@php
$totalCredit = $expense_payment->total_credit_match;
$totalDebit = $expense_payment->total_debit_match;
$previousBalance = $expense_payment->expenses->previous_balance;
// if both greater than 0
if ($totalCredit > 0 && $totalDebit > 0) {
$balance = $previousBalance + $totalCredit;
$balance = $balance - $totalDebit;
} elseif ($totalCredit >= 0 || $totalDebit >= 0) {
$balance = $previousBalance + $totalCredit;
$balance = $balance - $totalDebit;
}
@endphp
{{-- @dd($balance); --}}
{{ $loop->iteration }} |
{{ $expense_payment->expenses->name }} |
{{ $previousBalance }} |
{{ $totalCredit }} |
{{ $totalDebit }} |
{{ $balance }} |
@endforeach