{% set timeBudgetVisible = is_granted('time', entity) %} {% set durationTrans = entity.isMonthlyBudget() ? 'stats.durationMonth' : 'stats.durationTotal' %} {% if timeBudgetVisible %} {% embed '@AdminLTE/Widgets/box-widget.html.twig' %} {% import "macros/progressbar.html.twig" as progress %} {% import "macros/widgets.html.twig" as widgets %} {% block box_title %} {{ 'label.timeBudget'|trans }} {% if entity.isMonthlyBudget() %}({{ 'label.budgetType_month'|trans }}){% endif %} {% endblock %} {% block box_body_class %}no-padding{% endblock %} {% block box_attributes %}id="time_budget_box"{% endblock %} {% block box_body %}
{% set totalPercentReached = 100 %} {% if entity.timeBudget > 0 %} {% set totalPercentReached = (stats.durationBillable / (entity.timeBudget / 100)) %} {% endif %} {% set percentReached = 0 %} {% if stats.duration > 0 %} {% set percentReached = (stats.durationBillable / (stats.duration / 100)) %} {% endif %} {% if entity.timeBudget > 0 %} {% endif %}
{{ 'label.timeBudget'|trans }} {% if entity.timeBudget > 0 %} {{ entity.timeBudget|duration }} {% else %} - {% endif %} {% if entity.timeBudget > 0 %} 100% {% else %} - {% endif %}
{{ durationTrans|trans }} {{ stats.duration|duration }} {{ totalPercentReached|number_format(2) }}%
{{ 'label.billable'|trans }} {{ stats.durationBillable|duration }} {{ percentReached|number_format(2) }}%
{% if totalPercentReached < 100 %} {{ 'stats.percentUsedLeft'|trans({'%percent%': totalPercentReached|number_format(2), '%left%': (entity.timeBudget - stats.durationBillable)|duration}) }} {% else %} {{ 'stats.percentUsed'|trans({'%percent%': totalPercentReached|number_format(2)}) }} {% endif %}
{% if entity.timeBudget > 0 %} {{ progress.progressbar(entity.timeBudget, stats.durationBillable, durationTrans|trans, stats.durationBillable|duration ~ ' / ' ~ entity.timeBudget|duration) }} {% endif %} {{ progress.progressbar(stats.duration, stats.durationBillable, 'label.billable'|trans, stats.durationBillable|duration ~ ' / ' ~ stats.duration|duration, true) }}
{% endblock %} {% endembed %} {% endif %} {% if is_granted('budget', entity) %} {% embed '@AdminLTE/Widgets/box-widget.html.twig' %} {% import "macros/progressbar.html.twig" as progress %} {% import "macros/widgets.html.twig" as widgets %} {% block box_title %} {{ 'label.budget'|trans }} {% if entity.isMonthlyBudget() %}({{ 'label.budgetType_month'|trans }}){% endif %} {% endblock %} {% block box_body_class %}no-padding{% endblock %} {% block box_attributes %}id="budget_box"{% endblock %} {% block box_body %} {% set rateTrans = entity.isMonthlyBudget() ? 'stats.amountMonth' : 'stats.amountTotal' %}
{% set totalPercentReached = 100 %} {% if entity.budget > 0 %} {% set totalPercentReached = (stats.rateBillable / (entity.budget / 100)) %} {% endif %} {% set percentReached = 0 %} {% if stats.rate > 0 %} {% set percentReached = (stats.rateBillable / (stats.rate / 100)) %} {% endif %} {% set percentReached = 0 %} {% if stats.rateBillable > 0 %} {% set percentReached = (stats.internalRate / (stats.rateBillable / 100)) %} {% endif %} {% if not entity.isMonthlyBudget() and timeBudgetVisible and stats.duration > 0 %} {% set realHourlyRate = stats.rateBillable / stats.duration|chart_duration %} {% endif %} {% if entity.budget > 0 %} {% endif %}
{{ 'label.budget'|trans }} {% if entity.budget > 0 %} {{ entity.budget|money(currency) }} {% else %} - {% endif %} {% if entity.budget > 0 %} 100% {% else %} - {% endif %}
{{ rateTrans|trans }} {{ stats.rate|money(currency) }} {{ totalPercentReached|number_format(2) }}%
{{ 'label.billable'|trans }} {{ stats.rateBillable|money(currency) }} {{ percentReached|number_format(2) }}%
{{ 'label.rate_internal'|trans }} {{ stats.internalRate|money(currency) }} {{ percentReached|number_format(2) }}%
{{ 'label.hourlyRate'|trans }} ({{ 'label.billable'|trans }} / {{ durationTrans|trans }}) {{ realHourlyRate|money(currency) }} -
{% if totalPercentReached < 100 %} {{ 'stats.percentUsedLeft'|trans({'%percent%': totalPercentReached|number_format(2), '%left%': (entity.budget - stats.rateBillable)|money(currency)}) }} {% else %} {{ 'stats.percentUsed'|trans({'%percent%': totalPercentReached|number_format(2)}) }} {% endif %}
{% if entity.budget > 0 %} {{ progress.progressbar(entity.budget, stats.rateBillable, rateTrans|trans, stats.rateBillable|money(currency) ~ ' / ' ~ entity.budget|money(currency)) }} {% endif %} {{ progress.progressbar(stats.rate, stats.rateBillable, 'label.billable'|trans, stats.rateBillable|money(currency) ~ ' / ' ~ stats.rate|money(currency), true) }} {{ progress.progressbar(stats.rateBillable, stats.internalRate, 'label.rate_internal'|trans, stats.internalRate|money(currency) ~ ' / ' ~ stats.rateBillable|money(currency)) }}
{% endblock %} {% endembed %} {% endif %}