diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 99958bf56..042994766 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -54,13 +54,13 @@ class CompanyStatementController extends ThinkController if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { $time_start = strtotime($_REQUEST['time_start']); $time_end = strtotime($_REQUEST['time_end'])+ 86399; - $map["_string"] = "(statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (statement_end_time BETWEEN {$time_start} AND {$time_end})"; + $map["_string"] = "( (statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (statement_end_time BETWEEN {$time_start} AND {$time_end}) )"; } elseif (isset($_REQUEST['time_start'])) { $time_start = strtotime($_REQUEST['time_start']); - $map["_string"] = "(statement_begin_time >= {$time_start} ) OR (statement_end_time >= {$time_start})"; + $map["_string"] = "( (statement_begin_time >= {$time_start} ) OR (statement_end_time >= {$time_start}) )"; } elseif (isset($_REQUEST['time_end'])) { $time_end = strtotime($_REQUEST['time_end'])+ 86399; - $map["_string"] = "(statement_begin_time <= {$time_end} ) OR (statement_end_time <= {$time_end})"; + $map["_string"] = "( (statement_begin_time <= {$time_end} ) OR (statement_end_time <= {$time_end}) )"; } if (isset($_REQUEST['time_start2']) && isset($_REQUEST['time_end2'])) { @@ -144,7 +144,7 @@ class CompanyStatementController extends ThinkController if(isset($_REQUEST['confirm_status'])){ $map['confirm_status'] = $_REQUEST['confirm_status']; } - + // dd($map); // $this->checkListOrCountAuthRestMap($map);//导出权限 //条件end $data = M("company_statement","tab_") @@ -710,16 +710,17 @@ class CompanyStatementController extends ThinkController } foreach ($dbres as $k=>$v) { - if($v['verify_status'] != 1) continue; - if($v['company_belong'] == 9){ - //上游 - $this->setDf($datas['up'],$v); - } elseif($v['withdraw_type'] == 3&&$v['company_type']==1){ - $this->setDf($datas['complement_down'],$v); - } elseif($v['withdraw_type'] == 3&&$v['company_type']==2){ - $this->setDf($datas['complement_user'],$v); - } else { - $this->setDf($datas['down'],$v); + if($v['verify_status'] == 1 || $v['verify_status'] == -2){ + if($v['company_belong'] == 9){ + //上游 + $this->setDf($datas['up'],$v); + } elseif($v['withdraw_type'] == 3&&$v['company_type']==1){ + $this->setDf($datas['complement_down'],$v); + } elseif($v['withdraw_type'] == 3&&$v['company_type']==2){ + $this->setDf($datas['complement_user'],$v); + } else { + $this->setDf($datas['down'],$v); + } } } @@ -770,7 +771,7 @@ class CompanyStatementController extends ThinkController M("company_lack_statement_info","tab_")->where("id in ({$v['del_lack_ids']})")->save(["is_pool"=>1]); } //修改结算单规则 - $this->updatePoolVerifyStatus($v['statement_ids'],1,2,"pool",$v['statement_num']); + $this->updatePoolVerifyStatus($v['statement_ids'],2,"pool",$v['statement_num']); } $this->ajaxReturn(array( 'status' => 1, @@ -778,10 +779,10 @@ class CompanyStatementController extends ThinkController )); } //结算单规则 - protected function updatePoolVerifyStatus($ids,$old_status,$change_status,$op_pre,$num){ + protected function updatePoolVerifyStatus($ids,$change_status,$op_pre,$num){ $dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id in ({$ids})")->select(); foreach($dbres as $k=>&$v){ - if($v['verify_status'] != $old_status) continue; + // if($v['verify_status'] != $old_status) continue; $v['verify_log'] = json_decode($v['verify_log'],true); $v['verify_log'][$op_pre.'_user']=$this->admininfo["username"]; $v['verify_log'][$op_pre.'_time']=date("Y.m.d H:i:s"); diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index cbaf8468c..0d7512876 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -299,55 +299,60 @@ class CompanyStatementSetController extends Controller { $promote_ratio = $cp[$add_data['company_id']]['channel_rate'] ?? 0; $fax_ratio = $cp[$add_data['company_id']]['taxation_rate'] ?? 0; //游戏统计 - if(!isset($v['list'])){continue;} - foreach($v['list'] as $ke=>$va){ - $game =[]; - $game['pay_amount'] =$va['pay_money']; - $game['game_name'] =$ke; - //获取游戏id及比例 - $game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find(); - if(empty($game_id) && isset($va['unique_code']) && !empty($va['unique_code'])){ - $unique_code = $va['unique_code']; - $game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find(); - } - if(empty($game_id)){ - $game['relation_game_id']=0; - $tratio = 0; - }else{ - //获取比例 - $game['relation_game_id']=$game_id['relation_game_id']; - if($type == 1){ - $tratio = getGameCpRadio($game_id['id'],$va['pay_money'],true); - }elseif($type == 0){ - $tratio = getGameCpRadio($game_id['id'],$va['pay_money'],false); - }else{ - //补丁 - $tratio1 = getGameCpRadio($game_id['id'],$va['pay_money'],true); - $tratio2 = getGameCpRadio($game_id['id'],$va['pay_money'],false); - $tratio = $tratio1-$tratio2; - if($tratio <= 0){continue;} - } - } - if($v['first_company_type'] == 1){ - $game['first_ratio']=$tratio-0; - $game['second_ratio']=100-$tratio; - }else{ - $game['first_ratio']=100-$tratio; - $game['second_ratio']=$tratio-0; - } - $add_data['pay_amount'] += $va['pay_money']; - - $game['sum_money']=round($va['pay_money']*(100-$promote_ratio)*$tratio*(100-$fax_ratio)/(100*100*100),2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率) - - $add_data['statement_money'] += $game['sum_money']; + if (isset($v['list'])) { + foreach ($v['list'] as $ke=>$va) { + $game =[]; + $game['pay_amount'] =$va['pay_money']; + $game['game_name'] =$ke; + //获取游戏id及比例 + $game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find(); + if (empty($game_id) && isset($va['unique_code']) && !empty($va['unique_code'])) { + $unique_code = $va['unique_code']; + $game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find(); + } + if (empty($game_id)) { + $game['relation_game_id']=0; + $tratio = 0; + } else { + //获取比例 + $game['relation_game_id']=$game_id['relation_game_id']; + if ($type == 1) { + $tratio = getGameCpRadio($game_id['id'], $va['pay_money'], true); + } elseif ($type == 0) { + $tratio = getGameCpRadio($game_id['id'], $va['pay_money'], false); + } else { + //补丁 + $tratio1 = getGameCpRadio($game_id['id'], $va['pay_money'], true); + $tratio2 = getGameCpRadio($game_id['id'], $va['pay_money'], false); + $tratio = $tratio1-$tratio2; + if ($tratio <= 0) { + continue; + } + } + } + if ($v['first_company_type'] == 1) { + $game['first_ratio']=$tratio-0; + $game['second_ratio']=100-$tratio; + } else { + $game['first_ratio']=100-$tratio; + $game['second_ratio']=$tratio-0; + } + $add_data['pay_amount'] += $va['pay_money']; + + $game['sum_money']=round($va['pay_money']*(100-$promote_ratio)*$tratio*(100-$fax_ratio)/(100*100*100), 2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率) + + $add_data['statement_money'] += $game['sum_money']; - $game['fax_ratio']=$fax_ratio; - $game['promote_ratio']=$promote_ratio; + $game['fax_ratio']=$fax_ratio; + $game['promote_ratio']=$promote_ratio; - $game['statement_begin_time']=$statement_begin_time; - $game['statement_end_time']=$statement_end_time; - $game['statement_type']=0; - $add_data['statement_info'][] = $game; + $game['statement_begin_time']=$statement_begin_time; + $game['statement_end_time']=$statement_end_time; + $game['statement_type']=0; + $add_data['statement_info'][] = $game; + } + }else{ + $add_data['statement_info'] = []; } $add_data['platform_amount'] = $add_data['pay_amount']; if($type < 2){ @@ -411,9 +416,9 @@ class CompanyStatementSetController extends Controller { //金额为0不补点 continue; } - if($add_data['platform_amount'] == 0){ + if($add_data['platform_amount'] == 0 && $add_data['statement_money'] == 0){ //全等于0表示没有流水,小于0依旧要结算 - return; + continue; } //添加 if($recount && $company_id !== false){ @@ -494,10 +499,13 @@ class CompanyStatementSetController extends Controller { ]; //获取pc公司 $company = M("CompanyInfo","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank")->where("partner = '海南万盟天下科技有限公司'")->find(); + $first_party_info = json_encode($company,JSON_UNESCAPED_UNICODE); + $company['partner'] = C("OFFICIEL_CHANNEL"); + $second_party_info = json_encode($company,JSON_UNESCAPED_UNICODE); $add_data=[ - "first_party_info"=>json_encode($company,JSON_UNESCAPED_UNICODE), - "second_party_info"=>json_encode($company,JSON_UNESCAPED_UNICODE), - "pay_type"=>1, + "first_party_info"=>$first_party_info, + "second_party_info"=>$second_party_info, + "pay_type"=>2, "withdraw_type"=>1, "statement_begin_time"=>$begintime, "statement_end_time"=>$endtime, @@ -509,7 +517,7 @@ class CompanyStatementSetController extends Controller { "is_payment"=>2, "statement_info"=>[], "company_belong"=>0, - "company_name"=>'海南万盟天下科技有限公司', + "company_name"=>C("OFFICIEL_CHANNEL"), "company_id"=>0, "company_type"=>1 ]; diff --git a/Application/Admin/View/CompanyStatement/lists.html b/Application/Admin/View/CompanyStatement/lists.html index 8147dc3f2..bc77a6907 100644 --- a/Application/Admin/View/CompanyStatement/lists.html +++ b/Application/Admin/View/CompanyStatement/lists.html @@ -475,8 +475,8 @@ }else if(id=="pool"){ var opname = "发起汇总"; var opurl = "{:U('pool')}"; - var opst ="[审批通过]"; - var status = [1]; + var opst ="[审批通过,汇总撤销]"; + var status = [1,-2]; }else if(id=="updateStatement"){ var opname = "重算金额"; var opurl = "{:U('updateStatement')}"; @@ -510,7 +510,7 @@ return; } text = text.join(","); - + console.log(text); if(flag){ layer.confirm(opname+"仅会对"+opst+"的申请进行处理,选择中包含其他的状态的申请将被忽略,点击取消停止操作",{title:false}, function(index){ layer.close(index); diff --git a/Public/Admin/excel/up_stream.xls b/Public/Admin/excel/up_stream.xls index cfcba995d..8f56a516d 100644 Binary files a/Public/Admin/excel/up_stream.xls and b/Public/Admin/excel/up_stream.xls differ