CREATE VIEW [dbo].[TPriceXTaxView]
AS
SELECT     ISNULL(SUM(T.PriceOverwrite * (CASE T .Debit WHEN 1 THEN - 1 ELSE 1 END)), 0) AS PriceXTax, T.GlobalTransactionNumber, T.FolioNumber
FROM         dbo.Transactions AS T WITH (NOLOCK) INNER JOIN
                      dbo.Accounts AS A WITH (NOLOCK) ON A.AccountNumber = T.AccountNumber AND A.Balance = 1
GROUP BY T.GlobalTransactionNumber, T.FolioNumber