changed logic in production dashboard for hourly
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 20s
Laravel Larastan / larastan (pull_request) Failing after 5m41s
Laravel Pint / pint (pull_request) Successful in 5m45s

This commit is contained in:
dhanabalan
2026-10-29 09:43:44 +05:30
parent a1457a1e76
commit 924337fa6c

View File

@@ -161,12 +161,19 @@ class ItemOverview extends ChartWidget
} }
elseif ($activeFilter === 'this_month') { 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); $weeksCount = count($orderedData);
// Split the total monthly plan equally across all weeks
$weeklyPlan = $weeksCount > 0 $weeklyPlan = $weeksCount > 0
? round($monthlyPlan / $weeksCount, 2) ? round($monthlyPlanQuantity / $weeksCount, 2)
: 0; : 0;
$planData = array_fill( $planData = array_fill(