Commit 137aac13 by lizhilin

更新

parent 4b13a354
......@@ -77,10 +77,10 @@ public function getList(array $param)
$list = [];
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(['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');
if ($number) {
$note_monitor = $note_monitor->where("l.number", $number);
......@@ -155,9 +155,9 @@ public function getList(array $param)
$tmp = [];
//$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;
//已开票未收款
......
......@@ -106,10 +106,10 @@ public static function getTotalInfo($params, $received_at, $invoiced_at)
DB::enableQueryLog();
$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(['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');
if ($lnum) {
$note_monitor = $note_monitor->where("l.number", $lnum);
......@@ -183,6 +183,8 @@ public static function getTotalInfo($params, $received_at, $invoiced_at)
'payable_commission' => 0,
];
$list = $note_monitor->limit(1000)->groupBy('rp.lawyer_id')->get()->toArray();
//$queries = DB::getQueryLog();
foreach ($list as $item) {
$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