Query: Select InvoiceF total different from GLMovement total
Select
[ResInvoiceF].[DBId], [ResInvoiceF].[Number], [ResInvoiceF].[Id], [ResInvoiceF].[Type],
[ResGLMovement].*, [ResInvoiceF].[Total] from
(Select
[GLMovement].[DBId], [GLMovement].[GLPeriodId], [GLMovement].[EntryNumber],
[GLMovement].[InvoiceFId], Sum(Round(Case When [CD] = ‘C’ Then [Amount] Else
-[Amount] End, 2)) as [Total] from [GLMovement] INNER JOIN [GLAccount]
ON
([GLMovement].[GLAccountId] = [GLAccount].[Id] and [GLMovement].[DBId] =
[GLAccount].[DBId] and [GLAccount].[Type] = 12)
where
[GLMovement].[Type] = 2
Group by
[GLMovement].[DBId], [GLMovement].[GLPeriodId], [GLMovement].[EntryNumber],
[GLMovement].[InvoiceFId]) as [ResGLMovement] INNER JOIN
(Select [DBId],
[Id], [Number], [Type], Case When [Type] in (2, 4, 8, 9) Then
-Round([InvoiceF].[BilledNoVAT] + [InvoiceF].[VAT], 2) Else
Round([InvoiceF].[BilledNoVAT] + [InvoiceF].[VAT], 2) End as [Total] from
[InvoiceF]) as [ResInvoiceF] ON ([ResGLMovement].[InvoiceFId] =
[ResInvoiceF].[Id] and [ResGLMovement].[DBId] = [ResInvoiceF].[DBId]) where Not
[ResGLMovement].[Total] = [ResInvoiceF].[Total]
order by
[ResInvoiceF].[DBId]