diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php
index 16645934d..6e421beb5 100644
--- a/Application/Admin/Controller/CompanyStatementController.class.php
+++ b/Application/Admin/Controller/CompanyStatementController.class.php
@@ -491,7 +491,6 @@ class CompanyStatementController extends ThinkController
$StatementInfo = M("company_statement_info","tab_");
$company_info = $va['company_info'];
if($k == "up" || $k=="ups"){
- $company_type = 1;
foreach ($va['statement_info'] as $key => &$value) {
if($company_info['pay_type'] == 2){
$value["ratio"] = $value["second_ratio"];
@@ -501,15 +500,11 @@ class CompanyStatementController extends ThinkController
unset($value["first_ratio"]);
unset($value["second_ratio"]);
}
- }else{
- //下游
- $company_type = 2;
}
-
$adddata=[
"pool_id"=>$pool_id,
"company_id"=>$company_info['id'],
- "company_type"=>$company_type,
+ "company_type"=>$v['company_type'],
"company_name"=>$company_info['partner'],
"ali_user"=>$company_info['ali_user'],
"ali_account"=>$company_info['ali_account'],
@@ -551,8 +546,8 @@ class CompanyStatementController extends ThinkController
if(isset($savedata['company_list'][$v['company_id']])){
//存在游戏合并
$a = &$savedata['company_list'][$v['company_id']];
- $a['fine'] = $fine;
- $a['reward'] = $reward;
+ $a['fine'] += $fine;
+ $a['reward'] += $reward;
$a['statement_info'] = array_merge($a['statement_info'],$v['statement_info']);
// dump($a['statement_info']);
$a['platform_amount'] += $v['platform_amount'];
diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php
index c1d3c91e5..eea86812d 100644
--- a/Application/Admin/Controller/CompanyStatementPoolController.class.php
+++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php
@@ -170,70 +170,103 @@ class CompanyStatementPoolController extends ThinkController
$this->error('参数错误');
}
$id = $_REQUEST['id'];
+ $is_export= false;
+ 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'] == 1){
+ 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;
}
+ $count = [];
//初始值
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'];
$v['statement_money_exp'] = "=";
foreach($v['statement_info'] as $ke=>&$va){
$line ++;
- if($infolist[0]['company_type'] == 1){
+
+ if($infolist[0]['company_type'] == 3){
$va['sum_money_exp'] = "=F{$line}*G{$line}";
$v['statement_money_exp'] .= "K{$line}+";
$va['company_ratio'] = 100-$va['ratio'];
+ if($is_export){
+ $va['d_statement_money'] = $va['sum_money_exp'];
+ }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['platform_amount_exp'] .= "E{$line}+";
+ $count['platform_amount_exp2'] .= "F{$line}+";
+
+ $count['d_statement_money'] += $va['d_statement_money'];
+ $count['d_statement_money_exp'] .= "K{$line}+";
}
-
-
}
- if($infolist[0]['company_type'] == 1){
+ if($infolist[0]['company_type'] == 3){
+ //上游
+ $v['matche_platform'] = $Partner[$v['company_id']];
$v['statement_money_exp'] .= "M{$cline}-L{$cline}";
- }
+ if($is_export){
+ $v['statement_money'] = $v['statement_money_exp'];
+ }
+
+
+ //统计
+
+
+ $count['fine'] += $v['fine'];
+ $count['fine_exp'] .= "L{$cline}+";
+
+ $count['reward'] += $v['reward'];
+ $count['reward_exp'] .= "M{$cline}+";
+
+ $count['statement_money'] += $v['statement_money'];
+ $count['statement_money_exp'] .= "N{$cline}+";
+
+ }
$v['statement_count'] = count($v['statement_info']);
+
}
- // dd($infolist);
+ 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"],"+");
+ }
+
- // $dbres = $this->DBModel->where("id='{$id}'")->find();
+ }
- // $first_party_info = json_decode($dbres['first_party_info'],true);
- // $second_party_info = json_decode($dbres['second_party_info'],true);
- // $statement_info = json_decode($dbres['statement_info'],true);
-
- // if($dbres['pay_type'] == 2){
- // $company = $second_party_info['partner'];
- // $pyinfo = $second_party_info;
- // $fkf_pyinfo = $first_party_info;
- // }else{
- // $company = $first_party_info['partner'];
- // $pyinfo = $first_party_info;
- // $fkf_pyinfo = $second_party_info;
- // }
- // $senddata = array(
- // "company"=>$company,
- // "payinfo"=>$pyinfo,
- // "fkf_payinfo"=>$fkf_pyinfo,
- // "first_part_company"=>$first_party_info['partner'],
- // "second_part_company"=>$second_party_info['partner'],
- // "pay_type"=>$dbres['pay_type'],
- // "withdraw_type"=>$dbres['withdraw_type'],//2补丁
- // "first_party_info"=>$first_party_info,
- // "second_party_info"=>$second_party_info,
- // "statement_info"=>$statement_info,
- // "statement_count"=>array("pay_amount"=>$dbres['pay_amount'],"statement_money"=>$dbres['statement_money'],"big_ratio_money"=>convertAmountToCn($dbres['statement_money']))
- // );
$this->assign("data",$infolist);
+ $this->assign("count",$count);
+ $this->assign("is_export",$is_export);
// if($dbres["company_belong"] == 9){
// //上游
diff --git a/Application/Admin/View/CompanyStatementPool/viewCpPool.html b/Application/Admin/View/CompanyStatementPool/viewCpPool.html
index ee1004416..cf3d0213d 100644
--- a/Application/Admin/View/CompanyStatementPool/viewCpPool.html
+++ b/Application/Admin/View/CompanyStatementPool/viewCpPool.html
@@ -18,6 +18,7 @@
+