Introduce a setting to show net prices (#415)

* Introduce a setting to show net prices in the frontend

* Show net prices in the backend as well
This commit is contained in:
Raphael Michel
2017-02-22 16:59:54 +01:00
committed by GitHub
parent 08e7a29623
commit ed04f3124f
16 changed files with 206 additions and 43 deletions

View File

@@ -70,22 +70,35 @@
<input type="hidden" name="item_{{ line.item.id }}"
value="1" />
<input type="hidden" name="price_{{ line.item.id }}"
value="{{ line.price }}" />
value="{% if event.settings.display_net_prices %}{{ line.net_price }}{% else %}{{ line.price }}{% endif %}" />
{% endif %}
<button class="btn btn-mini btn-link"><i class="fa fa-plus"></i></button>
</form>
{% endif %}
</div>
<div class="singleprice price">
{{ event.currency }} {{ line.price|floatformat:2 }}
{% if event.settings.display_net_prices %}
{{ event.currency }} {{ line.net_price|floatformat:2 }}
{% else %}
{{ event.currency }} {{ line.price|floatformat:2 }}
{% endif %}
</div>
{% endif %}
<div class="totalprice price">
<strong>{{ event.currency }} {{ line.total|floatformat:2 }}</strong>
{% if line.tax_rate %}
<br /><small>{% blocktrans trimmed with rate=line.tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>
{% if event.settings.display_net_prices %}
<strong>{{ event.currency }} {{ line.net_total|floatformat:2 }}</strong>
{% if line.tax_rate %}
<br /><small>{% blocktrans trimmed with rate=line.tax_rate %}
<strong>plus</strong> {{ rate }}% taxes
{% endblocktrans %}</small>
{% endif %}
{% else %}
<strong>{{ event.currency }} {{ line.total|floatformat:2 }}</strong>
{% if line.tax_rate %}
<br /><small>{% blocktrans trimmed with rate=line.tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>
{% endif %}
{% endif %}
</div>
{% if download %}
@@ -102,23 +115,52 @@
</div>
{% endfor %}
{% if cart.payment_fee %}
{# TODO: Tax rate? #}
<div class="row cart-row">
<div class="col-md-4 col-xs-6">
<strong>{% trans "Payment method fee" %}</strong>
</div>
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
<strong>{{ event.currency }} {{ cart.payment_fee|floatformat:2 }}</strong>
{% if cart.payment_fee_tax_rate %}
<br/>
<small>{% blocktrans trimmed with rate=cart.payment_fee_tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>
{% if event.settings.display_net_prices %}
<strong>{{ event.currency }} {{ cart.payment_fee_net|floatformat:2 }}</strong>
{% if cart.payment_fee_tax_rate %}
<br/>
<small>{% blocktrans trimmed with rate=cart.payment_fee_tax_rate %}
<strong>plus</strong> {{ rate }}% taxes
{% endblocktrans %}</small>
{% endif %}
{% else %}
<strong>{{ event.currency }} {{ cart.payment_fee|floatformat:2 }}</strong>
{% if cart.payment_fee_tax_rate %}
<br/>
<small>{% blocktrans trimmed with rate=cart.payment_fee_tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>
{% endif %}
{% endif %}
</div>
<div class="clearfix"></div>
</div>
{% endif %}
{% if event.settings.display_net_prices %}
<div class="row cart-row total">
<div class="col-md-4 col-xs-6">
<strong>{% trans "Net total" %}</strong>
</div>
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
{{ event.currency }} {{ cart.net_total|floatformat:2 }}
</div>
<div class="clearfix"></div>
</div>
<div class="row cart-row">
<div class="col-md-4 col-xs-6">
<strong>{% trans "Taxes" %}</strong>
</div>
<div class="col-md-3 col-xs-6 col-md-offset-5 price">
{{ event.currency }} {{ cart.tax_total|floatformat:2 }}
</div>
<div class="clearfix"></div>
</div>
{% endif %}
<div class="row cart-row total">
<div class="col-md-4 col-xs-6">
<strong>{% trans "Total" %}</strong>

View File

@@ -136,14 +136,18 @@
<span class="input-group-addon">{{ event.currency }}</span>
<input type="number" class="form-control input-item-price"
placeholder="0"
min="{{ var.price|stringformat:"0.2f" }}"
min="{{ var.display_price|stringformat:"0.2f" }}"
name="price_{{ item.id }}_{{ var.id }}"
step="any" value="{{ var.price|stringformat:"0.2f" }}">
step="any" value="{{ var.display_price|stringformat:"0.2f" }}">
</div>
{% else %}
{{ event.currency }} {{ var.price|floatformat:2 }}
{{ event.currency }} {{ var.display_price|floatformat:2 }}
{% endif %}
{% if item.tax_rate %}
{% if item.tax_rate and event.settings.display_net_prices %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
<strong>plus</strong> {{ rate }}% taxes
{% endblocktrans %}</small>
{% elif item.tax_rate %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>
@@ -186,14 +190,18 @@
<div class="input-group input-group-price">
<span class="input-group-addon">{{ event.currency }}</span>
<input type="number" class="form-control input-item-price" placeholder="0"
min="{{ item.price|stringformat:"0.2f" }}"
min="{{ item.display_price|stringformat:"0.2f" }}"
name="price_{{ item.id }}"
step="any" value="{{ item.price|stringformat:"0.2f" }}">
step="any" value="{{ item.display_price|stringformat:"0.2f" }}">
</div>
{% else %}
{{ event.currency }} {{ item.price|floatformat:2 }}
{{ event.currency }} {{ item.display_price|floatformat:2 }}
{% endif %}
{% if item.tax_rate %}
{% if item.tax_rate and event.settings.display_net_prices %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
<strong>plus</strong> {{ rate }}% taxes
{% endblocktrans %}</small>
{% elif item.tax_rate %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>

View File

@@ -72,7 +72,11 @@
{% else %}
{{ event.currency }} {{ var.display_price|floatformat:2 }}
{% endif %}
{% if item.tax_rate %}
{% if item.tax_rate and event.settings.display_net_prices %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
<strong>plus</strong> {{ rate }}% taxes
{% endblocktrans %}</small>
{% elif item.tax_rate %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>
@@ -126,7 +130,11 @@
{% else %}
{{ event.currency }} {{ item.price|floatformat:2 }}
{% endif %}
{% if item.tax_rate %}
{% if item.tax_rate and event.settings.display_net_prices %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
<strong>plus</strong> {{ rate }}% taxes
{% endblocktrans %}</small>
{% elif item.tax_rate %}
<small>{% blocktrans trimmed with rate=item.tax_rate %}
incl. {{ rate }}% taxes
{% endblocktrans %}</small>