2.28号功能提交

master
zhengyongxing 4 years ago
parent 016c2e11bd
commit 8e28b1c4ad

@ -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 : '<br />');
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"=>"<a class='confirm viewPool' data-id='{$id}'>查看</a>",
"editPool"=>"<a class='confirm editPool' data-id='{$id}'>编辑</a>",
"editSpecialPuPool"=>"<a class='confirm editSpecialPuPool' data-id='{$id}'>编辑</a>",
"addRemark"=>"<a class='confirm addRemark' data-id='{$id}'>新增备注</a>",
"editRemark"=>"<a class='confirm editRemark' data-remark='{$remark}' data-id='{$id}'>修改备注</a>",
"viewRemark"=>"<a class='confirm viewRemark' data-remark='{$remark}' data-id='{$id}'>查看备注</a>",
"uploadVoucher"=>"<a class='confirm uploadVoucher' data-id='{$id}'>上传凭证</a>",
"viewVoucher"=>"<a class='confirm viewVoucher' data-img='{$img}' data-id='{$id}'>查看凭证</a>",
"editVoucher"=>" <a class='confirm editVoucher' data-id='{$id}'>编辑凭证</a>",
"setUlPayment"=>"<a class='confirm setUlPayment' 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>",
'reCount'=>"<a class='confirm reCount' data-id='{$id}'>重算</a>",
'cancelPool'=>"<a class='confirm cancelPool' data-id='{$id}'>撤销汇总</a>",
];
//操作对应菜单
$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'];

@ -0,0 +1,573 @@
<?php
namespace Admin\Controller;
//use Think\Controller;
/**
* 上下游结算单
* @author cz
*/
class SubCompanyStatementPoolController extends ThinkController
{
public $CompanyType = [
"1"=>"下游公司",
"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 = "<br>";
}
$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 = "<br>";
}
$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 : '<br />');
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"=>"<a class='confirm viewPool' data-id='{$id}'>查看</a>",
"editPool"=>"<a class='confirm editPool' data-id='{$id}'>编辑</a>",
"editSpecialPuPool"=>"<a class='confirm editSpecialPuPool' data-id='{$id}'>编辑</a>",
"addRemark"=>"<a class='confirm addRemark' data-id='{$id}'>新增备注</a>",
"editRemark"=>"<a class='confirm editRemark' data-remark='{$remark}' data-id='{$id}'>修改备注</a>",
"viewRemark"=>"<a class='confirm viewRemark' data-remark='{$remark}' data-id='{$id}'>查看备注</a>",
"uploadVoucher"=>"<a class='confirm uploadVoucher' data-id='{$id}'>上传凭证</a>",
"viewVoucher"=>"<a class='confirm viewVoucher' data-img='{$img}' data-id='{$id}'>查看凭证</a>",
"editVoucher"=>" <a class='confirm editVoucher' data-id='{$id}'>编辑凭证</a>",
"setUlPayment"=>"<a class='confirm setUlPayment' 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>",
'reCount'=>"<a class='confirm reCount' data-id='{$id}'>重算</a>",
'cancelPool'=>"<a class='confirm cancelPool' data-id='{$id}'>撤销汇总</a>",
];
//操作对应菜单
$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"=>"<a class='butn' id='export'>导出</a>"
];
$resarr = [];
foreach ($mentBtn as $k => $v) {
if(IS_ROOT){
$resarr[] = $v;
}else{
if(in_array($k,$this->OpAuthList)){
$resarr[] = $v;
}
}
}
return $resarr;
}
}

