Merge pull request 'feature/update_payment' (#42) from feature/update_payment into release

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/42
master
郑永星 4 years ago
commit db487f1033

@ -249,7 +249,7 @@ class PaymentController extends BaseController
$company_info = json_decode($value['company_info'],true);
$data[$key]['ali_user'] = $company_info['ali_user'];
$data[$key]['ali_account'] = $company_info['ali_account'];
$data[$key]['statement_time'] = date("Y-m-d H:i:s",$value['statement_begin_time']).'-'.date("Y-m-d H:i:s",$value['statement_end_time']);
$data[$key]['statement_time'] = date("Y-m-d",$value['statement_begin_time']).'-'.date("Y-m-d",$value['statement_end_time']);
if($value['pay_check'] == 0){
$v['pay_check_detail'] = "--";
@ -266,6 +266,7 @@ class PaymentController extends BaseController
}
$title = [
'num'=>'序号',
'company_name' => '公司名称',
'statement_time' => '结算时间',
'statement_money' => '结算金额',
@ -276,22 +277,31 @@ 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();
$money = M("company_statement_info","tab_")->alias('s')->field("sum(statement_money) statement_money")->where(['s.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();
$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]);
foreach($data as $key => $value) {
$data[$key]['num'] = $key + 1;
}
// dump($data);die();
data2csv($data,'线上打款',$title);
// $this->ajaxReturn(['stauts'=>1,'msg'=>'导出成功']);

Loading…
Cancel
Save