total sums for duration and rate in invoice and export preview (#3431)
This commit is contained in:
@@ -66,10 +66,26 @@
|
|||||||
{% if entries is empty %}
|
{% if entries is empty %}
|
||||||
{{ widgets.nothing_found() }}
|
{{ widgets.nothing_found() }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% set totalDuration = 0 %}
|
||||||
|
{% set totalRates = {} %}
|
||||||
|
|
||||||
|
{% for row in by_customer %}
|
||||||
|
{% set totalDuration = totalDuration + row.duration %}
|
||||||
|
{% set customerCurrency = row.customer.currency %}
|
||||||
|
{% if totalRates[customerCurrency] is not defined %}
|
||||||
|
{% set totalRates = totalRates|merge({(customerCurrency): 0.00}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% set totalRates = totalRates|merge({(customerCurrency): totalRates[customerCurrency] + row.rate}) %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
|
{% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
|
||||||
{% import "macros/widgets.html.twig" as widgets %}
|
{% import "macros/widgets.html.twig" as widgets %}
|
||||||
{% block box_title %}
|
{% block box_title %}
|
||||||
{{ 'button.preview'|trans }}: {{ 'export.title'|trans }}
|
{{ 'button.preview'|trans }}: {{ 'export.title'|trans }}
|
||||||
|
{{ widgets.label(totalDuration|duration, 'gray') }}
|
||||||
|
{% for totalCurrency, totalRate in totalRates %}
|
||||||
|
{{ widgets.label(totalRate|money(totalCurrency), 'gray') }}
|
||||||
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block box_body_class %}no-padding{% endblock %}
|
{% block box_body_class %}no-padding{% endblock %}
|
||||||
{% block box_footer %}
|
{% block box_footer %}
|
||||||
|
|||||||
@@ -66,12 +66,21 @@
|
|||||||
{{ widgets.callout('danger', 'http_error_403.suggestion'|trans({}, 'exceptions')) }}
|
{{ widgets.callout('danger', 'http_error_403.suggestion'|trans({}, 'exceptions')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% set totalDuration = 0 %}
|
||||||
|
{% set totalRates = {} %}
|
||||||
|
|
||||||
{% if searched %}
|
{% if searched %}
|
||||||
{% set showEmpty = true %}
|
{% set showEmpty = true %}
|
||||||
{% for model in models %}
|
{% for model in models %}
|
||||||
{% if showEmpty %}
|
{% if showEmpty %}
|
||||||
{% set showEmpty = model.calculator is empty or model.calculator.entries is empty %}
|
{% set showEmpty = model.calculator is empty or model.calculator.entries is empty %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% set totalDuration = totalDuration + model.calculator.timeWorked %}
|
||||||
|
{% set customerCurrency = model.customer.currency %}
|
||||||
|
{% if totalRates[customerCurrency] is not defined %}
|
||||||
|
{% set totalRates = totalRates|merge({(customerCurrency): 0.00}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% set totalRates = totalRates|merge({(customerCurrency): totalRates[customerCurrency] + model.calculator.total}) %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if showEmpty %}
|
{% if showEmpty %}
|
||||||
{{ widgets.nothing_found() }}
|
{{ widgets.nothing_found() }}
|
||||||
@@ -84,6 +93,10 @@
|
|||||||
{% import '@AdminLTE/Macros/buttons.html.twig' as button %}
|
{% import '@AdminLTE/Macros/buttons.html.twig' as button %}
|
||||||
{% block box_title %}
|
{% block box_title %}
|
||||||
{{ 'button.preview'|trans }}: {{ 'invoices'|trans }}
|
{{ 'button.preview'|trans }}: {{ 'invoices'|trans }}
|
||||||
|
{{ widgets.label(totalDuration|duration, 'gray') }}
|
||||||
|
{% for totalCurrency, totalRate in totalRates %}
|
||||||
|
{{ widgets.label(totalRate|money(totalCurrency), 'gray') }}
|
||||||
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block box_body_class %}no-padding{% endblock %}
|
{% block box_body_class %}no-padding{% endblock %}
|
||||||
{% block box_footer %}
|
{% block box_footer %}
|
||||||
|
|||||||
Reference in New Issue
Block a user