@extends('receipts.layout') {{-- A Reports Hub report as a printable document. A4 prints the on-screen layout (statements keep their own layout). On 80mm / 58mm thermal roll a table can't fit, so every row stacks: its text columns as a heading line, then each amount as a "label … value" line — the same rows and totals the Excel export carries. --}} @php $money = fn ($n) => $n === null || $n === '' ? '' : (((float) $n < 0 ? '(' : '') . number_format(abs((float) $n), 2) . ((float) $n < 0 ? ')' : '')); $isAmount = fn ($col) => !empty($col['money']) || ($col['align'] ?? '') === 'right'; $textCols = collect($result->columns)->reject($isAmount)->values(); $amountCols = collect($result->columns)->filter($isAmount)->values(); $cell = function ($col, $value) use ($money) { if (!empty($col['money'])) { return $money($value); } return !empty($col['pill']) ? ucfirst((string) $value) : (string) $value; }; $label = fn ($col) => trim(preg_replace('/\s*\(₦\)\s*$/u', '', $col['label'])); @endphp @push('styles') @endpush @section('body')
Scope{{ $filters->scope() }}
Report{{ $result->subtitle }}
@if ($result->stats)
@foreach ($result->stats as $s) @if ($slip)
{{ $s['label'] }}{{ $s['value'] }}
@else
{{ $s['label'] }}
{{ $s['value'] }}
@if (!empty($s['hint']))
{{ $s['hint'] }}
@endif
@endif @endforeach
@endif @if ($result->note)

{{ $result->note }}

@endif @if ($slip) @forelse ($result->rows as $row)
{{ $textCols->map(fn ($c) => $cell($c, $row[$c['key']] ?? ''))->filter(fn ($v) => $v !== '')->implode(' · ') ?: '—' }}
@foreach ($amountCols as $c) @php $v = $row[$c['key']] ?? null; @endphp @if ($v !== null && $v !== '')
{{ $label($c) }}{{ $cell($c, $v) }}
@endif @endforeach
@empty

Nothing to report for this selection.

@endforelse @if ($result->totals && $result->rows)
{{ $textCols->map(fn ($c) => $result->totals[$c['key']] ?? '')->filter()->implode(' ') ?: 'Totals' }}
@foreach ($amountCols as $c) @if (array_key_exists($c['key'], $result->totals))
{{ $label($c) }}{{ $cell($c, $result->totals[$c['key']]) }}
@endif @endforeach
@endif @else
@include($result->view ?? 'reports.partials.table', ['result' => $result, 'money' => $money] + $result->data)
@endif

Amounts in Naira; brackets denote negatives.

@endsection @section('footer') {{ $report::LABEL }} — {{ $company->company_name ?? '' }} @endsection