40e1cdab4627e1a0a7094e265a8c676bfeb55e1b
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py                1) # -*- coding: utf-8 -*-
Invoice/InvoiceToZUGFeRD.py                2) 
Bernd Wurst Kontoinhaber im XML einsetzen

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py                3) import os.path
Invoice/InvoiceToZUGFeRD.py                4) import sys
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py                5) from decimal import Decimal
Invoice/InvoiceToZUGFeRD.py                6) 
Invoice/InvoiceToZUGFeRD.py                7) # Search for included submodule python-drafthorse
Invoice/InvoiceToZUGFeRD.py                8) atoms = os.path.abspath(os.path.dirname(__file__)).split('/')
Invoice/InvoiceToZUGFeRD.py                9) dir = ''
Invoice/InvoiceToZUGFeRD.py               10) while atoms:
Invoice/InvoiceToZUGFeRD.py               11)     candidate = os.path.join('/'.join(atoms), 'external/python-drafthorse')
Invoice/InvoiceToZUGFeRD.py               12)     if os.path.exists(candidate):
Invoice/InvoiceToZUGFeRD.py               13)         dir = candidate
Invoice/InvoiceToZUGFeRD.py               14)         break
Invoice/InvoiceToZUGFeRD.py               15)     atoms = atoms[:-1]
Invoice/InvoiceToZUGFeRD.py               16) sys.path.insert(0, dir)
Invoice/InvoiceToZUGFeRD.py               17) from drafthorse.models.document import Document
Invoice/InvoiceToZUGFeRD.py               18) from drafthorse.models.accounting import ApplicableTradeTax
Invoice/InvoiceToZUGFeRD.py               19) from drafthorse.models.tradelines import LineItem
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               20) from .InvoiceObjects import InvoiceTable, InvoiceText, RECHNUNG, GUTSCHRIFT, KORREKTUR, \
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               21)     VAT_REGULAR, VAT_KLEINUNTERNEHMER, VAT_INNERGEM, PAYMENT_UEBERWEISUNG, PAYMENT_LASTSCHRIFT
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               22) from drafthorse.models.party import TaxRegistration, URIUniversalCommunication
Invoice/InvoiceToZUGFeRD.py               23) from drafthorse.models.payment import PaymentTerms
Invoice/InvoiceToZUGFeRD.py               24) from drafthorse.models.note import IncludedNote
Invoice/InvoiceToZUGFeRD.py               25) from drafthorse.pdf import attach_xml
Invoice/InvoiceToZUGFeRD.py               26) 
Bernd Wurst Test-Script lauffähig

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               27) 
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               28) def InvoiceToXML(invoice):
Invoice/InvoiceToZUGFeRD.py               29)     doc = Document()
Bernd Wurst Falscher ID-String

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               30)     doc.context.guideline_parameter.id = "urn:cen.eu:en16931:2017"
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               31)     doc.header.id = invoice.id
Invoice/InvoiceToZUGFeRD.py               32)     # Typecodes:
Invoice/InvoiceToZUGFeRD.py               33)     # 380: Handelsrechnungen
Invoice/InvoiceToZUGFeRD.py               34)     # 381: Gutschrift
Invoice/InvoiceToZUGFeRD.py               35)     # 384: Korrekturrechnung
Invoice/InvoiceToZUGFeRD.py               36)     # 389: Eigenrechnung (vom Käufer im Namen des Lieferanten erstellt).
Invoice/InvoiceToZUGFeRD.py               37)     # 261: Selbstverfasste Gutschrift.
Invoice/InvoiceToZUGFeRD.py               38)     # 386: Vorauszahlungsrechnung
Invoice/InvoiceToZUGFeRD.py               39)     # 326: Teilrechnung
Invoice/InvoiceToZUGFeRD.py               40)     # 751: Rechnungsinformation - KEINE RECHNUNG
Invoice/InvoiceToZUGFeRD.py               41)     if invoice.type == RECHNUNG:
Invoice/InvoiceToZUGFeRD.py               42)         doc.header.type_code = "380"
Invoice/InvoiceToZUGFeRD.py               43)     elif invoice.type == GUTSCHRIFT:
Invoice/InvoiceToZUGFeRD.py               44)         doc.header.type_code = "381"
Invoice/InvoiceToZUGFeRD.py               45)     elif invoice.type == KORREKTUR:
Invoice/InvoiceToZUGFeRD.py               46)         doc.header.type_code = "384"
Invoice/InvoiceToZUGFeRD.py               47)     else:
Invoice/InvoiceToZUGFeRD.py               48)         raise TypeError("Unbekannter Rechnungstyp, kann kein XML erstellen")
Invoice/InvoiceToZUGFeRD.py               49)     doc.header.issue_date_time = invoice.date
Invoice/InvoiceToZUGFeRD.py               50) 
Invoice/InvoiceToZUGFeRD.py               51)     # Seller-Address
Invoice/InvoiceToZUGFeRD.py               52)     if invoice.seller['trade_name']:
Invoice/InvoiceToZUGFeRD.py               53)         pass
Invoice/InvoiceToZUGFeRD.py               54)         # FIXME: specified_legal_organization ist in der Library nicht implementiert, pull request ist vorhanden
Bernd Wurst Kontoinhaber im XML einsetzen

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               55)         # doc.trade.agreement.seller.specified_legal_organization.trade_name = invoice.seller['trade_name']
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               56)     doc.trade.agreement.seller.name = invoice.seller['name']
Invoice/InvoiceToZUGFeRD.py               57)     doc.trade.agreement.seller.address.country_id = invoice.seller['address']['country_id']
Invoice/InvoiceToZUGFeRD.py               58)     doc.trade.agreement.seller.address.postcode = invoice.seller['address']['postcode']
Invoice/InvoiceToZUGFeRD.py               59)     doc.trade.agreement.seller.address.city_name = invoice.seller['address']['city_name']
Invoice/InvoiceToZUGFeRD.py               60)     doc.trade.agreement.seller.address.line_one = invoice.seller['address']['line1']
Invoice/InvoiceToZUGFeRD.py               61)     doc.trade.agreement.seller.address.line_two = invoice.seller['address']['line2']
Invoice/InvoiceToZUGFeRD.py               62)     doc.trade.agreement.seller.address.line_three = invoice.seller['address']['line3']
Bernd Wurst Telefonnummer

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               63)     if invoice.seller['phone']:
Invoice/InvoiceToZUGFeRD.py               64)         doc.trade.agreement.seller.contact.telephone.number = invoice.seller['phone']
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               65)     if invoice.seller_vat_id:
Invoice/InvoiceToZUGFeRD.py               66)         tax_reg = TaxRegistration()
Invoice/InvoiceToZUGFeRD.py               67)         tax_reg.id = ('VA', invoice.seller_vat_id)
Invoice/InvoiceToZUGFeRD.py               68)         doc.trade.agreement.seller.tax_registrations.add(tax_reg)
Invoice/InvoiceToZUGFeRD.py               69)     if invoice.seller['email']:
Invoice/InvoiceToZUGFeRD.py               70)         email = URIUniversalCommunication()
Invoice/InvoiceToZUGFeRD.py               71)         email.uri_ID = ('EM', invoice.seller['email'])
Invoice/InvoiceToZUGFeRD.py               72)         # FIXME: Typo in der Library ("adress")?
Invoice/InvoiceToZUGFeRD.py               73)         doc.trade.agreement.seller.electronic_adress.add(email)
Invoice/InvoiceToZUGFeRD.py               74) 
Invoice/InvoiceToZUGFeRD.py               75)     # Buyer-Address
Invoice/InvoiceToZUGFeRD.py               76)     doc.trade.agreement.buyer.name = invoice.customer['name']
Invoice/InvoiceToZUGFeRD.py               77)     doc.trade.agreement.buyer.address.country_id = invoice.customer['address']['country_id']
Invoice/InvoiceToZUGFeRD.py               78)     doc.trade.agreement.buyer.address.postcode = invoice.customer['address']['postcode']
Invoice/InvoiceToZUGFeRD.py               79)     doc.trade.agreement.buyer.address.city_name = invoice.customer['address']['city_name']
Invoice/InvoiceToZUGFeRD.py               80)     doc.trade.agreement.buyer.address.line_one = invoice.customer['address']['line1']
Invoice/InvoiceToZUGFeRD.py               81)     doc.trade.agreement.buyer.address.line_two = invoice.customer['address']['line2']
Invoice/InvoiceToZUGFeRD.py               82)     doc.trade.agreement.buyer.address.line_three = invoice.customer['address']['line3']
Invoice/InvoiceToZUGFeRD.py               83) 
Bernd Wurst Telefonnummer

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               84)     if invoice.buyer_reference:
Invoice/InvoiceToZUGFeRD.py               85)         # "Leitweg-ID" in XRechnung
Invoice/InvoiceToZUGFeRD.py               86)         doc.trade.agreement.buyer_reference = invoice.buyer_reference
Bernd Wurst Referenznummern auf allen A...

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               87)     if invoice.order_number:
Invoice/InvoiceToZUGFeRD.py               88)         doc.trade.agreement.buyer_order.issuer_assigned_id = invoice.order_number
Invoice/InvoiceToZUGFeRD.py               89)     if invoice.contract_number:
Invoice/InvoiceToZUGFeRD.py               90)         doc.trade.agreement.contract.issuer_assigned_id = invoice.contract_number
Bernd Wurst Telefonnummer

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               91) 
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py               92)     # Line Items
Invoice/InvoiceToZUGFeRD.py               93)     summe_netto = 0.0
Invoice/InvoiceToZUGFeRD.py               94)     summe_brutto = 0.0
Invoice/InvoiceToZUGFeRD.py               95)     summe_bezahlt = 0.0
Invoice/InvoiceToZUGFeRD.py               96)     summe_ust = 0.0
Invoice/InvoiceToZUGFeRD.py               97)     line_id_count = 0
Invoice/InvoiceToZUGFeRD.py               98)     textparts = []
Invoice/InvoiceToZUGFeRD.py               99)     for part in invoice.parts:
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              100)         if isinstance(part, InvoiceText):
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              101)             textparts += part.paragraphs
Bernd Wurst Codestyle-Fixes

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              102)         if isinstance(part, InvoiceTable):
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              103)             for el in part.entries:
Invoice/InvoiceToZUGFeRD.py              104)                 line_id_count += 1
Invoice/InvoiceToZUGFeRD.py              105)                 li = LineItem()
Invoice/InvoiceToZUGFeRD.py              106)                 li.document.line_id = f"{line_id_count}"
Invoice/InvoiceToZUGFeRD.py              107)                 li.product.name = el['subject']
Invoice/InvoiceToZUGFeRD.py              108)                 if 'desc' in el and el['desc'] != '':
Bernd Wurst typo

