@extends('layouts.app') @section('title', 'Ledgers') @section('subtitle', 'Principal books grouped by account') @section('content') Cash book Trial balance Chart of accounts
@foreach ($types as $type => $label) @php($rows = $grouped->get($type, collect())) @continue($rows->isEmpty())

{{ $label }}

{{ $rows->count() }}
@foreach ($rows as $row) @php($account = $row['account']) @php($balance = $account->isDebitNormal() ? $row['signed'] : -$row['signed']) @endforeach
Account Debits Credits Balance
{{ $account->code }} — {{ $account->name }} @unless ($account->is_active)Inactive@endunless {{ $row['debit'] > 0 ? money($row['debit']) : '—' }} {{ $row['credit'] > 0 ? money($row['credit']) : '—' }} {{ money(abs($balance)) }} {{ $account->isDebitNormal() ? 'Dr' : 'Cr' }}
@endforeach
@endsection