added export context (#2216)

This commit is contained in:
Kevin Papst
2020-12-22 18:41:00 +01:00
committed by GitHub
parent 74b3917e69
commit 40eda01c22
16 changed files with 266 additions and 64 deletions

View File

@@ -3,6 +3,8 @@
{% set showRateColumn = showRateColumn ?? is_granted('view_rate_other_timesheet') %}
{% set showRateBudget = showRateBudget ?? false %}
{% set showTimeBudget = showTimeBudget ?? false %}
{% set showTotalSummary = showTotalSummary ?? true %}
{% 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.user is not null %}
@@ -12,7 +14,7 @@
{% endif %}
<html lang="{{ app.request.locale }}">
<head>
{% block styles %}
{% block styles %}
<style>
body {
font-family: sans-serif;
@@ -70,7 +72,7 @@
white-space: nowrap;
}
</style>
{% endblock %}
{% endblock %}
</head>
<body>
{% block pdf_footer %}
@@ -132,29 +134,39 @@ mpdf-->
{% 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) %}
<tr class="summary">
<td colspan="2">
</td>
{% if showTimeBudget %}
<td></td>
<tr class="summary">
<td colspan="2">
</td>
{% if showTimeBudget %}
<td></td>
{% endif %}
{% if showRateBudget %}
<td></td>
{% endif %}
<td class="totals duration">{{ customerDuration|duration(decimal) }}</td>
{% if showRateColumn %}
{% if showInternalRate %}
<td class="totals cost">{{ customerInternalRate|money(customerCurrency) }}</td>
{% endif %}
{% if showRateBudget %}
<td></td>
{% endif %}
<td class="totals duration">{{ customerDuration|duration(decimal) }}</td>
{% if showRateColumn %}
{% if showInternalRate %}
<td class="totals cost">{{ customerInternalRate|money(customerCurrency) }}</td>
{% endif %}
<td class="totals cost">{{ customerRate|money(customerCurrency) }}</td>
{% endif %}
</tr>
<td class="totals cost">{{ customerRate|money(customerCurrency) }}</td>
{% endif %}
</tr>
{% set customerCurrency = summary.currency %}
{% set customer = summary.customer %}
{% set customerDuration = 0 %}
@@ -210,6 +222,26 @@ mpdf-->
{% endif %}
</tr>
{% endif %}
{% if showTotalSummary and not multiCurrency %}
<tr class="summary-total">
<td class="totals" colspan="2">
{{ 'sum.total'|trans }}
</td>
{% if showTimeBudget %}
<td></td>
{% endif %}
{% if showRateBudget %}
<td></td>
{% endif %}
<td class="totals duration">{{ totalDuration|duration(decimal) }}</td>
{% if showRateColumn %}
{% if showInternalRate %}
<td class="totals cost">{{ totalInternalRate|money(customerCurrency) }}</td>
{% endif %}
<td class="totals cost">{{ totalRate|money(customerCurrency) }}</td>
{% endif %}
</tr>
{% endif %}
</tbody>
</table>