Bernd Wurst commited on 2024-03-23 11:36:18
Zeige 3 geänderte Dateien mit 48 Einfügungen und 9 Löschungen.
... | ... |
@@ -100,6 +100,40 @@ PAYMENT_ONLINE = "68" |
100 | 100 |
PAYMENT_BAR = "10" |
101 | 101 |
PAYMENT_KARTE = "48" |
102 | 102 |
|
103 |
+UNITS = { |
|
104 |
+ # key = XML-Code, value = (Langform Einzahl, Langform Mehrzahl, Kurzform, [mögliche weitere Schreibweisen,...]) |
|
105 |
+ 'H87': ('Stück', 'Stück', 'Stk', 'pcs'), |
|
106 |
+ 'SEC': ('Sekunde', 'Sekunden', 's', 'Sek.', 'Sek'), |
|
107 |
+ 'MIN': ('Minute', 'Minuten', 'min', 'Min.', 'Min'), |
|
108 |
+ 'HUR': ('Stunde', 'Stunden', 'h', 'Std.', 'Std'), |
|
109 |
+ 'DAY': ('Tag', 'Tage', 'Tg', 'd'), |
|
110 |
+ 'WEE': ('Woche', 'Wochen', 'Woch.', 'Woch'), |
|
111 |
+ 'MON': ('Monat', 'Monate', 'Mon.', 'Mon'), |
|
112 |
+ 'ANN': ('Jahr', 'Jahre', 'J.', 'y'), |
|
113 |
+ 'LTR': ('Liter', 'Liter', 'l', 'Ltr'), |
|
114 |
+ 'MTQ': ('Kubikmeter', 'Kubikmeter', 'm³', 'cbm'), |
|
115 |
+ 'GRM': ('Gramm', 'Gramm', 'g', 'Gr', 'gr'), |
|
116 |
+ 'KGM': ('Kilogramm', 'Kilogramm', 'kg', 'Kilo'), |
|
117 |
+ 'TNE': ('Tonne', 'Tonnen', 't'), |
|
118 |
+ 'DTN': ('Dezitonne', 'Dezitonnen', 'dt'), |
|
119 |
+ 'MTR': ('Meter', 'Meter', 'm', 'Mtr'), |
|
120 |
+ 'MMT': ('Millimeter', 'Millimeter', 'mm'), |
|
121 |
+ 'KMT': ('Kilometer', 'Kilometer', 'km'), |
|
122 |
+ 'MTK': ('Quadratmeter', 'Quadratmeter', 'm²', 'qm'), |
|
123 |
+ 'KWT': ('Kilowatt', 'Kilowatt', 'kW'), |
|
124 |
+ 'MAW': ('Megawatt', 'Megawatt', 'MW'), |
|
125 |
+ 'KWH': ('Kilowattstunde', 'Kilowattstunden', 'kWh'), |
|
126 |
+ 'MWH': ('Megawattstunde', 'Megawattstunden', 'MWh'), |
|
127 |
+ 'D97': ('Palette', 'Paletten', 'Pal'), |
|
128 |
+ 'AD': ('Byte', 'Bytes', 'Byte', 'octet', 'octets'), |
|
129 |
+ '2P': ('Kilobyte', 'Kilobytes', 'KB'), |
|
130 |
+ '4L': ('Megabyte', 'Megabytes', 'MB'), |
|
131 |
+ 'E34': ('Gigabyte', 'Gigabytes', 'GB'), |
|
132 |
+ 'E35': ('Terabyte', 'Terabytes', 'TB'), |
|
133 |
+ 'E36': ('Petabyte', 'Petabytes', 'PB'), |
|
134 |
+ '1I': ('Pauschal', 'Pauschale', 'Psch.', 'Psch'), |
|
135 |
+} |
|
136 |
+ |
|
103 | 137 |
|
104 | 138 |
class Invoice(object): |
105 | 139 |
def __init__(self, tender=False): |
... | ... |
@@ -18,7 +18,7 @@ from drafthorse.models.document import Document |
18 | 18 |
from drafthorse.models.accounting import ApplicableTradeTax |
19 | 19 |
from drafthorse.models.tradelines import LineItem |
20 | 20 |
from .InvoiceObjects import InvoiceTable, InvoiceText, RECHNUNG, GUTSCHRIFT, KORREKTUR, \ |
21 |
- VAT_REGULAR, VAT_KLEINUNTERNEHMER, VAT_INNERGEM, PAYMENT_UEBERWEISUNG, PAYMENT_LASTSCHRIFT |
|
21 |
+ VAT_REGULAR, VAT_KLEINUNTERNEHMER, VAT_INNERGEM, PAYMENT_UEBERWEISUNG, PAYMENT_LASTSCHRIFT, UNITS |
|
22 | 22 |
from drafthorse.models.party import TaxRegistration, URIUniversalCommunication |
23 | 23 |
from drafthorse.models.payment import PaymentTerms |
24 | 24 |
from drafthorse.models.note import IncludedNote |
... | ... |
@@ -121,15 +121,20 @@ def InvoiceToXML(invoice): |
121 | 121 |
else: |
122 | 122 |
li.settlement.period.end = el['period_start'] |
123 | 123 |
|
124 |
- # FIXME: Hier sollte der passende Code benutzt werden (z.B. Monat) |
|
125 |
- li.delivery.billed_quantity = (Decimal(el['count']), 'C62') |
|
124 |
+ unit = 'C62' |
|
125 |
+ if el['unit']: |
|
126 |
+ for key, value in UNITS.items(): |
|
127 |
+ if el['unit'] in value: |
|
128 |
+ unit = key |
|
129 |
+ li.delivery.billed_quantity = (Decimal(el['count']), unit) |
|
126 | 130 |
# C62 = ohne Einheit |
127 | 131 |
# H87 = Stück |
128 |
- # MON = Month |
|
129 |
- # LTR = Liter (1 dm3) |
|
130 |
- # KGM = Kilogram |
|
131 |
- # MTR = Meter |
|
132 |
- # TNE = Tonne |
|
132 |
+ # MON = Month, SEC = second, MIN = minute, HUR = hour, DAY = day, WEE = week, ANN = year |
|
133 |
+ # LTR = Liter, MTQ = m³ |
|
134 |
+ # GRM = gram, KGM = Kilogram, TNE = Tonne, DTN = decitonne, |
|
135 |
+ # MTR = Meter, MMT = Millimeter, KMT = Kilometer |
|
136 |
+ # MTK = m² |
|
137 |
+ # KWT = kW, MAW = MW, KWH = kWh, MWH = MWh |
|
133 | 138 |
|
134 | 139 |
li.settlement.trade_tax.type_code = "VAT" |
135 | 140 |
if invoice.vat_type == VAT_REGULAR: |