diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 8ff15c6f5..e8bb16d28 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -738,22 +738,16 @@ class CompanyStatementSetController extends Controller { $tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); $tratio += $company_ratio; -// if ($add_data['company_id'] == 12&&$game['relation_game_id'] == 191) { -// dump($tratio); +// if ($add_data['company_id'] == 5) { // dump($game_all_payment); +// dump($this->getTurnoverType($t_game_id,$k,$begintime,$endtime)); // dump($tmp_game_ratio); -// dump($company_ratio); // } }elseif($type == 0){ // $tratio = $tmp_game_ratio['ratio']; $turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime); -// if ($add_data['company_id'] == 43) { -// dump($turnover_type); -// dump($tmp_game_ratio); -// } - if ($turnover_type == 2 || $turnover_type == 4) { $tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); } else { @@ -794,6 +788,13 @@ class CompanyStatementSetController extends Controller { $add_data['pay_amount'] += $temp_game['pay_amount']; if($type == 1){ + +// if ($add_data['company_id'] == 5) { +// dump($game_all_payment); +// dump($this->getTurnoverType($t_game_id,$k,$begintime,$endtime)); +// dump($tmp_game_ratio); +// } + $tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); $tratio += $company_ratio; }elseif($type == 0){ @@ -1039,10 +1040,15 @@ class CompanyStatementSetController extends Controller { $res[$company_id][$v[$j]]['ratio_pay_amount'] = $all_res[$company_id][$v[$j]]['pay_amount']; $temp += $all_res[$company_id][$v[$j]]['pay_amount']; } elseif($turnover_type == 3){ - if (empty($cp_res)) { + if (empty($cp_res[$company_id])) { $cpSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpMap)->group('game_id') ->join("left join tab_game g on s.game_id = g.id") ->select(); + +// if ($company_id == 5) { +// dump($cpMap); +// } + foreach($cpSpendList as $ck=>$cv){ try { $cp_res[$company_id]["pay_amount"] += $cv['pay_amount']; @@ -1065,7 +1071,7 @@ class CompanyStatementSetController extends Controller { } elseif($turnover_type == 4){ - if (empty($cp_all_res)) { + if (empty($cp_all_res[$company_id])) { $cpAllSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpAllMap)->group('game_id') ->join("left join tab_game g on s.game_id = g.id") @@ -1114,26 +1120,33 @@ class CompanyStatementSetController extends Controller { if ($k!='pay_amount') { $turnover_type = $this->getTurnoverType($k,$key,$begintime,$endtime); + if ($turnover_type == 2) { $res[$key][$k]['ratio_pay_amount'] = $all_res[$key][$k]['pay_amount']; } elseif($turnover_type == 3){ - if (empty($cp_res)) { + if (empty($cp_res[$key])) { +// if ($key == 5) { +// dump(2); +// dump($cpMap); +// dump($cp_res); +// } $cpSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpMap)->group('game_id') ->join("left join tab_game g on s.game_id = g.id") ->select(); + foreach($cpSpendList as $ck=>$cv){ try { - $cp_res[$company_id]["pay_amount"] += $cv['pay_amount']; + $cp_res[$key]["pay_amount"] += $cv['pay_amount']; } catch (\Throwable $th) { - $cp_res[$company_id]["pay_amount"] = $cv['pay_amount']; + $cp_res[$key]["pay_amount"] = $cv['pay_amount']; } - if(isset($cp_res[$company_id][$cv['relation_game_id']])){ + if(isset($cp_res[$key][$cv['relation_game_id']])){ // - $cp_res[$company_id][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount']; + $cp_res[$key][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount']; }else{ unset($cv['game_id']); - $cp_res[$company_id][$cv['relation_game_id']]= $cv; + $cp_res[$key][$cv['relation_game_id']]= $cv; } } } @@ -1141,23 +1154,23 @@ class CompanyStatementSetController extends Controller { $res[$key][$k]['ratio_pay_amount'] = $cp_res[$key][$k]['pay_amount']; } elseif($turnover_type == 4){ - if (empty($cp_all_res)) { + if (empty($cp_all_res[$key])) { $cpAllSpendList = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($cpAllMap)->group('game_id') ->join("left join tab_game g on s.game_id = g.id") ->select(); foreach ($cpAllSpendList as $ck => $cv) { try { - $cp_all_res[$company_id]["pay_amount"] += $cv['pay_amount']; + $cp_all_res[$key]["pay_amount"] += $cv['pay_amount']; } catch (\Throwable $th) { - $cp_all_res[$company_id]["pay_amount"] = $cv['pay_amount']; + $cp_all_res[$key]["pay_amount"] = $cv['pay_amount']; } - if (isset($cp_all_res[$company_id][$cv['relation_game_id']])) { + if (isset($cp_all_res[$key][$cv['relation_game_id']])) { // - $cp_all_res[$company_id][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount']; + $cp_all_res[$key][$cv['relation_game_id']]['pay_amount'] += $cv['pay_amount']; } else { unset($cv['game_id']); - $cp_all_res[$company_id][$cv['relation_game_id']] = $cv; + $cp_all_res[$key][$cv['relation_game_id']] = $cv; } } } @@ -1640,7 +1653,7 @@ class CompanyStatementSetController extends Controller { // $tratio = $tmp_game_ratio['ratio']; $turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime); -// if ($v['id'] == 43) { +// if ($v['id'] == 5) { // dump($p_info['all_pay_amount']); // dump($turnover_type); // dump($tmp_game_ratio); @@ -1716,7 +1729,7 @@ class CompanyStatementSetController extends Controller { }elseif($type == 0){ $turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime); -// if ($v['id'] == 43) { +// if ($v['id'] == 5) { // dump($p_info['all_pay_amount']); // dump($turnover_type); // dump($tmp_game_ratio);