Bernd Wurst commited on 2008-04-15 15:48:50
Zeige 3 geänderte Dateien mit 155 Einfügungen und 169 Löschungen.
... | ... |
@@ -0,0 +1,84 @@ |
1 |
+# -* coding: utf8 *- |
|
2 |
+from metrics import * |
|
3 |
+ |
|
4 |
+def FoldingMarkers(canvas): |
|
5 |
+ """Setzt Falzmarken""" |
|
6 |
+ from reportlab.lib.units import cm |
|
7 |
+ canvas.setStrokeColorRGB(0,0,0) |
|
8 |
+ canvas.setLineWidth(0.01*cm) |
|
9 |
+ canvas.lines( |
|
10 |
+ [(0.3*cm,page_height-10.5*cm,0.65*cm,page_height-10.5*cm), |
|
11 |
+ (0.3*cm,page_height-21.0*cm,0.65*cm,page_height-21.0*cm), |
|
12 |
+ (0.3*cm,page_height-14.85*cm,0.7*cm,page_height-14.85*cm)]); |
|
13 |
+ |
|
14 |
+ |
|
15 |
+def Footer(canvas): |
|
16 |
+ canvas.line(leftcontent, bottomcontent, rightcontent, bottomcontent) |
|
17 |
+ canvas.setFont(font, 7) |
|
18 |
+ canvas.drawString(leftcontent, bottomcontent-10, 'schokokeks.org GbR') |
|
19 |
+ canvas.drawString(leftcontent, bottomcontent-20, 'Bernd Wurst / Johannes Böck') |
|
20 |
+ canvas.drawString(leftcontent, bottomcontent-30, 'http://www.schokokeks.org') |
|
21 |
+ canvas.drawString(leftcontent, bottomcontent-40, 'root@schokokeks.org') |
|
22 |
+ |
|
23 |
+ canvas.drawString(leftcontent+((rightcontent-leftcontent)/3), bottomcontent-10, 'Steuernummer 51072/01109') |
|
24 |
+ canvas.drawString(leftcontent+((rightcontent-leftcontent)/3), bottomcontent-20, 'Finanzamt Backnang') |
|
25 |
+ canvas.drawString(leftcontent+((rightcontent-leftcontent)/3), bottomcontent-30, 'USt-ID: DE255720588') |
|
26 |
+ |
|
27 |
+ canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-10, 'Volksbank Backnang (BLZ: 602 911 20)') |
|
28 |
+ canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-20, 'Konto: 671279 017') |
|
29 |
+ canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-30, 'IBAN: DE78602911200671279017') |
|
30 |
+ canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-40, 'BIC: GENODES1VBK') |
|
31 |
+ |
|
32 |
+ |
|
33 |
+def address(canvas, lines): |
|
34 |
+ x = 2.0 * cm |
|
35 |
+ y = page_height - 4.5*cm |
|
36 |
+ canvas.setFont(font, 8) |
|
37 |
+ canvas.drawString(x+0.5*cm, y+0.1*cm, 'schokokeks.org · Köchersberg 25 · 71540 Murrhardt') |
|
38 |
+ canvas.line(x, y, x + address_width, y) |
|
39 |
+ y = y - 0.2*cm |
|
40 |
+ |
|
41 |
+ line_height = 11 + 0.1*cm |
|
42 |
+ y -= line_height |
|
43 |
+ canvas.setFont(font, 11) |
|
44 |
+ for line in lines: |
|
45 |
+ canvas.drawString(x+0.5*cm, y, line) |
|
46 |
+ y -= line_height |
|
47 |
+ |
|
48 |
+ |
|
49 |
+ |
|
50 |
+def basicPage(canvas): |
|
51 |
+ FoldingMarkers(canvas) |
|
52 |
+ Footer(canvas) |
|
53 |
+ return topcontent |
|
54 |
+ |
|
55 |
+ |
|
56 |
+def firstPage(canvas): |
|
57 |
+ basicPage(canvas) |
|
58 |
+ |
|
59 |
+ font_size = default_font_size |
|
60 |
+ y = topcontent |
|
61 |
+ canvas.drawInlineImage("logo.png", rightcolumn, topcontent-(3*cm), width=4.08*cm, height=3*cm) |
|
62 |
+ y -= (3.5*cm) |
|
63 |
+ canvas.setFont(font+"-Bold", font_size) |
|
64 |
+ #canvas.drawString(rightcolumn, y, "schokokeks.org Webhosting") |
|
65 |
+ #y -= (font_size + 5 + 0.2*cm) |
|
66 |
+ canvas.drawString(rightcolumn, y, "schokokeks.org GbR") |
|
67 |
+ y -= (font_size + 5) |
|
68 |
+ canvas.setFont(font, font_size) |
|
69 |
+ canvas.drawString(rightcolumn, y, "Bernd Wurst / Johannes Böck") |
|
70 |
+ y -= (font_size + 5) |
|
71 |
+ canvas.drawString(rightcolumn, y, "Köchersberg 25") |
|
72 |
+ y -= (font_size + 5) |
|
73 |
+ canvas.drawString(rightcolumn, y, "71540 Murrhardt") |
|
74 |
+ y -= (font_size + 10) |
|
75 |
+ canvas.drawString(rightcolumn, y, "Tel: 07192-936432") |
|
76 |
+ y -= (font_size + 5) |
|
77 |
+ canvas.drawString(rightcolumn, y, "Fax: 07192-936431") |
|
78 |
+ y -= (font_size + 5) |
|
79 |
+ canvas.drawString(rightcolumn, y, "E-Mail: root@schokokeks.org") |
|
80 |
+ y -= (font_size + 10) |
|
81 |
+ |
|
82 |
+ return topcontent - 7.5*cm |
|
83 |
+ |
|
84 |
+ |
... | ... |
@@ -0,0 +1,40 @@ |
1 |
+ |
|
2 |
+def setup(): |
|
3 |
+ from reportlab.lib.pagesizes import A4 |
|
4 |
+ from reportlab.lib.units import cm |
|
5 |
+ from reportlab.pdfbase.ttfonts import TTFont |
|
6 |
+ from reportlab.pdfbase import pdfmetrics |
|
7 |
+ |
|
8 |
+ if 'Vera' not in pdfmetrics._fonts.keys(): |
|
9 |
+ pdfmetrics.registerFont(TTFont("Vera", "Vera.ttf")) |
|
10 |
+ pdfmetrics.registerFont(TTFont("Vera-Bold", "VeraBd.ttf")) |
|
11 |
+ pdfmetrics.registerFont(TTFont("Vera-Oblique", "VeraIt.ttf")) |
|
12 |
+ pdfmetrics.registerFont(TTFont("Vera-BoldOblique", "VeraBI.ttf")) |
|
13 |
+ |
|
14 |
+ return (cm, A4) |
|
15 |
+ |
|
16 |
+ |
|
17 |
+(cm, A4) = setup() |
|
18 |
+ |
|
19 |
+(page_width, page_height) = A4 |
|
20 |
+font = 'Vera' |
|
21 |
+# Set default font size |
|
22 |
+default_font_size = 9 |
|
23 |
+ |
|
24 |
+ |
|
25 |
+# set margins |
|
26 |
+topmargin = 2*cm |
|
27 |
+bottommargin = 2.5*cm |
|
28 |
+leftmargin = 2*cm |
|
29 |
+rightmargin = 2*cm |
|
30 |
+ |
|
31 |
+topcontent = page_height-topmargin |
|
32 |
+leftcontent = leftmargin |
|
33 |
+rightcontent = page_width - rightmargin |
|
34 |
+bottomcontent = bottommargin |
|
35 |
+ |
|
36 |
+rightcolumn = 13*cm |
|
37 |
+ |
|
38 |
+address_width = 8.5*cm |
|
39 |
+address_height = 5.0*cm |
|
40 |
+ |
... | ... |
@@ -3,15 +3,13 @@ |
3 | 3 |
import Invoice |
4 | 4 |
import re |
5 | 5 |
|
6 |
+# our page size and margins |
|
7 |
+from metrics import * |
|
8 |
+# our custom page style |
|
9 |
+from custom_elements import basicPage, firstPage, address |
|
10 |
+ |
|
6 | 11 |
# reportlab imports |
7 | 12 |
from reportlab.lib.units import cm |
8 |
-from reportlab.lib.pagesizes import A4 |
|
9 |
-from reportlab.pdfbase.ttfonts import TTFont, TTFontFace, TTFontFile, TTFOpenFile, \ |
|
10 |
- TTFontParser, TTFontMaker, TTFError, \ |
|
11 |
- parse_utf8, makeToUnicodeCMap, \ |
|
12 |
- FF_SYMBOLIC, FF_NONSYMBOLIC, \ |
|
13 |
- calcChecksum |
|
14 |
-from reportlab.pdfbase import pdfmetrics |
|
15 | 13 |
from reportlab.pdfgen import canvas as Canvas |
16 | 14 |
|
17 | 15 |
|
... | ... |
@@ -38,14 +36,6 @@ def _niceCount(value): |
38 | 36 |
return (integer, decimals) |
39 | 37 |
|
40 | 38 |
|
41 |
-def _registerFonts(): |
|
42 |
- pdfmetrics.registerFont(TTFont("Vera", "Vera.ttf")) |
|
43 |
- pdfmetrics.registerFont(TTFont("Vera-Bold", "VeraBd.ttf")) |
|
44 |
- pdfmetrics.registerFont(TTFont("Vera-Oblique", "VeraIt.ttf")) |
|
45 |
- pdfmetrics.registerFont(TTFont("Vera-BoldOblique", "VeraBI.ttf")) |
|
46 |
- |
|
47 |
- |
|
48 |
- |
|
49 | 39 |
def _splitToWidth(canvas, text, width, font, size): |
50 | 40 |
'''_splitToWidth(canvas, text, width, font, size) |
51 | 41 |
Split a string to several lines of a given width.''' |
... | ... |
@@ -63,52 +53,23 @@ def _splitToWidth(canvas, text, width, font, size): |
63 | 53 |
return lines |
64 | 54 |
|
65 | 55 |
|
66 |
-def _PageMarkers(canvas): |
|
67 |
- """Setzt Falzmarken""" |
|
68 |
- from reportlab.lib.units import cm |
|
69 |
- canvas.setStrokeColorRGB(0,0,0) |
|
70 |
- canvas.setLineWidth(0.01*cm) |
|
71 |
- canvas.lines( |
|
72 |
- [(0.3*cm,-10.5*cm,0.65*cm,-10.5*cm), |
|
73 |
- (0.3*cm,-21.0*cm,0.65*cm,-21.0*cm), |
|
74 |
- (0.3*cm,-14.85*cm,0.7*cm,-14.85*cm)]); |
|
75 |
- |
|
76 |
- |
|
77 | 56 |
|
78 | 57 |
def _PageWrap(canvas): |
79 | 58 |
'''Seitenumbruch''' |
80 | 59 |
canvas.showPage() |
81 |
- canvas.translate(0, A4[1]) |
|
82 |
- _PageMarkers(canvas) |
|
60 |
+ basicPage(canvas) |
|
83 | 61 |
|
84 | 62 |
|
85 | 63 |
|
86 | 64 |
def InvoiceToPDF(iv): |
87 |
- _registerFonts() |
|
88 | 65 |
from StringIO import StringIO |
89 | 66 |
fd = StringIO() |
90 | 67 |
canvas = Canvas.Canvas(fd, pagesize=A4) |
91 |
- (width, height) = A4 |
|
92 |
- font = 'Vera' |
|
93 |
- canvas.setFont(font, 12) |
|
94 |
- # Set marker to top. |
|
95 |
- canvas.translate(0, A4[1]) |
|
96 |
- # Set default font size |
|
97 |
- default_font_size = 9 |
|
98 |
- # set margins |
|
99 |
- topmargin = 2*cm |
|
100 |
- bottommargin = 2.5*cm |
|
101 |
- leftmargin = 2*cm |
|
102 |
- rightmargin = 2*cm |
|
103 | 68 |
|
104 |
- num_pages = 1 |
|
105 | 69 |
|
106 |
- topcontent = -topmargin |
|
107 |
- leftcontent = leftmargin |
|
108 |
- rightcontent = A4[0] - rightmargin |
|
109 |
- bottomcontent = -(A4[1] - bottommargin) |
|
70 |
+ canvas.setFont(font, 12) |
|
110 | 71 |
|
111 |
- rightcolumn = 13*cm |
|
72 |
+ num_pages = 1 |
|
112 | 73 |
|
113 | 74 |
# Waehrungssysmbol |
114 | 75 |
symbol = '€' |
... | ... |
@@ -117,7 +78,6 @@ def InvoiceToPDF(iv): |
117 | 78 |
font_height = 0.35*cm |
118 | 79 |
line_padding = 0.1*cm |
119 | 80 |
line_height = font_height+0.1*cm |
120 |
- _PageMarkers(canvas) |
|
121 | 81 |
|
122 | 82 |
def _partHeight(part): |
123 | 83 |
height = 0 |
... | ... |
@@ -137,71 +97,13 @@ def InvoiceToPDF(iv): |
137 | 97 |
height += 3*cm |
138 | 98 |
return height |
139 | 99 |
|
140 |
- def _Footer(canvas): |
|
141 |
- canvas.line(leftcontent, bottomcontent, rightcontent, bottomcontent) |
|
142 |
- canvas.setFont(font, 7) |
|
143 |
- canvas.drawString(leftcontent, bottomcontent-10, 'schokokeks.org GbR') |
|
144 |
- canvas.drawString(leftcontent, bottomcontent-20, 'Bernd Wurst / Johannes Böck') |
|
145 |
- canvas.drawString(leftcontent, bottomcontent-30, 'http://www.schokokeks.org') |
|
146 |
- canvas.drawString(leftcontent, bottomcontent-40, 'root@schokokeks.org') |
|
147 | 100 |
|
148 |
- canvas.drawString(leftcontent+((rightcontent-leftcontent)/3), bottomcontent-10, 'Steuernummer 51072/01109') |
|
149 |
- canvas.drawString(leftcontent+((rightcontent-leftcontent)/3), bottomcontent-20, 'Finanzamt Backnang') |
|
150 |
- canvas.drawString(leftcontent+((rightcontent-leftcontent)/3), bottomcontent-30, 'USt-ID: DE255720588') |
|
151 |
- |
|
152 |
- canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-10, 'Volksbank Backnang (BLZ: 602 911 20)') |
|
153 |
- canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-20, 'Konto: 671279 017') |
|
154 |
- canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-30, 'IBAN: DE78602911200671279017') |
|
155 |
- canvas.drawString(leftcontent+((rightcontent-leftcontent)/3)*2, bottomcontent-40, 'BIC: GENODES1VBK') |
|
156 |
- |
|
157 |
- |
|
158 |
- addy_width = 8.5*cm |
|
159 |
- addy_height = 5.0*cm |
|
160 |
- |
|
161 |
- font_size = 8 |
|
162 |
- x = 2.0 * cm |
|
163 |
- y = -4.8 * cm - font_size - 1 |
|
164 |
- |
|
165 |
- canvas.setFont(font, font_size) |
|
166 |
- |
|
167 |
- |
|
168 |
- canvas.drawString(x, y+0.1*cm, ' schokokeks.org · Köchersberg 25 · 71540 Murrhardt') |
|
169 |
- canvas.line(x, y, x + (8.5 * cm), y) |
|
170 |
- y = y - font_size - 3 |
|
171 |
- |
|
172 |
- font_size = 11 |
|
173 |
- x += 0.5*cm |
|
174 |
- y -= 0.5*cm |
|
175 |
- canvas.setFont(font, font_size) |
|
176 |
- for line in iv.addresslines: |
|
177 |
- canvas.drawString(x, y, line) |
|
178 |
- y -= line_height |
|
179 | 101 |
|
102 |
+ address(canvas, iv.addresslines) |
|
180 | 103 |
|
181 | 104 |
font_size = default_font_size |
105 |
+ y = firstPage(canvas) |
|
182 | 106 |
|
183 |
- y = topcontent |
|
184 |
- canvas.drawInlineImage("logo.png", rightcolumn, topcontent-(3*cm), width=4.08*cm, height=3*cm) |
|
185 |
- y -= (3.5*cm) |
|
186 |
- canvas.setFont(font+"-Bold", font_size) |
|
187 |
- #canvas.drawString(rightcolumn, y, "schokokeks.org Webhosting") |
|
188 |
- #y -= (font_size + 5 + 0.2*cm) |
|
189 |
- canvas.drawString(rightcolumn, y, "schokokeks.org GbR") |
|
190 |
- y -= (font_size + 5) |
|
191 |
- canvas.setFont(font, font_size) |
|
192 |
- canvas.drawString(rightcolumn, y, "Bernd Wurst / Johannes Böck") |
|
193 |
- y -= (font_size + 5) |
|
194 |
- canvas.drawString(rightcolumn, y, "Köchersberg 25") |
|
195 |
- y -= (font_size + 5) |
|
196 |
- canvas.drawString(rightcolumn, y, "71540 Murrhardt") |
|
197 |
- y -= (font_size + 10) |
|
198 |
- canvas.drawString(rightcolumn, y, "Tel: 07192-936432") |
|
199 |
- y -= (font_size + 5) |
|
200 |
- canvas.drawString(rightcolumn, y, "Fax: 07192-936431") |
|
201 |
- y -= (font_size + 5) |
|
202 |
- canvas.drawString(rightcolumn, y, "E-Mail: root@schokokeks.org") |
|
203 |
- y -= (font_size + 10) |
|
204 |
- y = -9.5*cm |
|
205 | 107 |
canvas.setFont(font+'-Bold', font_size+3) |
206 | 108 |
min_y = y |
207 | 109 |
if iv.caption: |
... | ... |
@@ -257,7 +159,6 @@ def InvoiceToPDF(iv): |
257 | 159 |
y = bottomcontent + (0.5*cm) |
258 | 160 |
canvas.setFont(font, default_font_size-2) |
259 | 161 |
canvas.drawRightString(rightcontent, bottomcontent + line_padding, 'Fortsetzung auf Seite %i' % num_pages) |
260 |
- _Footer(canvas) |
|
261 | 162 |
_PageWrap(canvas) |
262 | 163 |
y = topcontent - font_size |
263 | 164 |
canvas.setFillColor((0,0,0)) |
... | ... |
@@ -352,13 +253,21 @@ def InvoiceToPDF(iv): |
352 | 253 |
summaries = [] |
353 | 254 |
if len(part.vat) == 1: |
354 | 255 |
vat = part.vat.keys()[0] |
256 |
+ (integer, decimals) = _niceCount( (vat * 100) ) |
|
257 |
+ vatstr = '%s' % integer |
|
258 |
+ if decimals: |
|
259 |
+ vatstr += ',%s' % decimals |
|
355 | 260 |
if iv.tender: |
356 |
- summaries.append(('Im Gesamtbetrag sind %.1f%% MwSt enthalten:' % (vat*100), _formatPrice((part.sum/(vat+1))*vat))) |
|
261 |
+ summaries.append(('Im Gesamtbetrag sind %s%% MwSt enthalten:' % vatstr, _formatPrice((part.sum/(vat+1))*vat))) |
|
357 | 262 |
else: |
358 |
- summaries.append(('Im Rechnungsbetrag sind %.1f%% MwSt enthalten:' % (vat*100), _formatPrice((part.sum/(vat+1))*vat))) |
|
263 |
+ summaries.append(('Im Rechnungsbetrag sind %s%% MwSt enthalten:' % vatstr, _formatPrice((part.sum/(vat+1))*vat))) |
|
359 | 264 |
else: |
360 | 265 |
for vat, vatdata in part.vat.iteritems(): |
361 |
- summaries.append('%s: Im Teilbetrag von %s sind %.1f%% MwSt enthalten:' % (vatdata[1], _formatPrice(vatdata[0]), vat*100), _formatPrice((vatdata[0]/(vat+1))*vat)) |
|
266 |
+ (integer, decimals) = _niceCount( (vat * 100) ) |
|
267 |
+ vatstr = '%s' % integer |
|
268 |
+ if decimals: |
|
269 |
+ vatstr += ',%s' % decimals |
|
270 |
+ summaries.append(('%s: Im Teilbetrag von %s sind %s%% MwSt enthalten:' % (vatdata[1], _formatPrice(vatdata[0]), vatstr), _formatPrice((vatdata[0]/(vat+1))*vat))) |
|
362 | 271 |
summaries.sort() |
363 | 272 |
for line in summaries: |
364 | 273 |
canvas.drawRightString(left + 14.5*cm, y-font_height, line[0]) |
... | ... |
@@ -371,10 +280,18 @@ def InvoiceToPDF(iv): |
371 | 280 |
summaries = [] |
372 | 281 |
if len(part.vat) == 1: |
373 | 282 |
vat = part.vat.keys()[0] |
374 |
- summaries.append(('zzgl. %.1f%% MwSt:' % (vat*100), _formatPrice(vat*part.sum))) |
|
283 |
+ (integer, decimals) = _niceCount( (vat * 100) ) |
|
284 |
+ vatstr = '%s' % integer |
|
285 |
+ if decimals: |
|
286 |
+ vatstr += ',%s' % decimals |
|
287 |
+ summaries.append(('zzgl. %s%% MwSt:' % vatstr, _formatPrice(vat*part.sum))) |
|
375 | 288 |
else: |
376 | 289 |
for vat, vatdata in part.vat.iteritems(): |
377 |
- summaries.append(('zzgl. %.1f%% MwSt (%s):' % (vat*100, vatdata[1]), _formatPrice(vat*vatdata[0]))) |
|
290 |
+ (integer, decimals) = _niceCount( (vat * 100) ) |
|
291 |
+ vatstr = '%s' % integer |
|
292 |
+ if decimals: |
|
293 |
+ vatstr += ',%s' % decimals |
|
294 |
+ summaries.append(('zzgl. %s%% MwSt (%s):' % (vatstr, vatdata[1]), _formatPrice(vat*vatdata[0]))) |
|
378 | 295 |
summaries.sort() |
379 | 296 |
for line in summaries: |
380 | 297 |
canvas.drawRightString(left + 14.5*cm, y-font_height, line[0]) |
... | ... |
@@ -429,7 +346,6 @@ def InvoiceToPDF(iv): |
429 | 346 |
raise NotImplementedError("Cannot handle part of type %s" % type(part)) |
430 | 347 |
y -= (0.5*cm) |
431 | 348 |
|
432 |
- _Footer(canvas) |
|
433 | 349 |
|
434 | 350 |
canvas.showPage() |
435 | 351 |
canvas.save() |
... | ... |
@@ -438,57 +354,3 @@ def InvoiceToPDF(iv): |
438 | 354 |
|
439 | 355 |
|
440 | 356 |
|
441 |
- |
|
442 |
- |
|
443 |
- |
|
444 |
- |
|
445 |
-####################################### |
|
446 |
-''' |
|
447 |
- for el in invoiceTable.entries: |
|
448 |
- if len(invoiceTable.vat) == 1: |
|
449 |
- subject = _breakLine(el['subject'], width=43) |
|
450 |
- ret.append(u'%5.2f %-43s %10s %10s' % (el['count'], subject[0], format_price(el['price']), format_price(el['total']))) |
|
451 |
- for i in range(1,len(subject)): |
|
452 |
- ret.append(u' %s' % subject[i]) |
|
453 |
- else: |
|
454 |
- subject = _breakLine(el['subject'], width=41) |
|
455 |
- ret.append(u'%5.2f %-41s %10s %s %10s' % (el['count'], subject[0], format_price(el['price']), invoiceTable.vat[el['vat']][1], format_price(el['total']))) |
|
456 |
- for i in range(1,len(subject)): |
|
457 |
- ret.append(u' %s' % subject[i]) |
|
458 |
- if 'desc' in el and el['desc']: |
|
459 |
- desc = _breakLine(el['desc'], 43) |
|
460 |
- for line in desc: |
|
461 |
- ret.append(u' %s' % line) |
|
462 |
- ret.append('-'*72) |
|
463 |
- if invoiceTable.vatType == 'gross': |
|
464 |
- ret.append((u'Rechnungsbetrag: %11s' % format_price(invoiceTable.sum)).rjust(72)) |
|
465 |
- ret.append('') |
|
466 |
- summaries = [] |
|
467 |
- if len(invoiceTable.vat) == 1: |
|
468 |
- vat = invoiceTable.vat.keys()[0] |
|
469 |
- summaries.append(u' Im Rechnungsbetrag sind %.1f%% MwSt enthalten (%s)' % (vat*100, format_price((invoiceTable.sum/(vat+1))*vat))) |
|
470 |
- else: |
|
471 |
- for vat, vatdata in invoiceTable.vat.iteritems(): |
|
472 |
- summaries.append(u' %s: Im Teilbetrag von %s sind %.1f%% MwSt enthalten (%s)' % (vatdata[1], format_price(vatdata[0]), vat*100, format_price((vatdata[0]/(vat+1))*vat))) |
|
473 |
- summaries.sort() |
|
474 |
- for line in summaries: |
|
475 |
- ret.append(line) |
|
476 |
- else: |
|
477 |
- ret.append((u'Nettobetrag: %11s' % format_price(invoiceTable.sum)).rjust(72)) |
|
478 |
- summaries = [] |
|
479 |
- if len(invoiceTable.vat) == 1: |
|
480 |
- vat = invoiceTable.vat.keys()[0] |
|
481 |
- summaries.append((u'zzgl. %.1f%% MwSt: %11s' % (vat*100, format_price(vat*invoiceTable.sum))).rjust(72)) |
|
482 |
- else: |
|
483 |
- for vat, vatdata in invoiceTable.vat.iteritems(): |
|
484 |
- summaries.append((u'zzgl. %4.1f%% MwSt (%s): %11s' % (vat*100, vatdata[1], format_price(vat*vatdata[0]))).rjust(72)) |
|
485 |
- summaries.sort() |
|
486 |
- for line in summaries: |
|
487 |
- ret.append(line) |
|
488 |
- sum = 0 |
|
489 |
- for vat, vatdata in invoiceTable.vat.iteritems(): |
|
490 |
- sum += (vat+1)*vatdata[0] |
|
491 |
- ret.append((u'Rechnungsbetrag: %11s' % format_price(sum)).rjust(72)) |
|
492 |
- return ('\n'.join(ret)).encode('utf-8') |
|
493 |
- |
|
494 |
-''' |
|
495 | 357 |