Referenznummern auf allen Ausgabeformaten
Bernd Wurst

Bernd Wurst commited on 2024-02-09 17:04:40
Zeige 4 geänderte Dateien mit 34 Einfügungen und 1 Löschungen.

... ...
@@ -159,8 +159,10 @@ class Invoice(object):
159 159
         self.due_date = None
160 160
         self.debit = False
161 161
         self.payment_type = PAYMENT_UEBERWEISUNG
162
+        self.leitweg_id = None
162 163
         self.buyer_reference = None
163 164
         self.order_number = None
165
+        self.contract_number = None
164 166
         self.debit_mandate_id = None
165 167
         self.creditor_reference_id = None
166 168
         self.buyer_bank_data = {
... ...
@@ -347,6 +347,22 @@ class PDF(object):
347 347
             self.canvas.drawString(self.rightcolumn, self.y, "Kundennummer:")
348 348
             self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.customerno)
349 349
             self.y -= (self.font_size + 0.5 * cm)
350
+        if self.invoice.leitweg_id:
351
+            self.canvas.drawString(self.rightcolumn, self.y, "Leitweg-ID:")
352
+            self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.leitweg_id)
353
+            self.y -= (self.font_size + 0.1 * cm)
354
+        if self.invoice.buyer_reference:
355
+            self.canvas.drawString(self.rightcolumn, self.y, "Kunden-Referenz:")
356
+            self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.buyer_reference)
357
+            self.y -= (self.font_size + 0.1 * cm)
358
+        if self.invoice.contract_number:
359
+            self.canvas.drawString(self.rightcolumn, self.y, "Vertragsnummer:")
360
+            self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.contract_number)
361
+            self.y -= (self.font_size + 0.1 * cm)
362
+        if self.invoice.order_number:
363
+            self.canvas.drawString(self.rightcolumn, self.y, "Ihre Bestellnummer:")
364
+            self.canvas.drawRightString(self.rightcontent, self.y, "%s" % self.invoice.order_number)
365
+            self.y -= (self.font_size + 0.1 * cm)
350 366
         self.canvas.setFont(self.font, self.font_size)
351 367
 
352 368
         if self.invoice.salutation:
... ...
@@ -39,6 +39,15 @@ def InvoiceToText(invoice: Invoice):
39 39
     ret.append(f'Rechnungsnummer: {invoice.id}')
40 40
     ret.append(f'Rechnungsdatum:  {invoice.date.strftime("%d.%m.%Y")}')
41 41
 
42
+    if invoice.leitweg_id:
43
+        ret.append(f'Leitweg-ID:      {invoice.leitweg_id}')
44
+    if invoice.buyer_reference:
45
+        ret.append(f'Kunden-Referenz: {invoice.buyer_reference}')
46
+    if invoice.contract_number:
47
+        ret.append(f'Vertragsnummer:  {invoice.contract_number}')
48
+    if invoice.order_number:
49
+        ret.append(f'Ihre Bestellnummer: {invoice.order_number}')
50
+
42 51
     ret.append('')
43 52
     for part in invoice.parts:
44 53
         if isinstance(part, InvoiceTable):
... ...
@@ -99,6 +99,10 @@ def InvoiceToXML(invoice):
99 99
     if invoice.buyer_reference:
100 100
         # "Leitweg-ID" in XRechnung
101 101
         doc.trade.agreement.buyer_reference = invoice.buyer_reference
102
+    if invoice.order_number:
103
+        doc.trade.agreement.buyer_order.issuer_assigned_id = invoice.order_number
104
+    if invoice.contract_number:
105
+        doc.trade.agreement.contract.issuer_assigned_id = invoice.contract_number
102 106
 
103 107
     # Line Items
104 108
     summe_netto = 0.0
... ...
@@ -124,7 +128,9 @@ def InvoiceToXML(invoice):
124 128
                         li.settlement.period.start = el['period_start']
125 129
                         li.settlement.period.end = el['period_end']
126 130
                     else:
127
-                        li.delivery.event.occurrence = el['period_start']
131
+                        #li.delivery.event.occurrence = el['period_start']
132
+                        # FIXME: Fehler in drafthorse?! Wird nicht akzeptiert.
133
+                        pass
128 134
 
129 135
                 # FIXME: Hier sollte der passende Code benutzt werden (z.B. Monat)
130 136
                 li.delivery.billed_quantity = (Decimal(el['count']), 'C62')
131 137