Usage Reports Export CSV @php $isMonthly = $view === 'monthly'; $typeMeta = [ 'water' => ['icon' => 'ti-droplet', 'tone' => 'blue', 'color' => '#2563eb'], 'electricity' => ['icon' => 'ti-bolt', 'tone' => 'amber', 'color' => '#d97706'], ]; $q = request()->except(['view', 'date', 'month', 'page']); $periodKey = $isMonthly ? 'month' : 'date'; $periodValue = $isMonthly ? $month->format('Y-m') : $date->format('Y-m-d'); @endphp {{-- Daily / Monthly switch --}}
{{ $periodLabel }} @if ($nextUrl) @else @endif
{{-- Filters --}}
@if ($isMonthly) @else @endif @if (request()->hasAny(['building_id', 'floor_id', 'type'])) Clear @endif
@if ($meters->isEmpty())

No meters match these filters.

@else {{-- Totals --}}
@foreach ($typesPresent as $t)

{{ $typeLabels[$t] }} used

{{ number_format($totals[$t], 2) }} {{ $units[$t] }}

@endforeach

{{ $isMonthly ? 'With readings' : 'Read' }}

{{ $readCount }} / {{ $meters->count() }}

{{-- Charts --}}
@foreach ($typesPresent as $t)
{{ $typeLabels[$t] }} ({{ $units[$t] }})

{{ $chartTitle }}

@endforeach
{{-- Table --}}
@if ($isMonthly) @else @endif @foreach ($rows as $row) @php $m = $row['meter']; $fmt = fn ($v) => $v === null ? '—' : number_format($v, 2); @endphp @if ($isMonthly) @else @php $e = $row['entry']; @endphp @endif @endforeach
MeterLocationType OpeningClosing UsageAvg / day ReadingsNote
MeterLocationType PreviousReading UsageStatus
{{ $m->name }} @if ($m->apartment_no) {{ $m->apartment_label }} @endif {{ $m->floor->building->name }} · {{ $m->floor->name }} {{ $m->typeLabel() }} {{ $fmt($row['opening']) }} {{ $fmt($row['closing']) }} {{ $row['readings'] ? number_format($row['usage'], 2).' '.$m->unit : '—' }} {{ $row['readings'] ? number_format($row['usage'] / $daysInPeriod, 2) : '—' }} {{ $row['readings'] }} / {{ $daysInPeriod }} days @if ($row['note']) {{ $row['note'] }} @else OK @endif {{ $fmt($e['prev'] ?? null) }} {{ $fmt($e['reading'] ?? null) }} {{ $e && $e['usage'] !== null && ! $e['flag'] ? number_format($e['usage'], 2).' '.$m->unit : '—' }} @if ($e === null) Not read @elseif ($row['note']) {{ $row['note'] }} @else Read @endif

Usage is the difference between a meter's reading and its previous reading, counted on the date of the later reading. A meter's first reading is only a starting point. Readings lower than the one before are flagged and left out of totals. @if ($isMonthly && $isPartial) This month is still in progress, so averages use the days so far. @endif

@endif