@ -0,0 +1,767 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
.data_list table td{
line-height: 2;
}
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">联运平台汇总结算单管理</h3>
<p class="description_text">结算单发起汇总后生成汇总单--->汇总单财务审核--->提交打款信息--->打款审批</p>
</div>
<div class="cf top_nav_list" style="height: 38px;">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list" style="margin-bottom: 15px;">
<div class="input-list">
<input type="text" name="statement_num" class="" placeholder="请输入订单号" value="{:I('statement_num')}" />&nbsp;
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="company_type" name="company_type" class="select_gallery" >
<option value="">请选择结算单类型</option>
<volist name="CompanyType" id="vo">
<option value="{$key}" <if condition="isset($_GET['company_type']) && $key eq I('company_type')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="is_payment" name="is_payment" class="select_gallery" >
<option value="">请选择是否打款</option>
<volist name="IsPayment" id="vo">
<option value="{$key}" <if condition="isset($_GET['is_payment']) && $key eq I('is_payment')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="结算开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="结算结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="withdraw_type" name="withdraw_type" class="select_gallery" >
<option value="">结算周期</option>
<volist name="WithdrawType" id="vo">
<option value="{$key}" <if condition="isset($_GET['withdraw_type']) && $key eq I('withdraw_type')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="verify_status" name="verify_status" class="select_gallery" >
<option value="">请选择审核状态</option>
<volist name="VerifyStatus" id="vo">
<option value="{$key}" <if condition="isset($_GET['verify_status']) && $key eq I('verify_status')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start2" name="time_start2" class="" value="{:I('time_start2')}" placeholder="操作开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker2" style="display:inline-block">
<input type="text" readonly id="time_end2" name="time_end2" class="" value="{:I('time_end2')}" placeholder="操作结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('lists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<foreach name="menubtn" item="vo" >
{$vo}
</foreach>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th>结算汇总单订单号</th>
<th>结算时间</th>
<th>结算类型</th>
<th>结算周期</th>
<!-- <th>是否打款</th> -->
<th>结算金额</th>
<!-- <th>结算流水</th> -->
<th>不结算金额</th>
<th>创建记录</th>
<th>凭证</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td ><input class="ids" type="checkbox" data-status="{$data.verify_status}" data-export="{$data.can_export}" value="{$data['id']}" name="ids[]"></td>
<td>{$data.statement_num}</td>
<td>{$data.valid}</td>
<td>{$data.company_type_str}</td>
<td>{$data.withdraw_type}</td>
<!-- <td>{$data.is_payment_str}</td> -->
<td>{$data.statement_money}</td>
<!-- <td>{$data.platform_amount}</td> -->
<td>{$data.lack_statement_money}</td>
<td>{$data.create}</td>
<td>{$data.ext_file_type}</td>
<td>
<foreach name="data.oplist" item="vo" >
{$vo}
</foreach>
</td>
</tr>
</volist>
<tr><td style="line-height: 42px;">合计</td><td colspan="13" style="line-height: 42px;">结算总金额:&nbsp;{$count.statement_money}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;不结算总金额:{$count.lack_statement_money}&nbsp;&nbsp;&nbsp;</td></tr>
</notemtpy>
</tbody>
</table>
</div>
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<!-- <a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a> -->
</if>
{$_page|default=''}
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<script type="text/javascript">
</script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
function reload() {
window.location.reload();
}
$(function(){
var company_id = "{$_GET['company_id']??0}";
$("#company_type").on("change",function(){
var type = $(this).find("option:selected").val();
var url = "{:U('Ajax/getCompanyList')}"+"&company_type="+type;
$.get(url,function(data){
var company = data;
var companystr = '<option value="">请选择合作公司</option>';
for (var i in company) {
if(company[i].id == company_id){
companystr += "<option value='" + company[i].id + "' selected='selected'>" + company[i].name + "</option>"
}else{
companystr += "<option value='" + company[i].id + "'>" + company[i].name + "</option>"
}
}
$("#company_id").html(companystr);
$("#company_id").select2();
})
})
$("#company_type").change();
$(".viewPool").click(function () {
var id = $(this).data("id");
var url = "{:U('viewPool')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$(".unPayment").click(function () {
var id = $(this).data("id");
var url = "{:U('viewUnPaymentPool')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$(".editPool").click(function () {
var id = $(this).data("id");
var url = "{:U('editPool')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$(".editSpecialPuPool").click(function () {
var id = $(this).data("id");
var url = "{:U('editPool')}"+"&id="+id+"&type=1"
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$("#verifyAgree,#verifyRefuse,#firstverifyAgree,#firstverifyRefuse").on("click",function(){
var id = $(this).attr("id");
if(id == "verifyAgree"){
var opname = "审批通过";
var opurl = "{:U('verifyAgree')}";
var opst ="[初审通过]";
var status = [6,1];
}else if(id=="verifyRefuse"){
var opname = "审批拒绝";
var opurl = "{:U('verifyRefuse')}";
var opst ="[初审通过]";
var status = [6];
}else if(id=="firstverifyAgree"){
var opname = "初审通过";
var opurl = "{:U('firstverifyAgree')}";
var opst ="[未进行审批]";
var status = [0];
}else if(id=="firstverifyRefuse"){
var opname = "初审拒绝";
var opurl = "{:U('firstverifyRefuse')}";
var opst ="[未进行审批]";
var status = [0,1];
}
var confirm = confirm ? confirm :false;
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($.inArray( $(elem).data("status"),status) == -1){
flag = true;
}else{
return $(elem).val();
}
}).get();
if(text.length > 40){
layer.msg("<font style='color:white'>" + '为保证效率暂不支持超过40条的批量操作' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要'+opname+'的申请,仅'+opst+'状态可以进行'+opname+"</font>");
return;
}
text = text.join(",");
if(flag){
layer.confirm(opname+"仅会对"+opst+"的申请进行处理,选择中包含其他的状态的申请将被忽略,点击取消停止操作",{title:false}, function(index){
_doAgreeApply();
layer.close(index);
});
}else{
if(confirm){
layer.confirm('【警告】'+opname+'将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
_doAgreeApply();
});
}else{
layer.confirm('【警告】'+opname+'是否确认,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function() {
_doAgreeApply();
});
}
}
function _doAgreeApply(){
//执行
$.ajax({
type: "POST",
url: opurl,
dataType: 'json',
async: false,
data: {ids:text},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
}
});
$("#verifyReturn").on("click",function(){
var status = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
console.log($(elem).data("status"))
if($(elem).data("status") == 1 || $(elem).data("status") == -1 || $(elem).data("status") == 2){
return $(elem).val();
} else {
status = true;
}
}).get();
if(text.length > 40){
layer.msg("<font style='color:white'>" + '为保证效率暂不支持超过40条的批量操作' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要审批撤回的操作'+"</font>");
return;
}
text = text.join(",");
if (status) {
layer.confirm("审批撤回仅会对【'审批通过','审批拒绝'】的申请进行处理,选择中包含其他的状态的申请将被忽略,点击取消停止操作",{title:false}, function(index){
_doAgreeApply();
layer.close(index);
});
} else {
layer.confirm('【提示】点击确认后,审批即撤回', {
btn: ['确认','取消'],
title:false
}, function(){
_doAgreeApply();
});
}
function _doAgreeApply(){
//执行
$.ajax({
type: "POST",
url: "{:U('verifyReturn')}",
dataType: 'json',
async: false,
data: {ids:text},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
}
});
$("#export").click(function () {
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("export") == 1){
return $(elem).val();
}else{
flag = true;
}
}).get();
if(text.length > 20){
layer.msg("<font style='color:white'>" + '暂不支持超过20条的批量导出' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要导出的结算单' + "</font>");
return;
}
if(flag){
layer.confirm("仅结算金额不等于0的会进行导出将忽略结算金额等于0的汇总单点击取消停止操作",{title:false}, function(index){
_export();
layer.close(index);
});
}else{
_export();
}
function _export(){
for (var index = 0; index < text.length; index++) {
var id = text[index];
var url ="{:U('viewPool')}"+"&id="+id+"&export=1";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel)
}
}
})
//撤销汇总
$(".cancelPool,.reCount").on("click",function(){
var id = $(this).data('id');
var url = "{:U('cancelPool')}";
layer.confirm("撤销汇总/重算都是不可逆操作,请慎重选择",{title:false}, function(index){
layer.close(index);
cancelPoolAjax(url,{id:id});
});
});
//撤销汇总
$(".cancelWmPool,.reCount").on("click",function(){
var id = $(this).data('id');
var url = "{:U('cancelWmPool')}";
layer.confirm("撤销汇总/重算都是不可逆操作,请慎重选择",{title:false}, function(index){
layer.close(index);
cancelPoolAjax(url,{id:id});
});
})
//线下打款
$(".setUlPayment").on("click",function(){
var id = $(this).data('id');
var url = "{:U('setUlPayment')}";
cancelPoolAjax(url,{ids:id});
})
$(".setPayment,.editPayment").on("click",function(){
var id = $(this).data("id");
var url = "{:U('setPayment')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
})
$(".viewPayment").on("click",function(){
var id = $(this).data("id");
var url = "{:U('viewPayment')}"+"&id="+id
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
})
function cancelPoolAjax(opurl,senddata){
//执行
layer.load(2);
$.ajax({
type: "POST",
url: opurl,
dataType: 'json',
async: true,
data: senddata,
success:function(data){
layer.closeAll('loading');
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
}
//新增批注
$(".addRemark").click(function(){
var id = $(this).data("id");
layer.prompt({
formType: 2,
value: '',
title: '输入备注',
area: ['360px', '300px'] //自定义文本域宽高
}, function(value, index, elem){
if(value != ''){
$.ajax({
type: "POST",
url: "{:U('saveRemark')}",
dataType: 'json',
async: false,
data: {id:id,remark:value},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}
}
});
}else{
layer.closeAll();
}
});
})
//编辑批注
$(".editRemark").click(function(){
var id = $(this).data("id");
var remark = $(this).data("remark");
layer.prompt({
formType: 2,
title: '修改备注',
value:remark,
area: ['360px', '300px'],
btnAlign: 'c',
id: 'prompt',
yes: function (index, layero) {
// 获取文本框输入的值
var value = layero.find(".layui-layer-input").val();
$.ajax({
type: "POST",
url: "{:U('saveRemark')}",
dataType: 'json',
async: false,
data: {id:id,remark:value},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}
}
});
}
});
})
//查看批注
$(".viewRemark").click(function () {
var remark = $(this).data("remark");
layer.open({
type: 1,
title:false,
content:"<div style='width: 300;height:auto;margin: auto;padding:20px;'>"+remark+"</div>"
});
});
//上传凭证
$(".uploadVoucher").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "上传凭证",
shadeClose: true,
shade: 0.8,
area: ['60%', '60%'],
content:'/admin.php?s=/CompanyStatementPool/uploadVoucher/id/'+id,
end:function(){
reload();
}
});
});
//查看凭证
$(".viewVoucher").click(function () {
var img = $(this).data("img");
layer.open({
type: 1,
title:false,
content:"<img src='"+img+"' style='width: auto;height: 450px;margin: auto;'>"
});
});
//编辑凭证
$(".editVoucher").click(function () {
var id = $(this).data("id");
layer.open({
type: 2,
title: "编辑凭证",
shadeClose: true,
shade: 0.8,
area: ['60%', '60%'],
content:'/admin.php?s=/CompanyStatementPool/editVoucher/id/'+id,
end:function(){
reload();
}
});
});
$("#search").click(function(){
var start = $("#time_start").val();
var end = $("#time_end").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('结算开始时间必须小于等于结束时间');
return false;
}
}
var start2 = $("#time_start2").val();
var end2 = $("#time_end2").val();
if(start2 !='' && end2 != ''){
if (Date.parse(start2) > Date.parse(end2)){
layer.msg('操作开始时间必须小于等于结束时间');
return false;
}
}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
$('#time_start2').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker2').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
})
</script>
</block>

