@php
$dueAmount = 0;
$paid = 0;
foreach ($row->payments as $payment) {
if ($payment->payment_mode == \App\Models\Payment::MANUAL && $payment->is_approved !== \App\Models\Payment::APPROVED) {
continue;
}
$paid += $payment->amount;
}
$dueAmount = $row->final_amount - $paid;
@endphp
@if ($row->status_label == 'Draft')
{{ __('messages.common.n/a') }}
@else
@if ($row->final_amount == $paid)
Paid:{{ getInvoiceCurrencyAmount($paid, $row->currency_id, true) }}
@elseif($row->status == 3)
Paid:{{ getInvoiceCurrencyAmount($paid, $row->currency_id, true) }}
Due:{{ getInvoiceCurrencyAmount($dueAmount, $row->currency_id, true) }}
@else
Due:{{ getInvoiceCurrencyAmount($dueAmount, $row->currency_id, true) }}
@endif
@endif