Commit 3448404d by lizhilin

更新

parent 6519034e
...@@ -47,7 +47,7 @@ protected function grid() ...@@ -47,7 +47,7 @@ protected function grid()
return self::getAnnuity($this->number, $year); return self::getAnnuity($this->number, $year);
}); });
$grid->column('posting_tickets_fee', '贴票成本')->display(function ($val) use ($year) { $grid->column('posting_tickets_fee', '贴票成本')->display(function ($val) use ($year) {
return ModelLawyerCost::getPostingTicketsMoney($this->id, $year, $this->commission_rate, $this->ticket_ratio); return ModelLawyerCost::getAllPostingTicketsMoney($this->id, $year);
}); });
$grid->column('assistant_fee', '助理律师成本')->display(function ($val) use ($year) { $grid->column('assistant_fee', '助理律师成本')->display(function ($val) use ($year) {
return self::getAssistantFee($this->number, $year); return self::getAssistantFee($this->number, $year);
......
...@@ -85,21 +85,7 @@ public function getList(array $param) ...@@ -85,21 +85,7 @@ public function getList(array $param)
//->select(['rp.cid', 'c.cname', 'c.ctype', 'c.number as cnum', 'c.principal', 'l.number as lnum', 'l.name as lname', 'sum(invoiced_money) as invoiced_money']) //->select(['rp.cid', 'c.cname', 'c.ctype', 'c.number as cnum', 'c.principal', 'l.number as lnum', 'l.name as lname', 'sum(invoiced_money) as invoiced_money'])
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id'); ->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id');
if ($lnum) {
$note_monitor = $note_monitor->where("l.number", $lnum);
}
if ($lname) {
$note_monitor = $note_monitor->where("l.name", $lname);
}
if ($cnum) {
$note_monitor = $note_monitor->where("c.number", $cnum);
}
if ($ctype) {
$note_monitor = $note_monitor->where("c.ctype", $ctype);
}
if ($principal) {
$note_monitor = $note_monitor->where("c.principal", $principal);
}
if ($invoiced_at['start'] && $received_at['start']) { if ($invoiced_at['start'] && $received_at['start']) {
$in_start = $invoiced_at['start'] ?? ''; $in_start = $invoiced_at['start'] ?? '';
$in_end = $invoiced_at['end'] ?? ''; $in_end = $invoiced_at['end'] ?? '';
...@@ -108,17 +94,17 @@ public function getList(array $param) ...@@ -108,17 +94,17 @@ public function getList(array $param)
if ($in_start && $re_start) { if ($in_start && $re_start) {
if ($in_end && $re_end) { if ($in_end && $re_end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end]) $note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end])
->whereBetween('rp.invoiced_at', [$in_start, $in_end]); ->orWhereBetween('rp.invoiced_at', [$in_start, $in_end]);
} else { } else {
if ($in_end) { if ($in_end) {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start) $note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start)
->whereBetween('rp.invoiced_at', [$in_start, $in_end]); ->orWhereBetween('rp.invoiced_at', [$in_start, $in_end]);
} elseif ($re_end) { } elseif ($re_end) {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereBetween('rp.received_at', [$re_start, $re_end]); ->orWhereBetween('rp.received_at', [$re_start, $re_end]);
} else { } else {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereDate('rp.received_at', '>', $re_start); ->orWhereDate('rp.received_at', '>', $re_start);
} }
} }
} }
...@@ -146,6 +132,21 @@ public function getList(array $param) ...@@ -146,6 +132,21 @@ public function getList(array $param)
} }
} }
} }
if ($lnum) {
$note_monitor = $note_monitor->having("lnum", $lnum);
}
if ($lname) {
$note_monitor = $note_monitor->having("lname", $lname);
}
if ($cnum) {
$note_monitor = $note_monitor->having("cnum", $cnum);
}
if ($ctype) {
$note_monitor = $note_monitor->having("ctype", $ctype);
}
if ($principal) {
$note_monitor = $note_monitor->having("principal", $principal);
}
// 计算列表总数 // 计算列表总数
$count = 0; $count = 0;
$cObj = $note_monitor->groupBy('rp.cid')->get(); $cObj = $note_monitor->groupBy('rp.cid')->get();
...@@ -155,13 +156,14 @@ public function getList(array $param) ...@@ -155,13 +156,14 @@ public function getList(array $param)
// 获取列表 // 获取列表
$data = []; $data = [];
$list = $note_monitor->groupBy('rp.cid') $list = $note_monitor->groupBy('rp.cid')->limit($prePage)
->limit($prePage)
->offset($offset_start) ->offset($offset_start)
->get() ->get()
->toArray(); ->toArray();
//$queries = DB::getQueryLog(); $queries = DB::getQueryLog();
// echo "<pre>";
// print_r($queries);
// die;
foreach ($list as $key => $item) { foreach ($list as $key => $item) {
$tmp = []; $tmp = [];
......
...@@ -474,21 +474,7 @@ public static function getTotalReceivedAmount($params, $received_at, $invoiced_a ...@@ -474,21 +474,7 @@ public static function getTotalReceivedAmount($params, $received_at, $invoiced_a
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id') ->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id')
->where('rp.rtype', 1); ->where('rp.rtype', 1);
if ($lnum) {
$note_monitor = $note_monitor->where("l.number", $lnum);
}
if ($lname) {
$note_monitor = $note_monitor->where("l.name", $lname);
}
if ($cnum) {
$note_monitor = $note_monitor->where("c.number", $cnum);
}
if ($ctype) {
$note_monitor = $note_monitor->where("c.ctype", $ctype);
}
if ($principal) {
$note_monitor = $note_monitor->where("c.principal", $principal);
}
if ($invoiced_at['start'] && $received_at['start']) { if ($invoiced_at['start'] && $received_at['start']) {
$in_start = $invoiced_at['start'] ?? ''; $in_start = $invoiced_at['start'] ?? '';
$in_end = $invoiced_at['end'] ?? ''; $in_end = $invoiced_at['end'] ?? '';
...@@ -497,17 +483,17 @@ public static function getTotalReceivedAmount($params, $received_at, $invoiced_a ...@@ -497,17 +483,17 @@ public static function getTotalReceivedAmount($params, $received_at, $invoiced_a
if ($in_start && $re_start) { if ($in_start && $re_start) {
if ($in_end && $re_end) { if ($in_end && $re_end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end]) $note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end])
->whereBetween('rp.invoiced_at', [$in_start, $in_end]); ->orWhereBetween('rp.invoiced_at', [$in_start, $in_end]);
} else { } else {
if ($in_end) { if ($in_end) {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start) $note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start)
->whereBetween('rp.invoiced_at', [$in_start, $in_end]); ->orWhereBetween('rp.invoiced_at', [$in_start, $in_end]);
} elseif ($re_end) { } elseif ($re_end) {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereBetween('rp.received_at', [$re_start, $re_end]); ->orWhereBetween('rp.received_at', [$re_start, $re_end]);
} else { } else {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereDate('rp.received_at', '>', $re_start); ->orWhereDate('rp.received_at', '>', $re_start);
} }
} }
} }
...@@ -536,6 +522,21 @@ public static function getTotalReceivedAmount($params, $received_at, $invoiced_a ...@@ -536,6 +522,21 @@ public static function getTotalReceivedAmount($params, $received_at, $invoiced_a
} }
} }
if ($lnum) {
$note_monitor = $note_monitor->having("lnum", $lnum);
}
if ($lname) {
$note_monitor = $note_monitor->having("lname", $lname);
}
if ($cnum) {
$note_monitor = $note_monitor->having("cnum", $cnum);
}
if ($ctype) {
$note_monitor = $note_monitor->having("ctype", $ctype);
}
if ($principal) {
$note_monitor = $note_monitor->having("principal", $principal);
}
// 计算列表总数 // 计算列表总数
$total = 0; $total = 0;
$list = $note_monitor->groupBy('rp.cid')->get(); $list = $note_monitor->groupBy('rp.cid')->get();
...@@ -567,21 +568,7 @@ public static function getTotalInvoicedMoney($params, $received_at, $invoiced_at ...@@ -567,21 +568,7 @@ public static function getTotalInvoicedMoney($params, $received_at, $invoiced_at
->leftJoin('covenant as c', 'rp.cid', '=', 'c.id') ->leftJoin('covenant as c', 'rp.cid', '=', 'c.id')
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id') ->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id')
->where('rp.rtype', 2); ->where('rp.rtype', 2);
if ($lnum) {
$note_monitor = $note_monitor->where("l.number", $lnum);
}
if ($lname) {
$note_monitor = $note_monitor->where("l.name", $lname);
}
if ($cnum) {
$note_monitor = $note_monitor->where("c.number", $cnum);
}
if ($ctype) {
$note_monitor = $note_monitor->where("c.ctype", $ctype);
}
if ($principal) {
$note_monitor = $note_monitor->where("c.principal", $principal);
}
if ($invoiced_at['start'] && $received_at['start']) { if ($invoiced_at['start'] && $received_at['start']) {
$in_start = $invoiced_at['start'] ?? ''; $in_start = $invoiced_at['start'] ?? '';
$in_end = $invoiced_at['end'] ?? ''; $in_end = $invoiced_at['end'] ?? '';
...@@ -590,17 +577,17 @@ public static function getTotalInvoicedMoney($params, $received_at, $invoiced_at ...@@ -590,17 +577,17 @@ public static function getTotalInvoicedMoney($params, $received_at, $invoiced_at
if ($in_start && $re_start) { if ($in_start && $re_start) {
if ($in_end && $re_end) { if ($in_end && $re_end) {
$note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end]) $note_monitor = $note_monitor->whereBetween('rp.received_at', [$re_start, $re_end])
->whereBetween('rp.invoiced_at', [$in_start, $in_end]); ->orWhereBetween('rp.invoiced_at', [$in_start, $in_end]);
} else { } else {
if ($in_end) { if ($in_end) {
$note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start) $note_monitor = $note_monitor->whereDate('rp.received_at', '>', $re_start)
->whereBetween('rp.invoiced_at', [$in_start, $in_end]); ->orWhereBetween('rp.invoiced_at', [$in_start, $in_end]);
} elseif ($re_end) { } elseif ($re_end) {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereBetween('rp.received_at', [$re_start, $re_end]); ->orWhereBetween('rp.received_at', [$re_start, $re_end]);
} else { } else {
$note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start) $note_monitor = $note_monitor->whereDate('rp.invoiced_at', '>', $in_start)
->whereDate('rp.received_at', '>', $re_start); ->orWhereDate('rp.received_at', '>', $re_start);
} }
} }
} }
...@@ -629,6 +616,21 @@ public static function getTotalInvoicedMoney($params, $received_at, $invoiced_at ...@@ -629,6 +616,21 @@ public static function getTotalInvoicedMoney($params, $received_at, $invoiced_at
} }
} }
if ($lnum) {
$note_monitor = $note_monitor->having("lnum", $lnum);
}
if ($lname) {
$note_monitor = $note_monitor->having("lname", $lname);
}
if ($cnum) {
$note_monitor = $note_monitor->having("cnum", $cnum);
}
if ($ctype) {
$note_monitor = $note_monitor->having("ctype", $ctype);
}
if ($principal) {
$note_monitor = $note_monitor->having("principal", $principal);
}
// 计算列表总数 // 计算列表总数
$total = 0; $total = 0;
$list = $note_monitor->groupBy('rp.cid')->get(); $list = $note_monitor->groupBy('rp.cid')->get();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment