1
0
forked from poc/pds

changed logic in item overview

This commit is contained in:
dhanabalan
2026-10-29 11:44:35 +05:30
parent 1b576da90c
commit 1799cd8d9d

View File

@@ -159,14 +159,7 @@ class ItemOverview extends ChartWidget
->whereMonth('created_at', $startDate->month) ->whereMonth('created_at', $startDate->month)
->sum('plan_quantity'); ->sum('plan_quantity');
$weeksCount = count($orderedData); $hourlyPlan = round($monthlyPlanQuantity / 22.5, 2);
// Split the total monthly plan equally across all weeks
$weeklyPlan = $weeksCount > 0
? round($monthlyPlanQuantity / $weeksCount, 2)
: 0;
$hourlyPlan = round($weeklyPlan / 22.5, 2);
// Same hourly plan value for every hour // Same hourly plan value for every hour
$planData = array_fill(0, 24, $hourlyPlan); $planData = array_fill(0, 24, $hourlyPlan);