01557cdc5ab4b4b4d6050143bb3b29beb38f39b8
Bernd Wurst 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) 
Bernd Wurst Umbenannt aber wieder in ko...

Bernd Wurst authored 16 years ago

src/rechnung/Invoice/__init__.py        5) class Text(object):
Bernd Wurst Struktur verändern (broken!)

Bernd Wurst authored 16 years ago

src/rechnung/Invoice/InvoiceObjects.py  6)   def __init__(self, content, urgent=False, headline=None):
src/rechnung/Invoice/InvoiceObjects.py  7)     self.paragraphs = [content]
src/rechnung/Invoice/InvoiceObjects.py  8)     self.urgent = urgent
src/rechnung/Invoice/InvoiceObjects.py  9)     self.headline = headline
src/rechnung/Invoice/InvoiceObjects.py 10) 
src/rechnung/Invoice/InvoiceObjects.py 11)   def addParagraph(self, content):
src/rechnung/Invoice/InvoiceObjects.py 12)     self.paragraphs.append(content)
src/rechnung/Invoice/InvoiceObjects.py 13) 
src/rechnung/Invoice/InvoiceObjects.py 14) 
Bernd Wurst Umbenannt aber wieder in ko...

Bernd Wurst authored 16 years ago

src/rechnung/Invoice/__init__.py       15) class Table(object):
Bernd Wurst Struktur verändern (broken!)

Bernd Wurst authored 16 years ago

src/rechnung/Invoice/InvoiceObjects.py 16)   def __init__(self, vatType = 'gross', tender = False, summary = True):
src/rechnung/Invoice/InvoiceObjects.py 17)     self.entries = []
src/rechnung/Invoice/InvoiceObjects.py 18)     self.vat = {}
src/rechnung/Invoice/InvoiceObjects.py 19)     self.sum = 0.0
src/rechnung/Invoice/InvoiceObjects.py 20)     self.tender = tender
src/rechnung/Invoice/InvoiceObjects.py 21)     self.summary = summary
src/rechnung/Invoice/InvoiceObjects.py 22)     if vatType not in ['gross', 'net']:
src/rechnung/Invoice/InvoiceObjects.py 23)       raise ValueError('vatType must be »gross« or »net«')
src/rechnung/Invoice/InvoiceObjects.py 24)     self.vatType = vatType
src/rechnung/Invoice/InvoiceObjects.py 25) 
src/rechnung/Invoice/InvoiceObjects.py 26)   def validEntry(self, entry):
src/rechnung/Invoice/InvoiceObjects.py 27)     '''bekommt einen Eintrag und liefert einen Eintrag wenn ok, wirft ansonsten ValueError.
src/rechnung/Invoice/InvoiceObjects.py 28)     wird benutzt um z.B. die Summe auszurechnen oder ähnliches
src/rechnung/Invoice/InvoiceObjects.py 29)     '''
src/rechnung/Invoice/InvoiceObjects.py 30)     k = entry.keys()
src/rechnung/Invoice/InvoiceObjects.py 31)     e = entry
src/rechnung/Invoice/InvoiceObjects.py 32)     if not ('count' in k and 'subject' in k and 'price' in k and 'vat' in k):
src/rechnung/Invoice/InvoiceObjects.py 33)       raise ValueError('Some data is missing!')
src/rechnung/Invoice/InvoiceObjects.py 34)     ret = {'count': e['count'],
src/rechnung/Invoice/InvoiceObjects.py 35)           'subject': e['subject'],
src/rechnung/Invoice/InvoiceObjects.py 36)           'price': e['price'],
src/rechnung/Invoice/InvoiceObjects.py 37)           'total': (e['price'] * e['count']),
src/rechnung/Invoice/InvoiceObjects.py 38)           'vat': e['vat'],
src/rechnung/Invoice/InvoiceObjects.py 39)           'tender': False,
src/rechnung/Invoice/InvoiceObjects.py 40)           }
src/rechnung/Invoice/InvoiceObjects.py 41)     if 'tender' in e.keys():
src/rechnung/Invoice/InvoiceObjects.py 42)       ret['tender'] = e['tender']
src/rechnung/Invoice/InvoiceObjects.py 43)     if 'desc' in k:
src/rechnung/Invoice/InvoiceObjects.py 44)       ret['desc'] = e['desc']
src/rechnung/Invoice/InvoiceObjects.py 45)     return ret
src/rechnung/Invoice/InvoiceObjects.py 46) 
src/rechnung/Invoice/InvoiceObjects.py 47)   def addItem(self, data):
src/rechnung/Invoice/InvoiceObjects.py 48)     '''Fügt eine Zeile ein. data muss ein Dict mit passenden Keys und passenden
src/rechnung/Invoice/InvoiceObjects.py 49)     Typen sein'''
src/rechnung/Invoice/InvoiceObjects.py 50)     d = self.validEntry(data)
src/rechnung/Invoice/InvoiceObjects.py 51)     if not d['vat'] in self.vat.keys():
src/rechnung/Invoice/InvoiceObjects.py 52)       self.vat[d['vat']] = [0, chr(65+len(self.vat))]
src/rechnung/Invoice/InvoiceObjects.py 53)     if 'tender' not in data or not data['tender']:
src/rechnung/Invoice/InvoiceObjects.py 54)       self.vat[d['vat']][0] += d['total']
src/rechnung/Invoice/InvoiceObjects.py 55)       self.sum += d['total']
src/rechnung/Invoice/InvoiceObjects.py 56)     self.entries.append(d)
src/rechnung/Invoice/InvoiceObjects.py 57) 
src/rechnung/Invoice/InvoiceObjects.py 58) 
src/rechnung/Invoice/InvoiceObjects.py 59) 
src/rechnung/Invoice/InvoiceObjects.py 60) class Invoice(object):
Bernd Wurst Umbenannt aber wieder in ko...

Bernd Wurst authored 16 years ago

src/rechnung/Invoice/__init__.py       61)   tender = False
src/rechnung/Invoice/__init__.py       62)   caption = 'Rechnung'
src/rechnung/Invoice/__init__.py       63) 
src/rechnung/Invoice/__init__.py       64)   def __init__(self):
Bernd Wurst Struktur verändern (broken!)

Bernd Wurst authored 16 years ago

src/rechnung/Invoice/InvoiceObjects.py 65)     self.customerno = None
src/rechnung/Invoice/InvoiceObjects.py 66)     self.addresslines = ['', ]
Bernd Wurst Typo

Bernd Wurst authored 14 years ago

src/rechnung/Invoice/__init__.py       67)     self.salutation = 'Sehr geehrte Damen und Herren,'
Bernd Wurst Struktur verändern (broken!)

Bernd Wurst authored 16 years ago

src/rechnung/Invoice/InvoiceObjects.py 68)     self.id = None
src/rechnung/Invoice/InvoiceObjects.py 69)     self.parts = []
src/rechnung/Invoice/InvoiceObjects.py 70)     self.pagecount = 0
src/rechnung/Invoice/InvoiceObjects.py 71)     self.date = datetime.date.today()
src/rechnung/Invoice/InvoiceObjects.py 72) 
src/rechnung/Invoice/InvoiceObjects.py 73)   def setDate(self, date):
src/rechnung/Invoice/InvoiceObjects.py 74)     if type(date) != datetime.date:
src/rechnung/Invoice/InvoiceObjects.py 75)       raise ValueError('date must be of type »datetime.date«')
src/rechnung/Invoice/InvoiceObjects.py 76)     self.date = date