CSupplierBatches

From Sage Evolution SDK | Documentation Portal
Revision as of 16:32, 18 July 2017 by Admin (Talk | contribs) (Created page with "A Supplier Batch is created in Suppliers | Transactions | Suppliers Batches. Supplier batches can take gl accounts and Customer accounts. The batch can also be processed. ''...")

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

A Supplier Batch is created in Suppliers | Transactions | Suppliers Batches.

Supplier batches can take gl accounts and Customer accounts. The batch can also be processed.

The following is an example of a Supplier Batch

string SBatchNum = "APB1";
 
 
 
SupplierBatch.Get(1);
if (SupplierBatch.Find(SBatchNum) == -1)
{
//  Batch code does not exist, so create it
SupplierBatch createsbatch = new SupplierBatch();
createsbatch.BatchNo = SBatchNum;
createsbatch.Description = "SB Batch";
createsbatch.CreatedAgent = new Agent("Admin");
createsbatch.AllowGLContraSplit = true;
createsbatch.AllowDuplicateReferences = true;
createsbatch.EnterTaxOnGlContraSplit = true;
createsbatch.Save();
 
MessageBox.Show(createsbatch.BatchNo);
}
//The following code populates a Supplierbatch and processes it
SupplierBatch SB = new SupplierBatch(SBatchNum);
 
BatchDetail BDet = new BatchDetail();
BDet.Customer = new Customer("Cash");
BDet.Date = DateTime.Now;
BDet.Description = "LineDesc";
BDet.Reference = "ref1";
BDet.PostDated = false;
BDet.TransactionCode = new TransactionCode(Module.AR, "IN");
BDet.TaxType = new TaxRate(1);
BDet.AmountExclusive = 728;
BDet.GLContraAccount = new GLAccount("accounting fees");
SB.Detail.Add(BDet);
 
BDet = new BatchDetail();
SB.Detail.Add(BDet);
BDet.Supplier = new Supplier("Supplier1");
BDet.Date = DateTime.Now;
BDet.Description = "LineDesc";
BDet.Reference = "ref1";
BDet.PostDated = false;
BDet.TransactionCode = new TransactionCode(Module.AP, "IN");
BDet.TaxType = new TaxRate(1);
BDet.ContraSplit.Add("Security", "Ledger Line 1", 100, "1");
BDet.ContraSplit.Add("Sales", "Ledger Line 2", 328, "1");
BDet.AmountExclusive = 428;
 
BDet = new BatchDetail();
BDet.GLAccount = new GLAccount("Advertising");
BDet.Date = DateTime.Now;
BDet.Description = "LineDesc";
BDet.Reference = "ref1";
BDet.PostDated = false;
BDet.IsDebit = true;
BDet.TransactionCode = new TransactionCode(Module.GL, "JNL");
BDet.TaxType = new TaxRate(1);
BDet.ContraSplit.Add("Security", "Ledger Line 1", 100, "1");
BDet.ContraSplit.Add("Sales", "Ledger Line 2", 428, "1");
BDet.ContraSplit.Add("Accounting fees", "Ledger Line 3", 500, "3");
BDet.AmountExclusive = 1028;
SB.Detail.Add(BDet);
 
SB.Process();