提交 ce16bfd8 authored 作者: chengye's avatar chengye

test

......@@ -44,13 +44,7 @@ class Payment
$payment->pay_date = time();
$payment->save();
try {
$res = (new WriteOff())->writeOffFromPayment($payment->account_id, $payment->payment_id);
} catch (\Exception $e){
$res = $e->getMessage();
Log::error('##res##:'.$res);
}
$res = (new WriteOff())->writeOffFromPayment($payment->account_id, $payment->payment_id);
return json([
......
......@@ -21,19 +21,15 @@ class WriteOff extends Controller
//获取关联的账单对象
$invs = (new EmInvoice())->alias('a')->field('a.invoice_id')
->leftJoin(['em_payment_invoice'=>'b'],'b.invoice_id = a.invoice_id')
->join(['em_payment_invoice'=>'b'],'b.invoice_id = a.invoice_id')
->where('b.payment_id','=',$payment_id)
->where('a.payment_balance','neq',0)
->order('a.invoice_id asc')
->select();
$invsArr = [];
//更新缴费单状态
if($invs->isEmpty()){
$payment->status = 4;
$payment->save();
return '审核成功';
} else {
//如果存在账单关联对象
if(!$invs->isEmpty()){
foreach ($invs as $inv){
$invsArr[] = $inv->invoice_id;
}
......@@ -47,6 +43,7 @@ class WriteOff extends Controller
$invs = (new EmInvoice())->field('invoice_id')
->where('account_id','=',$payment->account_id)
->where('payment_balance','neq',0)
->whereNotIn('invoice_id',$invsArr)
->order('invoice_id asc')
->select();
if(!$invs->isEmpty()) {
......@@ -56,6 +53,7 @@ class WriteOff extends Controller
}
}
$paymentIds[] = $payment->payment_id;
//处理账户金额
......@@ -82,10 +80,12 @@ class WriteOff extends Controller
foreach ($payments as $key => $payment){
if($payment->balance == 0) continue;
foreach ($invs as $index => $inv) {
$balanceMode = new EmPaymentInvoiceBalance();
$balanceMode->payment_id = $payment->payment_id;
if ($inv->payment_balance == 0) continue;
$balanceMode = new EmPaymentInvoiceBalance();
$balanceMode->payment_id = $payment->payment_id;
$balanceMode->invoice_id = $inv->invoice_id;
//如果该缴费单可以完全消除当前账单额度
......
......@@ -155,13 +155,28 @@
</div>
</div>
{if $em.rule.pricing_type == 2}
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
实缴电费
</label>
<div class="layui-input-inline">
<input type="text" id="amount" name="amount" autocomplete="off" class="layui-input" value="{$em.useage.amount|default=''}" {if isset($em.useage.amount) } disabled="disabled" {/if}>
</div>
<div class="layui-form-mid layui-word-aux">
</div>
</div>
</div>
{/if}
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
单价
</label>
<div class="layui-input-inline">
<input type="text" id="price" name="price" autocomplete="off" class="layui-input" {if $em.useage.price } disabled="disabled" {/if} value="{$em.useage.price|default=''}">
<input type="text" id="price" name="price" autocomplete="off" class="layui-input" {if $em.useage.price || $em.rule.pricing_type == 2 } disabled="disabled" {/if} value="{$em.useage.price|default=''}">
</div>
<div class="layui-form-mid layui-word-aux">
......@@ -310,6 +325,15 @@
$('#repo_numb').val( $rNum/$level )
}
})
$('#amount').change(function(){
if($('#repo_numb').val() == '') {
layMsg('本次抄表必须大于上次抄表读数',5);
return;
}
var $price = $('#amount').val() / $('#repo_numb').val();
$('#price').val($price.toFixed(4))
})
});
</script>
{/block}
\ No newline at end of file
......@@ -151,6 +151,8 @@
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论