mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Show correct amount [skip ci]
This commit is contained in:
@@ -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>
|
||||||
|
Reference in New Issue
Block a user