This commit is contained in:
weiz 2024-01-22 19:11:41 +08:00
parent 5e75ea317b
commit 8b52125968
3 changed files with 4 additions and 5 deletions

View File

@ -43,11 +43,9 @@ class QuotationLogic extends BaseLogic
*/
public static function add(array $params): bool
{
$amount_including_tax = 0;
$quotation_detail = $params['quotation_detail'];
$tax_rate_dict = DictData::where('type_value','tax_rate')->column('name','value');
foreach($quotation_detail as &$v){
$amount_including_tax += $v['num'] * $v['tax_inclusive_price'];
$v['tax_inclusive_amount'] = $v['num'] * $v['tax_inclusive_price'];
$v['tax_exclusive_amount'] = $v['num'] * $v['tax_inclusive_price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100);
}
@ -75,8 +73,8 @@ class QuotationLogic extends BaseLogic
'num' => $item['num'],
'tax_rate' => $item['tax_rate'],
'tax_inclusive_price' => $item['tax_inclusive_price'],
'tax_inclusive_amount' => $item['tax_inclusive_amount'],
'tax_exclusive_amount' => $item['tax_exclusive_amount'],
'tax_inclusive_amount' => $item['tax_inclusive_price'] * $item['num'],
'tax_exclusive_amount' => $item['tax_inclusive_price'] * $item['num'] * (1- $tax_rate_dict[$item['tax_rate']] / 100),
'remark' => $item['remark'] ?? ''
]);
}

View File

@ -91,4 +91,5 @@ class ProcurementContractDetailValidate extends BaseValidate
return $this->only(['id']);
}
}

View File

@ -59,7 +59,7 @@ class Contract extends BaseModel
}
public function getAnnexAttr($value){
return !empty($value) ? json_decode($value,true) : null;
return !empty($value) ? json_decode($value,true) : '';
}
}