@php $totalAmount = $trend->sum('total_amount'); $totalEntries = $trend->sum('entry_count'); $peakPeriod = $trend->sortByDesc('total_amount')->first(); $maxVal = $trend->max('total_amount'); @endphp {{-- Stat cards --}}
Total in Range
{{ number_format($totalAmount, 2) }}
{{ $trend->count() }} {{ $groupBy }} periods
Peak Period
{{ $peakPeriod?->period ?? '—' }}
{{ number_format($peakPeriod?->total_amount ?? 0, 2) }}
Avg per Period
{{ $trend->count() > 0 ? number_format($totalAmount / $trend->count(), 2) : '0.00' }}
{{ ucfirst($groupBy) }} average
Total Entries
{{ number_format($totalEntries) }}
expense records
Expense Trend — {{ ucfirst($groupBy) }} View {{ $trend->count() }} periods
@if($trend->isEmpty())
No trend data found.
@else @foreach($trend as $row) @php $pct = $maxVal > 0 ? round($row->total_amount / $maxVal * 100, 1) : 0; @endphp @endforeach
Period Summaries Entries Avg per Entry Total Amount vs Peak
{{ $row->period }} {{ number_format($row->summary_count) }} {{ number_format($row->entry_count) }} {{ $row->entry_count > 0 ? number_format($row->total_amount / $row->entry_count, 2) : '0.00' }} {{ number_format($row->total_amount, 2) }}
{{ $pct }}%
Total {{ number_format($totalAmount, 2) }}
@endif