@extends('admin.layouts.inventory') @section('title', $dispatch->document_number) @section('content') @php $statusValue = $dispatch->status?->value ?? $dispatch->status; $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; @endphp
No line items on this dispatch.
@else| # | SKU / Item | Batch | Qty | Unit | @if ($hasPricing)Unit price | @if ($showLineTax)GST / Tax | Tax amount | @endifLine total | @endif
|---|---|---|---|---|---|---|---|---|
| {{ $line->line_number }} |
{{ $line->sku?->sku_code }}
{{ $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 ?? '—' }} | @if ($hasPricing){{ $line->unit_price !== null ? number_format((float) $line->unit_price, 2) : '—' }} | @if ($showLineTax)@if ($line->tax) {{ $line->tax->name }} ({{ $line->tax->rate }}%) @else — @endif | {{ $line->tax_amount !== null ? number_format((float) $line->tax_amount, 2) : '—' }} | @endif{{ $total !== null ? number_format($total, 2) : '—' }} | @endif