Added current date logic for single pump #1165
@@ -1515,6 +1515,24 @@ class StickerPdfService
|
||||
$pdf->AddPage();
|
||||
$qrContent = $itemCode . '|' . $serial;
|
||||
|
||||
|
||||
$serialString = (string) $serial;
|
||||
$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') {
|
||||
@@ -1524,6 +1542,9 @@ class StickerPdfService
|
||||
if ($textValue == '__SERIAL_NUMBER__') {
|
||||
$textValue = (string) $serial;
|
||||
}
|
||||
if ($textValue == '__CURRENT_DATE__') {
|
||||
$textValue = $serialDate;
|
||||
}
|
||||
|
||||
$pdf->SetFont($element['font'],'',$element['size']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user