@extends('admin.layouts.inventory') @section('title', $goodsReceipt->document_number) @section('content') @php $statusValue = $goodsReceipt->status?->value ?? $goodsReceipt->status; $useAverageGst = (bool) $goodsReceipt->use_average_gst; $totals = \App\Support\InventoryDocumentTotals::for($goodsReceipt, 'sell'); $unitPrice = fn ($line) => $line->site_unit_price !== null ? (float) $line->site_unit_price : null; $lineTotal = fn ($line) => $unitPrice($line) !== null ? (float) $line->qty * $unitPrice($line) : null; $hasPricing = $goodsReceipt->lines->contains(fn ($line) => $line->site_unit_price !== null); $hasTax = $useAverageGst || $goodsReceipt->lines->contains(fn ($line) => $line->tax_id || $line->tax); $showLineTax = $hasTax && ! $useAverageGst; @endphp
@include('admin.inventory.partials.document_show_header', [ 'title' => $goodsReceipt->document_number, 'subtitle' => 'Site dispatch (direct to site)', 'back' => route('admin.inventory.dispatches.index'), 'backLabel' => 'Back to list', 'status' => $goodsReceipt->status, 'actions' => $statusValue === 'completed' ? 'Download PDF' : null, ])
Destination project {{ $goodsReceipt->project?->customer_name ?? '—' }} @if ($goodsReceipt->project?->assignedUser?->name) ({{ $goodsReceipt->project->assignedUser->name }}) @endif
Type Direct to site
Supplier {{ $goodsReceipt->supplier?->name ?? '—' }}
Transaction date {{ $goodsReceipt->transaction_date?->format('d M Y') ?? '—' }}
Effective date {{ $goodsReceipt->effective_date?->format('d M Y') ?? '—' }}
@if ($useAverageGst)
GST method Average GST ({{ number_format((float) $goodsReceipt->average_gst_rate, 2) }}%)
@endif
@if ($goodsReceipt->remarks)
Remarks

{{ $goodsReceipt->remarks }}

@endif

Line items

{{ $goodsReceipt->lines->count() }} {{ str('item')->plural($goodsReceipt->lines->count()) }}
@if ($goodsReceipt->lines->isEmpty())

No line items on this dispatch.

@else
@if ($hasPricing) @if ($showLineTax) @endif @endif @foreach ($goodsReceipt->lines as $line) @php $item = $line->sku?->variant?->item; $price = $unitPrice($line); $total = $lineTotal($line); $lineTax = ($total !== null && $line->tax) ? round($total * ((float) $line->tax->rate / 100), 2) : null; @endphp @if ($hasPricing) @if ($showLineTax) @endif @endif @endforeach
# SKU / Item Batch Qty UnitUnit priceGST / Tax Tax amountLine total
{{ $line->line_number }}
{{ $line->sku?->sku_code }}
@if ($item)
{{ $item->name }} @if ($line->sku?->variant?->variant) — {{ $line->sku->variant->variant }} @endif
@endif
{{ $line->batch_no ?: '—' }} @qty($line->qty) {{ $line->unit?->symbol ?? $line->unit?->name ?? '—' }}{{ $price !== null ? number_format($price, 2) : '—' }} @if ($line->tax) {{ $line->tax->name }} ({{ $line->tax->rate }}%) @else — @endif {{ $lineTax !== null ? number_format($lineTax, 2) : '—' }}{{ $total !== null ? number_format($total, 2) : '—' }}
@if ($hasPricing && ($totals['gross'] > 0 || $totals['tax'] > 0))
Subtotal (taxable) ₹{{ number_format($totals['gross'], 2) }}
@if ($hasTax && $totals['tax'] > 0)
@if ($useAverageGst) Average GST {{ number_format((float) $goodsReceipt->average_gst_rate, 2) }}% @else GST / Tax @endif ₹{{ number_format($totals['tax'], 2) }}
@endif
Grand total ₹{{ number_format($totals['total'], 2) }}
@endif @endif
@endsection