Sample Sales Return + Auto Credit Memo


This document can be create under

Trading → Sales → Cancel Cash Sales / Invoice

Trading → Sales → Sales Return by Invoice

Trading → Sales → Sales Return (Multi Invoice)


Giving example , the Sales Return number is SR1001


select  * from cust_sales_return_index where pkid = 1001;

select * from cust_sales_return_item where sales_return_id = 1001;


To trace movement in / out of the item (Stock Movement)

select * from inv_stock_delta where doc_table = 'cust_sales_return_item' and doc_key in (select pkid from cust_sales_return_item where sales_return_id = 1001);


To trace movement in / out of the serial number or batch and expiry (Trace Stock)

select * from inv_serial_number_delta where doc_table = 'cust_sales_return_item' and doc_key in (select pkid from cust_sales_return_item where sales_return_id = 1001);


Giving example , the CM auto created from Sales Return is CM1003

If you don't have the CM number and only have the SR and SR number is SR1001,

select * from acc_credit_memo_index where doc_table = 'cust_sales_return_index' and doc_key = 1001;


if you have the CM number , can proceed to check base on CM pkid

select * from acc_credit_memo_index where pkid = 1003;

select * from acc_credit_memo_item where index_id = 1003;


Record in Financial Report (Balance Sheet / Trial Balance / P&L / GL Listing

select * from acc_journal_transaction where doc_ref = 'acc_credit_memo_index' and doc_key = 1003;

select * from acc_journal_entry where journaltxnid in (select pkid from acc_journal_transaction where doc_ref = 'acc_credit_memo_index' and doc_key = 1003);


Record in AR / AP Transaction / Billing Statement / Historical AR / AP Balance

select * from acc_nominal_account_txn where foreign_table  = 'acc_credit_memo_index' and foreign_key = 1003;


Settlement / CC-07

select * from acc_doclink where src_docref = 'acc_credit_memo_index' and src_docid = 1003;

select * from acc_doclink where tgt_docref = 'acc_credit_memo_index' and tgt_docid = 1003;


If customer choose refund , system will also auto create Payment Voucher and knock off it with CM .

But from database , you can also trace the PV auto created from cust_sales_return_index table .


Giving example  , the PV auto created from Sales Return is PV10001


select * from acc_payment_voucher_index where pkid = 10001;

select * from acc_payment_voucher_item where index_id = 10001;


Record in Financial Report (Balance Sheet / Trial Balance / P&L / GL Listing

select * from acc_journal_transaction where doc_ref = 'acc_payment_voucher_index' and doc_key = 10001;

select * from acc_journal_entry where journaltxnid in (select pkid from acc_journal_transaction where doc_ref = 'acc_payment_voucher_index' and doc_key = 10001);


Record in AR / AP Transaction / Billing Statement / Historical AR / AP Balance

select * from acc_nominal_account_txn where foreign_table  = 'acc_payment_voucher_item' and foreign_key in (select pkid from acc_payment_voucher_item where index_id =  10001);


Record in Query Cashbook Transaction / Cash Level / Bank Recon

select * from acc_cash_transactions where foreign_table = 'acc_payment_voucher_index' and foreign_key = 10001;


Settlement / CC-07

select * from acc_doclink where src_docref = 'acc_payment_voucher_item' and src_docid in (select pkid from acc_payment_voucher_item where index_id =  10001);





Private & Confidential