@foreach($orders as $order) @php $isReseller = !empty($order->customer_payable_amount); $subtotal = 0; foreach ($order->orderdetails as $od) { $subtotal += ($od->sale_price * $od->qty); } if ($isReseller && $order->customer_payable_amount) { $subtotal = $order->customer_payable_amount - $order->shipping_charge; } $finalTotal = $isReseller ? $order->customer_payable_amount : $order->amount; $totalQty = $order->orderdetails->sum('qty'); $payMethod = strtoupper($order->payment_gateway ?? ($order->payment ? $order->payment->payment_method : 'N/A')); $payStatus = $order->payment_status ?? ($order->payment ? $order->payment->payment_status : 'pending'); $trackingId = $order->courier_tracking_id ?? $order->consignment_id ?? null; $courierType = $order->courier_type ?? ($trackingId ? 'steadfast' : null); @endphp
{{-- Header --}}
{{ $generalsetting->name }}
@if($contact->address)

{{ $contact->address }}

@endif @if($contact->phone)

Phone: {{ $contact->phone }}

@endif @if($contact->email)

{{ $contact->email }}

@endif
{{-- Title --}}
POS Invoice
{{-- Meta --}}
Bill No. : {{ $order->invoice_id }} {{ $order->created_at->format('H:i') }} hrs
Date   : {{ $order->created_at->format('d-m-Y') }}
@if($order->shipping && $order->shipping->name)
Buyer   : {{ $order->shipping->name }}
@endif @if($order->shipping && $order->shipping->phone)
Phone   : {{ $order->shipping->phone }}
@endif @if($order->shipping && ($order->shipping->address || $order->shipping->area))
Address : {{ $order->shipping->address }}{{ $order->shipping->area ? ', '.$order->shipping->area : '' }}
@endif
{{-- Products --}} @foreach($order->orderdetails as $item) @php if ($isReseller && $order->customer_payable_amount && $subtotal > 0) { $tv = $item->sale_price * $item->qty; $dp = (($tv / ($subtotal + $order->discount)) * $subtotal) / $item->qty; } else { $dp = $item->sale_price; } $sz = $item->size ? ($item->size->sizeName ?? null) : null; if (!$sz && $item->product_size) { $szm = \App\Models\Size::find($item->product_size); $sz = $szm ? ($szm->sizeName ?? null) : (is_numeric($item->product_size) ? null : $item->product_size); } $cl = $item->color ? ($item->color->colorName ?? null) : null; if (!$cl && $item->product_color && !is_numeric($item->product_color)) { $cl = $item->product_color; } @endphp @endforeach
# Product Qty Rate Total
{{ $loop->iteration }} {{ $item->product_name }} @if($sz || $cl)
@if($sz)Sz:{{ $sz }}@endif @if($sz && $cl)| @endif @if($cl){{ $cl }}@endif
@endif
{{ $item->qty }} {{ number_format($dp, 2) }} {{ number_format($dp * $item->qty, 2) }}
{{-- Summary --}}
Subtotal{{ number_format($subtotal, 2) }}
@if($order->discount > 0)
Discount (–){{ number_format($order->discount, 2) }}
@endif @if($order->shipping_charge > 0)
Delivery (+){{ number_format($order->shipping_charge, 2) }}
@endif
Total   {{ $totalQty }} {{ $totalQty > 1 ? 'Nos' : 'No' }} ৳ {{ number_format($finalTotal, 2) }}
{{-- Payment --}}
Method   :{{ $payMethod }}
Pay Status : @if($payStatus=='paid') PAID @elseif($payStatus=='pending') PENDING @elseif($payStatus=='failed') FAILED @else {{ strtoupper($payStatus) }} @endif
@if($courierType)
Courier   :{{ ucfirst($courierType) }}
@if($trackingId)
Tracking  :{{ $trackingId }}
@endif @if($order->courier_sent_at)
Sent      :{{ \Carbon\Carbon::parse($order->courier_sent_at)->format('d M Y') }}
@endif @endif
Total Paid ৳ {{ number_format($finalTotal, 2) }}
{{-- Order status --}}
Order Status :{{ $order->status ? $order->status->name : 'Processing' }}
{{-- Footer --}}
Thank You!
Visit Again!
* Computer generated invoice. No signature required.
@endforeach