Negative expenses, as per #129

This commit is contained in:
James Cole
2015-12-11 18:30:28 +01:00
parent 28c3cfe084
commit c38ae09735
2 changed files with 3 additions and 3 deletions

View File

@@ -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);
}