@extends('pdf.layout') @section('content') @php $rows = $products->getCollection(); $out = $rows->filter(fn ($p) => (float) $p->current_stock <= 0)->count(); @endphp
Products to reorder
{{ $rows->count() }}
Out of stock
{{ $out }}
Low (still some left)
{{ $rows->count() - $out }}
@if($rows->count()) @foreach($rows as $p) @php $stock = (float) $p->current_stock; @endphp @endforeach
SKUProductCategoryIn stockAlert atReorder at leastStatus
{{ $p->sku }} {{ $p->name }} {{ $p->category->name ?? '-' }} {{ rtrim(rtrim(number_format($stock, 2), '0'), '.') }} {{ $p->unit->short_name ?? '' }} {{ rtrim(rtrim(number_format($p->alertLevel(), 2), '0'), '.') }} {{ rtrim(rtrim(number_format(max(0, $p->alertLevel() - $stock), 2), '0'), '.') ?: '0' }} {{ $stock <= 0 ? 'Out of stock' : 'Low' }}

"Reorder at least" is how many are needed to get back up to the alert quantity.

@else
No products are low on stock.
@endif @endsection