@extends('layouts.app') @section('content')

Balance Integrity Check - {{ $fund->name }}

{{ $result['has_issues'] ? 'Issues Found' : 'All Good' }}
Initial Amount

UGX {{ number_format($result['initial_amount'], 2) }}

Current Balance (System)

UGX {{ number_format($result['current_balance'], 2) }}

Calculated Balance

UGX {{ number_format($result['calculated_balance'], 2) }}

@if($result['balance_matches'])
Balance Matches!

The current balance matches the calculated balance. System integrity is intact.

@else
Balance Mismatch Detected!

Current Balance: UGX {{ number_format($result['current_balance'], 2) }}
Calculated Balance: UGX {{ number_format($result['calculated_balance'], 2) }}
Difference: UGX {{ number_format($result['calculated_balance'] - $result['current_balance'], 2) }}


Action Required: Use auto-reconcile to fix the balance.

@endif @if(count($result['transaction_discrepancies']) > 0)
Transaction Discrepancies Found

The following transactions have incorrect balance_after values:

@foreach($result['transaction_discrepancies'] as $discrepancy) @endforeach
Transaction ID Date Description Expected Balance Recorded Balance Difference
#{{ $discrepancy['transaction_id'] }} {{ $discrepancy['date'] }} {{ $discrepancy['description'] }} UGX {{ number_format($discrepancy['expected_balance'], 2) }} UGX {{ number_format($discrepancy['recorded_balance'], 2) }} {{ number_format($discrepancy['difference'], 2) }}
How to Fix: Click the "Fix Balance History" button below to recalculate all balance_after values.
@else
All Transaction Balances Are Correct

Every transaction has the correct balance_after value.

@endif
Back to Fund
@if(count($result['transaction_discrepancies']) > 0)
@csrf
@endif @if(!$result['balance_matches'])
@csrf
@endif
What This Check Does
  • Verifies that the current fund balance matches the calculated balance from all approved transactions
  • Checks that every transaction's balance_after value is correct
  • Identifies any discrepancies that need to be fixed
Recommended Actions
  • If balance doesn't match: Use Auto-Reconcile Balance to fix the current balance
  • If transaction discrepancies found: Use Fix Balance History to recalculate all balance_after values
  • Run this check periodically to ensure data integrity
@endsection @push('styles') @endpush