Add fis_wdg_* table functions for dashboard widgets and wire them into FuchsDatabase.sqlproj; update the invoice list procs accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
-- NOTE: Manual-only maintenance utility. Never called from application code (IntranetController /
|
||||
-- InvoiceService) — run by hand against the database when needed. Ignore this proc when
|
||||
-- investigating missing invoice PDFs via app logs: it clears [fds__invoices].[file] without going
|
||||
@@ -6,6 +7,7 @@
|
||||
|
||||
-- Example usage: EXEC dbo.usp_BackupAndClearInvoiceFile @InvoiceID = 'R2025-0057';
|
||||
|
||||
|
||||
CREATE PROCEDURE [dbo].[_BackupAndClearInvoiceFile]
|
||||
@InvoiceID nvarchar(25)
|
||||
AS
|
||||
@@ -56,8 +58,8 @@ BEGIN
|
||||
|
||||
|
||||
|
||||
Print Formatmessage('https://sanitaerfuchs.de/intranet/do/req/idoc?id=%s&create=1', @invID);
|
||||
Print Formatmessage('https://sanitaerfuchs.de/intranet/do/inv/rdoc?id=%s&create=1', @invID);
|
||||
--Print Formatmessage('https://sanitaerfuchs.de/intranet/do/req/idoc?id=%s&create=1', @invID);
|
||||
--Print Formatmessage('https://sanitaerfuchs.de/intranet/do/inv/rdoc?id=%s&create=1', @invID);
|
||||
|
||||
|
||||
RETURN 0;
|
||||
|
||||
@@ -93,7 +93,9 @@ BEGIN
|
||||
,[DueDate]
|
||||
,[PaymentTerm] = ISNULL([PaymentTerm], @stage1)
|
||||
,[PaymentStatus]
|
||||
,[IsPayed] = CAST(CASE WHEN ISNULL(iv.[IsCanceled],0) = 1 THEN 1 ELSE ISNULL([IsPayed],0) END as bit)
|
||||
,[IsPayed] = CAST(CASE WHEN ISNULL(iv.[IsCanceled],0) = 1 THEN 1
|
||||
WHEN [dbo].[fds__fn_invoiceDate](iv.[DateFinalized], iv.[DateCreated]) < DATEFROMPARTS(2026,1,1) THEN 1
|
||||
ELSE ISNULL([IsPayed],0) END as bit)
|
||||
,[IsCanceled]
|
||||
,[isSent]
|
||||
,[isFinal]
|
||||
|
||||
@@ -132,7 +132,9 @@ BEGIN
|
||||
,[DueDate]
|
||||
,[PaymentTerm] = ISNULL([PaymentTerm], @stage1)
|
||||
,[PaymentStatus]
|
||||
,[IsPayed] = CAST(CASE WHEN [dbo].[fds__fn_isInvoiceCancelled](iv.[Id]) = 1 THEN 1 ELSE ISNULL([IsPayed],0) END as bit)
|
||||
,[IsPayed] = CAST(CASE WHEN [dbo].[fds__fn_isInvoiceCancelled](iv.[Id]) = 1 THEN 1
|
||||
WHEN [dbo].[fds__fn_invoiceDate](iv.[DateFinalized], iv.[DateCreated]) < DATEFROMPARTS(2026,1,1) THEN 1
|
||||
ELSE ISNULL([IsPayed],0) END as bit)
|
||||
,[IsCanceled] = [dbo].[fds__fn_isInvoiceCancelled](iv.[Id])
|
||||
,[isSent]
|
||||
,[isFinal]
|
||||
|
||||
@@ -126,7 +126,9 @@ BEGIN
|
||||
,[DueDate]
|
||||
,[PaymentTerm] = ISNULL([PaymentTerm], @stage1)
|
||||
,[PaymentStatus]
|
||||
,[IsPayed] = CAST(CASE WHEN ISNULL(iv.[IsCanceled],0) = 1 THEN 1 ELSE ISNULL([IsPayed],0) END as bit)
|
||||
,[IsPayed] = CAST(CASE WHEN ISNULL(iv.[IsCanceled],0) = 1 THEN 1
|
||||
WHEN [dbo].[fds__fn_invoiceDate](iv.[DateFinalized], iv.[DateCreated]) < DATEFROMPARTS(2026,1,1) THEN 1
|
||||
ELSE ISNULL([IsPayed],0) END as bit)
|
||||
,[IsCanceled] = CAST(IIF(ISNULL([IsCanceled],0) = 1 OR [dbo].[fds__fn_isInvoiceCancelled](iv.[Id]) = 1, 1,0) as bit)
|
||||
,[isSent]
|
||||
,[isFinal]
|
||||
|
||||
Reference in New Issue
Block a user