|
|
|
@ -113,8 +113,8 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
->page($page,$row)->select();
|
|
|
|
|
foreach($data as $k => &$v) {
|
|
|
|
|
|
|
|
|
|
$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['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_type_str'] = $this->CompanyType[$v['company_type']];
|
|
|
|
|
$v['is_payment_str'] = $this->IsPayment[$v['is_payment']];
|
|
|
|
@ -123,8 +123,8 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
$v['can_export'] = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$v['op_time'] = date('Y-m-d H:i:s',$v['op_time']);
|
|
|
|
|
$v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
|
|
|
|
|
$v['op_time'] = date('Y.m.d H:i:s',$v['op_time']);
|
|
|
|
|
$v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
|
|
|
|
|
|
|
|
|
|
$v['ext_file_type'] = empty($v['ext_file']) ? "无" : "有";
|
|
|
|
|
$v['withdraw_type'] = $this->WithdrawType[$v['withdraw_type']];;
|
|
|
|
@ -208,10 +208,15 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
$infolist = M("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}'")->select();
|
|
|
|
|
//获取母单
|
|
|
|
|
$pool_info = M("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment')->where("id={$id}")->find();
|
|
|
|
|
if(!empty($pool_info['create_lack_ids'])){
|
|
|
|
|
$l_ids = $pool_info['create_lack_ids'];
|
|
|
|
|
$lack_info = M("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select();
|
|
|
|
|
$infolist =array_merge($infolist,$lack_info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$statement_num = $pool_info['statement_num'];
|
|
|
|
|
$this->assign("title",$statement_num);
|
|
|
|
|
$this->assign("pool_status",$pool_info['verify_status']);
|
|
|
|
|
$this->assign("pool_status",$pool_info['verify_status']);
|
|
|
|
|
$this->assign("is_payment",$pool_info['is_payment']);
|
|
|
|
|
if($infolist[0]['company_type'] == 3){
|
|
|
|
|
//上游
|
|
|
|
@ -220,20 +225,12 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
//下游公司
|
|
|
|
|
$this->viewPcPool($infolist,$is_export);
|
|
|
|
|
}else{
|
|
|
|
|
//获取母单
|
|
|
|
|
if(!empty($pool_info['create_lack_ids'])){
|
|
|
|
|
$l_ids = $pool_info['create_lack_ids'];
|
|
|
|
|
$lack_info = M("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select();
|
|
|
|
|
|
|
|
|
|
$infolist =array_merge($infolist,$lack_info);
|
|
|
|
|
}
|
|
|
|
|
$this->viewPuPool($infolist,$is_export);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//个人汇总结算查看
|
|
|
|
|
public function viewPuPool(&$infolist,$is_export){
|
|
|
|
|
// dd($infolist);
|
|
|
|
|
$line = 1;
|
|
|
|
|
$count = [];
|
|
|
|
|
//获取对接人
|
|
|
|
@ -242,6 +239,13 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
$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']);
|
|
|
|
|
if( isset($v['verify_status'])){
|
|
|
|
|
if( $v['verify_status'] ==2 ){
|
|
|
|
|
$v['is_payment'] = 2; //不打款
|
|
|
|
|
}else{
|
|
|
|
|
$v['is_payment'] = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$cline = $line+1;
|
|
|
|
|
if($is_export){
|
|
|
|
|
$v['sum_money_exp'] = "=";
|
|
|
|
@ -292,8 +296,16 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
unset($pl);
|
|
|
|
|
foreach($infolist as $k=>&$v){
|
|
|
|
|
$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']);
|
|
|
|
|
if( isset($v['verify_status'])){
|
|
|
|
|
if( $v['verify_status'] ==2 ){
|
|
|
|
|
$v['is_payment'] = 2; //不打款
|
|
|
|
|
}else{
|
|
|
|
|
$v['is_payment'] = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$cline = $line+1;
|
|
|
|
|
if($is_export){
|
|
|
|
|
$v['statement_money_exp'] = "=";
|
|
|
|
@ -310,10 +322,6 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
$v['statement_money_exp'] .= "H{$line}+";
|
|
|
|
|
|
|
|
|
|
$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);
|
|
|
|
|
|
|
|
|
@ -327,11 +335,6 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
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'];
|
|
|
|
@ -341,13 +344,13 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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"],"+");
|
|
|
|
|
$count["platform_amount"] = "=SUM(D2:D".$line.")";
|
|
|
|
|
$count["d_statement_money"] = "=SUM(H2:H".$line.")";
|
|
|
|
|
$count["fine"] = "=SUM(I2:I".$line.")";
|
|
|
|
|
$count["reward"] = "=SUM(J2:J".$line.")";
|
|
|
|
|
$count["statement_money"] = "=SUM(K2:K".$line.")";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// dd($infolist);
|
|
|
|
|
$this->assign("data",$infolist);
|
|
|
|
|
$this->assign("count",$count);
|
|
|
|
|
$this->assign("is_export",$is_export);
|
|
|
|
@ -372,8 +375,18 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
//
|
|
|
|
|
foreach($infolist as $k=>&$v){
|
|
|
|
|
$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']);
|
|
|
|
|
|
|
|
|
|
if( isset($v['verify_status'])){
|
|
|
|
|
if( $v['verify_status'] ==2 ){
|
|
|
|
|
$v['is_payment'] = 2; //不打款
|
|
|
|
|
}else{
|
|
|
|
|
$v['is_payment'] = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$cline = $line+1;
|
|
|
|
|
if($is_export){
|
|
|
|
|
$v['statement_money_exp'] = "=";
|
|
|
|
@ -384,9 +397,6 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
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'];
|
|
|
|
@ -398,9 +408,6 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
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'];
|
|
|
|
@ -410,13 +417,14 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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"],"+");
|
|
|
|
|
$count["d_statement_money"] = "=SUM(K3:K".$line.")";
|
|
|
|
|
$count["platform_amount"] = "=SUM(E3:E".$line.")";
|
|
|
|
|
$count["platform_amount2"] = "=SUM(F3:F".$line.")";
|
|
|
|
|
$count["fine"] = "=SUM(L3:L".$line.")";
|
|
|
|
|
$count["reward"] = "=SUM(M3:M".$line.")";
|
|
|
|
|
$count["statement_money"] = "=SUM(N3:N".$line.")";
|
|
|
|
|
}
|
|
|
|
|
// dd($infolist);
|
|
|
|
|
$this->assign("data",$infolist);
|
|
|
|
|
$this->assign("count",$count);
|
|
|
|
|
$this->assign("is_export",$is_export);
|
|
|
|
@ -457,7 +465,7 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
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");
|
|
|
|
|
$v['verify_log'][$op_pre.'_time']=date("Y.m.d H:i:s");
|
|
|
|
|
$v['verify_log'] = json_encode($v['verify_log']);
|
|
|
|
|
$v['verify_status']=$change_status;
|
|
|
|
|
$this->DBModel->save($v);
|
|
|
|
@ -475,7 +483,7 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
$dbres = $this->DBModel->field("id,verify_status,verify_log")->where("id = {$id}")->find();
|
|
|
|
|
$dbres['verify_log'] = json_decode($dbres['verify_log'],true);
|
|
|
|
|
$dbres['verify_log'][$op_pre.'_user']=$this->admininfo["username"];
|
|
|
|
|
$dbres['verify_log'][$op_pre.'_time']=date("Y-m-d H:i:s");
|
|
|
|
|
$dbres['verify_log'][$op_pre.'_time']=date("Y.m.d H:i:s");
|
|
|
|
|
$dbres['verify_log'] = json_encode($dbres['verify_log']);
|
|
|
|
|
$dbres['verify_status']=$change_status;
|
|
|
|
|
$this->DBModel->save($dbres);
|
|
|
|
@ -492,16 +500,22 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
$CompanyInfo = M("company_statement_info","tab_")
|
|
|
|
|
->alias('i')
|
|
|
|
|
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,p.statement_num,i.remark,i.pay_status,p.statement_money all_money")
|
|
|
|
|
->field("i.id,i.pool_id,i.company_name,i.company_info,i.statement_money,p.statement_num,i.remark,i.pay_status,p.statement_money all_money,i.verify_status")
|
|
|
|
|
->join("tab_company_statement_pool p ON p.id = i.pool_id")
|
|
|
|
|
->where("pool_id='{$id}'")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
foreach($CompanyInfo as $k=>&$v){
|
|
|
|
|
if($v['verify_status'] == 2){
|
|
|
|
|
$v['is_payment'] = 2;
|
|
|
|
|
}else{
|
|
|
|
|
$v['is_payment'] = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$v['company_info'] = json_decode($v['company_info'],true);
|
|
|
|
|
$v['company_info']['ali_user'] ?? '';
|
|
|
|
|
$v['company_info']['ali_account'] ?? '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign("CompanyInfo",$CompanyInfo);
|
|
|
|
|
$this->assign("id",$id);
|
|
|
|
|
$this->display();
|
|
|
|
@ -514,25 +528,31 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
//循环保存
|
|
|
|
|
foreach($info as $k=>$v){
|
|
|
|
|
$ydata = $CompanyInfo->where("id= '{$k}'")->find();
|
|
|
|
|
if($ydata['verify_status'] == 2){continue;}
|
|
|
|
|
|
|
|
|
|
$company_info = json_decode($ydata['company_info'],true);
|
|
|
|
|
$company_info['ali_user'] = $v['ali_user'];
|
|
|
|
|
$company_info['ali_account'] = $v['ali_account'];
|
|
|
|
|
if($ydata['verify_status'] == 2){
|
|
|
|
|
$company_info['payee_name'] = $v['payee_name'];
|
|
|
|
|
$company_info['bank_account'] = $v['bank_account'];
|
|
|
|
|
$company_info['opening_bank'] = $v['opening_bank'];
|
|
|
|
|
}else{
|
|
|
|
|
$company_info['ali_user'] = $v['ali_user'];
|
|
|
|
|
$company_info['ali_account'] = $v['ali_account'];
|
|
|
|
|
}
|
|
|
|
|
$savedata = [
|
|
|
|
|
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
|
|
|
|
|
"remark"=>$v['remark'],
|
|
|
|
|
"id"=>$k
|
|
|
|
|
];
|
|
|
|
|
if(empty($v['ali_user']) || empty($v['ali_account'])){
|
|
|
|
|
$savedata['verify_status'] = -1;
|
|
|
|
|
}else{
|
|
|
|
|
$savedata['verify_status'] = 1;
|
|
|
|
|
if($ydata['verify_status'] != 2){
|
|
|
|
|
if(empty($v['ali_user']) || empty($v['ali_account'])){
|
|
|
|
|
$savedata['verify_status'] = -1;
|
|
|
|
|
}else{
|
|
|
|
|
$savedata['verify_status'] = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$CompanyInfo->save($savedata);
|
|
|
|
|
}
|
|
|
|
|
//修改状态
|
|
|
|
|
$this->setOneVerifyStatus(2,"payment",$_REQUEST['pool_id'],$mgs = "打款信息提交");
|
|
|
|
|
$this->setOneVerifyStatus(2,"payment",$_REQUEST['pool_id'],$mgs = "打款信息确认");
|
|
|
|
|
}
|
|
|
|
|
//查看打款信息
|
|
|
|
|
public function viewPayment(){
|
|
|
|
@ -693,13 +713,11 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
'verify_status'=>0
|
|
|
|
|
];
|
|
|
|
|
//
|
|
|
|
|
if(empty($pool_data['create_lack_ids'])){
|
|
|
|
|
if(empty($pool['create_lack_ids'])){
|
|
|
|
|
$pool_data['create_lack_ids'] = $l_id;
|
|
|
|
|
}else{
|
|
|
|
|
$pool_data['create_lack_ids'] = $pool_data['create_lack_ids'].",".$l_id;
|
|
|
|
|
$pool_data['create_lack_ids'] = $pool['create_lack_ids'].",".$l_id;
|
|
|
|
|
}
|
|
|
|
|
$info_ids = explode(",",$pool['info_ids']);
|
|
|
|
|
$pool_data['info_ids'] =implode(",",array_diff($info_ids,[$id]));
|
|
|
|
|
M("company_statement_pool","tab_")->save($pool_data);
|
|
|
|
|
M("company_statement_info","tab_")->where("id='{$id}'")->delete();
|
|
|
|
|
$this->ajaxReturn(array(
|
|
|
|
@ -777,12 +795,12 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
$this->ajaxReturn(array('status' => 0,"info"=>"重算失败"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
M()->commit();
|
|
|
|
|
|
|
|
|
|
//重新计算
|
|
|
|
|
$stime = $info['statement_end_time']-0+1;
|
|
|
|
|
$type = $info['withdraw_type'];
|
|
|
|
|
A("CompanyStatementSet")->promoteUserPool($type,$stime,true,$info['is_payment']);
|
|
|
|
|
|
|
|
|
|
A("CompanyStatementSet")->promoteUserPool($type,$stime,true);
|
|
|
|
|
M()->commit();
|
|
|
|
|
$this->ajaxReturn(array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'info' => "重算成功"
|
|
|
|
@ -836,7 +854,7 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
foreach($st_res as $k=>&$v){
|
|
|
|
|
$v['verify_log'] = json_decode($v['verify_log'],true);
|
|
|
|
|
$v['verify_log']['pool_user']=$this->admininfo["username"];
|
|
|
|
|
$v['verify_log']['pool_time']=date("Y-m-d H:i:s");
|
|
|
|
|
$v['verify_log']['pool_time']=date("Y.m.d H:i:s");
|
|
|
|
|
$v['verify_log'] = json_encode($v['verify_log']);
|
|
|
|
|
$v['verify_status']=-3;
|
|
|
|
|
$stres = M("company_statement","tab_")->save($v);
|
|
|
|
@ -901,7 +919,7 @@ class CompanyStatementPoolController extends ThinkController
|
|
|
|
|
|
|
|
|
|
"setUlPayment"=>"<a class='confirm setUlPayment' data-id='{$id}'>线下打款</a>",
|
|
|
|
|
|
|
|
|
|
"setPayment"=>"<a class='confirm setPayment' data-id='{$id}'>打款信息提交</a>",
|
|
|
|
|
"setPayment"=>"<a class='confirm setPayment' data-id='{$id}'>打款信息确认</a>",
|
|
|
|
|
"editPayment"=>"<a class='confirm editPayment' data-id='{$id}'>打款信息编辑</a>",
|
|
|
|
|
"viewPayment"=>"<a class='confirm viewPayment' data-id='{$id}'>打款详情</a>",
|
|
|
|
|
|
|
|
|
|