@extends('master.app') @section('title', 'General Ledger') @section('body') @php $lang = $filters['lang'] ?? 'en'; $typeLabel = $filters['type'] ?? ''; $q = $filters['q'] ?? ''; $dateFrom = $filters['date_from'] ?? ''; $dateTo = $filters['date_to'] ?? ''; $perPage = (int)($filters['per_page'] ?? 50); $accName = null; if(!empty($account)){ $accName = $lang==='ps' ? ($account['title_ps'] ?? $account['title_en']) : ($lang==='dr' ? ($account['title_dr'] ?? $account['title_en']) : ($account['title_en'] ?? $account['title_ps'])); } $sumDebit = (float)($totals['debit'] ?? 0); $sumCredit = (float)($totals['credit'] ?? 0); $closing = (float)$opening + (float)(collect($entries->items() ?? [])->sum('delta')); // quick helper for module badge/icon $modMeta = function($m){ $m = strtolower((string)$m); if(str_contains($m,'cash')) return ['icon'=>'fa-money-bill-wave','cls'=>'badge-soft-success']; if(str_contains($m,'bank')) return ['icon'=>'fa-building-columns','cls'=>'badge-soft-info']; if(str_contains($m,'sale') || str_contains($m,'invoice')) return ['icon'=>'fa-receipt','cls'=>'badge-soft-primary']; if(str_contains($m,'purchase') || str_contains($m,'bill')) return ['icon'=>'fa-cart-shopping','cls'=>'badge-soft-warning']; if(str_contains($m,'payroll')) return ['icon'=>'fa-users','cls'=>'badge-soft-dark']; return ['icon'=>'fa-layer-group','cls'=>'badge-soft-secondary']; }; @endphp @push('styles') @endpush
{{-- HERO / HEADER --}}
General Ledger
Base currency: currency_id=1
FX: ex_rate
Account Ledger @if($account) — {{ $account['key'] }} {{ $accName ? ' • '.$accName : '' }} @endif
Filter by account/type/date and search in narration.
Reset Print {{-- Optional: Excel (if you add route later) --}} {{-- Export --}}
{{-- STATS ROW --}}
Opening
{{ number_format((float)$opening, 2) }}
Total Debit
{{ number_format($sumDebit, 2) }}
Total Credit
{{ number_format($sumCredit, 2) }}
Closing
{{ number_format($closing, 2) }}
{{-- FILTERS --}}
Filters @if($typeLabel || $dateFrom || $dateTo || $q) Active @endif
Tip: choose one account to view its running balance.
Reset
{{-- TABLE --}}
{{-- opening --}} @forelse($entries as $e) @php $meta = $modMeta($e->module ?? ''); @endphp @empty @endforelse
Date Ref Description Module Debit Credit Running
Opening Balance {{ number_format((float)$opening, 2) }}
{{ $e->date }}
{{-- {{ $e->created_at }} --}}
{{ $e->ref }}
{{ $e->description }}
@if(!empty($e->narration))
{{ $e->narration }}
@endif
{{ $e->module }} {{ number_format((float)$e->debit, 2) }} {{ number_format((float)$e->credit, 2) }} {{ number_format((float)($e->running ?? 0), 2) }}
No entries found
Try changing date range or search text.
Totals {{ number_format($sumDebit, 2) }} {{ number_format($sumCredit, 2) }} {{ number_format((float)$closing, 2) }}
Showing {{ $entries->firstItem() ?? 0 }}{{ $entries->lastItem() ?? 0 }} of {{ $entries->total() ?? 0 }} entries
{{-- {{ $entries->links() }} --}} {{ $entries->links('pagination::bootstrap-4') }}
@endsection