2012年10月29日星期一
How to using code create sales order
/*sales Order using X++
Hi,In this post we will learn the below using X++ :
1) How to Create Sales Order
2) How to Create Sales Order Line
3) How to Post Sales Order
*/
public static void THK_createSalesOrderDemo(Args _s)
{
// Create the Sales Order
SalesTable salesTable;
SalesLine sl;
SalesId sid;
NumberSeq NumberSeq;
SalesFormLetter fl;
;
NumberSeq = NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().numberSequence);
sid = NumberSeq.num();
//create sales order header
salesTable.SalesId = sid;
salesTable.initValue();
salesTable.CustAccount = "1101";
salesTable.initFromCustTable();
salesTable.insert();
//Create the Sales Line with the created Sales Order
sl.SalesId = sid;
sl.ItemId = "1109";
sl.CreateLine(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);
info("Sales Order Created with Line");
//How to Post the Sales Order Invoice
fl=SalesFormLetter::construct(DocumentStatus::Invoice);
fl.update(SalesTable::find(sid));
info("Sales Order Posted");
}
订阅:
博文评论 (Atom)
没有评论:
发表评论