Merge pull request 'changed logic in item overview for verification' (#1348) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #1348
This commit was merged in pull request #1348.
This commit is contained in:
2026-10-29 06:19:17 +00:00

View File

@@ -159,7 +159,15 @@ class ItemOverview extends ChartWidget
->whereMonth('created_at', $startDate->month) ->whereMonth('created_at', $startDate->month)
->sum('plan_quantity'); ->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 // Same hourly plan value for every hour
$planData = array_fill(0, 24, $hourlyPlan); $planData = array_fill(0, 24, $hourlyPlan);