Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Apr 5, 2019
1 parent 321fb07 commit 97d67fe
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions app/Models/Banking/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,11 @@ public function getBalanceAttribute()
// Opening Balance
$total = $this->opening_balance;

// Sum invoices
foreach ($this->invoice_payments as $item) {
$total += $item->amount;
}

// Sum revenues
foreach ($this->revenues as $item) {
$total += $item->amount;
}

// Subtract bills
foreach ($this->bill_payments as $item) {
$total -= $item->amount;
}

// Subtract payments
foreach ($this->payments as $item) {
$total -= $item->amount;
}
// Sum Incomes
$total += $this->invoice_payments()->sum('amount') + $this->revenues()->sum('amount');

// Subtract Expenses
$total -= $this->bill_payments()->sum('amount') + $this->payments()->sum('amount');

return $total;
}
Expand Down

0 comments on commit 97d67fe

Please sign in to comment.