mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-02 10:22:09 +00:00
Negative expenses, as per #129
This commit is contained in:
@@ -36,7 +36,7 @@ class Expense
|
|||||||
$accountId = $entry->account_id;
|
$accountId = $entry->account_id;
|
||||||
if (!$this->expenses->has($accountId)) {
|
if (!$this->expenses->has($accountId)) {
|
||||||
$newObject = new stdClass;
|
$newObject = new stdClass;
|
||||||
$newObject->amount = strval(round($entry->amount_positive, 2));
|
$newObject->amount = strval(round($entry->amount, 2));
|
||||||
$newObject->name = $entry->name;
|
$newObject->name = $entry->name;
|
||||||
$newObject->count = 1;
|
$newObject->count = 1;
|
||||||
$newObject->id = $accountId;
|
$newObject->id = $accountId;
|
||||||
@@ -44,7 +44,7 @@ class Expense
|
|||||||
} else {
|
} else {
|
||||||
bcscale(2);
|
bcscale(2);
|
||||||
$existing = $this->expenses->get($accountId);
|
$existing = $this->expenses->get($accountId);
|
||||||
$existing->amount = bcadd($existing->amount, $entry->amount_positive);
|
$existing->amount = bcadd($existing->amount, $entry->amount);
|
||||||
$existing->count++;
|
$existing->count++;
|
||||||
$this->expenses->put($accountId, $existing);
|
$this->expenses->put($accountId, $existing);
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<small>{{ expense.count }} {{ 'transactions'|_|lower }}</small>
|
<small>{{ expense.count }} {{ 'transactions'|_|lower }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td><span class="text-danger">{{ (expense.amount)|formatAmountPlain }}</span></td>
|
<td>{{ (expense.amount)|formatAmount }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Reference in New Issue
Block a user