Difference between revisions of "C Customer Allocations"
(Created page with "A Customer Transaction is the Equivalent of a Standard transaction done in Evolution | Accounts Receivable | Transactions | Standard. Customer transactions affect the General...") |
(No difference)
|
Revision as of 15:16, 22 October 2015
A Customer Transaction is the Equivalent of a Standard transaction done in Evolution | Accounts Receivable | Transactions | Standard. Customer transactions affect the General Ledger and the Debtors Ledger and are typically used to post payments(receipts) for customers since invoices done here do not affect Inventory or store as a source document.
The only required values are Account, Reference and TransactionCode. Notice how the Account property is set to an instance of the Customer class. The transaction code defines whether the transaction is a debit or credit (hence the Amount is always positive) and also determines which accounts to post to in the general ledger. There are a number of default transaction codes configured in a new Evolution database (such as IN and CN), but the list is often extended, so it would be wise to make transaction codes configurable in your application. Finally, the Post method is called. This processes the transaction to the account immediately and adjusts the account balance accordingly. Other interesting fields are the transaction date (defaults to current date), description (defaults to transaction code description) and order number (empty by default).
The following is a example of a Customer Transaction using the IN Transaction Type
// Declare Customer Transaction Class CustomerTransaction CustTran = new CustomerTransaction(); //Instance of Customer class CustTran.Customer = new Customer("Customer1"); CustTran.TransactionCode = new TransactionCode(Module.AR, "IN"); CustTran.TaxRate = new TaxRate("1"); CustTran.Amount = 100; CustTran.Reference = "AP_Ref1"; CustTran.Description = "StringDescription"; //Post Method to Commit Transaction CustTran.Post();
The following example posts Customer transactions as a batch using the same Audit number
{
ConsolidateCustomers(); } private static GLBatch _batch = new GLBatch(); public static void ConsolidateCustomers()//create method consolidatesuppliers { try { DatabaseContext.BeginTran(); _batch.Clear(); //Transaction 1 CustomerTransaction custtran = new CustomerTransaction(); custtran.GLDebitPosting += new TransactionBase.GLPostingEventHandler(custtran_GLDebitPosting); custtran.GLCreditPosting += new TransactionBase.GLPostingEventHandler(custtran_GLCreditPosting); custtran.Account = new Customer("Customer1"); custtran.Amount = 50; custtran.TaxRate = new TaxRate(7); custtran.Reference = custtran.Description = "inv1"; custtran.TransactionCode = new TransactionCode(Module.AR, "IN"); custtran.Post(); //Transaction 2 custtran = new CustomerTransaction(); custtran.GLDebitPosting += new TransactionBase.GLPostingEventHandler(custtran_GLDebitPosting); custtran.GLCreditPosting += new TransactionBase.GLPostingEventHandler(custtran_GLCreditPosting); custtran.Account = new Customer("Customer1"); custtran.Amount = 60; custtran.TaxRate = new TaxRate(7); custtran.Reference = custtran.Description = "inv2"; custtran.TransactionCode = new TransactionCode(Module.AR, "IN"); custtran.Post(); //Transaction 3 custtran = new CustomerTransaction(); custtran.GLDebitPosting += new TransactionBase.GLPostingEventHandler(custtran_GLDebitPosting); custtran.GLCreditPosting += new TransactionBase.GLPostingEventHandler(custtran_GLCreditPosting); custtran.Account = new Supplier("Customer1"); custtran.Amount = 70; custtran.TaxRate = new TaxRate(7); custtran.Reference = custtran.Description = "inv3"; custtran.TransactionCode = new TransactionCode(Module.AR, "IN"); custtran.Post(); _batch.Post(); DatabaseContext.CommitTran(); } catch (Exception ex) { DatabaseContext.RollbackTran(); MessageBox.Show(ex.Message); } } static void custtran_GLCreditPosting(TransactionBase sender, TransactionBase.GLPostingEventArgs e) { _batch.Add((GLTransaction)e.GLTransaction.Clone()); e.Posted = true; } static void custtran_GLDebitPosting(TransactionBase sender, TransactionBase.GLPostingEventArgs e) { _batch.Add((GLTransaction)e.GLTransaction.Clone(), true, true); e.Posted = true; }
- See more at: http://kb.pastel.co.za/article.php?id=1998#sthash.zJo9JeJw.dpuf