{{-- resources/views/admin/orders/invoice.blade.php --}} Order Invoice {{-- Top Print Button (screen only) --}}
{{-- ===== Normalize: $items or $item/$order -> $orders (collection) ===== --}} @php $orders = collect(); if (isset($items)) { $orders = collect($items); } elseif (isset($item)) { $orders = collect([$item]); } elseif (isset($order)) { $orders = collect([$order]); } @endphp @forelse($orders as $item) @php $subTotal = 0; @endphp
{{-- Header / Logo --}}
logo
{{ $info->site_name ?? config('app.name') }}
{{ $info->address ?? '' }}
Invoice
ID: #{{ $item->invoice_no }}
Order Summary
{{-- Bill To / Meta --}}
Invoice To
{{ $item->first_name }} {{ $item->last_name }}
{{ $item->shipping_address }}
Phone: {{ $item->mobile }}
Invoice#{{ $item->invoice_no }}
Date{{ dateFormate($item->date) }}
Created{{ $item->created_at->diffForHumans() }}
{{-- Items --}}
@foreach($item->details as $idx => $detail) @php $var = optional($detail->variation); // Unit price precedence: order_details.unit_price > variation.after_discount_price > variation.price $unitPrice = $detail->unit_price ?? ($var->after_discount_price ?? ($var->price ?? 0)); $qty = (int)($detail->quantity ?? 0); $rowTotal = $unitPrice * $qty; $subTotal += $rowTotal; $colorLabel = optional($var->color)->name; $sizeLabel = optional($var->size)->title; if($colorLabel === 'Default'){ $colorLabel = ''; } if($sizeLabel === 'free'){ $sizeLabel = ''; } $desc = trim( ($detail->product->name ?? '').' '.($detail->productsize->title ?? '') ); @endphp @endforeach
SL. Item Description Color Size Price Qty Total
{{ $idx+1 }} {{ $desc }} {{ $colorLabel }} {{ $sizeLabel }} {{ priceFormate($unitPrice) }} {{ $qty }} {{ priceFormate($rowTotal) }}
{{-- Note + Totals (NO DISCOUNT line) --}}
@php $orderNote = trim($item->note ?? ''); @endphp @if($orderNote !== '')
Note
{{ $orderNote }}
@endif
@php $deliveryAmount = optional($item->delivery_charge)->amount ?? ($item->shipping_charge ?? 0); $grand = $subTotal + $deliveryAmount; // Subtotal + Delivery (no discount line) @endphp
Sub Total
{{ priceFormate($subTotal) }}
Delivery Charge
{{ priceFormate($deliveryAmount) }}

Total
{{ priceFormate($grand) }}
{{-- Signature & Footer --}}
Phone:
{{ $info->owner_phone ?? '' }}
Company: {{ $info->site_name ?? config('app.name') }} | Address: {{ $info->address ?? '' }}
{{-- Page break between orders (print only) --}} @if(!$loop->last)
@endif @empty
No order found.
@endforelse