Add Fuchs_Database SSDT project (schema source of truth)

Adds the SQL Server Data Tools project for the fuchs_fds database — tables,
table types, functions and stored procedures that the backend calls (e.g.
fds__getInvoice, fds__merge_bankingtransactions, fds__tt__bankingtransactions,
fds__admin_getReportCatalog, fis_* auth). Build/model caches (bin, obj,
*.dbmdl, *.jfm, *.user) are git-ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 14:50:54 +02:00
parent 1376779224
commit 10ecdfa2e4
359 changed files with 22603 additions and 0 deletions
@@ -0,0 +1,49 @@
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[fds__getInvPayments]
@InvID varchar(20)
, @authuser varchar(100)
AS
BEGIN
SET NOCOUNT ON;
IF [dbo].[fis_getModuleAuth]('fds_inv', @authuser) < 1 OR [dbo].[fis_getModuleAuth]('fds_bam', @authuser) < 1
THROW 60000, N'not authorized', 1;
INSERT INTO [dbo].[fds__admin_activity] ([activity] ,[authuser] ,[info])
VALUES ('fds__getInvPayments' ,@authuser , '');
DECLARE @InvoiceId varchar(50) = (SELECT TOP(1) [invoiceid] FROM [fds__invoices] WHERE [id] = @InvID);
WITH bs1 as (
SELECT bs.[taID], [invid] = value, [manu] = cast(1 as bit)
FROM [dbo].[fds__bankingtransactions_settings] as bs
CROSS APPLY STRING_SPLIT(bs.assigned_invoice_id, ',')
WHERE bs.assigned_invoice_id is not null AND [value] = @InvID
UNION
SELECT bs.[taID], [invid] = value, [manu] = cast(0 as bit)
FROM [dbo].[fds__bankingtransactions_settings] as bs
CROSS APPLY STRING_SPLIT(bs.auto_invoice_id, ',')
WHERE bs.auto_invoice_id is not null AND [value] = @InvID
), bs as (
SELECT [taID], [invid], manu = CAST(MAX(CAST([manu] as int)) as bit)
from bs1
GROUP BY [taID], [invid]
)
SELECT
bs.[taID]
, [account] = bt.[AccountIdentification]
, [name] = bt.[NameOfPayer]
, [text] = bt.[SepaRemittanceInformation]
, [InvID] = @InvID
, [InvoiceID] = @InvoiceId
, [amount] = FORMAT(ISNULL(bt.[amount], 0.0), '0.00€', 'de')
, [date] = FORMAT([ValueDate], 'dd.MM.yyyy', 'de-de')
, [manual] = IIF(bs.manu = 1, 'manuell','')
, [order] = ROW_NUMBER() OVER (ORDER BY [ValueDate] ASC, [AccountIdentification] ASC)
FROM [dbo].[fds__bankingtransactions] as bt
JOIN bs ON bt.[taID] = bs.[taID];
END