Merge branch 'feature/group_type' of 47.111.118.107:wmtx/platform into dev

master
chenzhi 5 years ago
commit ee5330bfc9

@ -1830,7 +1830,7 @@ function getCompanyList() {
//上游cp对账单导出 //上游cp对账单导出
function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money) { function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money) {
header("Content-type: text/html; charset=gb2312"); header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL); error_reporting(E_ALL);
ini_set('display_errors', TRUE); ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE); ini_set('display_startup_errors', TRUE);
@ -1901,10 +1901,15 @@ function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_
$objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+3), $data['pay_company']['bank_account']); $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+3), $data['pay_company']['bank_account']);
$objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+4), $data['pay_company']['opening_bank']); $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+4), $data['pay_company']['opening_bank']);
$statement_begin_time = date('Y.m.d', $data['statement_begin_time']);//对账开始时间
$statement_end_time = date('Y.m.d',$data['statement_end_time']);//对账截止时间
$fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['partner']}-对账单{$statement_begin_time}-{$statement_end_time}";
ob_end_clean();//清除缓冲区,避免乱码 ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public'); header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="上游结算单.xls"'); header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
header("Content-Disposition:attachment;filename=上游结算单.xls");//attachment新窗口打印inline本窗口打印 header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output'); $objWriter->save('php://output');
exit; exit;
@ -1929,8 +1934,8 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
//设置模板文件 //设置模板文件
$objPHPExcel = $objReader->load("Public/Admin/excel/down_stream.xls"); $objPHPExcel = $objReader->load("Public/Admin/excel/down_stream.xls");
$statement_begin_time = set_show_time($data['statement_begin_time']);//对账开始时间 $statement_begin_time = date('Y.m.d', $data['statement_begin_time']);//对账开始时间
$statement_end_time = set_show_time($data['statement_end_time']);//对账截止时间 $statement_end_time = date('Y.m.d',$data['statement_end_time']);//对账截止时间
$objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单 $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单
{$statement_begin_time}-{$statement_end_time}"); {$statement_begin_time}-{$statement_end_time}");
@ -1983,11 +1988,12 @@ function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_al
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['second_party_info']['bank_account']);//银行账号 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['second_party_info']['bank_account']);//银行账号
$objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['second_party_info']['opening_bank']);//开户行 $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['second_party_info']['opening_bank']);//开户行
$filename = '下游结算单'; $fileName = "{$data['second_party_info']['partner']}&{$data['first_party_info']['jfCompany']}-对账单{$statement_begin_time}-{$statement_end_time}";
// dd($fileName);
ob_end_clean();//清除缓冲区,避免乱码 ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public'); header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"'); header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $fileName .'".xls');
header("Content-Disposition:attachment;filename=$filename.xls");//attachment新窗口打印inline本窗口打印 header("Content-Disposition:attachment;filename={$fileName}.xls");//attachment新窗口打印inline本窗口打印
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output'); $objWriter->save('php://output');
exit; exit;

@ -354,4 +354,28 @@ class AjaxController extends ThinkController{
} }
function getPromoteCompanyList() {
$map = [];
if ($_REQUEST['withdraw_number']) {
$map['widthdraw_number'] = $_REQUEST['withdraw_number'];
}
// var_dump($map);die();
if ($_REQUEST['company_id']) {
$map['company_id'] = $_REQUEST['company_id'];
}
$data = M("withdraw","tab_")
->field("widthdraw_number,promote_account,tab_promote_company.id as company_id,company_name,tab_withdraw.settlement_type,mobile_phone,real_name,bank_card,account_openin,address,game_ratio,bank_account")
->join("left join tab_promote on tab_withdraw.promote_id=tab_promote.id")
->join("left join tab_promote_company on tab_promote.company_id=tab_promote_company.id")
->where($map)
->select();
$this->ajaxReturn(['data'=>$data]);
// return $data;
}
} }

