@php $nf0 = fn ($v) => number_format((float) $v, 0, ',', '.'); $nf2 = fn ($v) => number_format((float) $v, 2, ',', '.'); $bestellbar = $vorschlaege->where('order_quantity', '>', 0); $ohneBestand = $vorschlaege->where('order_quantity', '<=', 0); // Dringlichkeit analog Filial-Maske: Ausverkauft / unter Sicherheitsbestand / Nachbestellen. $dringlichkeit = function ($v) { if ($v->current_stock <= 0) return 'out'; if ($v->current_stock <= $v->safety_stock) return 'critical'; return 'reorder'; }; @endphp @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Kennzahlen --}}

Positionen

{{ $nf0($statistik['positionen']) }}

Stück gesamt

{{ $nf0($statistik['stueck']) }}

Lieferant ohne Bestand

{{ $nf0($statistik['gedeckelt']) }}

Bestand unbekannt

{{ $nf0($statistik['unbekannt']) }}

{{-- Werkzeugleiste: Status links, Sammelexport rechts --}}
Online-API {{ $online->isConfigured() ? 'verbunden' : 'fehlt' }} Historie {{ $historieTage }} Tage{{ $historieBis ? ' (Stand ' . \Illuminate\Support\Carbon::parse($historieBis)->format('d.m.') . ')' : '' }} @if($stand) Lauf vom {{ \Illuminate\Support\Carbon::parse($stand)->format('d.m.Y') }} @endif
@if($bestellbar->isNotEmpty())
Bestellung ExTrade – CSV @if($gesendet) ✓ Versendet {{ $gesendet->sent_at?->format('H:i') }} Uhr ({{ $nf0($gesendet->positions) }} Pos.) @elseif($apiBereit)
@csrf
@else @endif
@endif

Bestellt wird wöchentlich ({{ $bestelltag }}), Zielreichweite {{ $zielTage }} Tage. Bedarfsbasis: Onlineshop-Endkunden (Kassenbelege und Filialbestellungen herausgerechnet – Filialen bestellen ExTrade direkt). Rechenlauf jeden Dienstag 05:30, manuell per php artisan replenishment:central.

{{-- Beleg: ExTrade → Zentrallager --}} @if($stand && $bestellbar->isNotEmpty())
{{-- Belegkopf: klickbar zum Auf-/Zuklappen --}}

{{ $bestellbar->first()->supplier_name }}

Bestellung {{ $bestelltag }} · Empfänger: {{ $zentrallager ?: 'Lager 94' }}

{{ $bestellbar->count() }} Positionen · {{ $nf0($bestellbar->sum('order_quantity')) }} Stück

CSV
{{-- Positionen --}}
@foreach($bestellbar as $v) @endforeach
Artikel Bestand Dringlichkeit Meldebestand Bestellmenge

{{ $v->article_name }}

{{ $v->article_sku }}

{{ $nf0($v->current_stock) }} @if($dringlichkeit($v) === 'out') Ausverkauft @elseif($dringlichkeit($v) === 'critical') Unter Sicherheitsbest. @else Nachbestellen @endif @if($v->supplier_stock === null)

Bestand unbekannt

@elseif(!is_null($v->days_of_stock) && $v->days_of_stock > 0)

reicht ~{{ $nf0($v->days_of_stock) }} T

@endif
{{ $nf0($v->reorder_point) }} {{ $nf0($v->order_quantity) }} Detail
Summe {{ $nf0($bestellbar->sum('order_quantity')) }}
@endif {{-- Markierungen: Lieferant kann nicht liefern --}} @if($ohneBestand->isNotEmpty())
@foreach($ohneBestand as $v) @endforeach

{{ $v->article_name }}

{{ $v->article_sku }}

Bestand {{ $nf0($v->current_stock) }} Ø/Tag {{ $nf2($v->avg_daily_demand) }} {{ $v->failure_reason ?: 'Lieferant ohne Bestand' }} Detail
@endif @if(! $stand)
Noch kein Rechenlauf erfolgt. Die Berechnung läuft automatisch jeden Dienstag 05:30 – manuell per php artisan replenishment:central.
@elseif($bestellbar->isEmpty() && $ohneBestand->isEmpty())
Aktuell keine geplante Zentrallager-Bestellung – kein Artikel hat den Meldebestand erreicht.
@endif