c
复制代码
SalesTable salesTable;
SalesLine salesLine;
NumberSeq numberSeq;
ttsBegin;
//creating sales order header
//getting sales order id from number sequence
numberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId());
numberSeq.used();
salesTable.SalesId = numberSeq.num();
salesTable.initValue();
salesTable.CustAccount = 'F0001';
salesTable.initFromCustTable();
//validate
if (!salesTable.validateWrite()) {
throw Exception::Error;
}
salesTable.insert();
//creating sales order line
salesLine.SalesId = salesTable.SalesId;
salesLine.ItemId = 'D0001';
salesLine.SalesQty = 2;
salesLine.LinePercent = 1;
salesLine.createLine(true, true, true, true, true, true);
ttsCommit;