diff --git a/hosting/templates/hosting/invoice_detail.html b/hosting/templates/hosting/invoice_detail.html index e63f25a7..359178b2 100644 --- a/hosting/templates/hosting/invoice_detail.html +++ b/hosting/templates/hosting/invoice_detail.html @@ -89,80 +89,90 @@

{% trans "Invoice summary" %}

{% if vm %} -

- {% trans "Product" %}:  - {% if vm.name %} - {{ vm.name }} - {% endif %} -

-
-
- {% if period_start %} + {% if line_items %} + + + {% for line_item in line_items %} + + {% endfor %} + +
ProductPeriodQuantityUnit PriceTotal
{% if line_item.description|len > 0 %}{{line_item.description}}{% else %}{{line_item.stripe_plan.stripe_plan_id}}{% endif %}{{ line_item.period_start | date:'Y-m-d' }} — {{ line_item.period_end | date:'Y-m-d' }}{{line_item.quantity}}{{line_item.unit_amount}}{{line_item.amount}}
Grand Total{{total_in_chf}}
+ {% else %}

- {% trans "Period" %}: - - {{ period_start|date:'Y-m-d h:i a' }} - {{ period_end|date:'Y-m-d h:i a' }} - -

- {% endif %} -

- {% trans "Cores" %}: - {% if vm.cores %} - {{vm.cores|floatformat}} - {% else %} - {{vm.cpu|floatformat}} + {% trans "Product" %}:  + {% if vm.name %} + {{ vm.name }} {% endif %}

-

- {% trans "Memory" %}: - {{vm.memory}} GB -

-

- {% trans "Disk space" %}: - {{vm.disk_size}} GB -

-
-
-
-
- {% if vm.vat > 0 or vm.discount.amount > 0 %} -
-
- {% if vm.vat > 0 %} -

- {% trans "Subtotal" %} - {{vm.price|floatformat:2|intcomma}} - CHF -

-

- {% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) - - {{vm.vat|floatformat:2|intcomma}} CHF -

- {% endif %} - {% if vm.discount.amount > 0 %} -

- {%trans "Discount" as discount_name %} - {{ vm.discount.name|default:discount_name }} - - {{ vm.discount.amount }} CHF -

+
+
+ {% if period_start %} +

+ {% trans "Period" %}: + + {{ period_start|date:'Y-m-d h:i a' }} - {{ period_end|date:'Y-m-d h:i a' }} + +

+ {% endif %} +

+ {% trans "Cores" %}: + {% if vm.cores %} + {{vm.cores|floatformat}} + {% else %} + {{vm.cpu|floatformat}} + {% endif %} +

+

+ {% trans "Memory" %}: + {{vm.memory}} GB +

+

+ {% trans "Disk space" %}: + {{vm.disk_size}} GB +

+
+
+
+
+ {% if vm.vat > 0 or vm.discount.amount > 0 %} +
+
+ {% if vm.vat > 0 %} +

+ {% trans "Subtotal" %} + {{vm.price|floatformat:2|intcomma}} + CHF +

+

+ {% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) + + {{vm.vat|floatformat:2|intcomma}} CHF +

+ {% endif %} + {% if vm.discount.amount > 0 %} +

+ {%trans "Discount" as discount_name %} + {{ vm.discount.name|default:discount_name }} + - {{ vm.discount.amount }} CHF +

+ {% endif %} +
+
+
+
+
{% endif %} +
+

+ {% trans "Total" %} + {% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} + CHF +

+
-
-
-
-
{% endif %} -
-

- {% trans "Total" %} - {% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} - CHF -

-
-
{% else %}

{% trans "Product" %}:  diff --git a/hosting/views.py b/hosting/views.py index fe13ff21..862989e1 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -1322,6 +1322,9 @@ class InvoiceDetailView(LoginRequiredMixin, DetailView): context['total_in_chf'] = obj.total_in_chf() context['invoice_number'] = obj.invoice_number context['discount_on_stripe'] = obj.discount_in_chf() + if obj.lines_data_count > 1: + # special case, we pass the details of each of the line items + context['line_items'] = obj.hostingbilllineitem_set.all() return context else: raise Http404