Added print item in print order controller and create page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
@@ -50,7 +50,8 @@ class ProductionOrderController extends Controller
|
||||
|
||||
$qrCode = new QrCode($qrData);
|
||||
$output = new Output\Png;
|
||||
$qrBinary = $output->output($qrCode, 100);
|
||||
// $qrBinary = $output->output($qrCode, 100);
|
||||
$qrBinary = $output->output($qrCode, 600);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
$stickers[] = [
|
||||
@@ -134,6 +135,53 @@ class ProductionOrderController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function printitemserial($production_order)
|
||||
{
|
||||
$order = ProductionOrder::where('production_order', $production_order)->first();
|
||||
|
||||
if (!$order) {
|
||||
abort(404, 'Production Order not found');
|
||||
}
|
||||
else{
|
||||
$fromSerial = (int) $order->from_serial_number;
|
||||
$toSerial = (int) $order->to_serial_number;
|
||||
$itemCode = $order->item->code ?? '';
|
||||
$itemDes = $order->item->description ?? '';
|
||||
|
||||
$stickers = [];
|
||||
|
||||
for ($i = $fromSerial; $i <= $toSerial; $i++)
|
||||
{
|
||||
|
||||
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
||||
|
||||
$qrData = $itemCode . '|' . $serial;
|
||||
|
||||
// $qrBase64 = base64_encode(
|
||||
// QrCode::format('png')->size(100)->generate($qrData)
|
||||
// );
|
||||
|
||||
$qrCode = new QrCode($qrData);
|
||||
$output = new Output\Png;
|
||||
// $qrBinary = $output->output($qrCode, 100);
|
||||
$qrBinary = $output->output($qrCode, 600);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
$stickers[] = [
|
||||
'serial' => $serial,
|
||||
'qr' => 'data:image/png;base64,' . $qrBase64,
|
||||
'production_order' => $itemCode,
|
||||
'description' => $itemDes ?? ''
|
||||
];
|
||||
}
|
||||
|
||||
$pdf = Pdf::loadView('production-orders.printItemSerial', compact('stickers'))
|
||||
->setPaper([0, 0, 170, 40]);
|
||||
|
||||
return $pdf->stream('stickers.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user