liyinglin 2 years ago
parent 14af2e875f
commit fa434c0883

@ -404,7 +404,7 @@ class StatisticsController extends CommonController
$product = Product::where('project_id', $project_id)->first();
$productItem = ProductItems::where('product_id', $product->id)->get();
$factor = FactorItems::where('factor_id', $product->statistic_factor_id)->get();
$sumOrderTotal = 0;
foreach ($data as $item) {
// 获取所有床位id
$bedIds = Bed::where('area_id', $item->id)->pluck('id');
@ -413,6 +413,7 @@ class StatisticsController extends CommonController
->whereIn("bed_id", $bedIds)
->where('paid_at', 'like', '%' . $month . '%')
->sum('total');
$sumOrderTotal += $item->order_total;
// 子项
$item->lies = $this->getLies($bedIds, $productItem, $factor, $month);
}
@ -420,7 +421,7 @@ class StatisticsController extends CommonController
$lie = array_column($data[0]->lies, 'name');
$months = $this->_getMonths();
return view($this->bladePath . ".huli", compact("data", "month", "lie", "projects", "project_id"));
return view($this->bladePath . ".huli", compact("sumOrderTotal","data", "month", "lie", "projects", "project_id"));
}
/**

@ -21,6 +21,7 @@
</select>
</form>
</div>
<div>合计:{{$sumOrderTotal}}</div>
<table class="table table-bordered" id="data-table">
<thead>
<tr>

Loading…
Cancel
Save