@extends('pdf.layouts.order-interior') @section('title','Invoice') @section('content') @php $isQuotationOrder = !empty($order->quotation_id); @endphp

INVOICE

{{-- CLIENT INFO --}} @if($order->shippingAddress) @endif
Name: {{ $order->user->name ?? '-' }} Date: {{ now()->format('d-M-Y') }}
Contact: {{ $order->user->phone ?? '-' }} Invoice No: {{ $order->order_number }}
Billing Address: {{ $order->billingFullAddress ?? '-' }}
Shipping Address: {{ $order->shippingAddress->name }} , {{ $order->shippingAddress->address_line1 }}, {{ $order->shippingAddress->address_line2 ?? '' }} {{ $order->shippingAddress->city }}, {{ $order->shippingAddress->state }}, {{ $order->shippingAddress->phone }}
{{-- ITEM TABLE --}} @if(!$isQuotationOrder) @endif @foreach($order->items as $item) @if(!$isQuotationOrder) @endif @endforeach
No ItemUnit Qty PriceAmount
{{ $loop->iteration }}
{{ $item->product_name }}
{{-- Variant SKU --}} @if($item->variant) SKU: {{ $item->variant->sku ?? '-' }}
@endif {{-- Master catalog --}} @if($item->product) CATALOG: {{ $item->product->master_catalogue_name ?? '-' }} ({{ $item->product->master_catalogue_code ?? '-' }})
@endif {{-- Curtain Details --}} @if(!empty($item->curtain_details)) @php $cd = $item->curtain_details; $modelName = \App\Models\ProductModel::where('id', $cd['model_id'] ?? null)->value('name'); @endphp Model: {{ $modelName ?? '-' }}
Size: {{ $cd['width'] ?? '-' }} × {{ $cd['height'] ?? '-' }} cm
Panels: {{ $cd['panels'] ?? '-' }}
Fabric: {{ $cd['fabric_meter'] ?? '-' }} m
Stitch Rate: ₹{{ $cd['stitch_rate'] ?? '-' }}
Stitch Total: ₹{{ $cd['stitch_total'] ?? '-' }} @endif @php $product = $item->product; $gstPercent = $product->gst_percent ?? 0; $isInclusive = $product->gst_inclusive ?? 0; $price = $item->price; $qty = $item->quantity; $baseTotal = $price * $qty; if($gstPercent > 0){ if($isInclusive){ // GST already included in price $gstAmount = ($baseTotal * $gstPercent) / (100 + $gstPercent); $taxableAmount = $baseTotal - $gstAmount; }else{ // GST needs to be added $gstAmount = ($baseTotal * $gstPercent) / 100; $taxableAmount = $baseTotal; $baseTotal += $gstAmount; } }else{ $gstAmount = 0; $taxableAmount = $baseTotal; } @endphp
@if($gstPercent > 0) GST ({{ $gstPercent }}%) : ₹ {{ number_format($gstAmount,2) }}
@endif
Nos {{ $item->quantity }} ₹ {{ number_format($item->price,2) }} @if(!$isQuotationOrder) ₹ {{ number_format($item->total ?? $item->price,2) }} @else ₹ {{ number_format($item->calculated_total ?? ($item->price * $item->quantity),2) }} @endif
{{-- TOTAL SECTION --}} @if($isQuotationOrder) @else @endif
Subtotal : ₹ {{ number_format($order->sub_total,2) }}
Tax : ₹ {{ number_format($order->tax,2) }}
Delivery Fee : ₹ {{ number_format($order->delivery_fee,2) }}
Discount : ₹ {{ number_format($order->discount,2) }}
Grand Total : ₹ {{ number_format($order->total_amount,2) }}
{{-- PAYMENT STATUS --}} @if($isQuotationOrder) @php $paidAmount = $order->paid_amount ?? 0; // You can store partial payment in orders table $remainingAmount = $order->total_amount - $paidAmount; @endphp
Payment Status : @if($paidAmount > 0 && $paidAmount < $order->total_amount) Partial Paid (₹ {{ number_format($paidAmount,2) }})
Remaining: ₹ {{ number_format($remainingAmount,2) }} @elseif($paidAmount >= $order->total_amount) Paid in Full @else Pending @endif
@else {{-- Normal full payment --}}
Payment Status : {{ ucfirst($order->payment_status) }}
@endif
Authorized Signature
@endsection