@component('mail::message') # Branch-direct valuation — week of {{ $weekStart }} to {{ $weekEnd }} @php $units = collect($groups)->sum(fn ($g) => collect($g['rows'])->sum(fn ($r) => (float) $r['quantity'])); @endphp @if (count($groups) === 0) No branch-direct stock this week — all inventory sits in warehouses. Nothing to review. @else **{{ count($groups) }} branch(es)** hold inventory directly: **{{ number_format((float) $totalCost, 2) }} at cost** ({{ number_format((float) $totalRetail, 2) }} at retail) across **{{ number_format((float) $units, 2) }} units**. @foreach ($groups as $group) ### BRANCH: {{ $group['branch']['name'] }} | Product | SKU | On hand | Cost value | Retail value | |-|-|-|-|-| @foreach ($group['rows'] as $r) | {{ \Illuminate\Support\Str::limit($r['name'], 40) }} | {{ $r['sku'] }} | {{ $r['quantity'] }} | {{ $r['cost_value'] }} | {{ $r['retail_value'] }} | @endforeach Subtotal — cost **{{ number_format((float) $group['cost_value'], 2) }}**, retail **{{ number_format((float) $group['retail_value'], 2) }}** @endforeach The full report is attached as a PDF on the company letterhead. Branch-direct figures reconcile with the Inventory Valuation report's Branch-direct buckets. @endif {{ config('app.name', 'ERP') }} — automated weekly finance digest @endcomponent