diff --git a/Application/Admin/Controller/CompanyStatementLackController.class.php b/Application/Admin/Controller/CompanyStatementLackController.class.php index 38e06ad7d..852787085 100644 --- a/Application/Admin/Controller/CompanyStatementLackController.class.php +++ b/Application/Admin/Controller/CompanyStatementLackController.class.php @@ -127,7 +127,7 @@ class CompanyStatementLackController extends ThinkController //下游公司 A("CompanyStatementPool")->viewPcPool($dbres,$is_export,$withdraw_type); }else{ - A("CompanyStatementPool")->viewPuPool($dbres,$is_export,$withdraw_type); + A("CompanyStatementPool")->viewPuPool($dbres,$is_export,["withdraw_type"=>3]); } } @@ -284,7 +284,7 @@ class CompanyStatementLackController extends ThinkController A("CompanyStatementPool")->viewPcPool($dbres,$is_export); }else{ $this->assign("title","下游个人未汇总"); - A("CompanyStatementPool")->viewPuPool($dbres,$is_export); + A("CompanyStatementPool")->viewPuPool($dbres,$is_export,["withdraw_type"=>3]); } } diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 5b242e20c..074084d12 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -218,7 +218,7 @@ class CompanyStatementPoolController extends ThinkController //获取基本信息 $infolist = M("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}'")->select(); //获取母单 - $pool_info = M("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment,withdraw_type')->where("id={$id}")->find(); + $pool_info = M("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time')->where("id={$id}")->find(); if(!empty($pool_info['create_lack_ids'])){ $l_ids = $pool_info['create_lack_ids']; $lack_info = M("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select(); @@ -236,7 +236,7 @@ class CompanyStatementPoolController extends ThinkController //下游公司 $this->viewPcPool($infolist,$is_export); }else{ - $this->viewPuPool($infolist,$is_export); + $this->viewPuPool($infolist,$is_export,$pool_info); } } @@ -466,11 +466,19 @@ class CompanyStatementPoolController extends ThinkController } //个人汇总结算查看 - public function viewPuPool(&$infolist,$is_export){ + public function viewPuPool(&$infolist,$is_export,$pool_info){ $line = 1; - $count = []; + $count = [ + "pool_week_count"=>0,//上周数据合计 + "pool_lack_count"=>0,//本周未结算流水合计 + "sum_money"=>0,//打款合计 + "pool_lack_count"=>0,//本周未结算流水合计 + "st_lack_count"=>0,//本周暂不结算合计 + "st_count"=>0//本次应支付 + ]; $week_line = 2; - + $pool_statement_begin_time = date('Y.m.d', $pool_info['statement_begin_time']); + $pool_statement_end_time = date('Y.m.d', $pool_info['statement_end_time']); //获取对接人 foreach($infolist as $k=>&$v){ $v['statement_info'] = json_decode($v['statement_info'],true); @@ -484,6 +492,7 @@ class CompanyStatementPoolController extends ThinkController $v['is_payment'] = 1; } } + $is_statement = $v['st'] == 1 ? true :false; $cline = $line+1; if($is_export){ $v['statement_money'] = "=ROUND("; @@ -495,17 +504,9 @@ class CompanyStatementPoolController extends ThinkController foreach($v['statement_info'] as $ke=>&$va){ $va['row'] = count($va['game_list']); $row += count($va['game_list']); - foreach($va['game_list'] as $key=>&$val){ $line ++; if($v['withdraw_type'] != 3) { -// if(!$val['ratio']&&!$val['increment_ratio']) { -// if(isset($val['ratio'])){ -// $val['increment_ratio'] = 0; -// }else{ -// $val['ratio'] = 0; -// } -// } if (!$val['increment_ratio']) { $val['increment_ratio'] = 0; } @@ -513,8 +514,25 @@ class CompanyStatementPoolController extends ThinkController if (!$val['ratio']) { $val['ratio'] = 0; } - + //上周数据合计 + if($val['statement_begin_time'] == $pool_statement_begin_time && $val['statement_end_time'] == $pool_statement_end_time){ + $count['pool_week_count'] += $val['pay_amount']; + if($is_export){ + $this->setWeekCount($line); + } + } + //本周未结算流水合计 + if(!$is_statement){ + $count['pool_lack_count'] += $val['pay_amount']; + $count['st_lack_count'] += $val['sum_money']; + if($is_export){ + $this->setlackCount($line); + } + }else{ + $count['st_count'] += $val['sum_money']; + } } + if($is_export){ if($v['withdraw_type'] != 3) { @@ -525,15 +543,11 @@ class CompanyStatementPoolController extends ThinkController $v['statement_money'] .= "S{$line}+"; }else{ $count['platform_amount'] += $val['pay_amount']; - -// $count['sum_money'] += $val['sum_money']; } } $count['week_money'] += $va['week_amount']; $count['sum_money'] += $va['week_amount']; } -// dump($count); - $v['row'] = $row; @@ -543,7 +557,6 @@ class CompanyStatementPoolController extends ThinkController if($is_export){ if($v['withdraw_type'] != 3) { -// $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)"; @@ -551,18 +564,78 @@ class CompanyStatementPoolController extends ThinkController } } - if($is_export){ + if($pool_info["withdraw_type"] != 3){ + //上周数据合计 + $count["pool_week_count"] = $this->setWeekCount($line,true); + $count["pool_lack_count"] = $this->setlackCount($line,true); + //本周暂不结算合计 + $count["st_lack_count"] = '=ROUND(SUMIFS(T2:T'.$line.',Y2:Y'.$line.',"否"),2)'; + //本次应支付 + $count["st_count"] = '=ROUND(SUMIFS(T2:T'.$line.',Y2:Y'.$line.',"是"),2)'; + + } $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)"; $count["week_money"] = "=ROUND(SUM(S2:S".$line."),2)"; $count["sum_money"] = "=ROUND(SUM(T2:T".$line."),2)"; } -// die(); + // die(); $this->assign("data",$infolist); $this->assign("count",$count); $this->assign("is_export",$is_export); + + $this->assign("withdraw_type",$pool_info["withdraw_type"]); $this->display("CompanyStatementPool/viewPuPool"); } + //导出中上周结算数据计算 + protected function setWeekCount($line,$return = false) + { + global $pool_week_str,$pool_week_line; + if(empty($pool_week_str)){ + $pool_week_str = "="; + $pool_week_line = 0; + } + if($pool_week_str == "="){ + $pool_week_str .= "SUM(K{$line}:"; + }else{ + if($line - $pool_week_line > 1){ + //不连续 + $pool_week_str .= "K{$pool_week_line})+SUM(K{$line}:"; + } + } + $pool_week_line = $line; + if($return){ + $data = $pool_week_str."K{$line})"; + unset($pool_week_str,$pool_week_line); + return $data; + } + } + //本周不结算 + protected function setlackCount($line,$return = false) + { + global $pool_lack_str,$pool_lack_line; + if(empty($pool_lack_str)){ + $pool_lack_str = "="; + $pool_lack_line = 0; + } + if($pool_lack_str == "="){ + $pool_lack_str .= "SUM(K{$line}:"; + }else{ + if($line - $pool_lack_line > 1){ + //不连续 + $pool_lack_str .= "K{$pool_lack_line})+SUM(K{$line}:"; + } + } + $pool_lack_line = $line; + if($return){ + $data = $pool_lack_str."K{$line})"; + unset($pool_lack_str,$pool_lack_line); + return $data; + } + } + + + //改变结构 public function changeDataStruct($statement_info = [],$is_export = 0,&$week_line = 1) { diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 15416f9c9..48d02a272 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -153,7 +153,12 @@ class SpendController extends ThinkController ($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):''; $value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无'; $value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']]; + //拆分游戏名称和设备类型 + $game_arr = explode("(",rtrim($value['game_name'],")")); + $value['game_name'] = $game_arr[0]; + $value['sdk_version_name'] = $game_arr[1]; } + $this->assign('showMarketAdmin', session('user_auth')['show_market_admin']); $this->assign('showPromote', session('user_auth')['show_promote']); $this->assign('isMarketAdmin', $isMarketAdmin); diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index 4f72beed3..62e907d73 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -327,6 +327,7 @@ class StatementMangementController extends ThinkController ->field('r.id') ->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT') ->where($map) + ->order("r.id desc") ->group('r.id') ->select(); @@ -345,10 +346,11 @@ class StatementMangementController extends ThinkController $list = M('reward_record', 'tab_')->alias('r') ->field(' - r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id, + r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,r.create_time, rd.id as rid, rd.type as detail_type, rd.company_type as detail_company_type, rd.company_id as detail_company_id , rd.company_name as detail_company_name, rd.settlement_type as detail_settlement_type, rd.promote_account as detail_promote_account,rd.amount as detail_amount ') ->where($map) + ->order("rid desc") ->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')->select(); if ($list) { $record = []; @@ -397,7 +399,7 @@ class StatementMangementController extends ThinkController if ($page) { $this->assign('_page', $page); } - ksort($record); + krsort($record); $this->assign('list', $record); $this->assign('promoters', array_column(M('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id')); diff --git a/Application/Admin/View/CompanyStatementPool/viewPuPool.html b/Application/Admin/View/CompanyStatementPool/viewPuPool.html index 1f920a664..04a4ab5ed 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPuPool.html @@ -308,28 +308,61 @@ -
说明:仅统计通知成功,结算给上游的是支付成功通知成功,就算给公会的是支付成功
+说明:游戏相关支付统计,结算给上游的是支付成功通知成功的订单,结算给公会的是支付成功的订单
+