Skip to content

Firefly III: a personal finances manager

Remove amount when nothing left.

James Coleb48b2a411a9d
diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php
index b573ee5ace..d66b936d5c 100644
--- a/app/Support/Export/ExportDataGenerator.php
+++ b/app/Support/Export/ExportDataGenerator.php
@@ -88,115 +88,7 @@ class ExportDataGenerator
private bool $exportTransactions = false;
private Carbon $start;
private User $user;
- private UserGroup $userGroup; // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
-
- // @phpstan-ignore-line
+ private UserGroup $userGroup;
public function __construct()
{
diff --git a/resources/views/budgets/partials/amount-left.twig b/resources/views/budgets/partials/amount-left.twig
index e72d89ec61..79c83dc323 100644
--- a/resources/views/budgets/partials/amount-left.twig
+++ b/resources/views/budgets/partials/amount-left.twig
@@ -1,13 +1,22 @@
{# The amount left can only be shown for actual budget limits. #}
{% for budgetLimit in budget.budgeted %}
<span class="left_span" data-currency="{{ budgetLimit.currency_id }}" data-limit="{{ budgetLimit.id }}" data-value="{{ budgetLimit.left }}" class="amount_left">
+ {# the amount left #}
{{ formatAmountBySymbol(budgetLimit.left, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}
- {% if not budgetLimit.in_past %}
- {% if 0 == budgetLimit.active_days_left %}
- ({{ formatAmountBySymbol(budgetLimit.left, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }})
- {% else %}
- ({{ formatAmountBySymbol(budgetLimit.left / budgetLimit.active_days_left, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }})
+
+ {# if the budget limit is in the past, this is not interesting. #}
+ {# if there is nothing left, this is not interesting. #}
+ {% if not budgetLimit.in_past and -1 == bccomp('0',budgetLimit.left) %}
+ {% if 0 == budgetLimit.active_days_left %}
+ ({{ formatAmountBySymbol(budgetLimit.left, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }})
+ {% else %}
+ ({{ formatAmountBySymbol(budgetLimit.left / budgetLimit.active_days_left, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }})
+ {% endif %}
{% endif %}
+
+ {# if there is nothing left, just format 0.00 #}
+ {% if not budgetLimit.in_past and -1 != bccomp('0',budgetLimit.left) %}
+ ({{ formatAmountBySymbol('0', budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }})
{% endif %}
</span><br />
{% endfor %}