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