changed logic in production dashboard for hourly #1334
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user