diff --git a/Application/Admin/Controller/BusinessAffairsAwardController.class.php b/Application/Admin/Controller/BusinessAffairsAwardController.class.php index d86f1b3a2..150147eed 100644 --- a/Application/Admin/Controller/BusinessAffairsAwardController.class.php +++ b/Application/Admin/Controller/BusinessAffairsAwardController.class.php @@ -158,6 +158,8 @@ class BusinessAffairsAwardController extends ThinkController public function businessAffairsList() { + $check_quarter = ["03","06","09","12"]; + $map = []; $params = I('get.'); @@ -181,9 +183,12 @@ class BusinessAffairsAwardController extends ThinkController } $data = M("business_affairs_award_pool","tab_") - ->where($map) - ->page($page, $row) - ->select(); + ->where($map); + + if (!$_REQUEST['export']) { + $data->page($page, $row); + } + $data = $data->order("time desc")->select(); foreach ($data as $key => $value) { @@ -201,6 +206,16 @@ class BusinessAffairsAwardController extends ThinkController }else { $detail .= "
"; } + + $data[$key]['total_quarter_bonus_pool'] = $value['quarter_bonus_pool'] * 0.25; + + $time = date("m",strtotime($value['time'])); + if (!in_array($time,$check_quarter)) { + $data[$key]["quarter_award"] = "0.00"; + } + + $data[$key]['person_award'] = $data[$key]['quarter_award'] + $value['month_award']; + if ($value['verify_status']) { $data[$key]['verify_detail'] = $detail.date('Y-m-d H:i:s',$value['verify_time']); } else { @@ -218,7 +233,8 @@ class BusinessAffairsAwardController extends ThinkController 'ratio' => '抽成比例', 'game_belong_name' => '奖励归属', 'month_bonus_pool' => '本月奖金池总额', - 'quarter_bonus_pool' => '本季度累计激励', + 'total_quarter_bonus_pool'=>'本季度累计激励', + 'quarter_bonus_pool' => '个人发放激励', 'month_award' => '流水个人奖金', 'person_award' => '个人奖金总额', 'verify_detail' => '审批状态']; diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 9080bc505..db5119a88 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -1583,7 +1583,7 @@ class TimingController extends AdminController { $lasttime = [$time2,$time3]; $tempoparyData = M("spend","tab_") - ->field("tab_spend.*,from_unixtime(payed_time,'%Y-%m') time,from_unixtime(payed_time,'%Y') year,from_unixtime(payed_time,'%Y-%m') month,relation_game_id,relation_game_name,game_belong_id,game_belong_name") + ->field("tab_spend.*,from_unixtime(payed_time,'%Y-%m') time,from_unixtime(payed_time,'%Y') year,from_unixtime(payed_time,'%m') month,relation_game_id,relation_game_name,game_belong_id,game_belong_name") ->join("left join tab_game on tab_game.id=tab_spend.game_id") ->where(['tab_spend.pay_status'=>1,'game_belong_id'=>['neq',0],'pay_way' => ['egt', 0]]) ->select(false); @@ -1611,23 +1611,38 @@ class TimingController extends AdminController { ->where(['time'=>$time1]) ->find()['pay_amount']; //判断是不是初次 - $is_hav = M("business_affairs_award_pool","tab_")->where("time = {$time2}")->find(); + $is_hav = M("business_affairs_award_pool","tab_")->where(['time'=>$time2])->find(); - foreach ($data as $key => $value){ + $month_bonus_pool = 0; + $quarter_bonus_pool = 0; - echo "{$value['time']},{$value['game_belong_name']},{$value['pay_amount']}\n"; + foreach($data as $key => $value) { - $value['month_bonus_pool'] = $this->businessAffairRatio($value['pay_amount']); + $month_bonus_pool += $this->businessAffairRatio($value['pay_amount']); - $value['quarter_bonus_pool'] = $this->businessAffairRatio($value['pay_amount']); + $quarter_bonus_pool = $this->businessAffairRatio($value['pay_amount']); if ($is_hav) { for($i = (($value['month']%3)?(($value['month']%3)-1):2); $i > 0; $i--) { - $value['quarter_bonus_pool'] += - $this->businessAffairRatio($handleData[$value['year'].'-'.(($value['month']-$i)>0?($value['month']-$i):($value['month']-$i+12)).$value['game_belong_id'].$value['relation_game_id']]['pay_amount']); + + $date = date("Y-m",strtotime($value['year'].'-'.(($value['month']-$i)>0?($value['month']-$i):($value['month']-$i+12)))); + dump($date); + + $quarter_bonus_pool += + $this->businessAffairRatio($handleData[$date.$value['game_belong_id'].$value['relation_game_id']]['pay_amount']); } } + } + + + foreach ($data as $key => $value){ + + echo "{$value['time']},{$value['game_belong_name']},{$value['pay_amount']}\n"; + + $value['month_bonus_pool'] = $month_bonus_pool; + + $value['quarter_bonus_pool'] = $quarter_bonus_pool; unset($value['year']); unset($value['month']); diff --git a/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html b/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html index fd67f55b6..afdcb886a 100644 --- a/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html +++ b/Application/Admin/View/BusinessAffairsAward/businessAffairsList.html @@ -183,6 +183,7 @@ 奖金归属人 本月奖金池总额 本季度累计激励 + 个人发放激励 流水个人奖金 个人奖金总额 审批状态 @@ -206,6 +207,7 @@ {$data.ratio|default='--'} {$data.game_belong_name|default='无'} {$data.month_bonus_pool|default='0'} + {$data.total_quarter_bonus_pool|default='0'} {$data.quarter_award|default='0'} {$data.month_award|default='0'} {$data.person_award|default='0'}