@php use Carbon\Carbon; $statement = $loan->statement; $collection = collect($statement->more); $data = '
ACCOUNT SUMMARY | ||||
---|---|---|---|---|
Currency | Opening Balance | Credits | Debits | Closing Balance |
NGN | '; $data .= '' . 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) . ' | '; $data .= '
DATE | NARATION | DEBIT AMOUNT | CREDIT AMOUNT | BALANCE | ||
---|---|---|---|---|---|---|
' . Carbon::parse($file->date)->format('F d, Y h:i A') . ' | '; $data .= '' . $file->narration . ' | '; if ($file->type == 'debit') { $data .= '-' . number_format($file->amount, 2) . ' | '; $data .= ''; } else { $data .= ' | '; $data .= ' | +' . number_format($file->amount, 2) . ' | '; } $data .= '' . number_format($file->balance, 2) . ' | '; } $data .= '