changed logic in production dashboard for hourly #1334

Merged
jothi merged 1 commits from ranjith-dev into master 2026-10-29 04:14:03 +00:00
Showing only changes of commit 924337fa6c - Show all commits

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(