Thursday, July 20, 2017

Dynamics NAV-LS Retail - Retail Sales - POS Manual Discounts View

SELECT     dbo.[CRONUS$Trans_ Sales Entry].[Store No_], dbo.[CRONUS$Trans_ Sales Entry].[POS Terminal No_],
                      dbo.[CRONUS$Trans_ Sales Entry].[Transaction No_], dbo.[CRONUS$Trans_ Sales Entry].[Receipt No_],
                      dbo.[CRONUS$Trans_ Sales Entry].[Item No_], dbo.CRONUS$Item.Description, dbo.[CRONUS$Trans_ Sales Entry].Price,
                      dbo.[CRONUS$Trans_ Sales Entry].Quantity * - 1 AS Quantity, dbo.[CRONUS$Trans_ Sales Entry].[Periodic Discount],
                      dbo.[CRONUS$Trans_ Sales Entry].[Total Discount], dbo.[CRONUS$Trans_ Sales Entry].[Line Discount],
                      dbo.[CRONUS$Trans_ Infocode Entry].Infocode, dbo.[CRONUS$Trans_ Infocode Entry].Information,
                      dbo.[CRONUS$Trans_ Infocode Entry].Amount, dbo.[CRONUS$Trans_ Sales Entry].[Net Amount] * - 1 AS [Net Amount],
                      dbo.[CRONUS$Trans_ Sales Entry].[VAT Amount], dbo.[CRONUS$Trans_ Sales Entry].[Discount Amount],
                      dbo.[CRONUS$Trans_ Sales Entry].Date, dbo.[CRONUS$Trans_ Sales Entry].[Staff ID],
                      dbo.CRONUS$Staff.[First Name] + N' ' + dbo.CRONUS$Staff.[Last Name] AS StaffName, dbo.[CRONUS$Trans_ Sales Entry].[Deal Line],
                      dbo.[CRONUS$Trans_ Sales Entry].Price * dbo.[CRONUS$Trans_ Sales Entry].Quantity * - 1 AS OrigNetAmt,
                      dbo.[CRONUS$Member Contact].Name,
                      dbo.[CRONUS$Trans_ Sales Entry].[Total Discount] + dbo.[CRONUS$Trans_ Sales Entry].[Line Discount] AS ManualDiscounts
FROM         dbo.[CRONUS$Member Contact] INNER JOIN
                      dbo.[CRONUS$Member Sales Entry] ON
                      dbo.[CRONUS$Member Contact].[Account No_] = dbo.[CRONUS$Member Sales Entry].[Member Account No_] RIGHT OUTER JOIN
                      dbo.[CRONUS$Trans_ Sales Entry] INNER JOIN
                      dbo.CRONUS$Item ON dbo.[CRONUS$Trans_ Sales Entry].[Item No_] = dbo.CRONUS$Item.No_ INNER JOIN
                      dbo.CRONUS$Staff ON dbo.[CRONUS$Trans_ Sales Entry].[Staff ID] = dbo.CRONUS$Staff.ID ON
                      dbo.[CRONUS$Member Sales Entry].[Item No_] = dbo.[CRONUS$Trans_ Sales Entry].[Item No_] AND
                      dbo.[CRONUS$Member Sales Entry].[Line No_] = dbo.[CRONUS$Trans_ Sales Entry].[Line No_] AND
                      dbo.[CRONUS$Member Sales Entry].[Document No_] = dbo.[CRONUS$Trans_ Sales Entry].[Receipt No_] LEFT OUTER JOIN
                      dbo.[CRONUS$Trans_ Infocode Entry] ON
                      dbo.[CRONUS$Trans_ Sales Entry].[Store No_] = dbo.[CRONUS$Trans_ Infocode Entry].[Store No_] AND
                      dbo.[CRONUS$Trans_ Sales Entry].[POS Terminal No_] = dbo.[CRONUS$Trans_ Infocode Entry].[POS Terminal No_] AND
                      dbo.[CRONUS$Trans_ Sales Entry].[Transaction No_] = dbo.[CRONUS$Trans_ Infocode Entry].[Transaction No_] AND
                      dbo.[CRONUS$Trans_ Sales Entry].[Line No_] = dbo.[CRONUS$Trans_ Infocode Entry].[Line No_]
WHERE     (dbo.[CRONUS$Trans_ Sales Entry].[Discount Amount] <> 0) AND (dbo.[CRONUS$Trans_ Sales Entry].Date >= CONVERT(DATETIME,
                      '2016-10-01 00:00:00', 102)) AND (dbo.[CRONUS$Trans_ Sales Entry].Date <= CONVERT(DATETIME, '2017-06-30 00:00:00', 102)) AND
                      (dbo.[CRONUS$Trans_ Sales Entry].[Total Discount] + dbo.[CRONUS$Trans_ Sales Entry].[Line Discount] <> 0)

No comments:

Post a Comment