|
|
|
@ -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']);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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"],"+");
|
|
|
|
|
}
|
|
|
|
|
// dd($infolist);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $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){
|
|
|
|
|
// //上游
|
|
|
|
|