|
|
|
|
@ -408,8 +408,12 @@ class StatisticsController extends CommonController
|
|
|
|
|
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');
|
|
|
|
|
// 子项
|
|
|
|
|
$item->lies = $this->getLies($bedIds, $productItem, $factor, $month);
|
|
|
|
|
}
|
|
|
|
|
// 获取所有列
|
|
|
|
|
|