From b6288f7ed5467af3dc728bd03a89c282f0cb3be3 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 18 Nov 2026 11:57:17 +0530 Subject: [PATCH] Added order quantity in process order chart --- app/Filament/Widgets/ProcessOrderChart.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Filament/Widgets/ProcessOrderChart.php b/app/Filament/Widgets/ProcessOrderChart.php index 90d2accb..d16aef60 100644 --- a/app/Filament/Widgets/ProcessOrderChart.php +++ b/app/Filament/Widgets/ProcessOrderChart.php @@ -179,21 +179,37 @@ class ProcessOrderChart extends ChartWidget ") ->first(); + $totalOrderQuantity = DB::table('process_orders') + ->where('plant_id', $selectedPlant) + ->where('line_id', $selectedLine) + ->whereIn('process_order', function ($query) use ($selectedPlant, $selectedLine) { + $query->select('process_order') + ->from('characteristic_values') + ->where('plant_id', $selectedPlant) + ->where('line_id', $selectedLine) + ->distinct(); + }) + ->where('created_at', '>=', $startDate) + ->where('created_at', '<', $endDate) + ->sum('order_quantity'); + return [ 'datasets' => [ [ 'label' => 'Quantity', 'data' => [ + (int) ($totalOrderQuantity ?? 0), (int) ($records->ok_count ?? 0), (int) ($records->not_ok_count ?? 0), ], 'backgroundColor' => [ + '#3B82F6', '#16A34A', '#DC2626', ], ], ], - 'labels' => ['OK', 'Not OK'], + 'labels' => ['Order Quantity', 'OK', 'Not OK'], ]; }