7d420e1c6392016e5d7379ae47a72c10f0f1f405
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py   1) # -*- coding: utf-8 -*-
src/rechnung/Invoice/InvoiceToPDF.py   2) # (C) 2011 by Bernd Wurst <bernd@schokokeks.org>
src/rechnung/Invoice/InvoiceToPDF.py   3) 
src/rechnung/Invoice/InvoiceToPDF.py   4) # This file is part of Bib2011.
src/rechnung/Invoice/InvoiceToPDF.py   5) #
src/rechnung/Invoice/InvoiceToPDF.py   6) # Bib2011 is free software: you can redistribute it and/or modify
src/rechnung/Invoice/InvoiceToPDF.py   7) # it under the terms of the GNU General Public License as published by
src/rechnung/Invoice/InvoiceToPDF.py   8) # the Free Software Foundation, either version 3 of the License, or
src/rechnung/Invoice/InvoiceToPDF.py   9) # (at your option) any later version.
src/rechnung/Invoice/InvoiceToPDF.py  10) #
src/rechnung/Invoice/InvoiceToPDF.py  11) # Bib2011 is distributed in the hope that it will be useful,
src/rechnung/Invoice/InvoiceToPDF.py  12) # but WITHOUT ANY WARRANTY; without even the implied warranty of
src/rechnung/Invoice/InvoiceToPDF.py  13) # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
src/rechnung/Invoice/InvoiceToPDF.py  14) # GNU General Public License for more details.
src/rechnung/Invoice/InvoiceToPDF.py  15) #
src/rechnung/Invoice/InvoiceToPDF.py  16) # You should have received a copy of the GNU General Public License
src/rechnung/Invoice/InvoiceToPDF.py  17) # along with Bib2011.  If not, see <http://www.gnu.org/licenses/>.
src/rechnung/Invoice/InvoiceToPDF.py  18) 
src/rechnung/Invoice/InvoiceToPDF.py  19) import os.path
src/rechnung/Invoice/InvoiceToPDF.py  20) import re
src/rechnung/Invoice/InvoiceToPDF.py  21) 
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  22) from reportlab.lib.pagesizes import A4
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  23) # reportlab imports
src/rechnung/Invoice/InvoiceToPDF.py  24) from reportlab.lib.units import cm, inch
src/rechnung/Invoice/InvoiceToPDF.py  25) from reportlab.pdfbase import pdfmetrics
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  26) from reportlab.pdfbase.ttfonts import TTFont, TTFError
src/rechnung/Invoice/InvoiceToPDF.py  27) from reportlab.pdfgen import canvas
src/rechnung/Invoice/InvoiceToPDF.py  28) 
src/rechnung/Invoice/InvoiceToPDF.py  29) from .InvoiceObjects import InvoiceTable, InvoiceText, InvoiceImage, GUTSCHRIFT
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  30) 
src/rechnung/Invoice/InvoiceToPDF.py  31) 
src/rechnung/Invoice/InvoiceToPDF.py  32) def _formatPrice(price, symbol='€'):
src/rechnung/Invoice/InvoiceToPDF.py  33)     '''_formatPrice(price, symbol='€'):
src/rechnung/Invoice/InvoiceToPDF.py  34)     Gets a floating point value and returns a formatted price, suffixed by 'symbol'. '''
src/rechnung/Invoice/InvoiceToPDF.py  35)     s = ("%.2f" % price).replace('.', ',')
src/rechnung/Invoice/InvoiceToPDF.py  36)     pat = re.compile(r'([0-9])([0-9]{3}[.,])')
src/rechnung/Invoice/InvoiceToPDF.py  37)     while pat.search(s):
src/rechnung/Invoice/InvoiceToPDF.py  38)         s = pat.sub(r'\1.\2', s)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  39)     return s + ' ' + symbol
src/rechnung/Invoice/InvoiceToPDF.py  40) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  41) 
src/rechnung/Invoice/InvoiceToPDF.py  42) def find_font_file(filename):
src/rechnung/Invoice/InvoiceToPDF.py  43)     for n in range(4):
src/rechnung/Invoice/InvoiceToPDF.py  44)         candidate = os.path.abspath(os.path.join(os.path.dirname(__file__), '../' * n, 'ressource/fonts', filename))
src/rechnung/Invoice/InvoiceToPDF.py  45)         if os.path.exists(candidate):
src/rechnung/Invoice/InvoiceToPDF.py  46)             return candidate
src/rechnung/Invoice/InvoiceToPDF.py  47) 
src/rechnung/Invoice/InvoiceToPDF.py  48) 
src/rechnung/Invoice/InvoiceToPDF.py  49) def _registerFonts():
src/rechnung/Invoice/InvoiceToPDF.py  50)     fonts = [
src/rechnung/Invoice/InvoiceToPDF.py  51)         ("DejaVu", "DejaVuSans.ttf"),
src/rechnung/Invoice/InvoiceToPDF.py  52)         ("DejaVu-Bold", "DejaVuSans-Bold.ttf"),
src/rechnung/Invoice/InvoiceToPDF.py  53)         ("DejaVu-Italic", "DejaVuSans-Oblique.ttf"),
src/rechnung/Invoice/InvoiceToPDF.py  54)         ("DejaVu-BoldItalic", "DejaVuSans-BoldOblique.ttf")
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  55)     ]
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  56)     for fontname, fontfile in fonts:
src/rechnung/Invoice/InvoiceToPDF.py  57)         found = False
src/rechnung/Invoice/InvoiceToPDF.py  58)         try:
src/rechnung/Invoice/InvoiceToPDF.py  59)             pdfmetrics.registerFont(TTFont(fontname, fontfile))
src/rechnung/Invoice/InvoiceToPDF.py  60)             found = True
src/rechnung/Invoice/InvoiceToPDF.py  61)         except TTFError:
src/rechnung/Invoice/InvoiceToPDF.py  62)             pass
src/rechnung/Invoice/InvoiceToPDF.py  63)         if not found:
src/rechnung/Invoice/InvoiceToPDF.py  64)             f = find_font_file(fontfile)
src/rechnung/Invoice/InvoiceToPDF.py  65)             if f:
src/rechnung/Invoice/InvoiceToPDF.py  66)                 pdfmetrics.registerFont(TTFont(fontname, f))
src/rechnung/Invoice/InvoiceToPDF.py  67) 
src/rechnung/Invoice/InvoiceToPDF.py  68) 
src/rechnung/Invoice/InvoiceToPDF.py  69) class PDF(object):
src/rechnung/Invoice/InvoiceToPDF.py  70)     # Set default font size
src/rechnung/Invoice/InvoiceToPDF.py  71)     default_font_size = 8
src/rechnung/Invoice/InvoiceToPDF.py  72)     font = 'DejaVu'
src/rechnung/Invoice/InvoiceToPDF.py  73)     # set margins
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  74)     topmargin = 2 * cm
src/rechnung/Invoice/InvoiceToPDF.py  75)     bottommargin = 2.2 * cm
src/rechnung/Invoice/InvoiceToPDF.py  76)     leftmargin = 2 * cm
src/rechnung/Invoice/InvoiceToPDF.py  77)     rightmargin = 2 * cm
src/rechnung/Invoice/InvoiceToPDF.py  78)     rightcolumn = 13 * cm
src/rechnung/Invoice/InvoiceToPDF.py  79) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  80)     canvas = None
src/rechnung/Invoice/InvoiceToPDF.py  81)     num_pages = 1
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  82)     font_height = 0.3 * cm
src/rechnung/Invoice/InvoiceToPDF.py  83)     line_padding = 0.1 * cm
src/rechnung/Invoice/InvoiceToPDF.py  84)     line_height = font_height + 0.1 * cm
src/rechnung/Invoice/InvoiceToPDF.py  85) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  86)     invoice = None
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  87) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  88)     def __init__(self, invoice):
src/rechnung/Invoice/InvoiceToPDF.py  89)         _registerFonts()
src/rechnung/Invoice/InvoiceToPDF.py  90)         from io import BytesIO
src/rechnung/Invoice/InvoiceToPDF.py  91)         self.fd = BytesIO()
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  92)         self.canvas = canvas.Canvas(self.fd, pagesize=A4)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  93) 
src/rechnung/Invoice/InvoiceToPDF.py  94)         self.invoice = invoice
src/rechnung/Invoice/InvoiceToPDF.py  95) 
src/rechnung/Invoice/InvoiceToPDF.py  96)         self.topcontent = -self.topmargin
src/rechnung/Invoice/InvoiceToPDF.py  97)         self.leftcontent = self.leftmargin
src/rechnung/Invoice/InvoiceToPDF.py  98)         self.rightcontent = A4[0] - self.rightmargin
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py  99)         self.bottomcontent = -(A4[1] - self.bottommargin)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 100) 
src/rechnung/Invoice/InvoiceToPDF.py 101)         self.font_size = 8
src/rechnung/Invoice/InvoiceToPDF.py 102)         self.x = 2.0 * cm
src/rechnung/Invoice/InvoiceToPDF.py 103)         self.y = -4.8 * cm - self.font_size - 1
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 104) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 105)         self.canvas.setFont(self.font, self.font_size)
src/rechnung/Invoice/InvoiceToPDF.py 106) 
src/rechnung/Invoice/InvoiceToPDF.py 107)     def _splitToWidth(self, text, width, font, size):
src/rechnung/Invoice/InvoiceToPDF.py 108)         '''_splitToWidth(canvas, text, width, font, size)
src/rechnung/Invoice/InvoiceToPDF.py 109)         Split a string to several lines of a given width.'''
src/rechnung/Invoice/InvoiceToPDF.py 110)         lines = []
src/rechnung/Invoice/InvoiceToPDF.py 111)         paras = text.split('\n')
src/rechnung/Invoice/InvoiceToPDF.py 112)         for para in paras:
src/rechnung/Invoice/InvoiceToPDF.py 113)             words = para.split(' ')
src/rechnung/Invoice/InvoiceToPDF.py 114)             while len(words) > 0:
src/rechnung/Invoice/InvoiceToPDF.py 115)                 mywords = [words[0], ]
src/rechnung/Invoice/InvoiceToPDF.py 116)                 del words[0]
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 117)                 while len(words) > 0 and self.canvas.stringWidth(' '.join(mywords) + ' ' + words[0], font,
src/rechnung/Invoice/InvoiceToPDF.py 118)                                                                  size) <= width:
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 119)                     mywords.append(words[0])
src/rechnung/Invoice/InvoiceToPDF.py 120)                     del words[0]
src/rechnung/Invoice/InvoiceToPDF.py 121)                 lines.append(' '.join(mywords))
src/rechnung/Invoice/InvoiceToPDF.py 122)         return lines
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 123) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 124)     def _PageMarkers(self):
src/rechnung/Invoice/InvoiceToPDF.py 125)         """Setzt Falzmarken"""
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 126)         self.canvas.setStrokeColor((0, 0, 0))
src/rechnung/Invoice/InvoiceToPDF.py 127)         self.canvas.setLineWidth(0.01 * cm)
src/rechnung/Invoice/InvoiceToPDF.py 128)         self.canvas.lines([(0.3 * cm, -10.5 * cm, 0.65 * cm, -10.5 * cm),
src/rechnung/Invoice/InvoiceToPDF.py 129)                            (0.3 * cm, -21.0 * cm, 0.65 * cm, -21.0 * cm),
src/rechnung/Invoice/InvoiceToPDF.py 130)                            (0.3 * cm, -14.85 * cm, 0.7 * cm, -14.85 * cm)])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 131) 
src/rechnung/Invoice/InvoiceToPDF.py 132)     def _lineHeight(self, fontsize=None, font=None):
src/rechnung/Invoice/InvoiceToPDF.py 133)         if not fontsize:
src/rechnung/Invoice/InvoiceToPDF.py 134)             fontsize = self.default_font_size
src/rechnung/Invoice/InvoiceToPDF.py 135)         if not font:
src/rechnung/Invoice/InvoiceToPDF.py 136)             font = self.font
src/rechnung/Invoice/InvoiceToPDF.py 137)         face = pdfmetrics.getFont(font).face
src/rechnung/Invoice/InvoiceToPDF.py 138)         string_height = (face.ascent - face.descent) / 1000 * fontsize
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 139)         return string_height + 0.1 * cm
src/rechnung/Invoice/InvoiceToPDF.py 140) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 141)     def _partHeight(self, part):
src/rechnung/Invoice/InvoiceToPDF.py 142)         height = 0
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 143)         if isinstance(part, InvoiceText):
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 144)             left, right = self.leftcontent, self.rightcontent
src/rechnung/Invoice/InvoiceToPDF.py 145)             if part.urgent:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 146)                 left += 1.5 * cm
src/rechnung/Invoice/InvoiceToPDF.py 147)                 right -= 1.5 * cm
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 148)                 height += len(part.paragraphs) * 3 * self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 149)                 # Rechne eine Zeile mehr für den Rahmen
src/rechnung/Invoice/InvoiceToPDF.py 150)                 height += self.line_height
src/rechnung/Invoice/InvoiceToPDF.py 151)             if part.headline:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 152)                 height += (len(self._splitToWidth(part.headline, right - left, self.font + '-Bold',
src/rechnung/Invoice/InvoiceToPDF.py 153)                                                   self.default_font_size + 1)) * self.line_height) + self.line_padding
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 154)             for para in part.paragraphs:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 155)                 height += (len(self._splitToWidth(para, right - left, self.font,
src/rechnung/Invoice/InvoiceToPDF.py 156)                                                   self.default_font_size)) * self.line_height) + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 157)         elif isinstance(part, InvoiceTable):
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 158)             # Eine Zeile plus 2 mal line_padding für Tabellenkopf
src/rechnung/Invoice/InvoiceToPDF.py 159)             height = self.line_height + 2 * self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 160)             # Wenn nur ein Element (plus Summen) hin passt, reicht uns das
src/rechnung/Invoice/InvoiceToPDF.py 161)             el = part.entries[0]
src/rechnung/Invoice/InvoiceToPDF.py 162)             # Die Abstände oben und unten
src/rechnung/Invoice/InvoiceToPDF.py 163)             height += 2 * self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 164)             # Die Breite ist konservativ
src/rechnung/Invoice/InvoiceToPDF.py 165)             if el['type'] == 'title':
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 166)                 height += self.line_height + 0.2 * cm
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 167)             else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 168)                 height += self.line_height * len(self._splitToWidth(el['subject'], 9.3 * cm, self.font, self.font_size))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 169)             if 'desc' in el and el['desc'] != '':
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 170)                 height += self.line_height * len(self._splitToWidth(el['desc'], 11 * cm, self.font, self.font_size))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 171)             if part.vatType == 'net':
src/rechnung/Invoice/InvoiceToPDF.py 172)                 # Eine Zeile mehr
src/rechnung/Invoice/InvoiceToPDF.py 173)                 height += self.line_height + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 174)             # Für die MwSt-Summen
src/rechnung/Invoice/InvoiceToPDF.py 175)             height += (self.line_height + self.line_padding) * len(part.vat)
src/rechnung/Invoice/InvoiceToPDF.py 176)             # Für den Rechnungsbetrag
src/rechnung/Invoice/InvoiceToPDF.py 177)             height += self.line_height + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 178)         return height
src/rechnung/Invoice/InvoiceToPDF.py 179) 
src/rechnung/Invoice/InvoiceToPDF.py 180)     def _tableHead(self, part):
src/rechnung/Invoice/InvoiceToPDF.py 181)         self.canvas.setFont(self.font, self.font_size)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 182)         self.canvas.drawString(self.leftcontent + (0.1 * cm), self.y - self.line_height + self.line_padding, 'Anz.')
src/rechnung/Invoice/InvoiceToPDF.py 183)         self.canvas.drawString(self.leftcontent + (2.1 * cm), self.y - self.line_height + self.line_padding,
src/rechnung/Invoice/InvoiceToPDF.py 184)                                'Beschreibung')
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 185)         if len(part.vat) == 1:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 186)             self.canvas.drawRightString(self.leftcontent + (14.3 * cm), self.y - self.line_height + self.line_padding,
src/rechnung/Invoice/InvoiceToPDF.py 187)                                         'Einzelpreis')
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 188)         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 189)             self.canvas.drawRightString(self.leftcontent + (13.3 * cm), self.y - self.line_height + self.line_padding,
src/rechnung/Invoice/InvoiceToPDF.py 190)                                         'Einzelpreis')
src/rechnung/Invoice/InvoiceToPDF.py 191)         self.canvas.drawRightString(self.leftcontent + (16.8 * cm), self.y - self.line_height + self.line_padding,
src/rechnung/Invoice/InvoiceToPDF.py 192)                                     'Gesamtpreis')
src/rechnung/Invoice/InvoiceToPDF.py 193)         self.canvas.setLineWidth(0.01 * cm)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 194)         self.canvas.line(self.leftcontent, self.y - self.line_height, self.rightcontent, self.y - self.line_height)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 195)         self.y -= self.line_height + 0.02 * cm
src/rechnung/Invoice/InvoiceToPDF.py 196) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 197)     def _PageWrap(self):
src/rechnung/Invoice/InvoiceToPDF.py 198)         '''Seitenumbruch'''
src/rechnung/Invoice/InvoiceToPDF.py 199)         self.num_pages += 1
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 200)         self.canvas.setFont(self.font, self.default_font_size - 2)
src/rechnung/Invoice/InvoiceToPDF.py 201)         self.canvas.drawRightString(self.rightcontent, self.bottomcontent + self.line_padding,
src/rechnung/Invoice/InvoiceToPDF.py 202)                                     'Fortsetzung auf Seite %i' % self.num_pages)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 203)         self.canvas.showPage()
src/rechnung/Invoice/InvoiceToPDF.py 204)         self.basicPage()
src/rechnung/Invoice/InvoiceToPDF.py 205)         self.y = self.topcontent - self.font_size
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 206)         self.canvas.setFillColor((0, 0, 0))
src/rechnung/Invoice/InvoiceToPDF.py 207)         self.canvas.setFont(self.font, self.font_size - 2)
src/rechnung/Invoice/InvoiceToPDF.py 208)         self.canvas.drawCentredString(self.leftcontent + (self.rightcontent - self.leftcontent) / 2, self.y,
src/rechnung/Invoice/InvoiceToPDF.py 209)                                       '- Seite %i -' % self.num_pages)
src/rechnung/Invoice/InvoiceToPDF.py 210) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 211)     def _Footer(self):
src/rechnung/Invoice/InvoiceToPDF.py 212)         self.canvas.setStrokeColor((0, 0, 0))
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 213)         self.canvas.setFillColor((0, 0, 0))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 214)         self.canvas.line(self.leftcontent, self.bottomcontent, self.rightcontent, self.bottomcontent)
src/rechnung/Invoice/InvoiceToPDF.py 215)         self.canvas.setFont(self.font, 7)
src/rechnung/Invoice/InvoiceToPDF.py 216)         lines = list(filter(None, [
src/rechnung/Invoice/InvoiceToPDF.py 217)             self.invoice.seller['trade_name'],
src/rechnung/Invoice/InvoiceToPDF.py 218)             self.invoice.seller['name'] if self.invoice.seller['trade_name'] else None,
src/rechnung/Invoice/InvoiceToPDF.py 219)             self.invoice.seller['website'],
src/rechnung/Invoice/InvoiceToPDF.py 220)             self.invoice.seller['email'],
src/rechnung/Invoice/InvoiceToPDF.py 221)         ]))
src/rechnung/Invoice/InvoiceToPDF.py 222)         c = 0
src/rechnung/Invoice/InvoiceToPDF.py 223)         for line in lines:
src/rechnung/Invoice/InvoiceToPDF.py 224)             c += 10
src/rechnung/Invoice/InvoiceToPDF.py 225)             self.canvas.drawString(self.leftcontent, self.bottomcontent - c, line)
src/rechnung/Invoice/InvoiceToPDF.py 226) 
src/rechnung/Invoice/InvoiceToPDF.py 227)         if self.invoice.seller_vat_id:
src/rechnung/Invoice/InvoiceToPDF.py 228)             lines = list(filter(None, [
src/rechnung/Invoice/InvoiceToPDF.py 229)                 "USt-ID: " + self.invoice.seller_vat_id
src/rechnung/Invoice/InvoiceToPDF.py 230)             ]))
src/rechnung/Invoice/InvoiceToPDF.py 231)             c = 0
src/rechnung/Invoice/InvoiceToPDF.py 232)             for line in lines:
src/rechnung/Invoice/InvoiceToPDF.py 233)                 c += 10
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 234)                 self.canvas.drawString(self.leftcontent + ((self.rightcontent - self.leftcontent) // 3),
src/rechnung/Invoice/InvoiceToPDF.py 235)                                        self.bottomcontent - c, line)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 236) 
src/rechnung/Invoice/InvoiceToPDF.py 237)         if not self.invoice.debit:
src/rechnung/Invoice/InvoiceToPDF.py 238)             iban = self.invoice.seller_bank_data['iban']
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 239)             iban = ' '.join([iban[i:i + 4] for i in range(0, len(iban), 4)])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 240)             lines = [
src/rechnung/Invoice/InvoiceToPDF.py 241)                 f"IBAN: {iban}",
src/rechnung/Invoice/InvoiceToPDF.py 242)                 self.invoice.seller_bank_data['bankname'],
Bernd Wurst Kleine Korrekturen, mache B...

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 243)                 f"BIC: {self.invoice.seller_bank_data['bic']}" if self.invoice.seller_bank_data['bic'] else None,
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 244)             ]
src/rechnung/Invoice/InvoiceToPDF.py 245)             c = 0
src/rechnung/Invoice/InvoiceToPDF.py 246)             for line in lines:
src/rechnung/Invoice/InvoiceToPDF.py 247)                 c += 10
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 248)                 self.canvas.drawString(self.leftcontent + ((self.rightcontent - self.leftcontent) // 3) * 2,
src/rechnung/Invoice/InvoiceToPDF.py 249)                                        self.bottomcontent - c, line)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 250) 
src/rechnung/Invoice/InvoiceToPDF.py 251)     def basicPage(self):
src/rechnung/Invoice/InvoiceToPDF.py 252)         # Set marker to top.
src/rechnung/Invoice/InvoiceToPDF.py 253)         self.canvas.translate(0, A4[1])
src/rechnung/Invoice/InvoiceToPDF.py 254) 
src/rechnung/Invoice/InvoiceToPDF.py 255)         self._PageMarkers()
src/rechnung/Invoice/InvoiceToPDF.py 256)         self._Footer()
src/rechnung/Invoice/InvoiceToPDF.py 257) 
src/rechnung/Invoice/InvoiceToPDF.py 258)     def addressBox(self):
src/rechnung/Invoice/InvoiceToPDF.py 259)         lines = [
src/rechnung/Invoice/InvoiceToPDF.py 260)             self.invoice.seller['trade_name'],
src/rechnung/Invoice/InvoiceToPDF.py 261)             self.invoice.seller['address']['line1'],
src/rechnung/Invoice/InvoiceToPDF.py 262)             self.invoice.seller['address']['line2'],
src/rechnung/Invoice/InvoiceToPDF.py 263)             self.invoice.seller['address']['line3'],
src/rechnung/Invoice/InvoiceToPDF.py 264)             self.invoice.seller['address']['postcode'] + ' ' + self.invoice.seller['address']['city_name'],
src/rechnung/Invoice/InvoiceToPDF.py 265)         ]
src/rechnung/Invoice/InvoiceToPDF.py 266)         address = ' · '.join(filter(None, lines))
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 267)         self.canvas.drawString(self.x, self.y + 0.1 * cm, f' {address}')
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 268)         self.canvas.line(self.x, self.y, self.x + (8.5 * cm), self.y)
src/rechnung/Invoice/InvoiceToPDF.py 269)         self.y = self.y - self.font_size - 3
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 270) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 271)         font_size = 11
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 272)         x = self.x + 0.5 * cm
src/rechnung/Invoice/InvoiceToPDF.py 273)         self.y -= 0.5 * cm
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 274)         self.canvas.setFont(self.font, font_size)
src/rechnung/Invoice/InvoiceToPDF.py 275)         addresslines = filter(None, [
src/rechnung/Invoice/InvoiceToPDF.py 276)             self.invoice.customer['name'].strip(),
src/rechnung/Invoice/InvoiceToPDF.py 277)             self.invoice.customer['address']['line1'] or '',
src/rechnung/Invoice/InvoiceToPDF.py 278)             self.invoice.customer['address']['line2'] or '',
src/rechnung/Invoice/InvoiceToPDF.py 279)             self.invoice.customer['address']['line3'] or '',
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 280)             ((self.invoice.customer['address']['postcode'] or '') + ' ' + (
src/rechnung/Invoice/InvoiceToPDF.py 281)                     self.invoice.customer['address']['city_name'] or '')).strip(),
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 282)         ])
src/rechnung/Invoice/InvoiceToPDF.py 283)         for line in addresslines:
src/rechnung/Invoice/InvoiceToPDF.py 284)             self.canvas.drawString(x, self.y, line)
src/rechnung/Invoice/InvoiceToPDF.py 285)             self.y -= font_size * 0.03527 * cm * 1.2
src/rechnung/Invoice/InvoiceToPDF.py 286) 
src/rechnung/Invoice/InvoiceToPDF.py 287)     def firstPage(self):
src/rechnung/Invoice/InvoiceToPDF.py 288)         self.basicPage()
src/rechnung/Invoice/InvoiceToPDF.py 289)         self.addressBox()
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 290) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 291)         self.y = self.topcontent
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 292)         self.canvas.drawImage(self.invoice.logo_image_file, self.rightcolumn, self.topcontent - (2 * cm),
src/rechnung/Invoice/InvoiceToPDF.py 293)                               height=2 * cm, preserveAspectRatio=True, anchor='nw')
src/rechnung/Invoice/InvoiceToPDF.py 294)         self.y -= (2.5 * cm)
src/rechnung/Invoice/InvoiceToPDF.py 295)         self.canvas.setFont(self.font + "-Bold", self.font_size)
src/rechnung/Invoice/InvoiceToPDF.py 296)         self.canvas.drawString(self.rightcolumn, self.y,
src/rechnung/Invoice/InvoiceToPDF.py 297)                                self.invoice.seller['trade_name'] or self.invoice.seller['name'])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 298)         self.y -= (self.font_size + 5)
src/rechnung/Invoice/InvoiceToPDF.py 299)         self.canvas.setFont(self.font, self.font_size)
src/rechnung/Invoice/InvoiceToPDF.py 300)         lines = [
src/rechnung/Invoice/InvoiceToPDF.py 301)             self.invoice.seller['name'] if self.invoice.seller['trade_name'] else None,
src/rechnung/Invoice/InvoiceToPDF.py 302)             self.invoice.seller['address']['line1'],
src/rechnung/Invoice/InvoiceToPDF.py 303)             self.invoice.seller['address']['line2'],
src/rechnung/Invoice/InvoiceToPDF.py 304)             self.invoice.seller['address']['line3'],
src/rechnung/Invoice/InvoiceToPDF.py 305)             self.invoice.seller['address']['postcode'] + ' ' + self.invoice.seller['address']['city_name'],
src/rechnung/Invoice/InvoiceToPDF.py 306)             self.invoice.seller['website'],
src/rechnung/Invoice/InvoiceToPDF.py 307)         ]
src/rechnung/Invoice/InvoiceToPDF.py 308)         address = filter(None, lines)
src/rechnung/Invoice/InvoiceToPDF.py 309)         for line in address:
src/rechnung/Invoice/InvoiceToPDF.py 310)             self.canvas.drawString(self.rightcolumn, self.y, line)
src/rechnung/Invoice/InvoiceToPDF.py 311)             self.y -= (self.font_size + 5)
src/rechnung/Invoice/InvoiceToPDF.py 312)         self.y -= 5
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 313)         if self.invoice.seller['phone']:
src/rechnung/Invoice/InvoiceToPDF.py 314)             self.canvas.drawString(self.rightcolumn, self.y, f"Tel: {self.invoice.seller['phone']}")
src/rechnung/Invoice/InvoiceToPDF.py 315)             self.y -= (self.font_size + 5)
src/rechnung/Invoice/InvoiceToPDF.py 316)         if self.invoice.seller['email']:
src/rechnung/Invoice/InvoiceToPDF.py 317)             self.canvas.drawString(self.rightcolumn, self.y, f"E-Mail: {self.invoice.seller['email']}")
src/rechnung/Invoice/InvoiceToPDF.py 318)             self.y -= (self.font_size + 10)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 319)         self.y = -9.5 * cm
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 320) 
src/rechnung/Invoice/InvoiceToPDF.py 321)     def title(self, title):
src/rechnung/Invoice/InvoiceToPDF.py 322)         self.canvas.setTitle(title)
src/rechnung/Invoice/InvoiceToPDF.py 323)         self.canvas.drawString(self.leftcontent, self.y, title)
src/rechnung/Invoice/InvoiceToPDF.py 324) 
src/rechnung/Invoice/InvoiceToPDF.py 325)     def renderRechnung(self):
src/rechnung/Invoice/InvoiceToPDF.py 326)         self.firstPage()
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 327)         self.canvas.setFont(self.font + '-Bold', self.font_size + 3)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 328)         self.title(self.invoice.title)
src/rechnung/Invoice/InvoiceToPDF.py 329) 
src/rechnung/Invoice/InvoiceToPDF.py 330)         if self.invoice.tender:
src/rechnung/Invoice/InvoiceToPDF.py 331)             self.canvas.setFont(self.font, self.font_size)
src/rechnung/Invoice/InvoiceToPDF.py 332)             self.canvas.drawString(self.rightcolumn, self.y, "Erstellungsdatum:")
src/rechnung/Invoice/InvoiceToPDF.py 333)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.date.strftime('%d. %m. %Y'))
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 334)             self.y -= (self.font_size + 0.1 * cm)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 335)         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 336)             self.canvas.setFont(self.font + '-Bold', self.font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 337)             self.canvas.drawString(self.rightcolumn, self.y, "Bei Fragen bitte immer angeben:")
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 338)             self.y -= (self.font_size + 0.2 * cm)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 339)             self.canvas.setFont(self.font, self.font_size)
src/rechnung/Invoice/InvoiceToPDF.py 340)             self.canvas.drawString(self.rightcolumn, self.y, "Rechnungsdatum:")
src/rechnung/Invoice/InvoiceToPDF.py 341)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.date.strftime('%d. %m. %Y'))
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 342)             self.y -= (self.font_size + 0.1 * cm)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 343)             self.canvas.drawString(self.rightcolumn, self.y, "Rechnungsnummer:")
src/rechnung/Invoice/InvoiceToPDF.py 344)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.id)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 345)             self.y -= (self.font_size + 0.1 * cm)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 346)         if self.invoice.customerno:
src/rechnung/Invoice/InvoiceToPDF.py 347)             self.canvas.drawString(self.rightcolumn, self.y, "Kundennummer:")
src/rechnung/Invoice/InvoiceToPDF.py 348)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.customerno)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 349)             self.y -= (self.font_size + 0.5 * cm)
Bernd Wurst Referenznummern auf allen A...

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 350)         if self.invoice.leitweg_id:
src/rechnung/Invoice/InvoiceToPDF.py 351)             self.canvas.drawString(self.rightcolumn, self.y, "Leitweg-ID:")
src/rechnung/Invoice/InvoiceToPDF.py 352)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.leitweg_id)
src/rechnung/Invoice/InvoiceToPDF.py 353)             self.y -= (self.font_size + 0.1 * cm)
src/rechnung/Invoice/InvoiceToPDF.py 354)         if self.invoice.buyer_reference:
src/rechnung/Invoice/InvoiceToPDF.py 355)             self.canvas.drawString(self.rightcolumn, self.y, "Kunden-Referenz:")
src/rechnung/Invoice/InvoiceToPDF.py 356)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.buyer_reference)
src/rechnung/Invoice/InvoiceToPDF.py 357)             self.y -= (self.font_size + 0.1 * cm)
src/rechnung/Invoice/InvoiceToPDF.py 358)         if self.invoice.contract_number:
src/rechnung/Invoice/InvoiceToPDF.py 359)             self.canvas.drawString(self.rightcolumn, self.y, "Vertragsnummer:")
src/rechnung/Invoice/InvoiceToPDF.py 360)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.contract_number)
src/rechnung/Invoice/InvoiceToPDF.py 361)             self.y -= (self.font_size + 0.1 * cm)
src/rechnung/Invoice/InvoiceToPDF.py 362)         if self.invoice.order_number:
src/rechnung/Invoice/InvoiceToPDF.py 363)             self.canvas.drawString(self.rightcolumn, self.y, "Ihre Bestellnummer:")
src/rechnung/Invoice/InvoiceToPDF.py 364)             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.order_number)
src/rechnung/Invoice/InvoiceToPDF.py 365)             self.y -= (self.font_size + 0.1 * cm)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 366)         self.canvas.setFont(self.font, self.font_size)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 367) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 368)         if self.invoice.salutation:
src/rechnung/Invoice/InvoiceToPDF.py 369)             self.canvas.drawString(self.leftcontent, self.y, self.invoice.salutation)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 370)             self.y -= self.font_size + 0.2 * cm
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 371)             introText = 'hiermit stellen wir Ihnen die nachfolgend genannten Leistungen in Rechnung.'
src/rechnung/Invoice/InvoiceToPDF.py 372)             if self.invoice.tender:
src/rechnung/Invoice/InvoiceToPDF.py 373)                 introText = 'hiermit unterbreiten wir Ihnen folgendes Angebot.'
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 374)             if self.invoice.type == GUTSCHRIFT:
src/rechnung/Invoice/InvoiceToPDF.py 375)                 introText = 'nach unserer Berechnung entsteht für Sie folgende Gutschrift.'
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 376)             intro = self._splitToWidth(introText, self.rightcontent - self.leftcontent, self.font, self.font_size)
src/rechnung/Invoice/InvoiceToPDF.py 377)             for line in intro:
src/rechnung/Invoice/InvoiceToPDF.py 378)                 self.canvas.drawString(self.leftcontent, self.y, line)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 379)                 self.y -= self.font_size + 0.1 * cm
src/rechnung/Invoice/InvoiceToPDF.py 380)             self.y -= self.font_size + 0.1 * cm
src/rechnung/Invoice/InvoiceToPDF.py 381) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 382)         font_size = self.default_font_size
src/rechnung/Invoice/InvoiceToPDF.py 383)         for part in self.invoice.parts:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 384)             if self.y - self._partHeight(part) < (self.bottomcontent + (0.5 * cm)):
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 385)                 self._PageWrap()
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 386)                 self.y = self.topcontent - self.font_size - self.line_padding * 3
src/rechnung/Invoice/InvoiceToPDF.py 387)             if isinstance(part, InvoiceTable):
src/rechnung/Invoice/InvoiceToPDF.py 388) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 389)                 left = self.leftcontent
src/rechnung/Invoice/InvoiceToPDF.py 390)                 right = self.rightcontent
src/rechnung/Invoice/InvoiceToPDF.py 391)                 self._tableHead(part)
src/rechnung/Invoice/InvoiceToPDF.py 392)                 temp_sum = 0.0
src/rechnung/Invoice/InvoiceToPDF.py 393)                 odd = True
src/rechnung/Invoice/InvoiceToPDF.py 394)                 for el in part.entries:
src/rechnung/Invoice/InvoiceToPDF.py 395)                     if el['type'] == 'title':
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 396)                         self.y -= self.line_padding + 0.2 * cm
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 397)                         self.canvas.setFillColorRGB(0, 0, 0)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 398)                         self.canvas.setFont(self.font + '-Italic', font_size)
src/rechnung/Invoice/InvoiceToPDF.py 399)                         self.canvas.drawString(left, self.y - self.font_height, el['title'])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 400)                         self.canvas.setFont(self.font, font_size)
src/rechnung/Invoice/InvoiceToPDF.py 401)                         self.y -= self.line_height + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 402)                     else:
src/rechnung/Invoice/InvoiceToPDF.py 403)                         if len(part.vat) == 1:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 404)                             subject = self._splitToWidth(el['subject'], 9.8 * cm, self.font, font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 405)                         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 406)                             subject = self._splitToWidth(el['subject'], 8.8 * cm, self.font, font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 407)                         desc = []
src/rechnung/Invoice/InvoiceToPDF.py 408)                         if 'desc' in el and el['desc'] != '':
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 409)                             desc = self._splitToWidth(el['desc'], 14.0 * cm, self.font, font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 410)                         if 'period_start' in el and el['period_start']:
src/rechnung/Invoice/InvoiceToPDF.py 411)                             if 'period_end' in el and el['period_end']:
src/rechnung/Invoice/InvoiceToPDF.py 412)                                 desc.extend(self._splitToWidth('Leistungszeitraum: %s - %s' %
src/rechnung/Invoice/InvoiceToPDF.py 413)                                                                (el['period_start'].strftime('%d.%m.%Y'),
src/rechnung/Invoice/InvoiceToPDF.py 414)                                                                 el['period_end'].strftime('%d.%m.%Y')),
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 415)                                                                14.0 * cm, self.font, font_size))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 416)                             else:
src/rechnung/Invoice/InvoiceToPDF.py 417)                                 desc.extend(self._splitToWidth('Leistungsdatum: %s' %
src/rechnung/Invoice/InvoiceToPDF.py 418)                                                                (el['period_start'].strftime('%d.%m.%Y'),),
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 419)                                                                14.0 * cm, self.font, font_size))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 420)                         need_lines = len(subject) + len(desc)
src/rechnung/Invoice/InvoiceToPDF.py 421)                         # need page wrap?
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 422)                         if self.y - (need_lines + 1 * (self.line_height + self.line_padding)) < (
src/rechnung/Invoice/InvoiceToPDF.py 423)                                 self.bottomcontent + 1 * cm):
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 424)                             self.canvas.setFont(self.font + '-Italic', font_size)
src/rechnung/Invoice/InvoiceToPDF.py 425)                             # Zwischensumme
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 426)                             self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Zwischensumme:')
src/rechnung/Invoice/InvoiceToPDF.py 427)                             self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 428)                                                         _formatPrice(temp_sum))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 429)                             # page wrap
src/rechnung/Invoice/InvoiceToPDF.py 430)                             self._PageWrap()
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 431)                             self.y = self.topcontent - font_size - self.line_padding * 3
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 432)                             # header
src/rechnung/Invoice/InvoiceToPDF.py 433)                             self._tableHead(part)
src/rechnung/Invoice/InvoiceToPDF.py 434)                             self.y -= self.line_padding * 3
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 435)                             odd = True
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 436)                             # übertrag
src/rechnung/Invoice/InvoiceToPDF.py 437)                             self.canvas.setFont(self.font + '-Italic', font_size)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 438)                             self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Übertrag:')
src/rechnung/Invoice/InvoiceToPDF.py 439)                             self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 440)                                                         _formatPrice(temp_sum))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 441)                             self.y -= self.font_height + self.line_padding * 3
src/rechnung/Invoice/InvoiceToPDF.py 442)                             self.canvas.setFont(self.font, self.default_font_size)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 443) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 444)                         # Zwischensumme (inkl. aktueller Posten)
src/rechnung/Invoice/InvoiceToPDF.py 445)                         temp_sum += el['total']
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 446) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 447)                         # draw the background
src/rechnung/Invoice/InvoiceToPDF.py 448)                         if not odd:
src/rechnung/Invoice/InvoiceToPDF.py 449)                             self.canvas.setFillColorRGB(0.9, 0.9, 0.9)
src/rechnung/Invoice/InvoiceToPDF.py 450)                         else:
src/rechnung/Invoice/InvoiceToPDF.py 451)                             self.canvas.setFillColorRGB(1, 1, 1)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 452)                         self.canvas.rect(left, self.y - (need_lines * self.line_height) - (2 * self.line_padding),
src/rechnung/Invoice/InvoiceToPDF.py 453)                                          height=(need_lines * self.line_height) + (2 * self.line_padding),
src/rechnung/Invoice/InvoiceToPDF.py 454)                                          width=right - left, fill=1, stroke=0)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 455)                         self.canvas.setFillColorRGB(0, 0, 0)
src/rechnung/Invoice/InvoiceToPDF.py 456)                         self.y -= self.line_padding
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 457)                         self.canvas.drawRightString(left + 1.1 * cm, self.y - self.font_height, '%.0f' % el['count'])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 458)                         if el['unit']:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 459)                             self.canvas.drawString(left + 1.2 * cm, self.y - self.font_height, el['unit'])
src/rechnung/Invoice/InvoiceToPDF.py 460)                         self.canvas.drawString(left + 2.2 * cm, self.y - self.font_height, subject[0])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 461)                         if len(part.vat) == 1:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 462)                             self.canvas.drawRightString(left + 14.3 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 463)                                                         _formatPrice(el['price']))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 464)                         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 465)                             self.canvas.drawRightString(left + 13.3 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 466)                                                         _formatPrice(el['price']))
src/rechnung/Invoice/InvoiceToPDF.py 467)                             self.canvas.drawString(left + 13.7 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 468)                                                    str(part.vat[el['vat']][1]))
src/rechnung/Invoice/InvoiceToPDF.py 469)                         if el['tender']:
src/rechnung/Invoice/InvoiceToPDF.py 470)                             self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, 'eventual')
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 471)                         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 472)                             self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 473)                                                         _formatPrice(el['total']))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 474)                         subject = subject[1:]
src/rechnung/Invoice/InvoiceToPDF.py 475)                         x = 1
src/rechnung/Invoice/InvoiceToPDF.py 476)                         for line in subject:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 477)                             self.canvas.drawString(left + 2.2 * cm, self.y - (x * self.line_height) - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 478)                                                    line)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 479)                             x += 1
src/rechnung/Invoice/InvoiceToPDF.py 480)                         for line in desc:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 481)                             self.canvas.drawString(left + 2.2 * cm, self.y - (x * self.line_height) - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 482)                                                    line)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 483)                             x += 1
src/rechnung/Invoice/InvoiceToPDF.py 484)                         odd = not odd
src/rechnung/Invoice/InvoiceToPDF.py 485)                         self.y -= (need_lines * self.line_height) + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 486)                 if part.summary:
src/rechnung/Invoice/InvoiceToPDF.py 487)                     need_lines = 5
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 488)                     if self.y - (need_lines + 1 * (self.line_height + self.line_padding)) < (
src/rechnung/Invoice/InvoiceToPDF.py 489)                             self.bottomcontent + 1 * cm):
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 490)                         self.canvas.setFont(self.font + '-Italic', font_size)
src/rechnung/Invoice/InvoiceToPDF.py 491)                         # Zwischensumme
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 492)                         self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Zwischensumme:')
src/rechnung/Invoice/InvoiceToPDF.py 493)                         self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, _formatPrice(temp_sum))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 494)                         # page wrap
src/rechnung/Invoice/InvoiceToPDF.py 495)                         self._PageWrap()
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 496)                         self.y = self.topcontent - font_size - self.line_padding * 3
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 497)                         # header
src/rechnung/Invoice/InvoiceToPDF.py 498)                         self._tableHead(part)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 499)                         odd = True
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 500)                         # übertrag
src/rechnung/Invoice/InvoiceToPDF.py 501)                         self.canvas.setFont(self.font + '-Italic', font_size)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 502)                         self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Übertrag:')
src/rechnung/Invoice/InvoiceToPDF.py 503)                         self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, _formatPrice(temp_sum))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 504)                         self.y -= self.font_height + self.line_padding
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 505)                     self.y -= (0.3 * cm)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 506)                     if part.vatType == 'gross':
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 507)                         self.canvas.setFont(self.font + '-Bold', font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 508)                         if self.invoice.tender or not self.invoice.official:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 509)                             self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Gesamtbetrag:')
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 510)                         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 511)                             self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Rechnungsbetrag:')
src/rechnung/Invoice/InvoiceToPDF.py 512)                         self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, _formatPrice(part.sum))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 513)                         if self.invoice.official:
src/rechnung/Invoice/InvoiceToPDF.py 514)                             self.canvas.setFont(self.font, font_size)
src/rechnung/Invoice/InvoiceToPDF.py 515)                             self.y -= self.line_height + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 516)                             summaries = []
src/rechnung/Invoice/InvoiceToPDF.py 517)                             vat = 0.0
src/rechnung/Invoice/InvoiceToPDF.py 518)                             if len(part.vat) == 1 and list(part.vat.keys())[0] == 0.0:
src/rechnung/Invoice/InvoiceToPDF.py 519)                                 self.canvas.drawString(left, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 520)                                                        'Dieser Beleg wurde ohne Ausweis von MwSt erstellt.')
src/rechnung/Invoice/InvoiceToPDF.py 521)                                 self.y -= self.line_height
src/rechnung/Invoice/InvoiceToPDF.py 522)                             else:
src/rechnung/Invoice/InvoiceToPDF.py 523)                                 if len(part.vat) == 1:
src/rechnung/Invoice/InvoiceToPDF.py 524)                                     vat = list(part.vat.keys())[0]
src/rechnung/Invoice/InvoiceToPDF.py 525)                                     if self.invoice.tender:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 526)                                         summaries.append(('Im Gesamtbetrag sind %.1f%% MwSt enthalten:' % (vat * 100),
src/rechnung/Invoice/InvoiceToPDF.py 527)                                                           _formatPrice((part.sum / (vat + 1)) * vat)))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 528)                                     else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 529)                                         summaries.append((
src/rechnung/Invoice/InvoiceToPDF.py 530)                                             'Im Rechnungsbetrag sind %.1f%% MwSt enthalten:' % (vat * 100),
src/rechnung/Invoice/InvoiceToPDF.py 531)                                             _formatPrice((part.sum / (vat + 1)) * vat)))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 532)                                 else:
src/rechnung/Invoice/InvoiceToPDF.py 533)                                     for vat, vatdata in part.vat.items():
src/rechnung/Invoice/InvoiceToPDF.py 534)                                         if vat > 0:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 535)                                             summaries.append(('%s: Im Teilbetrag von %s sind %.1f%% MwSt enthalten:' % (
src/rechnung/Invoice/InvoiceToPDF.py 536)                                                 vatdata[1], _formatPrice(vatdata[0]), vat * 100),
src/rechnung/Invoice/InvoiceToPDF.py 537)                                                               _formatPrice((vatdata[0] / (vat + 1)) * vat)))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 538)                                         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 539)                                             summaries.append(('%s: Durchlaufende Posten ohne Berechnung von MwSt.' % (
src/rechnung/Invoice/InvoiceToPDF.py 540)                                                 vatdata[1]), 0.0))
src/rechnung/Invoice/InvoiceToPDF.py 541)                             summaries.append(('Nettobetrag:', _formatPrice(part.sum - (part.sum / (vat + 1)) * vat)))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 542)                             summaries.sort()
src/rechnung/Invoice/InvoiceToPDF.py 543)                             for line in summaries:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 544)                                 self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, line[0])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 545)                                 if line[1]:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 546)                                     self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, line[1])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 547)                                 self.y -= self.line_height
src/rechnung/Invoice/InvoiceToPDF.py 548)                     elif len(part.vat) == 1 and part.vatType == 'net':
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 549)                         self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Nettobetrag:')
src/rechnung/Invoice/InvoiceToPDF.py 550)                         self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, _formatPrice(part.sum))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 551)                         self.y -= self.line_height
src/rechnung/Invoice/InvoiceToPDF.py 552)                         summaries = []
src/rechnung/Invoice/InvoiceToPDF.py 553)                         if list(part.vat.keys())[0] == 0.0:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 554)                             self.canvas.drawString(left, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 555)                                                    'Dieser Beleg wurde ohne Ausweis von MwSt erstellt.')
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 556)                             self.y -= self.line_height
src/rechnung/Invoice/InvoiceToPDF.py 557)                         else:
src/rechnung/Invoice/InvoiceToPDF.py 558)                             if len(part.vat) == 1:
src/rechnung/Invoice/InvoiceToPDF.py 559)                                 vat = list(part.vat.keys())[0]
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 560)                                 summaries.append(('zzgl. %.1f%% MwSt:' % (vat * 100), _formatPrice(vat * part.sum)))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 561)                             else:
src/rechnung/Invoice/InvoiceToPDF.py 562)                                 for vat, vatdata in part.vat.items():
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 563)                                     summaries.append(('zzgl. %.1f%% MwSt (%s):' % (vat * 100, vatdata[1]),
src/rechnung/Invoice/InvoiceToPDF.py 564)                                                       _formatPrice(vat * vatdata[0])))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 565)                         summaries.sort()
src/rechnung/Invoice/InvoiceToPDF.py 566)                         for line in summaries:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 567)                             self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, line[0])
src/rechnung/Invoice/InvoiceToPDF.py 568)                             self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, line[1])
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 569)                             self.y -= self.line_height
src/rechnung/Invoice/InvoiceToPDF.py 570)                         sum = 0
src/rechnung/Invoice/InvoiceToPDF.py 571)                         for vat, vatdata in part.vat.items():
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 572)                             sum += (vat + 1) * vatdata[0]
src/rechnung/Invoice/InvoiceToPDF.py 573)                         self.canvas.setFont(self.font + '-Bold', font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 574)                         if self.invoice.tender:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 575)                             self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Gesamtbetrag:')
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 576)                         else:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 577)                             self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, 'Rechnungsbetrag:')
src/rechnung/Invoice/InvoiceToPDF.py 578)                         self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, _formatPrice(sum))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 579)                         self.canvas.setFont(self.font, font_size)
src/rechnung/Invoice/InvoiceToPDF.py 580)                         self.y -= self.line_height + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 581)                     paysum = 0.0
src/rechnung/Invoice/InvoiceToPDF.py 582)                     for pay in part.payments:
src/rechnung/Invoice/InvoiceToPDF.py 583)                         paysum += pay['amount']
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 584)                         descr = 'Zahlung'
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 585)                         if pay['type'] == 'cash':
src/rechnung/Invoice/InvoiceToPDF.py 586)                             descr = 'gegeben'
src/rechnung/Invoice/InvoiceToPDF.py 587)                         elif pay['type'] == 'return':
src/rechnung/Invoice/InvoiceToPDF.py 588)                             descr = 'zurück'
src/rechnung/Invoice/InvoiceToPDF.py 589)                         elif pay['type'] == 'ec':
src/rechnung/Invoice/InvoiceToPDF.py 590)                             descr = 'Kartenzahlung (EC)'
src/rechnung/Invoice/InvoiceToPDF.py 591)                         elif pay['type'] == 'gutschein':
src/rechnung/Invoice/InvoiceToPDF.py 592)                             descr = 'Einlösung Gutschein'
src/rechnung/Invoice/InvoiceToPDF.py 593)                         if pay['date'] != self.invoice.date:
src/rechnung/Invoice/InvoiceToPDF.py 594)                             descr += ' am %s' % (pay['date'].strftime('%d. %m. %Y'))
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 595)                         self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height, descr + ':')
src/rechnung/Invoice/InvoiceToPDF.py 596)                         self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 597)                                                     _formatPrice(pay['amount']))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 598)                         self.y -= self.line_height
src/rechnung/Invoice/InvoiceToPDF.py 599)                     sum = part.sum
src/rechnung/Invoice/InvoiceToPDF.py 600)                     if part.vatType == 'net':
src/rechnung/Invoice/InvoiceToPDF.py 601)                         sum = 0
src/rechnung/Invoice/InvoiceToPDF.py 602)                         for vat, vatdata in part.vat.items():
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 603)                             sum += (vat + 1) * vatdata[0]
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 604)                     rest = sum - paysum
src/rechnung/Invoice/InvoiceToPDF.py 605)                     if part.payments and rest > 0:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 606)                         self.canvas.setFont(self.font + '-Bold', font_size)
src/rechnung/Invoice/InvoiceToPDF.py 607)                         self.canvas.drawRightString(left + 14.5 * cm, self.y - self.font_height,
src/rechnung/Invoice/InvoiceToPDF.py 608)                                                     'Offener Rechnungsbetrag:')
src/rechnung/Invoice/InvoiceToPDF.py 609)                         self.canvas.drawRightString(left + 16.8 * cm, self.y - self.font_height, _formatPrice(rest))
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 610)                         self.canvas.setFont(self.font, font_size)
src/rechnung/Invoice/InvoiceToPDF.py 611)                         self.y -= self.line_height + self.line_padding
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 612) 
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 613)                     self.y -= self.line_padding
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 614)             elif isinstance(part, InvoiceText):
src/rechnung/Invoice/InvoiceToPDF.py 615)                 my_font_size = font_size + part.fontsize  # Relative Schriftgröße beachten
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 616)                 self.canvas.setFont(self.font, my_font_size)
src/rechnung/Invoice/InvoiceToPDF.py 617)                 left, right = self.leftcontent, self.rightcontent
src/rechnung/Invoice/InvoiceToPDF.py 618)                 firsttime = True
src/rechnung/Invoice/InvoiceToPDF.py 619)                 headlines = []
src/rechnung/Invoice/InvoiceToPDF.py 620)                 if part.urgent:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 621)                     left += 1.5 * cm
src/rechnung/Invoice/InvoiceToPDF.py 622)                     right -= 1.5 * cm
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 623)                 if part.headline:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 624)                     headlines = self._splitToWidth(part.headline, right - left, self.font, my_font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 625)                 for para in part.paragraphs:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 626)                     lines = self._splitToWidth(para, right - left, self.font, my_font_size)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 627)                     if part.urgent:
src/rechnung/Invoice/InvoiceToPDF.py 628)                         need_height = len(lines) * self._lineHeight(my_font_size)
src/rechnung/Invoice/InvoiceToPDF.py 629)                         if len(headlines) > 0:
src/rechnung/Invoice/InvoiceToPDF.py 630)                             need_height += len(headlines) * (self._lineHeight(my_font_size) + 1) + self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 631)                         self.canvas.setFillColorRGB(0.95, 0.95, 0.95)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 632)                         self.canvas.rect(left - 0.5 * cm, self.y - (need_height + (6 * self.line_padding)),
src/rechnung/Invoice/InvoiceToPDF.py 633)                                          height=need_height + (6 * self.line_padding), width=right - left + 1 * cm,
src/rechnung/Invoice/InvoiceToPDF.py 634)                                          fill=1, stroke=1)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 635)                         self.canvas.setFillColorRGB(0, 0, 0)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 636)                         self.y -= self.line_padding * 3
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 637)                     if part.headline and firsttime:
src/rechnung/Invoice/InvoiceToPDF.py 638)                         firsttime = False
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 639)                         self.canvas.setFont(self.font + '-Bold', my_font_size + 1)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 640)                         for line in headlines:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 641)                             self.canvas.drawString(left, self.y - (self.font_height + 1), line)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 642)                             self.y -= self._lineHeight(my_font_size) + 1
src/rechnung/Invoice/InvoiceToPDF.py 643)                         self.y -= self.line_padding
src/rechnung/Invoice/InvoiceToPDF.py 644)                         self.canvas.setFont(self.font, my_font_size)
src/rechnung/Invoice/InvoiceToPDF.py 645)                     for line in lines:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 646)                         self.canvas.drawString(left, self.y - self.font_height, line)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 647)                         self.y -= self._lineHeight(my_font_size)
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 648)                     self.y -= self.line_padding * 3
src/rechnung/Invoice/InvoiceToPDF.py 649)             elif isinstance(part, InvoiceImage):
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 650)                 width = (part.imagedata.width / part.dpi) * inch
src/rechnung/Invoice/InvoiceToPDF.py 651)                 height = width * (part.imagedata.height / part.imagedata.width)
src/rechnung/Invoice/InvoiceToPDF.py 652)                 x = self.leftcontent
src/rechnung/Invoice/InvoiceToPDF.py 653)                 if part.alignment == "center":
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 654)                     x = self.leftcontent + (self.rightcontent - self.leftcontent) / 2 - width / 2
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 655)                 elif part.alignment == "right":
src/rechnung/Invoice/InvoiceToPDF.py 656)                     x = self.rightcontent - width
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 657)                 self.canvas.drawInlineImage(part.imagedata, x, self.y - height, width=width, height=height)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 658)                 self.y -= self.line_padding + height
src/rechnung/Invoice/InvoiceToPDF.py 659)                 if part.caption:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 660)                     self.canvas.drawString(x, self.y - self.font_height, part.caption)
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 661)                     self.y -= self._lineHeight()
src/rechnung/Invoice/InvoiceToPDF.py 662)             else:
src/rechnung/Invoice/InvoiceToPDF.py 663)                 raise NotImplementedError("Cannot handle part of type %s" % type(part))
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToPDF.py 664)             self.y -= (0.5 * cm)
src/rechnung/Invoice/InvoiceToPDF.py 665)