Commit 137aac13 by lizhilin

更新

parent 4b13a354
...@@ -77,10 +77,10 @@ public function getList(array $param) ...@@ -77,10 +77,10 @@ public function getList(array $param)
$list = []; $list = [];
DB::enableQueryLog(); DB::enableQueryLog();
$note_monitor = DB::table('covenant_receive_payment AS rp') $note_monitor = DB::table('lawyer as l')
->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount')) ->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount'))
//->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate']) //->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate'])
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id') ->leftJoin('covenant_receive_payment AS rp', 'rp.lawyer_id', '=', 'l.id')
->whereNull('rp.deleted_at'); ->whereNull('rp.deleted_at');
if ($number) { if ($number) {
$note_monitor = $note_monitor->where("l.number", $number); $note_monitor = $note_monitor->where("l.number", $number);
...@@ -155,9 +155,9 @@ public function getList(array $param) ...@@ -155,9 +155,9 @@ public function getList(array $param)
$tmp = []; $tmp = [];
//$tmp['id'] = $item->id; //$tmp['id'] = $item->id;
//已收款 //已收款
$receipt_money = $item->received_amount; //ModelCovenantReceivePayment::getReceivedMoney($item->lawyer_id, $year); $receipt_money = $item->received_amount;
//已开票 //已开票
$invoiced_money = $item->invoiced_money; //ModelCovenantReceivePayment::getInvoicedMoney($item->lawyer_id, $year); $invoiced_money = $item->invoiced_money;
//已收款未开票 //已收款未开票
$receipt_noinvoice = ($receipt_money - $invoiced_money) > 0 ? $receipt_money - $invoiced_money : 0; $receipt_noinvoice = ($receipt_money - $invoiced_money) > 0 ? $receipt_money - $invoiced_money : 0;
//已开票未收款 //已开票未收款
......
...@@ -106,10 +106,10 @@ public static function getTotalInfo($params, $received_at, $invoiced_at) ...@@ -106,10 +106,10 @@ public static function getTotalInfo($params, $received_at, $invoiced_at)
DB::enableQueryLog(); DB::enableQueryLog();
$list = []; $list = [];
$note_monitor = DB::table('covenant_receive_payment AS rp') $note_monitor = DB::table('lawyer as l')
->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount')) ->select(DB::raw('rp.lawyer_id,rp.year,l.number as lnumber,l.name as lname,l.commission_rate,sum(invoiced_money) as invoiced_money,sum(received_amount) as received_amount'))
//->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate']) //->select(['rp.*', 'l.name as lname', 'l.number as lnumber', 'l.commission_rate'])
->leftJoin('lawyer as l', 'rp.lawyer_id', '=', 'l.id') ->leftJoin('covenant_receive_payment AS rp', 'rp.lawyer_id', '=', 'l.id')
->whereNull('rp.deleted_at'); ->whereNull('rp.deleted_at');
if ($lnum) { if ($lnum) {
$note_monitor = $note_monitor->where("l.number", $lnum); $note_monitor = $note_monitor->where("l.number", $lnum);
...@@ -183,6 +183,8 @@ public static function getTotalInfo($params, $received_at, $invoiced_at) ...@@ -183,6 +183,8 @@ public static function getTotalInfo($params, $received_at, $invoiced_at)
'payable_commission' => 0, 'payable_commission' => 0,
]; ];
$list = $note_monitor->limit(1000)->groupBy('rp.lawyer_id')->get()->toArray(); $list = $note_monitor->limit(1000)->groupBy('rp.lawyer_id')->get()->toArray();
//$queries = DB::getQueryLog();
foreach ($list as $item) { foreach ($list as $item) {
$lawyerObj = Lawyer::find($item->lawyer_id); $lawyerObj = Lawyer::find($item->lawyer_id);
//已收款 //已收款
......
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