Bernd Wurst commited on 2024-02-15 06:12:11
Zeige 3 geänderte Dateien mit 13 Einfügungen und 0 Löschungen.
| ... | ... |
@@ -83,6 +83,9 @@ def InvoiceTableToText(invoiceTable: InvoiceTable): |
| 83 | 83 |
ret.append(u'-' * 72) |
| 84 | 84 |
|
| 85 | 85 |
for el in invoiceTable.entries: |
| 86 |
+ if el['type'] == 'title': |
|
| 87 |
+ ret.append('\n'.join(_breakLine(el['title'])))
|
|
| 88 |
+ continue |
|
| 86 | 89 |
unit = '' |
| 87 | 90 |
if el['unit']: |
| 88 | 91 |
unit = ' %s' % el['unit'] |
| ... | ... |
@@ -100,10 +100,19 @@ def InvoiceToXML(invoice): |
| 100 | 100 |
if isinstance(part, InvoiceText): |
| 101 | 101 |
textparts += part.paragraphs |
| 102 | 102 |
if isinstance(part, InvoiceTable): |
| 103 |
+ last_title = None |
|
| 103 | 104 |
for el in part.entries: |
| 105 |
+ if el['type'] == 'title': |
|
| 106 |
+ # Diese Information ist im XML nicht auf diese Weise darstellbar |
|
| 107 |
+ last_title = el['title'] |
|
| 108 |
+ continue |
|
| 104 | 109 |
line_id_count += 1 |
| 105 | 110 |
li = LineItem() |
| 106 | 111 |
li.document.line_id = f"{line_id_count}"
|
| 112 |
+ if last_title: |
|
| 113 |
+ title = IncludedNote() |
|
| 114 |
+ title.content.add(last_title) |
|
| 115 |
+ li.document.notes.add(title) |
|
| 107 | 116 |
li.product.name = el['subject'] |
| 108 | 117 |
if 'desc' in el and el['desc'] != '': |
| 109 | 118 |
li.product.description = el['desc'] |
| ... | ... |
@@ -88,6 +88,7 @@ if __name__ == '__main__': |
| 88 | 88 |
vatType = 'gross' # Entscheidet anhand des ersten Eintrags ob die Rechnung Netto oder Brutto gestellt wird |
| 89 | 89 |
tab = InvoiceTable(vatType=vatType) |
| 90 | 90 |
|
| 91 |
+ tab.addTitle("Zwischenüberschrift in der Tabelle")
|
|
| 91 | 92 |
for item in data: |
| 92 | 93 |
# Der Betrag muss immer positiv sein, bei Gutschriften wird nur die Anzahl negativ. |
| 93 | 94 |
count = float(item['anzahl']) |
| 94 | 95 |