@php use App\Support\RichTextSanitizer; @endphp Purchase Order {{ $po->po_number }}
@php $fmt = function ($n) { $n = (float) $n; return number_format($n, fmod($n, 1) == 0 ? 2 : 4); }; $currency = $po->currency ?: ''; $money = function ($n) use ($fmt, $currency) { return trim($currency.' '.$fmt($n)); }; // Billing-To (issuing company) identity, falling back to the account. $buyerName = $po->billing_to_name ?: ($account->name ?? config('app.name')); $buyerAddress = $po->billing_to_address ?: ($account->address ?? null); $buyerEmail = $po->billing_to_email ?: ($po->creator?->email ?? null); $buyerPhone = $po->billing_to_phone ?: (($po->creator?->country_code ?? '').($po->creator?->phone ?? '') ?: null); // Shipping-To falls back to the billing-to party when not supplied. $shipToName = $po->shipping_to_name ?: $buyerName; $shipToAddress = $po->shipping_to_address ?: $buyerAddress; // "Prepared By" date: the PO date, else the record's creation date. $preparedDate = ($po->po_date ?: $po->created_at)?->format('d.m.Y'); // Supplier blocks. Shipping-from falls back to billing-from when not supplied. $billFromName = $po->billing_from_name ?: 'Valued Supplier'; $shipFromName = $po->shipping_from_name ?: $billFromName; $shipFromAddress = $po->shipping_from_address ?: $po->billing_from_address; $shipFromGstin = $po->shipping_from_gstin ?: $po->billing_from_gstin; @endphp
PURCHASE ORDER
{{ $po->po_number }}
Billing To
{{ $buyerName }}
@if($buyerAddress)
{{ $buyerAddress }}
@endif @if($po->billing_to_gstin)
GSTIN: {{ $po->billing_to_gstin }}
@endif @if($po->billing_to_gst_state)
GST State: {{ $po->billing_to_gst_state }}
@endif @if($po->billing_to_cin)
CIN: {{ $po->billing_to_cin }}
@endif @if($po->billing_to_contact_person)
Contact: {{ $po->billing_to_contact_person }}
@endif @if($buyerEmail)
Email: {{ $buyerEmail }}
@endif @if($buyerPhone)
Phone: {{ $buyerPhone }}
@endif
Shipping To
{{ $shipToName }}
@if($shipToAddress)
{{ $shipToAddress }}
@endif @if($po->shipping_to_gstin)
GSTIN: {{ $po->shipping_to_gstin }}
@endif @if($po->shipping_to_gst_state)
GST State: {{ $po->shipping_to_gst_state }}
@endif @if($po->shipping_to_cin)
CIN: {{ $po->shipping_to_cin }}
@endif @if($po->shipping_to_contact_person)
Contact: {{ $po->shipping_to_contact_person }}
@endif @if($po->shipping_to_email)
Email: {{ $po->shipping_to_email }}
@endif @if($po->shipping_to_phone)
Phone: {{ $po->shipping_to_phone }}
@endif
Billing From (Supplier)
{{ $billFromName }}
@if($po->billing_from_address)
{{ $po->billing_from_address }}
@endif @if($po->billing_from_gstin)
GSTIN: {{ $po->billing_from_gstin }}
@endif @if($po->billing_from_gst_state)
GST State: {{ $po->billing_from_gst_state }}
@endif @if($po->billing_from_cin)
CIN: {{ $po->billing_from_cin }}
@endif @if($po->billing_from_contact_person)
Contact: {{ $po->billing_from_contact_person }}
@endif @if($po->billing_from_email)
Email: {{ $po->billing_from_email }}
@endif @if($po->billing_from_phone)
Phone: {{ $po->billing_from_phone }}
@endif
Shipping From (Supplier)
{{ $shipFromName }}
@if($shipFromAddress)
{{ $shipFromAddress }}
@endif @if($shipFromGstin)
GSTIN: {{ $shipFromGstin }}
@endif @if($po->shipping_from_gst_state)
GST State: {{ $po->shipping_from_gst_state }}
@endif @if($po->shipping_from_cin)
CIN: {{ $po->shipping_from_cin }}
@endif @if($po->shipping_from_contact_person)
Contact: {{ $po->shipping_from_contact_person }}
@endif @if($po->shipping_from_email)
Email: {{ $po->shipping_from_email }}
@endif @if($po->shipping_from_phone)
Phone: {{ $po->shipping_from_phone }}
@endif
Order No. {{ $po->po_number ?? '-' }} Order Date {{ $po->po_date ? $po->po_date->format('M j, Y') : '-' }}
Document No. {{ $po->document_no ?? '-' }} Currency {{ $po->currency ?: '-' }}
Valid From {{ $po->valid_from ? $po->valid_from->format('M j, Y') : '-' }} Valid Till {{ $po->valid_till ? $po->valid_till->format('M j, Y') : '-' }}
Expected Delivery {{ $po->expected_delivery_date ? $po->expected_delivery_date->format('M j, Y') : '-' }} Payment Terms {{ $po->payment_terms ?: '-' }}
@if($po->items && $po->items->count() > 0) @forelse($po->items as $i => $item) @empty @endforelse
# Item / Description HSN/SAC UOM Qty Rate Discount Amount
{{ $i + 1 }} {{ $item->product }} @if($item->description) {{ $item->description }} @endif @if($item->sku) SKU: {{ $item->sku }} @endif {{ $item->hsn_sac ?? '-' }} {{ $item->unit ?? '-' }} {{ $fmt($item->quantity) }} {{ $money($item->unit_price) }} {{ $money($item->discount) }} {{ $money($item->total) }}
No items
@endif
@if((float) $po->discount_total != 0) @endif @if((float) $po->shipping_charges != 0) @endif @if((float) $po->shipping_tax_amount != 0) @endif @foreach($po->charges as $charge) @endforeach @if((float) $po->taxable_amount != 0) @endif @if((float) $po->cgst != 0) @endif @if((float) $po->sgst != 0) @endif @if((float) $po->igst != 0) @endif @if((float) $po->other_taxes != 0) @endif @if((float) $po->tcs != 0) @endif @if((float) $po->round_off != 0) @endif
Subtotal {{ $money($po->subtotal) }}
Discount - {{ $money($po->discount_total) }}
Shipping / Freight {{ $money($po->shipping_charges) }}
Shipping Tax{{ $po->shipping_tax_percent ? ' ('.$po->shipping_tax_percent.')' : '' }} {{ $money($po->shipping_tax_amount) }}
{{ $charge->label }} {{ $money($charge->amount) }}
Taxable Amount {{ $money($po->taxable_amount) }}
CGST{{ (float) $po->cgst_percent != 0 ? ' @ '.rtrim(rtrim(number_format((float) $po->cgst_percent, 2), '0'), '.').'%' : '' }} {{ $money($po->cgst) }}
SGST{{ (float) $po->sgst_percent != 0 ? ' @ '.rtrim(rtrim(number_format((float) $po->sgst_percent, 2), '0'), '.').'%' : '' }} {{ $money($po->sgst) }}
IGST{{ (float) $po->igst_percent != 0 ? ' @ '.rtrim(rtrim(number_format((float) $po->igst_percent, 2), '0'), '.').'%' : '' }} {{ $money($po->igst) }}
Other Taxes {{ $money($po->other_taxes) }}
TCS {{ $money($po->tcs) }}
Round Off {{ $money($po->round_off) }}
Net Amount {{ $money($po->grand_total) }}
@if($po->amount_in_words)
Amount in Words: {{ $po->amount_in_words }}
@endif @php $hasDelivery = $po->delivery_method || $po->delivery_location || $po->freight_terms || $po->packaging_requirements; $hasPayment = $po->payment_method || $po->bank_name || $po->bank_account_number; @endphp @if($hasDelivery || $hasPayment)
@if($hasDelivery) @php $deliveryRows = []; if ($po->delivery_method) { $deliveryRows[] = ['Method', $po->delivery_method]; } if ($po->delivery_location) { $deliveryRows[] = ['Location', $po->delivery_location]; } if ($po->freight_terms) { $deliveryRows[] = ['Freight Terms', $po->freight_terms]; } if ($po->packaging_requirements) { $deliveryRows[] = ['Packaging', $po->packaging_requirements]; } $deliveryPairs = array_chunk($deliveryRows, 2); @endphp

