提交 53179b77 authored 作者: chengye's avatar chengye

merge release 改动

上级 cae0784c
......@@ -172,7 +172,10 @@ class Payment extends Base
//过滤不可以生成缴费单的账单ID
$idsArr = [];
$amount = 0;
$inv0 = null;
foreach ($invs as $inv){
if($inv0 === null) $inv0 = $inv;
//未生成缴费或已挂起
$amount += $inv->payment_balance;
//是否已挂起
......@@ -219,8 +222,8 @@ class Payment extends Base
$pData = [];
$pData['payment_id'] = $paymentId;
$pData['status'] = 1;
$pData['account_id'] = '\\'; //占位符,表示空的无效的
$pData['em_id'] = '\\'; //占位符,表示空的无效的
$pData['account_id'] = $inv0->account_id; //占位符,表示空的无效的
$pData['em_id'] = $inv0->em_id; //占位符,表示空的无效的
$pData['payment_type'] = 1;
$pData['balance'] = $pData['amount'] = round($amount,2);
$pData['uid'] = $this->uid;
......
......@@ -23,46 +23,19 @@ class EmPayment extends Base
//缴费单+search
public function getPaymentList($map,$Nowpage,$limits){
//先找到账单
$data = self::alias('pay')
->field('pay.*')
->field('epi.invoice_id')
->field('em.em_numb')
->field('r.region_name,station.station_name')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.payment_id = pay.payment_id')
->leftJoin(['em_invoice'=>'ei'],'ei.invoice_id=epi.invoice_id')
->leftJoin(['em_account'=>'ea'],'ea.account_id=ei.account_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map)
->order('pay.id desc')
->group('pay.payment_id')
->page($Nowpage, $limits)
->select()
->toarray();
$arr = [];
foreach ($data as $v){
$arr[] = $v['payment_id'];
}
$data2 = self::alias('pay')
$data = self::alias('pay')
->field('pay.*')
->field('em.em_numb,r.region_name,station.station_name')
->leftJoin(['em_account'=>'ea'],'ea.account_id=pay.account_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['em'],'em.id=pay.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map)
->whereNotIn('pay.payment_id',$arr)
->order('pay.id desc')
->group('pay.payment_id')
->page($Nowpage, $limits)
->select()
->toarray();
$data = array_merge($data,$data2);
$sortKey = [];
foreach ($data as $k=>$item){
......@@ -80,52 +53,36 @@ class EmPayment extends Base
//先找到账单
$data = self::alias('pay')
->field('pay.*')
->field('epi.invoice_id')
->field('em.em_numb')
->field('r.region_name,station.station_name')
->leftJoin(['em_payment_invoice'=>'epi'],'epi.payment_id = pay.payment_id')
->leftJoin(['em_invoice'=>'ei'],'ei.invoice_id=epi.invoice_id')
->leftJoin(['em_account'=>'ea'],'ea.account_id=ei.account_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map)
->count();
$data2 = self::alias('pay')
->field('pay.*')
->field('em.em_numb,r.region_name,station.station_name')
->leftJoin(['em_account'=>'ea'],'ea.account_id=pay.account_id')
->leftJoin(['em'],'em.id=ea.em_id')
->leftJoin(['em'],'em.id=pay.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['region'=>'r'],'station.area_id = r.id')
->where($map)
->count();
return intval($data + $data2);
return $data;
}
//通过缴费单id返回缴费单关联账单信息
public function getinvsInfo($payment_id){
//1.获取所关联账单的账单id,通过账单id查询账单信息
$invIdArr = EmPaymentInvoice::field('invoice_id')->where('payment_id','=',$payment_id)->select()->toArray();
//1.获取所关联账单的账单id,通过账单id查询账单信息
$invIdArr = EmPaymentInvoice::field('invoice_id')->where('payment_id','=',$payment_id)->select()->toArray();
//降维
//降维
$invArr = [];
foreach ($invIdArr as $inv){
$invArr[] = $inv['invoice_id'];
}
$invModel = new EmInvoice();
$invs = $invModel->alias('inv')
->field('inv.*')
->field('station.station_name,station.proj_number')
->field('em.em_numb')
->leftJoin(['em_invoice_useage'=>'eiu'],'eiu.invoice_id=inv.invoice_id')
->leftJoin(['em_useage'=>'eu'],'eu.useage_id = eiu.useage_id')
->leftJoin(['em'],'em.id=eu.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->where(['inv.invoice_id'=>$invArr])
->select();
->field('inv.*')
->field('station.station_name,station.proj_number')
->field('em.em_numb')
->leftJoin(['em_invoice_useage'=>'eiu'],'eiu.invoice_id=inv.invoice_id')
->leftJoin(['em_useage'=>'eu'],'eu.useage_id = eiu.useage_id')
->leftJoin(['em'],'em.id=eu.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->where(['inv.invoice_id'=>$invArr])
->select();
return $invs;
}
......
......@@ -209,7 +209,7 @@
</label>
<div class="layui-input-inline">
<button type="button" class="layui-btn" id="up_photo" {if $useage.status==2} disabled="disabled" {/if}>
<i class="layui-icon"></i>上传
<i class="layui-icon"></i>上传
</button>
<input type="hidden" name="photo_id" value="{$useage.photo_id}">
<a href="{$useage.photo.src}" target="_blank" class="layui-btn {if empty($useage.photo_id)} layui-hide {/if}">
......@@ -307,7 +307,7 @@
}
});
$('#current_numb').change(function(){
var $level = 100000;
var $level = 1;
var $rate = $('#rate').val();
var $baseNum = $level*$rate;
var $rNum = $(this).val()*$baseNum - $('#last_numb').val()*$baseNum;
......@@ -317,7 +317,8 @@
layMsg('本次抄表必须大于上次抄表读数',5);
$('#current_numb').focus();
} else{
var $num = $rNum/$level;
var $num = round2($rNum);
$('#repo_numb').val( $num )
if($amount != '' || $amount != 0){
......@@ -336,6 +337,10 @@
var $price = $('#amount').val() / $('#repo_numb').val();
$('#price').val($price.toFixed(4))
})
function round2(num){
return Math.round((num + Number.EPSILON) * 100) / 100;
}
});
</script>
{/block}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论