QUERY TO ASSIGN TRANSACTION AMOUNT TO DEBIT OR CREDIT
Posted on 2011-03-10
I have transaction which are :
1. Money Receive.
2. Money Pay.
Query Condition :
1. When Receive then Debet.
2. When Receive and Minus Then Credit
3. When Pay then Credit.
4. When Pay and Minus Then Debit
Below are my code :
CASE WHEN RIGHT(A.TipeTransaksi, 1) = 'D' THEN B.TransactionAmount ELSE 0.00 END AS Debit"
CASE WHEN RIGHT(A.TipeTransaksi, 1) = 'C' THEN B.TransactionAmount ELSE 0.00 END AS Credit"
How to add condition for minus TransactionAmount to the right place, Debit or Credit?