{% import "macros/widgets.html.twig" as widgets %} {%- set absoluteDuration = 0 -%} {%- set absoluteInternalRate = 0 -%} {%- set absoluteRate = 0 -%} {%- set totalsDuration = {} -%} {%- set totalsInternalRate = {} -%} {%- set totalsRate = {} -%} {%- set with_links = with_links is defined ? with_links : false -%} {% if dataType == 'rate' %} {% set dataTypeTitle = 'stats.amountTotal' %} {% elseif dataType == 'internalRate' %} {% set dataTypeTitle = 'internalRate' %} {% else %} {% set dataTypeTitle = 'stats.durationTotal' %} {% endif %} {% set columns = 0 %} {% set totalCurrency = false %} {% set filter_options = {'begin': begin, 'end': end} %} {% set filter_route = 'timesheet' %} {% if is_granted('view_other_timesheet') %} {% set filter_route = 'admin_timesheet' %} {% set filter_options = filter_options|merge({'user': user.id}) %} {% endif %} {% 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 %} {% for customerId, data in rows %} {% set currency = data.customer.currency %} {% if totalCurrency is same as (false) %} {% set totalCurrency = currency %} {% elseif data.customer != totalCurrency %} {% set totalCurrency = null %} {% endif %} {% for project in data.projects %} {% 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 %} {% endfor %} {% if totalCurrency is same as (false) %} {% set totalCurrency = null %} {% endif %} {% for column in period.dateTimes %} {% set dateKey = column|report_date %} {% endfor %}
{% block upper_left %}{{ user.displayName|sanitize_dde }}{% endblock %} {{ dataTypeTitle|trans }}{{ column|date_short }}
{{ widgets.label_customer(data.customer) }} {% if with_links %}{% endif %} {% if dataType == 'rate' %} {{ data.rate|money(currency) }} {% elseif dataType == 'internalRate' %} {{ data.internalRate|money(currency) }} {% else %} {{ data.duration|duration(decimal) }} {% endif %} {% if with_links %}{% endif %}
{{ widgets.label_project(project.project) }} {% if with_links %}{% endif %} {%- if dataType == 'rate' -%} {{ project.rate|money(currency) }} {%- elseif dataType == 'internalRate' -%} {{ project.internalRate|money(currency) }} {%- else -%} {{ project.duration|duration(decimal) }} {%- endif -%} {% if with_links %}{% 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 with_links %}{% endif %} {% if dataType == 'rate' %} {{ activity.rate|money(currency) }} {% elseif dataType == 'internalRate' %} {{ activity.internalRate|money(currency) }} {% else %} {{ activity.duration|duration(decimal) }} {% endif %} {% if with_links %}{% 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 %}