Struktur verändern (broken!)
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/InvoiceObjects.py 1) # -* coding: utf8 *-
src/rechnung/Invoice/InvoiceObjects.py 2)
src/rechnung/Invoice/InvoiceObjects.py 3) import datetime
src/rechnung/Invoice/InvoiceObjects.py 4)
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 5)
|
Python-3-Migration
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 6) class Text:
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 7) def __init__(self, content, urgent=False, headline=None):
src/rechnung/Invoice/__init__.py 8) self.paragraphs = [content]
src/rechnung/Invoice/__init__.py 9) self.urgent = urgent
src/rechnung/Invoice/__init__.py 10) self.headline = headline
|
Struktur verändern (broken!)
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/InvoiceObjects.py 11)
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 12) def addParagraph(self, content):
src/rechnung/Invoice/__init__.py 13) self.paragraphs.append(content)
|
Struktur verändern (broken!)
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/InvoiceObjects.py 14)
src/rechnung/Invoice/InvoiceObjects.py 15)
|
Python-3-Migration
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 16) class Table:
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 17) def __init__(self, vatType='gross', tender=False, summary=True):
src/rechnung/Invoice/__init__.py 18) self.entries = []
src/rechnung/Invoice/__init__.py 19) self.vat = {}
src/rechnung/Invoice/__init__.py 20) self.sum = 0.0
src/rechnung/Invoice/__init__.py 21) self.tender = tender
src/rechnung/Invoice/__init__.py 22) self.summary = summary
src/rechnung/Invoice/__init__.py 23) if vatType not in ['gross', 'net']:
src/rechnung/Invoice/__init__.py 24) raise ValueError('vatType must be »gross« or »net«')
src/rechnung/Invoice/__init__.py 25) self.vatType = vatType
src/rechnung/Invoice/__init__.py 26)
src/rechnung/Invoice/__init__.py 27) def validEntry(self, entry):
src/rechnung/Invoice/__init__.py 28) '''bekommt einen Eintrag und liefert einen Eintrag wenn ok, wirft ansonsten ValueError.
src/rechnung/Invoice/__init__.py 29) wird benutzt um z.B. die Summe auszurechnen oder ähnliches
src/rechnung/Invoice/__init__.py 30) '''
src/rechnung/Invoice/__init__.py 31) e = entry
src/rechnung/Invoice/__init__.py 32) if not ('count' in e and 'subject' in e and 'price' in e and 'vat' in e):
src/rechnung/Invoice/__init__.py 33) raise ValueError('Some data is missing!')
src/rechnung/Invoice/__init__.py 34) if 'unit' not in e:
src/rechnung/Invoice/__init__.py 35) e['unit'] = None
src/rechnung/Invoice/__init__.py 36) ret = {'count': e['count'],
src/rechnung/Invoice/__init__.py 37) 'unit': e['unit'],
src/rechnung/Invoice/__init__.py 38) 'subject': e['subject'],
src/rechnung/Invoice/__init__.py 39) 'price': e['price'],
src/rechnung/Invoice/__init__.py 40) 'total': (e['price'] * e['count']),
src/rechnung/Invoice/__init__.py 41) 'vat': e['vat'],
src/rechnung/Invoice/__init__.py 42) 'tender': False,
src/rechnung/Invoice/__init__.py 43) }
src/rechnung/Invoice/__init__.py 44) if 'tender' in e:
src/rechnung/Invoice/__init__.py 45) ret['tender'] = e['tender']
src/rechnung/Invoice/__init__.py 46) if 'desc' in e:
src/rechnung/Invoice/__init__.py 47) ret['desc'] = e['desc']
src/rechnung/Invoice/__init__.py 48) return ret
src/rechnung/Invoice/__init__.py 49)
src/rechnung/Invoice/__init__.py 50) def addItem(self, data):
src/rechnung/Invoice/__init__.py 51) '''Fügt eine Zeile ein. data muss ein Dict mit passenden Keys und passenden
src/rechnung/Invoice/__init__.py 52) Typen sein'''
src/rechnung/Invoice/__init__.py 53) d = self.validEntry(data)
src/rechnung/Invoice/__init__.py 54) if d['vat'] != 0:
src/rechnung/Invoice/__init__.py 55) if not d['vat'] in self.vat:
src/rechnung/Invoice/__init__.py 56) self.vat[d['vat']] = [0, chr(65 + len(self.vat))]
src/rechnung/Invoice/__init__.py 57) if 'tender' not in data or not data['tender']:
src/rechnung/Invoice/__init__.py 58) self.vat[d['vat']][0] += d['total']
src/rechnung/Invoice/__init__.py 59) if 'tender' not in data or not data['tender']:
src/rechnung/Invoice/__init__.py 60) self.sum += d['total']
src/rechnung/Invoice/__init__.py 61) self.entries.append(d)
|
Struktur verändern (broken!)
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/InvoiceObjects.py 62)
src/rechnung/Invoice/InvoiceObjects.py 63)
|
Python-3-Migration
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 64) class Invoice:
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 65) tender = False
src/rechnung/Invoice/__init__.py 66) caption = 'Rechnung'
|
Umbenannt aber wieder in ko...
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/__init__.py 67)
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 68) def __init__(self):
src/rechnung/Invoice/__init__.py 69) self.customerno = None
src/rechnung/Invoice/__init__.py 70) self.addresslines = ['', ]
src/rechnung/Invoice/__init__.py 71) self.salutation = 'Sehr geehrte Damen und Herren,'
src/rechnung/Invoice/__init__.py 72) self.id = None
src/rechnung/Invoice/__init__.py 73) self.parts = []
src/rechnung/Invoice/__init__.py 74) self.pagecount = 0
src/rechnung/Invoice/__init__.py 75) self.date = datetime.date.today()
|
Struktur verändern (broken!)
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/InvoiceObjects.py 76)
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 77) def setDate(self, date):
src/rechnung/Invoice/__init__.py 78) if type(date) != datetime.date:
src/rechnung/Invoice/__init__.py 79) raise ValueError('date must be of type »datetime.date«')
src/rechnung/Invoice/__init__.py 80) self.date = date
|
Umbenannt aber wieder in ko...
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/__init__.py 81)
src/rechnung/Invoice/__init__.py 82)
src/rechnung/Invoice/__init__.py 83) class Tender(Invoice):
|
automatische code-style-fixes
Bernd Wurst authored 5 years ago
|
src/rechnung/Invoice/__init__.py 84) tender = True
src/rechnung/Invoice/__init__.py 85) caption = 'Angebot'
|
Umbenannt aber wieder in ko...
Bernd Wurst authored 16 years ago
|
src/rechnung/Invoice/__init__.py 86)
src/rechnung/Invoice/__init__.py 87)
src/rechnung/Invoice/__init__.py 88) class Generic(Invoice):
|