- Created a new function `fds__getCompanyAddressJson` to return a company's postal address as a structured JSON object.
- Modified stored procedures `fds__createInvoice`, `fds__setInvoice`, and `fds__prepInvoice` to include a new parameter `@SendToAddressJson` for handling the address data.
- Updated the invoice table and user-defined types to accommodate the new `SendToAddressJson` field.
- Ensured that the address data is properly retrieved and stored in the invoice records.
Finalized invoices are emitted as a ZUGFeRD 2.4 / Factur-X hybrid: the FuchsPdf visual PDF
with the EN 16931 CII XML embedded, in a formally conformant PDF/A-3. This makes invoices
DATEV-ingestible and satisfies the B2B/B2G e-invoicing mandate. The library doing the structured
XML + PDF/A-3 work is the eRechnungLib submodule; Fuchs supplies the invoice data and the visual
PDF.
Single PDF/A engine (ADR 0012). eRechnungLib owns the one PDF/A-3 layer. For the eRechnung
path the Spire PDF/A step is skipped (DocToPdfBytesRaw); Spire stays only for on-screen preview
rasterisation. This avoids a conflicting second output intent / pdfaid marker.
Structured recipient address.InvoiceRecipientAddress holds the EN 16931 buyer fields
(name, street, post code, city, country BT-55, optional VAT id BT-48). It is edited via a
dialog form ($inv.eAddress in fis.inv_shared.js), prefilled from fds__prepInvoice's
invoiceaddressData, and carried as a JSON object through the draft cache. A private person
(no VAT id) is fully valid — B2C stays effortless. The free-text SendToAddress is composed
from it so the PDF layout is unchanged.
Mapping.ERechnungMapper maps the Fuchs invoice to the EN 16931 model: seller = Fuchs
(constants mirroring the FuchsPdf letterhead — name, Steuernummer BT-32, IBAN/BIC), buyer =
the structured recipient, lines from the invoice items, §13b → reverse charge (category AE +
exemption reason). VAT breakdown and totals are recomputed by the library.
Feature flag & fallback. Emission is gated by Fuchs:ERechnung:Enabled (off until fully
validated). IERechnungService returns null on disable or any failure, so
RenderInvoicePdfBytesAsync falls back to the plain Spire PDF/A — invoicing never breaks.
Formal verification.Fuchs:ERechnung:Validation:ServiceUrl is the seam for an external
online veraPDF (PDF/A-3) + ZUGFeRD validator; until the URL is provisioned, verification is
reported as not-configured.