|
@@ -92,6 +92,7 @@ class InvoiceOrder extends Base{
|
|
|
Log::info('InvoiceOrder跟后数据orderIn:cgd:'. $cgdinfo->winv_fee."----".$fee);
|
|
|
if(!$cgdinfo->isEmpty() && $cgdinfo->winv_fee>=strval($fee)){
|
|
|
$cgdinfo->winv_fee = bcsub($cgdinfo->winv_fee,strval($fee),2);
|
|
|
+ $cgdinfo->inv_status=2;
|
|
|
$cgdinfo->save();
|
|
|
}else throw new \Exception("关联金额{$fee}大于采购单{$code}未开票金额{$cgdinfo->winv_fee}");
|
|
|
$payinfo = PayInfo::where(['cgdNo'=>$code,'status'=>1,'is_del'=>0])->findOrEmpty();
|
|
@@ -101,6 +102,7 @@ class InvoiceOrder extends Base{
|
|
|
if(!$pay->isEmpty() && $pay->winv_fee>=strval($fee)){
|
|
|
$pay->winv_fee=bcsub($pay->winv_fee,strval($fee),2);
|
|
|
$pay->inv_fee = bcadd($pay->inv_fee,strval($fee),2);
|
|
|
+ $pay->inv_status=2;
|
|
|
$pay->save();
|
|
|
}else throw new \Exception("关联金额{$fee}大于对账单{$payinfo->payNo}未开票金额{$pay->winv_fee}");
|
|
|
}
|
|
@@ -118,6 +120,7 @@ class InvoiceOrder extends Base{
|
|
|
if(!$pay->isEmpty() && $pay->inv_fee>=strval($fee)){
|
|
|
$pay->winv_fee=bcadd($pay->winv_fee,strval($fee),2);
|
|
|
$pay->inv_fee = bcsub($pay->inv_fee,strval($fee),2);
|
|
|
+ $pay->inv_status=$pay->ainv_fee==0 && $pay->inv_fee==0?1:2;
|
|
|
$pay->save();
|
|
|
}else throw new \Exception("关联金额{$fee}大于对账单{$payinfo->payNo}开票中金额{$pay->winv_fee}");
|
|
|
}
|
|
@@ -127,7 +130,7 @@ class InvoiceOrder extends Base{
|
|
|
$cgdinfo = CgdInfo::where(['sequenceNo'=>$code])->findOrEmpty();
|
|
|
if(!$cgdinfo->isEmpty()){
|
|
|
$cgdinfo->ainv_fee = bcadd($cgdinfo->ainv_fee,strval($fee),2);
|
|
|
- $cgdinfo->inv_status = $cgdinfo->ainv_fee==$cgdinfo->totalPrice&& $cgdinfo->winv_fee==0 ?3:2;
|
|
|
+ $cgdinfo->inv_status = $cgdinfo->ainv_fee==$cgdinfo->totalPrice-$cgdinfo->inv_tag_fe&& $cgdinfo->winv_fee==0 ?3:2;
|
|
|
$cgdinfo->save();
|
|
|
}
|
|
|
$payinfo = PayInfo::where(['cgdNo'=>$code,'status'=>1,'is_del'=>0])->findOrEmpty();
|
|
@@ -146,7 +149,7 @@ class InvoiceOrder extends Base{
|
|
|
if(!$cgdinfo->isEmpty()){
|
|
|
$cgdinfo->winv_fee = bcadd($cgdinfo->winv_fee,strval($fee),2);
|
|
|
$cgdinfo->ainv_fee = bcsub($cgdinfo->ainv_fee,strval($fee),2);
|
|
|
- $cgdinfo->inv_status = $cgdinfo->ainv_fee==0 && $cgdinfo->winv_fee==$cgdinfo->totalPrice?1:2;
|
|
|
+ $cgdinfo->inv_status = $cgdinfo->ainv_fee==0 && $cgdinfo->winv_fee==$cgdinfo->totalPrice-$cgdinfo->inv_tag_fee?1:2;
|
|
|
$cgdinfo->save();
|
|
|
}
|
|
|
$payinfo = PayInfo::where(['cgdNo'=>$code,'status'=>1,'is_del'=>0])->findOrEmpty();
|
|
@@ -155,7 +158,7 @@ class InvoiceOrder extends Base{
|
|
|
if(!$pay->isEmpty()){
|
|
|
$pay->winv_fee=bcadd($pay->winv_fee,strval($fee),2);
|
|
|
$pay->ainv_fee = bcsub($pay->ainv_fee,strval($fee),2);
|
|
|
- $pay->inv_status = $pay->ainv_fee==0?1:2;
|
|
|
+ $pay->inv_status = $pay->winv_fee==0 && $pay->inv_fee==0?3:2;
|
|
|
$pay->save();
|
|
|
}
|
|
|
}
|