C General Ledger Transactions

From Sage Evolution SDK | Documentation Portal
Revision as of 11:58, 23 October 2015 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Ledger Transactions can be posted which is the equivalent of a Journal done in Evolution as follows:

{
    DatabaseContext.BeginTran();
    GLTransaction GLDr = new GLTransaction();
    GLDr.Account = new GLAccount("Sales");// specify the Gl Account
    GLDr.Debit = 100+14;
    GLDr.Date = DateTime.Today;
    GLDr.Description = "descr";
    GLDr.Reference = "ref1";
    GLDr.TransactionCode = new TransactionCode(Module.GL, "JNL");//Specify the GL transaction code
    GLDr.Post();
 
    GLTransaction GLCr = new GLTransaction();
    GLCr.Account = new GLAccount("Accruals");// specify the Gl Account
    GLCr.Credit = 100;
    GLCr.TaxRate = new TaxRate(1);
    //GLCr.Tax = 14;//Tax Amount can be specified if required
    GLCr.Date = DateTime.Today;
    GLCr.Description = "descr";
    GLCr.Reference = "ref1";
    GLCr.TransactionCode = new TransactionCode(Module.GL, "JNL");//Specify the GL transaction code
    GLCr.Post();
 
    //Posting the vat leg of the credit transaction above
    GLTransaction Tax = new GLTransaction();
    Tax.Account = new GLAccount("Vat Control");// specify the Gl Tax Account
    Tax.Credit = 14;
    //Tax.Tax = GLCr.Tax;
    Tax.Date = DateTime.Today;
    Tax.ModID = ModuleID.Tax;//Specify this transaction id to be tax
    Tax.Description = "descr";
    Tax.Reference = "ref1";
    Tax.TransactionCode = new TransactionCode(Module.GL, "JNL");//Specify the GL transaction code
    Tax.Post();
    DatabaseContext.CommitTran();
}