changed logic for today and yesterday in item overview #1340

Merged
jothi merged 1 commits from ranjith-dev into master 2026-10-29 05:48:50 +00:00
Showing only changes of commit 9f0ee1c29b - Show all commits

View File

@@ -151,13 +151,31 @@ class ItemOverview extends ChartWidget
// );
if (in_array($activeFilter, ['today', 'yesterday'])) {
$planQuantity = round(array_sum($orderedData) / 22.5, 2);
// Get total monthly plan quantity
$monthlyPlanQuantity = \DB::table('YOUR_ACTUAL_PLAN_TABLE')
->where('plant_id', $selectedPlant)
->where('line_id', $selectedLine)
->whereYear('created_at', $startDate->year)
->whereMonth('created_at', $startDate->month)
->sum('plan_quantity');
$weeksCount = (int) ceil($startDate->daysInMonth / 7);
$weeklyPlan = $weeksCount > 0
? $monthlyPlanQuantity / $weeksCount
: 0;
$dailyPlan = $weeklyPlan / 7;
$hourlyPlan = round($dailyPlan / 22.5, 2);
$planData = array_fill(
0,
count($orderedData),
$planQuantity
$hourlyPlan
);
}
elseif ($activeFilter === 'this_month') {