<?xml version="1.0" encoding="UTF-8"?>
<!--
  ==========================================================================
  XRECHNUNG UBL 2.1 — ABSICHTLICH UNGÜLTIGES TESTDOKUMENT
  XRechnung UBL 2.1 — Intentionally Invalid Test Document
  ==========================================================================
  Format:    XRechnung 3.0.2 / UBL 2.1 (deliberately invalid)
  Zweck:     Zum Testen von Validatoren und Fehlerbehandlung
  Purpose:   For testing validators and error handling workflows

  WARNUNG / WARNING:
  Dieses Dokument ist ABSICHTLICH ungültig und enthält mehrere Fehler,
  die häufig in der Praxis vorkommen. Es darf NICHT als echte Rechnung
  verwendet werden.

  This document is INTENTIONALLY invalid and contains multiple errors
  commonly found in practice. It MUST NOT be used as a real invoice.

  Enthaltene Fehler / Errors included:
  1.  BT-10 (Käuferreferenz/Leitweg-ID) fehlt vollständig — BR-DE-15
  2.  BT-31 (USt-IdNr. des Lieferanten) fehlt — BR-DE-1
  3.  BT-2 (Rechnungsdatum) hat ungültiges Format (kein ISO 8601)
  4.  Summen rechnerisch inkonsistent: BT-115 ≠ BT-109 + BT-110
  5.  BT-118 (Steuerkategorie-Code) enthält ungültigen Wert „XX"
  6.  Positionsnummer BT-126 beginnt nicht bei 1 und ist nicht eindeutig
  7.  BT-84 (IBAN) fehlt bei Überweisung (PaymentMeansCode 30)
  8.  BT-106 ≠ Summe der Positionsbeträge (rechnerischer Fehler)

  Quelle / Source: docutools.pro — https://docutools.pro/vorlagen
  ==========================================================================
-->
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
         xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">

  <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_3.0</cbc:CustomizationID>

  <!-- BT-1: Rechnungsnummer -->
  <cbc:ID>FEHLER-RECHNUNG-001</cbc:ID>

  <!-- FEHLER 3: BT-2 Datum in falschem Format (sollte YYYY-MM-DD sein) -->
  <cbc:IssueDate>15.05.2025</cbc:IssueDate>

  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>

  <!-- FEHLER 1: BT-10 Käuferreferenz/Leitweg-ID fehlt komplett -->
  <!-- <cbc:BuyerReference>991-12345678-06</cbc:BuyerReference> -->
  <!-- → Verstößt gegen BR-DE-15: Die Leitweg-ID ist bei XRechnung verpflichtend -->

  <cac:AccountingSupplierParty>
    <cac:Party>
      <cbc:EndpointID schemeID="EM">test@fehler-firma.de</cbc:EndpointID>
      <cac:PartyName>
        <cbc:Name>Fehler GmbH</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>Teststraße 1</cbc:StreetName>
        <cbc:PostalZone>12345</cbc:PostalZone>
        <cbc:CityName>Teststadt</cbc:CityName>
        <cac:Country>
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>

      <!-- FEHLER 2: BT-31 USt-IdNr. fehlt -->
      <!-- <cac:PartyTaxScheme> -->
      <!--   <cbc:CompanyID>DE123456789</cbc:CompanyID> -->
      <!--   <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme> -->
      <!-- </cac:PartyTaxScheme> -->
      <!-- → Verstößt gegen BR-DE-1 -->

      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Fehler GmbH</cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingSupplierParty>

  <cac:AccountingCustomerParty>
    <cac:Party>
      <cac:PostalAddress>
        <cbc:StreetName>Empfängerweg 5</cbc:StreetName>
        <cbc:PostalZone>54321</cbc:PostalZone>
        <cbc:CityName>Empfängerstadt</cbc:CityName>
        <cac:Country>
          <cbc:IdentificationCode>DE</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>Test Behörde</cbc:RegistrationName>
      </cac:PartyLegalEntity>
    </cac:Party>
  </cac:AccountingCustomerParty>

  <!-- FEHLER 7: PaymentMeansCode 30 (Überweisung) ohne IBAN -->
  <cac:PaymentMeans>
    <cbc:PaymentMeansCode>30</cbc:PaymentMeansCode>
    <!-- Keine PayeeFinancialAccount mit IBAN → ungültig für Überweisung -->
  </cac:PaymentMeans>

  <cac:TaxTotal>
    <!-- BT-110: Steuerbetrag -->
    <cbc:TaxAmount currencyID="EUR">190.00</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="EUR">1000.00</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="EUR">190.00</cbc:TaxAmount>
      <cac:TaxCategory>
        <!-- FEHLER 5: BT-118 enthält ungültigen Code „XX" (gültig wäre z. B. „S", „Z", „AE") -->
        <cbc:ID>XX</cbc:ID>
        <cbc:Percent>19</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>

  <cac:LegalMonetaryTotal>
    <!-- FEHLER 8: BT-106 = 999.00, aber Summe der Positionen = 1000.00 -->
    <cbc:LineExtensionAmount currencyID="EUR">999.00</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="EUR">1000.00</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="EUR">1190.00</cbc:TaxInclusiveAmount>
    <!-- FEHLER 4: BT-115 = 1500.00, aber BT-109 (1000) + BT-110 (190) = 1190 -->
    <cbc:PayableAmount currencyID="EUR">1500.00</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>

  <!-- FEHLER 6: Positionsnummern 5 und 5 (Duplikat, beginnt nicht bei 1) -->
  <cac:InvoiceLine>
    <cbc:ID>5</cbc:ID>
    <cbc:InvoicedQuantity unitCode="HUR">10</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="EUR">600.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Description>Testleistung A</cbc:Description>
      <cbc:Name>Testleistung</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>19</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="EUR">60.00</cbc:PriceAmount>
    </cac:Price>
  </cac:InvoiceLine>

  <!-- Duplikat-ID: ebenfalls 5 -->
  <cac:InvoiceLine>
    <cbc:ID>5</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">4</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="EUR">400.00</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Description>Testleistung B</cbc:Description>
      <cbc:Name>Testleistung</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>19</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="EUR">100.00</cbc:PriceAmount>
    </cac:Price>
  </cac:InvoiceLine>

</Invoice>
