{% set showUserColumn = showUserColumn ?? true %} {% set showInternalRate = showInternalRate ?? false %} {% set showRateColumn = showRateColumn ?? is_granted('view_rate_other_timesheet') %} {% set showHourlyRateColumn = showRateColumn and (showHourlyRateColumn ?? false) %} {% set showSummaryHourlyRate = showRateColumn and (showSummaryHourlyRate ?? false) %} {% set showRateBudget = showRateBudget ?? false %} {% set showTimeBudget = showTimeBudget ?? false %} {% set showCustomerSummary = showCustomerSummary ?? true %} {% set showTotalSummary = showTotalSummary ?? true %} {% set showDateTimeShort = showDateTimeShort ?? false %} {% set now = create_date('now', app.user) %} {% set decimal = decimal ?? false %} {# this is only triggered, if a user exports from his personal timesheet screen #} {% if query is defined and query.user is not null %} {% set showUserColumn = false %} {# if exporting via the admin screen, users without view_rate_own_timesheet might still see their own rates #} {% set showRateColumn = is_granted('view_rate_own_timesheet') %} {% endif %} {% set summaryColumns = ['customer', 'project'] %} {% if showTimeBudget %} {% set summaryColumns = summaryColumns|merge(['timeBudget']) %} {% endif %} {% if showRateBudget %} {% set summaryColumns = summaryColumns|merge(['budget']) %} {% endif %} {% if showSummaryHourlyRate %} {% set summaryColumns = summaryColumns|merge(['hourlyRate']) %} {% endif %} {% set summaryColumns = summaryColumns|merge(['duration']) %} {% if showRateColumn %} {% if showInternalRate %} {% set summaryColumns = summaryColumns|merge(['internalRate']) %} {% endif %} {% set summaryColumns = summaryColumns|merge(['rate']) %} {% endif %} {% block document_title %}{{ 'export'|trans }}{% endblock %} {% block styles %} {% endblock %} {% block pdf_footer %} {% endblock %} {% block body_start %}{% endblock %} {% block summary %} {% block summary_header %}

{% block title %}{{ 'export.document_title'|trans }}{% endblock %}

{% if query is defined %}

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

{% endif %}

{{ 'export.summary'|trans }}

{% endblock %} {% for summaryColumn in summaryColumns %} {% if summaryColumn == 'customer' %} {% elseif summaryColumn == 'project' %} {% else %} {% endif %} {% endfor %} {% set customer = null %} {% set customerDuration = 0 %} {% set customerRate = 0 %} {% set customerInternalRate = 0 %} {% set customerCurrency = null %} {% set customerCount = 0 %} {% set multiCurrency = false %} {% set totalDuration = 0 %} {% set totalInternalRate = 0 %} {% set totalRate = 0 %} {% for id, summary in summaries %} {% set totalDuration = totalDuration + summary.duration %} {% set totalInternalRate = totalInternalRate + summary.rate_internal %} {% set totalRate = totalRate + summary.rate %} {% if customerCurrency is not null and customerCurrency is not same as(summary.currency) %} {% set multiCurrency = true %} {% endif %} {% if customer is same as(null) %} {% set customer = summary.customer %} {% set customerCurrency = summary.currency %} {% endif %} {% if customer is not same as(summary.customer) %} {% for summaryColumn in summaryColumns %} {% if summaryColumn == 'duration' %} {% elseif summaryColumn == 'internalRate' %} {% elseif summaryColumn == 'rate' %} {% else %} {% endif %} {% endfor %} {% set customerCurrency = summary.currency %} {% set customer = summary.customer %} {% set customerDuration = 0 %} {% set customerRate = 0 %} {% set customerInternalRate = 0 %} {% set customerCount = 0 %} {% endif %} {% for summaryColumn in summaryColumns %} {% if summaryColumn == 'customer' %} {% elseif summaryColumn == 'project' %} {% elseif summaryColumn == 'timeBudget' %} {% elseif summaryColumn == 'budget' %} {% elseif summaryColumn == 'hourlyRate' %} {% set summaryHourlyRate = summary.duration/3600 %} {% elseif summaryColumn == 'duration' %} {% elseif summaryColumn == 'internalRate' %} {% elseif summaryColumn == 'rate' %} {% endif %} {% endfor %} {% set customerDuration = customerDuration + summary.duration %} {% set customerRate = customerRate + summary.rate %} {% set customerInternalRate = customerInternalRate + summary.rate_internal %} {% set customerCount = customerCount + 1 %} {% endfor %} {% if showCustomerSummary and customer is not same as(null) %} {% for summaryColumn in summaryColumns %} {% if summaryColumn == 'duration' %} {% elseif summaryColumn == 'internalRate' %} {% elseif summaryColumn == 'rate' %} {% else %} {% endif %} {% endfor %} {% endif %} {% if showTotalSummary and not multiCurrency %} {% for summaryColumn in summaryColumns %} {% if summaryColumn == 'duration' %} {% elseif summaryColumn == 'internalRate' %} {% elseif summaryColumn == 'rate' %} {% elseif summaryColumn not in ['customer', 'project'] %} {% endif %} {% endfor %} {% endif %}
{{ 'customer'|trans }}{{ 'project'|trans }}{{ summaryColumn|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 %} {{ summaryHourlyRate > 0 ? (summary.rate/summaryHourlyRate)|money(summary.currency) : '' }}{{ summary.duration|duration(decimal) }}{{ summary.rate_internal|money(summary.currency) }}{{ summary.rate|money(summary.currency) }}
{{ customerDuration|duration(decimal) }}{{ customerInternalRate|money(customerCurrency) }}{{ customerRate|money(customerCurrency) }}
{{ 'sum.total'|trans }} {{ totalDuration|duration(decimal) }}{{ totalInternalRate|money(customerCurrency) }}{{ totalRate|money(customerCurrency) }}
{% endblock %} {% block items %} {% block items_header %}

{{ 'export.full_list'|trans }}

{% endblock %} {% set duration = 0 %} {% set rate = 0 %} {% set rateInternal = 0 %} {% set currency = false %} {% if showUserColumn %} {% endif %} {% if showHourlyRateColumn %} {% endif %} {% if showRateColumn %} {% if showInternalRate %} {% endif %} {% endif %} {% for entry in entries %} {% set duration = duration + entry.duration %} {% set entryCurrency = entry.project.customer.currency %} {% if currency is same as(false) %} {% set currency = entryCurrency %} {% endif %} {% if currency is not same as(entryCurrency) %} {% set currency = null %} {% endif %} {% if showUserColumn %} {% endif %} {% if showHourlyRateColumn %} {% endif %} {% if showRateColumn %} {# no check for is_granted('view_rate', entry) because it is only available for timesheets, but maybe missing for other potential export repositories #} {% set rate = rate + entry.rate %} {% set rateInternal = rateInternal + entry.internalRate %} {% set entryRate = entry.rate|money(entryCurrency) %} {% set entryRateInternal = entry.internalRate|money(entryCurrency) %} {% if showInternalRate %} {% endif %} {% endif %} {% endfor %} {% if showUserColumn %} {% else %} {% endif %} {% if showHourlyRateColumn %} {% endif %} {% if showRateColumn %} {% if showInternalRate %} {% endif %} {% endif %}
{{ 'date'|trans }}{{ 'user'|trans }}{{ 'description'|trans }}{{ 'hourlyRate'|trans }}{{ 'duration'|trans }}{{ 'internalRate'|trans }}{{ 'rate'|trans }}
{% block date_begin %}{% if not showDateTimeShort %}{{ entry.begin|date_time }}{% else %}{{ entry.begin|date_short }}{% endif %}{% endblock %} {% if entry.end %} {% block date_end %}{% if not showDateTimeShort %}
{{ entry.end|date_time }}{% endif %}{% endblock %} {% endif %}
{{ entry.user.displayName }} {% block description %} {{ 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 %} {% endblock %}
{% if entry.fixedRate %} - {% else %} {{ entry.hourlyRate|money(entryCurrency) }} {% endif %} {% if entry.duration == 0 %} - {% else %} {{ entry.duration|duration(decimal) }} {% endif %} {{ entryRateInternal }}{{ entryRate }}
{{ 'sum.total'|trans }}{{ 'sum.total'|trans }}{{ duration|duration(decimal) }}{% if currency is not null %}{{ rateInternal|money(currency) }}{% endif %}{% if currency is not null %}{{ rate|money(currency) }}{% endif %}
{% endblock %} {% block body_end %}{% endblock %}