Commit 9dd72064 by lizhilin

更新

parent 584bad92
...@@ -36,7 +36,7 @@ protected function grid() ...@@ -36,7 +36,7 @@ protected function grid()
return sprintf('%.2f', $paid_amount); return sprintf('%.2f', $paid_amount);
}); });
$grid->column('posting_tickets_money', '贴票金额')->display(function () use ($year) { $grid->column('posting_tickets_money', '贴票金额')->display(function () use ($year) {
$tickets_money = ModelLawyerCost::getPostingTicketsMoney($this->id, $year, $this->commission_rate, $this->ticket_ratio); $tickets_money = ModelLawyerCost::getAllPostingTicketsMoney($this->id, $year);
return $tickets_money; return $tickets_money;
}); });
$grid->column('commission_retention', '预留结案费')->display(function () use ($year) { $grid->column('commission_retention', '预留结案费')->display(function () use ($year) {
......
...@@ -223,22 +223,14 @@ public static function getPostingTicketsMoney($lawyer_id, $year, $commission_rat ...@@ -223,22 +223,14 @@ public static function getPostingTicketsMoney($lawyer_id, $year, $commission_rat
public static function getAllPostingTicketsMoney($lawyer_id, $year) public static function getAllPostingTicketsMoney($lawyer_id, $year)
{ {
$total = 0; $total = 0;
$where = []; $lawyerObj = Lawyer::find($lawyer_id);
if ($lawyer_id) { $commission_rate = $lawyerObj->commission_rate;
$where['id'] = $lawyer_id; $ticket_ratio = $lawyerObj->ticket_ratio;
} $monthArr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
$result = DB::table('lawyer')->select(['id', 'number', 'commission_rate', 'ticket_ratio']) foreach ($monthArr as $m) {
->where($where)
->limit(1500)
->get();
if ($result->toArray()) {
foreach ($result as $item) {
$lawyer_id = $item->id;
$commission_rate = $item->commission_rate;
$ticket_ratio = $item->ticket_ratio;
$ticket = 0; $ticket = 0;
$received_money = CovenantReceivePayment::getReceivedMoney($lawyer_id, $year); //创收已收款 $received_money = CovenantReceivePayment::getReceivedMoney($lawyer_id, $year, $m); //创收已收款
$paid_amount = LawyerCost::getPaidAmount($lawyer_id, $year); //已支付款项 $paid_amount = LawyerCost::getPaidAmount($lawyer_id, $year, $m); //已支付款项
$commission = $received_money * ($commission_rate / 100); //提成 $commission = $received_money * ($commission_rate / 100); //提成
if ($commission_rate == 80) { if ($commission_rate == 80) {
if ($commission > 300000) { if ($commission > 300000) {
...@@ -255,7 +247,7 @@ public static function getAllPostingTicketsMoney($lawyer_id, $year) ...@@ -255,7 +247,7 @@ public static function getAllPostingTicketsMoney($lawyer_id, $year)
} }
$total += $ticket; $total += $ticket;
} }
}
return $total; return $total;
} }
......
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