Added reprint for scan pallet

This commit is contained in:
dhanabalan
2025-07-29 13:56:30 +05:30
parent ab769d2287
commit a78cb75bdd
3 changed files with 59 additions and 1 deletions

View File

@@ -521,7 +521,7 @@ class PalletValidationResource extends Resource
]) ])
->action(function (array $data) { ->action(function (array $data) {
$selectedPalletNumber = $data['pallet_list']; $selectedPalletNumber = $data['pallet_list'];
return redirect()->route('download-qr-pdf', ['palletNo' => $selectedPalletNumber]); return redirect()->route('download-reprint-qr-pdf', ['palletNo' => $selectedPalletNumber]);
}) })
->visible(function() { ->visible(function() {

View File

@@ -17,6 +17,62 @@ class PalletController extends Controller
// //
} }
public function downloadReprintQrPdf($palletNo)
{
$qrCode = new QrCode($palletNo);
$output = new Output\Png();
$qrBinary = $output->output($qrCode, 100);
$qrBase64 = base64_encode($qrBinary);
return '
<html>
<head>
<style>
body { margin: 0; padding: 0; width: 60mm; height: 14mm; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; }
.qr-cell { width: 14mm; text-align: right; vertical-align: bottom; padding-left: 6mm; padding-top: 0mm; }
.text-cell { text-align: left; vertical-align: middle; font-size: 16pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
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">
' . htmlspecialchars($palletNo) . '
</td>
</tr>
</table>
<script>
window.onload = function () {
window.print();
setTimeout(function () {
window.close();
}, 500); // Wait 0.5 seconds before closing
};
</script>
</body>
</html>
';
// $mpdf = new Mpdf([
// 'mode' => 'utf-8',
// 'format' => [60, 14],
// 'margin_left' => 0,
// 'margin_right' => 0,
// 'margin_top' => 0,
// 'margin_bottom' => 0,
// // 'tempDir' => '/var/www/storage/mpdf-tmp',
// ]);
// $mpdf->WriteHTML($html);
// // Output PDF to browser for printing
// $mpdf->Output('qr-label.pdf', 'I');
}
public function downloadQrPdf($palletNo) public function downloadQrPdf($palletNo)
{ {
$qrCode = new QrCode($palletNo); $qrCode = new QrCode($palletNo);

View File

@@ -82,6 +82,8 @@ Route::get('sticker/get-master-type-data', [StickerMasterController::class, 'get
Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf'); Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf');
Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf');
Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf'); Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf');
//Production Dashboard Controller //Production Dashboard Controller