{{-- resources/views/accounting/reports/general_ledger.blade.php --}} @extends('admin.admin_dashboard') @section('admin') <<<<<<< HEAD @php // $accounts is passed from the controller with: // account_id, account_name, account_code, opening_balance, transactions, closing_balance @endphp
@forelse($accounts as $account) {{-- Account Header --}}
{{ $account['account_code'] }} - {{ $account['account_name'] }}
{{-- Opening Balance --}}
@php $runningBalance = $account['opening_balance']; @endphp @foreach($account['transactions'] as $i => $tran) @php $runningBalance += ($tran['debit'] ?? 0) - ($tran['credit'] ?? 0); @endphp @endforeach {{-- Closing Balance --}}
# Date Reference Description Debit Credit Balance
Opening Balance {{ number_format($account['opening_balance'], 2) }}
{{ $i + 1 }} {{ \Carbon\Carbon::parse($tran['date'])->format('Y-m-d') }} {{ $tran['journal_no'] }} {{ $tran['description'] }} {{ number_format($tran['debit'] ?? 0, 2) }} {{ number_format($tran['credit'] ?? 0, 2) }} {{ number_format($runningBalance, 2) }}
Closing Balance {{ number_format($account['closing_balance'], 2) }}
@empty
No transactions found for the selected criteria.
@endforelse
======= @php use App\Support\AccountingAmounts; @endphp
@include('partials.accounting.period-banner')
@forelse($accounts as $account)
{{ $account['account_code'] }} — {{ $account['account_name'] }}
Account ledger
@foreach($account['transactions'] as $i => $tran) @endforeach
# Date Reference Description Debit (−) Credit (+) Balance
Opening balance {{ AccountingAmounts::formatSigned($account['opening_balance']) }}
{{ $i + 1 }} {{ $tran['date'] ? \Carbon\Carbon::parse($tran['date'])->format('Y-m-d') : '—' }} {{ $tran['journal_no'] }} {{ $tran['description'] ?: ($tran['memo'] ?? '') }} {{ AccountingAmounts::formatDebit($tran['debit']) }} {{ AccountingAmounts::formatCredit($tran['credit']) }} {{ AccountingAmounts::formatSigned($tran['balance']) }}
Closing balance {{ AccountingAmounts::formatSigned($account['closing_balance']) }}
@empty
No transactions found for the selected criteria.
@endforelse
>>>>>>> origin/main
@endsection