Delivery Terms

@foreach($deliveryPairs as $pair) @if(isset($pair[1])) @else @endif @endforeach
{{ $pair[0][0] }} {{ $pair[0][1] }}{{ $pair[1][0] }} {{ $pair[1][1] }}
@endif @if($hasPayment) @php $paymentRows = []; if ($po->payment_method) { $paymentRows[] = ['Method', $po->payment_method]; } if ($po->payment_terms) { $paymentRows[] = ['Terms', $po->payment_terms]; } if ($po->bank_name) { $paymentRows[] = ['Bank', $po->bank_name]; } if ($po->bank_account_name) { $paymentRows[] = ['Account Name', $po->bank_account_name]; } if ($po->bank_account_number) { $paymentRows[] = ['Account No.', $po->bank_account_number]; } if ($po->bank_ifsc_swift) { $paymentRows[] = ['IFSC/SWIFT', $po->bank_ifsc_swift]; } $paymentPairs = array_chunk($paymentRows, 2); @endphp

Payment Details

@foreach($paymentPairs as $pair) @if(isset($pair[1])) @else @endif @endforeach
{{ $pair[0][0] }} {{ $pair[0][1] }}{{ $pair[1][0] }} {{ $pair[1][1] }}
@endif
@endif @if($terms && $terms->count() > 0)

Terms & Conditions

@foreach($terms as $term)
{!! RichTextSanitizer::clean($term->term) !!}
@endforeach
@endif @if($po->notes)

Notes / Special Instructions

{{ $po->notes }}
@endif

Please confirm your acceptance of this purchase order by returning a signed copy.

Authorization

For {{ strtoupper($buyerName) }}
Prepared By (Name / Designation / Date)
Approved By (Name / Designation / Date)
Authorized Signature & Stamp
Supplier Acknowledgement
We acknowledge and accept the above Purchase Order and agree to supply the goods/services according to the stated terms.
Authorized Person (Name / Designation)
Signature & Stamp / Date
This is a computer-generated document and does not require a physical signature.