@extends('layouts.app', ['title' => 'Eingangsrechnung | ' . $invoice->invoice_nr]) @section('content') {{-- ── Modal: Kostenstelle ─────────────────────────────────────────── --}} {{-- ── Modal: Zahlungsdaten ────────────────────────────────────────── --}} {{-- ── Modal: Konto ────────────────────────────────────────────────── --}} {{-- ── Modal: Neue Mahnung ─────────────────────────────────────────── --}} {{-- ── Modal: Mahnung löschen ──────────────────────────────────────── --}} {{-- ── Modal: Neuer Zahlungsausgang ────────────────────────────────── --}} {{-- ── Modal: Zahlung löschen ──────────────────────────────────────── --}} {{-- ══════════════════════════════════════════════════════════════════ --}}
{{-- ── Header ──────────────────────────────────────────────────── --}}
Zurück

{{ $invoice->invoice_nr }}

{{ $invoice->supplier->name }}
@if ($previous_invoice) Vorherige @endif @if ($next_invoice) Nächste @endif
{{-- ── Workflow-Banner ──────────────────────────────────────────── --}}
{{-- Zurückgabe --}} @if (Auth::user()->get_employee->is_mgt || (Auth::user()->get_employee->is_mgr && $invoice->fk_department_id == Auth::user()->get_employee->get_department->department_id)) @if ($invoice->current_phase > 1 && $invoice->fk_invoice_status_id < '3' && $wfPrevStation)
@csrf
@endif @endif {{-- Aktueller Stand --}} @if ($invoice->fk_invoice_status_id == '4' || $invoice->fk_invoice_status_id == '3') Abgeschlossen: {{ $invoice->get_current_department->name }} @else Aktuell in: {{ $invoice->get_current_department?->name ?? 'N/A' }} @endif {{-- Aufgabe --}}
@if ($invoice->fk_invoice_status_id != '4' && $wfCurrentStation) Aufgabe: {{ $wfCurrentStation->aufgabe ?? '—' }} @endif
{{-- Weiter --}} @if (Auth::user()->get_employee->employee_id == '15' || Auth::user()->get_employee->is_mgt || (Auth::user()->get_employee->is_mgr && $invoice->fk_department_id == Auth::user()->get_employee->get_department->department_id)) @if ($invoice->fk_invoice_status_id <= '2') @if (!$wfNextStation) Workflow abgeschlossen @else
@csrf
@endif @endif @endif
{{-- ── Status-Zeile ─────────────────────────────────────────────── --}} @if (Auth::user()->get_employee->is_mgt || Auth::user()->get_employee->is_acc)
Hauptstatus
@foreach ($status_in_com as $sc)
@csrf
@endforeach
Status in Abteilung ({{ $invoice->get_current_department?->name ?? '—' }})
@php $depStatuses = [ ['id' => 1, 'label' => 'unbearbeitet', 'color' => 'secondary'], ['id' => 2, 'label' => 'in Bearbeitung', 'color' => 'primary'], ['id' => 3, 'label' => 'wartet auf Rückmeldung','color' => 'warning'], ]; @endphp @foreach ($depStatuses as $ds)
@csrf
@endforeach
@endif {{-- ── Hauptinhalt ──────────────────────────────────────────────── --}}
{{-- ── Links: Rechnungsdetails ─────────────────────────────── --}}
{{-- Tabs --}}
{{-- Tab 1: Rechnungsdaten --}}
{{-- Stammdaten --}}
{{ $invoice->supplier->name }}
{{ $invoice->invoice_nr }}
{{ !empty($invoice->invoice_date) ? date('d.m.Y', strtotime($invoice->invoice_date)) : '—' }}
{{ date('d.m.Y', strtotime($invoice->income_date)) }}
{{ date('d.m.Y', strtotime($invoice->expiry_date)) }}
@switch($invoice->is_prepayment) @case(1) VORKASSE @break @case(2) Gutschrift @break @case(0) NACH ERHALT @break @case(3) Sofort Barkasse @break @default Unbekannt @endswitch
{{ $invoice->title }}
@if ($invoice->info)
{{ $invoice->info }}
@endif
{{-- Beträge --}}
Netto {{ number_format($invoice->subtotal, 2, ',', '.') }} €
MwSt. {{ $invoice->tax_percent * 100 }}% {{ number_format($invoice->tax, 2, ',', '.') }} €
Brutto {{ number_format($invoice->total, 2, ',', '.') }} €
@if ($invoice->get_warning->count() > 0)
Mahngebühren +{{ number_format($invoice->get_warning->sum('total'), 2, ',', '.') }} €
Gesamt {{ number_format($invoice->total + $invoice->get_warning->sum('total'), 2, ',', '.') }} €
@endif @if ($invoice->get_payments->count() > 0)
Zahlungen −{{ number_format($invoice->get_payments->sum('amount'), 2, ',', '.') }} €
Offen {{ number_format($invoice->total + $invoice->get_warning->sum('total') - $invoice->get_payments->sum('amount'), 2, ',', '.') }} €
@endif
{{-- Kostenstelle --}}
Kostenstelle
@if (isset($invoice->get_cost_center)) {{ $invoice->get_cost_center->old_number ?? $invoice->get_cost_center->number }} – {{ $invoice->get_cost_center->name }} @else nicht zugewiesen @endif
{{-- Buchhaltung --}} @if ($invoice->fk_invoice_status_id == '2' || $invoice->fk_invoice_status_id == '3' || ($invoice->fk_invoice_status_id == '1' && $invoice->fk_status_in_department_id == '2'))
Buchhaltung
Bezahlt am
@if (Auth::user()->get_employee->is_acc) @endif {{ $invoice->paid_date ? date('d.m.Y', strtotime($invoice->paid_date)) : 'noch unbezahlt' }}
Bezahlt mit
@if ($invoice->paid_date) {{ $invoice->get_payment_method?->name ?? $invoice->paid_with ?? '—' }} @else — @endif
Konto
@if (Auth::user()->get_employee->is_acc) @endif {{ $invoice->fk_konto_id ? $invoice->konto->konto . ' – ' . $invoice->konto->name : '—' }}
@endif
{{-- Inline-Mahnungsvorschau --}} @if ($invoice->get_warning->count() > 0)
Mahnungen
@foreach ($invoice->get_warning as $witem) @endforeach
# Eingangsdatum Frist bis Mahngebühr
{{ $witem->number }} {{ date('d.m.Y', strtotime($witem->income_date)) }} {{ date('d.m.Y', strtotime($witem->expiry_date)) }} {{ number_format($witem->total, 2, ',', '.') }} €
@endif {{-- Inline-Zahlungsvorschau --}} @if ($invoice->get_payments->count() > 0)
Zahlungsausgänge
@foreach ($invoice->get_payments as $pitem) @endforeach
# Betrag Datum Methode Notiz
{{ $pitem->id }} {{ number_format($pitem->amount, 2, ',', '.') }} € {{ date('d.m.Y', strtotime($pitem->payment_date)) }} {{ $pitem->get_payment_method->name }} {{ $pitem->note }}
@endif
{{-- Tab 2: Mahnungen --}}
@if (Auth::user()->get_employee->is_mgt || Auth::user()->get_employee->is_sec)
@endif @if ($invoice->get_warning->count() > 0)
@foreach ($invoice->get_warning as $witem) @endforeach
# Eingangsdatum Frist bis Mahngebühr PDF
{{ $witem->number }} {{ date('d.m.Y', strtotime($witem->income_date)) }} {{ date('d.m.Y', strtotime($witem->expiry_date)) }} {{ number_format($witem->total, 2, ',', '.') }} € {{ $witem->number }}-Mahnung
@else
Keine Mahnungen
@endif
{{-- Tab 3: Zahlungsausgänge --}}
@if (Auth::user()->get_employee->is_mgt || Auth::user()->get_employee->is_sec || Auth::user()->get_employee->is_acc)
@endif @if ($invoice->get_payments->count() > 0)
@foreach ($invoice->get_payments as $pitem) @endforeach
# Betrag Datum Methode Notiz
{{ $pitem->id }} {{ number_format($pitem->amount, 2, ',', '.') }} € {{ date('d.m.Y', strtotime($pitem->payment_date)) }} {{ $pitem->get_payment_method->name }} {{ $pitem->note }}
Summe {{ number_format($invoice->get_payments->sum('amount'), 2, ',', '.') }} €
@else
Keine Zahlungsausgänge
@endif
{{-- Tab 4: PDF --}}
{{-- ── Rechts: Timeline ────────────────────────────────────── --}}
@if ($invoice->id != 6)
@csrf
@foreach([ ['4','notes','bi-info-square-fill','Info','text-info'], ['0','call','bi-telephone-fill','Anruf','text-success'], ['1','mail','bi-envelope-fill','E-Mail','text-primary'], ['2','poste','bi-mailbox2','Post','text-secondary'], ['3','personally','bi-people-fill','Persönlich','text-warning'], ] as [$val,$rid,$ico,$lbl,$col]) @endforeach

