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' => '时间',