Bernd Wurst authored 9 months ago

src/rechnung/Invoice/InvoiceToZUGFeRD.py 109)                     li.product.description = el['desc']
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              110) 
Invoice/InvoiceToZUGFeRD.py              111)                 if 'period_start' in el and el['period_start']:
Invoice/InvoiceToZUGFeRD.py              112)                     if 'period_end' in el and el['period_end']:
Invoice/InvoiceToZUGFeRD.py              113)                         li.settlement.period.start = el['period_start']
Invoice/InvoiceToZUGFeRD.py              114)                         li.settlement.period.end = el['period_end']
Invoice/InvoiceToZUGFeRD.py              115)                     else:
Bernd Wurst Referenznummern auf allen A...

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              116)                         #li.delivery.event.occurrence = el['period_start']
Invoice/InvoiceToZUGFeRD.py              117)                         # FIXME: Fehler in drafthorse?! Wird nicht akzeptiert.
Invoice/InvoiceToZUGFeRD.py              118)                         pass
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              119) 
Invoice/InvoiceToZUGFeRD.py              120)                 # FIXME: Hier sollte der passende Code benutzt werden (z.B. Monat)
Bernd Wurst Kleine Korrekturen, mache B...

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              121)                 li.delivery.billed_quantity = (Decimal(el['count']), 'C62')
Invoice/InvoiceToZUGFeRD.py              122)                 # C62 = ohne Einheit
Invoice/InvoiceToZUGFeRD.py              123)                 # H87 = Stück
Invoice/InvoiceToZUGFeRD.py              124)                 # MON = Month
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              125)                 # LTR = Liter (1 dm3)
Invoice/InvoiceToZUGFeRD.py              126)                 # KGM = Kilogram
Invoice/InvoiceToZUGFeRD.py              127)                 # MTR = Meter
Invoice/InvoiceToZUGFeRD.py              128)                 # TNE = Tonne
Invoice/InvoiceToZUGFeRD.py              129) 
Invoice/InvoiceToZUGFeRD.py              130)                 li.settlement.trade_tax.type_code = "VAT"
Invoice/InvoiceToZUGFeRD.py              131)                 if invoice.vat_type == VAT_REGULAR:
Invoice/InvoiceToZUGFeRD.py              132)                     li.settlement.trade_tax.category_code = "S"
Invoice/InvoiceToZUGFeRD.py              133)                 elif invoice.vat_type == VAT_KLEINUNTERNEHMER:
Invoice/InvoiceToZUGFeRD.py              134)                     li.settlement.trade_tax.category_code = "E"
Invoice/InvoiceToZUGFeRD.py              135)                 elif invoice.vat_type == VAT_INNERGEM:
Invoice/InvoiceToZUGFeRD.py              136)                     li.settlement.trade_tax.category_code = "K"
Invoice/InvoiceToZUGFeRD.py              137)                 # FIXME: Typ bei uns nur global gesetzt, nicht pro Artikel
Invoice/InvoiceToZUGFeRD.py              138)                 # S = Standard VAT rate
Invoice/InvoiceToZUGFeRD.py              139)                 # Z = Zero rated goods
Invoice/InvoiceToZUGFeRD.py              140)                 # E = VAT exempt
Invoice/InvoiceToZUGFeRD.py              141)                 # AE = Reverse charge
Invoice/InvoiceToZUGFeRD.py              142)                 # K = Intra-Community supply (specific reverse charge)
Invoice/InvoiceToZUGFeRD.py              143)                 # G = Exempt VAT for Export outside EU
Invoice/InvoiceToZUGFeRD.py              144)                 # O = Outside VAT scope
Bernd Wurst Kontoinhaber im XML einsetzen

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              145)                 li.settlement.trade_tax.rate_applicable_percent = Decimal(f"{el['vat'] * 100:.1f}")
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              146) 
Invoice/InvoiceToZUGFeRD.py              147)                 nettopreis = el['price']
Invoice/InvoiceToZUGFeRD.py              148)                 if part.vatType == 'gross':
Invoice/InvoiceToZUGFeRD.py              149)                     nettopreis = el['price'] / (1 + el['vat'])
Invoice/InvoiceToZUGFeRD.py              150)                 li.agreement.net.amount = Decimal(f"{nettopreis:.2f}")
Invoice/InvoiceToZUGFeRD.py              151) 
Invoice/InvoiceToZUGFeRD.py              152)                 nettosumme = el['total']
Invoice/InvoiceToZUGFeRD.py              153)                 if part.vatType == 'gross':
Invoice/InvoiceToZUGFeRD.py              154)                     nettosumme = el['total'] / (1 + el['vat'])
Invoice/InvoiceToZUGFeRD.py              155)                 li.settlement.monetary_summation.total_amount = Decimal(f"{nettosumme:.2f}")
Invoice/InvoiceToZUGFeRD.py              156) 
Invoice/InvoiceToZUGFeRD.py              157)                 summe_netto += nettosumme
Invoice/InvoiceToZUGFeRD.py              158)                 summe_brutto += el['total']
Invoice/InvoiceToZUGFeRD.py              159)                 doc.trade.items.add(li)
Invoice/InvoiceToZUGFeRD.py              160) 
Invoice/InvoiceToZUGFeRD.py              161)             for pay in part.payments:
Invoice/InvoiceToZUGFeRD.py              162)                 summe_bezahlt += pay['amount']
Invoice/InvoiceToZUGFeRD.py              163) 
Invoice/InvoiceToZUGFeRD.py              164)             for vat, vatdata in part.vat.items():
Invoice/InvoiceToZUGFeRD.py              165)                 trade_tax = ApplicableTradeTax()
Invoice/InvoiceToZUGFeRD.py              166)                 # Steuerbetrag dieses Steuersatzes
Invoice/InvoiceToZUGFeRD.py              167)                 trade_tax.calculated_amount = Decimal(f"{(vatdata[0] / (vat + 1)) * vat:.2f}")
Invoice/InvoiceToZUGFeRD.py              168)                 # Nettosumme dieses Steuersatzes
Invoice/InvoiceToZUGFeRD.py              169)                 trade_tax.basis_amount = Decimal(f"{(vatdata[0] / (vat + 1)):.2f}")
Invoice/InvoiceToZUGFeRD.py              170)                 trade_tax.type_code = "VAT"
Invoice/InvoiceToZUGFeRD.py              171)                 if invoice.vat_type == VAT_REGULAR:
Invoice/InvoiceToZUGFeRD.py              172)                     trade_tax.category_code = "S"
Invoice/InvoiceToZUGFeRD.py              173)                 elif invoice.vat_type == VAT_KLEINUNTERNEHMER:
Invoice/InvoiceToZUGFeRD.py              174)                     trade_tax.category_code = "E"
Invoice/InvoiceToZUGFeRD.py              175)                     trade_tax.exemption_reason = 'Als Kleinunternehmer wird gemäß §19 UStG keine USt in Rechnung gestellt.'
Invoice/InvoiceToZUGFeRD.py              176)                 elif invoice.vat_type == VAT_INNERGEM:
Invoice/InvoiceToZUGFeRD.py              177)                     trade_tax.category_code = "K"
Bernd Wurst Kontoinhaber im XML einsetzen

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              178)                 trade_tax.rate_applicable_percent = Decimal(f"{vat * 100:.1f}")
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              179)                 summe_ust += (vatdata[0] / (vat + 1)) * vat
Invoice/InvoiceToZUGFeRD.py              180)                 doc.trade.settlement.trade_tax.add(trade_tax)
Invoice/InvoiceToZUGFeRD.py              181) 
Invoice/InvoiceToZUGFeRD.py              182)     for paragraph in textparts:
Invoice/InvoiceToZUGFeRD.py              183)         note = IncludedNote()
Invoice/InvoiceToZUGFeRD.py              184)         note.content.add(paragraph)
Invoice/InvoiceToZUGFeRD.py              185)         doc.header.notes.add(note)
Invoice/InvoiceToZUGFeRD.py              186) 
Invoice/InvoiceToZUGFeRD.py              187)     rest = summe_brutto - summe_bezahlt
Invoice/InvoiceToZUGFeRD.py              188) 
Invoice/InvoiceToZUGFeRD.py              189)     if invoice.creditor_reference_id:
Invoice/InvoiceToZUGFeRD.py              190)         # Gläubiger-ID für SEPA
Invoice/InvoiceToZUGFeRD.py              191)         doc.trade.settlement.creditor_reference_id = invoice.creditor_reference_id
Invoice/InvoiceToZUGFeRD.py              192)     doc.trade.settlement.payment_reference = invoice.id
Invoice/InvoiceToZUGFeRD.py              193)     doc.trade.settlement.currency_code = 'EUR'
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              194)     if invoice.payment_type:
Invoice/InvoiceToZUGFeRD.py              195)         doc.trade.settlement.payment_means.type_code = invoice.payment_type
Invoice/InvoiceToZUGFeRD.py              196) 
Invoice/InvoiceToZUGFeRD.py              197)     if invoice.seller_bank_data['iban'] and invoice.payment_type == PAYMENT_UEBERWEISUNG:
Bernd Wurst Kontoinhaber im XML einsetzen

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              198)         doc.trade.settlement.payment_means.payee_account.account_name = \
Invoice/InvoiceToZUGFeRD.py              199)             invoice.seller_bank_data['kontoinhaber'] or invoice.seller['trade_name'] or invoice.seller['name']
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              200)         doc.trade.settlement.payment_means.payee_account.iban = invoice.seller_bank_data['iban']
Bernd Wurst Kleine Korrekturen, mache B...

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              201)         if invoice.seller_bank_data['bic']:
Invoice/InvoiceToZUGFeRD.py              202)             doc.trade.settlement.payment_means.payee_institution.bic = invoice.seller_bank_data['bic']
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              203)     if invoice.buyer_bank_data['iban'] and invoice.payment_type == PAYMENT_LASTSCHRIFT:
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              204)         # Kunden-Bankverbindung bei Lastschrift
Invoice/InvoiceToZUGFeRD.py              205)         doc.trade.settlement.payment_means.payer_account.iban = invoice.buyer_bank_data['iban']
Invoice/InvoiceToZUGFeRD.py              206) 
Invoice/InvoiceToZUGFeRD.py              207)     terms = PaymentTerms()
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              208)     if invoice.due_date and invoice.payment_type == PAYMENT_UEBERWEISUNG:
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              209)         terms.description = f"Bitte begleichen Sie den Betrag bis zum {invoice.due_date.strftime('%d.%m.%Y')} ohne Abzüge."
Invoice/InvoiceToZUGFeRD.py              210)         terms.due = invoice.due_date
Bernd Wurst Kleine Korrekturen, mache B...

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              211)     if invoice.type in [GUTSCHRIFT, KORREKTUR]:
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              212)         terms.description = f"Wir überweisen den Betrag auf Ihr Konto."
Invoice/InvoiceToZUGFeRD.py              213)     elif invoice.debit:
Bernd Wurst In eigenes GIT ausgelagert

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              214)         if invoice.debit_mandate_id:
Invoice/InvoiceToZUGFeRD.py              215)             # Mandatsreferenz für Lastschrift
Invoice/InvoiceToZUGFeRD.py              216)             terms.debit_mandate_id = invoice.debit_mandate_id
Invoice/InvoiceToZUGFeRD.py              217)         terms.description = 'Wir buchen von Ihrem Konto ab.'
Invoice/InvoiceToZUGFeRD.py              218)     doc.trade.settlement.terms.add(terms)
Invoice/InvoiceToZUGFeRD.py              219) 
Invoice/InvoiceToZUGFeRD.py              220)     doc.trade.settlement.monetary_summation.line_total = Decimal(f"{summe_netto:.2f}")
Invoice/InvoiceToZUGFeRD.py              221)     doc.trade.settlement.monetary_summation.charge_total = Decimal("0.00")
Invoice/InvoiceToZUGFeRD.py              222)     doc.trade.settlement.monetary_summation.allowance_total = Decimal("0.00")
Invoice/InvoiceToZUGFeRD.py              223)     doc.trade.settlement.monetary_summation.tax_basis_total = Decimal(f"{summe_netto:.2f}")
Invoice/InvoiceToZUGFeRD.py              224)     doc.trade.settlement.monetary_summation.tax_total = (Decimal(f"{summe_ust:.2f}"), "EUR")
Invoice/InvoiceToZUGFeRD.py              225)     doc.trade.settlement.monetary_summation.prepaid_total = Decimal(f"{summe_bezahlt:.2f}")
Invoice/InvoiceToZUGFeRD.py              226)     doc.trade.settlement.monetary_summation.grand_total = Decimal(f"{summe_brutto:.2f}")
Invoice/InvoiceToZUGFeRD.py              227)     doc.trade.settlement.monetary_summation.due_amount = Decimal(f"{rest:.2f}")
Invoice/InvoiceToZUGFeRD.py              228) 
Invoice/InvoiceToZUGFeRD.py              229)     # Generate XML file
Bernd Wurst WiP

Bernd Wurst authored 9 months ago

Invoice/InvoiceToZUGFeRD.py              230)     xml = doc.serialize(schema="FACTUR-X_EN16931")