changed logic for today and yesterday in item overview
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 19s
Laravel Larastan / larastan (pull_request) Failing after 5m27s
Laravel Pint / pint (pull_request) Successful in 3m58s

This commit is contained in:
dhanabalan
2026-10-29 11:18:34 +05:30
parent fa657ffa35
commit 9f0ee1c29b

View File

@@ -151,13 +151,31 @@ class ItemOverview extends ChartWidget
// ); // );
if (in_array($activeFilter, ['today', 'yesterday'])) { 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( $planData = array_fill(
0, 0,
count($orderedData), count($orderedData),
$planQuantity $hourlyPlan
); );
} }
elseif ($activeFilter === 'this_month') { elseif ($activeFilter === 'this_month') {