faster spreadsheet exporter based on opensout and other export improvements (#5238)

This commit is contained in:
Kevin Papst
2024-12-22 18:36:47 +01:00
committed by GitHub
parent c7f0508707
commit 136104d4b0
80 changed files with 2023 additions and 1699 deletions

View File

@@ -23,6 +23,7 @@
'project': {'class': 'd-none d-sm-table-cell', 'orderBy': false},
'activity': {'class': 'd-none', 'orderBy': false},
'description': {'class': 'd-none d-xl-table-cell timesheet-description', 'orderBy': false},
'tags': {'class': 'd-none d-xl-table-cell', 'orderBy': false},
'unit_price': {'class': 'd-none text-nowrap text-end', 'orderBy': false},
'duration': {'class': 'text-end text-nowrap', 'orderBy': false},
'internalRate': {'class': 'text-end d-none text-nowrap', 'orderBy': false},
@@ -229,6 +230,11 @@
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }}">
{{ entry.description|desc2html }}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'tags') }}">
{% if entry.type == 'timesheet' %}
{{ widgets.tag_list(entry.tags) }}
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'unit_price') }}">
{{ rate|money(currency) }}
</td>

View File

@@ -16,7 +16,7 @@
{% if stats is empty %}
{{ nothing_found() }}
{% else %}
{% embed 'reporting/customer/monthly_projects_data.html.twig' with {'dataTypeFormat': null, 'stats': stats, 'dataType': dataType, 'decimal': decimal} only %}
{% embed 'reporting/customer/monthly_projects_data.html.twig' with {'stats': stats, 'dataType': dataType, 'decimal': decimal} only %}
{% set rowspanStyle = 'vertical-align: middle' %}
{% endembed %}
{% endif %}

View File

