upMerge branch 'master' of ssh://118.31.104.155:4422/mnt/git/v2.tiantianxinye.365care

master
weizong song 2 years ago
commit 149b108f41

@ -404,19 +404,24 @@ 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');
$order = Orders::whereIn('bed_id', $bedIds)->where('status', 100)->get();
$item->order_total = $order->sum('total');
// 总和
$item->order_total = OrderItems::whereIn('product_item_id', $productItem->pluck('id'))
->whereIn("bed_id", $bedIds)
->where('paid_at', 'like', '%' . $month . '%')
->sum('total');
$sumOrderTotal += $item->order_total;
// 子项
$item->lies = $this->getLies($bedIds, $productItem, $factor, $month);
}
// 获取所有列
$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