更新到账管理

This commit is contained in:
yaooo 2023-11-04 11:50:46 +08:00
parent abcf1dce71
commit 861b4cdca2
1 changed files with 2 additions and 2 deletions

View File

@ -183,7 +183,7 @@ class FinanceIncome extends ApiController
$param = get_params(); $param = get_params();
$this->uid = JWT_UID; $this->uid = JWT_UID;
//作废初始化发票到账数据 //作废初始化发票到账数据
$income =InvoiceIncome::where(['id'=>$param['id']])->find(); $income = InvoiceIncome::where(['id'=>$param['id']])->find();
$invoice = Invoice::where(['id'=>$income['inid']])->find(); $invoice = Invoice::where(['id'=>$income['inid']])->find();
if($income){ if($income){
$res = InvoiceIncome::where(['id'=>$param['id']])->update(['status'=>'6','update_time'=>time()]); $res = InvoiceIncome::where(['id'=>$param['id']])->update(['status'=>'6','update_time'=>time()]);
@ -193,7 +193,7 @@ class FinanceIncome extends ApiController
Invoice::where(['id'=>$income['inid']])->update(['is_cash'=>0,'enter_amount'=>0,'enter_time'=>0]); Invoice::where(['id'=>$income['inid']])->update(['is_cash'=>0,'enter_amount'=>0,'enter_time'=>0]);
} }
else if($income['amount']*100 < $invoice['amount']*100){ else if($income['amount']*100 < $invoice['amount']*100){
$incomeTotal=InvoiceIncome::where(['inid'=>$income['inid'],'status'=>1])->sum('amount'); $incomeTotal = InvoiceIncome::where(['inid'=>$income['inid'],'status'=>1])->sum('amount');
//发票部分到账 //发票部分到账
Invoice::where(['id'=>$income['inid']])->update(['is_cash'=>1,'enter_amount'=>$incomeTotal,'enter_time'=>time()]); Invoice::where(['id'=>$income['inid']])->update(['is_cash'=>1,'enter_amount'=>$incomeTotal,'enter_time'=>time()]);
} }