|
|
|
@ -80,6 +80,12 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
$typeflag = 2;//周结
|
|
|
|
|
$map["withdraw_type"] = ["in",[0,2]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($_REQUEST['withdraw_type'] == 3){
|
|
|
|
|
$typeflag = 3;//特殊补点
|
|
|
|
|
$map["withdraw_type"] = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['withdraw_type2'])) {
|
|
|
|
|
if($_REQUEST['withdraw_type2'] == 2){
|
|
|
|
@ -97,6 +103,22 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
$map['withdraw_type'] = ["in",[0,1]];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($_REQUEST['withdraw_type2'] == 3){
|
|
|
|
|
if ($typeflag == 3 || !$typeflag) {
|
|
|
|
|
$map["withdraw_type"] = 3;
|
|
|
|
|
} else {
|
|
|
|
|
$map["withdraw_type"] = 999; //两者不一搜索为空
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if($typeflag == 3) {
|
|
|
|
|
$map["withdraw_type"] = 999; //两者不一搜索为空
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//其他
|
|
|
|
|
if(isset($_REQUEST['company_type'])){
|
|
|
|
@ -122,12 +144,14 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
if(isset($_REQUEST['confirm_status'])){
|
|
|
|
|
$map['confirm_status'] = $_REQUEST['confirm_status'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// $this->checkListOrCountAuthRestMap($map);//导出权限
|
|
|
|
|
//条件end
|
|
|
|
|
$data = M("company_statement","tab_")
|
|
|
|
|
->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,confirm_status,confirm_log,op_time,remark")
|
|
|
|
|
->where($map)
|
|
|
|
|
->order("FIELD(verify_status,0,1,-1,2,3,-2,-3),id desc")->page($page,$row)->select();
|
|
|
|
|
|
|
|
|
|
foreach($data as $k => &$v) {
|
|
|
|
|
|
|
|
|
|
$v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']);
|
|
|
|
@ -138,8 +162,8 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
$v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$v['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" : ($v['withdraw_type'] == 3 ?"特殊补点" : "周结"));
|
|
|
|
|
$v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" :"正常结算");
|
|
|
|
|
$v['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" : ($v['withdraw_type'] == 3 ?"其他" : "周结"));
|
|
|
|
|
$v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" : ($v['withdraw_type'] == 3 ?"特殊补点" : "正常结算"));
|
|
|
|
|
|
|
|
|
|
$v['verify_log'] = json_decode($v['verify_log'], true);
|
|
|
|
|
$v['confirm_log'] = json_decode($v['confirm_log'], true);
|
|
|
|
@ -443,10 +467,12 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
//导出
|
|
|
|
|
public function export()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(!isset($_REQUEST['id'])) $this->error("参数错误");
|
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
|
|
|
|
|
$data = M("CompanyStatement","tab_")->where(['id' => $id])->find();
|
|
|
|
|
|
|
|
|
|
$data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方
|
|
|
|
|
$data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方
|
|
|
|
|
$data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录
|
|
|
|
@ -481,7 +507,33 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
} else {
|
|
|
|
|
//下游
|
|
|
|
|
// if($dbres["company_type"] == 1){
|
|
|
|
|
|
|
|
|
|
if ($data['withdraw_type'] == 3 && $data['company_type'] == 2) {
|
|
|
|
|
|
|
|
|
|
$dbres = M("CompanyStatement","tab_")->where(['id' => $id])->find();
|
|
|
|
|
if($dbres['pay_type'] == 2){
|
|
|
|
|
//乙方收款
|
|
|
|
|
$dbres['company_info'] = $dbres['second_party_info'];
|
|
|
|
|
}else{
|
|
|
|
|
$dbres['company_info'] = $dbres['first_party_info'];
|
|
|
|
|
}
|
|
|
|
|
unset($dbres['second_party_info']);
|
|
|
|
|
unset($dbres['first_party_info']);
|
|
|
|
|
|
|
|
|
|
$dbres=[$dbres];
|
|
|
|
|
|
|
|
|
|
$this->assign("title","下游个人特殊补点");
|
|
|
|
|
$this->exportSpecialComplement($dbres,1);
|
|
|
|
|
|
|
|
|
|
} else if ($data['withdraw_type'] == 3 && $data['company_type'] != 2){
|
|
|
|
|
excelSpecialComplementEmplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
// $data['statement_begin_time'] = date('Ymd',$data['statement_begin_time']);
|
|
|
|
|
// $data['statement_end_time'] = date('Ymd',$data['statement_end_time']);
|
|
|
|
@ -492,6 +544,105 @@ class CompanyStatementController extends ThinkController
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function exportSpecialComplement(&$infolist,$is_export) {
|
|
|
|
|
|
|
|
|
|
$line = 1;
|
|
|
|
|
$count = [];
|
|
|
|
|
//获取对接人
|
|
|
|
|
foreach($infolist as $k=>&$v){
|
|
|
|
|
$infolist[$k]['reward'] = 0;
|
|
|
|
|
$infolist[$k]['fine'] = 0;
|
|
|
|
|
$v['statement_info'] = json_decode($v['statement_info'],true);
|
|
|
|
|
$v['company_info'] = json_decode($v['company_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']);
|
|
|
|
|
$v['company_info']['nickname'] = $v['statement_info'][0]['real_name'];
|
|
|
|
|
|
|
|
|
|
if (isset($v['company_info']['company_type'])) {
|
|
|
|
|
if($v['company_info']['company_type'] == 1) {
|
|
|
|
|
$v['company_info']['company_type_str'] = '公司';
|
|
|
|
|
} elseif($v['company_info']['company_type'] == 2){
|
|
|
|
|
$v['company_info']['company_type_str'] = '个人';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($v['company_info']['company_belong'])) {
|
|
|
|
|
$v['company_info']['company_belong_str'] = getCompanyBlong($v['company_info']['company_belong']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($v['company_info']['develop_type'])) {
|
|
|
|
|
$v['company_info']['company_relation_str'] = getCompanyRelation($v['company_info']['develop_type']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$cline = $line+1;
|
|
|
|
|
if($is_export){
|
|
|
|
|
$v['statement_money'] = "=";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$row = 0;
|
|
|
|
|
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(isset($val['ratio'])){
|
|
|
|
|
$val['increment_ratio'] = 0;
|
|
|
|
|
}else{
|
|
|
|
|
$val['ratio'] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($is_export){
|
|
|
|
|
if($v['withdraw_type'] != 3) {
|
|
|
|
|
$val['sum_money'] = "=K{$line}*(L{$line}+M{$line})";
|
|
|
|
|
} else {
|
|
|
|
|
$val['sum_money'] = "=K{$line}*(M{$line})";
|
|
|
|
|
}
|
|
|
|
|
// $val['sum_money'] = "=J{$line}*(K{$line}+L{$line})";
|
|
|
|
|
$v['statement_money'] .= "N{$line}+";
|
|
|
|
|
}else{
|
|
|
|
|
$count['platform_amount'] += $val['pay_amount'];
|
|
|
|
|
$count['sum_money'] += $val['sum_money'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if($is_export){
|
|
|
|
|
// //J3*(K3+L3)+M3-N3
|
|
|
|
|
// if($va['statement_type'] > 0){ //罚款服务器费用
|
|
|
|
|
// $va['sum_money'] = "=J{$line}";
|
|
|
|
|
// }else{
|
|
|
|
|
// $va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// $count['platform_amount'] += $va['pay_amount'];
|
|
|
|
|
// $count['sum_money'] += $va['sum_money'];
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
$v['row'] = $row;
|
|
|
|
|
if($is_export){
|
|
|
|
|
|
|
|
|
|
if($v['withdraw_type'] != 3) {
|
|
|
|
|
$v['statement_money'] .="N{$cline}-O{$cline}";
|
|
|
|
|
} else {
|
|
|
|
|
$v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1);
|
|
|
|
|
}
|
|
|
|
|
// dump($v['statement_money']);die();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($is_export){
|
|
|
|
|
$count["platform_amount"] = "=SUM(K2:K".$line.")";
|
|
|
|
|
$count["sum_money"] = "=SUM(Q2:Q".$line.")";
|
|
|
|
|
}
|
|
|
|
|
$this->assign("data",$infolist);
|
|
|
|
|
$this->assign("count",$count);
|
|
|
|
|
$this->assign("is_export",$is_export);
|
|
|
|
|
$this->display("CompanyStatementPool/viewPuPool");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//汇总
|
|
|
|
|
public function pool()
|
|
|
|
|
{
|
|
|
|
|