@php
$totalCredit = $supplier_payment->total_credit_match;
$totalDebit = $supplier_payment->total_debit_match;
$previousBalance = $supplier_payment->suppliers->previous_balance;
if ($totalCredit > 0 && $totalDebit > 0) {
$balance = $previousBalance + $totalCredit;
$balance = $balance - $totalDebit;
} elseif ($totalCredit >= 0 || $totalDebit >= 0) {
$balance = $previousBalance + $totalCredit;
$balance = $balance - $totalDebit;
}
@endphp
{{ $loop->iteration }} |
{{ $supplier_payment->suppliers->name }} |
{{ $previousBalance }} |
{{ $totalCredit }} |
{{ $totalDebit }} |
{{ $balance }} |
@endforeach