@include('templates.pdf_header', [ 'organisation' => $organisation, 'title' => 'Income Statement', 'currency_code' => $currency ]) @if(isset($comparison)) @endif @php // Recursive renderer function renderItem($item, $level = 0, $comparison = false) { @endphp @if($comparison) @endif @php if(!empty($item->children)) { foreach($item->children as $child) { renderItem($child, $level + 1, $comparison); } } if(!empty($item->accounts)) { foreach($item->accounts as $acc) { @endphp @if($comparison) @endif @php } } } @endphp @php $comparisonFlag = isset($data[0]->group_total_previous); @endphp @foreach($data as $section) @foreach($section->subcategories as $subcat) @php renderItem($subcat, 0, $comparisonFlag); @endphp @endforeach @if($comparisonFlag) @endif @endforeach
Particulars Current ({{ $currency }})Previous ({{ $currency }}) Variance
{{ $item->name }} @if(isset($item->code)) ({{ $item->code }}) @endif {{ number_format($item->total_current ?? 0, 2) }}{{ number_format($item->total_previous ?? 0, 2) }} {{ number_format(($item->total_current ?? 0) - ($item->total_previous ?? 0), 2) }}
{{ is_array($acc) ? $acc['name'] : $acc->name }} ({{ is_array($acc) ? $acc['code'] : $acc->code }}) {{ number_format(is_array($acc) ? $acc['current'] ?? 0 : $acc->current ?? 0, 2) }}{{ number_format(is_array($acc) ? $acc['previous'] ?? 0 : $acc->previous ?? 0, 2) }} {{ number_format((is_array($acc) ? $acc['current'] ?? 0 : $acc->current ?? 0) - (is_array($acc) ? $acc['previous'] ?? 0 : $acc->previous ?? 0), 2) }}
{{ $section->group_name }}
Total {{ $section->group_name }} {{ number_format($section->group_total_current ?? 0, 2) }}{{ number_format($section->group_total_previous ?? 0, 2) }} {{ number_format(($section->group_total_current ?? 0) - ($section->group_total_previous ?? 0), 2) }}