@ -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,