{% import "macros/widgets.html.twig" as widgets %} {%- set absoluteDuration = 0 -%} {%- set absoluteInternalRate = 0 -%} {%- set absoluteRate = 0 -%} {%- set totalsDuration = {} -%} {%- set totalsInternalRate = {} -%} {%- set totalsRate = {} -%} {% if dataType == 'rate' %} {% set dataTypeTitle = 'stats.amountTotal' %} {% elseif dataType == 'internalRate' %} {% set dataTypeTitle = 'label.rate_internal' %} {% else %} {% set dataTypeTitle = 'stats.durationTotal' %} {% endif %} {% set columns = 2 %} {% set totalCurrency = false %} {% for column in period.dateTimes %} {% block period_name %}{% endblock %} {% set columns = columns + 1 %} {% set dateKey = column|report_date %} {% set totalsDuration = totalsDuration|merge({(dateKey): 0}) %} {% set totalsInternalRate = totalsInternalRate|merge({(dateKey): 0}) %} {% set totalsRate = totalsRate|merge({(dateKey): 0}) %} {% endfor %} {% set oldCustomer = null %} {% for project in rows|sort((a,b) => a.project.customer.id <=> b.project.customer.id) %} {% set currency = project.project.customer.currency %} {% if oldCustomer is null or oldCustomer != project.project.customer.id %} {% set oldCustomer = project.project.customer.id %} {% if totalCurrency is same as (false) %} {% set totalCurrency = currency %} {% elseif project.project.customer.currency != totalCurrency %} {% set totalCurrency = null %} {% endif %} {% endif %} {% set absoluteDuration = absoluteDuration + project.duration %} {% set absoluteInternalRate = absoluteInternalRate + project.internalRate %} {% set absoluteRate = absoluteRate + project.rate %} {% for column in project.data.data %} {% set dateKey = column.date|report_date %} {% endfor %} {% for activity in project.activities %} {% for column in activity.data.data %} {% endfor %} {% endfor %} {% endfor %} {% if totalCurrency is same as (false) %} {% set totalCurrency = null %} {% endif %} {% for column in period.dateTimes %} {% set dateKey = column|report_date %} {% endfor %}
  {{ dataTypeTitle|trans }}
{{ widgets.label_customer(project.project.customer) }}
{{ widgets.label_project(project.project) }} {% if dataType == 'rate' %} {{ project.rate|money(currency) }} {% elseif dataType == 'internalRate' %} {{ project.internalRate|money(currency) }} {% else %} {{ project.duration|duration(decimal) }} {% endif %} {% if column.duration > 0 or column.rate > 0 or column.internalRate > 0 %} {% if dataType == 'rate' %} {% set totalsRate = totalsRate|merge({(dateKey): (totalsRate[dateKey] + column.rate)}) %} {{ column.rate|money(currency) }} {% elseif dataType == 'internalRate' %} {% set totalsInternalRate = totalsInternalRate|merge({(dateKey): (totalsInternalRate[dateKey] + column.internalRate)}) %} {{ column.internalRate|money(currency) }} {% else %} {% set totalsDuration = totalsDuration|merge({(dateKey): (totalsDuration[dateKey] + column.duration)}) %} {{ column.duration|duration(decimal) }} {% endif %} {% endif %}
{{ widgets.label_activity(activity.activity) }} {% if dataType == 'rate' %} {{ activity.rate|money(currency) }} {% elseif dataType == 'internalRate' %} {{ activity.internalRate|money(currency) }} {% else %} {{ activity.duration|duration(decimal) }} {% endif %} {% if column.duration > 0 or column.rate > 0 or column.internalRate > 0 %} {% if dataType == 'rate' %} {{ column.rate|money(currency) }} {% elseif dataType == 'internalRate' %} {{ column.internalRate|money(currency) }} {% else %} {{ column.duration|duration(decimal) }} {% endif %} {% endif %}
{{ dataTypeTitle|trans }} {% if dataType == 'rate' %} {{ absoluteRate|money(totalCurrency) }} {% elseif dataType == 'internalRate' %} {{ absoluteInternalRate|money(totalCurrency) }} {% else %} {{ absoluteDuration|duration(decimal) }} {% endif %} {% if dataType == 'rate' %} {{ totalsRate[dateKey]|money(totalCurrency) }} {% elseif dataType == 'internalRate' %} {{ totalsInternalRate[dateKey]|money(totalCurrency) }} {% else %} {{ totalsDuration[dateKey]|duration(decimal) }} {% endif %}