From e36b200806b031dff3f3078c27258812bd27e1c4 Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Sat, 3 Feb 2024 09:38:08 +0800 Subject: [PATCH] fixed --- app/adminapi/logic/contract/ContractNegotiationLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 {