Show vat_percent and subtotal for vat exclusive case

This commit is contained in:
PCoder 2018-04-17 21:38:28 +02:00
parent a50fa77c8a
commit c2513dc7c3
3 changed files with 9 additions and 4 deletions

View file

@ -67,7 +67,11 @@
</p> </p>
{% if vm.vat > 0 %} {% if vm.vat > 0 %}
<p> <p>
<span>{% trans "VAT" %}: </span> <span>{% trans "Subtotal" %}: </span>
<span class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</span>
</p>
<p>
<span>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%): </span>
<span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span>
</p> </p>
{% endif %} {% endif %}

View file

@ -158,7 +158,7 @@ class IndexView(CreateView):
) )
return HttpResponseRedirect(referer_url + "#order_form") return HttpResponseRedirect(referer_url + "#order_form")
price, vat = get_vm_price_with_vat( price, vat, vat_percent = get_vm_price_with_vat(
cpu=cores, cpu=cores,
memory=memory, memory=memory,
ssd_size=storage, ssd_size=storage,
@ -170,6 +170,7 @@ class IndexView(CreateView):
'disk_size': storage, 'disk_size': storage,
'price': price, 'price': price,
'vat': vat, 'vat': vat,
'vat_percent': vat_percent,
'total_price': price + vat, 'total_price': price + vat,
'pricing_name': vm_pricing_name 'pricing_name': vm_pricing_name
} }

View file

@ -749,7 +749,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
context['vm'] = vm_detail.__dict__ context['vm'] = vm_detail.__dict__
context['vm']['name'] = '{}-{}'.format( context['vm']['name'] = '{}-{}'.format(
context['vm']['configuration'], context['vm']['vm_id']) 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'], cpu=context['vm']['cores'],
ssd_size=context['vm']['disk_size'], ssd_size=context['vm']['disk_size'],
memory=context['vm']['memory'], memory=context['vm']['memory'],
@ -766,7 +766,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
) )
vm = manager.get_vm(obj.vm_id) vm = manager.get_vm(obj.vm_id)
context['vm'] = VirtualMachineSerializer(vm).data 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'], cpu=context['vm']['cores'],
ssd_size=context['vm']['disk_size'], ssd_size=context['vm']['disk_size'],
memory=context['vm']['memory'], memory=context['vm']['memory'],