|
|
|
@ -586,7 +586,7 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
,'pay_time'=>strtotime($payment_time)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$unPayData = SM("company_statement_info_part","tab_")
|
|
|
|
|
$unPayData = M("company_statement_info_part","tab_")
|
|
|
|
|
->field("sum(statement_money) statement_money,info_id")
|
|
|
|
|
->where(["pay_status"=>0])
|
|
|
|
|
->group("info_id")
|
|
|
|
@ -597,7 +597,7 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
$handleData[$value['info_id']] = $value['statement_money'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$payData = SM("company_statement_info_part","tab_")
|
|
|
|
|
$payData = M("company_statement_info_part","tab_")
|
|
|
|
|
->field("sum(statement_money) statement_money,info_id")
|
|
|
|
|
->group("info_id")
|
|
|
|
|
->select();
|
|
|
|
@ -613,11 +613,16 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
$time = date("Y-m-d H:i:s",time());
|
|
|
|
|
$unPayAmount = $value['statement_money']-$handlePayData[$value['id']];
|
|
|
|
|
$saveData['remark'] = $value['remark'];
|
|
|
|
|
|
|
|
|
|
$partInfo = M("company_statement_info_part","tab_")->where(['info_id'=>$value['id']])->order("id desc")->find();
|
|
|
|
|
$partCompanyInfo = json_decode($partInfo['company_info'],true);
|
|
|
|
|
$saveData['company_info'] = $partInfo['company_info'];
|
|
|
|
|
|
|
|
|
|
if($handleData[$value['id']]) {
|
|
|
|
|
$saveData['remark'] = "{$value['remark']} {$_SESSION['onethink_admin']['user_auth']['username']}于{$time}已打款{$handleData[$value['id']]},剩余{$unPayAmount}";
|
|
|
|
|
$saveData['remark'] .= ";{$_SESSION['onethink_admin']['user_auth']['username']}于{$time}向({$partCompanyInfo['payee_name']}/{$partCompanyInfo['opening_bank']}/{$partCompanyInfo['bank_account']})打款{$handleData[$value['id']]},剩余{$unPayAmount}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SM("company_statement_info_part","tab_")
|
|
|
|
|
M("company_statement_info_part","tab_")
|
|
|
|
|
->where(['info_id'=>$value['id'],'pay_status'=>['neq',1]])
|
|
|
|
|
->save(["pay_status"=>1,'pay_time'=>strtotime($payment_time)]);
|
|
|
|
|
|
|
|
|
@ -629,7 +634,8 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
"pay_status"=>1,
|
|
|
|
|
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time]),
|
|
|
|
|
"remark"=>$saveData['remark'],
|
|
|
|
|
'pay_time'=>strtotime($payment_time)
|
|
|
|
|
'pay_time'=>strtotime($payment_time),
|
|
|
|
|
'company_info'=>$partInfo['company_info']
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
$companyStatementInfo->where(['id'=>$value['id']])->save($saveData);
|
|
|
|
|