@lang('reports::reports.Balance Sheet')
{{ $data['companyName'] }}
{{-- Determine view type: single vs comparison --}}
@if(isset($data['periods']))
{{-- === Comparison Mode (multiple periods) === --}}
|
@foreach($data['periods'] as $period)
{{ Date::format($period) }} |
@endforeach
{{-- repurpose markup from previous compare blade --}}
@foreach ($data['categories'] as $category)
| {{ $category['category']->name}} |
|
@foreach($category['subCategories'] as $subCategory)
| {{ $subCategory['name'] }} |
|
@foreach($subCategory['accounts'] as $account)
| {{ $account['code'] }} - {{ $account['name'] }} |
@foreach($account['current_balance'] as $balance)
@if($balance >= 0)
{{ number_format($balance,2) }}
@else
({{ number_format(abs($balance),2) }})
@endif
|
@endforeach
@php $tree = $account['tree']['directChildren'] ?? null; @endphp
@isset($tree)
{!! generateHTMLForBalanceSheetComparisonCustomLevel($tree,1,request('level')+1) !!}
@endisset
{{-- totals per account (only when account has tree totals) --}}
@php
$treeTotals = $account['tree']['total'] ?? [];
@endphp
@if(isset($account['tree']) && array_sum($treeTotals) != 0)
| @lang('reports::reports.total') {{ $account['name'] }} |
@foreach($treeTotals as $total)
@if($total >= 0)
{{ number_format($total,2) }}
@else
({{ number_format(abs($total),2) }})
@endif
|
@endforeach
@endif
@endforeach
{{-- totals per subcategory --}}
| @lang('reports::reports.total') {{ $subCategory['name'] }} |
@foreach($subCategory['total'] as $total)
@if($total >= 0) {{ number_format($total,2) }} @else ({{ number_format(abs($total),2) }}) @endif
|
@endforeach
{{-- separator row for credit categories --}}
@if($category['category']->id != \Modules\Accounting\Enums\AccountingCategoriesEnum::ASSETS)
| @foreach($category['total'] as $total) | @endforeach
@endif
@endforeach
{{-- total per category (credits only) --}}
@if($category['category']->id != \Modules\Accounting\Enums\AccountingCategoriesEnum::ASSETS)
| @lang('reports::reports.total') {{ $category['category']->name }} |
@foreach($category['total'] as $total)
@if($total >= 0) {{ number_format($total,2) }} @else ({{ number_format(abs($total),2) }}) @endif
|
@endforeach
@endif
{{-- debit total (first loop iteration) --}}
@if($loop->iteration == 1)
| @lang('reports::reports.balance_sheet_total_debit') |
@foreach($data['totalDebit'] as $debit)
@if($debit >= 0) {{ number_format($debit,2) }} @else ({{ number_format(abs($debit),2) }}) @endif |
@endforeach
@endif
@endforeach
{{-- net earnings row --}}
| @lang('reports::reports.net_earnings') |
@foreach($data['net'] as $net)
@if($net >= 0) {{ number_format($net,2) }} @else ({{ number_format(abs($net),2) }}) @endif |
@endforeach
{{-- total credit row --}}
| @lang('reports::reports.balance_sheet_total_credit') |
@foreach($data['totalCredit'] as $credit)
@if($credit >= 0) {{ number_format($credit,2) }} @else ({{ number_format(abs($credit),2) }}) @endif |
@endforeach
@lang('reports::reports.accrual_basis')
@if(app()->getLocale() == 'ar')
{{ Date::now('datetime') }}
@else
{{ Date::now('datetime') }}
@endif
@else
{{-- === Single Period Mode (existing layout) === --}}
@lang('reports::reports.Balance Sheet')
{{ $data['companyName'] }}
@lang('reports::reports.balance_sheet_as_of') {{$data['to']}}
|
@lang('reports::reports.balance')
/ @lang('reports::reports.total') |
@foreach ($data['categories'] as $category)
| {{ $category['category']->name}} |
|
@foreach($category['subCategories'] as $subCategory)
| {{$subCategory['name']}} |
@if($subCategory['total'] == 0) {{ number_format($subCategory['total'],2) }} @endif |
@foreach($subCategory['accounts'] as $account)
@if($account['current_balance']!=0||$account['total']!=0)
|
{{$account['code']}} - {{$account['name']}}
|
@if($account['current_balance']>=0)
{{ number_format($account['current_balance'],2)}}
@else
({{ number_format(abs($account['current_balance']),2)}})
@endif
|
@php
if(isset($account['tree'])){
$tree=$account['tree']['directChildren'];
}
@endphp
@isset($account['tree'])
{!! generateHTMLForBalanceSheetCustomLevel($tree,1,request('level')+1) !!}
@endisset
@php
$treeTotal = $account['tree']['total'] ?? 0;
@endphp
@if(isset($account['tree']) && $treeTotal != 0)
|
@lang('reports::reports.total') {{$account['name']}}
|
@if($treeTotal >= 0)
{{ number_format($treeTotal,2) }}
@else
({{ number_format(abs($treeTotal),2) }})
@endif
|
@endif
@endif
@endforeach
@if($subCategory['total'] != 0)
|
@lang('reports::reports.total') {{$subCategory['name']}}
|
@if($subCategory['total']>0)
{{ number_format($subCategory['total'],2) }}
@else
({{ number_format(abs($subCategory['total']),2)}})
@endif
|
@endif
@if($category['category']->id!=\Modules\Accounting\Enums\AccountingCategoriesEnum::ASSETS)
|
|
@endif
@endforeach
@if($category['category']->id!=\Modules\Accounting\Enums\AccountingCategoriesEnum::ASSETS)
|
@lang('reports::reports.total') {{$category['category']->name}}
|
@if($category['total']>=0)
{{ number_format($category['total'],2) }}
@else
({{ number_format(abs($category['total']),2)}})
@endif
|
@endif
@if($loop->iteration==1)
{{-- I depeand here the fact that here is only one debit category which is the first one --}}
|
@lang('reports::reports.balance_sheet_total_debit')
|
@if($data['totalDebit']>=0)
{{ number_format($data['totalDebit'],2) }}
@else
({{ number_format(abs($data['totalDebit']),2)}})
@endif
|
{{-- I depeand here the fact that here is only one debit category which is the first one --}}
@else
|
|
@endif
@endforeach
|
@lang('reports::reports.net_earnings')
|
@if($data['net']>=0)
{{ number_format($data['net'],2) }}
@else
({{ number_format(abs($data['net']),2)}})
@endif
|
|
@lang('reports::reports.balance_sheet_total_credit')
|
@if($data['totalCredit']>=0)
{{ number_format($data['totalCredit'],2) }}
@else
({{ number_format(abs($data['totalCredit']),2)}})
@endif
|
@lang('reports::reports.accrual_basis')
{{ Date::now('datetime') }}
@endif