|
|
@@ -206,9 +206,9 @@ class PerformanceLogic extends BaseLogic
|
|
|
// 前工单
|
|
|
$serviceWork = ServiceWork::where('id',$orderEffectiveLog->work_id)->findOrEmpty();
|
|
|
if($serviceWork->master_worker_id != $work->master_worker_id){
|
|
|
- // 扣掉 原工单工程师的提成+质保金 + 惩罚金额 to 新工程师余额
|
|
|
+ // 扣掉 原工单工程师的提成+质保金 to 新工程师余额 + 惩罚金额
|
|
|
$income_fee = \app\adminapi\logic\effective\OrderEffectiveLogLogic::commissionAndAssuranceDeposit($serviceWork);
|
|
|
- $new_amount = $income_fee + $orderEffectiveLog->penalty_amount;
|
|
|
+ $new_amount = bcadd((string)$income_fee,(string)$orderEffectiveLog->penalty_amount,2);
|
|
|
|
|
|
$remark = '工单号:'.$work->work_sn.',扣除金额:'.$new_amount.',扣除原因:保修工单新工程师收益';
|
|
|
RetentionMoneyLogic::refundRetention([
|
|
|
@@ -218,10 +218,21 @@ class PerformanceLogic extends BaseLogic
|
|
|
'amount'=>$new_amount
|
|
|
],false);
|
|
|
|
|
|
- $remark = '保修单结算-工单号:'.$work->work_sn.',收益金额:'.$new_amount.',原因:保修工单新工程师收益';
|
|
|
- WorkerAccountLogLogic::addAccountLog($work,$new_amount,WorkerAccountLogEnum::UM_INC_ADMIN,WorkerAccountLogEnum::INC,$remark);
|
|
|
+ // 新工程师收益: 原工单工程师的提成+质保金
|
|
|
+ $remark = '保修单结算-工单号:'.$work->work_sn.',收益金额:'.$income_fee.',原因:保修工单新工程师收益';
|
|
|
+ WorkerAccountLogLogic::addAccountLog($work,$income_fee,WorkerAccountLogEnum::UM_INC_ADMIN,WorkerAccountLogEnum::INC,$remark);
|
|
|
|
|
|
Log::info('effectivePerformance:'.$remark);
|
|
|
+ }else{
|
|
|
+ $new_amount = $orderEffectiveLog->penalty_amount;
|
|
|
+
|
|
|
+ $remark = '工单号:'.$work->work_sn.',扣除金额:'.$new_amount.',扣除原因:保修工单原工程师差额|罚金';
|
|
|
+ RetentionMoneyLogic::refundRetention([
|
|
|
+ 'remark'=>$remark,
|
|
|
+ 'work_id'=>$work->id,
|
|
|
+ 'worker_id'=>$serviceWork->master_worker_id,
|
|
|
+ 'amount'=>$new_amount
|
|
|
+ ],false);
|
|
|
}
|
|
|
$orderEffectiveLog->effective_status = 3;
|
|
|
$orderEffectiveLog->save();
|