This commit is contained in:
weiz 2024-02-03 09:38:08 +08:00
parent aa0e450e64
commit e36b200806

View File

@ -45,7 +45,7 @@ class ContractNegotiationLogic extends BaseLogic
public static function add(array $params): bool
{
$contract = Contract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty();
$profit = $params['negotiation_amount'] - ($params['labor_costs'] + $params['material_costs']);
$profit = $params['negotiation_amount'] - (($params['labor_costs']??0) + ($params['material_costs']??0));
$profit_rate = $profit / $params['negotiation_amount'];
Db::startTrans();
try {
@ -89,7 +89,7 @@ class ContractNegotiationLogic extends BaseLogic
public static function edit(array $params): bool
{
$contract = Contract::field('project_id')->where('id',$params['contract_id'])->findOrEmpty();
$profit = $params['negotiation_amount'] - ($params['labor_costs'] + $params['material_costs']);
$profit = $params['negotiation_amount'] - (($params['labor_costs']??0) + ($params['material_costs']??0));
$profit_rate = $profit / $params['negotiation_amount'];
Db::startTrans();
try {