{{ $company['name'] ?? config('app.name') }}
@if(!empty($company['address'])){{ $company['address'] }}
@endif @if(!empty($company['city']) || !empty($company['state'])){{ $company['city'] }}{{ !empty($company['city']) && !empty($company['state']) ? ', ' : '' }}{{ $company['state'] }} {{ $company['zip'] ?? '' }}
@endif @if(!empty($company['phone']))Phone: {{ $company['phone'] }}
@endif @if(!empty($company['email']))Email: {{ $company['email'] }}
@endif @if(!empty($company['gst']))GSTIN: {{ $company['gst'] }}@endif
PURCHASE ORDER
{{ $po->po_number }}
Date: {{ $po->po_date->format('d M Y') }}
{{ $po->status }}
Vendor Details
{{ $po->vendor->name ?? '-' }}
@if($po->vendor) @if($po->vendor->address)
{{ $po->vendor->address }}
@endif @if($po->vendor->city || $po->vendor->state)
{{ $po->vendor->city }}{{ $po->vendor->city && $po->vendor->state ? ', ' : '' }}{{ $po->vendor->state }} {{ $po->vendor->pincode }}
@endif @if($po->vendor->phone)
Phone: {{ $po->vendor->phone }}
@endif @if($po->vendor->email)
Email: {{ $po->vendor->email }}
@endif @if($po->vendor->gst_number)
GSTIN: {{ $po->vendor->gst_number }}
@endif @endif
Shipping Details
@if($po->shipping_address)
{{ $po->shipping_address }}
@endif @if($po->shipping_city || $po->shipping_state)
{{ $po->shipping_city }}{{ $po->shipping_city && $po->shipping_state ? ', ' : '' }}{{ $po->shipping_state }} {{ $po->shipping_pincode }}
@endif
Payment: {{ $po->payment_terms ?? 'Net 30' }}
@if($po->expected_date)
Expected: {{ $po->expected_date->format('d M Y') }}
@endif
@php // Collect unique tax names $hasTax1 = $po->items->whereNotNull('tax_1_name')->count() > 0; $hasTax2 = $po->items->whereNotNull('tax_2_name')->count() > 0; $tax1Name = $po->items->whereNotNull('tax_1_name')->first()->tax_1_name ?? 'Tax 1'; $tax2Name = $po->items->whereNotNull('tax_2_name')->first()->tax_2_name ?? 'Tax 2'; @endphp @if($hasTax1)@endif @if($hasTax2)@endif @foreach($po->items as $i => $item) @php $lineTotal = $item->qty * $item->rate; $discAmount = $lineTotal * (($item->discount_percent ?? 0) / 100); $afterDisc = $lineTotal - $discAmount; // Back-calculate taxable amount from inclusive price $taxPercent = ($item->tax_1_rate ?? 0) + ($item->tax_2_rate ?? 0); $taxableAmt = $taxPercent > 0 ? ($afterDisc / (1 + $taxPercent / 100)) : $afterDisc; @endphp @if($hasTax1)@endif @if($hasTax2)@endif @endforeach
# Description Unit Qty Rate Taxable Amt{{ $tax1Name }}{{ $tax2Name }}Total
{{ $i + 1 }} {{ $item->product->name ?? 'N/A' }} @if($item->variation)
{{ $item->variation->variation_name ?: $item->variation->sku }}@endif @if($item->product && $item->product->sku)
SKU: {{ $item->product->sku }}@endif @if($item->discount_percent > 0)
Discount: {{ $item->discount_percent }}%@endif
{{ $item->unit->short_name ?? '-' }} {{ number_format($item->qty, 3) }} {{ number_format($item->rate, 2) }} {{ number_format($taxableAmt, 2) }}{{ $item->tax_1_amount ? number_format($item->tax_1_amount, 2) : '-' }}{{ $item->tax_2_amount ? number_format($item->tax_2_amount, 2) : '-' }}{{ number_format($item->total, 2) }}
@if($po->terms_conditions)
Terms & Conditions
{!! nl2br(e($po->terms_conditions)) !!}
@endif
@if($hasTax1) @php $tax1Total = $po->items->sum('tax_1_amount'); @endphp @endif @if($hasTax2) @php $tax2Total = $po->items->sum('tax_2_amount'); @endphp @endif @if($po->shipping_charge > 0)@endif @if($po->discount_amount > 0)@endif
Subtotal₹{{ number_format($po->subtotal, 2) }}
{{ $tax1Name }}₹{{ number_format($tax1Total, 2) }}
{{ $tax2Name }}₹{{ number_format($tax2Total, 2) }}
Shipping₹{{ number_format($po->shipping_charge, 2) }}
Discount-₹{{ number_format($po->discount_amount, 2) }}
Grand Total₹{{ number_format($po->total_amount, 2) }}
@if($settings['show_signature'] ?? true)
Vendor Signature
{{ $settings['signature_text'] ?? 'Authorized Signatory' }}
@endif @if(!empty($settings['footer_text'])) @endif