replaced revenues/payments with transactions

This commit is contained in:
denisdulici
2019-11-27 12:08:36 +03:00
parent e4d0de0677
commit 3a15c1d615
28 changed files with 139 additions and 141 deletions

View File

@@ -27,14 +27,14 @@ class TotalExpenses extends AbstractWidget
$expenses_amount = $open_bill = $overdue_bill = 0;
// Get categories
$categories = Category::with(['bills', 'payments'])->type(['expense'])->enabled()->get();
$categories = Category::with(['bills', 'expense_transactions'])->type(['expense'])->enabled()->get();
foreach ($categories as $category) {
$amount = 0;
// Payments
foreach ($category->payments as $payment) {
$amount += $payment->getAmountConvertedToDefault();
// Transactions
foreach ($category->expense_transactions as $transaction) {
$amount += $transaction->getAmountConvertedToDefault();
}
$expenses_amount += $amount;