@extends('layouts.portal') @section('title', $document->document_number ?? __('Supplier Invoice')) @push('styles') @include('accounting.journal._styles') @endpush @section('content')
@include('partials.portal-header')

{{ __('Supplier Invoice') }} {{ $document->document_number }}

{{ __(ucfirst($document->status)) }}

{{ __('Back to list') }} @if($document->isDraft()) {{ __('Edit') }}
@csrf
@csrf @method('DELETE')
@elseif($document->isPosted())
@csrf
@endif
@if(session('success'))
{{ session('success') }}
@endif @if($inventoryWarnings !== [])
{{ __('Important inventory information is missing.') }}
    @foreach($inventoryWarnings as $warning)
  • {{ $warning }}
  • @endforeach
{{ __('These details are recommended but will not prevent saving the invoice.') }}
@endif @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
{{ __('Supplier') }}
{{ $document->person?->first_name }} {{ $document->person?->last_name }}
{{ __('Date') }}
{{ $document->document_date->format('Y-m-d') }}
{{ __('Due date') }}
{{ $document->due_date?->format('Y-m-d') ?? '—' }}
{{ __('Payment term') }}
{{ $document->paymentTerm?->name ?? '—' }}
{{ __('Reference') }}
{{ $document->reference ?? '—' }}
{{ __('Project') }}
{{ $document->project ? $document->project->code.' — '.$document->project->name : '—' }}
{{ __('Warehouse') }}
{{ $warehouse ? $warehouse->code.' — '.$warehouse->name : '—' }}
{{ __('Paid') }}
{{ number_format((float) $document->amount_paid, 2) }}
@if($document->journalEntry)
{{ __('Journal entry') }}
{{ $document->journalEntry->display_number }} @if($document->journalEntry->reversal) · {{ __('Reversed by') }} {{ $document->journalEntry->reversal->display_number }} @endif
@endif @if($document->quick_payment_amount)
{{ __('Immediate payment plan') }}
@if($document->quickPaymentMethod) {{ __('Amount :amount via :method', ['amount' => number_format((float) $document->quick_payment_amount, 2), 'method' => $document->quickPaymentMethod->name]) }} @elseif($document->quickPaidBy) {{ __('Amount :amount paid personally by :employee', ['amount' => number_format((float) $document->quick_payment_amount, 2), 'employee' => $document->quickPaidBy->first_name.' '.$document->quickPaidBy->last_name]) }} @endif
@endif @if($document->notes)
{{ __('Notes') }}
{{ $document->notes }}
@endif
@foreach($document->lines as $line) @endforeach
# {{ __('Line type') }} {{ __('Item / account') }} {{ __('Description') }} {{ __('Project') }} {{ __('Shelf / location') }} {{ __('Lot / expiry') }} {{ __('Quantity') }} {{ __('Base quantity') }} {{ __('Unit price') }} {{ __('Discount %') }} {{ __('Total') }}
{{ $line->line_number }} {{ $line->line_type === 'item' ? __('Item') : ($line->purchaseConcept ? __('Concept') : __('Account')) }} @if($line->line_type === 'item') {{ $line->item?->sku }} — {{ $line->item?->name }} @elseif($line->purchaseConcept) {{ $line->purchaseConcept->name }}
{{ $line->account?->code }} — {{ $line->account?->name }}
@else {{ $line->account?->code }} — {{ $line->account?->name }} @endif
{{ $line->description }} {{ $line->project?->code }} {{ $line->location?->code ?? '—' }} {{ $line->lot_number ?? '—' }} @if($line->expires_on) {{ __('Expires') }} {{ $line->expires_on->format('Y-m-d') }} @endif {{ rtrim(rtrim(number_format((float) $line->quantity, 6, '.', ''), '0'), '.') }} {{ $line->unit?->code }} @if($line->base_quantity !== null) {{ rtrim(rtrim(number_format((float) $line->base_quantity, 4, '.', ''), '0'), '.') }} {{ $line->baseUnit?->code }} @else — @endif {{ number_format((float) $line->unit_price, 2) }} {{ number_format((float) $line->discount_pct, 2) }} {{ number_format((float) $line->line_total, 2) }}
{{ __('Total') }} {{ number_format((float) $document->total, 2) }}
@endsection