feat(accounting): Skontobedingungen auf Belegen und automatische Skonto-Vorschläge
Ausgangs- und Eingangsbelege erhalten Skontosatz und Frist, mit Vorgaben bei Kunden und Lieferanten. Das PDF ergänzt automatisch einen Skontohinweis (oder nutzt neue Textvorlagen-Variablen); bei Schlussrechnungen gilt der Skonto für die Restforderung. Skontobedingungen werden aus E-Rechnungen (#SKONTO# und ZUGFeRD) sowie von der KI-Vorbereitung übernommen. Die Bankzuordnung erkennt Zahlungen abzüglich Skonto innerhalb der Frist und bietet sie in der Vorschlagsübersicht direkt an. BWA-Erlöse und -Aufwand berücksichtigen gebuchten Skonto im Zeitraum der Zahlung. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,3 +66,27 @@ test("markiert Summenabweichungen als Prüfungsfehler", () => {
|
||||
|
||||
assert.match(parsed.validation.errors.join(" "), /Positionssumme/)
|
||||
})
|
||||
|
||||
test("reads XRechnung cash discount terms from CII payment terms", async () => {
|
||||
const xml = Buffer.from(ciiInvoice.toString().replace(
|
||||
"<ram:SpecifiedTradePaymentTerms>",
|
||||
"<ram:SpecifiedTradePaymentTerms><ram:Description>#SKONTO#TAGE=10#PROZENT=2.00#\n</ram:Description>",
|
||||
))
|
||||
const detection = await detectElectronicInvoice(xml, { name: "rechnung.xml" })
|
||||
const parsed = parseElectronicInvoice(detection!.xml, detection!.syntax)
|
||||
assert.deepEqual(parsed.cashDiscount, { percent: 2, days: 10 })
|
||||
|
||||
const mapped = mapElectronicInvoiceToIncomingInvoice(parsed, 1, 5, "xml", null)
|
||||
assert.equal(mapped.cashDiscountPercent, 2)
|
||||
assert.equal(mapped.cashDiscountDueDate, "2026-07-31")
|
||||
})
|
||||
|
||||
test("reads cash discount terms from UBL payment terms notes", async () => {
|
||||
const xml = Buffer.from(ublInvoice.toString().replace(
|
||||
"<cac:PaymentMeans>",
|
||||
"<cac:PaymentTerms><cbc:Note>#SKONTO#TAGE=14#PROZENT=3.00#</cbc:Note></cac:PaymentTerms><cac:PaymentMeans>",
|
||||
))
|
||||
const detection = await detectElectronicInvoice(xml, { name: "xrechnung.xml" })
|
||||
const parsed = parseElectronicInvoice(detection!.xml, detection!.syntax)
|
||||
assert.deepEqual(parsed.cashDiscount, { percent: 3, days: 14 })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user