SCENARIO:


As per sample below, Transaction only have single posting.

by right should be Debit Purchase, Credit Supplier account.


Note: above issue happen when DB is corrupted/suspect, after repaid by script may caused data loss.

OR

when user internet extremely not stable, caused data posting missing.


SOLUTION:


run below Script to trace all transaction which have same issue


select sum(Debit) debit,sum(credit) credit, sum(Debit) - sum(credit) variance, DocumentCode, JournalType, string_agg(ARM.Arcode,',') knockoffwithOR, string_agg(APM.APcode, ',') knockoffwithPV

from gltransactions G

left JOIN ARMatched ARM

ON G.DocumentId = ARM.PayForId

left JOIN APMatched APM

ON G.Documentid = APM.PayForId

where G.TransactionDate > '01-Jan-2015'--cut off date

group by documentcode,  JournalType

having sum(Debit) - sum(credit) != 0 

order by JournalType asc


Note: this script with knock off info.


Or

Run below Script to trace all transaction which have same issue, without knock off info.


select sum(Debit) debit,sum(credit) credit, sum(Debit) - sum(credit) variance, DocumentCode, JournalType from gltransactions

where TransactionDate > '01-Jan-2015'--cut off date  

group by documentcode, JournalType 

having sum(Debit) - sum(credit) != 0 

order by JournalType asc