From b34e43575820c03e4722420e86b83c6d9a1ee3f2 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 16 Nov 2026 12:01:37 +0530 Subject: [PATCH] Added logic for sunday in production report --- app/Console/Commands/SendProductionReport.php | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/app/Console/Commands/SendProductionReport.php b/app/Console/Commands/SendProductionReport.php index d8c5ff93..36d2a1eb 100644 --- a/app/Console/Commands/SendProductionReport.php +++ b/app/Console/Commands/SendProductionReport.php @@ -363,15 +363,22 @@ class SendProductionReport extends Command $dayShiftPlanQuan = 0; $nightShiftPlanQuan = 0; - if($line->shift_flag == '0'){ - $dayShiftPlanQuan = ($totalTargetQuantity / 2); - $nightShiftPlanQuan = ($totalTargetQuantity / 2); - } - elseif($line->shift_flag == '1'){ + $isSunday = $endDate->isSunday(); + + if ($isSunday) { $dayShiftPlanQuan = ($totalTargetQuantity); - } - elseif($line->shift_flag == '2'){ - $nightShiftPlanQuan = ($totalTargetQuantity); + } else { + + if($line->shift_flag == '0'){ + $dayShiftPlanQuan = ($totalTargetQuantity / 2); + $nightShiftPlanQuan = ($totalTargetQuantity / 2); + } + elseif($line->shift_flag == '1'){ + $dayShiftPlanQuan = ($totalTargetQuantity); + } + elseif($line->shift_flag == '2'){ + $nightShiftPlanQuan = ($totalTargetQuantity); + } } if (strtolower($line->type) == 'fg line') {