@extends('pdf.layout') @section('content') @php $rows = $products->getCollection(); $n = fn ($v) => rtrim(rtrim(number_format((float) $v, 2), '0'), '.') ?: '0'; @endphp

Opening / closing: stock when the register was opened and closed on {{ $day->format('d M Y') }} (without a register that day: at the start and end of the day). "est." = worked out from the stock history.

@if($rows->count()) @foreach($rows as $p) @php $ds = $dayStock[$p->id] ?? null; @endphp @foreach(['opening', 'closing'] as $when) @endforeach @endforeach
ProductCategorySelling price OpeningClosingCurrent stock Total soldTotal purchasedLast sold
{{ $p->name }}
{{ $p->sku }}
{{ $p->category->name ?? '-' }} {{ number_format((float) $p->selling_price, 2) }}@if($ds && $ds[$when] !== null){{ $n($ds[$when]) }}@if($ds[$when . '_estimated']) est.@endif @else - @endif{{ $n($p->current_stock) }} {{ $p->unit->short_name ?? '' }} {{ $n($p->total_sold ?? 0) }} {{ $n(($p->total_purchased ?? 0) + ($p->total_stock_in ?? 0)) }} {{ $p->last_sold_at ? \Carbon\Carbon::parse($p->last_sold_at)->format('d M Y') : '-' }}
@else
No products match this search.
@endif @endsection