From a122f0763aaecc70bcfdae8565f75f7742ea1129 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 17 Nov 2026 16:14:49 +0530 Subject: [PATCH] Changed logic in process order --- app/Console/Commands/SendProcessOrderReport.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/Console/Commands/SendProcessOrderReport.php b/app/Console/Commands/SendProcessOrderReport.php index f422c2b7..aadb5eca 100644 --- a/app/Console/Commands/SendProcessOrderReport.php +++ b/app/Console/Commands/SendProcessOrderReport.php @@ -87,13 +87,13 @@ class SendProcessOrderReport extends Command // ->get(); // Total coils grouped by process order - $processOrderTotals = DB::table('process_orders') - ->where('plant_id', $plant->id) - ->where('coil_number', '!=', 0) - ->selectRaw('process_order, COUNT(*) AS total_count') - ->groupBy('process_order') - ->get() - ->keyBy('process_order'); + // $processOrderTotals = DB::table('process_orders') + // ->where('plant_id', $plant->id) + // ->where('coil_number', '!=', 0) + // ->selectRaw('process_order, COUNT(*) AS total_count') + // ->groupBy('process_order') + // ->get() + // ->keyBy('process_order'); // OK and Not OK counts grouped by process order $statusCounts = DB::table('characteristic_values') @@ -126,12 +126,11 @@ class SendProcessOrderReport extends Command $processOrder = $order->process_order; - $total = $processOrderTotals[$processOrder]->total_count ?? 0; + $total = $statusCounts[$processOrder]->total_count ?? 0; $notOk = $statusCounts[$processOrder]->notok_count ?? 0; $ok = $statusCounts[$processOrder]->ok_count ?? 0; - // Calculate percentages $notOkPerc = $total > 0 ? round(($notOk / $total) * 100, 2) : 0; -- 2.49.1