From 93fd26d79e72fd0d27bcab7dd55753967e048d61 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Thu, 27 Jun 2024 15:54:54 +0800 Subject: [PATCH] update --- .../Controllers/Admin/StatisticsController.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index 2452388..c68a056 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -546,14 +546,14 @@ class StatisticsController extends CommonController // 当月天数 $days = date('t', strtotime($month)); $area = Area::withCount('beds')->where('project_id', $project_id)->get(); - $beds = Bed::whereIn('area_id', $area->pluck('id'))->where('project_id', $project_id)->get(); - $totalBed = $beds->count(); - // 订单总数 - $orderTotal = Orders::where('project_id', $project_id) - ->where('created_at', 'like', '%' . $month . '%') - ->whereIn('bed_id', $beds->pluck('id')) - ->sum('total'); + foreach ($area as $item) { + $beds = Bed::where('area_id', $area->id)->where('project_id', $project_id)->get(); + // 订单总数 + $orderTotal = Orders::where('project_id', $project_id) + ->where('created_at', 'like', '%' . $month . '%') + ->whereIn('bed_id', $beds->pluck('id')) + ->sum('total'); $item->order_total = $orderTotal; $item->shouxufei = $orderTotal * 0.006; $item->zengshishui = $orderTotal * 0.06;