{% extends './layout/default' %} {% block breadcrumbs %} {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }} {% endblock %} {% block content %}
| {{ 'budget'|_ }} | {{ 'budgeted'|_ }} | {{ 'left'|_ }} ({{ 'per_day'|_|lower }}) | 
|---|---|---|
| {% if 0 == budget.budgeted|length %}
                                            {{ budget.name }}
                                        {% endif %}
                                        {% if 1 == budget.budgeted|length %}
                                            {% for budgetLimit in budget.budgeted %}
                                                {{ budget.name }}
                                            {% endfor %}
                                        {% endif %}
                                        {% if budget.budgeted|length > 1 %}
                                            {% for budgetLimit in budget.budgeted %}
                                                {{ budget.name }} ({{ budgetLimit.currency_name }}) {% endfor %} {% endif %} {% if budget.auto_budget %} {% if 1 == budget.auto_budget.auto_budget_type %} {% endif %} {% if 2 == budget.auto_budget.auto_budget_type %} {% endif %} {% if 3 == budget.auto_budget.auto_budget_type %} {% endif %} {% endif %} {% if budget.attachments.count() > 0 %} {% endif %} | {% if 0==budget.budgeted|length %} {# this cell displays the amount left in the budget, per budget limit. #}{{ defaultCurrency.symbol }} {% endif %} {% endfor %} {% endif %} {% if budget.budgeted|length < currencies.count() %} {% endif %} | {% for spentInfo in budget.spent %}
                                            {% set countLimit = 0 %}
                                            {% for budgetLimit in budget.budgeted %}
                                                {# now looping a single budget limit. #}
                                                {% if spentInfo.currency_id == budgetLimit.currency_id and budgetLimit.in_range %}
                                                    {# the code below is used for budget limits INSIDE the current view range. #}
                                                    {% set countLimit = countLimit + 1 %}
                                                    
                                                        {# the amount left is automatically calculated. #}
                                                        {{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }}
                                                        {% if spentInfo.spent + budgetLimit.amount > 0 %}
                                                            {% if 0 == activeDaysLeft %}
                                                                ({{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }})
                                                            {% else %}
                                                                ({{ formatAmountBySymbol((spentInfo.spent + budgetLimit.amount) / activeDaysLeft, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }})
                                                            {% endif %}
                                                        {% else %}
                                                            ({{ formatAmountBySymbol(0, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }})
                                                        {% endif %} {% endif %} {% endfor %} {% if countLimit == 0 %} {# this code is used for budget limits OUTSIDE the current view range. #} {{ formatAmountBySymbol(spentInfo.spent, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }} {% endif %} {% endfor %} {% for budgetLimit in budget.budgeted %} D {% if null == budget.spent[budgetLimit.currency_id] %} E {{ formatAmountBySymbol(budgetLimit.amount, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }} {% if budgetLimit.in_range %} {% if 0 == activeDaysLeft %} ({{ formatAmountBySymbol(budgetLimit.amount, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}) {% else %} ({{ formatAmountBySymbol(budgetLimit.amount / activeDaysLeft, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}) {% endif %} {% endif %} {% if not budgetLimit.in_range %} {# For issue #10441, add per day if the budget limit is out of range. #} ({{ formatAmountBySymbol(budgetLimit.amount / budgetLimit.total_days, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}) {% endif %} {% endif %} {% endfor %} |