Merge pull request 'changed logic in production dashboard for hourly' (#1334) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s

Reviewed-on: #1334
This commit was merged in pull request #1334.
This commit is contained in:
2026-10-29 04:14:03 +00:00

View File

@@ -161,12 +161,19 @@ class ItemOverview extends ChartWidget
}
elseif ($activeFilter === 'this_month') {
$monthlyPlan = round(array_sum($orderedData) / 22.5, 2);
$monthlyPlanQuantity = \DB::table('production_plans')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->whereYear('created_at', $startDate->year)
->whereMonth('created_at', $startDate->month)
->sum('plan_quantity');
// Number of weeks in the current month
$weeksCount = count($orderedData);
// Split the total monthly plan equally across all weeks
$weeklyPlan = $weeksCount > 0
? round($monthlyPlan / $weeksCount, 2)
? round($monthlyPlanQuantity / $weeksCount, 2)
: 0;
$planData = array_fill(