提交 fb68426c authored 作者: chengye's avatar chengye

缴费单作废之后删除关联账单关系

上级 1d997d44
......@@ -8,6 +8,7 @@
namespace app\api\controller\v2\common;
use app\em\controller\Account;
use app\em\controller\Invoice;
use app\em\controller\WriteOff;
use app\em\model\EmInvoice;
use app\em\model\EmPayment;
......@@ -32,6 +33,7 @@ class Payment
Log::record(date('Y-m-d H:i:s').' OA单号:'.$data['numb'].' 接口操作:单据状态更新');
return $this->update($data['numb'],$data['status'],$data['mes']);
} else {
Log::record(date('Y-m-d H:i:s').' OA单号:'.$data['numb'].' 接口操作:单据作废');
return $this->dropNumb($data['numb'],$data['status']);
}
}
......@@ -69,11 +71,20 @@ class Payment
$payment = (new EmPayment())->get(['payment_id' => $paymentFk->payment_id]);
$paymentFk->status = 0;
$paymentFk->save();
$payment->status = 9;
$payment->status = $status;
$payment->save();
//删除payment_invoice表
$delNum = (new EmPaymentInvoice())->where('payment_id', '=', $payment->payment_id)->delete();
$invoices = (new EmPaymentInvoice())->where('payment_id', '=', $payment->payment_id)->select();
//释放账单状态
if(!$invoices->is_empty()) {
$invObj = new Invoice();
foreach ($invoices as $inv) {
$invObj->statusBack($inv->invoice_id,$payment->payment_id);
}
}
Log::record(date('Y-m-d H:i:s').' OA单号:'.$numb. '缴费单已作废');
return json(
......
......@@ -413,4 +413,9 @@ class Invoice extends Base
return $msg;
}
public function statusBack($invoice_id,$payment_id){
$eModel = EmPaymentInvoice::get(['invoice_id'=>'$invoice_id','payment_id'=>$payment_id]);
$eModel->delete();
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论