@extends('layouts.user') @section('title', __('balance_sheet.balance_sheet')) @section('page_title', __('balance_sheet.balance_sheet')) @section('breadcrumb', __('balance_sheet.reports') . ' / ' . __('balance_sheet.balance_sheet')) @section('content') @php $fmt = fn($v) => number_format((float) $v, 2); $asOfDate = \Carbon\Carbon::parse($asOf)->format('d M, Y'); $differenceAbs = abs((float) ($difference ?? 0)); $isBalanced = $differenceAbs < 0.01; $assetItems = [ ['label' => __('balance_sheet.cash_bank_mfs_balance'), 'amount' => $totalAccountBalances ?? 0], ['label' => __('balance_sheet.customer_receivable'), 'amount' => $customerDue ?? 0], ['label' => __('balance_sheet.employee_outstanding_advance'), 'amount' => $employeeOutstandingAdvance ?? 0], ]; $liabilityItems = [ ['label' => __('balance_sheet.supplier_payable'), 'amount' => $supplierDue ?? 0], ['label' => __('balance_sheet.loan_payable'), 'amount' => $loanPayable ?? 0], ['label' => __('balance_sheet.unpaid_employee_bonus'), 'amount' => $unpaidEmployeeBonus ?? 0], ['label' => __('balance_sheet.salary_due'), 'amount' => $salaryDue ?? 0], ]; $equityItems = [ ['label' => __('balance_sheet.owner_capital'), 'amount' => $ownerCapital ?? 0], ['label' => __('balance_sheet.retained_earnings'), 'amount' => $retainedEarnings ?? 0], ]; @endphp
{{-- Header --}}

{{ __('balance_sheet.financial_position') }}

{{ __('balance_sheet.balance_sheet') }}

{{ __('balance_sheet.as_of') }} {{ $asOfDate }}

PDF
{{-- Top Cards --}}

{{ __('balance_sheet.total_assets') }}

{{ $fmt($totalAssets ?? 0) }}

{{ __('balance_sheet.total_liabilities') }}

{{ $fmt($totalLiabilities ?? 0) }}

{{ __('balance_sheet.total_equity') }}

{{ $fmt($equity ?? 0) }}

{{ __('balance_sheet.status') }}

{{ $isBalanced ? __('balance_sheet.balanced') : __('balance_sheet.needs_review') }}

{{-- Statement --}}
{{-- Assets --}}

{{ __('balance_sheet.assets') }}

{{ __('balance_sheet.company_will_receive_owns') }}

@foreach ($assetItems as $item)
{{ $item['label'] }} {{ $fmt($item['amount']) }}
@endforeach
{{ __('balance_sheet.total_assets') }} {{ $fmt($totalAssets ?? 0) }}
{{-- Liabilities + Equity --}}

{{ __('balance_sheet.liabilities') }}

{{ __('balance_sheet.company_needs_to_pay') }}

@foreach ($liabilityItems as $item)
{{ $item['label'] }} {{ $fmt($item['amount']) }}
@endforeach
{{ __('balance_sheet.total_liabilities') }} {{ $fmt($totalLiabilities ?? 0) }}

{{ __('balance_sheet.equity') }}

{{ __('balance_sheet.owner_interest_in_business') }}

@foreach ($equityItems as $item)
{{ $item['label'] }} {{ $fmt($item['amount']) }}
@endforeach
{{ __('balance_sheet.total_equity') }} {{ $fmt($equity ?? 0) }}
{{ __('balance_sheet.liabilities_plus_equity') }} {{ $fmt(($totalLiabilities ?? 0) + ($equity ?? 0)) }}
{{-- Accounts details --}}

{{ __('balance_sheet.cash_bank_mfs_details') }}

{{ __('balance_sheet.account_wise_balance_summary') }}

{{ __('balance_sheet.total') }}: {{ $fmt($totalAccountBalances ?? 0) }}
@forelse ($accountRows ?? [] as $row) @empty @endforelse @if (!empty($accountRows) && count($accountRows)) @endif
{{ __('balance_sheet.account') }} {{ __('balance_sheet.type') }} {{ __('balance_sheet.account_no') }} {{ __('balance_sheet.opening') }} {{ __('balance_sheet.debit') }} {{ __('balance_sheet.credit') }} {{ __('balance_sheet.balance') }}
{{ $row['name'] }} {{ str_replace('_', ' ', $row['type']) }} {{ $row['account_number'] ?: '—' }} {{ $fmt($row['opening']) }} {{ $fmt($row['debit']) }} {{ $fmt($row['credit']) }} {{ $fmt($row['balance']) }}
{{ __('balance_sheet.no_active_account_found') }}
{{ __('balance_sheet.total') }} {{ $fmt($totalOpeningBalances ?? 0) }} {{ $fmt(collect($accountRows)->sum('debit')) }} {{ $fmt(collect($accountRows)->sum('credit')) }} {{ $fmt($totalAccountBalances ?? 0) }}
{{-- Helpers --}}

{{ __('balance_sheet.profit_retained_earnings_summary') }}

{{ __('balance_sheet.total_sales') }} {{ $fmt($totalSales ?? 0) }}
{{ __('balance_sheet.purchase_cost') }} {{ $fmt($totalPurchaseCost ?? 0) }}
{{ __('balance_sheet.general_expenses') }} {{ $fmt($totalExpenses ?? 0) }}
{{ __('balance_sheet.payroll_expense') }} {{ $fmt($payrollExpense ?? 0) }}
{{ __('balance_sheet.bonus_expense') }} {{ $fmt($bonusExpense ?? 0) }}
{{ __('balance_sheet.loan_interest_expense') }} {{ $fmt($loanInterestExpense ?? 0) }}
{{ __('balance_sheet.loan_fee_expense') }} {{ $fmt($loanFeeExpense ?? 0) }}
{{ __('balance_sheet.loan_finance_cost') }} {{ $fmt($loanFinanceCost ?? 0) }}
{{ __('balance_sheet.retained_earnings') }} {{ $fmt($retainedEarnings ?? 0) }}

{{ __('balance_sheet.owner_capital_summary') }}

{{ __('balance_sheet.owner_investment') }} {{ $fmt($ownerInvestment ?? 0) }}
{{ __('balance_sheet.owner_drawings') }} {{ $fmt($ownerDrawings ?? 0) }}
{{ __('balance_sheet.recorded_capital') }} {{ $fmt($ownerCapitalRecorded ?? 0) }}
{{ __('balance_sheet.retained_earnings') }} {{ $fmt($retainedEarnings ?? 0) }}
{{ __('balance_sheet.total_equity') }} {{ $fmt($equity ?? 0) }}
@endsection