2012年10月29日星期一
How to using code create purchase order
Purchase Order using X++
In this post we will learn the below using X++ :
1) How to Create Purchase Order
2) How to Create Purchase Order Line
3) How to Post Purchase Order
static void THK_createPurchaseOrder(Args _args)
{
PurchTable purchTable;
PurchLine pline;
NumberSeq ns;
PurchID pid;
PurchFormLetter pl;
;
//Create Purchase Order
ns = NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().NumberSequence);
purchTable.initValue();
pid = ns.num();
purchTable.PurchId = pid;
purchTable.OrderAccount = "4202";
purchTable.initFromVendTable();
purchTable.insert();
//Create Purchase Line
pline.clear();
pline.PurchId = pid;
pline.ItemId = "1109";
pline.createLine(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);
info("Purchase Order Created Sucessfully");
//Post the PO
pl = PurchFormLetter::construct(DocumentStatus::Invoice);
pl.update(PurchTable::find(pid), pid, SystemDateGet(),PurchUpdate::All,AccountOrder::None,false,true);
info("Posted Sucessfully");
}
订阅:
博文评论 (Atom)
没有评论:
发表评论