mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 09:51:21 -06:00
Negative expenses, as per #129
This commit is contained in:
parent
28c3cfe084
commit
c38ae09735
@ -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);
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user