mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-13 07:53:16 +00:00
Clean up some money formatting routines.
This commit is contained in:
@@ -43,16 +43,16 @@ class Amount
|
|||||||
* This method will properly format the given number, in color or "black and white",
|
* This method will properly format the given number, in color or "black and white",
|
||||||
* as a currency, given two things: the currency required and the current locale.
|
* as a currency, given two things: the currency required and the current locale.
|
||||||
*
|
*
|
||||||
* @param TransactionCurrency $format
|
* @param \FireflyIII\Models\TransactionCurrency $format
|
||||||
* @param string $amount
|
* @param string $amount
|
||||||
* @param bool $coloured
|
* @param bool $coloured
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string
|
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string
|
||||||
{
|
{
|
||||||
$locale = setlocale(LC_MONETARY, 0);
|
$locale = setlocale(LC_MONETARY, 0);
|
||||||
$float = round($amount, 2);
|
$float = round($amount, 12);
|
||||||
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
||||||
$result = $formatter->formatCurrency($float, $format->code);
|
$result = $formatter->formatCurrency($float, $format->code);
|
||||||
|
|
||||||
@@ -74,6 +74,22 @@ class Amount
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used in many places (unfortunately).
|
||||||
|
*
|
||||||
|
* @param string $currencyCode
|
||||||
|
* @param string $amount
|
||||||
|
* @param bool $coloured
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function formatByCode(string $currencyCode, string $amount, bool $coloured = true): string
|
||||||
|
{
|
||||||
|
$currency = TransactionCurrency::whereCode($currencyCode)->first();
|
||||||
|
|
||||||
|
return $this->formatAnything($currency, $amount, $coloured);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param \FireflyIII\Models\TransactionJournal $journal
|
* @param \FireflyIII\Models\TransactionJournal $journal
|
||||||
@@ -83,27 +99,9 @@ class Amount
|
|||||||
*/
|
*/
|
||||||
public function formatJournal(TransactionJournal $journal, bool $coloured = true): string
|
public function formatJournal(TransactionJournal $journal, bool $coloured = true): string
|
||||||
{
|
{
|
||||||
$locale = setlocale(LC_MONETARY, 0);
|
$currency = $journal->transactionCurrency;
|
||||||
$float = round(TransactionJournal::amount($journal), 2);
|
|
||||||
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
|
||||||
$currencyCode = $journal->transaction_currency_code ?? $journal->transactionCurrency->code;
|
|
||||||
$result = $formatter->formatCurrency($float, $currencyCode);
|
|
||||||
|
|
||||||
if ($coloured === true && $float === 0.00) {
|
return $this->formatAnything($currency, TransactionJournal::amount($journal), $coloured);
|
||||||
return '<span style="color:#999">' . $result . '</span>'; // always grey.
|
|
||||||
}
|
|
||||||
if (!$coloured) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
if (!$journal->isTransfer()) {
|
|
||||||
if ($float > 0) {
|
|
||||||
return '<span class="text-success">' . $result . '</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<span class="text-danger">' . $result . '</span>';
|
|
||||||
} else {
|
|
||||||
return '<span class="text-info">' . $result . '</span>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,41 +117,6 @@ class Amount
|
|||||||
return $this->formatAnything($currency, strval($transaction->amount), $coloured);
|
return $this->formatAnything($currency, strval($transaction->amount), $coloured);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method will properly format the given number, in color or "black and white",
|
|
||||||
* as a currency, given two things: the currency required and the currency code.
|
|
||||||
*
|
|
||||||
* @param string $code
|
|
||||||
* @param string $amount
|
|
||||||
* @param bool $coloured
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function formatWithCode(string $code, string $amount, bool $coloured = true): string
|
|
||||||
{
|
|
||||||
$locale = setlocale(LC_MONETARY, 0);
|
|
||||||
$float = round($amount, 2);
|
|
||||||
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
|
||||||
$result = $formatter->formatCurrency($float, $code);
|
|
||||||
|
|
||||||
if ($coloured === true) {
|
|
||||||
|
|
||||||
if ($amount > 0) {
|
|
||||||
return sprintf('<span class="text-success">%s</span>', $result);
|
|
||||||
} else {
|
|
||||||
if ($amount < 0) {
|
|
||||||
return sprintf('<span class="text-danger">%s</span>', $result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sprintf('<span style="color:#999">%s</span>', $result);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
|
@@ -33,96 +33,6 @@ use Twig_SimpleFunction;
|
|||||||
class Journal extends Twig_Extension
|
class Journal extends Twig_Extension
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Twig_SimpleFunction
|
|
||||||
*/
|
|
||||||
public function formatAccountPerspective(): Twig_SimpleFunction
|
|
||||||
{
|
|
||||||
return new Twig_SimpleFunction(
|
|
||||||
'formatAccountPerspective', function (TransactionJournal $journal, Account $account) {
|
|
||||||
|
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty('formatAccountPerspective');
|
|
||||||
$cache->addProperty($journal->id);
|
|
||||||
$cache->addProperty($account->id);
|
|
||||||
|
|
||||||
if ($cache->has()) {
|
|
||||||
return $cache->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the account amount:
|
|
||||||
$transactions = $journal->transactions()->where('transactions.account_id', $account->id)->get(['transactions.*']);
|
|
||||||
$amount = '0';
|
|
||||||
foreach ($transactions as $transaction) {
|
|
||||||
$amount = bcadd($amount, strval($transaction->amount));
|
|
||||||
}
|
|
||||||
if ($journal->isTransfer()) {
|
|
||||||
$amount = bcmul($amount, '-1');
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if this sum is the same as the journal:
|
|
||||||
$journalSum = TransactionJournal::amount($journal);
|
|
||||||
$full = Amount::formatJournal($journal);
|
|
||||||
if (bccomp($journalSum, $amount) === 0 || bccomp(bcmul($journalSum, '-1'), $amount) === 0) {
|
|
||||||
$cache->store($full);
|
|
||||||
|
|
||||||
return $full;
|
|
||||||
}
|
|
||||||
|
|
||||||
$formatted = Amount::format($amount, true);
|
|
||||||
|
|
||||||
if ($journal->isTransfer()) {
|
|
||||||
$formatted = '<span class="text-info">' . Amount::format($amount) . '</span>';
|
|
||||||
}
|
|
||||||
$str = $formatted . ' (' . $full . ')';
|
|
||||||
$cache->store($str);
|
|
||||||
|
|
||||||
return $str;
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Twig_SimpleFunction
|
|
||||||
*/
|
|
||||||
public function formatBudgetPerspective(): Twig_SimpleFunction
|
|
||||||
{
|
|
||||||
return new Twig_SimpleFunction(
|
|
||||||
'formatBudgetPerspective', function (TransactionJournal $journal, ModelBudget $budget) {
|
|
||||||
|
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty('formatBudgetPerspective');
|
|
||||||
$cache->addProperty($journal->id);
|
|
||||||
$cache->addProperty($budget->id);
|
|
||||||
|
|
||||||
if ($cache->has()) {
|
|
||||||
return $cache->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the account amount:
|
|
||||||
$transactions = $journal->transactions()->where('transactions.amount', '<', 0)->get(['transactions.*']);
|
|
||||||
$amount = '0';
|
|
||||||
foreach ($transactions as $transaction) {
|
|
||||||
$currentBudget = $transaction->budgets->first();
|
|
||||||
if (!is_null($currentBudget) && $currentBudget->id === $budget->id) {
|
|
||||||
$amount = bcadd($amount, strval($transaction->amount));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($amount === '0') {
|
|
||||||
$formatted = Amount::formatJournal($journal);
|
|
||||||
$cache->store($formatted);
|
|
||||||
|
|
||||||
return $formatted;
|
|
||||||
}
|
|
||||||
|
|
||||||
$formatted = Amount::format($amount, true) . ' (' . Amount::formatJournal($journal) . ')';
|
|
||||||
$cache->store($formatted);
|
|
||||||
|
|
||||||
return $formatted;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Twig_SimpleFunction
|
* @return Twig_SimpleFunction
|
||||||
@@ -178,8 +88,6 @@ class Journal extends Twig_Extension
|
|||||||
$functions = [
|
$functions = [
|
||||||
$this->getSourceAccount(),
|
$this->getSourceAccount(),
|
||||||
$this->getDestinationAccount(),
|
$this->getDestinationAccount(),
|
||||||
$this->formatAccountPerspective(),
|
|
||||||
$this->formatBudgetPerspective(),
|
|
||||||
$this->journalBudgets(),
|
$this->journalBudgets(),
|
||||||
$this->journalCategories(),
|
$this->journalCategories(),
|
||||||
];
|
];
|
||||||
|
@@ -17,6 +17,7 @@ use Amount;
|
|||||||
use Crypt;
|
use Crypt;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\Transaction as TransactionModel;
|
use FireflyIII\Models\Transaction as TransactionModel;
|
||||||
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
use Twig_SimpleFilter;
|
use Twig_SimpleFilter;
|
||||||
@@ -29,15 +30,16 @@ use Twig_SimpleFunction;
|
|||||||
*/
|
*/
|
||||||
class Transaction extends Twig_Extension
|
class Transaction extends Twig_Extension
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Twig_SimpleFunction
|
* @return Twig_SimpleFunction
|
||||||
*/
|
*/
|
||||||
public function formatAmountPlainWithCode(): Twig_SimpleFunction
|
public function formatAnything(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'formatAmountPlainWithCode', function (string $amount, string $code): string {
|
'formatAnything', function (TransactionCurrency $currency, string $amount): string {
|
||||||
|
|
||||||
return Amount::formatWithCode($code, $amount, false);
|
return Amount::formatAnything($currency, $amount, true);
|
||||||
|
|
||||||
}, ['is_safe' => ['html']]
|
}, ['is_safe' => ['html']]
|
||||||
);
|
);
|
||||||
@@ -46,12 +48,26 @@ class Transaction extends Twig_Extension
|
|||||||
/**
|
/**
|
||||||
* @return Twig_SimpleFunction
|
* @return Twig_SimpleFunction
|
||||||
*/
|
*/
|
||||||
public function formatAmountWithCode(): Twig_SimpleFunction
|
public function formatAnythingPlain(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'formatAmountWithCode', function (string $amount, string $code): string {
|
'formatAnythingPlain', function (TransactionCurrency $currency, string $amount): string {
|
||||||
|
|
||||||
return Amount::formatWithCode($code, $amount, true);
|
return Amount::formatAnything($currency, $amount, false);
|
||||||
|
|
||||||
|
}, ['is_safe' => ['html']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Twig_SimpleFunction
|
||||||
|
*/
|
||||||
|
public function formatByCode(): Twig_SimpleFunction
|
||||||
|
{
|
||||||
|
return new Twig_SimpleFunction(
|
||||||
|
'formatByCode', function (string $currencyCode, string $amount): string {
|
||||||
|
|
||||||
|
return Amount::formatByCode($currencyCode, $amount, true);
|
||||||
|
|
||||||
}, ['is_safe' => ['html']]
|
}, ['is_safe' => ['html']]
|
||||||
);
|
);
|
||||||
@@ -75,8 +91,8 @@ class Transaction extends Twig_Extension
|
|||||||
public function getFunctions(): array
|
public function getFunctions(): array
|
||||||
{
|
{
|
||||||
$functions = [
|
$functions = [
|
||||||
$this->formatAmountWithCode(),
|
$this->formatAnything(),
|
||||||
$this->formatAmountPlainWithCode(),
|
$this->formatAnythingPlain(),
|
||||||
$this->transactionSourceAccount(),
|
$this->transactionSourceAccount(),
|
||||||
$this->transactionDestinationAccount(),
|
$this->transactionDestinationAccount(),
|
||||||
$this->optionalJournalAmount(),
|
$this->optionalJournalAmount(),
|
||||||
@@ -85,6 +101,7 @@ class Transaction extends Twig_Extension
|
|||||||
$this->transactionCategories(),
|
$this->transactionCategories(),
|
||||||
$this->transactionIdCategories(),
|
$this->transactionIdCategories(),
|
||||||
$this->splitJournalIndicator(),
|
$this->splitJournalIndicator(),
|
||||||
|
$this->formatByCode(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $functions;
|
return $functions;
|
||||||
@@ -107,24 +124,17 @@ class Transaction extends Twig_Extension
|
|||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'optionalJournalAmount', function (int $journalId, string $transactionAmount, string $code, string $type): string {
|
'optionalJournalAmount', function (int $journalId, string $transactionAmount, string $code, string $type): string {
|
||||||
|
// get amount of journal:
|
||||||
$amount = strval(
|
$amount = strval(TransactionModel::where('transaction_journal_id', $journalId)->whereNull('deleted_at')->where('amount', '<', 0)->sum('amount'));
|
||||||
TransactionModel::where('transaction_journal_id', $journalId)
|
// display deposit and transfer positive
|
||||||
->whereNull('deleted_at')
|
|
||||||
->where('amount', '<', 0)
|
|
||||||
->sum('amount')
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($type === TransactionType::DEPOSIT || $type === TransactionType::TRANSFER) {
|
if ($type === TransactionType::DEPOSIT || $type === TransactionType::TRANSFER) {
|
||||||
$amount = bcmul($amount, '-1');
|
$amount = bcmul($amount, '-1');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
// not equal to transaction amount?
|
||||||
bccomp($amount, $transactionAmount) !== 0
|
if (bccomp($amount, $transactionAmount) !== 0 && bccomp($amount, bcmul($transactionAmount, '-1')) !== 0) {
|
||||||
&& bccomp($amount, bcmul($transactionAmount, '-1')) !== 0
|
//$currency =
|
||||||
) {
|
return sprintf(' (%s)', 'x'); // Amount::formatWithCode($code, $amount, true)
|
||||||
// not equal?
|
|
||||||
return sprintf(' (%s)', Amount::formatWithCode($code, $amount, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@@ -70,10 +70,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- format amount of transaction -->
|
<!-- format amount of transaction -->
|
||||||
{{ formatAmountWithCode(transaction.transaction_amount, transaction.transaction_currency_code) }}
|
{{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
|
||||||
<!-- and then amount of journal itself. -->
|
<!-- and then amount of journal itself. -->
|
||||||
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount,
|
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
||||||
transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
@@ -15,10 +15,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="pull-right small">
|
<span class="pull-right small">
|
||||||
<!-- format amount of transaction -->
|
<!-- format amount of transaction -->
|
||||||
{{ formatAmountWithCode(transaction.transaction_amount, transaction.transaction_currency_code) }}
|
{{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
|
||||||
<!-- and then amount of journal itself. -->
|
<!-- and then amount of journal itself. -->
|
||||||
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount,
|
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
||||||
transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@@ -46,10 +46,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- format amount of transaction -->
|
<!-- format amount of transaction -->
|
||||||
{{ formatAmountWithCode(transaction.transaction_amount, transaction.transaction_currency_code) }}
|
{{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
|
||||||
<!-- and then amount of journal itself. -->
|
<!-- and then amount of journal itself. -->
|
||||||
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount,
|
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
||||||
transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="hidden-sm hidden-xs">
|
<td class="hidden-sm hidden-xs">
|
||||||
{{ transaction.date.formatLocalized(monthAndDayFormat) }}
|
{{ transaction.date.formatLocalized(monthAndDayFormat) }}
|
||||||
|
@@ -60,10 +60,9 @@
|
|||||||
<td class="hide-balance_before">{{ transaction.before|formatAmount }}</td>
|
<td class="hide-balance_before">{{ transaction.before|formatAmount }}</td>
|
||||||
<td class="hide-amount">
|
<td class="hide-amount">
|
||||||
<!-- format amount of transaction -->
|
<!-- format amount of transaction -->
|
||||||
{{ formatAmountWithCode(transaction.transaction_amount, transaction.transaction_currency_code) }}
|
{{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
|
||||||
<!-- and then amount of journal itself. -->
|
<!-- and then amount of journal itself. -->
|
||||||
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount,
|
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
||||||
transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="hide-balance_after">{{ transaction.after|formatAmount }}</td>
|
<td class="hide-balance_after">{{ transaction.after|formatAmount }}</td>
|
||||||
|
|
||||||
|
@@ -40,10 +40,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td data-value="{{ transaction.transaction_amount }}">
|
<td data-value="{{ transaction.transaction_amount }}">
|
||||||
<!-- format amount of transaction -->
|
<!-- format amount of transaction -->
|
||||||
{{ formatAmountWithCode(transaction.transaction_amount, transaction.transaction_currency_code) }}
|
{{ formatByCode(transaction.transaction_currency_code, transaction.transaction_amount) }}
|
||||||
<!-- and then amount of journal itself. -->
|
<!-- and then amount of journal itself. -->
|
||||||
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount,
|
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount, transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
||||||
transaction.transaction_currency_code, transaction.transaction_type_type) }}
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
@@ -285,8 +285,9 @@
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ formatAmountWithCode(transaction.source_account_before,journal.transactionCurrency.code) }}
|
|
||||||
⟶ {{ formatAmountWithCode(transaction.source_account_after,journal.transactionCurrency.code) }}
|
{{ formatAnything(journal.transactionCurrency, transaction.source_account_before) }}
|
||||||
|
⟶ {{ formatAnything(journal.transactionCurrency, transaction.source_account_after) }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if transaction.destination_account_type == 'Cash account' %}
|
{% if transaction.destination_account_type == 'Cash account' %}
|
||||||
@@ -297,23 +298,26 @@
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ formatAmountWithCode(transaction.destination_account_before,journal.transactionCurrency.code) }}
|
|
||||||
⟶ {{ formatAmountWithCode(transaction.destination_account_after,journal.transactionCurrency.code) }}
|
{{ formatAnything(journal.transactionCurrency, transaction.destination_account_before) }}
|
||||||
|
⟶ {{ formatAnything(journal.transactionCurrency, transaction.destination_account_after) }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if journal.transactiontype.type == 'Deposit' %}
|
{% if journal.transactiontype.type == 'Deposit' %}
|
||||||
<!-- deposit, positive amount with correct currency -->
|
<!-- deposit, positive amount with correct currency -->
|
||||||
{{ formatAmountWithCode(transaction.destination_amount, journal.transactionCurrency.code) }}
|
{{ formatAnything(journal.transactionCurrency, transaction.destination_amount) }}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if journal.transactiontype.type == 'Withdrawal' %}
|
{% if journal.transactiontype.type == 'Withdrawal' %}
|
||||||
<!-- withdrawal, negative amount with correct currency -->
|
<!-- withdrawal, negative amount with correct currency -->
|
||||||
{{ formatAmountWithCode(transaction.source_amount, journal.transactionCurrency.code) }}
|
{{ formatAnything(journal.transactionCurrency, transaction.source_amount) }}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if journal.transactiontype.type == 'Transfer' %}
|
{% if journal.transactiontype.type == 'Transfer' %}
|
||||||
<!-- transfer, positive amount in blue -->
|
<!-- transfer, positive amount in blue -->
|
||||||
<span class="text-info">{{ formatAmountPlainWithCode(transaction.destination_amount, journal.transactionCurrency.code) }}</span>
|
<span class="text-info">
|
||||||
|
{{ formatAnythingPlain(journal.transactionCurrency, transaction.destination_amount) }}
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
Reference in New Issue
Block a user