@ -0,0 +1,396 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 0px 150px;
width: 960px;
margin: auto;
}
.tabcon1711 table{
width: 480px;
}
table{
margin: auto;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
</style>
<body>
<div style="height: 20px"></div>
<div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
<div class="tab-content tabcon1711" >
<div class="input-list input-list-game search_label_rehab" style="margin-left: 375px;">
《{$company_name}》结算单
</div>
</div>
</div>
<div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
<div class="tab-content tabcon1711">
<div class="input-list input-list-game search_label_rehab" style="margin-left: 375px;">
<div style="margin-top: -20px;width: 100%;line-height: 20px;font-weight: 600;text-align: center;margin-bottom: 10px;margin-left: 30px;" class="time">({$statement_begin_time}-{$statement_end_time})</div>
</div>
</div>
</div>
<div class="data_list box_mt" style="margin-top: 10px;">
<div >
<table>
<!-- 表头 -->
<thead>
<tr>
<th>结算月份</th>
<th>合作产品名称</th>
<th>月累计用户充值流水</th>
<th>月新增用户数</th>
<th>税费费率</th>
<th>结算金额(元)</th>
</tr>
</thead>
<tbody >
<tr>
<td>{$list[0]['statement_begin_time']}-{$list[0]['statement_end_time']}</td>
<td>{$list[0]['game_name']}</td>
<td rowspan="{$row}" class="pay_amount">{$amount_data['pay_amount']}</td>
<td rowspan="{$row}" class="user_newcount">{$amount_data['user_newcount']}</td>
<td rowspan="{$row}" class="parent_fax_ratio">{$amount_data['fax_ratio']}%</td>
<td rowspan="{$row}" class="sum_money">{$amount_data['sum_money']}</td>
</tr>
<foreach name="list" item="it" key="key">
<if condition="$key neq 0">
<tr>
<td>{$it['statement_begin_time']}-{$it['statement_end_time']}</td>
<td>{$it['game_name']}</td>
</tr>
</if>
</foreach>
<tr>
<td>支付金额</td>
<td colspan="5">{:convertAmountToCn($amount_data['sum_money'])}</td>
</tr>
<tr>
<td>备注</td>
<td colspan="5">结算金额按每月双方实际核定结算指标为准</td>
</tr>
<if condition="$first_party_info['invoice_item']">
<tr>
<td>甲方</td>
<td colspan="2">{$first_party_info['partner']}</td>
<td>乙方</td>
<td colspan="2">{$second_party_info['partner']}</td>
</tr>
<tr>
<td>联系人</td>
<td colspan="2">{$first_party_info['link_man']}</td>
<td>联系人</td>
<td colspan="2">{$second_party_info['link_man']}</td>
</tr>
<tr>
<td>联系电话</td>
<td colspan="2">{$first_party_info['link_phone']}</td>
<td>联系电话</td>
<td colspan="2">{$second_party_info['phone']}</td>
</tr>
<tr>
<td>开票内容</td>
<td colspan="2">{$first_party_info['invoice_item']}</td>
<td>邮寄地址</td>
<td colspan="2">{$second_party_info['address']}</td>
</tr>
<tr>
<td>发票类型</td>
<td colspan="2">{$first_party_info['invoice_type']}</td>
<td>请汇入此账号</td>
<td colspan="2"></td>
</tr>
<tr>
<td>邮寄地址</td>
<td colspan="2">{$first_party_info['address']}</td>
<td>户名</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$second_party_info['ali_user']}</td>
<else/>
<td colspan="2">{$second_party_info['bank_address']}</td>
</if>
</tr>
<tr>
<td></td>
<td colspan="2"></td>
<td>账号</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$second_party_info['ali_account']}</td>
<else/>
<td colspan="2">{$second_party_info['bank_card']}</td>
</if>
</tr>
<if condition="$second_party_info['is_payment'] neq 1">
<tr>
<td></td>
<td colspan="2"></td>
<td>开户行</td>
<td colspan="2">{$second_party_info['bank_name']}</td>
</tr>
</if>
<else/>
<tr>
<td>甲方</td>
<td colspan="2">{$first_party_info['partner']}</td>
<td>乙方</td>
<td colspan="2">{$second_party_info['partner']}</td>
</tr>
<tr>
<td>联系人</td>
<td colspan="2">{$first_party_info['link_man']}</td>
<td>联系人</td>
<td colspan="2">{$second_party_info['link_man']}</td>
</tr>
<tr>
<td>联系电话</td>
<td colspan="2">{$first_party_info['link_phone']}</td>
<td>联系电话</td>
<td colspan="2">{$second_party_info['phone']}</td>
</tr>
<tr>
<td>邮寄地址</td>
<td colspan="2">{$first_party_info['address']}</td>
<td>开票内容</td>
<td colspan="2">{$second_party_info['invoice_item']}</td>
</tr>
<tr>
<td>请汇入此账号</td>
<td colspan="2"></td>
<td>发票类型</td>
<td colspan="2">{$second_party_info['invoice_type']}</td>
</tr>
<tr>
<td>户名</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$first_party_info['ali_user']}</td>
<else/>
<td colspan="2">{$first_party_info['bank_address']}</td>
</if>
<td>邮寄地址</td>
<td colspan="2">{$second_party_info['address']}</td>
</tr>
<tr>
<td>账号</td>
<if condition="$second_party_info['is_payment'] eq 1">
<td colspan="2">{$first_party_info['ali_account']}</td>
<else/>
<td colspan="2">{$first_party_info['bank_card']}</td>
</if>
<td></td>
<td colspan="2"></td>
</tr>
<if condition="$second_party_info['is_payment'] neq 1">
<tr>
<td>开户行</td>
<td colspan="2">{$first_party_info['bank_name']}</td>
<td></td>
<td colspan="2"></td>
</tr>
</if>
</if>
</tbody>
</table>
</div>
</div>
</body>
<script>
$(".select_gallery").select2();
$(function () {
var sum_amount = parseFloat($(".sum_money").text());
var row = 0;
var amount_datas;
var other_list;
var list = '{$js_data}';
var company_id;
var other_id;
$(".submit_btn").click(function () {
var id = "{$_GET['id']}";
if (!company_id) {
layer.msg("请选择汇总公司");
return;
}
var fax_ratio = $(".fax_ratio").val();
layer.load(2);
$.ajax({
type: 'post',
url: "{:U('saveCompanyData')}",
data:{list:list,other_list:other_list,company_id:company_id,amount_data:amount_datas,fax_ratio:fax_ratio,id:id,other_id:other_id},
success: function(data) {
layer.msg(data.msg);
if(data.status == 1) {
setTimeout(function(){
layer.close(2);
window.parent.reload();
},3000);
}
layer.closeAll("loading");
},
error:function(){
layer.closeAll("loading");
layer.alert("网络错误或超时");
return false;
}
});
});
$("#promote_company").change(function () {
var begin = $(".time").data("begin");
var end = $(".time").data("end");
company_id = $(this).val();
if (company_id == "请选择下游公司") {
company_id = '';
}
var id = "{$_GET['id']}";
var amount_data = '{$js_amount_data}';
$(".other_append").remove();
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))-row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))-row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))-row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))-row);
$.ajax({
type: 'post',
url: "{:U('checkCompanyData')}",
data:{begin_time:begin,end_time:end,company_id:company_id,statement_id:id,amount_data:amount_data},
success: function(data) {
if (data.status==1) {
for (var key in data.list) {
var tr = "<tr class='other_append'>" +
"<td>"+data.list[key]['statement_begin_time']+"-"+data.list[key]['statement_end_time']+"</td>" +
"<td>"+data.list[key]['game_name']+"</td>" +
"</tr>";
$("tbody").append(tr);
}
row = data.row;
$(".pay_amount").text(data.amount_data['pay_amount']);
$(".user_newcount").text(data.amount_data['user_newcount']);
// $(".fax_ratio").text(data.amount_data['pay_amount']);
$(".sum_money").text(data.amount_data['sum_money']);
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))+row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))+row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))+row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))+row);
sum_amount = data.amount_data['sum_money'];
amount_datas = JSON.stringify(data.amount_data);
other_list = JSON.stringify(data.list);
other_id = data.other_id;
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
$(".fax_ratio").blur(function() {
var fax_ratio = parseFloat($(this).val());
var pay_amount = parseFloat($(".pay_amount").text());
var sum_money = 0;
var fax_amount = sum_amount * (fax_ratio/100);
sum_money = sum_amount-fax_amount;
$(".sum_money").text(sum_money.toFixed(2));
});
});
</script>
</html>
Loading…
Cancel
Save