add subtotal and payment date to invoices (#2450)

This commit is contained in:
Philipp
2021-03-29 00:51:34 +02:00
committed by GitHub
parent 7029bde555
commit d84beb957c
11 changed files with 222 additions and 5 deletions

View File

@@ -11,7 +11,9 @@
'customer': {'class': 'hidden-xs hidden-sm text-nowrap', 'orderBy': false},
'invoice_number': {'class': 'hidden-xs hidden-sm text-center w-min', 'title': 'invoice.number'|trans, 'orderBy': false},
'due_date': {'class': 'hidden-xs text-center w-min', 'title': 'invoice.due_days'|trans, 'orderBy': false},
'payment_date': {'class': 'hidden-xs hidden text-center w-min', 'title': 'invoice.payment_date'|trans, 'orderBy': false},
'status': {'class': 'text-center alwaysVisible w-min', 'orderBy': false},
'subtotal': {'class': 'hidden-xs text-center w-min hidden', 'title': 'invoice.subtotal'|trans, 'orderBy': false},
'tax': {'class': 'hidden-xs text-center w-min hidden', 'title': 'invoice.tax'|trans, 'orderBy': false},
'total_rate': {'class': 'hidden-xs text-right w-min', 'orderBy': false},
'actions': {'class': 'actions alwaysVisible', 'orderBy': false},
@@ -40,7 +42,15 @@
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">{{ widgets.label_customer(entry.customer) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'invoice_number') }}">{{ widgets.label(entry.invoiceNumber, 'default') }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'due_date') }}">{{ macros.invoice_due_date(entry) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'payment_date') }}">
{% if entry.paymentDate and entry.paid %}
{{ widgets.label(entry.paymentDate|date_short, 'primary') }}
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'status') }}">{{ macros.invoice_status(entry) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'subtotal') }}">{{ entry.subtotal|money(entry.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'tax') }}">{{ entry.tax|money(entry.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'total_rate') }}">{{ entry.total|money(entry.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">{{ actions.invoice(entry, 'index') }}</td>
@@ -60,4 +70,9 @@
});
</script>
{% endif %}
<script type="text/javascript">
document.addEventListener('kimai.initialized', function() {
KimaiReloadPageWidget.create('kimai.invoiceUpdate');
});
</script>
{% endblock %}

View File

@@ -0,0 +1,13 @@
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% block page_title %}{{ 'invoice.title'|trans }}{% endblock %}
{% block main %}
{% set formEditTemplate = app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
{% set formOptions = {
'title': invoice.customer.name ~ ' ' ~ invoice.createdAt|date_short~ ' ' ~ invoice.total|money(invoice.customer.currency),
'form': form,
'back': path('admin_invoice_list')
} %}
{% embed formEditTemplate with formOptions %}{% endembed %}
{% endblock %}