|
|
|
@ -564,7 +564,7 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
$saveData = [
|
|
|
|
|
"pay_type"=>3,
|
|
|
|
|
"pay_status"=>1,
|
|
|
|
|
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time])
|
|
|
|
|
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time]),'pay_time'=>time()
|
|
|
|
|
];
|
|
|
|
|
if($info_id) {
|
|
|
|
|
$companyStatementInfo->where(['id'=>['in',$info_id]])->save($saveData);
|
|
|
|
@ -575,6 +575,7 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
"pay_type"=>3,
|
|
|
|
|
"pay_status"=>2,
|
|
|
|
|
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time])
|
|
|
|
|
,'pay_time'=>time()
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$unPayData = SM("company_statement_info_part","tab_")
|
|
|
|
@ -609,8 +610,8 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SM("company_statement_info_part","tab_")
|
|
|
|
|
->where(['info_id'=>$value['id']])
|
|
|
|
|
->save(["pay_status"=>1]);
|
|
|
|
|
->where(['info_id'=>$value['id'],'pay_status'=>['neq',1]])
|
|
|
|
|
->save(["pay_status"=>1,'pay_time'=>time()]);
|
|
|
|
|
|
|
|
|
|
if($value['statement_money'] - $handlePayData[$value['id']] <=0) {
|
|
|
|
|
//打款成功
|
|
|
|
@ -619,7 +620,8 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
"pay_type"=>3,
|
|
|
|
|
"pay_status"=>1,
|
|
|
|
|
"pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>$payment_time]),
|
|
|
|
|
"remark"=>$saveData['remark']
|
|
|
|
|
"remark"=>$saveData['remark'],
|
|
|
|
|
'pay_time'=>time()
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
$companyStatementInfo->where(['id'=>$value['id']])->save($saveData);
|
|
|
|
@ -707,7 +709,7 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
$CompanyInfo = M("company_statement_info","tab_")
|
|
|
|
|
->alias('i')
|
|
|
|
|
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money,i.pay_check")
|
|
|
|
|
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money,i.pay_check,pay_time")
|
|
|
|
|
->join("tab_company_statement_pool p ON p.id = i.pool_id")
|
|
|
|
|
->where("i.id in({$id}) and (pay_check=1 or pay_check=2)")
|
|
|
|
|
->select();
|
|
|
|
@ -718,7 +720,7 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
if ($CompanyInfo[0]['id']) {
|
|
|
|
|
$CompanyInfoSecord = M("company_statement_info_part","tab_")
|
|
|
|
|
->alias('i')
|
|
|
|
|
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money,i.pay_check")
|
|
|
|
|
->field("info_id id,i.pool_id,i.company_name,i.company_info,i.statement_money,i.remark,i.pay_status,i.verify_status,p.statement_num,i.statement_money,i.pay_check,pay_time")
|
|
|
|
|
->join("tab_company_statement_pool p ON p.id = i.pool_id")
|
|
|
|
|
->where("i.info_id ={$CompanyInfo[0]['id']}")
|
|
|
|
|
->select();
|
|
|
|
@ -727,7 +729,45 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
$CompanyInfo = $CompanyInfoSecord;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$all_money = 0;
|
|
|
|
|
|
|
|
|
|
$unPayData = SM("company_statement_info_part","tab_")
|
|
|
|
|
->field("sum(statement_money) statement_money,info_id")
|
|
|
|
|
->where(["pay_status"=>1,'info_id'=>['in',$_REQUEST['id']]])
|
|
|
|
|
->group("info_id")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$handleData = [];
|
|
|
|
|
foreach ($unPayData as $key => $value) {
|
|
|
|
|
$handleData[$value['info_id']] = $value['statement_money'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$payData = SM("company_statement_info","tab_")
|
|
|
|
|
->field("id,sum(statement_money) statement_money,pay_status")
|
|
|
|
|
->where(['id'=>['in',$_REQUEST['id']]])
|
|
|
|
|
->group("id")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$handleAllData = [];
|
|
|
|
|
foreach ($payData as $key => $value) {
|
|
|
|
|
$handleAllData[$value['id']] = $value['statement_money'];
|
|
|
|
|
}
|
|
|
|
|
// dump($payData);
|
|
|
|
|
|
|
|
|
|
$surplurAmount = array_sum($handleData);
|
|
|
|
|
$all_money = array_sum($handleAllData);
|
|
|
|
|
|
|
|
|
|
foreach ($payData as $key => $value) {
|
|
|
|
|
if ($value['pay_status'] == 1) {
|
|
|
|
|
$surplurAmount -= $handleData[$value['id']];
|
|
|
|
|
$surplurAmount += $value['statement_money'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sAmount = number_format($all_money-$surplurAmount,2,'.','');
|
|
|
|
|
|
|
|
|
|
foreach($CompanyInfo as $k=>&$v){
|
|
|
|
|
if($v['verify_status'] == 2){
|
|
|
|
|
$v['is_payment'] = 2;
|
|
|
|
@ -738,11 +778,13 @@ class CompanyStatementOfflineController extends ThinkController
|
|
|
|
|
$v['company_info'] = json_decode($v['company_info'],true);
|
|
|
|
|
$v['company_info']['ali_user'] ?? '';
|
|
|
|
|
$v['company_info']['ali_account'] ?? '';
|
|
|
|
|
$v['time'] = date("Y-m-d H:i:s",$v['pay_time']);
|
|
|
|
|
|
|
|
|
|
$all_money += $v['statement_money'];
|
|
|
|
|
// $all_money += $v['statement_money'];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign('surplur_amount',$sAmount);
|
|
|
|
|
$this->assign('all_money',$all_money);
|
|
|
|
|
$this->assign("CompanyInfo",$CompanyInfo);
|
|
|
|
|
$this->assign("id",$id);
|
|
|
|
|