{% import "macros/widgets.html.twig" as widgets %} {% import "macros/datatables.html.twig" as tables %} {% extends 'export/layout.html.twig' %} {% block document_title %}{{ 'export.title'|trans }}{% endblock %} {% set showRateBudget = false %} {% set showTimeBudget = false %} {% for budget in budgets %} {% if budget.money_left > 0 %} {% set showRateBudget = true %} {% endif %} {% if budget.time_left > 0 %} {% set showTimeBudget = true %} {% endif %} {% endfor %} {% set decimal = decimal|default(false) %} {% set columnTitles = {} %} {% set columns = { 'date': true, 'username': false, 'customer': true, 'project': true, 'activity': true, 'description': false, 'exported': false, 'tags': false, } %} {% for id, field in timesheetMetaFields %} {% set columns = columns|merge({ ('t_' ~ field.name): true}) %} {% set columnTitles = columnTitles|merge({ ('t_' ~ field.name): (field.label)}) %} {% endfor %} {% for id, field in customerMetaFields %} {% set columns = columns|merge({ ('c_' ~ field.name): true}) %} {% set columnTitles = columnTitles|merge({ ('c_' ~ field.name): (field.label)}) %} {% endfor %} {% for id, field in projectMetaFields %} {% set columns = columns|merge({ ('p_' ~ field.name): true}) %} {% set columnTitles = columnTitles|merge({ ('p_' ~ field.name): (field.label)}) %} {% endfor %} {% for id, field in activityMetaFields %} {% set columns = columns|merge({ ('a_' ~ field.name): true}) %} {% set columnTitles = columnTitles|merge({ ('a_' ~ field.name): (field.label)}) %} {% endfor %} {% for id, field in userPreferences %} {% set columns = columns|merge({ ('u_' ~ field.name): true}) %} {% set columnTitles = columnTitles|merge({ ('u_' ~ field.name): (field.label)}) %} {% endfor %} {% set columns = columns|merge({ 'hourlyRate': false, 'fixedRate': false, 'duration': 'label.duration', 'rate_internal': 'label.rate_internal', 'rate': 'label.rate', }) %} {% block javascripts %} {% endblock %} {% block styles %} {% endblock %} {% block export %}
{% if showTimeBudget %}
{% endif %} {% if showRateBudget %}
{% endif %}
{% for columnId, visibility in columns %}
{% endfor %}

{{ 'export.document_title'|trans }}

{{ 'export.period'|trans }}: {{ query.begin|date_short }} - {{ query.end|date_short }}

{{ 'export.summary'|trans }}

