@extends('layouts.app') @push('styles') @endpush @section('content')

{{ $company['name'] ?? 'Company Name' }}

@if(isset($company['address']) && $company['address'])

{{ $company['address'] }}

@endif
@if(isset($company['phone']) && $company['phone'])
{{ $company['phone'] }}
@endif @if(isset($company['email']) && $company['email'])
{{ $company['email'] }}
@endif
@if(isset($company['logo']) && $company['logo'])
{{ $company['name'] }}
@endif

Account Statement

@csrf
Export
Customer Information

Name: {{ $customer->CustomerName }}

Account #: {{ $customer->AccountNo }}

@if($customer->Email)

Email: {{ $customer->Email }}

@endif

Address:

{{ $customer->Address1 }}

@if($customer->Address2)

{{ $customer->Address2 }}

@endif

Phone: {{ $customer->TelNo }}

Statement Summary
Statement Period: {{ $startDate->format('F j, Y') }} - {{ $endDate->format('F j, Y') }}
Opening Balance: {{ number_format($statement['summary']['opening_balance'], 2) }}
Total Debits: {{ number_format($statement['summary']['total_debits'], 2) }}
Total Credits: {{ number_format($statement['summary']['total_credits'], 2) }}
Closing Balance: {{ number_format($statement['summary']['closing_balance'], 2) }}
@foreach($statement['transactions'] as $transaction) @endforeach
Date Description Reference Debit Credit Balance
{{ \Carbon\Carbon::parse($transaction['date'])->format('M j, Y') }} {{ $transaction['description'] }} @if(isset($transaction['entity']->BillType) && $transaction['entity']->BillType)
{{ $transaction['entity']->BillType }} @endif
@if($transaction['type'] === 'bill') @php $billType = $transaction['bill_type'] ?? strtolower($transaction['entity']->BillType ?? ''); $routeName = ''; if ($billType === 'rent') { $routeName = 'bills.rent.show'; } else { $routeName = 'bills.utility.show'; } @endphp @if(Route::has($routeName)) {{ $transaction['reference'] }} @else {{ $transaction['reference'] }} @endif @elseif($transaction['type'] === 'payment' && Route::has('payments.show')) {{ $transaction['reference'] }} @else {{ $transaction['reference'] }} @endif @if($transaction['debit'] > 0) {{ number_format($transaction['debit'], 2) }} @endif @if($transaction['credit'] > 0) {{ number_format($transaction['credit'], 2) }} @endif {{ number_format($transaction['balance'], 2) }}
@endsection @push('scripts') @endpush