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>
40 lines
1.3 KiB
Transact-SQL
40 lines
1.3 KiB
Transact-SQL
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fds__setBankingtransaction_done]
|
|
@taID varchar(100)
|
|
,@authuser varchar(25)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
IF [dbo].[fis_getModuleAuth]('fds_bam', @authuser) < 1
|
|
THROW 60000, N'not authorized', 1;
|
|
|
|
INSERT INTO [dbo].[fds__admin_activity] ([activity] ,[authuser] ,[info])
|
|
VALUES ('fds__setBankingtransaction_done' ,@authuser , '');
|
|
|
|
|
|
DECLARE @now datetime = GETUTCDATE();
|
|
DECLARE @today date = @now;
|
|
|
|
DECLARE @OUT TABLE([taID] varchar(10), [done_manually] varchar(25));
|
|
|
|
MERGE [dbo].[fds__bankingtransactions_settings] as TARGET
|
|
USING (SELECT TOP(1) * FROM [dbo].[fds__bankingtransactions] as b WHERE b.[taID] = @taID) as SOURCE ON TARGET.[taID] = SOURCE.[taID]
|
|
WHEN MATCHED THEN
|
|
UPDATE SET [done_manually] = FORMAT(@now, 'yyyy-MM-dd HH:mm:ss') + ';' + @authuser
|
|
WHEN NOT MATCHED BY TARGET THEN
|
|
INSERT ([taID],[done_manually]) VALUES (SOURCE.[taID], FORMAT(@now, 'yyyy-MM-dd HH:mm:ss') + ';' + @authuser)
|
|
OUTPUT inserted.[taID], inserted.[done_manually]
|
|
INTO @out;
|
|
;
|
|
|
|
|
|
--output to confirm as boolean
|
|
SELECT CAST( (CASE WHEN ISNULL((SELECT TOP(1) [done_manually] FROM @out), '') <> '' THEN 1 ELSE 0 END) as bit);
|
|
|
|
END |