diff --git a/app/adminapi/logic/contract/ContractNegotiationLogic.php b/app/adminapi/logic/contract/ContractNegotiationLogic.php index 13e91ec99..61a56be6a 100644 --- a/app/adminapi/logic/contract/ContractNegotiationLogic.php +++ b/app/adminapi/logic/contract/ContractNegotiationLogic.php @@ -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 {