diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index aef05910e..30721e0d7 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -513,7 +513,7 @@ class CompanyStatementPoolController extends ThinkController } else { $val['sum_money'] = "=ROUND(K{$line}*(N{$line}),2)"; } - $v['statement_money'] .= "O{$line}+"; + $v['statement_money'] .= "S{$line}+"; }else{ $count['platform_amount'] += $val['pay_amount']; $count['week_money'] += $val['sum_money']; @@ -532,7 +532,8 @@ class CompanyStatementPoolController extends ThinkController if($is_export){ if($v['withdraw_type'] != 3) { - $v['statement_money'] .="P{$cline}-Q{$cline},2)"; +// $v['statement_money'] .="P{$cline}-Q{$cline},2)"; + $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1) . ",2)"; } else { $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)"; } @@ -542,8 +543,8 @@ class CompanyStatementPoolController extends ThinkController if($is_export){ $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)"; - $count["week_money"] = "=ROUND(SUM(R2:R".$line."),2)"; - $count["sum_money"] = "=ROUND(SUM(S2:S".$line."),2)"; + $count["week_money"] = "=ROUND(SUM(S2:S".$line."),2)"; + $count["sum_money"] = "=ROUND(SUM(T2:T".$line."),2)"; } // die(); $this->assign("data",$infolist); @@ -556,7 +557,7 @@ class CompanyStatementPoolController extends ThinkController $game_list = []; $old_line = $week_line; -// dump($statement_info); + //使用时间与会长账号作为键值分离数据 foreach($statement_info as $sk=>$sv){ @@ -568,7 +569,6 @@ class CompanyStatementPoolController extends ThinkController } } -// dump($game_list); $game_data = []; $handle_data = []; @@ -602,7 +602,6 @@ class CompanyStatementPoolController extends ThinkController } } -// $game_data['week_amount'] += $sv[0]['sum_money']; $game_data['game_list'] = $sv; array_push($handle_data,$game_data); @@ -611,12 +610,11 @@ class CompanyStatementPoolController extends ThinkController } } -// dump($handle_data); + $substract = 1; -// dump($game_list); -// dump($handle_data); + //添加周结算金额,合并相同的结算时间 -// dump($handle_data); + foreach($handle_data as $hk => $hv) { if($hk > 0) { @@ -630,12 +628,7 @@ class CompanyStatementPoolController extends ThinkController } } -// if ( -//// $hv['account'] == 'zj9587' || -// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') { -// dump($handle_data); -// } -// dump($hv); + if ($hv['time'] == $handle_data[$hk-$substract]['time']) { $handle_data[$hk-$substract]['time_row'] += $handle_data[$hk]['time_row']; @@ -650,15 +643,11 @@ class CompanyStatementPoolController extends ThinkController } } -// $substract = 0; + foreach($handle_data as $hk => $hv) { $substract = 1; if ($is_export) { -// if ( -//// $hv['account'] == 'zj9587' || -// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') { -// dump($handle_data); -// } + for (;;) { if (!$handle_data[$hk+$substract]['time']&&$handle_data[$hk+$substract]['account']) { @@ -674,28 +663,19 @@ class CompanyStatementPoolController extends ThinkController break; } - } if (count($hv['game_list'])>1) { $week_line += count($hv['game_list'])-1; } -// if ( -//// $hv['account'] == 'zj9587' || -// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') { -// dump($handle_data); -// } - $handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)"; + + $handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line})+SUM(P{$old_line}:P{$week_line})-SUM(Q{$old_line}:Q{$week_line})-SUM(R{$old_line}:R{$week_line}),2)"; if (count($hv['game_list'])>1) { $old_line += count($hv['game_list']); -// if ( -//// $hv['account'] == 'zj9587' || -// $hv['account'] == 'DCX1012' || $hv['account'] == 'chuangshi168') { -// dump($old_line); -// } + } else { $old_line++; } @@ -706,17 +686,11 @@ class CompanyStatementPoolController extends ThinkController } else { $week_line = $old_line; } -// if ( -//// $hv['account'] == 'zj9587' || -// $hv['account'] == 'DCX1012' || $hv['account'] == 'chuangshi168') { -// dump($week_line); -// } } } -// dump($handle_data); return $handle_data?$handle_data:[]; } diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 8e1326d33..baac67e0c 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -1376,6 +1376,9 @@ class CompanyStatementSetController extends Controller { } } $promoteCompanyGameRatio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($v['id'],$v['game_ids'],$begintime,$endtime,$company_belong); + + $handleed_data = []; + foreach($v['list'] as $ke=>$va){ $templist = $va['game_list']; $va['game_list'] = []; @@ -1425,14 +1428,25 @@ class CompanyStatementSetController extends Controller { $p_info['statement_begin_time']=$statement_begin_time; $p_info['statement_end_time']=$statement_end_time; - $RewardRecordRes = $this->getPromoteUserGameRewardRecord($p_info['relation_game_id'],$v['id'],$statement_begin_time,$statement_end_time); + $RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'],$statement_begin_time,$statement_end_time); + if ( + ($handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] || $handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] == '0') + || ($handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['reward'] || $handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['reward'] == '0') + ) { + $p_info['fine'] = 0; + $p_info['reward'] = 0; + } else { + $p_info['fine'] = $RewardRecordRes['fine']?$RewardRecordRes['fine']:0; + $p_info['reward'] = $RewardRecordRes['reward']?$RewardRecordRes['reward']:0; + $handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] = (string)$RewardRecordRes['fine']; + $handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['reward'] = (string)$RewardRecordRes['reward']; + } // if ($p_info['relation_game_id'] == 191 && $v['id'] == 334) { // dump($RewardRecordRes); // } - $p_info['fine'] = $RewardRecordRes['fine']?$RewardRecordRes['fine']:0; - $p_info['reward'] = $RewardRecordRes['reward']?$RewardRecordRes['reward']:0; + $p_info['statement_type']=0; $va['game_list'][] = $p_info; @@ -1484,15 +1498,27 @@ class CompanyStatementSetController extends Controller { $temp_game['statement_end_time']=date("Y.m.d",$tmp_game_ratio['endtime']); $temp_game['statement_type']=0; - $RewardRecordRes = $this->getPromoteUserGameRewardRecord($p_info["relation_game_id"],$v['id'],$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']); + $RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'],$temp_game['statement_begin_time'],$temp_game['statement_end_time']); + if ( + ($handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] || $handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] == '0') + || ($handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['reward'] || $handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['reward'] == '0') + ) { + $temp_game['fine'] = 0; + $temp_game['reward'] = 0; + } else { + $temp_game['fine'] = $RewardRecordRes['fine']?$RewardRecordRes['fine']:0; + $temp_game['reward'] = $RewardRecordRes['reward']?$RewardRecordRes['reward']:0; + $handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] = (string)$RewardRecordRes['fine']; + $handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['reward'] = (string)$RewardRecordRes['reward']; + } // if ($p_info['relation_game_id'] == 191 && $v['id'] == 334) { // dump($RewardRecordRes); // } $temp_game['statement_type']=0; - $temp_game['fine'] = $RewardRecordRes['fine']?$RewardRecordRes['fine']:0; - $temp_game['reward'] = $RewardRecordRes['reward']?$RewardRecordRes['reward']:0; +// $temp_game['fine'] = $RewardRecordRes['fine']?$RewardRecordRes['fine']:0; +// $temp_game['reward'] = $RewardRecordRes['reward']?$RewardRecordRes['reward']:0; $temp_game['relation_game_id']=$p_info["relation_game_id"]; $temp_game['game_name']=$p_info["game_name"]; @@ -1703,7 +1729,7 @@ class CompanyStatementSetController extends Controller { /** * 获取游戏奖罚 */ - protected function getPromoteUserGameRewardRecord($relation_game_id,$cpmpamy_id,$begintime,$endtime) + protected function getPromoteUserGameRewardRecord($cpmpamy_id,$begintime,$endtime) { $begintime = strtotime(str_replace('.','-',$begintime)); @@ -1715,7 +1741,7 @@ class CompanyStatementSetController extends Controller { "d.company_type"=>2, "d.company_id"=>$cpmpamy_id, "d.settlement_type"=>2, - "relation_game_id"=>$relation_game_id, +// "relation_game_id"=>$relation_game_id, ); $rfres = M("RewardDetail","tab_") diff --git a/Application/Admin/View/CompanyStatementPool/editPuPool.html b/Application/Admin/View/CompanyStatementPool/editPuPool.html index a7e200b0d..17867b93c 100644 --- a/Application/Admin/View/CompanyStatementPool/editPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/editPuPool.html @@ -116,12 +116,12 @@ 结算时间 推广流水 退款 - 其他扣款 分成比例 补点 分成结算金额 奖励 罚款 + 其他扣款 周结算金额 结算金额 @@ -167,7 +167,6 @@ {$com['statement_info'][0]['game_list'][0]['pay_amount']} - % % {$com['statement_info'][0]['game_list'][0]['sum_money']} @@ -175,6 +174,7 @@ {$com['reward']} {$com['fine']} + {$com['statement_info'][0]['week_amount']} {$com['statement_money']} @@ -227,10 +227,10 @@ {$game['pay_amount']} - % % {$game['sum_money']} + @@ -257,10 +257,10 @@ - % % {$account['game_list'][0]['sum_money']} + {$account['week_amount']} @@ -289,10 +289,10 @@ - % % {$game['sum_money']} + diff --git a/Application/Admin/View/CompanyStatementPool/editSpecialPuPool.html b/Application/Admin/View/CompanyStatementPool/editSpecialPuPool.html index e13fd5579..544ef67eb 100644 --- a/Application/Admin/View/CompanyStatementPool/editSpecialPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/editSpecialPuPool.html @@ -116,12 +116,12 @@ 结算时间 推广流水 退款 - 其他扣款 分成比例 补点 分成结算金额 奖励 罚款 + 其他扣款 周结算金额 结算金额 @@ -167,7 +167,6 @@ {$com['statement_info'][0]['game_list'][0]['pay_amount']} - {$com['statement_info'][0]['game_list'][0]['ratio']}% % {$com['statement_info'][0]['game_list'][0]['sum_money']} @@ -175,6 +174,7 @@ {$com['reward']} {$com['fine']} + {$com['statement_info'][0]['week_amount']} {$com['statement_money']} @@ -227,10 +227,10 @@ {$game['pay_amount']} - {$game['ratio']}% % {$game['sum_money']} + @@ -257,10 +257,10 @@ - {$account['game_list'][0]['ratio']}% % {$account['game_list'][0]['sum_money']} + {$account['week_amount']} @@ -289,10 +289,10 @@ - {$game['ratio']}% % {$game['sum_money']} + diff --git a/Application/Admin/View/CompanyStatementPool/viewPuPool.html b/Application/Admin/View/CompanyStatementPool/viewPuPool.html index 495070d64..9873124b0 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPuPool.html @@ -114,12 +114,12 @@ 结算时间 推广流水 退款 - 其他扣款 分成比例 补点 分成结算金额 奖励 罚款 + 其他扣款 周结算金额 结算金额 @@ -166,7 +166,6 @@ {$com['statement_info'][0]['game_list'][0]['pay_amount']} {$com['statement_info'][0]['game_list'][0]['refund']|default=0} - {$com['statement_info'][0]['game_list'][0]['withhold']|default=0} {$com['statement_info'][0]['game_list'][0]['ratio']}% {$com['statement_info'][0]['game_list'][0]['increment_ratio']}% {$com['statement_info'][0]['game_list'][0]['sum_money']} @@ -174,6 +173,7 @@ {$com['statement_info'][0]['reward']||default="0"} {$com['statement_info'][0]['fine']||default="0"} + {$com['statement_info'][0]['game_list'][0]['withhold']|default=0} {$com['statement_info'][0]['week_amount']||default="0"} {$com['statement_money']} @@ -226,10 +226,10 @@ {$game['pay_amount']} {$game['refund']|default=0} - {$game['withhold']|default=0} {$game['ratio']}% {$game['increment_ratio']}% {$game['sum_money']} + {$game['withhold']|default=0} @@ -251,26 +251,22 @@ {$account['game_list'][0]['game_type_name']} {$account['time']|default="-----"} - - - {$account['game_list'][0]['pay_amount']} {$account['game_list'][0]['refund']|default=0} - {$account['game_list'][0]['withhold']|default=0} {$account['game_list'][0]['ratio']}% {$account['game_list'][0]['increment_ratio']}% {$account['game_list'][0]['sum_money']} - {$account['reward']} - {$account['fine']} + {$account['reward']|default=0} + {$account['fine']|default=0} + + {$account['game_list'][0]['withhold']|default=0} + {$account['week_amount']} - - - - - - - @@ -300,10 +296,10 @@ {$game['refund']|default=0} - {$game['withhold']|default=0} {$game['ratio']}% {$game['increment_ratio']}% {$game['sum_money']} + {$game['withhold']|default=0} diff --git a/Application/Admin/View/PromoteCompany/export.html b/Application/Admin/View/PromoteCompany/export.html index 50838ed1f..4be1b96a3 100644 --- a/Application/Admin/View/PromoteCompany/export.html +++ b/Application/Admin/View/PromoteCompany/export.html @@ -383,10 +383,10 @@