@php if (!function_exists('numberToWords')) { function numberToWords($num) { $num = (float)$num; $deci = round($num - floor($num), 2) * 100; $num = (int)$num; $ones = array( 0 => "Zero", 1 => "One", 2 => "Two", 3 => "Three", 4 => "Four", 5 => "Five", 6 => "Six", 7 => "Seven", 8 => "Eight", 9 => "Nine", 10 => "Ten", 11 => "Eleven", 12 => "Twelve", 13 => "Thirteen", 14 => "Fourteen", 15 => "Fifteen", 16 => "Sixteen", 17 => "Seventeen", 18 => "Eighteen", 19 => "Nineteen" ); $tens = array( 0 => "", 1 => "", 2 => "Twenty", 3 => "Thirty", 4 => "Forty", 5 => "Fifty", 6 => "Sixty", 7 => "Seventy", 8 => "Eighty", 9 => "Ninety" ); $helper = function($n) use ($ones, $tens) { $res = ""; if ($n >= 100) { $res .= $ones[(int)($n / 100)] . " Hundred "; $n %= 100; } if ($n > 0) { if ($n < 20) { $res .= $ones[$n] . " "; } else { $res .= $tens[(int)($n / 10)] . " "; if ($n % 10 > 0) { $res .= $ones[$n % 10] . " "; } } } return trim($res); }; if ($num == 0) { $words = "Zero"; } else { $parts = []; // Crores if ($num >= 10000000) { $crore = (int)($num / 10000000); $parts[] = $helper($crore) . " Crore"; $num %= 10000000; } // Lakhs if ($num >= 100000) { $lakh = (int)($num / 100000); $parts[] = $helper($lakh) . " Lakh"; $num %= 100000; } // Thousands if ($num >= 1000) { $thousand = (int)($num / 1000); $parts[] = $helper($thousand) . " Thousand"; $num %= 1000; } // Hundreds & Tens & Ones if ($num > 0) { $parts[] = $helper($num); } $words = implode(" ", $parts); } $paiseWords = ""; if ($deci > 0) { $deci = (int)$deci; if ($deci < 20) { $paiseWords = " And " . $ones[$deci] . " Paise"; } else { $paiseWords = " And " . $tens[(int)($deci / 10)] . " " . ($deci % 10 > 0 ? $ones[$deci % 10] : "") . " Paise"; } } return trim($words) . $paiseWords . " Only"; } } @endphp {{-- Toolbar --}}

@if($mode === 'print_labels') 🖨 Print Shipping Labels @else ⬇ Download / Print Shipping Labels @endif

{{ count($orders) }} label(s) ✕ Close
{{-- Label grid --}}
@forelse($orders as $order) @php $label = $order->labels->first(); $courier = $order->latest_shipment_log?->courier_name ?? $order->courier_name ?? 'Courier'; $awb = $order->awb_number ?? 'NO AWB'; @endphp
{{-- Section 1: Logo & Ship To --}}
Ship to:
{{ $order->customer_name }}
@if($order->shipping_address)
{{ $order->shipping_address }}
@endif @if($order->customer_phone)
{{ $order->customer_phone }}
@endif
{{-- Section 2: Courier & Barcode --}}
{{ $courier }}: {{ $awb }}
@if($order->awb_number)
*{{ $order->awb_number }}*
@else
[Barcode Placeholder]
@endif
{{-- Section 3: Mid Grid --}}
Order Amount
PREPAID
Rs {{ number_format((float)$order->amount, 2) }}
({{ numberToWords($order->amount) }})
Order Date: {{ $order->order_date ? $order->order_date->format('M d, Y, H:i') : $order->created_at->format('M d, Y, H:i') }}
Invoice No: {{ $order->order_number }}
Invoice Date: {{ $label ? $label->generated_at->format('M d, Y, H:i') : now()->format('M d, Y, H:i') }}
Pieces: {{ $order->items->sum('quantity') }}
Channel: {{ ucfirst($order->imported_from ?? 'Shopify') }}
Dim | Wt: {{ floatval($order->length) }}x{{ floatval($order->width) }}x{{ floatval($order->height) }} cm | {{ floatval($order->weight) }} Kg
{{-- Section 4: Order ID Banner --}} {{-- Section 5: Product Table --}}
@foreach($order->items as $item) @endforeach
# Product Name & SKU Price Qty IGST Amount
{{ $loop->iteration }}
{{ $item->product_name }}
SKU: {{ $item->sku }}
{{ number_format((float)$item->price, 2) }} {{ $item->quantity }} - {{ number_format((float)$item->line_total, 2) }}
{{-- Section 6: Footer --}} @if(!$label)
⚠ No label record found.
@endif
@empty
No orders found.
@endforelse
@if($mode === 'print_labels') @endif