From c6f4149d6a4b866cd5ae45e976f0ab507a99f154 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 9 Jun 2020 10:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E6=B8=B8=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E8=81=9A=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementSetController.class.php | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 9a8934d31..9ef0e726a 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -459,6 +459,7 @@ class CompanyStatementSetController extends Controller { $statement_begin_time = date("Y-m-d",$begintime); $statement_end_time = date("Y-m-d",$endtime); + $RewardRecord = M("RewardRecord","tab_"); foreach($pcList as $k=>$v){ $add_data=[]; //1.获取甲乙方信息 @@ -498,6 +499,8 @@ class CompanyStatementSetController extends Controller { $company_belong = $pc[$add_data['company_id']]['company_belong']; $add_data['company_belong']=$company_belong; $add_data['company_type']=$pc[$add_data['company_id']]['company_type']; + $is_pu = ($add_data['company_type'] == 1 ? false :true);//是否是个人 + //游戏统计 foreach($v['list'] as $ke=>$va){ $game =[]; @@ -522,8 +525,25 @@ class CompanyStatementSetController extends Controller { $game['ratio']=$tratio; } $add_data['pay_amount'] += $va['pay_amount']; + //判断是否是个人 + if($type < 2 && $is_pu){ + //非补点及是个人 + $rrmap = array( + "reward_time" => ['between', [$begintime,$endtime]], + "company_type"=>2, + "company_id"=>$add_data['company_id'], + "relation_game_id"=>$va['relation_game_id'] + ); + $rrfres =$RewardRecord->field("IFNULL(SUM(CASE WHEN reward_type = 1 THEN money ELSE 0 END),0) as reward_count,IFNULL(SUM(CASE WHEN reward_type = 2 THEN money ELSE 0 END),0) as fine_count")->where($rrmap)->find(); + $game['reward'] = $rrfres['reward_count']; + $game['fine'] = $rrfres['fine_count']; + + $game['sum_money']=round($va['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2)+$game['reward']-$game['fine']; + }else{ + $game['sum_money']=round($va['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率) + } + - $game['sum_money']=round($va['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率) $add_data['statement_money'] += $game['sum_money']; @@ -536,8 +556,8 @@ class CompanyStatementSetController extends Controller { } $add_data['platform_amount'] = $add_data['pay_amount']; - if($type < 2){ - //非补点奖罚 + if($type < 2 && !$is_pu){ + //非补点及不是个人 $rrmap = array( "reward_time" => ['between', [$begintime,$endtime]], "company_type"=>2,