Add function to retrieve company address as JSON and update invoice procedures

- 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.
This commit is contained in:
2026-07-18 18:01:24 +02:00
parent 5ccd85c38f
commit 628802db19
45 changed files with 1892 additions and 26 deletions
+10 -2
View File
@@ -90,8 +90,12 @@ payload; see `EVAL_live_invoice_editing.md` for the rationale.
### 4.1 What the user can change
- **Line items** — quantities, prices, notes, combine into one sum
(`$inv.rendersrq`, `$inv.quantChange`).
- **Recipient fields** — invoice title, address, email, provision
location/period (inline edit fields, `fm(...)` helper in `fis.inv_shared.js`).
- **Recipient fields** — invoice title, email, provision location/period (inline
edit fields, `fm(...)` helper in `fis.inv_shared.js`). The **recipient address**
is edited via a **structured dialog** (`$inv.eAddress`: name, street, PLZ, city,
country, optional VAT id) prefilled from `fds__prepInvoice`'s `invoiceaddressData`;
it drives the EN 16931 eRechnung and composes the free-text `SendToAddress` for the
PDF (see [`Concepts/erechnung-output.md`](Concepts/erechnung-output.md)).
- **§13b reverse-charge** toggle (`$inv.sp13b`) — suppresses VAT lines/columns.
- **Set-pricing display mode** (`$inv.ssetmode` / `setSetmode`) — `SetPrice`
(default) / `SetOnly`; see `INVOICE_SET_PRICING.md`. Purely presentational
@@ -360,6 +364,10 @@ flowchart TD
- **Draft vs. final changes the rendered PDF**: draft = watermark overlay, no
GiroCode; final = no watermark, GiroCode payment QR added when there's a
positive balance.
- **Final invoices can be emitted as eRechnung**: when `Fuchs:ERechnung:Enabled`,
the final PDF is a ZUGFeRD/Factur-X **PDF/A-3 hybrid** (eRechnungLib embeds the
CII XML into the render-only visual PDF; any failure falls back to the plain
PDF/A). Off by default. See [`Concepts/erechnung-output.md`](Concepts/erechnung-output.md).
- **Email is best-effort and tracked**: `IsSent` is only set `true`
automatically after a *successful* send; a failed send still leaves a
correctly finalised, stored invoice that staff can resend or mark sent