@php $useAverageGst = (bool) $dispatch->use_average_gst; $lineTotal = fn ($line) => $line->unit_price !== null ? (float) $line->qty * (float) $line->unit_price : null; $grandSubtotal = $dispatch->lines->sum(fn ($line) => $lineTotal($line) ?? 0); $grandTax = $useAverageGst ? (float) ($dispatch->average_gst_amount ?? 0) : $dispatch->lines->sum(fn ($line) => (float) ($line->tax_amount ?? 0)); $grandTotal = $grandSubtotal + $grandTax; $hasPricing = $dispatch->lines->contains(fn ($line) => $line->unit_price !== null); $hasTax = $useAverageGst || $dispatch->lines->contains(fn ($line) => $line->tax_id || $line->tax_amount); $showLineTax = $hasTax && ! $useAverageGst; $projectLabel = $dispatch->project?->customer_name ?? '—'; if ($dispatch->project?->assignedUser?->name) { $projectLabel .= ' ('.$dispatch->project->assignedUser->name.')'; } @endphp

{{ $tenant->name }}

@if ($tenant->email)

{{ $tenant->email }}@if($tenant->phone) · {{ $tenant->phone }}@endif

@endif
Site Dispatch — {{ $dispatch->document_number }}

Destination project

{{ $projectLabel }}

@if ($dispatch->projectRevision)

Revision: {{ $dispatch->projectRevision->document_number }}

@endif

Dispatch details

Status: {{ ucfirst($dispatch->status?->value ?? $dispatch->status) }}

Source warehouse: {{ $dispatch->sourceWarehouse?->name ?? '—' }}

Transaction date: {{ $dispatch->transaction_date?->format('d M Y') }}

Effective date: {{ $dispatch->effective_date?->format('d M Y') }}

@if ($useAverageGst)

GST method: Average GST ({{ number_format((float) $dispatch->average_gst_rate, 2) }}%)

@endif
@if ($hasPricing) @if ($showLineTax) @endif @endif @foreach ($dispatch->lines as $line) @php $total = $lineTotal($line); $item = $line->sku?->variant?->item; @endphp @if ($hasPricing) @if ($showLineTax) @endif @endif @endforeach
# SKU / Item Batch Qty UnitUnit priceGST TaxLine total
{{ $line->line_number }} {{ $line->sku?->sku_code }} @if ($item)
{{ $item->name }} @if ($line->sku?->variant?->variant) — {{ $line->sku->variant->variant }} @endif
@endif
@if ($line->batch) {{ $line->batch->batch_no ?: 'Batch #'.$line->batch->id }} @else — @endif @qty($line->qty) {{ $line->unit?->symbol ?? $line->unit?->name ?? '—' }}{{ $line->unit_price !== null ? number_format((float) $line->unit_price, 2) : '—' }} @if ($line->tax) {{ $line->tax->name }} ({{ $line->tax->rate }}%) @else — @endif {{ $line->tax_amount !== null ? number_format((float) $line->tax_amount, 2) : '—' }}{{ $total !== null ? number_format($total, 2) : '—' }}
@if ($hasPricing && ($grandSubtotal > 0 || $grandTax > 0)) @if ($hasTax && $grandTax > 0) @endif
Subtotal (taxable) ₹{{ number_format($grandSubtotal, 2) }}
@if ($useAverageGst) Average GST ({{ number_format((float) $dispatch->average_gst_rate, 2) }}%) @else GST / Tax @endif ₹{{ number_format($grandTax, 2) }}
Grand total ₹{{ number_format($grandTotal, 2) }}
@endif @if ($dispatch->remarks)

Remarks

{{ $dispatch->remarks }}

@endif