@extends('layouts.app') @section('title', 'Account Ledger') @section('breadcrumb') @endsection @section('content')
@if($account)
৳{{ number_format($openingBalance, 2) }}
Opening Balance
৳{{ number_format($totalCredits, 2) }}
Total Credits (In)
৳{{ number_format($totalDebits, 2) }}
Total Debits (Out)
৳{{ number_format($closingBalance, 2) }}
Closing Balance
Ledger: {{ $account->name }} — {{ \Carbon\Carbon::parse($from)->format('d M Y') }} to {{ \Carbon\Carbon::parse($to)->format('d M Y') }}
@if($transactions->isEmpty())

No transactions in this period.

@else
@php $runningBalance = $openingBalance; @endphp @foreach($transactions as $txn) @php if ($txn->entry_type === 'credit') { $runningBalance += $txn->amount; } else { $runningBalance -= $txn->amount; } @endphp @endforeach
Date Reference Type Description Credit (In) Debit (Out) Balance By
Opening Balance ৳{{ number_format($openingBalance, 2) }}
{{ $txn->trans_date->format('d M Y') }} {{ $txn->reference ?? '—' }} @php $badge = match($txn->type) { 'income' => 'success', 'expense' => 'danger', 'transfer' => 'info', 'sale_payment' => 'primary', 'purchase_payment' => 'warning', default => 'secondary', }; @endphp {{ $types[$txn->type] ?? $txn->type }} {{ $txn->description ?? '—' }} @if($txn->entry_type === 'credit') ৳{{ number_format($txn->amount, 2) }} @endif @if($txn->entry_type === 'debit') ৳{{ number_format($txn->amount, 2) }} @endif ৳{{ number_format($runningBalance, 2) }} {{ $txn->creator?->name ?? 'System' }}
Closing Balance ৳{{ number_format($totalCredits, 2) }} ৳{{ number_format($totalDebits, 2) }} ৳{{ number_format($closingBalance, 2) }}
@endif
@else

Select an account above to view its ledger.

@endif @endsection