diff --git a/resources/views/pages/pdfs/company_account_statement_transaction.blade.php b/resources/views/pages/pdfs/company_account_statement_transaction.blade.php index c04b20b9..a227b686 100644 --- a/resources/views/pages/pdfs/company_account_statement_transaction.blade.php +++ b/resources/views/pages/pdfs/company_account_statement_transaction.blade.php @@ -61,7 +61,65 @@ + @php + $roundOff = 2; + if ($isPrecise) { + $roundOff = 5; + } + $current_running_balance = 0; + @endphp + @foreach ($transactions as $key => $transaction) + @php + $description = ""; + $incoming = ""; + $outgoing = ""; + $marking = ""; + switch ($transaction->type) { + case 1: + if ($transaction->owner_type === "App\Models\Booking") { + $description = "Payment
" . $transaction->bill_no; + $marking = $transaction->owner->marking; + } else { + $description = "Payment
" . $transaction->bill_no; + $marking = App\Models\Transaction::where('payment_reference', $transaction->bill_no)->first()->owner->marking; + } + $outgoing = number_format(trim($transaction->amount), $roundOff); + break; + case 2: + $description = "Invoice
" . $transaction->bill_no; + $incoming = number_format((trim($transaction->amount) / $transaction->currency_rate + $transaction->service_charge), $roundOff); + $marking = $transaction->owner->marking; + break; + case 5: + $description = "Top Up
" . $transaction->payment_reference; + $incoming = number_format(trim($transaction->amount), $roundOff); + break; + case 9: + $description = "Credit Note
" . $transaction->payment_reference; + $incoming = number_format(trim($transaction->amount), $roundOff); + break; + } + + $current_running_balance = floatval($current_running_balance) + floatval($incoming) - floatval($outgoing); + $current_running_balance = number_format($current_running_balance, $roundOff); + + @endphp + + {{ $key + 1 }} + {{ \Carbon\Carbon::parse($transaction->created_at)->format('Y-m-d') }} + {!! $description !!}
{{$marking}} + + {{ $incoming }} + + + {{ $outgoing }} + + + {{ $current_running_balance }} + + + @endforeach