修改下游个人聚合

master
chenzhi 5 years ago
parent a3633ea52e
commit c6f4149d6a

@ -459,6 +459,7 @@ class CompanyStatementSetController extends Controller {
$statement_begin_time = date("Y-m-d",$begintime); $statement_begin_time = date("Y-m-d",$begintime);
$statement_end_time = date("Y-m-d",$endtime); $statement_end_time = date("Y-m-d",$endtime);
$RewardRecord = M("RewardRecord","tab_");
foreach($pcList as $k=>$v){ foreach($pcList as $k=>$v){
$add_data=[]; $add_data=[];
//1.获取甲乙方信息 //1.获取甲乙方信息
@ -498,6 +499,8 @@ class CompanyStatementSetController extends Controller {
$company_belong = $pc[$add_data['company_id']]['company_belong']; $company_belong = $pc[$add_data['company_id']]['company_belong'];
$add_data['company_belong']=$company_belong; $add_data['company_belong']=$company_belong;
$add_data['company_type']=$pc[$add_data['company_id']]['company_type']; $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){ foreach($v['list'] as $ke=>$va){
$game =[]; $game =[];
@ -522,8 +525,25 @@ class CompanyStatementSetController extends Controller {
$game['ratio']=$tratio; $game['ratio']=$tratio;
} }
$add_data['pay_amount'] += $va['pay_amount']; $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']; $add_data['statement_money'] += $game['sum_money'];
@ -536,8 +556,8 @@ class CompanyStatementSetController extends Controller {
} }
$add_data['platform_amount'] = $add_data['pay_amount']; $add_data['platform_amount'] = $add_data['pay_amount'];
if($type < 2){ if($type < 2 && !$is_pu){
//非补点奖罚 //非补点及不是个人
$rrmap = array( $rrmap = array(
"reward_time" => ['between', [$begintime,$endtime]], "reward_time" => ['between', [$begintime,$endtime]],
"company_type"=>2, "company_type"=>2,

Loading…
Cancel
Save