From 92ba1e128ae418f85272b4e0afd7940493bed33f Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 10 Nov 2026 11:22:18 +0530 Subject: [PATCH] Added logic for applying leave dates plan quantity in produciton mail --- app/Console/Commands/SendProductionReport.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Console/Commands/SendProductionReport.php b/app/Console/Commands/SendProductionReport.php index 78860d40..ec1b839b 100644 --- a/app/Console/Commands/SendProductionReport.php +++ b/app/Console/Commands/SendProductionReport.php @@ -6,6 +6,7 @@ use App\Mail\ProductionMail; use App\Models\Item; use App\Models\Line; use App\Models\Plant; +use App\Models\ProductionCalendar; use App\Models\ProductionPlan; use App\Models\ProductionQuantity; use Illuminate\Console\Command; @@ -260,6 +261,17 @@ class SendProductionReport extends Command // $capacityQuan = $totalHourlyQuantity * 22.5; + $leaveDates = ProductionCalendar::where('plant_id', $plant->id) + ->whereMonth('created_at', $month) + ->whereYear('created_at', $year) + ->value('leave_dates'); + + $leaveDates = $leaveDates ? array_map('trim', explode(',', $leaveDates)) : []; + + if (in_array($startDate->format('Y-m-d'), $leaveDates)) { + $totalTargetQuantity = 0; + } + if (strtolower($line->type) == 'fg line') { $productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id) -- 2.49.1