modified sticker reprint controller logic

This commit is contained in:
dhanabalan
2025-07-29 11:46:44 +05:30
parent 8c5f2b5b39
commit 48942307e1

View File

@@ -54,97 +54,87 @@ class ProductionStickerReprintController extends Controller
$sticker = StickerMaster::where('item_id', $itemId)->first();
// Decide number of copies
$copies = 1;
$copies = 1;
if ($sticker) {
if ($sticker->serial_number_motor == 1) {
$copies = 1;
} elseif (is_null($sticker->serial_number_motor) && $sticker->serial_number_pump == 1) {
if ($sticker->serial_number_pump == 1) {
// If pump is selected (regardless of motor), 2 copies
$copies = 2;
} elseif ($sticker->serial_number_motor == 1) {
// Only motor selected, 1 copy
$copies = 1;
}
}
return '
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
width: 60mm;
height: 14mm;
font-size: 10pt;
font-family: Arial Narrow, Arial, sans-serif;
}
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
width: 60mm;
height: 14mm;
font-size: 10pt;
font-family: Arial Narrow, Arial, sans-serif;
}
.sticker-table {
width: 60mm;
height: 14mm;
border-collapse: collapse;
}
.sticker-table {
width: 60mm;
height: 14mm;
border-collapse: collapse;
}
.text-cell {
text-align: left;
vertical-align: middle;
font-size: 10pt;
padding: 2mm 2mm 0 0;
white-space: normal;
font-weight: normal;
line-height: 0.3;
}
.text-cell {
text-align: left;
vertical-align: middle;
font-size: 10pt;
padding: 2mm 2mm 0 0;
white-space: normal;
font-weight: normal;
line-height: 0.3;
}
.text-row {
align-items: center;
width: 100%;
font-weight: bold;
font-size: 9pt;
}
.text-row {
align-items: center;
width: 100%;
font-weight: bold;
font-size: 9pt;
}
.serial {
text-align: left;
}
.serial {
text-align: left;
}
.po-number {
text-align: right;
white-space: nowrap;
width: 1%;
}
.po-number {
text-align: right;
white-space: nowrap;
width: 1%;
}
.desc-row {
font-weight: normal;
font-size: 7pt;
}
.desc-row {
font-weight: normal;
font-size: 7pt;
}
.qr-cell {
width: 14mm;
text-align: left;
vertical-align: middle;
padding-left: 1mm;
padding-top: 0mm;
}
.qr-cell {
width: 14mm;
text-align: left;
vertical-align: middle;
padding-left: 1mm;
padding-top: 0mm;
}
img.qr {
width: 13mm;
height: 13mm;
display: block;
}
</style>
</head>
<body>
<table class="sticker-table">
<tr>
<td class="qr-cell">
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
</td>
<td class="text-cell">
<div class="text-row"><pre><span class="serial">' . htmlspecialchars($serial) . '</span> <span class="po-number">' . htmlspecialchars($productionOrder) . '</span></pre>
</div>
<div class="desc-row">
' . htmlspecialchars($item->description) . '
</div>
</td>
</tr>
</table>
<div id="print-container"></div>
img.qr {
width: 13mm;
height: 13mm;
display: block;
}
</style>
</head>
<body>
<div id="print-container"></div>
<script>
const copies = ' . $copies . ';
@@ -178,9 +168,10 @@ class ProductionStickerReprintController extends Controller
}, 500);
};
</script>
</body>
</html>
';
</body>
</html>
';
// //Get sticker master data
// $sticker = StickerMaster::where('item_id', $itemId)->first();