@php use Illuminate\Support\Str; @endphp {{ Str::title(str_replace('_', ' ', $document->type)) }} - {{ $document->document_number }} @if(!empty($preview))
Download PDF
@endif
@if(isset($isReprint) && $isReprint) COPY - {{ Str::title(str_replace('_', ' ', $document->type)) }} @else {{ Str::title(str_replace('_', ' ', $document->type)) }} @endif
Company Information
@if($company && $company->logo_path) Company Logo @endif
Name:{{ $company->company_name }}
Address:{{ $company->address }}
Tel No:{{ $company->phone }}
Email:{{ $company->email }}
VAT No:{{ $company->vat_no }}
TIN No:{{ $company->tax_id }}
Currency:{{ $document->currency_code }}
Customer Information
Customer Name:{{ $document->customer->customer_account ?? '—' }}
Customer Address:{{ $document->customer->address ?? '—' }}
Customer Email:{{ $document->customer->email ?? '—' }}
Customer Phone:{{ $document->customer->contact_1 ?? '—' }}
Customer Contact Person:{{ $document->contact_person }}
Customer City:{{ $document->customer->city ?? '—' }}
Customer Province:{{ $document->customer->province ?? '—' }}
Customer VAT:{{ $document->customer->vat }}
Customer TIN:{{ $document->customer->tin }}
{{ Str::title(str_replace('_', ' ', $document->type)) }} #: {{ $document->document_number }}
Order #: {{ $document->order_number }}
@if($document->type === 'invoice')
Due Date: {{ $document->due_date->format('d M Y') }}
@endif
Order Date: {{ $document->document_date->format('d M Y') }}
Delivery Date: {{ $document->delivery_date->format('d M Y') }}
@if($document->type === 'invoice')
Delivery Note #: DN-{{ substr($document->document_number, 3) }}
@endif
@foreach($document->lines as $line) @endforeach
HS Code Code Description Additional Description Qty UOM Price (Incl) Disc % Tax Total (Incl)
{{ $line->hs_code }} @if($line->module === 'GL') {{ optional($line->account)->code }} @else {{ optional($line->item)->code }} @endif @if($line->module === 'GL') {{ optional($line->account)->account_name }} @else {{ optional($line->item)->description1 }} @endif {{ $line->description }} {{ $line->confirmed_quantity }} {{ optional($line->uom)->description ?? '' }} {{ number_format($line->price, 2) }} {{ number_format($line->discount_percent, 2) }}% {{ number_format($line->line_tax, 2) }} {{ number_format($line->line_total, 2) }}
Received by: ______________________________
Date: ______________________________
Signed: ______________________________
Exclusive Total: {{ optional($document->currency)->symbol ?? $document->currency_code }} {{ number_format($document->exclusive_total, 2) }}
Tax: {{ optional($document->currency)->symbol ?? $document->currency_code }} {{ number_format($document->tax_amount, 2) }}
Discount: {{ optional($document->currency)->symbol ?? $document->currency_code }} {{ number_format($document->discount_total, 2) }}
Inclusive Total: {{ optional($document->currency)->symbol ?? $document->currency_code }} {{ number_format($document->inclusive_total, 2) }}

Terms & Conditions
{{ $document->customer->term ?? $document->notes ?? 'No terms provided' }}
Sales Representative: ______________________________
Banking Details
@php $bankDetails = $company->bank_details ?? []; @endphp @forelse($bankDetails as $bank)
Bank Name: {{ $bank['bank_name'] ?? '' }}
Account Name: {{ $bank['account_name'] ?? '' }}
Account Number: {{ $bank['account_number'] ?? '' }}
Branch: {{ $bank['branch'] ?? '' }}

@empty
No banking details available
@endforelse
@inject('linkService', 'App\Services\DocumentLinkService') @php $incomingLinks = $linkService->getLinkedFrom($document->id, $document->type); $outgoingLinks = $linkService->getLinkedTo($document->id, $document->type); @endphp @if($incomingLinks->isNotEmpty() || $outgoingLinks->isNotEmpty())
Document Flow & Links
@if($incomingLinks->isNotEmpty())
Parent / Source Documents
@foreach($incomingLinks as $link) @php $parent = $linkService->resolveModel($link->source_id, $link->source_type); $parentUrl = null; if ($parent) { if (in_array($link->source_type, ['receipt'])) { $parentUrl = route('receipts.create'); } elseif (in_array($link->source_type, ['purchase_order', 'goods_received', 'sales_invoice', 'returns_debit'])) { $parentUrl = route('supplier.documents.pdf', $parent->id); } else { $parentUrl = route('documents.pdf', $parent->id); } } @endphp @if($parent) {{ str_replace('_', ' ', $link->source_type) }} #{{ $parent->document_number ?? $parent->receipt_number ?? $parent->id }} @endif @endforeach
@endif @if($incomingLinks->isNotEmpty() && $outgoingLinks->isNotEmpty())
@endif @if($outgoingLinks->isNotEmpty())
Child / Converted Documents
@foreach($outgoingLinks as $link) @php $child = $linkService->resolveModel($link->target_id, $link->target_type); $childUrl = null; if ($child) { if (in_array($link->target_type, ['receipt'])) { $childUrl = route('receipts.create'); } elseif (in_array($link->target_type, ['purchase_order', 'goods_received', 'sales_invoice', 'returns_debit'])) { $childUrl = route('supplier.documents.pdf', $child->id); } else { $childUrl = route('documents.pdf', $child->id); } } @endphp @if($child) {{ str_replace('_', ' ', $link->target_type) }} #{{ $child->document_number ?? $child->receipt_number ?? $child->id }} @endif @endforeach
@endif
@endif