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
@@ -18,7 +18,8 @@ CREATE PROCEDURE [dbo].[fds__setInvoice]
@ProvisionPeriod varchar(50),
@CustomValues nvarchar(max),
@authuser varchar(25),
@Id varchar(10) OUT
@Id varchar(10) OUT,
@SendToAddressJson nvarchar(max) = NULL
AS
BEGIN
SET NOCOUNT ON;
@@ -65,6 +66,7 @@ BEGIN
[IsCanceled] [bit] NULL,
[Replaces_InvId] [varchar](50) NULL,
[CustomValues] [nvarchar](max) NULL,
[SendToAddressJson] [nvarchar](max) NULL,
[DateSent] [datetime] NULL,
[UserSent] [varchar](25) NULL,
[DateFinalized] [datetime] NULL,
@@ -102,6 +104,7 @@ BEGIN
,0 --<IsPayed, bit,>
,0 --<IsSent, bit,>
,@CustomValues
,@SendToAddressJson
, NULL --[DateSent]
, NULL --[UserSent] [varchar](25) NULL,
,NULL --<DateFinalized, datetime,>
@@ -133,6 +136,7 @@ BEGIN
,[IsPayed]
,[IsSent]
,[CustomValues]
,[SendToAddressJson]
,[DateSent]
,[UserSent]
,[DateFinalized]
@@ -163,6 +167,7 @@ BEGIN
,[ProvisionPeriod] = SOURCE.[ProvisionPeriod]
,[ProvisionLocation] = SOURCE.[ProvisionLocation]
,[CustomValues] = SOURCE.[CustomValues]
,[SendToAddressJson] = SOURCE.[SendToAddressJson]
,[DateModified] = SOURCE.[DateModified]
,[UserModified] = SOURCE.[UserModified]
OUTPUT inserted.*