Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Negative expenses, as per #129
James Colec38ae09735f7
diff --git a/app/Helpers/Collection/Expense.php b/app/Helpers/Collection/Expense.phpindex 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.twigindex eb3f1d035c..c8c6f6b860 100644--- a/resources/twig/partials/reports/expenses.twig+++ b/resources/twig/partials/reports/expenses.twig@@ -18,7 +18,7 @@<small>{{ expense.count }} {{ 'transactions'|_|lower }}</small>{% endif %}</td>- <td><span class="text-danger">{{ (expense.amount)|formatAmountPlain }}</span></td>+ <td>{{ (expense.amount)|formatAmount }}</td></tr>{% endfor %}</tbody>