Added invoice footer with pagination

This commit is contained in:
Marc 2014-08-29 16:13:34 +00:00
parent b4113ef770
commit 9a24ee5ae1
5 changed files with 29 additions and 5 deletions

View file

@ -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

View file

@ -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')

View file

@ -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%;

View file

@ -9,6 +9,7 @@
{% endblock %}
{% block body %}
<div class="wrapper">
{% block header %}
<div id="logo">
{% block logo %}
@ -83,6 +84,7 @@
{% endfor %}
</div>
<div id="totals">
<br>&nbsp;<br>
<span class="subtotal column-title">subtotal</span>
<span class="subtotal column-value">{{ bill.subtotal }} &{{ currency.lower }};</span>
<br>
@ -96,6 +98,8 @@
{% endblock %}
{% block footer %}
<div class="push"></div>
</div>
<div id="footer">
<div id="footer-column-1">
<div id="comments">
@ -117,3 +121,6 @@
</div>
{% endblock %}
{% endblock %}

View file

@ -53,13 +53,16 @@ def run(command, display=True, error_codes=[0], silent=True, stdin=''):
p = subprocess.Popen(command, shell=True, executable='/bin/bash',
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
p.stdin.write(stdin)
p.stdin.close()
make_async(p.stdout)
make_async(p.stderr)
stdout = str()
stderr = str()
p.stdin.write(stdin)
p.stdin.close()
# Async reading of stdout and sterr
while True:
# Wait for data to become available