Files
Fuchs_Intranet/Fuchs_Database/dbo/Stored Procedures/fds__getFDSDocument.sql
T
Stefan c741535aec
Playwright Tests / test (push) Canceled after 0s
feat: Implement mfr truncation fix and enhance invoice handling
- Added a new SQL script to address the "String or binary data would be truncated" error in mfr sync by widening the Note fields in service objects and companies to NVARCHAR(MAX).
- Updated the table types and associated stored procedures to accommodate the changes, ensuring compatibility with existing data.
- Queued a re-sync for previously rejected rows due to truncation issues.
- Created application logins for fuchs_fds and fuchs_web with placeholder passwords for initial setup.
- Introduced functions for invoice backdating and invoice date retrieval to streamline invoice processing.
- Developed a password generation function with customizable parameters for length and character types.
- Added a random number generation function to support password creation.
2026-09-30 16:56:08 +02:00

31 lines
1.1 KiB
Transact-SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[fds__getFDSDocument]
@type varchar(10),
@reportid varchar(20)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @idbigint bigint = TRY_CAST(@reportid as bigint);
IF @type = 'invoice'
BEGIN
SELECT TOP(1)
[Id] = CAST([Id] as varchar(20)),[type] = @type, [InvoiceID],[DocumentName],[DateOfCreation] = [dbo].[fds__fn_invoiceDate]([DateFinalized], [DateCreated]),[fds] = CAST( 1 as bit), [file]
,[order] = ROW_NUMBER() OVER (ORDER BY [DateFinalized] ASC)
FROM [dbo].[fds__invoices] WHERE [id] = @reportid AND [isFinal] = 1;
END
ELSE IF @type = 'reminder'
BEGIN
SELECT TOP(1)
[Id] = CAST([Id] as varchar(20)),[type] = @type, [ReminderID] = '',[DocumentName],[isInvoice] = 1,[DateOfCreation] = [dbo].[fds__fn_invoiceDate]([DateFinalized], [DateCreated]),[fds] = CAST( 1 as bit), [file]
,[order] = ROW_NUMBER() OVER (ORDER BY [DateFinalized] ASC)
FROM [dbo].[fds__reminder] WHERE [id] = @reportid AND [isFinal] = 1;
END
END