@php $months = $reportData['months']; $tree = $reportData['tree']; $supplierSection = $reportData['supplierSection']; $customerSection = $reportData['customerSection']; $colCount = 12 + 3; // months + Average + Total + Account + Code // Format: negative → (1,234) | zero → '-' | positive → 1,234 $fmt = fn($v) => $v == 0 ? '-' : ($v < 0 ? '(' . number_format(abs($v), 0) . ')' : number_format($v, 0)); @endphp {{-- ══ Company Header ══ --}}
M.D.S
مابوار کھاتہ موازنہ    Accounts Comparision Report
Start Date : {{ \Carbon\Carbon::parse($reportData['startDate'])->format('d/m/Y') }}
@foreach($months as $m) @endforeach {{-- ════ SECTION 1: Account Hierarchy ════ --}} @foreach($tree as $ma) {{-- Main Account heading --}} @foreach($ma['children'] as $ca) @foreach($ca['children'] as $sca) @foreach($sca['children'] as $tacc) @if($tacc['total'] != 0) @foreach($tacc['monthly'] as $val) @endforeach @endif @endforeach @endforeach @if($ca['total'] != 0) {{-- Control Account subtotal --}} @foreach($ca['monthly'] as $val) @endforeach @endif @endforeach @if($ma['total'] != 0) {{-- Main Account total --}} @foreach($ma['monthly'] as $val) @endforeach @endif @endforeach {{-- ════ SECTION 2: SUPPLIERS ════ --}} @if(!empty($supplierSection['children'])) @foreach($supplierSection['children'] as $row) @foreach($row['monthly'] as $val) @endforeach @endforeach {{-- Suppliers total --}} @foreach($supplierSection['monthly'] as $val) @endforeach @endif {{-- ════ SECTION 3: CUSTOMERS ════ --}} @if(!empty($customerSection['children'])) @foreach($customerSection['children'] as $row) @foreach($row['monthly'] as $val) @endforeach @endforeach {{-- Customers total --}} @foreach($customerSection['monthly'] as $val) @endforeach @endif
Account Code {{ $m->format('M,y') }}Average Total
{{ strtoupper($ma['name']) }}
{{ $tacc['code'] }} {{ $fmt($val) }}{{ $fmt($tacc['average']) }} {{ $fmt($tacc['total']) }}
{{ $fmt($val) }}{{ $fmt($ca['average']) }} {{ $fmt($ca['total']) }}
{{ $fmt($val) }}{{ $fmt($ma['average']) }} {{ $fmt($ma['total']) }}
SUPPLIERS — سپلائرز
{{ $row['code'] }} {{ $fmt($val) }}{{ $fmt($row['average']) }} {{ $fmt($row['total']) }}
{{ $fmt($val) }}{{ $fmt($supplierSection['average']) }} {{ $fmt($supplierSection['total']) }}
CUSTOMERS — کسٹمرز
{{ $row['code'] }} {{ $fmt($val) }}{{ $fmt($row['average']) }} {{ $fmt($row['total']) }}
{{ $fmt($val) }}{{ $fmt($customerSection['average']) }} {{ $fmt($customerSection['total']) }}