@php // $preview = true renders the same template for an on-screen browser view // (logo by URL rather than base64, which dompdf needs inlined), keeping the // markup/CSS below the single source of truth for both outputs. $preview = $preview ?? false; $symbol = $currencySymbol ?: ''; $code = $order->currency_code ?: ''; $money = function ($value) use ($symbol, $code) { $formatted = number_format((float) $value, 2); return ($symbol !== '' ? $symbol . ' ' : ($code !== '' ? $code . ' ' : '')) . $formatted; }; $qty = fn ($value) => rtrim(rtrim(number_format((float) $value, 2), '0'), '.'); $logoData = null; if ($setting?->logo_path) { try { if ($preview) { $logoData = \Illuminate\Support\Facades\Storage::disk('public')->url($setting->logo_path); } else { $logoFull = \Illuminate\Support\Facades\Storage::disk('public')->path($setting->logo_path); if (is_file($logoFull)) { $logoData = 'data:' . (mime_content_type($logoFull) ?: 'image/png') . ';base64,' . base64_encode(file_get_contents($logoFull)); } } } catch (\Throwable $e) { $logoData = null; } } $companyName = $setting?->company_name ?: $order->team?->name; $supplier = $order->supplier; @endphp
|
{{ __('PURCHASE ORDER') }}
|
@if ($logoData)
@endif {{ $companyName }}
@if ($setting?->address){!! nl2br(e($setting->address)) !!} @endif @if ($setting?->phone){{ __('Phone') }}: {{ $setting->phone }} @endif @if ($setting?->email){{ __('Email') }}: {{ $setting->email }} @endif @if ($setting?->tin_number){{ __('TIN') }}: {{ $setting->tin_number }} @endif |
| {{ __('To') }} | {{ __('Ship To') }} | {{ __('P.O Number') }} |
|
{{ $supplier?->name ?: '—' }}
@if ($supplier?->contact_person){{ $supplier->contact_person }} @endif
@if ($supplier?->address){!! nl2br(e($supplier->address)) !!} @endif
@if ($supplier?->phone){{ __('Phone') }}: {{ $supplier->phone }} @endif
@if ($supplier?->email){{ __('Email') }}: {{ $supplier->email }} @endif
|
{{ $companyName }}
@if ($setting?->address){!! nl2br(e($setting->address)) !!} @endif
@if ($setting?->phone){{ __('Phone') }}: {{ $setting->phone }} @endif
@if ($setting?->email){{ __('Email') }}: {{ $setting->email }} @endif
|
{{ $order->po_number }}
{{ __('The P.O number must appear on all related correspondence, shipping papers and invoices.') }}
|
| {{ __('P.O Date') }} | {{ __('Requisitioner') }} | {{ __('Shipped Via') }} | {{ __('Expected') }} | {{ __('Terms') }} |
| {{ optional($order->order_date)->format('d M Y') ?: $order->created_at?->format('d M Y') }} | {{ $order->creator?->name ?: '—' }} | — | {{ optional($order->expected_date)->format('d M Y') ?: '—' }} | @if ($supplier?->payment_terms_days){{ __(':days days', ['days' => $supplier->payment_terms_days]) }}@else—@endif |
| {{ __('Qty') }} | {{ __('Unit') }} | {{ __('Description') }} | {{ __('Unit Price') }} | {{ __('Total') }} |
| {{ $qty($line->quantity) }} | {{ $line->variant?->material?->purchase_unit ?: $line->variant?->material?->base_unit ?: '—' }} | {{ $line->description ?: '—' }} | {{ $money($line->unit_price) }} | {{ $money($line->line_total) }} |
| {{ __('No items.') }} | ||||
{{ __('Notes') }}:
{{ $order->notes }} {{ __('Send all correspondence to:') }}
{{ $companyName }} @if ($setting?->address){!! nl2br(e($setting->address)) !!} @endif @if ($setting?->phone){{ $setting->phone }} @endif @if ($setting?->email){{ $setting->email }} @endif |
|
|
{{ __('Authorised by') }}@if ($order->approver) — {{ $order->approver->name }}@endif
|
{{ __('Date') }}@if ($order->approved_at) — {{ $order->approved_at->format('d M Y') }}@endif
|