feat(accounting): Ausgangsrechnungen als ZUGFeRD-E-Rechnung (EN 16931) erzeugen

Rechnungen, Abschlags-, Storno- und Serienrechnungen erhalten beim
Fertigstellen ein eingebettetes factur-x.xml (CII, Profil EN 16931) samt
Factur-X-XMP-Metadaten. Das XML wird serverseitig aus dem gespeicherten
Beleg erzeugt; fehlende Pflichtangaben werden als Hinweis gemeldet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-04 10:15:23 +01:00
parent bd768e404d
commit 549b469a41
9 changed files with 726 additions and 8 deletions

View File

@@ -1764,7 +1764,7 @@ const getDocumentData = async () => {
const showDocument = ref(false)
const uri = ref("")
const generateDocument = async () => {
const generateDocument = async (options = {}) => {
showDocument.value = false
const selectedLetterhead = getSelectedLetterhead()
@@ -1775,7 +1775,7 @@ const generateDocument = async () => {
const path = selectedLetterhead.path
uri.value = await useFunctions().useCreatePDF(await getDocumentData(), path, "createdDocument")
uri.value = await useFunctions().useCreatePDF(await getDocumentData(), path, "createdDocument", options)
/*uri.value = await useNuxtApp().$api("/api/functions/createinvoicepdf",{
method: "POST",
body: {
@@ -2048,7 +2048,19 @@ const closeDocument = async () => {
// Erzeugt die PDF aus dem aktuellen Stand und hängt sie an den Beleg an, ohne den Datensatz zu speichern
const uploadGeneratedDocument = async () => {
await generateDocument()
// Rechnungen werden als E-Rechnung (ZUGFeRD) abgelegt; das XML erzeugt das Backend aus dem gespeicherten Beleg
await generateDocument({
createdDocumentId: itemInfo.value.id,
onResult: (result) => {
if (result?.einvoiceWarnings?.length) {
toast.add({
title: result.einvoice ? "E-Rechnung mit Hinweisen erstellt" : "E-Rechnung konnte nicht erstellt werden",
description: result.einvoiceWarnings.join(" · "),
color: "warning",
})
}
},
})
if (!uri.value) throw new Error("PDF konnte nicht erzeugt werden")