From 4307c6afa88fcc93c3514af4c2b856eedeb3f0f3 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 2 Aug 2021 16:34:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=81=E8=AE=B8=E7=BB=A9?= =?UTF-8?q?=E6=95=88=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 0fc66bcef..24d1dfe6c 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -44,6 +44,16 @@ class MarketPercentageController extends ThinkController parent::_initialize(); } + private function getCoefficient($pay_time,$admin_id) + { + if(!array_key_exists($pay_time,$this->coefficient)){ + return 1; + } + if(!array_key_exists($admin_id,$this->coefficient[$pay_time])){ + return 1; + } + return $this->coefficient[$pay_time][$admin_id]; + } public function index($row = 10, $p = 1) { @@ -766,7 +776,7 @@ class MarketPercentageController extends ThinkController foreach ($all_data as $key => $value) { $wait_amount[$value['admin_id'] . $value['pay_time'] . 'performance_commission'] = $value['wait_performance_commission']; - $wait_amount[$value['admin_id'] . $value['pay_time'] . 'achievement_bonus'] = $value['wait_achievement_commission'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1); + $wait_amount[$value['admin_id'] . $value['pay_time'] . 'achievement_bonus'] = $value['wait_achievement_commission'] * ( $this->getCoefficient($value['pay_time'],$value['admin_id']) ); } @@ -850,7 +860,7 @@ class MarketPercentageController extends ThinkController //维护奖金考核比例 $data[$key]['maintain_appraisal_bonuses_ratio'] = $market_percentage['maintain_appraisal_bonuses_ratio']; - $data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1; + $data[$key]['coefficient'] = $this->getCoefficient($value['pay_time'],$value['admin_id']); $month = date("m", strtotime($value['pay_time'])); $yes = date("Y", strtotime($value['pay_time'])); @@ -858,10 +868,10 @@ class MarketPercentageController extends ThinkController $achievement_bonus = number_format($data[$key]['achievement_bonus'], 2, '.', ''); //绩效系数计算 - $data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1), 2, '.', ''); + $data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->getCoefficient($value['pay_time'],$value['admin_id'])), 2, '.', ''); $data[$key]['commission'] = number_format($data[$key]['performance_commission'] + $data[$key]['achievement_bonus'], 2, '.', ''); - $data[$key]['wait_commission'] = number_format($value['wait_performance_commission'] + $value['wait_achievement_commission'] * ($this->coefficient[$value['pay_time']][$value['admin_id']] ? $this->coefficient[$value['pay_time']][$value['admin_id']] : 1), 2, '.', ''); + $data[$key]['wait_commission'] = number_format($value['wait_performance_commission'] + $value['wait_achievement_commission'] * ($this->getCoefficient($value['pay_time'],$value['admin_id'])), 2, '.', ''); $data[$key]['extend_commission'] = $data[$key]['commission'] - $data[$key]['wait_commission']; // dump($data[$key]['commission']); @@ -921,7 +931,6 @@ class MarketPercentageController extends ThinkController $sum['wait_commission'] = '-------'; $sum['pay_time'] = '总计'; - // dd($data); if ($_REQUEST['export']) { $title = ['pay_time' => '时间',