From 9a24ee5ae1c3ffd35a25f8ca5977e33955ad2691 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 29 Aug 2014 16:13:34 +0000 Subject: [PATCH] Added invoice footer with pagination --- TODO.md | 2 ++ orchestra/apps/bills/actions.py | 6 ++++-- .../apps/bills/templates/bills/microspective.css | 12 +++++++++++- .../apps/bills/templates/bills/microspective.html | 7 +++++++ orchestra/utils/system.py | 7 +++++-- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 48c187f3..d2bc862b 100644 --- a/TODO.md +++ b/TODO.md @@ -76,3 +76,5 @@ at + clock time, midnight, noon- At 3:30 p.m., At 4:01, At noon * make account_link to autoreplace account on change view. + +* LAST version of this shit http://wkhtmltopdf.org/downloads.html diff --git a/orchestra/apps/bills/actions.py b/orchestra/apps/bills/actions.py index 1e61b863..414ba6c8 100644 --- a/orchestra/apps/bills/actions.py +++ b/orchestra/apps/bills/actions.py @@ -6,6 +6,8 @@ from orchestra.utils.system import run def generate_bill(modeladmin, request, queryset): bill = queryset.get() bill.close() - pdf = run('xvfb-run -a -s "-screen 0 640x4800x16" wkhtmltopdf - -', - stdin=bill.html.encode('utf-8'), display=False) +# return HttpResponse(bill.html) + pdf = run('xvfb-run -a -s "-screen 0 640x4800x16" ' + 'wkhtmltopdf --footer-center "Page [page] of [topage]" --footer-font-size 9 - -', + stdin=bill.html.encode('utf-8'), display=False) return HttpResponse(pdf, content_type='application/pdf') diff --git a/orchestra/apps/bills/templates/bills/microspective.css b/orchestra/apps/bills/templates/bills/microspective.css index 5fab4783..bfd5b68d 100644 --- a/orchestra/apps/bills/templates/bills/microspective.css +++ b/orchestra/apps/bills/templates/bills/microspective.css @@ -231,6 +231,17 @@ a:hover { /* FOOTER */ +.wrapper { + min-height: 100%; + height: auto !important; + height: 100%; + margin: 0 auto -4em; +} + +#footer, .push { + height: 4em; +} + #footer .title { color: {{ color }}; font-weight: bold; @@ -242,7 +253,6 @@ a:hover { font-size: small; } - #footer-column-1 { float: left; width: 48%; diff --git a/orchestra/apps/bills/templates/bills/microspective.html b/orchestra/apps/bills/templates/bills/microspective.html index 9b10535a..f851d8aa 100644 --- a/orchestra/apps/bills/templates/bills/microspective.html +++ b/orchestra/apps/bills/templates/bills/microspective.html @@ -9,6 +9,7 @@ {% endblock %} {% block body %} +
{% block header %}
+
 
subtotal {{ bill.subtotal }} &{{ currency.lower }};
@@ -96,6 +98,8 @@ {% endblock %} {% block footer %} +
+