|
@@ -1374,11 +1374,22 @@ class Payment extends BaseController
|
|
|
}
|
|
|
$page = isset($post['page'])&&$post['page']!="" ? intval($post['page']):1;
|
|
|
$size = isset($post['size'])&&$post['size']!="" ? intval($post['size']):10;
|
|
|
- $count =Db::name("pay_invoice")->alias("a")->leftJoin("pay b","a.payNo=b.payNo")->where($condition)->count();
|
|
|
- $total = ceil($count/$size);
|
|
|
- $page = $page>$total? intval($total):$page;
|
|
|
- $list = Db::name("pay_invoice")->alias("a")->leftJoin("pay b","a.payNo=b.payNo")->field("a.*")->where
|
|
|
- ($condition)->page($page,$size)->order("addtime desc")->select()->toArray();
|
|
|
+ $count = Db::name("pay_invoice")
|
|
|
+ ->alias("a")
|
|
|
+ ->leftJoin("pay b", "a.payNo=b.payNo")
|
|
|
+ ->where($condition)
|
|
|
+ ->count('a.id');
|
|
|
+ $total = ceil($count / $size);
|
|
|
+ $page = $page > $total ? intval($total) : $page;
|
|
|
+ $list = Db::name("pay_invoice")
|
|
|
+ ->alias("a")
|
|
|
+ ->leftJoin("pay b", "a.payNo=b.payNo")
|
|
|
+ ->field("a.*")
|
|
|
+ ->where($condition)
|
|
|
+ ->page($page, $size)
|
|
|
+ ->order("addtime desc")
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
foreach ($list as &$value){
|
|
|
$invoinfo =Db::name("invoice_info")->where(["hpNo"=>$value['hpNo'],"status"=>1])->find();
|
|
|
$value['buyer_name'] = $invoinfo['buyer_name']??"";
|
|
@@ -1400,7 +1411,19 @@ class Payment extends BaseController
|
|
|
$value['invStatus_cn'] = $this->invStatus[$value['invStatus']]??'';
|
|
|
$value['item_list'] = isset($invoinfo['item_list']) &&$invoinfo['item_list']!='' ?json_decode($invoinfo['item_list'],true):"";
|
|
|
}
|
|
|
- return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
|
|
|
+ //结算invlist这个接口当用payNo筛选的时候,返回列表里需要加一项统计筛选后列表的inv_subtotal_amount、total字段的和
|
|
|
+ $inv_subtotal_amount = $total = 0;
|
|
|
+ if ($payNo != '') {
|
|
|
+ $inv_subtotal_amount = round(array_sum(array_column($list, 'inv_subtotal_amount')), 2);
|
|
|
+ $total = round(array_sum(array_column($list, 'total')), 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ return app_show(0, "获取成功", [
|
|
|
+ "count" => $count,
|
|
|
+ "list" => $list,
|
|
|
+ 'inv_subtotal_amount' => $inv_subtotal_amount,
|
|
|
+ 'total' => $total
|
|
|
+ ]);
|
|
|
}
|
|
|
|
|
|
/**发票删除
|