Bläddra i källkod

Merge branch 'master-dev' of wugg/cxinv into master

wugg 2 år sedan
förälder
incheckning
293334a575
2 ändrade filer med 30 tillägg och 7 borttagningar
  1. 29 6
      app/admin/controller/Payment.php
  2. 1 1
      app/command/Report.php

+ 29 - 6
app/admin/controller/Payment.php

@@ -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
+        ]);
     }
 
         /**发票删除

+ 1 - 1
app/command/Report.php

@@ -546,7 +546,7 @@ class Report extends Command
             f.th_fee 退货金额            
             ')
 		          ->leftJoin('invoice_pool_info b', 'b.invNo=a.invNo')
-		          ->leftJoin('invoice_ticket c', 'c.invNo=a.invNo and c.type=0 and c.status=1')
+		          ->leftJoin('invoice_ticket c', 'c.invNo=a.invNo and c.type=0 and c.status in (0,1,2,3)')
 		          ->leftJoin("invoice_good m","m.invNo=a.invNo and m.invtype=0 and m.is_del=0")
 //		          ->leftJoin('assoc d', 'd.viceCode=a.invNo and d.type=1')
 		          ->leftJoin('qrd_info e', 'e.sequenceNo=m.orderCode')