@@ -51,7 +51,7 @@
{% if project.activities[activity.id] is defined and i <= project.activities[activity.id]['users']|length %}
{% set user = project.activities[activity.id]['users']|slice(-i) %}
<td>{{ user.0.name }}</td>
<td class="text-center"{% if dataTypeFormat is not null %} data-format="{{ dataTypeFormat }}"{% endif %}>
<td class="text-center">
{% set value = user.0[dataType] %}
{% block user_activity %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
@@ -62,7 +62,7 @@
{% endblock %}
</td>
{% if loop.parent.loop.first %}
<td{% if rowspan > 1 %} rowspan="{{ rowspan }}"{% endif %} class="text-center text-nowrap"{% if dataTypeFormat is not null %} data-format="{{ dataTypeFormat }}"{% endif %}>
<td{% if rowspan > 1 %} rowspan="{{ rowspan }}"{% endif %} class="text-center text-nowrap">
{% set value = project.activities[activity.id][dataType] %}
{% block project_activity %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
@@ -82,7 +82,7 @@
{% endif %}
{% endfor %}
{% if loop.first %}
<th{% if rowspan > 1 %} rowspan="{{ rowspan }}" style="{{ rowspanStyle }}"{% endif %} class="text-center text-nowrap"{% if dataTypeFormat is not null %} data-format="{{ dataTypeFormat }}"{% endif %}>
<th{% if rowspan > 1 %} rowspan="{{ rowspan }}" style="{{ rowspanStyle }}"{% endif %} class="text-center text-nowrap">
{% set value = project[dataType] %}
{% block project_total %}
{% if dataType == 'rate' or dataType == 'internalRate' %}

View File

@@ -1,30 +1,24 @@
{% embed 'reporting/customer/monthly_projects_data.html.twig' with {'decimal': true, 'stats': stats, 'dataType': dataType} only %}
{% set dataTypeFormat = null %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
{% set dataTypeFormat = constant('App\\Export\\Base\\AbstractSpreadsheetRenderer::RATE_FORMAT_NO_CURRENCY') %}
{% elseif dataType == 'duration' %}
{% set dataTypeFormat = constant('App\\Export\\Base\\AbstractSpreadsheetRenderer::DURATION_DECIMAL') %}
{% endif %}
{% set rowspanStyle = 'vertical-align:center' %}
{% block user_activity %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
{{ value|money(currency) }}
{% else %}
{{ value / 3600 }}
{{ value|duration(true) }}
{% endif %}
{% endblock %}
{% block project_activity %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
{{ value|money(currency) }}
{% else %}
{{ value / 3600 }}
{{ value|duration(true) }}
{% endif %}
{% endblock %}
{% block project_total %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
{{ value|money(currency) }}
{% else %}
{{ value / 3600 }}
{{ value|duration(true) }}
{% endif %}
{% endblock %}
{% endembed %}

View File

@@ -1,6 +1,7 @@
{% set columns = {
'customer': {'title': 'customer'|trans},
'name': {'title': 'name'|trans},
'currency': {'title': 'currency'|trans},
'budgetType': {'title': 'budgetType'|trans},
} %}
{% if is_granted('budget_time', 'project') %}
@@ -54,6 +55,8 @@
{% endif %}
{% elseif name == 'customer' %}
{{ project.customer.name }}
{% elseif name == 'currency' %}
{{ currency }}
{% elseif name == 'lastRecord' %}
{% if entry.lastRecord is not null %}
{{ entry.lastRecord|date_short }}
@@ -61,60 +64,56 @@
&ndash;
{% endif %}
{% elseif name == 'today' %}
{{ entry.durationDay|duration }}
{{ entry.durationDay|duration(true) }}
{% elseif name == 'week' %}
{{ entry.durationWeek|duration }}
{{ entry.durationWeek|duration(true) }}
{% elseif name == 'month' %}
{{ entry.durationMonth|duration }}
{{ entry.durationMonth|duration(true) }}
{% elseif name == 'timeBudget' %}
{% if showTimeBudget %}
{{ budgetStatisticModel.getTimeBudget()|duration }}
{% else %}
&ndash;
{{ budgetStatisticModel.getTimeBudget()|duration(true) }}
{% endif %}
{% elseif name == 'durationTotal' %}
{{ entry.durationTotal|duration }}
{{ entry.durationTotal|duration(true) }}
{% elseif name == 'billableTime' %}
{% if canSeeTimeBudget %}
{{ budgetStatisticModel.getTimeBudgetSpent()|duration }}
{{ budgetStatisticModel.getTimeBudgetSpent()|duration(true) }}
{% endif %}
{% elseif name == 'exported' %}
{% if canSeeTimeBudget %}
{{ entry.notExportedDuration|duration }}
{{ entry.notExportedDuration|duration(true) }}
{% endif %}
{% elseif name == 'budget' %}
{% if showMoneyBudget %}
{{ budgetStatisticModel.getBudget()|money(currency) }}
{% else %}
&ndash;
{{ budgetStatisticModel.getBudget()|money }}
{% endif %}
{% elseif name == 'amountTotal' %}
{% if canSeeMoneyBudget %}
{{ budgetStatisticModel.getStatisticTotal().getRate()|money(currency) }}
{{ budgetStatisticModel.getStatisticTotal().getRate()|money }}
{% endif %}
{% elseif name == 'billableMoney' %}
{% if canSeeMoneyBudget %}
{{ budgetStatisticModel.getBudgetSpent()|money(currency) }}
{{ budgetStatisticModel.getBudgetSpent()|money }}
{% endif %}
{% elseif name == 'internalRate' %}
{% if canSeeMoneyBudget %}
{{ budgetStatisticModel.getInternalRate()|money(currency) }}
{{ budgetStatisticModel.getInternalRate()|money }}
{% endif %}
{% elseif name == 'revenue' %}
{% if canSeeMoneyBudget %}
{{ revenue|money(currency) }}
{{ revenue|money }}
{% endif %}
{% elseif name == 'hourlyBillable' %}
{% if canSeeMoneyBudget and durationTotal > 0 %}
{{ (budgetStatisticModel.getBudgetSpent() / durationTotal)|money(currency) }}
{{ (budgetStatisticModel.getBudgetSpent() / durationTotal)|money }}
{% endif %}
{% elseif name == 'hourlyTotal' %}
{% if canSeeMoneyBudget and durationTotal > 0 %}
{{ (revenue / durationTotal)|money(currency) }}
{{ (revenue / durationTotal)|money }}
{% endif %}
{% elseif name == 'invoiced' %}
{% if canSeeMoneyBudget %}
{{ entry.notExportedRate|money(currency) }}
{{ entry.notExportedRate|money }}
{% endif %}
{% elseif name == 'projectStart' %}
{% if project.start is not null %}{{ project.start|date_short }}{% endif %}

View File

@@ -1,24 +1,18 @@
{% embed 'reporting/user_list_period_data.html.twig' with {'avatar': false, 'showAccountNumber': true, 'stats': stats, 'dataType': dataType, 'period_attribute': period_attribute} only %}
{% set dataTypeFormat = '' %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
{% set dataTypeFormat = ' data-format="' ~ constant('App\\Export\\Base\\AbstractSpreadsheetRenderer::RATE_FORMAT_NO_CURRENCY') ~ '"' %}
{% elseif dataType == 'duration' %}
{% set dataTypeFormat = ' data-format="' ~ constant('App\\Export\\Base\\AbstractSpreadsheetRenderer::DURATION_DECIMAL') ~ '"' %}
{% endif %}
{% block user_column %}
{{ userPeriod.user.displayName|sanitize_dde }}
{% endblock %}
{% block duration -%}
{{ period.totalDuration / 3600 }}
{{ period.totalDuration|duration(true) }}
{%- endblock %}
{% block total_duration -%}
{{ absoluteDuration / 3600 }}
{{ absoluteDuration|duration(true) }}
{%- endblock %}
{% block total_duration_user -%}
{{ usersTotalDuration / 3600 }}
{{ usersTotalDuration|duration(true) }}
{%- endblock %}
{% block total_duration_period -%}
{{ total / 3600 }}
{{ total|duration(true) }}
{%- endblock %}
{% block rate %}
{{ period.totalRate }}
@@ -49,11 +43,4 @@
{{ column|date_short }}
</th>
{% endblock %}
{% block user_column_cell_attribute %} data-format="@"{% endblock %}
{% block period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block user_total_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_rate_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_internal_rate_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_duration_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% endembed %}

View File

@@ -1,24 +1,18 @@
{% embed 'reporting/user_list_period_data.html.twig' with {'avatar': false, 'showAccountNumber': true, 'stats': stats, 'dataType': dataType, 'period_attribute': period_attribute} only %}
{% set dataTypeFormat = '' %}
{% if dataType == 'rate' or dataType == 'internalRate' %}
{% set dataTypeFormat = ' data-format="' ~ constant('App\\Export\\Base\\AbstractSpreadsheetRenderer::RATE_FORMAT_NO_CURRENCY') ~ '"' %}
{% elseif dataType == 'duration' %}
{% set dataTypeFormat = ' data-format="' ~ constant('App\\Export\\Base\\AbstractSpreadsheetRenderer::DURATION_DECIMAL') ~ '"' %}
{% endif %}
{% block user_column %}
{{ userPeriod.user.displayName|sanitize_dde }}
{% endblock %}
{% block duration -%}
{{ period.totalDuration / 3600 }}
{{ period.totalDuration|duration(true) }}
{%- endblock %}
{% block total_duration -%}
{{ absoluteDuration / 3600 }}
{{ absoluteDuration|duration(true) }}
{%- endblock %}
{% block total_duration_user -%}
{{ usersTotalDuration / 3600 }}
{{ usersTotalDuration|duration(true) }}
{%- endblock %}
{% block total_duration_period -%}
{{ total / 3600 }}
{{ total|duration(true) }}
{%- endblock %}
{% block rate %}
{{ period.totalRate }}
@@ -49,11 +43,4 @@
{{ column|month_name }} {{ column|date_format('Y') }}
</th>
{% endblock %}
{% block user_column_cell_attribute %} data-format="@"{% endblock %}
{% block period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block user_total_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_rate_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_internal_rate_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% block total_duration_period_cell_attribute %}{{ dataTypeFormat|raw }}{% endblock %}
{% endembed %}