From cc22392ef716a587796a31b004f6405cce1fd1ce Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 29 Jun 2015 13:51:37 +0100 Subject: [PATCH] Added estimated VAT, as per issue #71 --- RIGS/rigboard.py | 2 ++ RIGS/templates/RIGS/item_table.html | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py index 050e0eda..269cbdb5 100644 --- a/RIGS/rigboard.py +++ b/RIGS/rigboard.py @@ -47,6 +47,8 @@ class EventCreate(generic.CreateView): def get_context_data(self, **kwargs): context = super(EventCreate, self).get_context_data(**kwargs) context['edit'] = True + context['new'] = True + context['currentVAT'] = models.VatRate.objects.current_rate() form = context['form'] if re.search('"-\d+"', form['items_json'].value()): diff --git a/RIGS/templates/RIGS/item_table.html b/RIGS/templates/RIGS/item_table.html index 199f92c3..cac7e0ba 100644 --- a/RIGS/templates/RIGS/item_table.html +++ b/RIGS/templates/RIGS/item_table.html @@ -29,8 +29,13 @@ £ {{object.sum_total|default:0|floatformat:2}} - VAT @ - {{object.vat_rate.as_percent|floatformat|default:"TBD"}}% + {% if new %} + VAT @ + {{currentVAT.as_percent|floatformat}}% (TBC) + {% else %} + VAT @ + {{object.vat_rate.as_percent|floatformat|default:"TBD"}}% + {% endif %} £ {{object.vat|default:0|floatformat:2}}