C Return To Suppliers

From Sage Evolution SDK | Documentation Portal
Jump to: navigation, search

A RTS can be Saved or processes just like in Evolution. The following example is on placing a Return to supplier.

ReturnToSupplier RTS = new ReturnToSupplier();
RTS.Supplier = new Supplier("SupplierSDK1");
RTS.InvoiceDate = DateTime.Now;// choose to set the invoice date or Order date etc
RTS.InvoiceTo = RTS.Supplier.PostalAddress.Condense();//Condense method can be used or you can specify the address as below
RTS.DeliverTo = new Address("Physical Address 1", "Address 2", "Address 3", "Address 4", "Address 5", "PC");
RTS.Project = new Project("P1");//Various RTS properties like project can be set
 
OrderDetail OD = new OrderDetail();
RTS.Detail.Add(OD);
//Vaious Order Detail properties can be added like warehouse , sales reps , userfields etc
OD.InventoryItem = new InventoryItem("ItemA");//Use the inventoryItem constructor to specify a Item
OD.Quantity = 10;
OD.ToProcess = OD.Quantity;
OD.UnitSellingPrice = 20;
 
OD = new OrderDetail();
RTS.Detail.Add(OD);
OD.GLAccount = new GLAccount("Accounting Fees");//Use the GLAccount Item constructor to specify a Account
OD.Quantity = 1;
OD.ToProcess = OD.Quantity;
OD.UnitSellingPrice = 30;
 
RTS.Process();

The following example displays how to specify Additional Costs on a Return to supplier Document:

ReturnToSupplier RTS = new ReturnToSupplier();
RTS.Supplier = new Supplier("SupplierSDK1");
 
//Additional costs can be specified on a Return to supplier like the functionality in Evolution
CostAllocation costAlloc = new CostAllocation();
costAlloc.Supplier = new Supplier("Supplier1");
costAlloc.Reference = "ADDCost";
costAlloc.Description = "AddCost";
costAlloc.Amount = 200;
costAlloc.TaxRateID = 3;
costAlloc.Save();// Save the additional cost lines
 
RTS.AdditionalCosts.Add(costAlloc);//Add the total additional costs to the RTS
 
OrderDetail OD = new OrderDetail();
RTS.Detail.Add(OD);
OD.InventoryItem = new InventoryItem("ItemA");
OD.TotalAdditionalCost = 100;// Specify the Additional Costs per line or remove and use the distribute method below to distribute evenly between all lines
OD.Quantity = 1;
OD.ToProcess = OD.Quantity;
OD.UnitSellingPrice = 20;
 
OD = new OrderDetail();
RTS.Detail.Add(OD);
OD.InventoryItem = new InventoryItem("ItemB");
OD.TotalAdditionalCost = 100;
OD.Quantity = 1;
OD.ToProcess = OD.Quantity;
OD.UnitSellingPrice = 30;
 
// RTS.AdditionalCosts._Distribute();// Use this method when not specifying additional costs per line and to distribute the additional costs between each line
 
RTS.Process();