@extends('layouts.app') @section('title', 'Meter Reading Details') @section('content')

Meter Reading Details

Reading Date: {{ $reading->reading_date->format('F d, Y H:i') }}

Client Information

Account Number: {{ $reading->client->account_number }}
Name: {{ $reading->client->name }}
Meter Number: {{ $reading->client->meter_number ?? 'N/A' }}
Address: {{ $reading->client->address ?? '-' }}

Reading Data

Current Reading: {{ number_format($reading->reading_value, 2) }} cu.m
Previous Reading: {{ number_format($reading->previous_reading ?? 0, 2) }} cu.m

Units Consumed: {{ number_format($reading->units_consumed ?? 0, 2) }} cu.m
Recorded By: {{ $reading->recorded_by ?? '-' }}

@if ($reading->notes)

Notes:
{{ $reading->notes }}

@endif
Status: @php $statusColor = [ 'approved' => 'success', 'rejected' => 'danger', 'disregarded' => 'secondary', ][$reading->status] ?? 'warning'; @endphp {{ ucfirst($reading->status) }}
@if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @if ($reading->status === 'draft')

This reading is pending approval. Review the data and approve to generate a billing statement.

@csrf
@csrf
@elseif ($reading->status === 'approved') @if ($reading->isBillable()) {{-- Approved, but its bill was voided or cancelled: the consumption is unbilled again and needs a replacement bill. --}}
This reading is approved but has no billing standing against it — the previous bill was voided or cancelled.
@csrf
@else
This reading has been approved and a billing has been generated.
@endif @if ($activeBilling ?? $reading->billing) View Generated Billing @endif @elseif ($reading->status === 'disregarded')
This reading was disregarded. It no longer counts as a reading, so {{ $reading->client->name }}'s next reading is measured from the last good reading before it.
Reason: {{ $reading->disregard_reason ?? '—' }}
By: {{ $reading->disregardedByUser->name ?? '—' }} @if ($reading->disregarded_at) on {{ $reading->disregarded_at->format('M d, Y h:i A') }} @endif
@else
This reading has been rejected.
@endif
{{-- A reading found to be wrong after it was approved and billed. Correcting it recalculates the bill; disregarding it throws the reading out so the next one measures from the last good reading. Admin level only. --}} @if ($canEdit || $canDisregard || $canVoidReading)
Wrong Reading?

@if ($requiresVoidCode) Billing #{{ $activeBilling->billing_number }} already has ₱{{ number_format($activeBilling->amount_paid, 2) }} collected against it, so either action voids that bill and reverses the payments. The company owner's 6-digit code is required. @elseif ($activeBilling) Nothing has been paid on billing #{{ $activeBilling->billing_number }} yet. Correcting recalculates it in place; disregarding cancels it. @else No billing stands against this reading. @endif

@if ($canEdit) Edit Reading @endif @if ($canDisregard) @endif @if ($canVoidReading) @endif
@if ($canVoidReading && !$canDisregard) {{-- The stranded case: newer readings sit after this one, so Edit and Disregard are both closed and Void is the only way out. --}}
Newer approved readings exist for {{ $reading->client->name }}, so this one can no longer be corrected or disregarded. Void Reading takes it out together with its billing; the readings after it keep the figures they were already billed on.
@endif
@endif
Back to Readings
@if ($canVoidReading) @endif @if ($canDisregard) @endif @endsection @section('scripts') @endsection