From c8348310359f02a29b04ec8879c0ff913e19b491 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 29 Sep 2026 11:21:42 +0530 Subject: [PATCH] Added process order report in production mail --- app/Console/Commands/SendProductionReport.php | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/SendProductionReport.php b/app/Console/Commands/SendProductionReport.php index 477230d..bf84752 100644 --- a/app/Console/Commands/SendProductionReport.php +++ b/app/Console/Commands/SendProductionReport.php @@ -235,7 +235,14 @@ class SendProductionReport extends Command ->whereBetween('created_at', [$startDate, $endDate]) ->count(); - } else { + } + if(strtolower($line->type) == 'process fg line'){ + $productionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id) + ->where('line_id', $line->id) + ->whereBetween('created_at', [$startDate, $endDate]) + ->count(); + } + else { $productionQuantity = ProductionQuantity::where('plant_id', $plant->id) ->where('line_id', $line->id) @@ -272,6 +279,25 @@ class SendProductionReport extends Command ->count(); } + if (strtolower($line->type) == 'process fg line') { + + $dayproductionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id) + ->where('line_id', $line->id) + ->whereBetween('created_at', [ + $startDate->copy()->setTime(8, 0, 0), + $startDate->copy()->setTime(19, 30, 0), + ]) + ->sum('received_quantity'); + + $nightproductionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id) + ->where('line_id', $line->id) + ->whereBetween('created_at', [ + $startDate->copy()->setTime(19, 30, 0), + $endDate->copy()->setTime(8, 0, 0), + ]) + ->sum('received_quantity'); + } + $dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0; $nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0; -- 2.49.1