Explanation of SQL
Use this query to find orders with negative balance due. This is usually due to a bug whereby payments could be doubled (really entered twice without refreshing) or even tripled. This query finds those affected orders.
Risk of Data Corruption if Run Improperly
None. This is a selection query and no data is modified in the running of it.
SQL
SELECT OrderNumber, TotalPrice, PaymentTotal, CreditMemoAmount, BalanceDue, StatusText, OrderCreatedDate, SaleDate, (SELECT SUM(Amount) FROM GL WHERE TransactionID = TransHeader.ID AND GLAccountID = 14) AS ARBalance, FROM TransHeader WHERE BalanceDue < 0 AND TransactionType = 1 ORDER BY OrderNumber DESC
Version Information
- Entered : 3/2012
- Version : 4.6+
You could leave a comment if you were logged in.