show short summary under export table (#1547)

This commit is contained in:
Kevin Papst
2020-03-12 17:05:51 +01:00
committed by GitHub
parent 7f931cbfd3
commit fbdc668a22
4 changed files with 29 additions and 8 deletions

View File

@@ -33,7 +33,7 @@ with most advanced features from Kimai 1 and many new ones, including but not li
JSON API, invoicing, data exports, multi-timer and punch-in punch-out mode, tagging, multi-user and multi-timezones,
authentication via SAML/LDAP/Database, customizable role permissions, responsive and ready for your mobile device,
hourly and fixed rates, advanced filtering, money and time budgets with report, support for plugins and many more.
user specific rates, advanced search & filtering, money and time budgets with report, support for plugins and many more.
## Installation
@@ -61,9 +61,10 @@ It is open for changes and input from the community, your [ideas and questions](
> Kimai 2 uses a rolling release concept for delivering updates.
> You can upgrade Kimai at any time , you don't need to wait for the next official release.
Release versions will be created on a regular base (approx. one release per month) and you can should use these tags if you are not familiar with git.
Release versions will be created on a regular base (approx. one release per month) and you should use these tags if you are not familiar with git.
Every code change, whether it's a new feature or a bug fix, will be done on the master branch.
I have to do it this way, as I develop Kimai in my free time and want to put my effort into the software instead of backporting changes for old versions.
I develop Kimai in my free time and want to put my effort into the software instead of backporting changes for old versions.
The only exception is a critical security issue, which I would fix in the last version as well.
## Credits

View File

@@ -10,6 +10,7 @@ Perform EACH version specific task between your version and the new one, otherwi
## [1.8](https://github.com/kevinpapst/kimai2/releases/tag/1.8)
- New PHP requirement: `ext-xsl` should be pre-installed in most environments when `ext-xml` is loaded
- New mailer library: check if emails are still working (eg. by using the "password forgotten" function) or if you need to adjust your configuration, [see docs at symfony.com](https://symfony.com/doc/current/components/mailer.html#transport)
- Support for line breaks in multiline invoice fields for spreadsheets (check your invoice templates after the update)

View File

@@ -59,17 +59,23 @@
{{ widgets.callout('warning', 'error.no_entries_found') }}
{% else %}
{{ tables.datatable_header(tableName, columns, query, {}) }}
{% set totalAmount = {} %}
{% set totalDuration = 0 %}
{% for entry in entries %}
{% set currency = entry.project.customer.currency %}
{% set duration = entry.duration|duration %}
{% if totalAmount[currency] is not defined %}
{% set totalAmount = totalAmount|merge({(currency): 0}) %}
{% endif %}
{% if entry.fixedRate is not null %}
{% set rate = entry.fixedRate %}
{% set duration = 1 %}
{% elseif entry.hourlyRate is not null %}
{% set rate = entry.hourlyRate %}
{% set totalDuration = totalDuration + 1 %}
{% else %}
{% set rate = entry.user.preferenceValue('hourly_rate') %}
{% set rate = entry.hourlyRate %}
{% set totalDuration = totalDuration + entry.duration %}
{% endif %}
{% set totalAmount = totalAmount|merge({(currency): totalAmount[currency] + entry.rate}) %}
<tr>
<td class="text-nowrap">{{ entry.begin|date_short }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'user') }}">{{ widgets.label_user(entry.user) }}</td>
@@ -114,6 +120,17 @@
</td>
</tr>
{% endfor %}
<tr>
<td colspan="6"></td>
<th>{{ totalDuration|duration }}</th>
<th>
{% for currency, amount in totalAmount %}
{{ amount|money(currency) }}
{% if not loop.last %}<br>{% endif %}
{% endfor %}
</th>
<td></td>
</tr>
{{ tables.data_table_footer(entries) }}
{% endif %}
{% endif %}

View File

@@ -84,7 +84,8 @@ class ExportControllerTest extends ControllerBaseTest
// make sure all existing records are displayed
$this->assertHasDataTable($client);
$this->assertDataTableRowCount($client, 'datatable_export', 22);
// +1 row for summary
$this->assertDataTableRowCount($client, 'datatable_export', 23);
// assert export type buttons are available
$expected = ['csv', 'html', 'pdf', 'xlsx'];
@@ -135,7 +136,8 @@ class ExportControllerTest extends ControllerBaseTest
// make sure all existing records are displayed
$this->assertHasDataTable($client);
$this->assertDataTableRowCount($client, 'datatable_export', 2);
// +1 row for summary
$this->assertDataTableRowCount($client, 'datatable_export', 3);
// assert export type buttons are available
$expected = ['csv', 'html', 'pdf', 'xlsx'];