-- Read-only check for amounts mangled by the OCORE SQL_Float sign bug (fixed 2026-10-01). -- Before the fix, a negative amount posted as "-19.95" was parsed with the server's de-DE culture -- ("." = thousands separator) and stored scaled up, e.g. -19.95 -> -1995. Positive amounts were fine. -- Affected: fds__invoices header totals (Stornos / credits) and fds__invoice_details service totals -- written through fds__setInvoice / fds__createInvoice / fds__createInvoice_Details, plus reminder -- amounts written by ReminderService. Line items (fds__invoice_items) were NOT affected. -- -- Signal: the header net total disagrees with the sum of the invoice's own line items. -- 1) Invoices with a negative header total, compared against their persisted line items. SELECT i.[Id], i.[InvoiceId], i.[InvoiceType], i.[IsFinal], i.[DateCreated], i.[DateModified], i.[InvoiceBalance], i.[InvoiceBalance_net], i.[InvoiceVAT_net1], d.[InvoiceService_net], d.[InvoiceService_VAT], items_net = it.[items_net], suspicious = CASE WHEN it.[items_net] IS NOT NULL AND ABS(i.[InvoiceBalance_net] - it.[items_net]) > 0.05 THEN 1 ELSE 0 END FROM [dbo].[fds__invoices] i LEFT JOIN [dbo].[fds__invoice_details] d ON d.[InvId] = i.[Id] OUTER APPLY (SELECT [items_net] = SUM(x.[value_total]) FROM [dbo].[fds__invoice_items] x WHERE x.[InvId] = i.[Id]) it WHERE i.[InvoiceBalance] < 0 OR i.[InvoiceBalance_net] < 0 OR d.[InvoiceService_net] < 0 OR d.[InvoiceService_VAT] < 0 ORDER BY suspicious DESC, i.[DateModified] DESC; -- 2) Reminders with a negative amount (same helper). SELECT * FROM [dbo].[fds__reminder] WHERE [amount] < 0 OR [amount_payed] < 0;