switch to excel cell formats for report exports (#3178)
This commit is contained in:
@@ -45,11 +45,16 @@ abstract class AbstractSpreadsheetRenderer
|
|||||||
public const TIME_FORMAT = 'hh:mm';
|
public const TIME_FORMAT = 'hh:mm';
|
||||||
public const DURATION_FORMAT = '[hh]:mm';
|
public const DURATION_FORMAT = '[hh]:mm';
|
||||||
public const DURATION_DECIMAL = '#0.00';
|
public const DURATION_DECIMAL = '#0.00';
|
||||||
|
|
||||||
// https://support.microsoft.com/de-de/office/zahlenformatcodes-5026bbd6-04bc-48cd-bf33-80f18b4eae68
|
// https://support.microsoft.com/de-de/office/zahlenformatcodes-5026bbd6-04bc-48cd-bf33-80f18b4eae68
|
||||||
// Part 1 = positive; Part 2 = negative; Part 3 = zero; Part 4 = Text
|
// Part 1 = positive; Part 2 = negative; Part 3 = zero; Part 4 = Text
|
||||||
public const RATE_FORMAT_DEFAULT = '#.##0,00 [$%1$s];-#.##0,00 [$%1$s]';
|
public const RATE_FORMAT_DEFAULT = '#.##0,00 [$%1$s];-#.##0,00 [$%1$s]';
|
||||||
public const RATE_FORMAT_LEFT = '_("%1$s"* #,##0.00_);_("%1$s"* -#,##0.00;_("%1$s"* "-"??_);_(@_)';
|
public const RATE_FORMAT_LEFT = '_("%1$s"* #,##0.00_);_("%1$s"* -#,##0.00;_("%1$s"* "-"??_);_(@_)';
|
||||||
public const RATE_FORMAT = self::RATE_FORMAT_LEFT;
|
public const RATE_FORMAT = self::RATE_FORMAT_LEFT;
|
||||||
|
/**
|
||||||
|
* @internal used in html to excel exporter
|
||||||
|
*/
|
||||||
|
public const RATE_FORMAT_NO_CURRENCY = '#,##0.00;-#,##0.00';
|
||||||
|
|
||||||
protected $durationFormat = self::DURATION_FORMAT;
|
protected $durationFormat = self::DURATION_FORMAT;
|
||||||
protected $durationBase = 86400;
|
protected $durationBase = 86400;
|
||||||
|
|||||||
@@ -1,46 +1,59 @@
|
|||||||
{% embed 'reporting/user_list_period_data.html.twig' %}
|
{% embed 'reporting/user_list_period_data.html.twig' %}
|
||||||
|
{% 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 %}
|
{% block user_column %}
|
||||||
{{ userPeriod.user.displayName }}
|
{{ userPeriod.user.displayName }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block duration -%}
|
{% block duration -%}
|
||||||
=VALUE("{{ period.totalDuration|duration(true) }}")
|
{{ period.totalDuration / 3600 }}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block total_duration -%}
|
{% block total_duration -%}
|
||||||
=VALUE("{{ absoluteDuration|duration(true) }}")
|
{{ absoluteDuration / 3600 }}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block total_duration_user -%}
|
{% block total_duration_user -%}
|
||||||
=VALUE("{{ usersTotalDuration|duration(true) }}")
|
{{ usersTotalDuration / 3600 }}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block total_duration_period -%}
|
{% block total_duration_period -%}
|
||||||
=VALUE("{{ total|duration(true) }}")
|
{{ total / 3600 }}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block rate %}
|
{% block rate %}
|
||||||
=VALUE("{{ period.totalRate|money }}")
|
{{ period.totalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_rate %}
|
{% block total_rate %}
|
||||||
=VALUE("{{ absoluteRate|money }}")
|
{{ absoluteRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_rate_user %}
|
{% block total_rate_user %}
|
||||||
=VALUE("{{ usersTotalRate|money }}")
|
{{ usersTotalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_rate_period %}
|
{% block total_rate_period %}
|
||||||
=VALUE("{{ total|money }}")
|
{{ total }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block internal_rate %}
|
{% block internal_rate %}
|
||||||
=VALUE("{{ period.totalInternalRate|money }}")
|
{{ period.totalInternalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_internal_rate %}
|
{% block total_internal_rate %}
|
||||||
=VALUE("{{ absoluteInternalRate|money }}")
|
{{ absoluteInternalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_internal_rate_user %}
|
{% block total_internal_rate_user %}
|
||||||
=VALUE("{{ usersTotalInternalRate|money }}")
|
{{ usersTotalInternalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_internal_rate_period %}
|
{% block total_internal_rate_period %}
|
||||||
=VALUE("{{ total|money }}")
|
{{ total }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block period_name %}
|
{% block period_name %}
|
||||||
<th class="text-center text-nowrap">
|
<th class="text-center text-nowrap">
|
||||||
{{ column|date_short }}
|
{{ column|date_short }}
|
||||||
</th>
|
</th>
|
||||||
{% endblock %}
|
{% 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 %}
|
{% endembed %}
|
||||||
|
|||||||
@@ -1,46 +1,59 @@
|
|||||||
{% embed 'reporting/user_list_period_data.html.twig' %}
|
{% embed 'reporting/user_list_period_data.html.twig' %}
|
||||||
|
{% 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 %}
|
{% block user_column %}
|
||||||
{{ userPeriod.user.displayName }}
|
{{ userPeriod.user.displayName }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block duration -%}
|
{% block duration -%}
|
||||||
=VALUE("{{ period.totalDuration|duration(true) }}")
|
{{ period.totalDuration / 3600 }}
|
||||||
{%- endblock %}
|
|
||||||
{% block total_duration_user -%}
|
|
||||||
=VALUE("{{ usersTotalDuration|duration(true) }}")
|
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block total_duration -%}
|
{% block total_duration -%}
|
||||||
=VALUE("{{ absoluteDuration|duration(true) }}")
|
{{ absoluteDuration / 3600 }}
|
||||||
|
{%- endblock %}
|
||||||
|
{% block total_duration_user -%}
|
||||||
|
{{ usersTotalDuration / 3600 }}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block total_duration_period -%}
|
{% block total_duration_period -%}
|
||||||
=VALUE("{{ total|duration(true) }}")
|
{{ total / 3600 }}
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
{% block rate %}
|
{% block rate %}
|
||||||
=VALUE("{{ period.totalRate|money }}")
|
{{ period.totalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_rate %}
|
{% block total_rate %}
|
||||||
=VALUE("{{ absoluteRate|money }}")
|
{{ absoluteRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_rate_user %}
|
{% block total_rate_user %}
|
||||||
=VALUE("{{ usersTotalRate|money }}")
|
{{ usersTotalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_rate_period %}
|
{% block total_rate_period %}
|
||||||
=VALUE("{{ total|money }}")
|
{{ total }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block internal_rate %}
|
{% block internal_rate %}
|
||||||
=VALUE("{{ period.totalInternalRate|money }}")
|
{{ period.totalInternalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_internal_rate %}
|
{% block total_internal_rate %}
|
||||||
=VALUE("{{ absoluteInternalRate|money }}")
|
{{ absoluteInternalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_internal_rate_user %}
|
{% block total_internal_rate_user %}
|
||||||
=VALUE("{{ usersTotalInternalRate|money }}")
|
{{ usersTotalInternalRate }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block total_internal_rate_period %}
|
{% block total_internal_rate_period %}
|
||||||
=VALUE("{{ total|money }}")
|
{{ total }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block period_name %}
|
{% block period_name %}
|
||||||
<th class="text-center text-nowrap">
|
<th class="text-center text-nowrap">
|
||||||
{{ column|month_name }} {{ column|date_format('Y') }}
|
{{ column|month_name }} {{ column|date_format('Y') }}
|
||||||
</th>
|
</th>
|
||||||
{% endblock %}
|
{% 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 %}
|
{% endembed %}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
{% set usersTotalInternalRate = 0 %}
|
{% set usersTotalInternalRate = 0 %}
|
||||||
{% set usersTotalRate = 0 %}
|
{% set usersTotalRate = 0 %}
|
||||||
<tr class="user">
|
<tr class="user">
|
||||||
<td class="text-nowrap">
|
<td class="text-nowrap"{% block user_column_cell_attribute %}{% endblock %}>
|
||||||
{% block user_column %}
|
{% block user_column %}
|
||||||
{% from "macros/widgets.html.twig" import label_dot %}
|
{% from "macros/widgets.html.twig" import label_dot %}
|
||||||
{{ label_dot(userPeriod.user.displayName, userPeriod.user.color) }}
|
{{ label_dot(userPeriod.user.displayName, userPeriod.user.color) }}
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
{% set totalsInternalRate = totalsInternalRate|merge({(reportDateKey): (totalsInternalRate[reportDateKey] + period.totalInternalRate)}) %}
|
{% set totalsInternalRate = totalsInternalRate|merge({(reportDateKey): (totalsInternalRate[reportDateKey] + period.totalInternalRate)}) %}
|
||||||
{% set totalsRate = totalsRate|merge({(reportDateKey): (totalsRate[reportDateKey] + period.totalRate)}) %}
|
{% set totalsRate = totalsRate|merge({(reportDateKey): (totalsRate[reportDateKey] + period.totalRate)}) %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<th class="text-nowrap text-center total">
|
<th class="text-nowrap text-center total{% block user_total_cell_class %}{% endblock %}"{% block user_total_cell_attribute %}{% endblock %}>
|
||||||
{% if dataType == 'rate' %}
|
{% if dataType == 'rate' %}
|
||||||
{% block total_rate_user %}{% endblock %}
|
{% block total_rate_user %}{% endblock %}
|
||||||
{% elseif dataType == 'internalRate' %}
|
{% elseif dataType == 'internalRate' %}
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</th>
|
</th>
|
||||||
{% for period in attribute(userPeriod, period_attribute) %}
|
{% for period in attribute(userPeriod, period_attribute) %}
|
||||||
<td class="text-nowrap text-center day-total{% block period_cell_class %}{% endblock %}">
|
<td class="text-nowrap text-center day-total{% block period_cell_class %}{% endblock %}"{% block period_cell_attribute %}{% endblock %}>
|
||||||
{% if period.totalDuration > 0 or period.totalRate > 0 or period.totalInternalRate > 0 %}
|
{% if period.totalDuration > 0 or period.totalRate > 0 or period.totalInternalRate > 0 %}
|
||||||
{% if dataType == 'rate' %}
|
{% if dataType == 'rate' %}
|
||||||
{% block rate %}{% endblock %}
|
{% block rate %}{% endblock %}
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<tfoot>
|
<tfoot>
|
||||||
<tr class="summary">
|
<tr class="summary">
|
||||||
<td>{{ dataTypeTitle|trans }}</td>
|
<td>{{ dataTypeTitle|trans }}</td>
|
||||||
<td class="text-center text-nowrap">
|
<td class="text-center text-nowrap{% block total_period_cell_class %}{% endblock %}"{% block total_period_cell_attribute %}{% endblock %}>
|
||||||
{% if dataType == 'rate' %}
|
{% if dataType == 'rate' %}
|
||||||
{% block total_rate %}
|
{% block total_rate %}
|
||||||
{{ absoluteRate|money }}
|
{{ absoluteRate|money }}
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
</td>
|
</td>
|
||||||
{% if dataType == 'rate' %}
|
{% if dataType == 'rate' %}
|
||||||
{% for id, total in totalsRate %}
|
{% for id, total in totalsRate %}
|
||||||
<td class="text-center text-nowrap">
|
<td class="text-center text-nowrap{% block total_rate_period_cell_class %}{% endblock %}"{% block total_rate_period_cell_attribute %}{% endblock %}>
|
||||||
{% block total_rate_period %}
|
{% block total_rate_period %}
|
||||||
{{ total|money }}
|
{{ total|money }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% elseif dataType == 'internalRate' %}
|
{% elseif dataType == 'internalRate' %}
|
||||||
{% for id, total in totalsInternalRate %}
|
{% for id, total in totalsInternalRate %}
|
||||||
<td class="text-center text-nowrap">
|
<td class="text-center text-nowrap{% block total_internal_rate_period_cell_class %}{% endblock %}"{% block total_internal_rate_period_cell_attribute %}{% endblock %}>
|
||||||
{% block total_internal_rate_period %}
|
{% block total_internal_rate_period %}
|
||||||
{{ total|money }}
|
{{ total|money }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for id, total in totalsDuration %}
|
{% for id, total in totalsDuration %}
|
||||||
<td class="text-center text-nowrap">
|
<td class="text-center text-nowrap{% block total_duration_period_cell_class %}{% endblock %}"{% block total_duration_period_cell_attribute %}{% endblock %}>
|
||||||
{% block total_duration_period %}
|
{% block total_duration_period %}
|
||||||
{{ total|duration(decimal) }}
|
{{ total|duration(decimal) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user