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. * 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): def generate_bill(modeladmin, request, queryset):
bill = queryset.get() bill = queryset.get()
bill.close() bill.close()
pdf = run('xvfb-run -a -s "-screen 0 640x4800x16" wkhtmltopdf - -', # return HttpResponse(bill.html)
stdin=bill.html.encode('utf-8'), display=False) 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') return HttpResponse(pdf, content_type='application/pdf')

View File

@ -231,6 +231,17 @@ a:hover {
/* FOOTER */ /* FOOTER */
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
#footer, .push {
height: 4em;
}
#footer .title { #footer .title {
color: {{ color }}; color: {{ color }};
font-weight: bold; font-weight: bold;
@ -242,7 +253,6 @@ a:hover {
font-size: small; font-size: small;
} }
#footer-column-1 { #footer-column-1 {
float: left; float: left;
width: 48%; width: 48%;

View File

@ -9,6 +9,7 @@
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<div class="wrapper">
{% block header %} {% block header %}
<div id="logo"> <div id="logo">
{% block logo %} {% block logo %}
@ -83,6 +84,7 @@
{% endfor %} {% endfor %}
</div> </div>
<div id="totals"> <div id="totals">
<br>&nbsp;<br>
<span class="subtotal column-title">subtotal</span> <span class="subtotal column-title">subtotal</span>
<span class="subtotal column-value">{{ bill.subtotal }} &{{ currency.lower }};</span> <span class="subtotal column-value">{{ bill.subtotal }} &{{ currency.lower }};</span>
<br> <br>
@ -96,6 +98,8 @@
{% endblock %} {% endblock %}
{% block footer %} {% block footer %}
<div class="push"></div>
</div>
<div id="footer"> <div id="footer">
<div id="footer-column-1"> <div id="footer-column-1">
<div id="comments"> <div id="comments">
@ -117,3 +121,6 @@
</div> </div>
{% endblock %} {% endblock %}
{% 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', p = subprocess.Popen(command, shell=True, executable='/bin/bash',
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
p.stdin.write(stdin)
p.stdin.close()
make_async(p.stdout) make_async(p.stdout)
make_async(p.stderr) make_async(p.stderr)
stdout = str() stdout = str()
stderr = str() stderr = str()
p.stdin.write(stdin)
p.stdin.close()
# Async reading of stdout and sterr # Async reading of stdout and sterr
while True: while True:
# Wait for data to become available # Wait for data to become available