From 4f35cacbabaa8490e3cf9099600648a542eb5dbb Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Fri, 16 Oct 2020 11:42:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=87=E6=80=BB=E6=A8=A1=E6=9D=BF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementPoolController.class.php | 277 +++++++++++++++++- .../View/CompanyStatementPool/editPuPool.html | 23 +- .../View/CompanyStatementPool/viewCpPool.html | 10 +- .../View/CompanyStatementPool/viewPcPool.html | 18 +- .../View/CompanyStatementPool/viewPuPool.html | 23 +- 5 files changed, 323 insertions(+), 28 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 3666deff8..eb0c4a9c6 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -254,6 +254,7 @@ class CompanyStatementPoolController extends ThinkController public function editPuPool(&$infolist,$is_export) { $line = 1; $count = []; + $week_line = 2; //获取对接人 foreach($infolist as $k=>&$v){ $v['statement_info'] = json_decode($v['statement_info'],true); @@ -318,6 +319,11 @@ class CompanyStatementPoolController extends ThinkController } } } + + $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); + + $v['statement_info'] = $handle_data; + $v['row'] = $row; if($is_export){ if($v['withdraw_type'] != 3) { @@ -342,6 +348,8 @@ class CompanyStatementPoolController extends ThinkController public function viewPuPool(&$infolist,$is_export){ $line = 1; $count = []; + $week_line = 2; + //获取对接人 foreach($infolist as $k=>&$v){ $v['statement_info'] = json_decode($v['statement_info'],true); @@ -398,6 +406,11 @@ class CompanyStatementPoolController extends ThinkController } } } + + $handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line); + + $v['statement_info'] = $handle_data; + $v['row'] = $row; if($is_export){ if($v['withdraw_type'] != 3) { @@ -412,13 +425,140 @@ class CompanyStatementPoolController extends ThinkController $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)"; $count["sum_money"] = "=ROUND(SUM(R2:R".$line."),2)"; } +// die(); $this->assign("data",$infolist); $this->assign("count",$count); $this->assign("is_export",$is_export); $this->display("CompanyStatementPool/viewPuPool"); } + //改变结构 + public function changeDataStruct($statement_info = [],$is_export = 0,&$week_line = 1) { + + $game_list = []; + $old_line = $week_line; + + //使用时间与会长账号作为键值分离数据 + foreach($statement_info as $sk=>$sv){ + + foreach($sv['game_list'] as $gk=>$gv){ + + $gv['account'] = $sv['account']; + $game_list[$gv['statement_begin_time'].'-'.$gv['statement_end_time']][$gv['account']][] = $gv; + + } + + } + + $game_data = []; + $handle_data = []; + //处理游戏金额数据 + foreach($game_list as $gk => $gv) { + + foreach ($gv as $sk => $sv) { + $game_data['account'] = $sk; + $game_data['row'] = count($sv); + $game_data['time_row'] = count($sv); + $game_data['time'] = $gk; + //周结算金额计算 + for ($i=0;;$i++) { + if ($sv[$i]['sum_money']) { + $game_data['week_amount'] += $sv[$i]['sum_money']; + } else { + break; + } + + } +// $game_data['week_amount'] += $sv[0]['sum_money']; + + $game_data['game_list'] = $sv; + array_push($handle_data,$game_data); + $game_data = []; + + } + + } + $substract = 1; +// dump($game_list); +// dump($handle_data); + //添加周结算金额,合并相同的结算时间 +// dump($handle_data); + foreach($handle_data as $hk => $hv) { + + if($hk > 0) { + for (;;) { + + if (!$handle_data[$hk-$substract]['time']) { + $substract++; + } else { + break; + } + + } +// dump($hv); + if ($hv['time'] == $handle_data[$hk-$substract]['time']&&!$is_export) { + + $handle_data[$hk-$substract]['time_row'] += $handle_data[$hk]['time_row']; + + if ($is_export) { + + $week_line++; + $handle_data[$hk-$substract]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)"; + $old_line++; + } else { + $handle_data[$hk-$substract]['week_amount'] += $handle_data[$hk]['week_amount']; + } + + unset($handle_data[$hk]['time']); + unset($handle_data[$hk]['time_row']); + unset($handle_data[$hk]['week_amount']); + } else { + if ($is_export) { +// dump($old_line); + if (count($hv['game_list'])>1) { + $week_line += count($hv['game_list'])-1; + } + + $handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)"; + $old_line++; + $week_line++; + } + } + $substract = 1; + }else { + if ($is_export) { + + if (count($hv['game_list'])>1) { + $week_line += count($hv['game_list'])-1; + } + + $handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)"; + + + if (count($hv['game_list'])>1) { + $old_line += count($hv['game_list'])-1; + } else { + $old_line++; + } + + + if(count($hv['game_list'])>1) { + + $week_line = $old_line + 1; + } else { + $week_line = $old_line; + } + + } + } + + } +// dump($handle_data); + return $handle_data?$handle_data:[]; + } + //下游汇总结算查看 public function viewPcPool(&$infolist,$is_export){ + $line = 1; $count = []; //获取对接人 @@ -458,9 +598,9 @@ class CompanyStatementPoolController extends ThinkController if($is_export){ if($v['withdraw_type'] != 3) { - $va['d_statement_money'] = "=ROUND(D{$line}*(1-G{$line})*(E{$line}+F{$line}),2)"; + $va['d_statement_money'] = "=ROUND(E{$line}*(1-H{$line})*(F{$line}+G{$line}),2)"; } else { - $va['d_statement_money'] = "=ROUND(D{$line}*(F{$line}),2)"; + $va['d_statement_money'] = "=ROUND(E{$line}*(G{$line}),2)"; } }else{ if ($v['withdraw_type'] != 3) { @@ -478,14 +618,67 @@ class CompanyStatementPoolController extends ThinkController } } } + + +// $game_list = []; +// $statement_info = $v['statement_info']; +// //使用时间与会长账号作为键值分离数据 +// foreach($statement_info as $sk=>$sv){ +// +// $sv['time'] = $sv['statement_begin_time'].'-'.$sv['statement_end_time']; +// $game_list[$sv['statement_begin_time'].'-'.$sv['statement_end_time']][] = $sv; +// +// } +// +// $handle_data = []; +// $substract = 1; +// +// //处理游戏金额数据 +// foreach($game_list as $gk => $gv) { +// +// foreach ($gv as $lk => $lv){ +// +// if ($lk > 0) { +// +// for (;;) { +// +// if (!$handle_data[$lk-$substract]['time']) { +// $substract++; +// } else { +// $handle_data[$lk-$substract]['row'] += 1; +// $handle_data[$lk-$substract]['week_amount'] += $lv['d_statement_money']; +// unset($lv['time']); +// break; +// } +// +// } +// +// } else { +// +// $lv['row'] = 1; +// $lv['week_amount'] = $lv['d_statement_money']; +// } +// +// array_push($handle_data,$lv); +// +// } +// +// } +// + $handle_data = $this->changeDataStructVc($v['statement_info'],$is_export,$cline); + $v['statement_info'] = $handle_data; +// dump($handle_data); + + + $v['settlement_contact'] = $Partner[$v['company_id']]; if($is_export){ + if ($v['withdraw_type'] != 3) { - $v['statement_money'] = "=ROUND(SUM(H{$cline}:H{$line})+J{$cline}-I{$cline},2)"; + $v['statement_money'] = "=ROUND(SUM(I{$cline}:I{$line})+K{$cline}-J{$cline},2)"; } - }else{ $count['fine'] += $v['fine']; $count['reward'] += $v['reward']; @@ -495,11 +688,11 @@ class CompanyStatementPoolController extends ThinkController } if($is_export){ - $count["platform_amount"] = "=ROUND(SUM(D2:D".$line."),2)"; - $count["d_statement_money"] = "=ROUND(SUM(H2:H".$line."),2)"; - $count["fine"] = "=ROUND(SUM(I2:I".$line."),2)"; - $count["reward"] = "=ROUND(SUM(J2:J".$line."),2)"; - $count["statement_money"] = "=ROUND(SUM(K2:K".$line."),2)"; + $count["platform_amount"] = "=ROUND(SUM(E2:E".$line."),2)"; + $count["d_statement_money"] = "=ROUND(SUM(I2:I".$line."),2)"; + $count["fine"] = "=ROUND(SUM(J2:J".$line."),2)"; + $count["reward"] = "=ROUND(SUM(K2:K".$line."),2)"; + $count["statement_money"] = "=ROUND(SUM(M2:M".$line."),2)"; } // dd($infolist); $this->assign("data",$infolist); @@ -509,6 +702,65 @@ class CompanyStatementPoolController extends ThinkController } + public function changeDataStructVc($statement_info,$is_export = 0,$cline) { + $game_list = []; + $nline = $cline; + + //使用时间与会长账号作为键值分离数据 + foreach($statement_info as $sk=>$sv){ + + $sv['time'] = $sv['statement_begin_time'].'-'.$sv['statement_end_time']; + $game_list[$sv['statement_begin_time'].'-'.$sv['statement_end_time']][] = $sv; + + } + + $handle_data = []; + $substract = 1; + + //处理游戏金额数据 + foreach($game_list as $gk => $gv) { + + foreach ($gv as $lk => $lv){ + + if ($lk > 0) { + + for (;;) { + + if (!$handle_data[$lk-$substract]['time']) { + $nline++; + $substract++; + } else { + $handle_data[$lk-$substract]['row'] += 1; + $handle_data[$lk-$substract]['week_amount'] += $lv['d_statement_money']; + + if ($is_export) { + $handle_data[$lk-$substract]['week_amount'] = "=ROUND(SUM(I{$cline}:I{$nline}),2)"; + } + unset($lv['time']); + break; + } + + } + + } else { + + $lv['row'] = 1; + $lv['week_amount'] = $lv['d_statement_money']; + $nline++; + if ($is_export) { + $lv['week_amount'] = "=ROUND(SUM(I{$cline}}:I{$nline}),2)"; + } + } + + array_push($handle_data,$lv); + + } + + } + + return $handle_data; + } + //上游汇总查看及导出 public function viewCpPool(&$infolist,$is_export) { @@ -538,6 +790,8 @@ class CompanyStatementPoolController extends ThinkController } } +// dump($v['statement_info']); + $cline = $line+1; foreach($v['statement_info'] as $ke=>&$va){ $line ++; @@ -551,6 +805,11 @@ class CompanyStatementPoolController extends ThinkController $count['d_statement_money'] += $va['d_statement_money']; } } + + $handle_data = $this->changeDataStructVc($v['statement_info'],$is_export,$cline); + $v['statement_info'] = $handle_data; +// dump($v['statement_info']); + $v['matche_platform'] = $Partner[$v['company_id']]; if($is_export){ $v['statement_money'] = "=ROUND(SUM(K{$cline}:K{$line})+M{$cline}-L{$cline},2)"; diff --git a/Application/Admin/View/CompanyStatementPool/editPuPool.html b/Application/Admin/View/CompanyStatementPool/editPuPool.html index 660bf6d40..4fe2bfefb 100644 --- a/Application/Admin/View/CompanyStatementPool/editPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/editPuPool.html @@ -103,6 +103,7 @@ 序号 下游名称 + 结算时间 会长账号 内外团 @@ -112,7 +113,7 @@ 下游性质 产品 产品类型 - 结算时间 + 推广流水 退款 分成比例 @@ -120,6 +121,7 @@ 分成结算金额 奖励 罚款 + 周结算金额 结算金额 户名 @@ -145,6 +147,7 @@ + {$com['statement_info'][0]['time']} {$com['statement_info'][0]['account']} - @@ -159,7 +162,7 @@ {$com['statement_info'][0]['game_list'][0]['game_name']} {$com['statement_info'][0]['game_list'][0]['game_type_name']} - {$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']} + {$com['statement_info'][0]['game_list'][0]['pay_amount']} % @@ -169,6 +172,7 @@ {$com['reward']} {$com['fine']} + {$com['statement_info'][0]['week_amount']} {$com['statement_money']} @@ -179,6 +183,7 @@ - - - + - - - - @@ -216,7 +221,7 @@ {$game['game_name']} {$game['game_type_name']} - {$game['statement_begin_time']}-{$game['statement_end_time']} + {$game['pay_amount']} % @@ -234,12 +239,15 @@ + + {$account['time']} + {$account['account']} {$account['game_list'][0]['game_name']} {$account['game_list'][0]['game_type_name']} - {$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']} + {$account['game_list'][0]['pay_amount']} @@ -247,7 +255,9 @@ % % {$account['game_list'][0]['sum_money']} - + + {$account['week_amount']} + - - @@ -256,6 +266,7 @@ - - - + - @@ -265,7 +276,7 @@ {$game['game_name']} {$game['game_type_name']} - {$game['statement_begin_time']}-{$game['statement_end_time']} + {$game['pay_amount']} diff --git a/Application/Admin/View/CompanyStatementPool/viewCpPool.html b/Application/Admin/View/CompanyStatementPool/viewCpPool.html index 0ce64f331..7b37383a1 100644 --- a/Application/Admin/View/CompanyStatementPool/viewCpPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewCpPool.html @@ -111,6 +111,7 @@ 合作方待结算分成 违规罚款 奖励 + 周结算金额 合作待结算金额 是否结算 @@ -139,7 +140,8 @@ {$com.company_name} {$com.matche_platform} - {$com['statement_info'][0]['statement_begin_time']}-{$com['statement_info'][0]['statement_end_time']} + {$com['statement_info'][0]['time']} + {$com['statement_info'][0]['game_name']} {$com['statement_info'][0]['pay_amount']} @@ -152,6 +154,7 @@ {$com['fine']-0} {$com['reward']-0} + {$com['statement_info'][0]['week_amount']} {$com['statement_money']} @@ -184,7 +187,10 @@ - {$it['statement_begin_time']}-{$it['statement_end_time']} + + + {$it['time']} + {$it['game_name']} {$it['pay_amount']} {$it['pay_amount']} diff --git a/Application/Admin/View/CompanyStatementPool/viewPcPool.html b/Application/Admin/View/CompanyStatementPool/viewPcPool.html index 62c6f57db..01a4a7da5 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPcPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPcPool.html @@ -98,6 +98,7 @@ 序号 公司名称 + 结算日期 合作产品名称 平台总额(元) 下游内团分成比例 @@ -106,11 +107,10 @@ 分成金额/元 罚款 奖励 + 周结算金额 合计/元 对账人 - 结算日期 - - + 户名 帐号 开户行 @@ -128,6 +128,7 @@ {$key-0+1} {$com.company_name} + {$com['statement_info'][0]['time']} {$com['statement_info'][0]['game_name']} {$com['statement_info'][0]['pay_amount']} {$com['statement_info'][0]['ratio']|showNumPercent} @@ -136,9 +137,10 @@ {$com['statement_info'][0]['d_statement_money']} {$com['fine']-0} {$com['reward']-0} + {$com['statement_info'][0]['week_amount']} {$com['statement_money']} {$com.settlement_contact} - {$com['statement_info'][0]['statement_begin_time']}-{$com['statement_info'][0]['statement_end_time']} + @@ -169,19 +171,22 @@ + + {$it['time']} + {$it['game_name']} {$it['pay_amount']} {$it['ratio']|showNumPercent} {$it['increment_ratio']|showNumPercent} {$it['fax_ratio']|showNumPercent} {$it['d_statement_money']} - {$it['statement_begin_time']}-{$it['statement_end_time']} + - 合计: + 合计: {$count.platform_amount} @@ -190,6 +195,7 @@ {$count.fine} {$count.reward} {$count.statement_money} + {$count.statement_money} diff --git a/Application/Admin/View/CompanyStatementPool/viewPuPool.html b/Application/Admin/View/CompanyStatementPool/viewPuPool.html index ab815655d..5a406fb39 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPuPool.html @@ -101,6 +101,7 @@ 序号 下游名称 + 结算时间 会长账号 内外团 @@ -110,7 +111,7 @@ 下游性质 产品 产品类型 - 结算时间 + 推广流水 退款 分成比例 @@ -118,6 +119,7 @@ 分成结算金额 奖励 罚款 + 周结算金额 结算金额 户名 @@ -143,6 +145,7 @@ + {$com['statement_info'][0]['time']} {$com['statement_info'][0]['account']} - @@ -157,7 +160,7 @@ {$com['statement_info'][0]['game_list'][0]['game_name']} {$com['statement_info'][0]['game_list'][0]['game_type_name']} - {$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']} + {$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]['ratio']}% @@ -165,6 +168,7 @@ {$com['statement_info'][0]['game_list'][0]['sum_money']} {$com['reward']} {$com['fine']} + {$com['statement_info'][0]['week_amount']} {$com['statement_money']} @@ -175,6 +179,7 @@ - - - + - - - - @@ -212,7 +217,7 @@ {$game['game_name']} {$game['game_type_name']} - {$game['statement_begin_time']}-{$game['statement_end_time']} + {$game['pay_amount']} {$game['refund']|default=0} {$game['ratio']}% @@ -230,12 +235,15 @@ + + {$account['time']} + {$account['account']} {$account['game_list'][0]['game_name']} {$account['game_list'][0]['game_type_name']} - {$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']} + {$account['game_list'][0]['pay_amount']} @@ -243,6 +251,9 @@ {$account['game_list'][0]['ratio']}% {$account['game_list'][0]['increment_ratio']}% {$account['game_list'][0]['sum_money']} + + {$account['week_amount']} + - @@ -252,6 +263,7 @@ - - - + - @@ -261,7 +273,7 @@ {$game['game_name']} {$game['game_type_name']} - {$game['statement_begin_time']}-{$game['statement_end_time']} + {$game['pay_amount']} @@ -290,6 +302,7 @@ {$count.sum_money} + {$count.sum_money}