@php $columns = match ($format) { 'dymo' => 1, '2x7_price' => 2, '4x7_price' => 4, '4x12' => 4, '4x12_price' => 4, default => 2, }; $showPrice = str_contains($format, 'price'); // When MO is done, print label for finished product; otherwise print labels for components if ($isDone) { $items = collect(); if ($record->product) { $qty = match ($quantityType) { 'custom' => $quantity, 'operation' => max(1, (int) round((float) $record->quantity_producing ?: $record->quantity)), default => 1, }; for ($i = 0; $i < $qty; $i++) { $items->push([ 'product' => $record->product, 'barcode' => $record->product->barcode, 'price' => $record->product->price ?? 0, ]); } } } else { $items = collect(); foreach ($record->rawMaterialMoves as $move) { if (! $move->product) { continue; } $qty = match ($quantityType) { 'custom' => $quantity, 'operation' => max(1, (int) round((float) $move->product_uom_qty)), default => 1, }; for ($i = 0; $i < $qty; $i++) { $items->push([ 'product' => $move->product, 'barcode' => $move->product->barcode, 'price' => $move->product->price ?? 0, ]); } } } $barcodeScale = $columns === 4 ? 1.2 : 2; $totalItems = count($items); @endphp @for ($i = 0; $i < $totalItems; $i += $columns) @for ($j = 0; $j < $columns && ($i + $j) < $totalItems; $j++) @php $item = $items[$i + $j]; @endphp @endfor @endfor
{{ strtoupper($item['product']->name) }}
@if ($item['barcode'])
{!! DNS1D::getBarcodeHTML($item['barcode'], 'C128', $barcodeScale, 33) !!}
{{ $item['barcode'] }}
@endif @if ($showPrice)
{{ number_format((float) ($item['price'] ?? 0), 2) }}
@endif