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>
35 lines
1.3 KiB
Transact-SQL
35 lines
1.3 KiB
Transact-SQL
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fds__setReminderFinal]
|
|
@Id varchar(8),
|
|
@authuser varchar(25)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
IF [dbo].[fis_getModuleAuth]('fds_reminder', @authuser) < 2
|
|
THROW 60000, N'not authorized', 1;
|
|
|
|
|
|
|
|
DECLARE @now datetime = GETUTCDATE();
|
|
|
|
DECLARE @ids as TABLE([Id] varchar(10));
|
|
|
|
|
|
|
|
UPDATE [dbo].[fds__reminder] SET [DateFinalized] = @now, [UserFinalized] = @authuser, [DateModified] = @now, [UserModified] = @authuser, [version] = (ISNULL([version],0) + 1)
|
|
OUTPUT inserted.[id]
|
|
INTO @ids
|
|
WHERE [Id] = @Id AND @Id is not null and [isFinal] = 0 and [isSent] = 0;
|
|
|
|
SELECT rem.*
|
|
, [InvoiceFile] = (SELECT TOP(1) [file] FROM [fds__invoices] as i where i.InvoiceId = rem.[InvId] and i.IsFinal = 1 and i.[file] is not null and ISNULL(i.[DocumentName],'') <> '')
|
|
, [InvoiceFileName] = (SELECT TOP(1) [DocumentName] FROM [fds__invoices] as i where i.InvoiceId = rem.[InvId] and i.IsFinal = 1 and i.[file] is not null and ISNULL(i.[DocumentName],'') <> '')
|
|
FROM [dbo].[fds__reminder] as rem
|
|
JOIN @ids as ids on rem.[id] = ids.Id; --this is necessary to get calculated fields also
|
|
|
|
END |