Added logic in item overview for today filter seperated
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 21s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 20s
Laravel Pint / pint (pull_request) Successful in 3m50s
Laravel Larastan / larastan (pull_request) Failing after 6m42s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 21s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 20s
Laravel Pint / pint (pull_request) Successful in 3m50s
Laravel Larastan / larastan (pull_request) Failing after 6m42s
This commit is contained in:
@@ -150,7 +150,29 @@ class ItemOverview extends ChartWidget
|
||||
// $planQuantity
|
||||
// );
|
||||
|
||||
if (in_array($activeFilter, ['today', 'yesterday'])) {
|
||||
if ($activeFilter === 'today') {
|
||||
|
||||
$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');
|
||||
|
||||
// Calculate daily target directly
|
||||
$weeksCount = (int) ceil($startDate->daysInMonth / 7);
|
||||
|
||||
$dailyPlan = $weeksCount > 0
|
||||
? round($monthlyPlanQuantity / ($weeksCount * 7), 2)
|
||||
: 0;
|
||||
|
||||
// Calculate hourly target
|
||||
$hourlyPlan = round($dailyPlan / 22.5, 2);
|
||||
|
||||
// Same hourly plan value for every hour
|
||||
$planData = array_fill(0, 24, $hourlyPlan);
|
||||
}
|
||||
if ($activeFilter === 'yesterday') {
|
||||
|
||||
$monthlyPlanQuantity = \DB::table('production_plans')
|
||||
->where('plant_id', $selectedPlant)
|
||||
|
||||
Reference in New Issue
Block a user