From bb1c54f094df56de3fea3e243ed663de143f5216 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sun, 4 Oct 2026 15:30:31 +0530 Subject: [PATCH] solved bug in current date issue --- app/Services/StickerPdfService.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/app/Services/StickerPdfService.php b/app/Services/StickerPdfService.php index 3642c44e..89c4ee71 100644 --- a/app/Services/StickerPdfService.php +++ b/app/Services/StickerPdfService.php @@ -1646,11 +1646,29 @@ class StickerPdfService $pdf->AddPage(); $serialString = (string) $serial; + $serialDate = ''; $firstSerial = $serial; $secondSerial = $serial + 1; + $serialString = (string) $firstSerial; + $serialDate = ''; + + if (strlen($serialString) >= 4) { + + $year = substr($serialString, 0, 2); + $month = substr($serialString, 2, 2); + + if ((int) $month >= 1 && (int) $month <= 12) { + + $serialDate = \Carbon\Carbon::createFromFormat( + 'y-m', + $year . '-' . $month + )->format('M-y'); + } + } + foreach ($template['elements'] as $element) { if ($element['type'] == 'text') { @@ -1668,16 +1686,8 @@ class StickerPdfService $textValue = ''; } } - if (strlen($serialString) >= 4) { - $year = substr($serialString, 0, 2); - $month = substr($serialString, 2, 2); - - if ((int) $month >= 1 && (int) $month <= 12) { - $textValue = \Carbon\Carbon::createFromFormat( - 'y-m', - $year . '-' . $month - )->format('M-y'); - } + if ($textValue == '__CURRENT_DATE__') { + $textValue = $serialDate; } $pdf->SetFont( -- 2.49.1