@php use Carbon\Carbon; $statement = $loan->statement; $collection = collect($statement->more); $data = '
'; $data .= '
ACCOUNT STATEMENT FOR : ' . strtoupper($loan->more->account_info->first_name . ' ' . $loan->more->account_info->last_name) . '
ACCOUNT STATEMENT
EMAIL ADDRESS: ' . strtoupper($loan->more->account_info->personal_email) . '
ACCOUNT NAME: ' . strtoupper($loan->more->account_info->first_name) . ' ' . strtoupper($loan->more->account_info->other_name) . ' ' . strtoupper($loan->more->account_info->last_name) . '
'; $data .= '
'; $data .= ' '; $data .= '
ACCOUNT SUMMARY
Currency Opening Balance Credits Debits Closing Balance
NGN' . number_format($collection->first()->amount, 2) . ' ' . number_format($collection->where('type', 'credit')->sum('amount'), 2) . ' ' . number_format($collection->where('type', 'debit')->sum('amount'), 2) . ' ' . number_format($collection->last()->amount, 2) . '
'; foreach ($statement->more as $file) { $data .= ''; $data .= ''; $data .= ''; if ($file->type == 'debit') { $data .= ''; $data .= ''; } else { $data .= ''; $data .= ''; } $data .= ''; } $data .= '
DATE NARATION DEBIT AMOUNT CREDIT AMOUNT BALANCE
' . Carbon::parse($file->date)->format('F d, Y h:i A') . '' . $file->narration . '-' . number_format($file->amount, 2) . '+' . number_format($file->amount, 2) . '' . number_format($file->balance, 2) . '
'; $data .= '
'; @endphp {!! $data !!}