10ecdfa2e4
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>
38 lines
1.2 KiB
Transact-SQL
38 lines
1.2 KiB
Transact-SQL
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fds__createInvoice_Details]
|
|
@InvId varchar(10)
|
|
,@InvoiceService_net numeric(10,2)
|
|
,@InvoiceService_VAT numeric(10,2)
|
|
,@InvoiceOptions varchar(50)
|
|
,@authuser varchar(25)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
MERGE [dbo].[fds__invoice_details] AS TARGET
|
|
USING (VALUES(@InvId,@InvoiceService_net,@InvoiceService_VAT,@InvoiceOptions)) SOURCE ([InvId],[InvoiceService_net],[InvoiceService_VAT],[InvoiceOptions]) ON TARGET.[InvID] = SOURCE.[InvID]
|
|
WHEN MATCHED THEN
|
|
UPDATE SET
|
|
[InvoiceService_net] = ISNULL(SOURCE.[InvoiceService_net], TARGET.[InvoiceService_net])
|
|
,[InvoiceService_VAT] = ISNULL(SOURCE.[InvoiceService_VAT], TARGET.[InvoiceService_VAT])
|
|
,[InvoiceOptions] = ISNULL(SOURCE.[InvoiceOptions], TARGET.[InvoiceOptions])
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT
|
|
([InvId]
|
|
,[InvoiceService_net]
|
|
,[InvoiceService_VAT]
|
|
,[InvoiceOptions])
|
|
VALUES(
|
|
SOURCE.[InvId]
|
|
,SOURCE.[InvoiceService_net]
|
|
,SOURCE.[InvoiceService_VAT]
|
|
,SOURCE.[InvoiceOptions]
|
|
)
|
|
OUTPUT inserted.*
|
|
;
|
|
|
|
END |