@extends('layouts.app') @section('title', 'M-Pesa Agent Dashboard') @section('content')

M-Pesa Agent Dashboard

{{-- Date Range Filter --}}
Today
{{-- Balance Cards --}}
M-Pesa Float KES {{ number_format($summary['closing_mpesa']) }}
Cash in Hand KES {{ number_format($summary['closing_cash']) }}
Deposits (Sales) KES {{ number_format($summary['deposits']) }} ({{ $summary['deposit_count'] }} txns)
Withdrawals (Agent) KES {{ number_format($summary['withdrawals']) }} ({{ $summary['withdrawal_count'] }} txns)
{{-- Transaction Summary Table --}}

Transaction Summary

Type Count Total (KES)
↓ M-Pesa Deposit {{ $summary['deposit_count'] }} {{ number_format($summary['deposits']) }}
↑ M-Pesa Withdrawal {{ $summary['withdrawal_count'] }} {{ number_format($summary['withdrawals']) }}
⟳ Float Top-Up {{ $summary['float_count'] }} {{ number_format($summary['floats']) }}
TOTAL {{ $summary['total_count'] }} {{ number_format($summary['deposits'] + $summary['withdrawals'] + $summary['floats']) }}
{{-- Double-Entry Journal --}}

Journal Entries

@if($summary['deposits'] > 0)
M-Pesa Deposit
DR M-Pesa Wallet {{ number_format($summary['deposits']) }}
CR Sales Revenue {{ number_format($summary['deposits']) }}
@endif @if($summary['withdrawals'] > 0)
M-Pesa Withdrawal
DR Cash Register {{ number_format($summary['withdrawals']) }}
CR M-Pesa Wallet {{ number_format($summary['withdrawals']) }}
@endif @if($summary['floats'] > 0)
Float Top-Up
DR M-Pesa Wallet {{ number_format($summary['floats']) }}
CR Cash Register {{ number_format($summary['floats']) }}
@endif @if($summary['total_count'] == 0)

No transactions in this period

@endif
{{-- Per-Cashier Breakdown --}} @if($byCashier->count() > 0)

By Cashier

@foreach($byCashier as $userId => $items) @php $user = $items->first()->createdBy; $name = $user ? ($user->first_name . ' ' . $user->last_name) : 'Unknown'; $dep = $items->where('type', 'deposit')->sum('total'); $wd = $items->where('type', 'withdrawal')->sum('total'); $fl = $items->where('type', 'float')->sum('total'); $cnt = $items->sum('txn_count'); @endphp @endforeach
Cashier Deposits Withdrawals Float Txns
{{ $name }} {{ number_format($dep) }} {{ number_format($wd) }} {{ number_format($fl) }} {{ $cnt }}
@endif {{-- Quick Links --}}
@endsection