提交 6f85a745 authored 作者: chengye's avatar chengye

调整明细细节

上级 580c95c6
...@@ -422,26 +422,26 @@ class Payment extends Base ...@@ -422,26 +422,26 @@ class Payment extends Base
if($this->checkFkStatus($post['payment_id'])) return json(['status'=>0,'message'=>'该缴费单已经创建付款单无法再次创建.']); if($this->checkFkStatus($post['payment_id'])) return json(['status'=>0,'message'=>'该缴费单已经创建付款单无法再次创建.']);
$account = EmAccount::get(['account_id'=>$payment->account_id]);
$em = \app\em\model\Em::with('rule')->get($account->em_id);
$station = (new \app\em\model\Em)->getBaseInfo($account->em_id);
if($user['is_admin']) $staffName = 'admin'; if($user['is_admin']) $staffName = 'admin';
else $staffName = substr($staff->email,0,strpos($staff->email,'@')); else $staffName = substr($staff->email,0,strpos($staff->email,'@'));
$invs = (new EmPayment())->getinvsInfo($payment->payment_id); $invs = (new EmPayment())->getinvsInfo($payment->payment_id);
$amount = 0;
foreach ($invs as $inv){ $details = [];
foreach ($invs as $k => $inv){
$details[$k]['chargeType'] = "维护电费";
if($inv->payment_balance == 0){ if($inv->payment_balance == 0){
$amount += 0; $details[$k]['amount'] = 0;
} else if($inv->payment_amount == $inv->payment_balance){ } else if($inv->payment_amount == $inv->payment_balance){
$amount += $inv->payment_amount; $details[$k]['amount'] = $inv->payment_amount;
} else { } else {
$amount += $inv->payment_amount - $inv->payment_balance; $details[$k]['amount'] = $inv->payment_amount - $inv->payment_balance;
} }
$details[$k]['projectNumber'] = $this->getCbzxCode($inv->account_id);
$details[$k]['contractNumber'] = $this->getEmContract($inv->account_id);
$details[$k]['receipt'] = '';
} }
$amount = round($amount,2);
$data = [ $data = [
'title'=>$post['title'], 'title'=>$post['title'],
...@@ -454,15 +454,7 @@ class Payment extends Base ...@@ -454,15 +454,7 @@ class Payment extends Base
'remarks'=>$post['remark'], 'remarks'=>$post['remark'],
'type'=>2, 'type'=>2,
'date'=>$post['date'], 'date'=>$post['date'],
'details'=>[ 'details'=> $details
[
'chargeType'=>"维护电费",
'amount'=> $amount,
'projectNumber'=> $station->proj_number,
'contractNumber'=> $em->rule->pay_protocol_numb,
'receipt'=>''
]
]
]; ];
foreach ($data as $k => $v){ foreach ($data as $k => $v){
...@@ -534,4 +526,6 @@ class Payment extends Base ...@@ -534,4 +526,6 @@ class Payment extends Base
$res = (new EmPaymentFk())->get(['payment_id'=>$payment_id]); $res = (new EmPaymentFk())->get(['payment_id'=>$payment_id]);
return $res ? true : false; return $res ? true : false;
} }
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论