public void CreateSalesOrder()
{
CustTable custtable;
SalesTable salesTable;
NumberSeq NumberSeq;
SalesId sid;
SalesLine sl;
// sales order header part
NumberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId() , true);
sid = NumberSeq.num();
salesTable.SalesId = sid;
salesTable.initValue();
salesTable.CustAccount = custtable.AccountNum;
salesTable.initFromCustTable();
salesTable.ShippingDateRequested = systemDateGet();
salesTable.ShippingDateConfirmed = systemDateGet();
salesTable.ReceiptDateConfirmed = systemDateGet();
salesTable.ReceiptDateRequested = systemDateGet();
ttsBegin;
salesTable.insert();
ttsCommit;
// Sales order line part
sl.clear();
sl.SalesId = salesTable.SalesId;
sl.ItemId = //ItemID;
sl.initFromInventTable(InventTable::find(sl.ItemId));
sl.SalesQty = //QTY;
sl.SalesPrice = InventTableModule::find(sl.ItemId,ModuleInventPurchSales::Sales).Price;
sl.LineAmount = sl.SalesQty*sl.SalesPrice;
sl.createLine(NoYes::Yes, // Validate
NoYes::Yes, // initFromSalesTable
NoYes::No, // initFromInventTable
NoYes::Yes, // calcInventQty
NoYes::Yes, // searchMarkup
NoYes::No); // searchPrice
}
}