From 14af2e875fa99f4e66f816967be9a0e31eeb9e95 Mon Sep 17 00:00:00 2001 From: liyinglin Date: Wed, 24 Apr 2024 10:01:21 +0800 Subject: [PATCH] 1 --- app/Http/Controllers/Admin/StatisticsController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index 8527847..ed31ece 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -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); } // 获取所有列