@extends('layouts.app') @section('title', 'Account Ledger') @section('page-title', 'Account Ledger') @section('content')
@if($account)

{{ $account->account_code }} — {{ $account->account_name }}

{{ ucfirst($account->account_type) }} · Normal balance: {{ $account->normal_balance }}

Opening Balance: ₹{{ number_format($account->opening_balance, 2) }}
{{-- Opening balance row --}} @php $runningBalance = $account->opening_balance; @endphp @forelse($entries as $entry) @php if ($account->normal_balance === 'debit') { $runningBalance += $entry->debit_amount - $entry->credit_amount; } else { $runningBalance += $entry->credit_amount - $entry->debit_amount; } @endphp @empty @endforelse
Date Voucher # Type Narration Debit (₹) Credit (₹) Balance (₹)
Opening Opening Balance {{ $account->normal_balance === 'debit' && $account->opening_balance > 0 ? number_format($account->opening_balance,2) : '—' }} {{ $account->normal_balance === 'credit' && $account->opening_balance > 0 ? number_format($account->opening_balance,2) : '—' }} ₹{{ number_format($account->opening_balance,2) }}
{{ $entry->voucher->voucher_date->format('d M Y') }} {{ $entry->voucher->voucher_number }} {{ str_replace('_',' ',$entry->voucher->voucher_type) }} {{ $entry->voucher->narration }} {{ $entry->debit_amount > 0 ? number_format($entry->debit_amount,2) : '—' }} {{ $entry->credit_amount > 0 ? number_format($entry->credit_amount,2) : '—' }} ₹{{ number_format(abs($runningBalance),2) }} {{ $runningBalance < 0 ? '(Cr)' : '' }}
No transactions in this period
Closing Balance ₹{{ number_format($entries->sum('debit_amount'),2) }} ₹{{ number_format($entries->sum('credit_amount'),2) }} ₹{{ number_format(abs($runningBalance ?? $account->opening_balance),2) }}
@else

Select an account to view its ledger

@endif @endsection