@endif {{-- Filter --}}
Filter: @foreach([ ['0','all','bi-list-ul','Alle'], ['1','fnotes','bi-info-square-fill','Info'], ['2','fcall','bi-telephone-fill','Anruf'], ['3','fmail','bi-envelope-fill','E-Mail'], ['4','fposte','bi-mailbox2','Post'], ['5','fpersonally','bi-people-fill','Person'], ] as [$val,$fid,$ico,$lbl]) @endforeach
{{-- Einträge --}} @forelse($invoice->timelines->sortByDesc('created_at') as $tt) @if($tt->is_event or $tt->is_email or $tt->is_note or $tt->is_call or $tt->is_post or $tt->is_personally) @php $isEvent = (bool) $tt->is_event; $isNote = $tt->is_note && !$tt->is_event; $isCall = (bool) $tt->is_call; $isEmail = (bool) $tt->is_email; $isPost = (bool) $tt->is_post; $isPersonally = (bool) $tt->is_personally; if ($isEvent) { $tlIcon = 'bi-robot'; $tlColor = '#6c757d'; } elseif ($isNote) { $tlIcon = 'bi-info-square-fill'; $tlColor = '#0dcaf0'; } elseif ($isCall) { $tlIcon = 'bi-telephone-fill'; $tlColor = '#198754'; } elseif ($isEmail) { $tlIcon = 'bi-envelope-fill'; $tlColor = '#0d6efd'; } elseif ($isPost) { $tlIcon = 'bi-mailbox2'; $tlColor = '#6c757d'; } else { $tlIcon = 'bi-people-fill'; $tlColor = '#ffc107'; } @endphp
{{ $tt->created_at ? \Carbon\Carbon::parse($tt->created_at)->format('d.m.Y - H:i') : '—' }}
{!! $tt->event_msg !!}
{{ $tt->get_employee?->first_name }} {{ $tt->get_employee?->last_name }}
@endif @empty
Noch keine Einträge.
@endforelse
@endsection