@extends('layouts.app') @section('title', 'Cash Recon') @section('content') @php $isAdmin = auth()->user()->hasAnyRole('Super Admin', 'Hospital Admin'); @endphp

Cash Recon

Daily cash reconciliation · {{ now()->format('l, d M Y') }}

@if($activeShifts->isEmpty()) Open New Shift @else Continue Active Shift → @endif
@if(session('success'))
{{ session('success') }}
@endif @if(session('warning'))
{{ session('warning') }}
@endif {{-- Today summary line --}}

Today's Cash Collected (System)

KES {{ number_format($todayCashCollected, 2) }}

Sum of all cash payments recorded since 00:00 today across all shifts. This is the system's expected cash; counted physical cash should match.
{{-- Tab strip --}}
Active Shifts {{ $activeShifts->count() }} @if($isAdmin) Pending Review {{ $pendingShifts->count() }} @endif History {{ $historyShifts->total() }}
{{-- ═══════════════════════════════════════════════════════════════ --}} {{-- ACTIVE SHIFTS TAB --}} {{-- ═══════════════════════════════════════════════════════════════ --}} @if($tab === 'active')
@if($activeShifts->isEmpty())

No active shift right now.

Open a new shift to start tracking cash collections.

+ Open New Shift
@else @foreach($activeShifts as $s) @endforeach
Shift # Date · Label Opened By Opened At Opening Float Expected Now
#{{ $s->id }} {{ $s->shift_date->format('d M') }} {{ $s->shift_label }} {{ $s->openedBy->name ?? '—' }} {{ $s->opened_at->format('H:i, d M') }} {{ number_format($s->opening_float, 2) }} {{ number_format($s->expectedCash(), 2) }} Open →
@endif
@endif {{-- ═══════════════════════════════════════════════════════════════ --}} {{-- PENDING REVIEW TAB (admin only) --}} {{-- ═══════════════════════════════════════════════════════════════ --}} @if($tab === 'pending' && $isAdmin)
@if($pendingShifts->isEmpty())

No shifts pending approval. Variances under KES 200 auto-close.

@else @foreach($pendingShifts as $s) @php $v = $s->variance(); @endphp @endforeach
Shift # Date · Label Closed By Expected Counted Variance Notes
#{{ $s->id }} {{ $s->shift_date->format('d M') }} · {{ $s->shift_label }} {{ $s->closedBy->name ?? '—' }}
{{ $s->closed_at?->format('H:i, d M') }}
{{ number_format($s->expectedCash(), 2) }} {{ number_format($s->closing_count, 2) }} {{ $v >= 0 ? '+' : '' }}{{ number_format($v, 2) }} {{ $s->variance_notes ?: '—' }} Review →
@endif
@endif {{-- ═══════════════════════════════════════════════════════════════ --}} {{-- HISTORY TAB --}} {{-- ═══════════════════════════════════════════════════════════════ --}} @if($tab === 'history') {{-- Date range filter --}}
@if(request('date_from') || request('date_to')) Clear @endif
@if($historyShifts->isEmpty())
No closed shifts {{ request('date_from') || request('date_to') ? 'in this range' : 'yet' }}.
@else @foreach($historyShifts as $s) @php $v = $s->variance(); @endphp @endforeach
Shift # Date · Label Opened By Closed By Expected Counted Variance Approval
#{{ $s->id }} {{ $s->shift_date->format('d M Y') }} · {{ $s->shift_label }} {{ $s->openedBy->name ?? '—' }} {{ $s->closedBy->name ?? '—' }} {{ number_format($s->expectedCash(), 2) }} {{ number_format($s->closing_count, 2) }} @if(abs($v) < 0.01) 0.00 @else {{ $v >= 0 ? '+' : '' }}{{ number_format($v, 2) }} @endif @if($s->approved_at) Admin Approved @elseif(abs($v) < 0.01) Clean close @else Auto-accepted @endif
@if($historyShifts->hasPages())
{{ $historyShifts->links() }}
@endif @endif
@endif @endsection