diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php
index 045fff193..6cda8d817 100644
--- a/Application/Admin/Common/extend.php
+++ b/Application/Admin/Common/extend.php
@@ -1873,7 +1873,6 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
');
- date_default_timezone_set('Europe/London');
Vendor("PHPExcel.PHPExcel");
$objReader = \PHPExcel_IOFactory::createReader('Excel5');
@@ -1898,11 +1897,12 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
$objPHPExcel->getActiveSheet()->setCellValue('C7', "支付给:".$data['receive_company']['partner']); //增加支付给对应公司
$line = 10;
//记录统计项目
- $pay_amount_str = "=";
+ $pay_amount_str = "=SUM(J10:";
+ $plat_amount_str = "=SUM(E10:";
//增加结算记录
foreach ($data['statement_info'] as $key => $value) {
$objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1)->mergeCells("J$line:K$line");
- $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['statement_begin_time'] . '-' . $value['statement_end_time']);
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['statement_begin_time'].'-'.$value['statement_end_time']);
if ($value['statement_type'] > 0) {//罚款
$product_name = $value['game_name'];
$objPHPExcel->getActiveSheet()->setCellValue('F'.$line , '-');
@@ -1918,6 +1918,23 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
}
} else {//游戏
$product_name = $value['game_name'];
+ $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
+ $objPHPExcel->getActiveSheet()->getStyle('G'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
+ $objPHPExcel->getActiveSheet()->getStyle('H'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
+ $objPHPExcel->getActiveSheet()->getStyle('I'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
+ if($value['first_ratio'] == 0){
+ $value['first_ratio'] = 0;
+ }else{
+ $value['first_ratio'] = number_format($value['first_ratio']);
+ }
+ if($value['second_ratio'] == 0) {
+ $value['second_ratio'] = 0;
+ }else{
+ $value['second_ratio'] = number_format($value['second_ratio']);
+ }
+ if($value['promote_ratio'] == 0) $value['promote_ratio'] = 0;
+ if($value['fax_ratio'] == 0) $value['fax_ratio'] = 0;
+
$objPHPExcel->getActiveSheet()->setCellValue('F'.$line , $value['first_ratio'] . '%');
$objPHPExcel->getActiveSheet()->setCellValue('G'.$line, $value['second_ratio'] . '%');
$objPHPExcel->getActiveSheet()->setCellValue('H'.$line, $value['promote_ratio'] . '%');
@@ -1930,16 +1947,16 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
$objPHPExcel->getActiveSheet()->setCellValue('J'.$line, "=E{$line}*(1-H{$line})*F{$line}*(1-I{$line})");
}
}
- $pay_amount_str .= "J{$line}+";
+
$objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $product_name);
$line++;
}
//合计
- $objPHPExcel->getActiveSheet()->setCellValue("E" . ($line), $data['pay_amount']);
+ $objPHPExcel->getActiveSheet()->setCellValue("E" . ($line), $plat_amount_str."E".($line-1).")");
// $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line), $data['statement_money']);
- $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line), trim($pay_amount_str,"+"));
+ $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line), $pay_amount_str."J".($line-1).")");
// $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+1), $big_all_sum_money); //本月分成总金额(人民币大写)
$objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+1), "=J{$line}"); //本月分成总金额(人民币大写)
@@ -1957,7 +1974,7 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
$statement_begin_time = date('Y.m.d', $data['statement_begin_time']);//对账开始时间
$statement_end_time = date('Y.m.d',$data['statement_end_time']);//对账截止时间
- $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$statement_begin_time}-{$statement_end_time}";
+ $fileName = "{$data['company_name']}&{$data['my_company']}-对账单{$statement_begin_time}-{$statement_end_time}";
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
@@ -1996,12 +2013,13 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
$line = 3;
- $pay_amount_str = "=";
+ $pay_amount_str = "=SUM(F3:";
+ $plat_amount_str = "=SUM(C3:";
foreach ($data['statement_info'] as $key => $value) {
$objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1);
$objPHPExcel->getActiveSheet()->removeConditionalStyles();
- $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['statement_begin_time'] . '-' . $value['statement_end_time']);
+ $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['statement_begin_time'].'-'.$value['statement_end_time']);
if ($value['statement_type'] > 0) {//罚款
$product_name = $value['game_name'];
$objPHPExcel->getActiveSheet()->setCellValue('D'.$line, '-');
@@ -2015,6 +2033,24 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
}
} else {//游戏
$product_name = $value['game_name'];
+
+ $objPHPExcel->getActiveSheet()->getStyle('D'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);
+ $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_000);
+ $objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
+
+ if($value['increment_ratio'] == 0){
+ $value['increment_ratio'] = 0;
+ }else{
+ $value['increment_ratio'] = number_format($value['first_ratio']);
+ }
+ if($value['ratio'] == 0) {
+ $value['ratio'] = 0;
+ }else{
+ $value['ratio'] = number_format($value['ratio']);
+ }
+ if($value['fax_ratio'] == 0) $value['fax_ratio'] = 0;
+
+
if ($data['withdraw_type'] == 2) {
$objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['increment_ratio'] . '%');
}else{
@@ -2026,12 +2062,11 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
$objPHPExcel->getActiveSheet()->setCellValue('F'.$line,"=C{$line}*D{$line}*(1-E{$line})");
}
$objPHPExcel->getActiveSheet()->setCellValue('B'.$line, $product_name);
- $pay_amount_str .= "F{$line}+";
$line++;
}
- $objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $data['pay_amount']);//合计-平台总额
- $objPHPExcel->getActiveSheet()->setCellValue('F'.($line), trim($pay_amount_str,"+"));//合计-结算金额
+ $objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $plat_amount_str."C".($line-1).")");//合计-平台总额
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.($line), $pay_amount_str."F".($line-1).")");//合计-结算金额
// $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+1), $big_all_sum_money);//大写支付结算金额
@@ -2053,7 +2088,7 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['receive_company']['bank_account']."\t");//银行账号
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['receive_company']['opening_bank']);//开户行
- $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$statement_begin_time}-{$statement_end_time}";
+ $fileName = "{$data['company_name']}&{$data['my_company']}-对账单{$statement_begin_time}-{$statement_end_time}";
// dd($fileName);
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php
index 4b4af6a5b..e50a1665e 100644
--- a/Application/Admin/Common/function.php
+++ b/Application/Admin/Common/function.php
@@ -1042,3 +1042,18 @@ function showPercent($num)
}
+function showNumPercent($num)
+{
+ $num -= 0;
+ if($num >= 0){
+ if(strpos($num,"%")){
+ return $num;
+ }else{
+ return $num."%";
+ }
+
+ }else{
+ return $num ?? "--";
+ }
+}
+
diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php
index e727fe19d..98f1e5cf5 100644
--- a/Application/Admin/Controller/CompanyStatementController.class.php
+++ b/Application/Admin/Controller/CompanyStatementController.class.php
@@ -132,12 +132,12 @@ class CompanyStatementController extends ThinkController
->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']);
- $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_belong'] = $this->CompanyBelong[$v['company_belong']];
- $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['withdraw_type_1'] = ($v['withdraw_type'] == 1 ? "月结" :"周结");
@@ -282,7 +282,7 @@ class CompanyStatementController extends ThinkController
$y = M("CompanyStatement", "tab_")->where("id='{$params['id']}'")->find();
if($y['first_party_info'] != $params['first_party_info'] || $y['second_party_info'] != $params['second_party_info'] || $y['statement_info'] != $params['statement_info']){
$params['verify_status'] = 0;
- $params['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
+ $params['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]);
$params['op_time'] = time();
M("CompanyStatement","tab_")->save($params);
}
@@ -342,7 +342,7 @@ class CompanyStatementController extends ThinkController
if($v['confirm_status'] != 0) continue;
$v['confirm_log'] = json_decode($v['confirm_log'],true);
$v['confirm_log']['launch_user']=$this->admininfo["username"];
- $v['confirm_log']['launch_time']=date("Y-m-d H:i:s");
+ $v['confirm_log']['launch_time']=date("Y.m.d H:i:s");
$v['confirm_log'] = json_encode($v['confirm_log']);
$v['confirm_status']=1;
// $v['op_time'] = time();
@@ -364,7 +364,7 @@ class CompanyStatementController 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;
$v['op_time'] = time();
@@ -440,6 +440,12 @@ class CompanyStatementController extends ThinkController
} else{
$data['receive_company']['invoice_type']="普票";
}
+ if($data['company_name'] == $data['first_party_info']['partner']){
+ $data['my_company'] = $data['second_party_info']['partner'];
+ }else{
+ $data['my_company'] = $data['first_party_info']['partner'];
+ }
+
if ($data['company_belong'] == 9) {//上游
excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money);
} else {
@@ -478,29 +484,20 @@ class CompanyStatementController extends ThinkController
"fine"=>0,
"reward"=>0,
"verify_status"=>0,
- "verify_log"=>json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]),
+ "verify_log"=>json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]),
"op_time"=>time(),
"company_list"=>[]
];
- $datas = ["ups","up","downs","down"];
+ $datas = ["up","down"];
//初始化数据
foreach($datas as $k=>$v){
- if($v =="ups"){
- $basedata['company_type']=3;
- $basedata['is_payment']=1;
- }
if($v =="up"){
$basedata['company_type']=3;
- $basedata['is_payment']=2;
- }
-
- if($v =="downs"){
- $basedata['company_type']=1;
$basedata['is_payment']=1;
}
if($v =="down"){
$basedata['company_type']=1;
- $basedata['is_payment']=2;
+ $basedata['is_payment']=1;
}
$datas[$v]=$basedata;
unset($datas[$k]);
@@ -510,18 +507,9 @@ class CompanyStatementController extends ThinkController
if($v['verify_status'] != 2) continue;
if($v['company_belong'] == 9){
//上游
- if($v['is_payment'] == 1){
- $this->setDf($datas['ups'],$v);
- }else{
- $this->setDf($datas['up'],$v);
- }
+ $this->setDf($datas['up'],$v);
}else{
-
- if($v['is_payment'] == 1){
- $this->setDf($datas['downs'],$v);
- }else{
- $this->setDf($datas['down'],$v);
- }
+ $this->setDf($datas['down'],$v);
}
}
$Pool = M("company_statement_pool","tab_");
@@ -546,7 +534,7 @@ class CompanyStatementController extends ThinkController
if($v['statement_money'] == 0){
$v['verify_status'] = 5;
- $v['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s"),"verify_user"=>"system","verify_time"=>date("Y-m-d H:i:s"),"payment_user"=>"system","payment_time"=>date("Y-m-d H:i:s")]);
+ $v['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s"),"verify_user"=>"system","verify_time"=>date("Y.m.d H:i:s"),"payment_user"=>"system","payment_time"=>date("Y.m.d H:i:s")]);
}
//判断周月结
if(($v["statement_end_time"]-$v['statement_begin_time']) > 7*24*3600){
@@ -580,7 +568,7 @@ class CompanyStatementController 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'][$op_pre.'_num']=$num;
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=$change_status;
@@ -607,7 +595,7 @@ class CompanyStatementController extends ThinkController
unset($value["second_ratio"]);
}
}
- if($k=="ups" || $k=='downs'){
+ if($va['is_payment'] == 1){
$is_payment = 1;
$verify_status = 0;
}else{
@@ -741,7 +729,8 @@ class CompanyStatementController extends ThinkController
"fine"=>$fine,
"reward"=>$reward,
"statement_info"=>$v['statement_info'],
- "statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5)
+ "statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5),
+ "is_payment"=>$v['is_payment']
];
$savedata['company_list'][$v['company_id']] = $tdata;
}
diff --git a/Application/Admin/Controller/CompanyStatementLackController.class.php b/Application/Admin/Controller/CompanyStatementLackController.class.php
index 2403610c6..46ada8f23 100644
--- a/Application/Admin/Controller/CompanyStatementLackController.class.php
+++ b/Application/Admin/Controller/CompanyStatementLackController.class.php
@@ -75,11 +75,11 @@ class CompanyStatementLackController extends ThinkController
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['is_payment_str'] = $this->IsPayment[$v['is_payment']];
$v['company_type_str'] = $this->CompanyType[$v['company_type']];
- $v["valid"] = "{$v['statement_begin_time']} ~ {$v['statement_end_time']}";
+ $v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}";
$v['oplist'] = $this->OpAuth($v);
}
@@ -146,7 +146,7 @@ class CompanyStatementLackController extends ThinkController
"fine"=>0,
"reward"=>0,
"verify_status"=>0,
- "verify_log"=>json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]),
+ "verify_log"=>json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y.m.d H:i:s")]),
"op_time"=>time(),
"company_list"=>[]
];
diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php
index eb563d1ec..b4d3a5fe9 100644
--- a/Application/Admin/Controller/CompanyStatementPoolController.class.php
+++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php
@@ -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"=>"线下打款",
- "setPayment"=>"打款信息提交",
+ "setPayment"=>"打款信息确认",
"editPayment"=>"打款信息编辑",
"viewPayment"=>"打款详情",
diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php
index 1bb986703..85c10b0fa 100644
--- a/Application/Admin/Controller/CompanyStatementSetController.class.php
+++ b/Application/Admin/Controller/CompanyStatementSetController.class.php
@@ -327,11 +327,11 @@ class CompanyStatementSetController extends Controller {
}
}
if($v['first_company_type'] == 1){
- $game['first_ratio']=$tratio;
+ $game['first_ratio']=$tratio-0;
$game['second_ratio']=100-$tratio;
}else{
$game['first_ratio']=100-$tratio;
- $game['second_ratio']=$tratio;
+ $game['second_ratio']=$tratio-0;
}
$add_data['pay_amount'] += $va['pay_money'];
@@ -634,7 +634,7 @@ class CompanyStatementSetController extends Controller {
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
}
-
+ $tratio = $tratio-0;
if($v['type'] == 2){
$game['increment_ratio']=$tratio;
}else{
@@ -793,12 +793,12 @@ class CompanyStatementSetController extends Controller {
}
}
- public function promoteUserPool($type,$stime,$recount = false,$is_payment=false){
+ public function promoteUserPool($type,$stime,$recount = false){
$t = $this->setBeginAndEndTime($type,$stime);
$begintime = $t[0];
$endtime = $t[1];
- $basedata = [
+ $user = [
"pay_amount"=>0,
"statement_money"=>0,
"lack_statement_money"=>0,
@@ -813,45 +813,40 @@ class CompanyStatementSetController extends Controller {
"verify_status"=>0,
"company_type"=>2,
"verify_log"=>json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]),
- "op_time"=>time()
+ "op_time"=>time(),
+ "statement_num"=>"PL_".date('Ymd').date('His').sp_random_num(3)
];
- $users = $user = $basedata;
- $users['is_payment'] = 1;
- $users['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
+ // $users = $user = $basedata;
+ // $users['is_payment'] = 1;
+ // $users['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
- $user['is_payment'] = 2;
- $user['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
+ // $user['is_payment'] = 2;
+ // $user['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
if($type == 0){//周结
- $this->doPromoteUserPool($user,$users,$type,$stime,$recount);
+ $this->doPromoteUserPool($user,0,$stime,$recount);
}else if($type == 1){
$users['withdraw_type'] = 1;
$user['withdraw_type'] = 1;
//月结&补点
- $this->doPromoteUserPool($user,$users,1,$stime,$recount);
+ $this->doPromoteUserPool($user,1,$stime,$recount);
}else{
$users['withdraw_type'] = 2;
$user['withdraw_type'] = 2;
- $this->doPromoteUserPool($user,$users,2,$stime,$recount);
- }
- if($is_payment !== false && $is_payment==1){
- $this->savePromotateUserPool($users);
- }else if($is_payment !== false && $is_payment==2){
- $this->savePromotateUserPool($user);
- }else{
- $this->savePromotateUserPool($users);
- $this->savePromotateUserPool($user);
+ $this->doPromoteUserPool($user,2,$stime,$recount);
}
+
+ $this->savePromotateUserPool($user);
}
/**
* 下游个人汇总单
*/
- public function doPromoteUserPool(&$user,&$users,$type,$stime,$recount = false)
+ public function doPromoteUserPool(&$user,$type,$stime,$recount = false)
{
$t = $this->setBeginAndEndTime($type,$stime);
$begintime = $t[0];
@@ -900,11 +895,11 @@ class CompanyStatementSetController extends Controller {
"company_id"=>$v['id'],
"withdraw_done"=>1
];
- $pres = $Promote->field("alipay_account,alipay_real_name")->where($p_map)->find();
- if(!empty($pres) && !empty($pres['alipay_account']) && !empty($pres['alipay_real_name'])){
- $v['ali_user'] = $pres['alipay_real_name'];
- $v['ali_account'] = $pres['alipay_account'];
- }
+ // $pres = $Promote->field("alipay_account,alipay_real_name")->where($p_map)->find();
+ // if(!empty($pres) && !empty($pres['alipay_account']) && !empty($pres['alipay_real_name'])){
+ // $v['ali_user'] = $pres['alipay_real_name'];
+ // $v['ali_account'] = $pres['alipay_account'];
+ // }
if($v['has_ratio']){
$v['turnover_ratio'] = json_decode($v['turnover_ratio'],true);
}
@@ -932,11 +927,7 @@ class CompanyStatementSetController extends Controller {
}
//获取其他信息
$v = $this->getCompanyOtherInfo($v,$k);
- if($v['is_payment'] == 1){
- $countdata = &$users;
- }else{
- $countdata = &$user;
- }
+ $countdata = &$user;
$v['statement_money'] = 0;
$v['pay_amount'] = 0;
$v['fine'] = 0;
@@ -1117,12 +1108,19 @@ class CompanyStatementSetController extends Controller {
* 保存信息汇总信息
*/
public function savePromotateUserPool($data){
+ if(IS_CLI){
+ $op_name ="system";
+ }else{
+ $op_name =$_SESSION['onethink_admin']['user_auth']["username"];
+ }
if(empty($data['create_lack_ids']) && empty($data['del_lack_ids']) && empty($data['info_ids'])){ //补点为空不重算
return ;
}
if($data['statement_money'] == 0){
$data['verify_status'] = 5;
- $data['verify_log'] = json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s"),"verify_user"=>"system","verify_time"=>date("Y-m-d H:i:s"),"payment_user"=>"system","payment_time"=>date("Y-m-d H:i:s")]);
+ $data['verify_log'] = json_encode(["create_user"=>$op_name,"create_time"=>date("Y-m-d H:i:s"),"verify_user"=>"system","verify_time"=>date("Y-m-d H:i:s"),"payment_user"=>"system","payment_time"=>date("Y-m-d H:i:s")]);
+ }else{
+ $data['verify_log'] = json_encode(["create_user"=>$op_name,"create_time"=>date("Y-m-d H:i:s")]);
}
$data['create_lack_ids'] = implode(",",$data['create_lack_ids']);
$data['del_lack_ids'] = implode(",",$data['del_lack_ids']);
diff --git a/Application/Admin/View/CompanyStatement/viewCpStatement.html b/Application/Admin/View/CompanyStatement/viewCpStatement.html
index eadbad10d..353bcdf78 100644
--- a/Application/Admin/View/CompanyStatement/viewCpStatement.html
+++ b/Application/Admin/View/CompanyStatement/viewCpStatement.html
@@ -210,7 +210,7 @@