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

修复账单列表无法显示与账单详情显示错误

上级 0e2dea9d
差异被折叠。
...@@ -32,12 +32,10 @@ class EmInvoice extends Base ...@@ -32,12 +32,10 @@ class EmInvoice extends Base
public function getInvoiceList($map,$Nowpage,$limits){ public function getInvoiceList($map,$Nowpage,$limits){
$data = self::alias('inv') $data = self::alias('inv')
->field('inv.*') ->field('inv.*')
->field('station.station_name') ->field('station.station_name,em.em_numb')
->field('em.em_numb') ->join(['em_account'=>'ea'],'ea.account_id = inv.account_id')
->leftJoin(['em_invoice_useage'=>'eiu'],'eiu.invoice_id=inv.invoice_id') ->join(['em'],'em.id=ea.em_id')
->leftJoin(['em_useage'=>'eu'],'eu.useage_id = eiu.useage_id') ->join(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['em'],'em.id=eu.em_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->where($map) ->where($map)
->page($Nowpage, $limits) ->page($Nowpage, $limits)
->select() ->select()
...@@ -57,12 +55,9 @@ class EmInvoice extends Base ...@@ -57,12 +55,9 @@ class EmInvoice extends Base
public function getInvoiceCount($map){ public function getInvoiceCount($map){
$data = self::alias('inv') $data = self::alias('inv')
->field('inv.*') ->field('inv.*')
->field('station.station_name') ->join(['em_account'=>'ea'],'ea.account_id = inv.account_id')
->field('em.em_numb') ->join(['em'],'em.id=ea.em_id')
->leftJoin(['em_invoice_useage'=>'eiu'],'eiu.invoice_id=inv.invoice_id') ->join(['station_info'=>'station'],'station.station_id=em.station_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($map) ->where($map)
->count(); ->count();
return $data; return $data;
...@@ -73,10 +68,9 @@ class EmInvoice extends Base ...@@ -73,10 +68,9 @@ class EmInvoice extends Base
->field('inv.*') ->field('inv.*')
->field('station.station_name') ->field('station.station_name')
->field('em.em_numb') ->field('em.em_numb')
->leftJoin(['em_invoice_useage'=>'eiu'],'eiu.invoice_id=inv.invoice_id') ->join(['em_account'=>'ea'],'ea.account_id = inv.account_id')
->leftJoin(['em_useage'=>'eu'],'eu.useage_id = eiu.useage_id') ->join(['em'],'em.id=ea.em_id')
->leftJoin(['em'],'em.id=eu.em_id') ->join(['station_info'=>'station'],'station.station_id=em.station_id')
->leftJoin(['station_info'=>'station'],'station.station_id=em.station_id')
->where(['inv.invoice_id'=>$ids]) ->where(['inv.invoice_id'=>$ids])
// ->where('inv.payment_balance','neq',0) // ->where('inv.payment_balance','neq',0)
->select(); ->select();
...@@ -94,7 +88,14 @@ class EmInvoice extends Base ...@@ -94,7 +88,14 @@ class EmInvoice extends Base
$eiu = EmInvoiceUseage::where(['invoice_id'=>$inv->invoice_id])->find(); $eiu = EmInvoiceUseage::where(['invoice_id'=>$inv->invoice_id])->find();
//查询抄表信息 //查询抄表信息
$useage = Useage::with('photo')->get(['useage_id'=>$eiu->useage_id]); $useage = Useage::get(['useage_id'=>$eiu->useage_id]);
if($useage->photo_id) {
$receipt = Receipt::get(['id'=>$useage->photo_id]);
if($receipt) $useage['photo'] = $receipt;
} else {
$useage['photo'] = [];
}
//获取电表信息 //获取电表信息
$em = Em::with('rule')->field('id,station_id,em_numb,em_type_id,rate')->where(['id'=>$useage->em_id])->find(); $em = Em::with('rule')->field('id,station_id,em_numb,em_type_id,rate')->where(['id'=>$useage->em_id])->find();
...@@ -143,7 +144,7 @@ class EmInvoice extends Base ...@@ -143,7 +144,7 @@ class EmInvoice extends Base
$totle['current_numb'] = 0; $totle['current_numb'] = 0;
$totle['repo_numb'] = 0; $totle['repo_numb'] = 0;
$totle['amount'] = $totle['settle_amount'] = 0; $totle['amount'] = $totle['settle_amount'] = 0;
$totle['settle_price'] = $inv->em->emr->settle_price * $inv->em->rate; $totle['settle_price'] = ($inv->em->emr->settle_price?:0) * $inv->em->rate;
$totle['settle_status'] = parseStatus($inv->status,2); $totle['settle_status'] = parseStatus($inv->status,2);
//峰谷表与普通抄表 //峰谷表与普通抄表
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论