output($qrCode, 100); $qrBase64 = base64_encode($qrBinary); return '
QR '.htmlspecialchars($palletNo).'
'; // $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 downloadReprintProcess($plant, $item, $process_order, $coil_number, $name) { // dd($plant,$item,$process_order,$coil_number); $processOrder = \App\Models\ProcessOrder::where('plant_id', $plant) ->where('item_id', $item) ->where('process_order', $process_order) ->where('coil_number', $coil_number) ->first(); if (! $processOrder) { return response()->json(['error' => 'Process order not found'], 404); } $receivedQuantity = $processOrder->received_quantity; $machineName = $processOrder->machine_name; $user = $processOrder->created_by; $icode = \App\Models\Item::find($item); $pCode = \App\Models\Plant::find($plant); $plCode = $pCode->code; if (! $plCode) { Notification::make() ->title('Unknown Plant') ->body('Plant not found.') ->warning() ->send(); } if (! $icode) { Notification::make() ->title('Unknown Item') ->body('Item not found.') ->warning() ->send(); } $itCode = $icode->code; $itemAgaPlant = \App\Models\Item::where('code', $itCode) ->where('plant_id', $plant) ->first(); if (! $itemAgaPlant) { Notification::make() ->title('Unknown Item') ->body("Item not found against plant code $plCode.") ->warning() ->send(); } else { $itemDescription = $itemAgaPlant->description; } $nowDT = now()->format('d-m-Y H:i:s'); // Build QR content $qrContent = "{$receivedQuantity}|{$itCode}|{$process_order}-{$coil_number}"; $qrCode = new QrCode($qrContent); $output = new Output\Png; $qrBinary = $output->output($qrCode, 100); $qrBase64 = base64_encode($qrBinary); return '
D/T: '.htmlspecialchars($nowDT).'
OP ID: '.htmlspecialchars($user).'
PO NO: '.htmlspecialchars($process_order).'
M/C: '.htmlspecialchars($itCode).'
DES: '.htmlspecialchars($itemDescription).'
WGT: '.htmlspecialchars($receivedQuantity).' KGS
MAC: '.htmlspecialchars($machineName).'
QR
'; } public function downloadQrPdf($palletNo) { $qrCode = new QrCode($palletNo); $output = new Output\Png; $qrBinary = $output->output($qrCode, 100); $qrBase64 = base64_encode($qrBinary); $htmlBlock = '
QR '.htmlspecialchars($palletNo).'
'; return ' '.$htmlBlock.$htmlBlock.' '; // $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'); } /** * Store a newly created resource in storage. */ public function store(Request $request) { // } /** * Display the specified resource. */ public function show(string $id) { // } /** * Update the specified resource in storage. */ public function update(Request $request, string $id) { // } /** * Remove the specified resource from storage. */ public function destroy(string $id) { // } }