XRechnung 2.4.0 · UBL

BR-DE-18

XRechnung 2.4.0 · UBL

fatalcountry

Original rule text

[BR-DE-18] Skonto Zeilen in müssen diesem regulärem Ausdruck entsprechen: . Die Informationen zur Gewährung von Skonto müssen wie folgt im Element "Payment terms" (BT-20) übermittelt werden: Anzugeben ist im ersten Segment "SKONTO", im zweiten "TAGE=n", im dritten "PROZENT=n". Prozentzahlen sind ohne Vorzeichen sowie mit Punkt getrennt von zwei Nachkommastellen anzugeben. Liegt dem zu berechnenden Betrag nicht BT-115, "fälliger Betrag" zugrunde, sondern nur ein Teil des fälligen Betrags der Rechnung, ist der Grundwert zur Berechnung von Skonto als viertes Segment "BASISBETRAG=n" gemäß dem semantischen Datentypen Amount anzugeben. Jeder Eintrag beginnt mit einer #, die Segmente sind mit einer # getrennt und eine Zeile schließt mit einer # ab. Am Ende einer vollständigen Skontoangabe muss ein XML-konformer Zeilenumbruch folgen. Alle Angaben zur Gewährung von Skonto müssen in Großbuchstaben gemacht werden. Zusätzliches Whitespace (Leerzeichen, Tabulatoren oder Zeilenumbrüche) ist nicht zulässig. Andere Zeichen oder Texte als in den oberen Vorgaben genannt sind nicht zulässig.

Stored validation assertion
every $line in             cac:PaymentTerms/cbc:Note[1]/tokenize(. , '(\r?\n)')[starts-with( normalize-space(.) , '#')]              satisfies matches ( normalize-space ($line), $XR-SKONTO-REGEX)                                  and                                 matches( cac:PaymentTerms/cbc:Note[1]/tokenize(. ,  '#.+#')[last()], '^\s*\n' )

What this rule requires

The XRechnung rule BR-DE-18 requires that discount terms ("Skonto") in the first cac:PaymentTerms/cbc:Note element (BT-20 "Payment terms") are written as lines beginning with # in exactly the form #SKONTO#TAGE=n#PROZENT=n[#BASISBETRAG=n]#, with TAGE as digits, PROZENT as unsigned decimal with a dot and two decimal places, and an optional signed BASISBETRAG amount with two decimal places. A line fails if it starts with # but does not match that pattern after normalize-space(), or if the final line does not end with a newline. As this is a fatal rule, such a document fails validation.

How to fix

In cac:PaymentTerms/cbc:Note (BT-20), set each Skonto entry to a single line matching the required uppercase format, for example #SKONTO#TAGE=14#PROZENT=2.00# or #SKONTO#TAGE=14#PROZENT=2.00#BASISBETRAG=100.00#, and ensure the note ends with an XML line break (\n or \r\n) after the last #. Check that segments are separated by #, there is no whitespace inside a segment, PROZENT has exactly two decimal places, BASISBETRAG has two decimal places if present, and only the literal uppercase segment names are used.

Guidance on this rule. The original text above is authoritative.