Bernd Wurst commited on 2017-05-30 07:21:48
Zeige 2 geänderte Dateien mit 16 Einfügungen und 3 Löschungen.
| ... | ... |
@@ -11,7 +11,7 @@ from custom_elements import basicPage, firstPage, address_header |
| 11 | 11 |
# reportlab imports |
| 12 | 12 |
from reportlab.lib.units import cm |
| 13 | 13 |
from reportlab.pdfgen import canvas as Canvas |
| 14 |
- |
|
| 14 |
+from reportlab.lib.colors import Color |
|
| 15 | 15 |
|
| 16 | 16 |
num_pages = 1 |
| 17 | 17 |
|
| ... | ... |
@@ -119,7 +119,7 @@ def address(canvas, lines): |
| 119 | 119 |
|
| 120 | 120 |
|
| 121 | 121 |
|
| 122 |
-def InvoiceToPDF(iv): |
|
| 122 |
+def InvoiceToPDF(iv, bankdata=True): |
|
| 123 | 123 |
from StringIO import StringIO |
| 124 | 124 |
fd = StringIO() |
| 125 | 125 |
canvas = Canvas.Canvas(fd, pagesize=A4) |
| ... | ... |
@@ -207,6 +207,18 @@ def InvoiceToPDF(iv): |
| 207 | 207 |
|
| 208 | 208 |
font_size = default_font_size |
| 209 | 209 |
y = firstPage(canvas) |
| 210 |
+ if bankdata==False: |
|
| 211 |
+ # Bankdaten überschreiben wenn Lastschrift |
|
| 212 |
+ canvas.setFillColor( Color(255,255,255, alpha=0.8) ) |
|
| 213 |
+ canvas.rect(leftcontent+((rightcontent-leftcontent)/3)*2 - 2, bottomcontent - 2, (rightcontent-leftcontent)/3, -40, fill=True, stroke=False) |
|
| 214 |
+ canvas.setFillColor( Color(0,0,0, alpha=1) ) |
|
| 215 |
+ canvas.saveState() |
|
| 216 |
+ canvas.translate( leftcontent+((rightcontent-leftcontent)/3)*2 + 2, bottomcontent - 40 ) |
|
| 217 |
+ canvas.rotate( 15 ) |
|
| 218 |
+ canvas.drawString( 0, 0, "Bitte nicht überweisen" ) |
|
| 219 |
+ canvas.restoreState() |
|
| 220 |
+ #canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2 + 2, bottomcontent - 20, "Bitte nicht überweisen") |
|
| 221 |
+ |
|
| 210 | 222 |
|
| 211 | 223 |
canvas.setFont(font+'-Bold', font_size+3) |
| 212 | 224 |
min_y = y |
| ... | ... |
@@ -20,7 +20,7 @@ def _breakLine(text, width=72): |
| 20 | 20 |
return lines |
| 21 | 21 |
|
| 22 | 22 |
|
| 23 |
-def InvoiceToText(iv): |
|
| 23 |
+def InvoiceToText(iv, bankdata=True): |
|
| 24 | 24 |
ret = [] |
| 25 | 25 |
ret.append(u'Rechnungsempfänger:') |
| 26 | 26 |
for line in iv.addresslines: |
| ... | ... |
@@ -39,6 +39,7 @@ def InvoiceToText(iv): |
| 39 | 39 |
raise NotImplementedError("Cannot handle part of type %s" % type(part))
|
| 40 | 40 |
|
| 41 | 41 |
|
| 42 |
+ if bankdata: |
|
| 42 | 43 |
ret.append('-'*72)
|
| 43 | 44 |
ret.append('Unsere Bankverbindung:')
|
| 44 | 45 |
ret.append('Volksbank Backnang, BLZ 602 911 20, Konto-Nr. 41512 006')
|
| 45 | 46 |