{% if showTimeBudget %} {% endif %} {% if showRateBudget %} {% endif %} {% set customer = null %} {% set customerDuration = 0 %} {% set customerRate = 0 %} {% set customerInternalRate = 0 %} {% set customerCurrency = null %} {% for id, summary in summaries %} {% if customer is same as(null) %} {% set customer = summary.customer %} {% set customerCurrency = summary.currency %} {% endif %} {% if customer is not same as(summary.customer) %} {% if showTimeBudget %} {% endif %} {% if showRateBudget %} {% endif %} {% set customerCurrency = summary.currency %} {% set customer = summary.customer %} {% set customerDuration = 0 %} {% set customerRate = 0 %} {% set customerInternalRate = 0 %} {% endif %} {% if showTimeBudget %} {% endif %} {% if showRateBudget %} {% endif %} {% set customerDuration = customerDuration + summary.duration %} {% set customerRate = customerRate + summary.rate %} {% set customerInternalRate = customerInternalRate + summary.rate_internal %} {% endfor %} {% if customer is not same as(null) %} {% if showTimeBudget %} {% endif %} {% if showRateBudget %} {% endif %} {% endif %}
{{ 'label.customer'|trans }} {{ 'label.project'|trans }}{{ 'label.timeBudget'|trans }}{{ 'label.budget'|trans }}{{ 'label.duration'|trans }} {{ 'label.rate_internal'|trans }} {{ 'label.rate'|trans }}
 {{ customerDuration|duration(decimal) }} {{ customerInternalRate|money(customerCurrency) }} {{ customerRate|money(customerCurrency) }}
{{ summary.customer }} {{ summary.project }} {% if budgets[id] is defined and budgets[id].time_left > 0 %} {{ budgets[id].time_left|duration(decimal) }} {% endif %} {% if budgets[id] is defined and budgets[id].money_left > 0 %} {{ budgets[id].money_left|money(summary.currency) }} {% endif %} {{ summary.duration|duration(decimal) }} {{ summary.rate_internal|money(summary.currency) }} {{ summary.rate|money(summary.currency) }}
 {{ customerDuration|duration(decimal) }} {{ customerInternalRate|money(customerCurrency) }} {{ customerRate|money(customerCurrency) }}
{# ============================================ SUMMARY: BY ACTIVITY ============================================ #} {% set customer = null %} {% set customerDuration = 0 %} {% set customerRate = 0 %} {% set customerInternalRate = 0 %} {% set customerCurrency = null %} {% for summary in summaries %} {% if customer is same as(null) %} {% set customer = summary.customer %} {% set customerCurrency = summary.currency %} {% endif %} {% if customer is not same as(summary.customer) %} {% set customerCurrency = summary.currency %} {% set customer = summary.customer %} {% set customerDuration = 0 %} {% set customerRate = 0 %} {% set customerInternalRate = 0 %} {% endif %} {% for activitySummary in summary.activities %} {% endfor %} {% set customerDuration = customerDuration + summary.duration %} {% set customerRate = customerRate + summary.rate %} {% set customerInternalRate = customerInternalRate + summary.rate_internal %} {% endfor %} {% if customer is not same as(null) %} {% endif %}

{{ 'export.full_list'|trans }}

{% for columnId, visibility in columns %} {% endfor %} {% set timeWorked = 0 %} {% set rateTotal = 0 %} {% set rateInternalTotal = 0 %} {% set currency = false %} {% for entry in entries %} {% set timeWorked = timeWorked + entry.duration %} {% set rateTotal = rateTotal + entry.rate %} {% if entry.internalRate is defined %} {% set rateInternalTotal = rateInternalTotal + entry.internalRate %} {% else %} {% set rateInternalTotal = rateInternalTotal + entry.rate %} {% endif %} {% if currency is same as(false) %} {% set currency = entry.project.customer.currency %} {% endif %} {% if currency is not same as(entry.project.customer.currency) %} {% set currency = null %} {% endif %} {% for id, field in timesheetMetaFields %} {% endfor %} {% for id, field in customerMetaFields %} {% endfor %} {% for id, field in projectMetaFields %} {% endfor %} {% for id, field in activityMetaFields %} {% endfor %} {% for id, field in userPreferences %} {% endfor %} {% endfor %} {# leave in tbody instead of adding it to tfoot, as tfoot will be repeated on each page when printing #} {% for id, visibility in columns %} {% if id not in ['duration', 'rate', 'rate_internal'] %} {% endif %} {% endfor %}
{{ columnTitles[columnId]|default('label.'~columnId)|trans }}
{{ entry.begin|date_time }} {% if entry.end %}
{{ entry.end|date_time }} {% endif %}
{{ widgets.username(entry.user) }} {{ entry.project.customer.name }} {{ entry.project.name }} {% if entry.activity is not null %} {{ entry.activity.name }} {% endif %} {% if entry.description is not empty %} {{ entry.description|desc2html }} {% endif %} {% if entry.exported %} {{ 'entryState.exported'|trans }} {% else %} {{ 'entryState.not_exported'|trans }} {% endif %} {% if entry.tags is defined and entry.tags is not empty %} {{ entry.tagsAsArray|join(', ') }} {% endif %} {{ tables.datatable_meta_column(entry, field) }} {{ tables.datatable_meta_column(entry.project.customer, field) }} {{ tables.datatable_meta_column(entry.project, field) }} {% if entry.activity is not null %} {{ tables.datatable_meta_column(entry.activity, field) }} {% endif %} {% set metaField = entry.user.preference(field.name) %} {% if not metaField is null and metaField.value is not null and metaField.value is not empty %} {{ widgets.form_type_value(field.type, metaField.value, entry.user) }} {% endif %} {{ entry.hourlyRate|money(entry.project.customer.currency) }} {{ entry.fixedRate|money(entry.project.customer.currency) }} {{ entry.duration|duration(decimal) }} {% if entry.internalRate is defined %} {{ entry.internalRate|money(entry.project.customer.currency) }} {% else %} {{ entry.rate|money(entry.project.customer.currency) }} {% endif %} {{ entry.rate|money(entry.project.customer.currency) }}
{{- timeWorked|duration(decimal) -}} {%- if currency is not null and currency is not same as(false) %} {{ rateInternalTotal|money(currency) }} {% else %} {{ rateInternalTotal|money }} {% endif -%} {%- if currency is not null and currency is not same as(false) %} {{ rateTotal|money(currency) }} {% else %} {{ rateTotal|money }} {% endif -%}
{% endblock %}