master
chenzhi 4 years ago
parent 9292aa7862
commit 9ff3153f57

@ -75,7 +75,6 @@ class ExcelPaymentController extends BaseController
$map['i.batch_num'] = $_REQUEST['batch_num'];
}
$CompanyInfo = M("excel_statement_info","tab_")
->alias('i')
->field("i.*")
@ -105,10 +104,7 @@ class ExcelPaymentController extends BaseController
$countmap['pay_status']=["neq",1];
$money = M("excel_statement_info","tab_")->alias('i')->field("sum(statement_money) statement_money")->where($countmap)->find();
$count = M("excel_statement_info","tab_")->alias('i')->field("count(id) count")->where($map)->find();
// dd($count);
$parameter['p'] = $page;
$parameter['row'] = $row;
$page = set_pagination($count['count'], $row, $parameter);
$page = set_pagination($count['count'], $row);
if ($page) {
$this->assign('_page', $page);
}
@ -137,6 +133,7 @@ class ExcelPaymentController extends BaseController
}
$ExcelStatementInfo = M('ExcelStatementInfo',"tab_");
foreach ($checkarr as $k => &$v) {
$company_info = $v['company_info'];
$v['statement_begin_time'] = $statement_begin_time;
$v['statement_end_time'] = $statement_end_time;
$v['batch_num'] = $batch;
@ -145,14 +142,14 @@ class ExcelPaymentController extends BaseController
$v['company_type'] = 2;
$v['create_time'] = time();
$v['statement_num'] = "JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5);
if(!isset($v['company_info']['ali_user']) || !isset($v['company_info']['ali_account']) || $v['company_info']['ali_user'] == '' || $v['company_info']['ali_account'] == ''){
M('ExcelStatementInfo')->where("statement_num = '{$v['statement_num']}'")->delete();
if(!isset($company_info['ali_user']) || !isset($company_info['ali_account']) || $company_info['ali_user'] == '' || $company_info['ali_account'] == ''){
M('ExcelStatementInfo',"tab_")->where("statement_num = '{$v['statement_num']}'")->delete();
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
}
$res = $ExcelStatementInfo->add($v);
if($res === false){
M('ExcelStatementInfo')->where("statement_num = '{$v['statement_num']}'")->delete();
M('ExcelStatementInfo',"tab_")->where("statement_num = '{$v['statement_num']}'")->delete();
$this->ajaxReturn(["status"=>0,"msg"=>"添加失败"]);
}
}
@ -170,12 +167,34 @@ class ExcelPaymentController extends BaseController
$is_export = true;
}
//获取基本信息
$dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->select();
$title = $dbres[0]['company_name'];
$this->assign("title",$title);
if($is_export && isset($_REQUEST['exporttype']) && $_REQUEST['exporttype']=='all'){
$dbres = M("ExcelStatementInfo","tab_")->where("id in ({$id})")->select();
$title = date("YmdHis");
}else{
$dbres = M("ExcelStatementInfo","tab_")->where("id ='{$id}'")->select();
$title = $dbres[0]['company_name'].date("YmdHis");
}
$this->assign("title",$title);
$this->viewPuPool($dbres,$is_export);
}
public function delItem()
{
if(!isset($_REQUEST['ids'])){
$this->error('参数错误');
}
$ids = $_REQUEST['ids'];
$map = [
"pay_status"=>["NEQ",1],
"id"=>["IN",$ids]
];
$dbres = M("ExcelStatementInfo","tab_")->where($map)->delete();
if($dbres === false){
$this->ajaxReturn(["status"=>0,"info"=>"删除失败"]);
}
$this->ajaxReturn(["status"=>1,"info"=>"删除成功"]);
}
//个人汇总结算查看
public function viewPuPool(&$infolist,$is_export){
@ -203,8 +222,10 @@ class ExcelPaymentController extends BaseController
$val['ratio'] = 0;
}
if($is_export){
$val['ratio'] = $val['ratio']*100;
$val['increment_ratio'] = $val['increment_ratio']*100;
//J3*(K3+L3)+M3-N3
$va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
$val['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
$count['sum_money_exp'] .= "O{$line}+";
$count['platform_amount_exp'] .= "J{$line}+";
@ -220,7 +241,6 @@ class ExcelPaymentController extends BaseController
$count["platform_amount"] = "=".trim($count["platform_amount_exp"],"+");
$count["sum_money"] = "=".trim($count["sum_money_exp"],"+");
}
// dd($infolist);
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
@ -288,10 +308,11 @@ class ExcelPaymentController extends BaseController
$dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->find();
$company_info = json_decode($dbres['company_info'],true);
if($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1){
if($dbres['pay_status'] != 1){
//执行打款
$title = "信息服务费";
$title = $remark;
$amount = $dbres['statement_money'];
$amount = 0.1;
$payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title);
$resultCode = $payres->code;

@ -398,7 +398,7 @@
e[k] = Math.round(e[k]*100)/100;
}
gamet[titleKey[k]] = e[k];
}else if(k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
}else if(k=="下游类型" ||k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
temp.company_info[titleKey[k]] = e[k];
}else{
temp[titleKey[k]] = e[k];
@ -436,7 +436,7 @@
e[k] = Math.round(e[k]*100)/100;
}
gamet[titleKey[k]] = e[k];
}else if(k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
}else if(k=="下游类型" || k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
temp.company_info[titleKey[k]] = e[k];
}else{
temp[titleKey[k]] = e[k];
@ -469,7 +469,7 @@
e[k] = Math.round(e[k]*100)/100;
}
gamet[titleKey[k]] = e[k];
}else if(k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
}else if( k=="下游类型" || k=="市场员" || k=="下游性质" || k == "账户名" || k == "银行卡号" || k == "开户支行" || k == "账户类型" || k == "支付宝真实姓名" || k == "支付宝账号"){
temp.company_info[titleKey[k]] = e[k];
}else{
temp[titleKey[k]] = e[k];

@ -157,6 +157,8 @@
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<a class='butn' id='doPayment'>批量打款</a>
<a class='butn' id='leadExcel'>Excel导入</a>
<a class='butn' id='export'>导出</a>
<a class='butn' id='delItem' style="background-color: red;">批量删除</a>
</div>
</div>
@ -191,7 +193,7 @@
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td ><input class="ids" type="checkbox" value="{$data['id']}" data-pay="{$data['can_pay']}" name="ids[]"></td>
<td ><input class="ids" type="checkbox" value="{$data['id']}" data-pay="{$data['can_pay']}" data-paystatus="{$data.pay_status}" name="ids[]"></td>
<td>{$data.company_name}</td>
<td>{$data.company_type}</td>
<td>{$data.valid}</td>
@ -210,6 +212,7 @@
<td>{$data.remark}</td>
<td>
<a class='confirm viewPool' data-id='{$data.id}'>查看</a>
<a class='confirm exportPool' data-id='{$data.id}'>导出</a>
<if condition="$data['pay_status'] neq 0">
<a class='confirm paymentInfo' data-id='{$data.id}'>打款详情</a>
</if>
@ -291,6 +294,74 @@
content: url
});
});
$("#export").click(function () {
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要导出的打款单' + "</font>");
return;
}
_export();
function _export(){
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ "</font>");
var id = text.join(",");
var url ="{:U('viewPool')}"+"&id="+id+"&export=1&exporttype=all";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel);
}
})
$("#delItem").on("click",function(){
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("paystatus") == 1){
flag = true;
}else{
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>无可删除数据,支付成功的数据无法删除</font>");
return;
}
text = text.join(",");
layer.confirm('【警告】删除操作将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
$.ajax({
type: "POST",
url: "{:U('delItem')}",
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;
}
}
});
});
})
$(".exportPool").click(function(){
layer.alert("<font style='color:#333'>"+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ "</font>");
var id = $(this).data("id");
var url ="{:U('viewPool')}"+"&id="+id+"&export=1&exporttype=one";
var iframeExcel = "<iframe src='"+url+"' width='0px' height='0px' style='z-index:-1;position: absolute;top: -999999px;'></iframe>"//添加下载的地址到iframe这里是公司信息我用**表示了。
$("body").append(iframeExcel);
})
$(".paymentInfo").on("click",function(){
var id = $(this).data("id");
var url = "{:U('paymentInfo')}"+"&id="+id
@ -299,7 +370,7 @@
title: "打款详情",
shadeClose: true,
shade: 0.8,
area: ['20%', '60%'],
area: ['40%', '60%'],
content: url
});
@ -311,7 +382,7 @@
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>请先选择需要打款的结算单</font>");
layer.msg("<font style='color:white'>请先选择需要打款的结算单仅大于0.1元的打款单才能进行打款</font>");
return;
}
text = text.join(",");

@ -121,13 +121,13 @@
<td>{$vo.batch_num}</td>
<td>{$vo.statement_money}</td>
<td>{$vo.remark}</td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" data-pool="{$vo.pool_id}" name="remark" value="" placeholder="打款备注"></td>
<td><input type="text" class="txt paymentset" data-id="{$vo.id}" data-pool="{$vo.pool_id}" name="remark" value="信息服务费" placeholder="打款备注"></td>
</tr>
</foreach>
<tr>
<td colspan="2">合计:</td>
<td colspan="6">打款总金额:&nbsp;{$count['statement_money']} &nbsp;&nbsp;&nbsp;&nbsp;账户金额:&nbsp;{$money}</td>
<td colspan="6">打款总金额:&nbsp;{$count['statement_money']} <span <if condition="$count['statement_money'] gt $money ">style="color: red;"</if>>&nbsp;&nbsp;&nbsp;&nbsp;账户金额:&nbsp;{$money}</span></td>
</tr>
</tbody>
</table>

Loading…
Cancel
Save