@if($logo && file_exists(storage_path('app/public/' . $logo))) Logo @endif

{{ $applicationName }}

Loan Details Report

Generated on {{ $exportDate }}

Loan: {{ $loan->loan_code }}

{{ \App\Constants\LoanConstants::getStatusName($loan->level_status_id) }}

Client Information

@if($loan->loan_category_id == \App\Constants\LoanConstants::INDIVIDUAL_LOAN) @else @foreach($loan->groupClients as $groupClient) @endforeach @endif
Full Name Gender Phone ID Number Location
{{ $loan->individualClient->client->fullname }} {{ $loan->individualClient->client->gender }} {{ $loan->individualClient->client->phone }} {{ $loan->individualClient->client->idnumber }} {{ $loan->individualClient->client->location }}
{{ $groupClient->client->fullname }} {{ $groupClient->client->gender }} {{ $groupClient->client->phone }} {{ $groupClient->client->idnumber }} {{ $groupClient->client->location }}

Financial Summary

Principal Amount
{{ formatCurrencyDecimals($loan->principal_amount) }}
Interest Rate
{{ formatAmount($loan->interest_rate) }}%
Total Loan Amount
@if($loan->loanType->interest_method == \App\Constants\LoanConstants::DECLINING_BALANCE && $loan->level_status_id == \App\Constants\LoanConstants::PENDING) To be calculated @else {{ formatCurrencyDecimals($loan->loan_amount) }} @endif
Loan Payments
{{ formatCurrencyDecimals($loan->loanDeposits->sum('amount')) }}
({{ $loan->loanDeposits->count() }} payments)
Total Penalties
{{ formatCurrencyDecimals($loan->penalties->sum('amount')) }}
Penalty Payments
{{ formatCurrencyDecimals($loan->penaltyPayments->sum('amount')) }}
({{ $loan->penaltyPayments->count() }} payments)
Outstanding Penalties
{{ formatCurrencyDecimals($loan->penalties->sum('amount') - $loan->penaltyPayments->sum('amount')) }}
Total Balance
@if($loan->loanType->interest_method == \App\Constants\LoanConstants::DECLINING_BALANCE && $loan->level_status_id == \App\Constants\LoanConstants::PENDING) To be calculated @else {{ formatCurrencyDecimals($loan->repaymentSchedules->sum('balance') + ($loan->penalties->sum('amount') - $loan->penaltyPayments->sum('amount'))) }} @endif

Loan Details

Loan Type: {{ $loan->loanType->product_name }}
Loan Officer: {{ $loan->officers->fullname ?? 'N/A' }}
Interest Type: {{ \App\Constants\LoanConstants::getInterestTypeName($loan->loanType->interest_method) }}
Installments: {{ formatAmount($loan->installments) }}
Date Created: {{ Carbon\Carbon::parse($loan->created_at)->format('l, d F Y') }}
First Installment: {{ date('d M, Y (D)', strtotime($loan->first_installment_date)) }}
@if($loan->disbursement_on)
Disbursed On: {{ $loan->disbursement_on->format('l, d F Y') }}
@endif
@if($loan->comment)
Comments: {{ $loan->comment }}
@endif
@if($loan->repaymentSchedules->count() > 0)

Repayment Schedule

@foreach($loan->repaymentSchedules as $index => $schedule) @endforeach
# Date Amount Principal Paid Interest Paid Balance Status
{{ $index + 1 }} {{ $schedule->date?->format('d M, Y') ?? 'N/A' }} {{ formatAmount($schedule->amount) }} {{ formatAmount($schedule->principal_paid) }} {{ formatAmount($schedule->interest_paid) }} {{ formatAmount($schedule->balance) }} {{ ucfirst($schedule->status) }}
TOTALS {{ formatAmount($loan->repaymentSchedules->sum('amount')) }} {{ formatAmount($loan->repaymentSchedules->sum('principal_paid')) }} {{ formatAmount($loan->repaymentSchedules->sum('interest_paid')) }} {{ formatAmount($loan->repaymentSchedules->sum('balance')) }} -
@endif @if($loan->penalties->count() > 0)

Penalty Charges

@foreach($loan->penalties as $penalty) @endforeach
Date Type Amount Status
{{ $penalty->created_at?->format('d M, Y') ?? 'N/A' }} {{ $penalty->type ?? 'Late Payment' }} {{ formatAmount($penalty->amount) }} {{ ucfirst($penalty->status ?? 'pending') }}
TOTAL PENALTIES {{ formatAmount($loan->penalties->sum('amount')) }} -
@endif @if($loan->loanDeposits->count() > 0)

Payment History

@foreach($loan->loanDeposits->sortBy('deposit_date') as $index => $deposit) @endforeach
# Payment Date Amount Payment Method Reference Processed By Date Recorded
{{ $index + 1 }} {{ Carbon\Carbon::parse($deposit->deposit_date)?->format('d M, Y') ?? 'N/A' }} {{ formatAmount($deposit->amount) }} {{ $deposit->payment_method ?? 'Cash' }} {{ $deposit->reference_number ?? '-' }} {{ $deposit->createdBy->fullname ?? 'System' }} {{ $deposit->created_at?->format('d M, Y H:i') ?? 'N/A' }}
TOTAL PAYMENTS {{ formatAmount($loan->loanDeposits->sum('amount')) }} {{ $loan->loanDeposits->count() }} payment(s)
@endif @if($loan->penaltyPayments->count() > 0)

Penalty Payment History

@foreach($loan->penaltyPayments->sortBy('date') as $index => $penaltyPayment) @endforeach
# Payment Date Penalty Type Amount Paid Processed By Date Recorded
{{ $index + 1 }} {{ Carbon\Carbon::parse($penaltyPayment->date)?->format('d M, Y') ?? 'N/A' }} {{ $penaltyPayment->penalty->loanProductPenalty->name ?? 'Penalty Payment' }} {{ formatAmount($penaltyPayment->amount) }} {{ $penaltyPayment->createdBy->fullname ?? 'System' }} {{ $penaltyPayment->created_at?->format('d M, Y H:i') ?? 'N/A' }}
TOTAL PENALTY PAYMENTS {{ formatAmount($loan->penaltyPayments->sum('amount')) }} {{ $loan->penaltyPayments->count() }} payment(s)
@endif