Files
kimai2/templates/reporting/report_by_user_data.html.twig
Kevin Papst 38e37f1c2e Release 2.1.0 (#4321)
* fix deprecations
* remove unused config
* replace invalid annotation type with attribute
* use AsDoctrineListener to fix deprecation
* new ModifiedSubscriber to support custom logic and fix deprecation
* removed inheritdoc comment
* new ModifiedSubscriber to support custom logic and fix deprecation
* cleanup event dispatcher interface
* re-order annotation params
* one more doctrine based deprecation
* fix query to count active timesheets
* link to "all times" to identify active timesheets
* link icon instead of text
* fix "skin" translation in wizard
* use duration filter to show duration
* added login link command and controller
* bump tabler theme to 1.0
* added wizard to force password reset by user
* allow to configure that new accounts need to reset their password
* prevent uploading twig templates by default
* bump composer packages
* enable sandbox and basic security measures for custom twig templates for invoice and export
* bump to symfony 6.3.5
* allow to export single user reports to excel
* removed broken method to reload twig cache
* added api parameter to fetch user collection fully serialized
* allow to replace or append description via timesheet batch update
* show api username above form
2023-10-19 11:21:50 +02:00

152 lines
7.2 KiB
Twig

{% 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 = 'internalRate' %}
{% else %}
{% set dataTypeTitle = 'stats.durationTotal' %}
{% endif %}
{% set columns = 0 %}
{% set totalCurrency = false %}
<table class="table table-hover dataTable">
<thead>
<tr>
<th>{% block upper_left %}{{ user.displayName }}{% endblock %}</th>
<th class="text-center reportDataTypeTitle">{{ dataTypeTitle|trans }}</th>
{% for column in period.dateTimes %}
{% block period_name %}
<th>{{ column|date_short }}</th>
{% 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 %}
</tr>
</thead>
<tbody>
{% 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 %}
<tr class="summary">
<td>{{ widgets.label_customer(data.customer) }}</td>
<td class="text-center total">
{% if dataType == 'rate' %}
{{ data.rate|money(currency) }}
{% elseif dataType == 'internalRate' %}
{{ data.internalRate|money(currency) }}
{% else %}
{{ data.duration|duration(decimal) }}
{% endif %}
</td>
<td colspan="{{ columns }}"></td>
</tr>
{% for project in data.projects %}
{% set absoluteDuration = absoluteDuration + project.duration %}
{% set absoluteInternalRate = absoluteInternalRate + project.internalRate %}
{% set absoluteRate = absoluteRate + project.rate %}
<tr class="project">
<td class="text-nowrap">
<strong>{{ widgets.label_project(project.project) }}</strong>
</td>
<td class="text-nowrap text-center total">
{% if dataType == 'rate' %}
{{ project.rate|money(currency) }}
{% elseif dataType == 'internalRate' %}
{{ project.internalRate|money(currency) }}
{% else %}
{{ project.duration|duration(decimal) }}
{% endif %}
</td>
{% for column in project.data.data %}
{% set dateKey = column.date|report_date %}
<td class="text-nowrap text-center day-total {% block column_classes_project %}{% endblock %}">
{% if column.duration > 0 or column.rate > 0 or column.internalRate > 0 %}
{% if dataType == 'rate' %}
{% set totalsRate = totalsRate|merge({(dateKey): (totalsRate[dateKey] + column.rate)}) %}
<strong>{{ column.rate|money(currency) }}</strong>
{% elseif dataType == 'internalRate' %}
{% set totalsInternalRate = totalsInternalRate|merge({(dateKey): (totalsInternalRate[dateKey] + column.internalRate)}) %}
<strong>{{ column.internalRate|money(currency) }}</strong>
{% else %}
{% set totalsDuration = totalsDuration|merge({(dateKey): (totalsDuration[dateKey] + column.duration)}) %}
<strong>{{ column.duration|duration(decimal) }}</strong>
{% endif %}
{% endif %}
</td>
{% endfor %}
</tr>
{% for activity in project.activities %}
<tr class="activity">
<td class="text-nowrap">
{{ widgets.label_activity(activity.activity) }}
</td>
<td class="text-nowrap text-center">
{% if dataType == 'rate' %}
{{ activity.rate|money(currency) }}
{% elseif dataType == 'internalRate' %}
{{ activity.internalRate|money(currency) }}
{% else %}
{{ activity.duration|duration(decimal) }}
{% endif %}
</td>
{% for column in activity.data.data %}
<td class="text-nowrap text-center day-total {% block column_classes_activity %}{% endblock %}">
{% 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 %}
</td>
{% endfor %}
</tr>
{% endfor %}
{% endfor %}
{% endfor %}
</tbody>
{% if totalCurrency is same as (false) %}
{% set totalCurrency = null %}
{% endif %}
<tfoot>
<tr class="summary">
<td>{{ dataTypeTitle|trans }}</td>
<td class="text-nowrap text-center total">
{% if dataType == 'rate' %}
{{ absoluteRate|money(totalCurrency) }}
{% elseif dataType == 'internalRate' %}
{{ absoluteInternalRate|money(totalCurrency) }}
{% else %}
{{ absoluteDuration|duration(decimal) }}
{% endif %}
</td>
{% for column in period.dateTimes %}
{% set dateKey = column|report_date %}
<td class="text-nowrap text-center day-total {% block column_classes_total %}{% endblock %}">
{% if dataType == 'rate' %}
{{ totalsRate[dateKey]|money(totalCurrency) }}
{% elseif dataType == 'internalRate' %}
{{ totalsInternalRate[dateKey]|money(totalCurrency) }}
{% else %}
{{ totalsDuration[dateKey]|duration(decimal) }}
{% endif %}
</td>
{% endfor %}
</tr>
</tfoot>
</table>