Order Invoice

@php if ($order->state) { $state = json_decode($order->state, true); } else { $state = []; } @endphp

Order Information

Transaction ID: {{ $order->txnid ?: 'N/A' }}
Order ID: #{{ $order->transaction_number }}
Order Date: {{ $order->created_at->format('M d, Y') }}
Payment Status: @if ($order->payment_status == 'Paid') Paid @else Unpaid @endif
Payment Method: {{ $order->payment_method }}

Shipping Address

@php $ship = json_decode($order->shipping_info, true); $shipping_service = json_decode($order->shipping, true); // Ensure shipping info exists with proper fallbacks if (!$ship || empty($ship)) { $ship = []; } @endphp @if($shipping_service && isset($shipping_service['title']))
Shipping Method: {{ $shipping_service['title'] }} (৳{{ number_format($shipping_service['price'] ?? 0, 2) }})
@endif
Name: {{ ($ship['ship_first_name'] ?? '') }}
Email: {{ $ship['ship_email'] ?? 'N/A' }}
Phone: {{ $ship['ship_phone'] ?? 'N/A' }}
@if (isset($ship['ship_address1']))
Address: {{ $ship['ship_address1'] }}
@endif @if (isset($ship['ship_city']))
City: {{ $ship['ship_city'] }}{{ isset($ship['ship_zip']) ? ', ' . $ship['ship_zip'] : '' }}
@endif @if (isset($state['name']))
State: {{ $state['name'] }}
@endif @if (isset($ship['ship_country'])) {{--
Country: {{ $ship['ship_country'] }}
--}} @endif @if(isset($ship['pathao_city_id']) || isset($ship['pathao_zone_id']) || isset($ship['pathao_area_id']))
Delivery Details:
@php $pathaoNames = \App\Http\Controllers\Front\CheckoutController::getPathaoNames($ship); @endphp @if(isset($ship['pathao_city_id']))
City: {{ $pathaoNames['city_name'] }} {{-- (ID: {{ $ship['pathao_city_id'] }}) --}}
@endif @if(isset($ship['pathao_zone_id']))
Zone: {{ $pathaoNames['zone_name'] }} {{-- (ID: {{ $ship['pathao_zone_id'] }}) --}}
@endif @if(isset($ship['pathao_area_id']))
Area: {{ $pathaoNames['area_name'] }} {{-- (ID: {{ $ship['pathao_area_id'] }}) --}}
@endif @if(isset($ship['pathao_shipping_cost']))
Shipping Cost: {{ '৳' }}{{($ship['pathao_shipping_cost']) }}
@endif @endif
@php $option_price = 0; $total = 0; $subtotal = 0; @endphp @foreach (json_decode($order->cart, true) as $item) @php // Handle different cart structures for backward compatibility $main_price = isset($item['main_price']) ? $item['main_price'] : (isset($item['price']) ? $item['price'] : 0); $attribute_price = isset($item['attribute_price']) ? $item['attribute_price'] : 0; $qty = isset($item['qty']) ? $item['qty'] : 1; $item_name = isset($item['name']) ? $item['name'] : (isset($item['item']['name']) ? $item['item']['name'] : 'Product'); $total += $main_price * $qty; $option_price += $attribute_price; $grandSubtotal = $total + $option_price; $unit_price = $main_price + $attribute_price; $line_total = isset($item['total']) ? $item['total'] : ($unit_price * $qty); $subtotal += $line_total; @endphp {{-- @dd($grandSubtotal) --}} @endforeach
Products Attributes Quantity Price
{{ $item_name }} @if (isset($item['attribute']['names'])) @foreach ($item['attribute']['names'] as $index => $name) {{ $name }}: {{ $item['attribute']['option_name'][$index] }}
@endforeach @else -- @endif
{{ $qty }} @php $total_price = $main_price + $attribute_price; @endphp @if ($setting->currency_direction == 1) {{ '৳' }}{{ round($total_price * 1, 2) }} @else {{ round($total_price * 1, 2) }}{{ '৳' }} @endif
Sub Total: @if ($setting->currency_direction == 1) {{ '৳' }}{{ round($subtotal * 1, 2) }} @else {{ round($subtotal * 1, 2) }}{{ '৳' }} @endif
@if ($order->tax != 0)
Tax: @if ($setting->currency_direction == 1) {{ '৳' }}{{ round($order->tax * 1, 2) }} @else {{ round($order->tax * 1, 2) }}{{ '৳' }} @endif
@endif @if (json_decode($order->discount, true)) @php $discount = json_decode($order->discount, true); @endphp
Coupon Discount ({{ $discount['code']['code_name'] }}): @if ($setting->currency_direction == 1) -{{ '৳' }}{{ round($discount['discount'] * 1, 2) }} @else -{{ round($discount['discount'] * 1, 2) }}{{ '৳' }} @endif
@endif @if (json_decode($order->shipping_info, true) || json_decode($order->shipping, true)) @php $shipping_info = json_decode($order->shipping_info, true); $shipping_service = json_decode($order->shipping, true); $service_cost = 0; $pathao_cost = 0; $address_cost = 0; if($shipping_service && isset($shipping_service['price'])) { $service_cost = $shipping_service['price']; } if($shipping_info) { $pathao_cost = $shipping_info['pathao_shipping_cost'] ?? 0; $address_cost = $shipping_info['address_shipping_cost'] ?? 0; } $total_shipping = $service_cost + $pathao_cost + $address_cost; @endphp @if($service_cost > 0)
Shipping Method ({{ $shipping_service['title'] ?? 'N/A' }}): @if ($setting->currency_direction == 1) {{ '৳' }}{{ number_format($service_cost, 2) }} @else {{ number_format($service_cost, 2) }}{{ '৳' }} @endif
@endif @if($pathao_cost > 0)
Pathao Shipping: @if ($setting->currency_direction == 1) {{ '৳' }}{{ number_format($pathao_cost, 2) }} @else {{ number_format($pathao_cost, 2) }}{{ '৳' }} @endif
@endif @if($address_cost > 0)
Address Shipping: @if ($setting->currency_direction == 1) {{ '৳' }}{{ number_format($address_cost, 2) }} @else {{ number_format($address_cost, 2) }}{{ '৳' }} @endif
@endif @if($total_shipping > 0)
Total Shipping: @if ($setting->currency_direction == 1) {{ '৳' }}{{ number_format($total_shipping, 2) }} @else {{ number_format($total_shipping, 2) }}{{ '৳' }} @endif
@endif @endif @if (json_decode($order->state_price, true))
State Tax @if(isset($state['type']) && $state['type'] == 'percentage') ({{ $state['price'] }}%) @endif: @if ($setting->currency_direction == 1) {{ '৳' }}{{ round($order['state_price'] * 1, 2) }} @else {{ round($order['state_price'] * 1, 2) }}{{ '৳' }} @endif
@endif
@if ($order->payment_method == 'Cash On Delivery') Total Amount: @else Total Amount Due: @endif @if ($setting->currency_direction == 1) {{ '৳' }}{{ PriceHelper::OrderTotal($order) }} @else {{ PriceHelper::OrderTotal($order) }}{{ '৳' }} @endif