From 8e28b1c4ad04c8b7afc85b0ab4b4251fad361778 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Sat, 27 Feb 2021 18:36:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?2.28=E5=8F=B7=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementPoolController.class.php | 287 +------ ...ubCompanyStatementPoolController.class.php | 573 +++++++++++++ .../View/SubCompanyStatementPool/lists.html | 767 ++++++++++++++++++ .../poolWmStatement.html | 396 +++++++++ 4 files changed, 1737 insertions(+), 286 deletions(-) create mode 100644 Application/Admin/Controller/SubCompanyStatementPoolController.class.php create mode 100644 Application/Admin/View/SubCompanyStatementPool/lists.html create mode 100644 Application/Admin/View/SubCompanyStatementPool/poolWmStatement.html diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index ce4d619ea..db8ed1b5e 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -185,11 +185,7 @@ class CompanyStatementPoolController extends ThinkController } // $v['oplist'] = $this->OpAuth($v); - if (IS_SUBSITE) { - $v['oplist'] = $this->OpWmAuth($v); - } else { - $v['oplist'] = $this->OpAuth($v); - } + $v['oplist'] = $this->OpAuth($v); } // dump($data);die(); $count = $this->DBModel->field("count(id) count,SUM(statement_money) as statement_money,SUM(lack_statement_money) lack_statement_money")->where($map)->find(); @@ -264,13 +260,6 @@ class CompanyStatementPoolController extends ThinkController $pool_info["verify"] = '--'; } - if(true) { - - $this->viewWmStatement($pool_info['wm_statement_ids'],$is_export); - die(); - - } - if(isset($pool_info['verify_log']['payment_user'])){ if($pool_info['verify_status'] == -2){ $ts = "拒绝打款"; @@ -308,133 +297,6 @@ class CompanyStatementPoolController extends ThinkController } - public function exportWmStatement($wm_statement_ids = 0) { - - header("Content-type: text/html; charset=utf-8"); - error_reporting(E_ALL); - ini_set('display_errors', TRUE); - ini_set('display_startup_errors', TRUE); - - define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); - - Vendor("PHPExcel.PHPExcel"); - $objPHPExcel = new \PHPExcel(); - $objReader = \PHPExcel_IOFactory::createReader('Excel2007'); - - //设置模板文件 - $objPHPExcel = $objReader->load("Public/Admin/excel/wmStatement.xlsx"); - - $data = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->find(); - - $list = json_decode($data['statement_info'],true); - $statement_begin_time = date("Y-m-d",$data['statement_begin_time']); - $statement_end_time = date("Y-m-d",$data['statement_end_time']); - - $amount_data['pay_amount'] = $data['pay_amount']; - $amount_data['user_newcount'] = $data['user_newcount']; - $amount_data['fax_ratio'] = $data['fax_ratio']; - $amount_data['sum_money'] = $data['sum_money']; - - $first_party_info = json_decode($data['first_party_info'],true); - $second_party_info = json_decode($data['second_party_info'],true); - - - $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单\n({$statement_begin_time}-{$statement_end_time})"); - - $line = 3; - foreach ($list 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('B'.$line, $value['game_name']); - $line++; - } - $objPHPExcel->getActiveSheet()->setCellValue('C3', $amount_data['pay_amount']); - $objPHPExcel->getActiveSheet()->setCellValue('D3', $amount_data['user_newcount']); - $objPHPExcel->getActiveSheet()->setCellValue('E3', $amount_data['fax_ratio'])."%"; - $objPHPExcel->getActiveSheet()->setCellValue('F3', $amount_data['sum_money']); - - $tline = $line-1; - - $objPHPExcel->getActiveSheet()->mergeCells("C3:C{$tline}")->mergeCells("D3:D{$tline}")->mergeCells("E3:E{$tline}")->mergeCells("F3:F{$tline}"); - - $objPHPExcel->getActiveSheet()->setCellValue('B'.($line), convertAmountToCn($amount_data['sum_money'])); - - //甲方信息 - $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+3), $first_party_info['partner']);//甲方 - $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+4), $first_party_info['link_man']);//联系人 - $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+5), $first_party_info['link_phone']."\t");//联系电话 - $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+6), $first_party_info['invoice_item']);//开票项目 - $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+7), $first_party_info['invoice_type']);//发票类型 - $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+8), $first_party_info['address']);//发票类型 - - //乙方信息 - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+3), $second_party_info['partner']);//乙方 - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+4), $second_party_info['link_man']);//联系人 - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+5), $second_party_info['phone']."\t");//联系电话 - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+6), $second_party_info['address']);//邮寄地址 - if ($second_party_info['is_payment'] != 1) { - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+8), $second_party_info['bank_address']);//户名 - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+9), $second_party_info['bank_card']."\t");//银行账号 - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+10), $second_party_info['bank_name']);//开户行 - } else { - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+8), $second_party_info['ali_user']);//户名 - $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+9), $second_party_info['ali_account']."\t");//银行账号 - } - - - - $fileName = "{$data['company_name']}&{$data['my_company']}-对账单{$statement_begin_time}-{$statement_end_time}"; -// dd($fileName); - ob_end_clean();//清除缓冲区,避免乱码 - header('pragma:public'); - header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls'); - header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印 - $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); - $objWriter->save('php://output'); - exit; - - } - - - public function viewWmStatement($wm_statement_ids = '',$is_export=0) { - - if (!$wm_statement_ids) { - $this->error('参数错误'); - } - - if ($is_export) { - $this->exportWmStatement($wm_statement_ids); - } - - $data = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->find(); - - $list = json_decode($data['statement_info'],true); - $statement_begin_time = date("Y-m-d",$data['statement_begin_time']); - $statement_end_time = date("Y-m-d",$data['statement_end_time']); - - $amount_data['pay_amount'] = $data['pay_amount']; - $amount_data['user_newcount'] = $data['user_newcount']; - $amount_data['fax_ratio'] = $data['fax_ratio']; - $amount_data['sum_money'] = $data['sum_money']; - - $first_party_info = json_decode($data['first_party_info'],true); - $second_party_info = json_decode($data['second_party_info'],true); - - $this->assign("list",$list); - $this->assign("row",count($list)); - $this->assign("company_name",$data['company_name']); - $this->assign("statement_begin_time",$statement_begin_time); - $this->assign("statement_end_time",$statement_end_time); - $this->assign("amount_data",$amount_data); - $this->assign("first_party_info",$first_party_info); - $this->assign("second_party_info",$second_party_info); - - $this->display("poolWmStatement"); - - } - //查看 public function viewUnPaymentPool() { @@ -2023,10 +1885,6 @@ class CompanyStatementPoolController extends ThinkController //获取基础信息 $db_res = $this->DBModel->where("id='{$id}'")->find(); - if (IS_SUBSITE) { - $this->cancelWmCompanyPool($db_res); - } - $is_qz = (substr($db_res['statement_num'],0,2) == "QZ" ? true :false); //强制汇总的都允许回退 if($is_qz){ //强制汇总回退 @@ -2058,51 +1916,6 @@ class CompanyStatementPoolController extends ThinkController } - public function cancelWmCompanyPool($info) - { - if(in_array($info['verify_status'],[3,4])) return;//有打款就不允许回退 - - $sids = $info['statement_ids']; - $wm_statement_ids = $info['wm_statement_ids']; - - SM()->startTrans();//事务 - //删除info - $infores = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->delete(); - if($infores === false){ - SM()->rollback(); - $this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败")); - } - //删除自己 - $poolres = $this->DBModel->where("id = {$info['id']}")->delete(); - if($poolres === false){ - SM()->rollback(); - $this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败")); - } - //修改结算单信息 - $sids = array_filter(explode(",",$sids)); - - $st_res = SM("company_statement","tab_")->field("id,verify_status,verify_log")->where(["id"=>['in',$sids]])->select(); - - 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'] = json_encode($v['verify_log']); - $v['verify_status']=-2; - $stres = SM("company_statement","tab_")->save($v); - if($stres === false){ - SM()->rollback(); - $this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败")); - } - } - - SM()->commit(); - $this->ajaxReturn(array( - 'status' => 1, - "info"=>"撤销汇总成功" - )); - } - /** * 重算 先全删再进行二次生成 */ @@ -2231,104 +2044,6 @@ class CompanyStatementPoolController extends ThinkController )); } - public function OpWmAuth($info) - { - $id = $info['id']; - $img = $info['ext_file']; - $remark = $info['remark']; - $create_lack_ids = $info['create_lack_ids']; - $is_qz = (substr($info['statement_num'],0,2) == "QZ" ? true :false); //强制汇总的都允许回退 - - //原始列表 - $opBtn = [ - "viewPool"=>"查看", - - "editPool"=>"编辑", - "editSpecialPuPool"=>"编辑", - - "addRemark"=>"新增备注", - "editRemark"=>"修改备注", - "viewRemark"=>"查看备注", - - "uploadVoucher"=>"上传凭证", - "viewVoucher"=>"查看凭证", - "editVoucher"=>" 编辑凭证", - - "setUlPayment"=>"线下打款", - - "setPayment"=>"打款信息确认", - "editPayment"=>"打款信息编辑", - "viewPayment"=>"打款详情", - - 'reCount'=>"重算", - 'cancelPool'=>"撤销汇总", - - ]; - //操作对应菜单 - $optist = []; - switch ($info['verify_status']) { - case '-2': - case '-1': - case '0': - $optist = ["viewPool","cancelPool"]; - break; - case '1': - $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","editPayment","setUlPayment"]; - break; - case '2': - $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher"]; - break; - case '3': - $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","viewPayment"]; - break; - case '4': - $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","viewPayment"]; - break; - case '5': - $optist = ["viewPool","cancelPool"]; - break; - case '6': - $optist = ["viewPool","cancelPool"]; - - break; - default: - break; - } - - if(empty($info['ext_file'])){ - //未上传凭证 - $optist = array_diff($optist, ["viewVoucher", "editVoucher"]); - }else{ - $optist = array_diff($optist, ["uploadVoucher"]); - } - - if($info['is_payment'] == 1){ - $optist = array_diff($optist, ["setUlPayment"]); - }else{ - $optist = array_diff($optist, ["setPayment","editPayment","viewPayment"]); - } - - if(empty($info['remark'])){ - //未上传备注 - $optist = array_diff($optist, ["editRemark", "viewRemark"]); - }else{ - $optist = array_diff($optist, ["addRemark"]); - } - - // - $resarr = []; - foreach ($optist as $k => $v) { - if(IS_ROOT){ - $resarr[] = $opBtn[$v]; - }else{ - if(in_array($v,$this->OpAuthList)){ - $resarr[] = $opBtn[$v]; - } - } - } - return $resarr; - } - public function OpAuth($info) { $id = $info['id']; diff --git a/Application/Admin/Controller/SubCompanyStatementPoolController.class.php b/Application/Admin/Controller/SubCompanyStatementPoolController.class.php new file mode 100644 index 000000000..347b03063 --- /dev/null +++ b/Application/Admin/Controller/SubCompanyStatementPoolController.class.php @@ -0,0 +1,573 @@ +"下游公司", + "2"=>"下游个人", + "3"=>"上游CP" + ]; + public $IsPayment = [ + "1"=>"是", + "2"=>"否" + ]; + public $WithdrawType = [ + "0"=>"周结", + "1"=>"月结", + "2"=>"下游个人补点", + "3"=>"特殊补点", + "4"=>"其他" + ]; + public $VerifyStatus=[ + "-2"=>"拒绝打款", + "-1"=>"审核拒绝", + "0"=>"未审核", + "1"=>"打款信息确认", + "2"=>"审核通过", + "3"=>"打款中", + "4"=>"打款成功", + "5"=>"无需打款", + "6"=>"初审通过", + "-3"=>"初审拒绝", + ]; + public $InfoVerifyStatus=[ + "-1"=>"配置信息不全", + "0"=>"信息未确认", + "1"=>"允许打款", + "2"=>"线下无需打款" + ]; + public $PayStatus=[ + "-1"=>"打款失败", + "0"=>"未打款", + "1"=>"打款成功" + ]; + public $admininfo; + public $DBModel; + public function _initialize() + { + $this->admininfo = $_SESSION['onethink_admin']['user_auth']; + $this->DBModel = SM("CompanyStatementPool","tab_"); + parent::_initialize(); + } + + public function lists() { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + //权限分配 + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + $this->assign('menubtn',$this->menuAuth()); + + $map = [ + "_string"=>"1=1" + ]; + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $time_start = strtotime($_REQUEST['time_start']); + $time_end = strtotime($_REQUEST['time_end'])+ 86399; + $map["_string"] = "(statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (statement_end_time BETWEEN {$time_start} AND {$time_end}) OR (statement_begin_time <= {$time_end} AND statement_end_time >= {$time_end})"; + } elseif (isset($_REQUEST['time_start'])) { + $time_start = strtotime($_REQUEST['time_start']); + $map["_string"] = "(statement_begin_time >= {$time_start} ) OR (statement_end_time >= {$time_start})"; + } elseif (isset($_REQUEST['time_end'])) { + $time_end = strtotime($_REQUEST['time_end'])+ 86399; + $map["_string"] = "(statement_begin_time <= {$time_end} ) OR (statement_end_time <= {$time_end})"; + } + + if (isset($_REQUEST['time_start2']) && isset($_REQUEST['time_end2'])) { + $map['op_time'] = ['between', [strtotime($_REQUEST['time_start2']), strtotime($_REQUEST['time_end2']) + 86399]]; + } elseif (isset($_REQUEST['time_start2'])) { + $map['op_time'] = ['EGT', strtotime($_REQUEST['time_start2'])]; + } elseif (isset($_REQUEST['time_end2'])) { + $map['op_time'] = ['ELT', strtotime($_REQUEST['time_end2']) + 86399]; + } + + //其他 + + if(isset($_REQUEST['company_type'])){ + $map['company_type'] = $_REQUEST['company_type']; + } + if(isset($_REQUEST['verify_status'])){ + $map['verify_status'] = $_REQUEST['verify_status']; + } + if(isset($_REQUEST['statement_num'])){ + $map['statement_num'] = $_REQUEST['statement_num']; + } + if(isset($_REQUEST['is_payment'])){ + $map['is_payment'] = $_REQUEST['is_payment']; + } + if(isset($_REQUEST['withdraw_type'])){ + $map['withdraw_type'] = $_REQUEST['withdraw_type']; + } + + + // $this->checkListOrCountAuthRestMap($map);//导出权限 + //条件end + $data = $this->DBModel + ->field("*") + ->where($map) + ->order("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['company_type_str'] = $this->CompanyType[$v['company_type']]; + $v['is_payment_str'] = $this->IsPayment[$v['is_payment']]; + // $v['can_export'] = $v['platform_amount'] == 0 ? "0" : '1'; + // if($v['company_type'] == 2){ + $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['ext_file_type'] = empty($v['ext_file']) ? "无" : "有"; + $v['withdraw_type'] = $this->WithdrawType[$v['withdraw_type']];; + + $v['verify_log'] = json_decode($v['verify_log'], true); + if (isset($params['export'])) { + $symbol = "\n"; + } else { + $symbol = "
"; + } + $v["create"]= "{$v['verify_log']['create_user']} {$symbol} {$v['verify_log']['create_time']}"; + + if(isset($v['verify_log']['firstverify_user'])){ + if($v['verify_status'] == -3){ + $ts = "初审拒绝"; + }else{ + $ts = "初审通过"; + } + $v["firstverify"]= "{$ts}({$v['verify_log']['firstverify_user']}) {$symbol} {$v['verify_log']['firstverify_time']}"; + $ts = ''; + }else{ + $v["firstverify"] = '--'; + } + + if(isset($v['verify_log']['verify_user'])){ + if($v['verify_status'] == -1){ + $ts = "审核拒绝"; + }else{ + $ts = "审核通过"; + } + $v["verify"]= "{$ts}({$v['verify_log']['verify_user']}) {$symbol} {$v['verify_log']['verify_time']}"; + }else{ + $v["verify"] = '--'; + } + + + if(isset($v['verify_log']['payment_user'])){ + if($v['verify_status'] == -2){ + $ts = "拒绝打款"; + }elseif($v['verify_status'] == 1){ + $ts = "打款信息确认"; + }elseif($v['verify_status'] == 2){ + $ts = "待打款"; + }elseif($v['verify_status'] == 3){ + $ts = "打款中"; + }elseif($v['verify_status'] == 4){ + $ts="打款成功"; + }elseif($v['verify_status'] == 5){ + $ts="无需打款"; + } + $v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}"; + }else{ + $v["payment"] = '--'; + } + + $v['oplist'] = $this->OpWmAuth($v); + } +// dump($data);die(); + $count = $this->DBModel->field("count(id) count,SUM(statement_money) as statement_money,SUM(lack_statement_money) lack_statement_money")->where($map)->find(); + // dd($count); + $params['p'] = $page; + $params['row'] = $row; + $page = set_pagination($count['count'], $row, $params); + if ($page) { + $this->assign('_page', $page); + } + + $this->assign('data',$data); + $this->assign('count',$count); + $this->assign('CompanyType',$this->CompanyType); + $this->assign('IsPayment',$this->IsPayment); + $this->assign('VerifyStatus',$this->VerifyStatus); + $this->assign('WithdrawType',$this->WithdrawType); + $this->display(); + + } + + //查看 + public function viewPool() + { + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + + $is_export= false; + if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ + $is_export = true; + } + //获取基本信息 + $infolist = SM("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}'")->select(); + //获取母单 + $pool_info = SM("company_statement_pool","tab_") + ->field('wm_statement_ids,statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time,verify_log')->where("id={$id}")->find(); + if(!empty($pool_info['create_lack_ids'])){ + $l_ids = $pool_info['create_lack_ids']; + $lack_info = SM("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select(); + $infolist =array_merge($infolist,$lack_info); + } + + if ($is_export) { + $symbol = "\n"; + } else { + $symbol = "
"; + } + + $pool_info['verify_log'] = json_decode($pool_info['verify_log'], true); + + if(isset($pool_info['verify_log']['firstverify_user'])){ + if($pool_info['verify_status'] == -3){ + $ts = "初审拒绝"; + }else{ + $ts = "初审通过"; + } + $pool_info["firstverify"]= "{$ts}({$pool_info['verify_log']['firstverify_user']}) {$symbol} {$pool_info['verify_log']['firstverify_time']}"; + $ts = ''; + }else{ + $pool_info["firstverify"] = '--'; + } + + if(isset($pool_info['verify_log']['verify_user'])){ + if($pool_info['verify_status'] == -1){ + $ts = "审核拒绝"; + }else{ + $ts = "审核通过"; + } + $pool_info["verify"]= "{$ts}({$pool_info['verify_log']['verify_user']}) {$symbol} {$pool_info['verify_log']['verify_time']}"; + }else{ + $pool_info["verify"] = '--'; + } + + if(true) { + + $this->viewWmStatement($pool_info['wm_statement_ids'],$is_export); + + } + + } + + public function exportWmStatement($wm_statement_ids = 0) { + + header("Content-type: text/html; charset=utf-8"); + error_reporting(E_ALL); + ini_set('display_errors', TRUE); + ini_set('display_startup_errors', TRUE); + + define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + + Vendor("PHPExcel.PHPExcel"); + $objPHPExcel = new \PHPExcel(); + $objReader = \PHPExcel_IOFactory::createReader('Excel2007'); + + //设置模板文件 + $objPHPExcel = $objReader->load("Public/Admin/excel/wmStatement.xlsx"); + + $data = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->find(); + + $list = json_decode($data['statement_info'],true); + $statement_begin_time = date("Y-m-d",$data['statement_begin_time']); + $statement_end_time = date("Y-m-d",$data['statement_end_time']); + + $amount_data['pay_amount'] = $data['pay_amount']; + $amount_data['user_newcount'] = $data['user_newcount']; + $amount_data['fax_ratio'] = $data['fax_ratio']; + $amount_data['sum_money'] = $data['sum_money']; + + $first_party_info = json_decode($data['first_party_info'],true); + $second_party_info = json_decode($data['second_party_info'],true); + + + $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单\n({$statement_begin_time}-{$statement_end_time})"); + + $line = 3; + foreach ($list 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('B'.$line, $value['game_name']); + $line++; + } + $objPHPExcel->getActiveSheet()->setCellValue('C3', $amount_data['pay_amount']); + $objPHPExcel->getActiveSheet()->setCellValue('D3', $amount_data['user_newcount']); + $objPHPExcel->getActiveSheet()->setCellValue('E3', $amount_data['fax_ratio']."%"); + $objPHPExcel->getActiveSheet()->setCellValue('F3', $amount_data['sum_money']); + + $tline = $line-1; + + $objPHPExcel->getActiveSheet()->mergeCells("C3:C{$tline}")->mergeCells("D3:D{$tline}")->mergeCells("E3:E{$tline}")->mergeCells("F3:F{$tline}"); + + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line), convertAmountToCn($amount_data['sum_money'])); + + //甲方信息 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+3), $first_party_info['partner']);//甲方 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+4), $first_party_info['link_man']);//联系人 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+5), $first_party_info['link_phone']."\t");//联系电话 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+6), $first_party_info['invoice_item']);//开票项目 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+7), $first_party_info['invoice_type']);//发票类型 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($tline+8), $first_party_info['address']);//发票类型 + + //乙方信息 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+3), $second_party_info['partner']);//乙方 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+4), $second_party_info['link_man']);//联系人 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+5), $second_party_info['phone']."\t");//联系电话 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+6), $second_party_info['address']);//邮寄地址 + if ($second_party_info['is_payment'] != 1) { + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+8), $second_party_info['bank_address']);//户名 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+9), $second_party_info['bank_card']."\t");//银行账号 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+10), $second_party_info['bank_name']);//开户行 + } else { + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+8), $second_party_info['ali_user']);//户名 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($tline+9), $second_party_info['ali_account']."\t");//银行账号 + } + + + + $fileName = "{$data['company_name']}&{$data['my_company']}-对账单{$statement_begin_time}-{$statement_end_time}"; +// dd($fileName); + ob_end_clean();//清除缓冲区,避免乱码 + header('pragma:public'); + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls'); + header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印 + $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); + $objWriter->save('php://output'); + exit; + + } + + + public function viewWmStatement($wm_statement_ids = '',$is_export=0) { + + if (!$wm_statement_ids) { + $this->error('参数错误'); + } + + if ($is_export) { + $this->exportWmStatement($wm_statement_ids); + } + + $data = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->find(); + + $list = json_decode($data['statement_info'],true); + $statement_begin_time = date("Y-m-d",$data['statement_begin_time']); + $statement_end_time = date("Y-m-d",$data['statement_end_time']); + + $amount_data['pay_amount'] = $data['pay_amount']; + $amount_data['user_newcount'] = $data['user_newcount']; + $amount_data['fax_ratio'] = $data['fax_ratio']; + $amount_data['sum_money'] = $data['sum_money']; + + $first_party_info = json_decode($data['first_party_info'],true); + $second_party_info = json_decode($data['second_party_info'],true); + + $this->assign("list",$list); + $this->assign("row",count($list)); + $this->assign("company_name",$data['company_name']); + $this->assign("statement_begin_time",$statement_begin_time); + $this->assign("statement_end_time",$statement_end_time); + $this->assign("amount_data",$amount_data); + $this->assign("first_party_info",$first_party_info); + $this->assign("second_party_info",$second_party_info); + + $this->display("poolWmStatement"); + + } + + //撤销汇总 + public function cancelPool(){ + if(!isset($_REQUEST['id'])) $this->error("参数错误"); + $id = $_REQUEST['id']; + + //获取基础信息 + $db_res = $this->DBModel->where("id='{$id}'")->find(); + + if (IS_SUBSITE) { + $this->cancelWmCompanyPool($db_res); + } + + } + + public function cancelWmCompanyPool($info) + { + if(in_array($info['verify_status'],[3,4])) return;//有打款就不允许回退 + + $sids = $info['statement_ids']; + $wm_statement_ids = $info['wm_statement_ids']; + + SM()->startTrans();//事务 + //删除info + $infores = SM("new_company_statement_info","tab_")->where(['id'=>$wm_statement_ids])->delete(); + if($infores === false){ + SM()->rollback(); + $this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败")); + } + //删除自己 + $poolres = $this->DBModel->where("id = {$info['id']}")->delete(); + if($poolres === false){ + SM()->rollback(); + $this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败")); + } + //修改结算单信息 + $sids = array_filter(explode(",",$sids)); + + $st_res = SM("company_statement","tab_")->field("id,verify_status,verify_log")->where(["id"=>['in',$sids]])->select(); + + 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'] = json_encode($v['verify_log']); + $v['verify_status']=-2; + $stres = SM("company_statement","tab_")->save($v); + if($stres === false){ + SM()->rollback(); + $this->ajaxReturn(array('status' => 0,"info"=>"撤销汇总失败")); + } + } + + SM()->commit(); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"撤销汇总成功" + )); + } + + public function OpWmAuth($info) + { + $id = $info['id']; + $img = $info['ext_file']; + $remark = $info['remark']; + $create_lack_ids = $info['create_lack_ids']; + $is_qz = (substr($info['statement_num'],0,2) == "QZ" ? true :false); //强制汇总的都允许回退 + + //原始列表 + $opBtn = [ + "viewPool"=>"查看", + + "editPool"=>"编辑", + "editSpecialPuPool"=>"编辑", + + "addRemark"=>"新增备注", + "editRemark"=>"修改备注", + "viewRemark"=>"查看备注", + + "uploadVoucher"=>"上传凭证", + "viewVoucher"=>"查看凭证", + "editVoucher"=>" 编辑凭证", + + "setUlPayment"=>"线下打款", + + "setPayment"=>"打款信息确认", + "editPayment"=>"打款信息编辑", + "viewPayment"=>"打款详情", + + 'reCount'=>"重算", + 'cancelPool'=>"撤销汇总", + + ]; + //操作对应菜单 + $optist = []; + switch ($info['verify_status']) { + case '-2': + case '-1': + case '0': + $optist = ["viewPool","cancelPool"]; + break; + case '1': + $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","editPayment","setUlPayment"]; + break; + case '2': + $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher"]; + break; + case '3': + $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","viewPayment"]; + break; + case '4': + $optist = ["viewPool","viewVoucher","editVoucher","uploadVoucher","viewPayment"]; + break; + case '5': + $optist = ["viewPool","cancelPool"]; + break; + case '6': + $optist = ["viewPool","cancelPool"]; + + break; + default: + break; + } + + if(empty($info['ext_file'])){ + //未上传凭证 + $optist = array_diff($optist, ["viewVoucher", "editVoucher"]); + }else{ + $optist = array_diff($optist, ["uploadVoucher"]); + } + + if($info['is_payment'] == 1){ + $optist = array_diff($optist, ["setUlPayment"]); + }else{ + $optist = array_diff($optist, ["setPayment","editPayment","viewPayment"]); + } + + if(empty($info['remark'])){ + //未上传备注 + $optist = array_diff($optist, ["editRemark", "viewRemark"]); + }else{ + $optist = array_diff($optist, ["addRemark"]); + } + + // + $resarr = []; + foreach ($optist as $k => $v) { + if(IS_ROOT){ + $resarr[] = $opBtn[$v]; + }else{ + if(in_array($v,$this->OpAuthList)){ + $resarr[] = $opBtn[$v]; + } + } + } + return $resarr; + } + + public function menuAuth() + { + $mentBtn = [ + "export"=>"导出" + ]; + $resarr = []; + foreach ($mentBtn as $k => $v) { + if(IS_ROOT){ + $resarr[] = $v; + }else{ + if(in_array($k,$this->OpAuthList)){ + $resarr[] = $v; + } + } + } + return $resarr; + } + +} diff --git a/Application/Admin/View/SubCompanyStatementPool/lists.html b/Application/Admin/View/SubCompanyStatementPool/lists.html new file mode 100644 index 000000000..ea0103606 --- /dev/null +++ b/Application/Admin/View/SubCompanyStatementPool/lists.html @@ -0,0 +1,767 @@ + + + + + + + + + + + + + + + + + +
+ +
+
+   +
+ +
+ +
+ +
+ +
+ + + + +
+ +  -  +
+ + +
+
+ +
+ +
+ +
+ +
+ +
+ +  -  +
+ + +
+
+ +
+ 搜索 +
+ +
+
+ +
+
+ + {$vo} + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
结算汇总单订单号结算时间结算类型结算周期结算金额不结算金额创建记录凭证操作
aOh! 暂时还没有内容!
{$data.statement_num}{$data.valid}{$data.company_type_str}{$data.withdraw_type}{$data.statement_money}{$data.lack_statement_money}{$data.create}{$data.ext_file_type} + + {$vo} + +
合计结算总金额: {$count.statement_money}     不结算总金额:{$count.lack_statement_money}   
+
+ +
+
+ + + + {$_page|default=''} +
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + diff --git a/Application/Admin/View/SubCompanyStatementPool/poolWmStatement.html b/Application/Admin/View/SubCompanyStatementPool/poolWmStatement.html new file mode 100644 index 000000000..5e0424ff1 --- /dev/null +++ b/Application/Admin/View/SubCompanyStatementPool/poolWmStatement.html @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ 《{$company_name}》结算单 +
+
+
+
+
+
+
({$statement_begin_time}-{$statement_end_time})
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
结算月份合作产品名称月累计用户充值流水月新增用户数税费费率结算金额(元)
{$list[0]['statement_begin_time']}-{$list[0]['statement_end_time']}{$list[0]['game_name']}{$amount_data['pay_amount']}{$amount_data['user_newcount']}{$amount_data['fax_ratio']}%{$amount_data['sum_money']}
{$it['statement_begin_time']}-{$it['statement_end_time']}{$it['game_name']}
支付金额{:convertAmountToCn($amount_data['sum_money'])}
备注结算金额按每月双方实际核定结算指标为准
甲方{$first_party_info['partner']}乙方{$second_party_info['partner']}
联系人{$first_party_info['link_man']}联系人{$second_party_info['link_man']}
联系电话{$first_party_info['link_phone']}联系电话{$second_party_info['phone']}
开票内容{$first_party_info['invoice_item']}邮寄地址{$second_party_info['address']}
发票类型{$first_party_info['invoice_type']}请汇入此账号
邮寄地址{$first_party_info['address']}户名{$second_party_info['ali_user']}{$second_party_info['bank_address']}
账号{$second_party_info['ali_account']}{$second_party_info['bank_card']}
开户行{$second_party_info['bank_name']}
甲方{$first_party_info['partner']}乙方{$second_party_info['partner']}
联系人{$first_party_info['link_man']}联系人{$second_party_info['link_man']}
联系电话{$first_party_info['link_phone']}联系电话{$second_party_info['phone']}
邮寄地址{$first_party_info['address']}开票内容{$second_party_info['invoice_item']}
请汇入此账号发票类型{$second_party_info['invoice_type']}
户名{$first_party_info['ali_user']}{$first_party_info['bank_address']}邮寄地址{$second_party_info['address']}
账号{$first_party_info['ali_account']}{$first_party_info['bank_card']}
开户行{$first_party_info['bank_name']}
+ +
+
+ + + From c6587b61a59e985ee274c6ff3edbac4724f5bf1f Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Sat, 27 Feb 2021 18:38:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?2.28=E5=8F=B7=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/SubCompanyStatementPool/lists.html | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/Application/Admin/View/SubCompanyStatementPool/lists.html b/Application/Admin/View/SubCompanyStatementPool/lists.html index ea0103606..9286ddb56 100644 --- a/Application/Admin/View/SubCompanyStatementPool/lists.html +++ b/Application/Admin/View/SubCompanyStatementPool/lists.html @@ -70,26 +70,6 @@
 
- -
- -
- -
- -
- -
@@ -101,33 +81,6 @@
-
- -
- -
- -
- -
- -  -  -
- - -
-
-