From c38ae09735f7aa511e93f4cd5b1836cfd45d4e8d Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 11 Dec 2015 18:30:28 +0100 Subject: [PATCH] Negative expenses, as per #129 --- app/Helpers/Collection/Expense.php | 4 ++-- resources/twig/partials/reports/expenses.twig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Helpers/Collection/Expense.php b/app/Helpers/Collection/Expense.php index e165feb365..b8218fdf9f 100644 --- a/app/Helpers/Collection/Expense.php +++ b/app/Helpers/Collection/Expense.php @@ -36,7 +36,7 @@ class Expense $accountId = $entry->account_id; if (!$this->expenses->has($accountId)) { $newObject = new stdClass; - $newObject->amount = strval(round($entry->amount_positive, 2)); + $newObject->amount = strval(round($entry->amount, 2)); $newObject->name = $entry->name; $newObject->count = 1; $newObject->id = $accountId; @@ -44,7 +44,7 @@ class Expense } else { bcscale(2); $existing = $this->expenses->get($accountId); - $existing->amount = bcadd($existing->amount, $entry->amount_positive); + $existing->amount = bcadd($existing->amount, $entry->amount); $existing->count++; $this->expenses->put($accountId, $existing); } diff --git a/resources/twig/partials/reports/expenses.twig b/resources/twig/partials/reports/expenses.twig index eb3f1d035c..c8c6f6b860 100644 --- a/resources/twig/partials/reports/expenses.twig +++ b/resources/twig/partials/reports/expenses.twig @@ -18,7 +18,7 @@ {{ expense.count }} {{ 'transactions'|_|lower }} {% endif %} - {{ (expense.amount)|formatAmountPlain }} + {{ (expense.amount)|formatAmount }} {% endfor %}