@extends('layouts.app', ['title' => 'Rechnung ' . $invoice->invoice_nr]) @section('content')
{{-- Header --}}
Zum Auftrag {{ $order->order_nr }} {{ $invoice->type_labal }} {{ $invoice->status_label }}

{{ $invoice->invoice_nr }}

{{ $order->title }}
@if($invoice->pdf_dms_file_id) PDF herunterladen @endif @if($invoice->storno_pdf_dms_file_id) @endif @if($invoice->status === 'festgeschrieben') @endif
@if(session('success'))
{{ session('success') }}
@endif
{{-- Positionen (read-only) --}}
POSITIONEN
@foreach($invoice->positions as $pos) @include('pms.invoices._show_row', ['pos' => $pos, 'level' => 0, 'nr' => $loop->iteration]) @endforeach
Bezeichnung Menge Einzel € Gesamt €
{{-- Summen --}}
Nettobetrag {{ number_format($invoice->subtotal, 2, ',', '.') }} €
MwSt. {{ $invoice->vat_rate }}% {{ number_format($invoice->vat_amount, 2, ',', '.') }} €

Gesamtbetrag {{ number_format($invoice->total, 2, ',', '.') }} €
@if($invoice->type === 'schluss') @php $abzug = \App\Models\PmsInvoice::where('fk_order_id', $invoice->fk_order_id) ->where('type', 'abschlag')->where('status', 'festgeschrieben') ->where('is_deleted', 0)->sum('total'); @endphp @if($abzug > 0)
Abzügl. Abschläge – {{ number_format($abzug, 2, ',', '.') }} €
Zahlbetrag {{ number_format(max(0, $invoice->total - $abzug), 2, ',', '.') }} €
@endif @endif
{{-- Rechnungsdaten --}}
Rechnungsdaten
Rechnungsdatum
{{ $invoice->invoice_date ? \Carbon\Carbon::parse($invoice->invoice_date)->format('d.m.Y') : '—' }}
Fällig am
{{ $invoice->due_date ? \Carbon\Carbon::parse($invoice->due_date)->format('d.m.Y') : '—' }}
@if($invoice->payment_method)
Zahlungsmethode
{{ $invoice->payment_method->name }}
@endif @if($invoice->bank_account)
Bankkonto
{{ $invoice->bank_account->bank_name }}
{{ $invoice->bank_account->iban }}
@endif
{{-- Status-Karte --}} @if($invoice->status === 'festgeschrieben')
Festgeschrieben und gesperrt.
Zum Stornieren: Button oben rechts.
@elseif($invoice->status === 'storniert')
Storniert
Eine neue Rechnung für diesen Auftrag kann jetzt erstellt werden.
@endif
{{-- PDF-Vorschau-Modal --}} {{-- Storno-Bestätigungs-Modal --}} @if($invoice->status === 'festgeschrieben') @endif @endsection