From 52f9246ffb3a392e56f53e1eb40aed3dbbce06a4 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Tue, 31 May 2016 07:42:01 +0200 Subject: [PATCH] invoice styling --- shop/management/commands/invoice-worker.py | 2 +- shop/models.py | 2 + shop/templates/invoice.html | 52 --------------- shop/templates/pdf/invoice.html | 74 ++++++++++++++++++++++ 4 files changed, 77 insertions(+), 53 deletions(-) delete mode 100644 shop/templates/invoice.html create mode 100644 shop/templates/pdf/invoice.html diff --git a/shop/management/commands/invoice-worker.py b/shop/management/commands/invoice-worker.py index cc33be91..784cd449 100644 --- a/shop/management/commands/invoice-worker.py +++ b/shop/management/commands/invoice-worker.py @@ -36,7 +36,7 @@ class Command(BaseCommand): try: pdffile = generate_pdf_letter( filename=invoice.filename, - template='invoice.html', + template='pdf/invoice.html', formatdict=formatdict, ) self.output('Generated pdf for invoice %s' % invoice) diff --git a/shop/models.py b/shop/models.py index 814d3f36..201b1eda 100644 --- a/shop/models.py +++ b/shop/models.py @@ -271,6 +271,8 @@ class Invoice(CreatedUpdatedModel): def filename(self): return 'bornhack_invoice_%s.pdf' % self.pk + def regretdate(self): + return inv.created+timedelta(days=14) class CoinifyAPIInvoice(CreatedUpdatedModel): invoicejson = JSONField() diff --git a/shop/templates/invoice.html b/shop/templates/invoice.html deleted file mode 100644 index 72836f1a..00000000 --- a/shop/templates/invoice.html +++ /dev/null @@ -1,52 +0,0 @@ -{% load shop_tags %} - - - - - - - - - - - - -
Order number: {{ invoice.order.pk }}
Invoice number: {{ invoice.pk }}
Date: {% now "j/n-Y" %}
- - - - - - -
- Name - - Quantity - - Price - - Total -{% for order_product in invoice.order.orderproductrelation_set.all %} -
- {{ order_product.product.name }} - - {{ order_product.quantity }} - - {{ order_product.product.price|currency }} - - {{ order_product.total|currency }} -{% endfor %} - -
- - Danish VAT (25%) - - {{ order.vat|currency }} - -
- - Total - - {{ order.total|currency }} - -
diff --git a/shop/templates/pdf/invoice.html b/shop/templates/pdf/invoice.html new file mode 100644 index 00000000..1bf0cb2b --- /dev/null +++ b/shop/templates/pdf/invoice.html @@ -0,0 +1,74 @@ +{% load shop_tags %} + + + + + + + + + + + + + +

BornHack IVS

 

Invoice {{ invoice.pk }}

  + Order number: {{ invoice.order.pk }}
+ Invoice number: {{ invoice.pk }}
+ Invoice date: {% now "b js, Y" %}
+
+
+
+
+

Products

+ + + + + +
+ Name + + Quantity + + Price + + Total +{% for order_product in invoice.order.orderproductrelation_set.all %} +
+ {{ order_product.product.name }} + + {{ order_product.quantity }} + + {{ order_product.product.price|currency }} + + {{ order_product.total|currency }} +{% endfor %} + +
+ + Danish VAT (25%) + + {{ order.vat|currency }} + +
+ + Total + + {{ order.total|currency }} + +
+ +

The order has been paid in full.

+

+