@ -644,14 +644,23 @@
var sort = $(this).data("change"); var sort = $(this).data("change");
var val = $(this).val(); var val = $(this).val();
var vdata = eval("DATAOBJ."+sort);//原先值
var dom = $(this);
if(!CHECK.number.test(val)){ if(!CHECK.number.test(val)){
layer.msg('结算单中的罚款和税率必须是数字'); layer.msg('结算单中的罚款和税率必须是数字');
$(this).val(0); dom.val(vdata);
return false; return false;
} }
var str = "DATAOBJ."+sort+"='"+val+"';"; var str = "DATAOBJ."+sort+"='"+val+"';";
if(sort != 'fine'){ if(sort != 'fine'){
if(val > 100 || val < 0){
layer.msg('结算单中的税率不允许大于100和小于0');
dom.val(vdata);
return false;
}
eval(str); eval(str);
var index = $(this).data("index"); var index = $(this).data("index");
var td = DATAOBJ.statement_info[index]; var td = DATAOBJ.statement_info[index];

@ -456,91 +456,61 @@
} }
}) })
}, },
deepCompare(x, y) { floatAdd(a,b){
var i, l, leftChain, rightChain; return Math.round(a*100+b*100)/100;
function compare2Objects(x, y) { },
var p; floatCut(a,b){
if (isNaN(x) && isNaN(y) && typeof x === 'number' && typeof y === 'number') { return Math.round(a*100-b*100)/100;
return true; },
} CompanyKeyName:{
if (x === y) { id:"公司表id",
return true; partner:"公司名称",
} link_man:'联系人',
if ((typeof x === 'function' && typeof y === 'function') || link_phone:"联系电话",
(x instanceof Date && y instanceof Date) || address:'邮寄地址',
(x instanceof RegExp && y instanceof RegExp) || company_tax_no:'公司税号',
(x instanceof String && y instanceof String) || payee_name:'名称',
(x instanceof Number && y instanceof Number)) { bank_account:"银行账号",
return x.toString() === y.toString(); opening_bank:"开户行"
} },
if (!(x instanceof Object && y instanceof Object)) { checkCompanyKey(type,key){
return false; //获取公司名
} var company = '';
if (x.isPrototypeOf(y) || y.isPrototypeOf(x)) { if(key == "payee_name" || key == "bank_account" || key == "opening_bank"){
return false; if((DATAOBJ.statement_type == 0 && type == "first_party_info") || (DATAOBJ.statement_type == 1 && type == "second_party_info")){
} company = "收款方";
if (x.constructor !== y.constructor) {
return false;
} }
if (x.prototype !== y.prototype) { if((DATAOBJ.statement_type == 0 && type == "second_party_info")|| (DATAOBJ.statement_type == 1 && type == "first_party_info")){
return false; company = "付款方";
} }
if (leftChain.indexOf(x) > -1 || rightChain.indexOf(y) > -1) { }else{
return false; if(type == "first_party_info"){
company = "甲方";
}else{
company = "乙方";
} }
for (p in y) {
if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {
return false;
} else if (typeof y[p] !== typeof x[p]) {
return false;
}
}
for (p in x) {
if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {
return false;
} else if (typeof y[p] !== typeof x[p]) {
return false;
}
switch (typeof (x[p])) {
case 'object':
case 'function':
leftChain.push(x);
rightChain.push(y);
if (!compare2Objects(x[p], y[p])) {
return false;
}
leftChain.pop();
rightChain.pop();
break;
default:
if (x[p] !== y[p]) {
return false;
}
break;
}
}
return true;
} }
//获取键名
if (arguments.length < 1) { try {
return true; var keyname = company+PUBLIC.CompanyKeyName[key];
} catch (error) {
var keyname = false;
} }
for (i = 1, l = arguments.length; i < l; i++) { //验证
if(DATAOBJ[type][key] ===''){
leftChain = []; //Todo: this can be cached layer.msg(keyname+"不能为空");
rightChain = []; return false;
}
if (!compare2Objects(arguments[0], arguments[i])) { if(key == "link_phone" && !CHECK.mobile.test(DATAOBJ[type][key])){
return false; layer.msg(keyname+"格式错误");
} return false;
}
if(key == "bank_account" && !CHECK.BankNo.test(DATAOBJ[type][key])){
layer.msg(keyname+"格式错误");
return false;
} }
return true; return true;
} },
} }
//数据类 //数据类
@ -570,37 +540,20 @@
} }
//验证甲方信息 //验证甲方信息
for (const key in DATAOBJ.first_party_info) { for (const key in DATAOBJ.first_party_info) {
var t = DATAOBJ.first_party_info; var t = DATAOBJ.first_party_info;
if (t[key] === '') { var flag = PUBLIC.checkCompanyKey("first_party_info",key);
layer.msg('甲方信息不全,请先补全 code:' + key); if(!flag){
return false; return flag;
}
if (key == "link_phone" && !CHECK.mobile.test(t[key])) {
layer.msg('甲方联系人手机号格式错误');
return false;
}
if (key == "bank_account" && !CHECK.BankNo.test(t[key])) {
layer.msg('甲方银行卡号格式错误');
return false;
} }
} }
//乙方 //乙方
for (const key in DATAOBJ.second_party_info) { for (const key in DATAOBJ.second_party_info) {
var t = DATAOBJ.second_party_info; var t = DATAOBJ.second_party_info;
if (!t[key] || t[key] == '') { var flag = PUBLIC.checkCompanyKey("second_party_info",key);
layer.msg('乙方信息不全,请先补全 code:' + key); if(!flag){
return false; return flag;
}
if (key == "link_phone" && !CHECK.mobile.test(t[key])) {
layer.msg('乙方联系人手机号格式错误');
return false;
}
if (key == "bank_account" && !CHECK.BankNo.test(t[key])) {
layer.msg('乙方银行卡号格式错误');
return false;
} }
} }
console.log(DATAOBJ);
layer.load(2); layer.load(2);
$("#createStatement").off("click");//自我解绑 $("#createStatement").off("click");//自我解绑
@ -633,56 +586,67 @@
}, },
statementchange() { statementchange() {
$(".statementchange").off("blur"); $(".statementchange").off("blur");
$(".statementchange").on("blur", function () { $(".statementchange").on("blur",function(){
var sort = $(this).data("change"); var sort = $(this).data("change");
var val = $(this).val(); var val = $(this).val();
if (!CHECK.number.test(val)) { var vdata = eval("DATAOBJ."+sort);//原先值
var dom = $(this);
if(!CHECK.number.test(val)){
layer.msg('结算单中的罚款和税率必须是数字'); layer.msg('结算单中的罚款和税率必须是数字');
$(this).val(0); dom.val(vdata);
return false; return false;
} }
var str = "DATAOBJ." + sort + "='" + val + "';";
if (sort != 'fine') { var str = "DATAOBJ."+sort+"='"+val+"';";
if(sort != 'fine'){
if(val > 100 || val < 0){
layer.msg('结算单中的税率不允许大于100和小于0');
dom.val(vdata);
return false;
}
eval(str); eval(str);
var index = $(this).data("index"); var index = $(this).data("index");
var td = DATAOBJ.statement_info[index]; var td = DATAOBJ.statement_info[index];
if ($(this).attr("name") == "first_ratio") { if( $(this).attr("name") == "first_ratio"){
td['second_ratio'] = 100 - val; td['second_ratio'] = 100-val;
} }
if ($(this).attr("name") == "second_ratio") { if( $(this).attr("name") == "second_ratio"){
td['first_ratio'] = 100 - val; td['first_ratio'] = 100-val;
} }
if (DATAOBJ.statement_type == 0) { if(DATAOBJ.statement_type == 0){
var ratio = td['first_ratio'] / 100; var ratio = td['first_ratio']/100;
} else { }else{
var ratio = td['second_ratio'] / 100; var ratio = td['second_ratio']/100;
} }
DATAOBJ.statement_count['sum_money'] -= td['sum_money']; DATAOBJ.statement_count['sum_money'] = PUBLIC.floatCut(DATAOBJ.statement_count['sum_money'],td['sum_money']);
td['sum_money'] = Math.floor((td['pay_amount'] * (100 - td['promote_ratio']) / 100 * ratio * (100 - td['fax_ratio']) / 100) * 100) / 100; td['sum_money'] = Math.round((td['pay_amount']*(100-td['promote_ratio'])/100*ratio*(100-td['fax_ratio'])/100)* 100) / 100 ;
DATAOBJ.statement_count['sum_money'] += (td['sum_money'] - 0);
} else { DATAOBJ.statement_count['sum_money']=PUBLIC.floatAdd(DATAOBJ.statement_count['sum_money'],td['sum_money']);
DATAOBJ.fine = Math.floor(DATAOBJ.fine * 100) / 100;
if (val > DATAOBJ.statement_count['sum_money']) { }else{
DATAOBJ.fine = Math.round(DATAOBJ.fine * 100) / 100 ;
if(!CHECK.money.test(val)){
layer.msg('罚款金额格式错误');
$(this).val(DATAOBJ.fine);
return false;
}
if(val > DATAOBJ.statement_count['sum_money']){
layer.msg('罚款金额过大,总计不允许为负数'); layer.msg('罚款金额过大,总计不允许为负数');
$(this).val(DATAOBJ.fine); $(this).val(DATAOBJ.fine);
return false; return false;
} }
console.log(str);
DATAOBJ.statement_count['sum_money'] = (DATAOBJ.statement_count['sum_money'] - 0 + DATAOBJ.fine); DATAOBJ.statement_count['sum_money'] =PUBLIC.floatAdd(DATAOBJ.statement_count['sum_money'],DATAOBJ.fine);
DATAOBJ.statement_count['pay_amount'] = (DATAOBJ.statement_count['pay_amount'] - 0 + DATAOBJ.fine); DATAOBJ.statement_count['pay_amount'] = PUBLIC.floatAdd(DATAOBJ.statement_count['pay_amount'],DATAOBJ.fine);
eval(str); eval(str);
DATAOBJ.statement_count['sum_money'] = DATAOBJ.statement_count['sum_money'] - DATAOBJ.fine; DATAOBJ.statement_count['sum_money'] =PUBLIC.floatCut(DATAOBJ.statement_count['sum_money'],DATAOBJ.fine);
DATAOBJ.statement_count['pay_amount'] = DATAOBJ.statement_count['pay_amount'] - DATAOBJ.fine; DATAOBJ.statement_count['pay_amount'] = PUBLIC.floatCut(DATAOBJ.statement_count['pay_amount'],DATAOBJ.fine);
} }
DATAOBJ.statement_count['pay_amount'] = Math.floor(DATAOBJ.statement_count['pay_amount'] * 100) / 100;
DATAOBJ.statement_count['sum_money'] = Math.floor(DATAOBJ.statement_count['sum_money'] * 100) / 100;
TPLSHOW.showStatementList(true); TPLSHOW.showStatementList(true);
}) })
} }

