Added logic for applying leave dates plan quantity in produciton mail #1403

Merged
jothi merged 1 commits from ranjith-dev into master 2026-11-10 05:52:40 +00:00
Showing only changes of commit 92ba1e128a - Show all commits

View File

@@ -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)