Show tag amount better [skip ci]

This commit is contained in:
James Cole
2015-05-18 17:02:18 +02:00
parent b637455970
commit 064e60e9d5
2 changed files with 18 additions and 1 deletions

View File

@@ -59,6 +59,22 @@ class TransactionJournal extends Model
return $this->belongsToMany('FireflyIII\Models\Category'); return $this->belongsToMany('FireflyIII\Models\Category');
} }
/**
* @return float
*/
public function getActualAmountAttribute()
{
$amount = 0;
/** @var Transaction $t */
foreach ($this->transactions as $t) {
if ($t->amount > 0) {
$amount = floatval($t->amount);
}
}
return $amount;
}
/** /**
* @return float * @return float
*/ */
@@ -88,6 +104,7 @@ class TransactionJournal extends Model
foreach ($others as $other) { foreach ($others as $other) {
$amount -= $other->amount; $amount -= $other->amount;
} }
return $amount; return $amount;
} }

View File

@@ -57,7 +57,7 @@
{% if not hideTags %} {% if not hideTags %}
{{ relevantTags(journal)|raw }} {{ relevantTags(journal)|raw }}
{% else %} {% else %}
{{ journal|formatJournal }} {{ journal.actualAmount|formatAmount }}
{% endif %} {% endif %}
</td> </td>
<td> <td>