@ -246,6 +246,26 @@
$("#settlement_type_value").val(data.data.settlement_type); $("#settlement_type_value").val(data.data.settlement_type);
$("#bank_account_name").val(data.data.bank_account); $("#bank_account_name").val(data.data.bank_account);
var add = '';
$("#company_name").empty();
$.ajax({
url: "{:U('Ajax/getPromoteCompanyList')}",
type: "get",
data: {withdraw_number: ext_field},
dataType: 'json',
success: function (response) {
add +='<option value="">请选择推广公司</option>';
data = response.data;
console.log(data)
for (var i in data){
add += "<option company_id='"+data[i].company_id+"' value='"+data[i].company_id+"' "+('selected')+">"+data[i].company_name+"</option>"
}
$("#company_name").empty();
$("#company_name").append(add);
$("#company_name").select2();
}
});
$("#jfCompany").val(data.data.yfpartner); $("#jfCompany").val(data.data.yfpartner);
$("#jfCompany").next().text(data.data.yfpartner); $("#jfCompany").next().text(data.data.yfpartner);
$("#jfPerson").val(data.data.yflink_man); $("#jfPerson").val(data.data.yflink_man);
@ -348,6 +368,26 @@
$("#settlement_type_value").val(data.data.settlement_type); $("#settlement_type_value").val(data.data.settlement_type);
$("#bank_account_name").val(data.data.bank_account); $("#bank_account_name").val(data.data.bank_account);
var add = '';
$("#ext_field").empty();
$.ajax({
url: "{:U('Ajax/getPromoteCompanyList')}",
type: "get",
data: {company_id: ext_field},
dataType: 'json',
success: function (response) {
add +='<option value="">体现单号</option>';
data = response.data;
console.log(data)
for (var i in data){
add += "<option value='"+data[i].widthdraw_number+"' "+('selected')+">"+data[i].widthdraw_number+"</option>"
}
$("#ext_field").empty();
$("#ext_field").append(add);
$("#ext_field").select2();
}
});
$("#jfCompany").val(data.data.yfpartner); $("#jfCompany").val(data.data.yfpartner);
$("#jfCompany").next().text(data.data.yfpartner); $("#jfCompany").next().text(data.data.yfpartner);
$("#jfPerson").val(data.data.yflink_man); $("#jfPerson").val(data.data.yflink_man);

Loading…
Cancel
Save