12.28功能提交

master
zhengyongxing 4 years ago
parent c716535975
commit c8914800c7

@ -217,7 +217,6 @@ class PaymentController extends BaseController
$countmap['pay_status']=["neq",1];
$money = M("company_statement_info","tab_")->alias('s')->field("sum(statement_money) statement_money")->where($countmap)->find();
$count = M("company_statement_info","tab_")->alias('s')->field("count(id) count")->where($map)->find();
$page = set_pagination($count['count'], $row);
if ($page) {
@ -278,8 +277,23 @@ class PaymentController extends BaseController
'pay_status_str'=>'打款状态',
'pay_time'=>'打款时间',];
data2csv($data,'市场业绩提成',$title);
$sum = M("pay_statement_info","tab_")
->alias('s')
->field("sum(if(s.pay_status=0,s.statement_money,0)) unpay_amount,sum(if(s.pay_status>0,s.statement_money,0)) pay_amount,sum(if(s.pay_status<0,s.statement_money,0)) faild_pay_amount")
->join("left join tab_company_statement_info c on s.statement_info_id = c.id")
->where(['statement_info_id'=>['in',$id]])
->find();
$money = M("company_statement_info","tab_")->alias('s')->field("sum(statement_money) statement_money")->where(['s.id'=>['in',$id]])->find();
$sumData = [
'company_name'=>'合计',
'statement_time' => "待打款金额: {$money['statement_money']} 打款成功: {$sum['pay_amount']} 打款失败: {$sum['faild_pay_amount']}",
];
$data = array_merge($data,[$sumData]);
// dump($data);die();
data2csv($data,'线上打款',$title);
// $this->ajaxReturn(['stauts'=>1,'msg'=>'导出成功']);
}
@ -760,10 +774,12 @@ class PaymentController extends BaseController
public function editPayment(){
if(!isset($_REQUEST['info'])) $this->error("参数错误");
$info = $_REQUEST['info'];
$id = [];
$CompanyInfo = M("company_statement_info","tab_");
//循环保存
foreach($info as $k=>$v){
array_push($id,$k);
$ydata = $CompanyInfo->where("id= '{$k}'")->find();
$company_info = json_decode($ydata['company_info'],true);
if($ydata['verify_status'] == 2){
@ -788,6 +804,70 @@ class PaymentController extends BaseController
}
$companyStatementInfo = M("company_statement_info","tab_")
->where([
'id'=>['in',$id]
])
->select();
foreach ($companyStatementInfo as $key => $value) {
if ($value['statement_money'] <= 0) {
$payres["remark"] = '打款金额非正,直接打款成功';
$pay_info = json_encode($payres, JSON_UNESCAPED_UNICODE);
M("company_statement_info","tab_")
->where([
'id'=>['in',$value['id']]
])
->save(['pay_status'=>1,'pay_time'=>time(),'pay_type'=>2,'pay_info'=>$pay_info]);
M("pay_statement_info","tab_")
->where([
'statement_info_id'=>['in',$value['id']]
])
->save(['pay_status'=>1,'pay_time'=>time(),'pay_type'=>2,'pay_info'=>$pay_info]);
} else {
$payres["remark"] = '打款金额非正,直接打款成功';
$pay_info = json_encode($payres, JSON_UNESCAPED_UNICODE);
M("pay_statement_info","tab_")
->where([
'statement_info_id'=>['in',$value['id']],
'statement_money'=>['elt',0]
])
->save(['pay_status'=>1,'pay_time'=>time(),'pay_type'=>2,'pay_info'=>$pay_info]);
$pay_statement_info = M("pay_statement_info","tab_")
->where([
'statement_info_id'=>['in',$value['id']]
])
->order("statement_money ASC")
->select();
$subtraction = 0;
foreach ($pay_statement_info as $sk => $sv) {
if ($sv['statement_money'] < 0) {
$subtraction += -($sv['statement_money']);
$sv['final_statement_money'] = 0;
} elseif($sv['statement_money'] > 0 && $subtraction > 0) {
if($sv['statement_money'] >= $subtraction) {
$sv['final_statement_money'] = $sv['statement_money']-$subtraction;
$subtraction = 0;
} else {
$sv['final_statement_money'] = 0;
$subtraction =-$sv['final_statement_money'];
}
}
M("pay_statement_info","tab_")
->where([
'id'=>$sv['id']
])->save($sv);
}
}
}
$this->ajaxReturn(array(
'status' => 1,
"info"=>"打款信息编辑成功"

@ -316,7 +316,7 @@
</if>
</volist>
</volist>
<tr><td style="line-height: 42px;">合计</td><td colspan="13" style="line-height: 42px;">待打款金额:&nbsp;{$money.statement_money}&nbsp;待打款金额:&nbsp;{$sum['unpay_amount']}&nbsp;打款成功:&nbsp;{$sum['pay_amount']}&nbsp;打款失败:&nbsp;{$sum['faild_pay_amount']}</td></tr>
<tr><td style="line-height: 42px;">合计</td><td colspan="13" style="line-height: 42px;">待打款金额:&nbsp;{$money.statement_money|default='0.00'}&nbsp;&nbsp;打款成功:&nbsp;{$sum['pay_amount']|default='0.00'}&nbsp;打款失败:&nbsp;{$sum['faild_pay_amount']|default='0.00'}</td></tr>
</notemtpy>
</tbody>
</table>
@ -754,15 +754,21 @@
$(".setPayment").on("click",function(){
// var id = $(this).data("id");
var tip = 0;
var paystatustip = 0;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("pay_check") == 0 || $(elem).data("verify_status") == -1){
if(($(elem).data("pay_check") == 0 || $(elem).data("verify_status") == -1) && $(elem).data("paystatus") != 1){
return $(elem).data("verify_id");
} else {
}
if ($(elem).data("pay_check") != 1) {
tip = 1;
}
if ($(elem).data("paystatus") == 1) {
paystatustip = 1;
}
}).get();
if(tip == 1) {
@ -770,6 +776,11 @@
return;
}
if(paystatustip == 1) {
layer.msg("<font style='color: white'>请选择未打款的单子</font>");
return;
}
text = text.join(",");
if (!text) {
@ -790,16 +801,23 @@
$("#returnSetPayment").on("click",function () {
var paystatustip = 0;
var tip = 0;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("pay_check") == 1){
if($(elem).data("pay_check") == 1 && $(elem).data("paystatus") != 1){
return $(elem).data("verify_id");
} else {
}
if ($(elem).data("pay_check") != 1) {
tip = 1;
}
if ($(elem).data("paystatus") == 1) {
paystatustip = 1;
}
}).get();
if(tip == 1) {
@ -807,6 +825,11 @@
return;
}
if(paystatustip == 1) {
layer.msg("<font style='color: white'>请选择未打款的单子</font>");
return;
}
text = text.join(",");
layer.confirm('【提示】是否确认打款信息撤回', {

@ -147,7 +147,6 @@
<td></td>
<td>{$vo.company_info.ali_user}</td>
<td>{$vo.company_info.ali_account}</td>
<td></td>
<else />
<td></td>
<td>{$vo.company_info.payee_name}</td>

Loading…
Cancel
Save