diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 0a9b2e21d..39aa08532 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2036,9 +2036,10 @@ function excelSpecialComplementEmplate($data, $all_sum_money, $all_pay_amount, $ } 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('D'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE); + $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE); $objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00); + $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00); if($data['withdraw_type'] != 3) { @@ -2166,9 +2167,10 @@ 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('D'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE); + $objPHPExcel->getActiveSheet()->getStyle('E'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE); $objPHPExcel->getActiveSheet()->getStyle('C'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00); + $objPHPExcel->getActiveSheet()->getStyle('F'.$line)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00); if($value['increment_ratio'] == 0){ $value['increment_ratio'] = 0; diff --git a/Application/Admin/Controller/CompanyGameRatioController.class.php b/Application/Admin/Controller/CompanyGameRatioController.class.php index 77d6d837d..79c2fe3ec 100644 --- a/Application/Admin/Controller/CompanyGameRatioController.class.php +++ b/Application/Admin/Controller/CompanyGameRatioController.class.php @@ -966,11 +966,11 @@ class CompanyGameRatioController extends AdminController $turnoverratio = json_decode($turnover_ratio[$key],true); $v['turnover_ratios'][$key] = array( - array("ratio"=>$value."%","name"=>"默认比例") + array("ratio"=>floatval($value)."%","name"=>"默认比例") ); foreach($turnoverratio as $ke=>$va){ - $t=array("ratio"=>$va["ratio"]."%"); + $t=array("ratio"=>floatval($va["ratio"])."%"); if(array_key_exists("instanceof",$va)){ //存在 if($va['instanceof']=='1'){ diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 155f69a9b..47be1cc48 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -150,7 +150,7 @@ class CompanyStatementController extends ThinkController $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(); + ->order("statement_begin_time desc,id desc")->page($page,$row)->select(); foreach($data as $k => &$v) { @@ -372,7 +372,16 @@ class CompanyStatementController extends ThinkController public function delStatement(){ if(!isset($_REQUEST['ids'])) $this->error("参数错误"); $ids = $_REQUEST['ids']; - $dbres = $this->DBModel->where("id in ({$ids}) and verify_status = 0")->delete(); +// $dbres = $this->DBModel->where("id in ({$ids}) and verify_status = 0")->delete(); + $dbres = $this->DBModel->where("id in ({$ids})")->select(); + foreach ($dbres as $key=>$value) { + if($value['withdraw_type'] !=3) { + $this->DBModel->where("id = {$value['id']} and verify_status = 0")->delete(); + } else { + $this->DBModel->where("id = {$value['id']} and verify_status != 2")->delete(); + } + + } addOperationLog(['op_type'=>2,'key'=>$ids,"op_name"=>"删除结算单",'url'=>U('lists')]); $this->ajaxReturn(array( 'status' => 1, @@ -578,7 +587,7 @@ class CompanyStatementController extends ThinkController $cline = $line+1; if($is_export){ - $v['statement_money'] = "="; + $v['statement_money'] = "=ROUND("; } $row = 0; @@ -598,9 +607,9 @@ class CompanyStatementController extends ThinkController if($is_export){ if($v['withdraw_type'] != 3) { - $val['sum_money'] = "=K{$line}*(L{$line}+M{$line})"; + $val['sum_money'] = "=ROUND(K{$line}*(L{$line}+M{$line}),2)"; } else { - $val['sum_money'] = "=K{$line}*(M{$line})"; + $val['sum_money'] = "=ROUND(K{$line}*(M{$line}),2)"; } // $val['sum_money'] = "=J{$line}*(K{$line}+L{$line})"; $v['statement_money'] .= "N{$line}+"; @@ -625,17 +634,17 @@ class CompanyStatementController extends ThinkController if($is_export){ if($v['withdraw_type'] != 3) { - $v['statement_money'] .="N{$cline}-O{$cline}"; + $v['statement_money'] .="N{$cline}-O{$cline},2)"; } else { - $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1); + $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)"; } // dump($v['statement_money']);die(); } } if($is_export){ - $count["platform_amount"] = "=SUM(K2:K".$line.")"; - $count["sum_money"] = "=SUM(Q2:Q".$line.")"; + $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)"; + $count["sum_money"] = "=ROUND(SUM(Q2:Q".$line."),2)"; } $this->assign("data",$infolist); $this->assign("count",$count); @@ -1385,14 +1394,16 @@ class CompanyStatementController extends ThinkController $statement_data = []; M()->startTrans(); foreach ($data as $key => $value) { - + $begin_time = 99999999999; + $end_time = 0; + $statement_data = []; $company_data = M("promote_company","tab_")->where(['id'=>$value['company_id']])->find(); $company_type = M("company_relation","tab_")->where("first_company_id={$value['company_id']} or second_company_id={$value['company_id']}")->find(); $insert['is_payment'] = $company_type['is_payment']; - $insert['statement_begin_time'] = strtotime($value['statement_begin_time']); - $insert['statement_end_time'] = strtotime($value['statement_end_time']); +// $insert['statement_begin_time'] = strtotime($value['statement_begin_time']); +// $insert['statement_end_time'] = strtotime($value['statement_end_time']); $insert['withdraw_type'] = $withdraw_type; $insert['company_belong'] = $company_data['company_belong']; $insert['company_name'] = $company_data['company_name']; @@ -1487,12 +1498,23 @@ class CompanyStatementController extends ThinkController $amount_time['pay_way'] = ['egt',0]; foreach ($statement_info as $k => $v) { + $statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time'])); $statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399; + if ($statement_begin_time<$begin_time) { + $begin_time = $statement_begin_time; + } + + if ($statement_end_time>$end_time) { + $end_time = $statement_end_time; + } + + $amount_time['_string'] = "payed_time between {$statement_begin_time} and {$statement_end_time} and relation_game_id={$v['relation_game_id']}"; $dataAmount = M("spend","tab_") - ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name,substring_index(substring_index(promote.`chain`,'/',2),'/',-1) promote_id,chain,admin_id") + ->field("pay_amount,relation_game_id,relation_game_name,payed_time,game_type_name, + CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,chain,admin_id") ->join("left join tab_promote promote on tab_spend.promote_id=promote.id") ->join("left join tab_game game on tab_spend.game_id=game.id") ->where($amount_time) @@ -1542,9 +1564,25 @@ class CompanyStatementController extends ThinkController $insert['statement_info'] = json_encode($statement_insert); } else { + $insert['statement_info'] = json_encode($statement_info); + foreach ($statement_info as $k => $v) { + $statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time'])); + $statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399; + + if ($statement_begin_time<$begin_time) { + $begin_time = $statement_begin_time; + } + + if ($statement_end_time>$end_time) { + $end_time = $statement_end_time; + } + } } + $insert['statement_begin_time'] = $begin_time; + $insert['statement_end_time'] = $end_time; + if ($company_type['first_company_id'] == $value['company_id']) { $insert['first_party_info'] = json_encode($proCompany_info); $insert['second_party_info'] = json_encode($secord_info); diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 34a6fa726..f18a6fbac 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -241,7 +241,7 @@ class CompanyStatementPoolController extends ThinkController } $cline = $line+1; if($is_export){ - $v['statement_money'] = "="; + $v['statement_money'] = "=ROUND("; } $row = 0; @@ -261,44 +261,30 @@ class CompanyStatementPoolController extends ThinkController if($is_export){ if($v['withdraw_type'] != 3) { - $val['sum_money'] = "=K{$line}*(L{$line}+M{$line})"; + $val['sum_money'] = "=ROUND(K{$line}*(L{$line}+M{$line}),2)"; } else { - $val['sum_money'] = "=K{$line}*(M{$line})"; + $val['sum_money'] = "=ROUND(K{$line}*(M{$line}),2)"; } -// $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'] .="O{$cline}-P{$cline}"; + $v['statement_money'] .="O{$cline}-P{$cline},2)"; } else { - $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1); + $v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)"; } -// dump($v['statement_money']);die(); } } if($is_export){ - $count["platform_amount"] = "=SUM(K2:K".$line.")"; - $count["sum_money"] = "=SUM(Q2:Q".$line.")"; + $count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)"; + $count["sum_money"] = "=ROUND(SUM(Q2:Q".$line."),2)"; } $this->assign("data",$infolist); $this->assign("count",$count); @@ -346,9 +332,9 @@ class CompanyStatementPoolController extends ThinkController if($is_export){ if($v['withdraw_type'] != 3) { - $va['d_statement_money'] = "=D{$line}*(1-G{$line})*(E{$line}+F{$line})"; + $va['d_statement_money'] = "=ROUND(D{$line}*(1-G{$line})*(E{$line}+F{$line}),2)"; } else { - $va['d_statement_money'] = "=D{$line}*(F{$line})"; + $va['d_statement_money'] = "=ROUND(D{$line}*(F{$line}),2)"; } }else{ if ($v['withdraw_type'] != 3) { @@ -370,7 +356,7 @@ class CompanyStatementPoolController extends ThinkController if($is_export){ if ($v['withdraw_type'] != 3) { - $v['statement_money'] = "=SUM(H{$cline}:H{$line})+J{$cline}-I{$cline}"; + $v['statement_money'] = "=ROUND(SUM(H{$cline}:H{$line})+J{$cline}-I{$cline},2)"; } @@ -383,11 +369,11 @@ class CompanyStatementPoolController extends ThinkController } if($is_export){ - $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.")"; + $count["platform_amount"] = "=ROUND(SUM(D2:D".$line."),2)"; + $count["d_statement_money"] = "=ROUND(SUM(H2:H".$line."),2)"; + $count["fine"] = "=ROUND(SUM(I2:I".$line."),2)"; + $count["reward"] = "=ROUND(SUM(J2:J".$line."),2)"; + $count["statement_money"] = "=ROUND(SUM(K2:K".$line."),2)"; } // dd($infolist); $this->assign("data",$infolist); @@ -431,7 +417,7 @@ class CompanyStatementPoolController extends ThinkController $line ++; $va['company_ratio'] = 100-$va['ratio']; if($is_export){ - $va['d_statement_money'] = "=F{$line}*G{$line}"; + $va['d_statement_money'] = "=ROUND(F{$line}*G{$line},2)"; }else{ $va['d_statement_money'] = round($va['pay_amount']*$va['ratio']/100,2); $count['platform_amount'] += $va['pay_amount']; @@ -441,7 +427,7 @@ class CompanyStatementPoolController extends ThinkController } $v['matche_platform'] = $Partner[$v['company_id']]; if($is_export){ - $v['statement_money'] = "=SUM(K{$cline}:K{$line})+M{$cline}-L{$cline}"; + $v['statement_money'] = "=ROUND(SUM(K{$cline}:K{$line})+M{$cline}-L{$cline},2)"; }else{ $count['fine'] += $v['fine']; $count['reward'] += $v['reward']; @@ -451,12 +437,12 @@ class CompanyStatementPoolController extends ThinkController } if($is_export){ - $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.")"; + $count["d_statement_money"] = "=ROUND(SUM(K3:K".$line."),2)"; + $count["platform_amount"] = "=ROUND(SUM(E3:E".$line."),2)"; + $count["platform_amount2"] = "=ROUND(SUM(F3:F".$line."),2)"; + $count["fine"] = "=ROUND(SUM(L3:L".$line."),2)"; + $count["reward"] = "=ROUND(SUM(M3:M".$line."),2)"; + $count["statement_money"] = "=ROUND(SUM(N3:N".$line."),2)"; } // dd($infolist); $this->assign("data",$infolist); @@ -799,7 +785,12 @@ class CompanyStatementPoolController extends ThinkController if($re_op){ //公司及上游回退 if($db_res['company_type'] == 2){ - $this->retry($db_res); //个人重算 + + if($db_res['withdraw_type'] == 3) { + $this->cancelCompanyPool($db_res);//公司撤回 + } else { + $this->retry($db_res); //个人重算 + } }else{ $this->cancelCompanyPool($db_res);//公司撤回 } @@ -1063,7 +1054,7 @@ class CompanyStatementPoolController extends ThinkController $mentBtn = [ "verifyAgree"=>"审批通过", "verifyRefuse"=>"审核拒绝", - "export"=>"批量导出" + "export"=>"导出" ]; $resarr = []; foreach ($mentBtn as $k => $v) { diff --git a/Application/Admin/Controller/GameRatioMouldController.class.php b/Application/Admin/Controller/GameRatioMouldController.class.php index eac5363f7..17ff6fea9 100644 --- a/Application/Admin/Controller/GameRatioMouldController.class.php +++ b/Application/Admin/Controller/GameRatioMouldController.class.php @@ -214,11 +214,11 @@ class GameRatioMouldController extends AdminController protected function readTurnoverRatio(&$v){ $turnover_ratio = json_decode($v['turnover_ratio'],true); $v['turnover_ratio'] = array( - array("ratio"=>$v['ratio']."%","name"=>"默认比例") + array("ratio"=>floatval($v['ratio'])."%","name"=>"默认比例") ); foreach($turnover_ratio as $ke=>$va){ - $t=array("ratio"=>$va["ratio"]."%"); + $t=array("ratio"=>floatval($va["ratio"])."%"); if(array_key_exists("instanceof",$va)){ //存在 if($va['instanceof']=='1'){ diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 88e36503b..0e0e997d3 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -259,7 +259,7 @@ class PromoteCompanyController extends ThinkController $map["create_time"] = ['ELT',$time_end]; } $model = M("promote_company_verify", 'tab_'); - $data = $model->where($map)->page($page,$row)->order("FIELD(verify_status,0,1,-1,-2,2),id desc")->select(); + $data = $model->where($map)->page($page,$row)->order("create_time desc")->select(); foreach ($data as $k => &$v) { $v['company_info'] = json_decode($v['company_info'],true); if($v['company_id'] == 0){ @@ -362,6 +362,7 @@ class PromoteCompanyController extends ThinkController $v['verify_log']['market_time']=date("Y-m-d H:i:s"); $v['verify_log'] = json_encode($v['verify_log']); $v['verify_status']=-1; + $v["create_time"] = time(); M("PromoteCompanyVerify", 'tab_')->save($v); addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"市场部审核",'url'=>U('index')]); } @@ -381,6 +382,7 @@ class PromoteCompanyController extends ThinkController $v['verify_log']['admin_time']=date("Y-m-d H:i:s"); $v['verify_log'] = json_encode($v['verify_log']); $v['verify_status']=-2; + $v["create_time"] = time(); M("PromoteCompanyVerify", 'tab_')->save($v); addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"管理员审核",'url'=>U('index')]); } diff --git a/Application/Admin/View/CompanyStatement/lists.html b/Application/Admin/View/CompanyStatement/lists.html index bc77a6907..609360396 100644 --- a/Application/Admin/View/CompanyStatement/lists.html +++ b/Application/Admin/View/CompanyStatement/lists.html @@ -486,7 +486,7 @@ }else if(id=="delStatement"){ var opname = "批量删除"; var opurl = "{:U('delStatement')}"; - var opst ="[未进行审批]"; + var opst ="[未进行审批,特殊补点(除汇总状态)]"; var status = [0]; var confirm = true; } @@ -494,6 +494,10 @@ var flag = false; var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + if (id=="delStatement"&&$(elem).data("type")==3&&$(elem).data("status") == 2) { + flag = true; + } + if($.inArray( $(elem).data("status"),status) == -1||(id=="updateStatement" && $(elem).data("type")==3)){ flag = true; }else{ diff --git a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html index 3a0cc3dc3..b23770a61 100644 --- a/Application/Admin/View/CompanyStatement/viewSpecialComplement.html +++ b/Application/Admin/View/CompanyStatement/viewSpecialComplement.html @@ -236,13 +236,15 @@ format: 'yyyy-mm-dd', language:"zh-CN", minView:2, - autoclose:true + autoclose:true, + endDate : new Date() }); $('#time_end').datetimepicker({ format: 'yyyy-mm-dd', language:"zh-CN", minView:2, - autoclose:true + autoclose:true, + endDate : new Date() }); $('#datetimepicker').datetimepicker({ @@ -533,10 +535,10 @@ } $('#tablebox').find('tbody').prepend(html); - complementChange(); DeleteTd(); caculateAmount(); + } } else { @@ -572,6 +574,8 @@ $('.complement').change(function() { //获取总流水 var pay_amount = parseFloat($(this).parent().prev().prev().text()); + var show_ratio = $(this).parent().prev().text(); + show_ratio = parseFloat(show_ratio.slice(0,show_ratio.length-1)); //计算最终分配比率 var ratio = parseFloat($(this).val()); @@ -580,10 +584,14 @@ $(this).val(0); ratio = 0; } - - if (ratio>100) { - $(this).val(100); - ratio = 100; + if(!ratio) { + $(this).val(0); + ratio=0; + } + // console.log(ratio+show_ratio); + if ((ratio+show_ratio)>100) { + $(this).val(100-show_ratio); + ratio = 100-show_ratio; } //最终的分配金额 var withdraw_amount = ((pay_amount * ratio)/100).toFixed(2); @@ -592,6 +600,7 @@ caculateAmount(); }); } + //删除操作 function DeleteTd() { diff --git a/Application/Admin/View/Promote/add.html b/Application/Admin/View/Promote/add.html index d0d3561f8..e9dcab610 100644 --- a/Application/Admin/View/Promote/add.html +++ b/Application/Admin/View/Promote/add.html @@ -2,10 +2,33 @@ + - + 新增会长 @@ -42,7 +65,7 @@ *所属推广公司 - + 请选择推广公司 {:C(DEFAULT_COMPANY)} @@ -200,6 +223,7 @@ + @@ -180,7 +181,7 @@ 推广公司: - disabled style="background:#CCCCCC" > 请选择推广公司 @@ -457,8 +458,9 @@ - - + + +