@extends('layouts.master') @section('title', 'Balance Sheet') @push('style') @endpush @section('content')
{{-- --}} {{-- Back--}} {{-- --}}
@php $company = optional($accountGroups->first())->company; @endphp
{{-- @if (optional(optional($company)->company_details)->header)--}} {{-- {{ optional($company)->name }}--}} {{-- @else--}}

{{ optional($company)->name }}

{{-- @endif--}}

Balance Sheet

From: {{ fdate(request('from')) }}
@php $totalOwnerEquity = 0; $asset = 0; @endphp @foreach($accountGroups as $key => $accountGroup)

{{ $accountGroup->name }}

@foreach($accountGroup->accounts->where('balance', '<>', 0)->sortBy('name') as $account) @endforeach @if ($loop->iteration > 1) @php $totalOwnerEquity += $totalBalance; @endphp @else @php $asset = $totalBalance; @endphp @endif @if($loop->last) @endif
{{ $account->name }} {{ number_format($account->balance ?? 0, 2) }}
Total {{ $accountGroup->name }} {{ number_format($totalBalance = $accountGroup->accounts->sum('balance'), 2) }}
Liabilities and Owners Equity {{ number_format($totalOwnerEquity, 2) }}
Current Equity {{ number_format($currentEquity = ($asset - $totalOwnerEquity), 2) }}
Total Liabilities and Owners Equity {{ number_format($totalOwnerEquity + $currentEquity, 2) }}
@endforeach
{{-- @if (optional(optional($company)->company_details)->header)--}} {{-- {{ optional($company)->name }}--}} {{-- @endif--}}
@endsection @section('js') @endsection