@extends('layouts.master') @section('title', 'Trial Balance Report') @section('content')
Back to Reports
Trial Balance Report
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@csrf

@php $tbRows = $trial['rows'] ?? ($trialBalanceData ?? []); $totalDebit = $trial['totalDebit'] ?? ($totalDebit ?? 0); $totalCredit = $trial['totalCredit'] ?? ($totalCredit ?? 0); $variance = $trial['variance'] ?? (($totalDebit ?? 0) - ($totalCredit ?? 0)); $balanced = $trial['isBalanced'] ?? (abs($variance) < 0.01); $source = $trial['source'] ?? null; @endphp @if(isset($tbRows))
@csrf
Logo

Trial Balance Statement

Date: {{ date('F j, Y') }}

From: {{ $pfrom ?? date('Y-m-d') }} To: {{ $pto ?? date('Y-m-d') }}

@if($source) Source: {{ $source === 'journal_lines' ? 'Journal Lines (double-entry)' : 'General Journals' }} @endif
Total Debit
${{ number_format($totalDebit, 2) }}
Total Credit
${{ number_format($totalCredit, 2) }}
Balance Check
{{ $balanced ? 'Balanced' : ('Variance ' . number_format(abs($variance), 2)) }}
@forelse($tbRows as $account) @empty @endforelse
Account Code Account Name Debit Credit Balance
{{ $account['code'] }} {{ $account['name'] }} {{ number_format($account['debit'], 2) }} {{ number_format($account['credit'], 2) }} {{ number_format($account['balance'], 2) }}
No accounts found
Total {{ number_format($totalDebit, 2) }} {{ number_format($totalCredit, 2) }} {{ number_format($totalDebit - $totalCredit, 2) }}
@endif
@endsection @section('styles') @endsection