Files
Fuchs_Intranet/Fuchs_Database/dbo/Functions/fis_wdg_invoices_yesterday.sql
T
StefanandCopilot 330c33e65d
Playwright Tests / test (push) Waiting to run
Move fis widgets SQL into scalar functions
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>
2026-10-16 11:35:28 +02:00

13 lines
683 B
Transact-SQL

-- =============================================
-- Description: Dashboard widget 'wdg_invoices_yesterday' (Rechnung des letzten Werktags).
-- Called from [dbo].[fis_widgets].[sql] as: SELECT * FROM [dbo].[fis_wdg_invoices_yesterday]()
-- =============================================
CREATE FUNCTION [dbo].[fis_wdg_invoices_yesterday]()
RETURNS TABLE
AS
RETURN
(
SELECT [label] = N'Rechnungen erstellt am ' + FORMAT(CAST([dbo].[date_add](GETDATE(), '-1wd', 0) as date), 'dd.MM.yy', 'de')
, [value] = FORMAT((SELECT COUNT(*) FROM [dbo].[fds__invoices] WHERE CAST([DateFinalized] as date) = CAST([dbo].[date_add](GETDATE(), '-1wd', 0) as date)), '#0')
);