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

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

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

{{ __('New sale') }} {{ __('Back to list') }} @if($document->isPosted())
@csrf
@endif
@if(session('success'))
{{ session('success') }}
@endif @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
{{ __('Customer') }}
{{ $document->person?->first_name }} {{ $document->person?->last_name }}
{{ __('Date') }}
{{ $document->document_date->format('Y-m-d') }}
{{ __('Payment') }}
{{ $document->quickPaymentMethod?->name ?? __('Credit') }}{{ $document->paymentTerm ? ' · '.$document->paymentTerm->name : '' }}
{{ __('Due date') }}
{{ $document->due_date?->format('Y-m-d') ?? '—' }}
{{ __('Warehouse') }}
{{ $warehouse ? $warehouse->code.' — '.$warehouse->name : '—' }}
{{ __('Paid') }}
{{ number_format((float) $document->amount_paid, 2) }}
@if($document->reference)
{{ __('Reference') }}
{{ $document->reference }}
@endif @if($document->journalEntry) @endif @if($document->notes)
{{ __('Notes') }}
{{ $document->notes }}
@endif
@foreach($document->lines as $line) @php($lot = $line->lot_id ? $lots->get($line->lot_id) : null) @endforeach
# {{ __('Product / concept') }} {{ __('Lot / expiry') }} {{ __('Quantity') }} {{ __('Unit price') }} {{ __('Discount %') }} {{ __('Total') }}
{{ $line->line_number }} @if($line->line_type === 'item') {{ $line->item?->name }} {{ $line->item?->sku }} @else {{ $line->salesConcept?->name ?? $line->description }} @endif @if($line->description && $line->description !== $line->item?->name && $line->description !== $line->salesConcept?->name)
{{ $line->description }}
@endif
{{ $lot?->lot_number ?? $line->lot_number ?? '—' }} @if($lot?->expires_on) {{ __('Expires') }} {{ substr((string) $lot->expires_on, 0, 10) }} @endif {{ rtrim(rtrim(number_format((float) $line->quantity, 6, '.', ''), '0'), '.') }} {{ $line->unit?->code }} {{ 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