{{-- resources/views/exports/income_statement_pdf.blade.php Rendered by IncomeStatementController::exportIncomeStatement(), which passes named variables rather than spreading an array: data, displayType, organisation, fromDate, toDate, job, comparisonData, comparisonMeta, mergedSections. Note the underscored filename — the controller asks for 'exports.income_statement_pdf' while the other reports use hyphens. The filename follows the controller rather than the convention, so the view resolves without touching the call site. displayType is 'monthly', 'comparison', or anything else meaning the plain statement. --}} Income Statement @include('exports._report-styles')

{{ is_object($organisation) ? ($organisation->name ?? config('accounts.organisation.name')) : config('accounts.organisation.name') }}

Income Statement

{{ \Carbon\Carbon::parse($fromDate)->format('d/m/Y') }} to {{ \Carbon\Carbon::parse($toDate)->format('d/m/Y') }} @if ($job) — Fund: {{ $job->name ?? '' }} @endif
@php $money = fn ($v) => number_format((float) $v, 2); @endphp @if ($displayType === 'monthly') @php $months = $data['months'] ?? []; $summary = $data['monthly_summary'] ?? []; $totals = $data['totals'] ?? []; $measures = [ 'revenue' => 'Revenue', 'direct_cost' => 'Direct Cost', 'gross_surplus' => 'Gross Surplus', 'other_income' => 'Other Income', 'expenses' => 'Expenses', 'surplus_before_tax' => 'Surplus Before Tax', 'taxation' => 'Taxation', 'surplus_after_tax' => 'Surplus After Tax', ]; @endphp @foreach ($months as $month) @endforeach @foreach ($measures as $key => $label) @foreach ($summary as $month) @endforeach @endforeach
Particulars{{ $month['label'] ?? '' }}Total
{{ $label }}{{ $money($month[$key] ?? 0) }}{{ $money($totals[$key] ?? 0) }}
@elseif ($displayType === 'comparison' && ! empty($mergedSections)) @foreach ($mergedSections as $sectionName => $section) @foreach (($section['items'] ?? $section) as $item) @if (is_array($item)) @endif @endforeach @if (isset($section['total']) || isset($section['comparison_total'])) @endif @endforeach
Code Particulars {{ $comparisonMeta['current_label'] ?? 'Current' }} {{ $comparisonMeta['comparison_label'] ?? 'Comparison' }}
{{ strtoupper(str_replace('_', ' ', $sectionName)) }}
{{ $item['code'] ?? '' }} {{ $item['name'] ?? '' }} {{ $money($item['current'] ?? ($item['balance'] ?? 0)) }} {{ $money($item['comparison'] ?? 0) }}
Total {{ $money($section['total'] ?? 0) }} {{ $money($section['comparison_total'] ?? 0) }}
@else @php $sections = [ ['key' => 'revenue', 'label' => 'REVENUE'], ['key' => 'direct_cost', 'label' => 'DIRECT COST'], ['key' => 'other_income', 'label' => 'OTHER INCOME'], ['key' => 'expenses', 'label' => 'EXPENSES'], ['key' => 'taxation', 'label' => 'TAXATION'], ]; // Running subtotals sit between specific sections, not after each one. $after = [ 'direct_cost' => ['Gross Surplus', $data['gross_surplus'] ?? 0], 'expenses' => ['Surplus Before Tax', $data['surplus_before_tax'] ?? 0], 'taxation' => ['Surplus After Tax', $data['surplus_after_tax'] ?? 0], ]; @endphp @foreach ($sections as $section) @php $block = $data[$section['key']] ?? ['items' => [], 'total' => 0]; @endphp @forelse ($block['items'] ?? [] as $item) @empty @endforelse @isset($after[$section['key']]) @endisset @endforeach
Code Particulars Amount
{{ $section['label'] }}
{{ $item['code'] ?? '' }} {{ $item['name'] ?? '' }} {{ $money($item['balance'] ?? 0) }}
No entries for this period.
Total {{ ucfirst(strtolower($section['label'])) }} {{ $money($block['total'] ?? 0) }}
{{ $after[$section['key']][0] }} {{ $money($after[$section['key']][1]) }}
@endif