Python
From Sage Evolution SDK | Documentation Portal
AR Transaction with Allocations
import clr clr.AddReference('Pastel.Evolution') # This was done with the DLL registered in the GAC. from Pastel.Evolution import * DatabaseContext.Initialise('50008', 'EvolutionCommon', '(local)', 'sa', '123', 'DEMO', '12321452345') print 'Connected.' # Invoice 1 ct = CustomerTransaction() ct.Account = Customer('CASH') ct.Amount = 2006.15 ct.TranCode = TransactionCode(EvoModule.AR, 'IN') ct.TaxType = TaxType('3') ct.Reference = 'Inv1' ct.Post() inv1 = ct # Previous allocation ct = CustomerTransaction() ct.Account = Customer('CASH') ct.Amount = 1720.97 ct.TranCode = TransactionCode(EvoModule.AR, 'PM') ct.Reference = 'Inv1 PM' ct.Post() inv1.Allocations.Add(ct) inv1.Allocations.Save() # Invoice 2 ct = CustomerTransaction() ct.Account = Customer('CASH') ct.Amount = 1833.33 ct.TranCode = TransactionCode(EvoModule.AR, 'IN') ct.TaxType = TaxType('3') ct.Reference = 'Inv2' ct.Post() inv2 = ct # Payment ct = CustomerTransaction() ct.Account = Customer('CASH') ct.Amount = 1833.33 ct.TranCode = TransactionCode(EvoModule.AR, 'PM') ct.TaxType = TaxType('3') ct.Reference = 'OB2' ct.Post() print ct.Audit pm = ct # Refresh invoices inv2 = CustomerTransaction(inv2.ID) inv1 = CustomerTransaction(inv1.ID) pm.Allocations.Add(inv1) pm.Allocations.Add(inv2) pm.Allocations.Save() print 'Done!'
GL Journal
import clr from System import DateTime clr.AddReference('Pastel.Evolution') from Pastel.Evolution import * print 'Opening connection...' DatabaseContext.Initialise("40036", "(local)", "evo", "123", "SER_NO", "AUTH_CODE"); try: DatabaseContext.BeginTran() gt = GLTransaction() gt.Account = GLAccount("1100") gt.TransactionCode = TransactionCode(Module.GL, "CASH") gt.Description = "Test Tran" gt.Date = DateTime.Today gt.Reference = "test" gt.Debit = 250.50 gt.Post() print gt.Audit gt = gt.Clone() gt.Credit = 250.50 gt.Post() DatabaseContext.CommitTran() print gt.Audit except: DatabaseContext.Rollback() print 'failed'