Browse Source

后端报表-退货流水报表优化

wufeng 2 years ago
parent
commit
3ea17c0445
1 changed files with 7 additions and 3 deletions
  1. 7 3
      app/admin/controller/Report.php

+ 7 - 3
app/admin/controller/Report.php

@@ -1210,20 +1210,24 @@ class Report extends Base
         $count = Db::name('sale_return')
             ->alias('s')
             ->where($where)
+            ->leftJoin('sale ss', 'ss.orderCode=s.orderCode AND ss.is_del=0')
             ->leftJoin('order_num on', 'on.orderCode=s.orderCode')
             ->leftJoin('purchease_order po', 'po.cgdNo=on.cgdNo')
-            ->leftJoin('good_basic gb', 'gb.spuCode=po.spuCode AND gb.is_del=0')
+            ->leftJoin('good_basic gb', 'gb.spuCode=s.good_code AND gb.is_del=0')
             ->leftJoin('result_info ri', 'ri.result_code=s.error_code AND ri.is_del=0')
+            ->leftJoin('supplier sp','sp.code=gb.supplierNo')
             ->count('s.id');
 
         $list = Db::name('sale_return')
             ->alias('s')
-            ->field('s.returnCode,s.addtime,po.cgdNo,po.supplier_name,po.good_name,gb.is_stock,po.good_num,po.cgder_id,po.cgder,"" name,s.num,on.send_num,ri.result,s.is_th')
+            ->field('s.id,s.returnCode,s.addtime,po.cgdNo,sp.name supplier_name,s.good_name,gb.is_stock,ss.good_num,po.cgder_id,po.cgder,"" name,s.num,on.send_num,ri.result,s.is_th')
             ->where($where)
+            ->leftJoin('sale ss', 'ss.orderCode=s.orderCode AND ss.is_del=0')
             ->leftJoin('order_num on', 'on.orderCode=s.orderCode')
             ->leftJoin('purchease_order po', 'po.cgdNo=on.cgdNo')
-            ->leftJoin('good_basic gb', 'gb.spuCode=po.spuCode AND gb.is_del=0')
+            ->leftJoin('good_basic gb', 'gb.spuCode=s.good_code AND gb.is_del=0')
             ->leftJoin('result_info ri', 'ri.result_code=s.error_code AND ri.is_del=0')
+            ->leftJoin('supplier sp','sp.code=gb.supplierNo')
             ->page($param['page'], $param['size'])
             ->order('s.addtime desc')
             ->cursor();