bygdis.fi

git clone https://git.tarina.org/bygdis.fi
Log | Files | Refs | README

commit 2765dcfc4bed43160b894513c53fc1f452f11126
parent 95dddb0555860da693f11a08992bf10ddf753102
Author: rob <rob@tarina.org>
Date:   Thu,  9 Mar 2023 23:46:39 +0200

mlinvoice fungerar

Diffstat:
Mpublic_html/html/fakturor.html | 27+++++++++++++++------------
Mserver.py | 9++++++++-
2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/public_html/html/fakturor.html b/public_html/html/fakturor.html @@ -1,4 +1,4 @@ -$def with (alla_fakturor,getkund,getmaksuja,round) +$def with (alla_fakturor,getkund,getmaksuja,round,getprodukt) <br> <h1>Bygdis.fi</h1> @@ -12,17 +12,20 @@ $for i in alla_fakturor: $if i.deleted == 0: <br> $if i.company_id: - $getkund(i.company_id) - <br> - $i.invoice_date - <br> - nummer: $i.invoice_no - <br> - sista betalningsdag: $i.due_date - <br> + $getkund(i.company_id)<br> + nummer: $i.invoice_no<br> + datum: $i.invoice_date<br> + sista betalningsdag: $i.due_date<br> + $ tot = 0 $for p in getmaksuja(i.id): $if p.deleted != 1: - $p.description $round(p.price,2) - <a href='/fakturor?faktura=$i.id'>öppna pdf</a> - <br> + $ tot = tot + p.price + $if p.product_id: + $getprodukt(p.product_id).product_name + $else: + $p.description + $round(p.price,2) € <br> + totalt: $tot<br> + <a href='/fakturor?faktura=$i.id'>öppna som pdf</a> + <hr> diff --git a/server.py b/server.py @@ -225,6 +225,13 @@ def getmaksuja(id): maksut = '' return maksut +def getprodukt(id): + try: + produkt = db2.query("SELECT * FROM mlinvoice_product WHERE id='"+str(id)+"';")[0] + except: + produkt = '' + return produkt + def getbilder(): bilder = db.query("SELECT * FROM bilder ORDER BY uploaddate DESC") return bilder @@ -490,7 +497,7 @@ class fakturor(): binary_file.write(pdf_file) raise web.seeother('/static/pdf/'+pdfhash+'.pdf') alla_fakturor = db2.query("SELECT * FROM mlinvoice_invoice ORDER BY id DESC;") - return render.fakturor(alla_fakturor,getkund,getmaksuja,round) + return render.fakturor(alla_fakturor,getkund,getmaksuja,round,getprodukt) else: web.seeother('/')