Browse Source

汇总信息

sunhao 5 years ago
parent
commit
c8d3c63ce9

+ 9 - 0
app/Http/Controllers/Admin/StatisticsController.php

@@ -3899,6 +3899,14 @@ class StatisticsController extends Controller
3899 3899
             $item->warehouse = $wareArr[$item->warehouse];
3900 3900
         }
3901 3901
 
3902
+        //汇总
3903
+        $total = Order::select(DB::raw('sum(cost) as goods_cost, sum(freight_cost) as freight_cost, count(1) as order_count'))->where(function($query) use($stime, $etime, $warehouse){
3904
+            if($stime) $query->where('send_time', '>=', $stime);
3905
+            if($etime) $query->where('send_time', '<=', $etime);
3906
+            if($warehouse>0) $query->where('warehouse', '=', $warehouse);
3907
+        })->whereNotNull('send_time')->where('warehouse','>',0)->where('logistics_id','>','')->where('is_del', 0)->first();
3908
+
3909
+
3902 3910
         return view('statistics/warehouseFinanceList', ['result'=>$result,
3903 3911
             'page'              =>$page,
3904 3912
             'count'             =>$count,
@@ -3906,6 +3914,7 @@ class StatisticsController extends Controller
3906 3914
             'warehouse'         =>$warehouse,
3907 3915
             'stime'             =>$stime,  
3908 3916
             'etime'             =>$etime,  
3917
+            'total'             =>$total,
3909 3918
         ]);
3910 3919
 
3911 3920
     }   

+ 13 - 1
resources/views/statistics/warehouseFinanceList.blade.php

@@ -23,7 +23,19 @@
23 23
                 
24 24
             </div>
25 25
         </div>
26
-        
26
+        <br>
27
+        <table class="table  table-border table-bordered table-bg table-hover table-sort">
28
+                <tr>
29
+                    <th width="5%">汇总信息</th>
30
+                    <th>
31
+                <ul>
32
+                    <li>总单数:{{$total['order_count']}}&nbsp;&nbsp;&nbsp;&nbsp;
33
+                    总货品成本:&yen;{{$total['goods_cost']}}&nbsp;&nbsp;&nbsp;&nbsp;
34
+                    总物流成本:&yen;{{$total['freight_cost']}}&nbsp;&nbsp;&nbsp;&nbsp;
35
+                </ul>
36
+                    </th>
37
+                </tr>
38
+        </table>
27 39
         <div class="mt-20">
28 40
             <table class="table table-border table-bordered table-bg table-hover table-sort">
29 41
                 <thead>