formatting
This commit is contained in:
parent
321fb074d5
commit
97d67fee9d
@ -91,25 +91,11 @@ class Account extends Model
|
|||||||
// Opening Balance
|
// Opening Balance
|
||||||
$total = $this->opening_balance;
|
$total = $this->opening_balance;
|
||||||
|
|
||||||
// Sum invoices
|
// Sum Incomes
|
||||||
foreach ($this->invoice_payments as $item) {
|
$total += $this->invoice_payments()->sum('amount') + $this->revenues()->sum('amount');
|
||||||
$total += $item->amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sum revenues
|
// Subtract Expenses
|
||||||
foreach ($this->revenues as $item) {
|
$total -= $this->bill_payments()->sum('amount') + $this->payments()->sum('amount');
|
||||||
$total += $item->amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subtract bills
|
|
||||||
foreach ($this->bill_payments as $item) {
|
|
||||||
$total -= $item->amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subtract payments
|
|
||||||
foreach ($this->payments as $item) {
|
|
||||||
$total -= $item->amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user