12.28功能提交

master
zhengyongxing 4 years ago
parent 08153a8359
commit eb8478fbb7

@ -276,19 +276,24 @@ class PaymentController extends BaseController
'pay_check_detail'=>'打款信息确认',
'pay_status_str'=>'打款状态',
'pay_time'=>'打款时间',];
$sum = M("pay_statement_info","tab_")
->alias('s')
->field("sum(if(s.pay_status=0,s.statement_money,0)) unpay_amount,sum(if(s.pay_status>0,s.statement_money,0)) pay_amount,sum(if(s.pay_status<0,s.statement_money,0)) faild_pay_amount")
->join("left join tab_company_statement_info c on s.statement_info_id = c.id")
->alias('c')
->field("sum(if(c.pay_status=0,c.statement_money,0)) unpay_amount,sum(if(c.pay_status>0,c.statement_money,0)) pay_amount,sum(if(c.pay_status<0,c.statement_money,0)) faild_pay_amount")
->join("left join tab_company_statement_info s on c.statement_info_id = s.id")
->where(['statement_info_id'=>['in',$id]])
->find();
// $sum = M("pay_statement_info","tab_")
// ->alias('s')
// ->field("sum(if(s.pay_status=0,s.statement_money,0)) unpay_amount,sum(if(s.pay_status>0,s.statement_money,0)) pay_amount,sum(if(s.pay_status<0,s.statement_money,0)) faild_pay_amount")
// ->join("left join tab_company_statement_info c on s.statement_info_id = c.id")
// ->where(['statement_info_id'=>['in',$id]])
// ->find();
$money = M("company_statement_info","tab_")->alias('s')->field("sum(statement_money) statement_money")->where(['s.id'=>['in',$id]])->find();
$sumData = [
'company_name'=>'合计',
'statement_time' => "待打款金额: {$money['statement_money']} 打款成功: {$sum['pay_amount']} 打款失败: {$sum['faild_pay_amount']}",
'statement_time' => "待打款金额: {$sum['unpay_amount']} 打款成功: {$sum['pay_amount']} 打款失败: {$sum['faild_pay_amount']}",
];
$data = array_merge($data,[$sumData]);

Loading…
Cancel
Save