@extends('layouts.app')
@section('title','Bank Reconciliation')
@section('page_title','Bank Reconciliation')
@section('content')
<div class="page-head"><div><h1>Bank Reconciliation</h1><p>Import statements, compare book balances, clear transactions and close reconciliations.</p></div><a class="btn btn-secondary" href="{{ route('masters.index','bank-accounts') }}">Manage Bank Accounts</a></div>
<div class="grid grid-3">@forelse($accounts as $b)<div class="card metric"><div class="metric-label">{{ $b->bank_name }}</div><div class="metric-value" style="font-size:19px">{{ $b->account_name }}</div><div class="metric-note">{{ $b->currency_code }} · {{ $b->account_number }}</div><div class="actions" style="margin-top:14px"><a class="btn btn-primary btn-sm" href="{{ route('bank.show',$b) }}">Statement</a><a class="btn btn-secondary btn-sm" href="{{ route('bank.reconcile.create',$b) }}">Reconcile</a></div></div>@empty<div class="card metric"><div class="metric-value" style="font-size:18px">No bank accounts configured</div><div class="metric-note">Create a bank account and link it to a cash/bank general-ledger account.</div></div>@endforelse</div>
<div class="card" style="margin-top:18px"><div class="card-head"><strong>Recent Reconciliations</strong></div><div class="table-wrap"><table class="table"><thead><tr><th>Bank</th><th>Statement Date</th><th>Statement Balance</th><th>Book Balance</th><th>Difference</th><th>Status</th><th></th></tr></thead><tbody>@forelse($reconciliations as $r)<tr><td>{{ $r->bankAccount?->bank_name }}</td><td>{{ $r->statement_date->format('d M Y') }}</td><td>{{ number_format((float)$r->statement_ending_balance,2) }}</td><td>{{ number_format((float)$r->book_ending_balance,2) }}</td><td>{{ number_format((float)$r->difference,2) }}</td><td><span class="badge status-{{ $r->status }}">{{ ucfirst($r->status) }}</span></td><td><a class="btn btn-secondary btn-sm" href="{{ route('bank.reconciliations.show',$r) }}">Open</a></td></tr>@empty<tr><td colspan="7" class="empty">No reconciliations created.</td></tr>@endforelse</tbody></table></div></div>
@endsection
