From c2513dc7c3527afc4f94cb577062a47c9a906d74 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 17 Apr 2018 21:38:28 +0200 Subject: [PATCH] Show vat_percent and subtotal for vat exclusive case --- datacenterlight/templates/datacenterlight/order_detail.html | 6 +++++- datacenterlight/views.py | 3 ++- hosting/views.py | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index f26bc450..543f3934 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -67,7 +67,11 @@

{% if vm.vat > 0 %}

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

+

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

{% endif %} diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 87a0e660..cccd4277 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -158,7 +158,7 @@ class IndexView(CreateView): ) return HttpResponseRedirect(referer_url + "#order_form") - price, vat = get_vm_price_with_vat( + price, vat, vat_percent = get_vm_price_with_vat( cpu=cores, memory=memory, ssd_size=storage, @@ -170,6 +170,7 @@ class IndexView(CreateView): 'disk_size': storage, 'price': price, 'vat': vat, + 'vat_percent': vat_percent, 'total_price': price + vat, 'pricing_name': vm_pricing_name } diff --git a/hosting/views.py b/hosting/views.py index 88593969..a7aeca1e 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -749,7 +749,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['vm'] = vm_detail.__dict__ context['vm']['name'] = '{}-{}'.format( context['vm']['configuration'], context['vm']['vm_id']) - price, vat = get_vm_price_with_vat( + price, vat, vat_percent = get_vm_price_with_vat( cpu=context['vm']['cores'], ssd_size=context['vm']['disk_size'], memory=context['vm']['memory'], @@ -766,7 +766,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): ) vm = manager.get_vm(obj.vm_id) context['vm'] = VirtualMachineSerializer(vm).data - price, vat = get_vm_price_with_vat( + price, vat, vat_percent = get_vm_price_with_vat( cpu=context['vm']['cores'], ssd_size=context['vm']['disk_size'], memory=context['vm']['memory'],