mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
Show correct amount [skip ci]
This commit is contained in:
parent
064e60e9d5
commit
374b90fb00
@ -152,6 +152,28 @@ class TransactionJournal extends Model
|
||||
return $this->hasMany('FireflyIII\Models\Transaction');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getCorrectedActualAmountAttribute()
|
||||
{
|
||||
$amount = 0;
|
||||
$type = $this->transactionType->type;
|
||||
/** @var Transaction $t */
|
||||
foreach ($this->transactions as $t) {
|
||||
if ($t->amount > 0 && $type != 'Withdrawal') {
|
||||
$amount = floatval($t->amount);
|
||||
break;
|
||||
}
|
||||
if ($t->amount < 0 && $type == 'Withdrawal') {
|
||||
$amount = floatval($t->amount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return array
|
||||
|
@ -57,7 +57,7 @@
|
||||
{% if not hideTags %}
|
||||
{{ relevantTags(journal)|raw }}
|
||||
{% else %}
|
||||
{{ journal.actualAmount|formatAmount }}
|
||||
{{ journal.correctedActualAmount|formatAmount }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
|
Loading…
Reference in New Issue
Block a user