From 294a96fa7459acd3e44d25571e69ccac7990ac45 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 29 Oct 2026 11:49:04 +0530 Subject: [PATCH] changed logic in item overview for verification --- app/Filament/Widgets/ItemOverview.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Filament/Widgets/ItemOverview.php b/app/Filament/Widgets/ItemOverview.php index a091c13d..1de2fb7c 100644 --- a/app/Filament/Widgets/ItemOverview.php +++ b/app/Filament/Widgets/ItemOverview.php @@ -159,7 +159,15 @@ class ItemOverview extends ChartWidget ->whereMonth('created_at', $startDate->month) ->sum('plan_quantity'); - $hourlyPlan = round($monthlyPlanQuantity / 22.5, 2); + // Calculate daily target directly + $weeksCount = (int) ceil($startDate->daysInMonth / 7); + + $dailyPlan = $weeksCount > 0 + ? round($monthlyPlanQuantity / ($weeksCount * 7), 2) + : 0; + + // Calculate hourly target + $hourlyPlan = round($dailyPlan / 22.5, 2); // Same hourly plan value for every hour $planData = array_fill(0, 24, $hourlyPlan);