mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -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 $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
|
* @codeCoverageIgnore
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
{% if not hideTags %}
|
{% if not hideTags %}
|
||||||
{{ relevantTags(journal)|raw }}
|
{{ relevantTags(journal)|raw }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ journal.actualAmount|formatAmount }}
|
{{ journal.correctedActualAmount|formatAmount }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
Loading…
Reference in New Issue
Block a user