From 7ac118c024b28247bcff09ceac0ff8866f8eadc2 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 8 Jun 2020 15:32:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E6=B8=B8=E5=85=AC=E5=8F=B8=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementPoolController.class.php | 184 ++++++++++++------ .../View/CompanyStatementPool/viewPcPool.html | 177 +++++++++++++++++ 2 files changed, 300 insertions(+), 61 deletions(-) create mode 100644 Application/Admin/View/CompanyStatementPool/viewPcPool.html diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 5072032b7..a5a11d502 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -174,98 +174,160 @@ class CompanyStatementPoolController extends ThinkController if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ $is_export = true; } - - $Poolres = M("company_statement_pool","tab_")->where("id = '{$id}'")->find(); //获取基本信息 $infolist = M("company_statement_info","tab_")->where("pool_id = '{$id}'")->select(); + if($infolist[0]['company_type'] == 3){ //上游 - $line = 2; - //获取平台名 - $p_id = array_column($infolist,'company_id'); - $map['id'] = ['in',$p_id]; - $pl = M("Partner","tab_")->field("id,matche_platform")->where($map)->select(); - $Partner = []; - foreach($pl as $k=>$v){ - $Partner[$v['id']] = $v['matche_platform']; - } - unset($pl); - }else{ - $line = 1; + $this->viewCpPool($infolist,$is_export); + }elseif($infolist[0]['company_type'] == 1){ + //下游公司 + $this->viewPcPool($infolist,$is_export); } + } + protected function viewPcPool(&$infolist,$is_export){ + $line = 1; $count = []; - //初始值 + //获取对接人 + $p_id = array_column($infolist,'company_id'); + $map['id'] = ['in',$p_id]; + $pl = M("promote_company","tab_")->field("id,settlement_contact")->where($map)->select(); + $Partner = []; + foreach($pl as $k=>$v){ + $Partner[$v['id']] = $v['settlement_contact']; + } + unset($pl); foreach($infolist as $k=>&$v){ $v['statement_info'] = json_decode($v['statement_info'],true); $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']); $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']); $cline = $line+1; - // if($v['fine'] > 0) $v['fine'] = 0-$v['fine']; if($is_export){ $v['statement_money_exp'] = "="; } - foreach($v['statement_info'] as $ke=>&$va){ $line ++; + if(isset($va['ratio'])){ + $va['increment_ratio'] = 0; + }else{ + $va['ratio'] = 0; + } - if($infolist[0]['company_type'] == 3){ + if($is_export){ + $v['statement_money_exp'] .= "H{$line}+"; - $va['company_ratio'] = 100-$va['ratio']; - if($is_export){ - $v['statement_money_exp'] .= "K{$line}+"; - $va['d_statement_money'] = "=F{$line}*G{$line}"; - $count['platform_amount_exp'] .= "E{$line}+"; - $count['platform_amount_exp2'] .= "F{$line}+"; - $count['d_statement_money_exp'] .= "K{$line}+"; - }else{ - $va['d_statement_money'] = round($va['pay_amount']*$va['ratio']/100,2); - $count['platform_amount'] += $va['pay_amount']; - $count['platform_amount2'] += $va['pay_amount']; - $count['d_statement_money'] += $va['d_statement_money']; - } + $va['d_statement_money'] = "=D{$line}*(1-G{$line})*(E{$line}+F{$line})"; + + $count['platform_amount_exp'] .= "D{$line}+"; + $count['d_statement_money_exp'] .= "H{$line}+"; + + }else{ + $va['d_statement_money'] = round($va['pay_amount']*($va['ratio']+$va['increment_ratio'])*(100-$va['fax_ratio'])/100/100,2); + + $count['platform_amount'] += $va['pay_amount']; + + $count['d_statement_money'] += $va['d_statement_money']; } } - if($infolist[0]['company_type'] == 3){ - //上游 - $v['matche_platform'] = $Partner[$v['company_id']]; + $v['settlement_contact'] = $Partner[$v['company_id']]; + + if($is_export){ + $v['statement_money_exp'] .= "J{$cline}-I{$cline}"; + $v['statement_money'] = $v['statement_money_exp']; + + $count['fine_exp'] .= "I{$cline}+"; + $count['reward_exp'] .= "J{$cline}+"; + + $count['statement_money_exp'] .= "K{$cline}+"; + }else{ + $count['fine'] += $v['fine']; + $count['reward'] += $v['reward']; + $count['statement_money'] += $v['statement_money']; + } + $v['statement_count'] = count($v['statement_info']); + + } + if($is_export){ + $count["d_statement_money"] = "=".trim($count["d_statement_money_exp"],"+"); + $count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+"); + $count["fine"] = "=".trim($count["fine_exp"],"+"); + $count["reward"] = "=".trim($count["reward_exp"],"+"); + $count["statement_money"] = "=".trim($count["statement_money_exp"],"+"); + } + + $this->assign("data",$infolist); + $this->assign("count",$count); + $this->assign("is_export",$is_export); + $this->display("viewPcPool"); + + } + + //上游汇总查看及导出 + protected function viewCpPool(&$infolist,$is_export) + { + $line = 2; + $count = []; + //获取平台名 + $p_id = array_column($infolist,'company_id'); + $map['id'] = ['in',$p_id]; + $pl = M("Partner","tab_")->field("id,matche_platform")->where($map)->select(); + $Partner = []; + foreach($pl as $k=>$v){ + $Partner[$v['id']] = $v['matche_platform']; + } + unset($pl); + // + foreach($infolist as $k=>&$v){ + $v['statement_info'] = json_decode($v['statement_info'],true); + $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']); + $v['statement_end_time'] = date('Y-m-d',$v['statement_end_time']); + $cline = $line+1; + if($is_export){ + $v['statement_money_exp'] = "="; + } + foreach($v['statement_info'] as $ke=>&$va){ + $line ++; + $va['company_ratio'] = 100-$va['ratio']; if($is_export){ - $v['statement_money_exp'] .= "M{$cline}-L{$cline}"; - $v['statement_money'] = $v['statement_money_exp']; - $count['fine_exp'] .= "L{$cline}+"; - $count['reward_exp'] .= "M{$cline}+"; - $count['statement_money_exp'] .= "N{$cline}+"; + $v['statement_money_exp'] .= "K{$line}+"; + $va['d_statement_money'] = "=F{$line}*G{$line}"; + $count['platform_amount_exp'] .= "E{$line}+"; + $count['platform_amount_exp2'] .= "F{$line}+"; + $count['d_statement_money_exp'] .= "K{$line}+"; }else{ - $count['fine'] += $v['fine']; - $count['reward'] += $v['reward']; - $count['statement_money'] += $v['statement_money']; + $va['d_statement_money'] = round($va['pay_amount']*$va['ratio']/100,2); + $count['platform_amount'] += $va['pay_amount']; + $count['platform_amount2'] += $va['pay_amount']; + $count['d_statement_money'] += $va['d_statement_money']; } - + } + $v['matche_platform'] = $Partner[$v['company_id']]; + if($is_export){ + $v['statement_money_exp'] .= "M{$cline}-L{$cline}"; + $v['statement_money'] = $v['statement_money_exp']; + $count['fine_exp'] .= "L{$cline}+"; + $count['reward_exp'] .= "M{$cline}+"; + $count['statement_money_exp'] .= "N{$cline}+"; + }else{ + $count['fine'] += $v['fine']; + $count['reward'] += $v['reward']; + $count['statement_money'] += $v['statement_money']; } $v['statement_count'] = count($v['statement_info']); } - if($infolist[0]['company_type'] == 3){ - //上游 - if($is_export){ - $count["d_statement_money"] = "=".trim($count["d_statement_money_exp"],"+"); - $count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+"); - $count["platform_amount2"] = "=".trim($count["platform_amount_exp2"],"+"); - $count["fine"] = "=".trim($count["fine_exp"],"+"); - $count["reward"] = "=".trim($count["reward_exp"],"+"); - $count["statement_money"] = "=".trim($count["statement_money_exp"],"+"); - } + if($is_export){ + $count["d_statement_money"] = "=".trim($count["d_statement_money_exp"],"+"); + $count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+"); + $count["platform_amount2"] = "=".trim($count["platform_amount_exp2"],"+"); + $count["fine"] = "=".trim($count["fine_exp"],"+"); + $count["reward"] = "=".trim($count["reward_exp"],"+"); + $count["statement_money"] = "=".trim($count["statement_money_exp"],"+"); } - $this->assign("data",$infolist); $this->assign("count",$count); $this->assign("is_export",$is_export); - // dd($count); - if($infolist[0]['company_type'] == 3){ - // //上游 - $this->display("viewCpPool"); - }else{ - // $this->display("viewPcStatement"); - } + $this->display("viewCpPool"); } //审批通过 diff --git a/Application/Admin/View/CompanyStatementPool/viewPcPool.html b/Application/Admin/View/CompanyStatementPool/viewPcPool.html new file mode 100644 index 000000000..0a8f834f5 --- /dev/null +++ b/Application/Admin/View/CompanyStatementPool/viewPcPool.html @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号公司名称合作产品名称平台总额(元)下游内团分成比例补点比例税费费率分成金额/元罚款奖励合计/元对账人结算日期备注
{$key-0+1}{$com.company_name}{$com['statement_info'][0]['game_name']}{$com['statement_info'][0]['pay_amount']}{$com['statement_info'][0]['ratio']}%{$com['statement_info'][0]['increment_ratio']}%{$com['statement_info'][0]['fax_ratio']}%{$com['statement_info'][0]['d_statement_money']}{$com.fine}{$com.reward}{$com.statement_money}{$com.settlement_contact}{$com['statement_info'][0]['statement_begin_time']} ~ {$com['statement_info'][0]['statement_end_time']}{$com.renark}
{$it['game_name']}{$it['pay_amount']}{$it['ratio']}%{$it['increment_ratio']}%{$it['fax_ratio']}%{$it['d_statement_money']}{$it['statement_begin_time']} ~ {$it['statement_end_time']}
合计:{$count.platform_amount}{$count.d_statement_money}{$count.fine}{$count.reward}{$count.statement_money}
+
+
+ + +