From 705b9bf0f2d8a4d0f703e4463726882ac7cd62ec Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 1 Feb 2025 11:44:56 +0100 Subject: [PATCH] Fix https://github.com/firefly-iii/firefly-iii/issues/9719 --- app/Helpers/Collector/GroupCollector.php | 6 ++++++ resources/views/list/groups.twig | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index 49c05e1341..a7901aeaf8 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -722,8 +722,11 @@ class GroupCollector implements GroupCollectorInterface $groups[$groudId]['sums'][$currencyId]['currency_symbol'] = $transaction['currency_symbol']; $groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['currency_decimal_places']; $groups[$groudId]['sums'][$currencyId]['amount'] = '0'; + $groups[$groudId]['sums'][$currencyId]['native_amount'] = '0'; } + $transaction['native_amount'] = null === $transaction['native_amount'] ? '0' : $transaction['native_amount']; $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount']); + $groups[$groudId]['sums'][$currencyId]['native_amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['native_amount'], $transaction['native_amount']); if (null !== $transaction['foreign_amount'] && null !== $transaction['foreign_currency_id']) { $currencyId = (int) $transaction['foreign_currency_id']; @@ -735,8 +738,11 @@ class GroupCollector implements GroupCollectorInterface $groups[$groudId]['sums'][$currencyId]['currency_symbol'] = $transaction['foreign_currency_symbol']; $groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['foreign_currency_decimal_places']; $groups[$groudId]['sums'][$currencyId]['amount'] = '0'; + $groups[$groudId]['sums'][$currencyId]['save_amount'] = '0'; } + $transaction['native_foreign_amount'] = null === $transaction['native_foreign_amount'] ? '0' : $transaction['native_foreign_amount']; $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['foreign_amount']); + $groups[$groudId]['sums'][$currencyId]['native_amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['native_foreign_amount']); } } } diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twig index 3830e007c9..02edb9fe45 100644 --- a/resources/views/list/groups.twig +++ b/resources/views/list/groups.twig @@ -59,14 +59,26 @@ {% for sum in group.sums %} {% if group.transaction_type == 'Deposit' %} - {{ formatAmountBySymbol(sum.amount*-1, sum.currency_symbol, sum.currency_decimal_places) }}(TODO NATIVE group 1){% if loop.index != group.sums|length %},{% endif %} + {{ formatAmountBySymbol(sum.amount*-1, sum.currency_symbol, sum.currency_decimal_places) }} + {% if convertToNative and 0 != sum.native_amount %} + ({{ formatAmountBySymbol(sum.native_amount*-1, defaultCurrency.symbol, defaultCurrency.decimal_places) }}) + {% endif %} + {% if loop.index != group.sums|length %},{% endif %} {% elseif group.transaction_type == 'Transfer' %} - {{ formatAmountBySymbol(sum.amount*-1, sum.currency_symbol, sum.currency_decimal_places, false) }}(TODO group 2 ){% if loop.index != group.sums|length %},{% endif %} + {{ formatAmountBySymbol(sum.amount*-1, sum.currency_symbol, sum.currency_decimal_places, false) }} + {% if convertToNative and 0 != sum.native_amount %} + ({{ formatAmountBySymbol(sum.native_amount*-1, defaultCurrency.symbol, defaultCurrency.decimal_places) }}) + {% endif %} + {% if loop.index != group.sums|length %},{% endif %} {% else %} - {{ formatAmountBySymbol(sum.amount, sum.currency_symbol, sum.currency_decimal_places) }}(TODO NATIVE group 3){% if loop.index != group.sums|length %},{% endif %} + {{ formatAmountBySymbol(sum.amount, sum.currency_symbol, sum.currency_decimal_places) }} + {% if convertToNative and 0 != sum.native_amount %} + ({{ formatAmountBySymbol(sum.native_amount*-1, defaultCurrency.symbol, defaultCurrency.decimal_places) }}) + {% endif %} + {% if loop.index != group.sums|length %},{% endif %} {% endif %} {% endfor %}