Added print 2 method in production order controller logic
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
This commit is contained in:
@@ -72,6 +72,57 @@ class ProductionOrderController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function print2($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, 100);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
$stickers[] = [
|
||||
'serial' => $serial,
|
||||
'qr' => 'data:image/png;base64,' . $qrBase64,
|
||||
'production_order' => $production_order,
|
||||
'description' => $itemDes ?? ''
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// $pdf = Pdf::loadView('production-orders.print', compact('stickers'))
|
||||
// ->setPaper([0, 0, 170, 28.35]);
|
||||
|
||||
$pdf = Pdf::loadView('production-orders.print2', compact('stickers'))
|
||||
->setPaper([0, 0, 170.0787, 28.3465]);
|
||||
|
||||
return $pdf->stream('stickers.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
public function printpanel($production_order, $plantCode){
|
||||
|
||||
\Log::info('Print Panel Started', [
|
||||
|
||||
Reference in New Issue
Block a user