From 1b576da90ca8d0fff4384debdf3e43c2cdf62cad Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 29 Oct 2026 11:37:46 +0530 Subject: [PATCH] changed logic in today and yesterday filter in hourly production --- app/Filament/Widgets/ItemOverview.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Filament/Widgets/ItemOverview.php b/app/Filament/Widgets/ItemOverview.php index 5ae20e2e..7682d5b7 100644 --- a/app/Filament/Widgets/ItemOverview.php +++ b/app/Filament/Widgets/ItemOverview.php @@ -159,10 +159,11 @@ class ItemOverview extends ChartWidget ->whereMonth('created_at', $startDate->month) ->sum('plan_quantity'); - $weeksCount = (int) ceil($startDate->daysInMonth / 7); + $weeksCount = count($orderedData); + // Split the total monthly plan equally across all weeks $weeklyPlan = $weeksCount > 0 - ? $monthlyPlanQuantity / $weeksCount + ? round($monthlyPlanQuantity / $weeksCount, 2) : 0; $hourlyPlan = round($weeklyPlan / 22.5, 2);