feat: implement set-based invoice payment calculations and enhance email logging configuration
Playwright Tests / test (push) Canceled after 0s

This commit is contained in:
Stefan
2026-09-16 22:31:27 +02:00
parent 944a5bb442
commit 86f6a60860
8 changed files with 268 additions and 12 deletions
@@ -0,0 +1,23 @@
-- =============================================
-- Description: Set-based counterpart of the scalar [fds__fn_InvoicePaymentAmount]:
-- returns the summed (non-storno) banking payments for EVERY invoice in one pass
-- over [fds__fn_bankingtransactions]. Join it instead of calling the scalar
-- function per row — the scalar one declares a table variable, so SQL Server
-- cannot inline it and re-runs the whole banking TVF for each invoice
-- (~0.5 s × N rows; the overdue-sum widget timed out at 90 s with 187 rows).
-- Same semantics as the scalar version with an empty id list: all invoices,
-- no date filter, storno credits NOT included (see *_full for those).
-- =============================================
CREATE FUNCTION [dbo].[fds__fn_InvoicePaymentAmounts]
(
)
RETURNS TABLE
AS
RETURN
(
SELECT [InvId] = bs.[InvId]
,[Amount] = CAST(SUM(ISNULL(bs.[Amount], 0.0)) as numeric(9,2))
FROM [dbo].[fds__fn_bankingtransactions](NULL, NULL, NULL, NULL, DEFAULT) as bs
WHERE bs.[InvId] IS NOT NULL
GROUP BY bs.[InvId]
)