Show VAT elegantly
This commit is contained in:
parent
efe411933f
commit
3599f0bff4
2 changed files with 25 additions and 0 deletions
|
@ -55,10 +55,25 @@
|
||||||
</p>
|
</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
|
{% if generic_payment_details.vat_rate > 0 %}
|
||||||
|
<p>
|
||||||
|
<span>{% trans "Price" %}: </span>
|
||||||
|
<strong class="pull-right">CHF {{generic_payment_details.amount_before_vat|floatformat:2|intcomma}}</strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span>{% trans "VAT for" %} {{generic_payment_details.vat_country}} ({{generic_payment_details.vat_rate}}%) : </span>
|
||||||
|
<strong class="pull-right">CHF {{generic_payment_details.vat_amount|floatformat:2|intcomma}}</strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span>{% trans "Total Amount" %} : </span>
|
||||||
|
<strong class="pull-right">CHF {{generic_payment_details.amount|floatformat:2|intcomma}}</strong>
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
<p>
|
<p>
|
||||||
<span>{% trans "Amount" %}: </span>
|
<span>{% trans "Amount" %}: </span>
|
||||||
<strong class="pull-right">CHF {{generic_payment_details.amount|floatformat:2|intcomma}}</strong>
|
<strong class="pull-right">CHF {{generic_payment_details.amount|floatformat:2|intcomma}}</strong>
|
||||||
</p>
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% if generic_payment_details.description %}
|
{% if generic_payment_details.description %}
|
||||||
<p>
|
<p>
|
||||||
<span>{% trans "Description" %}: </span>
|
<span>{% trans "Description" %}: </span>
|
||||||
|
|
|
@ -414,8 +414,18 @@ class PaymentOrderView(FormView):
|
||||||
product = generic_payment_form.cleaned_data.get(
|
product = generic_payment_form.cleaned_data.get(
|
||||||
'product_name'
|
'product_name'
|
||||||
)
|
)
|
||||||
|
user_country_vat_rate = get_vat_rate_for_country(
|
||||||
|
address_form.cleaned_data["country"]
|
||||||
|
)
|
||||||
gp_details = {
|
gp_details = {
|
||||||
"product_name": product.product_name,
|
"product_name": product.product_name,
|
||||||
|
"vat_rate": user_country_vat_rate * 100,
|
||||||
|
"vat_amount": round(
|
||||||
|
float(product.product_price) *
|
||||||
|
user_country_vat_rate, 2),
|
||||||
|
"vat_country": address_form.cleaned_data["country"],
|
||||||
|
"amount_before_vat": round(
|
||||||
|
float(product.product_price), 2),
|
||||||
"amount": product.get_actual_price(
|
"amount": product.get_actual_price(
|
||||||
vat_rate=get_vat_rate_for_country(
|
vat_rate=get_vat_rate_for_country(
|
||||||
address_form.cleaned_data["country"])
|
address_form.cleaned_data["country"])
|
||||||
|
|
Loading…
Reference in a new issue