@extends('layouts.app') @section('title') {{ trans_choice('accounting::general.balance_sheet', 1) }} @endsection @section('css') @include('accounting::report.partials.report_css') @endsection @section('content') @include('accounting::layouts.nav') @component('accounting::components.section_header') @slot('title') {{ trans_choice('accounting::general.accounting', 1) }} {{ trans_choice('accounting::lang.report', 2) }} @endslot @slot('subtitle') {{ trans_choice('accounting::general.balance_sheet', 1) }} @endslot @endcomponent
@can('product.view')
@component('accounting::components.box') @slot('header')
@component('accounting::components.download_action_button', [ 'url' => Request::url(), 'filters' => http_build_query($_GET), ]) @endcomponent
@endslot @slot('body')

{{ trans_choice('accounting::general.balance_sheet', 1) }} @if (!empty($end_date)) {{ trans('accounting::general.as_on') }}: {{ readable_date($end_date) }} @endif

{{ trans_choice('accounting::lang.clear', 1) }}
@endslot @endcomponent @if (!empty($end_date)) @component('accounting::components.box') @slot('body') @php $assets = $data->where('account_type', 'asset'); $liabilities = $data->where('account_type', 'liability'); $equity = $data->where('account_type', 'equity'); $total_assets = $assets->sum('debit') - $assets->sum('credit'); $total_liabilities = $liabilities->sum('credit') - $liabilities->sum('debit'); $total_equity = $equity->sum('credit') - $equity->sum('debit'); $total_liab_equity = $total_liabilities + $total_equity; // Helper for formatting negatives function fmt($amount) { return $amount < 0 ? '(' . number_format(abs($amount), 2) . ')' : number_format($amount, 2); } @endphp

{{ trans_choice('accounting::general.balance_sheet', 1) }}

@if (!empty($location_id) && !empty($data->first()->business_location))

{{ trans_choice('accounting::lang.business_location', 1) }}: {{ $data->first()->business_location }}

@endif

{{ trans_choice('accounting::general.as_on', 1) }}: {{ readable_date($end_date) }}

{{ __('Assets') }}

@foreach ($assets as $acc) @php $balance = $acc->debit - $acc->credit; @endphp @endforeach
{{ trans_choice('accounting::lang.account', 1) }} {{ trans_choice('accounting::general.balance', 1) }}
{{ $acc->name }} {{ fmt($balance) }}
{{ __('Total Assets') }} {{ fmt($total_assets) }}

{{ __('Liabilities and Equity') }}

@foreach ($liabilities as $acc) @php $balance = $acc->credit - $acc->debit; @endphp @endforeach @foreach ($equity as $acc) @php $balance = $acc->credit - $acc->debit; @endphp @endforeach
{{ trans_choice('accounting::lang.account', 1) }} {{ trans_choice('accounting::general.balance', 1) }}
{{ __('Liabilities') }}
{{ $acc->name }} {{ fmt($balance) }}
{{ __('Total Liabilities') }} {{ fmt($total_liabilities) }}
{{ __('Equity') }}
{{ $acc->name }} {{ fmt($balance) }}
{{ __('Total Equity') }} {{ fmt($total_equity) }}
{{ __('Total Liabilities and Equity') }} {{ fmt($total_liab_equity) }}
{{ __('Total Assets:') }} {{ fmt($total_assets) }}
{{ __('Total Liabilities & Equity:') }} {{ fmt($total_liab_equity) }}
@endslot @endcomponent @endif
@endcan
@stop @section('javascript') @include('accounting::report.partials.report_js') @endsection