static void createAndPostPurchOrder(Args _args)

{

AxPurchLine axPurchLine = new axPurchLine();

AxPurchTable axPurchTable = new axPurchTable();
PurchFormLetter purchFormLetterInvoice = PurchFormLetter::construct(DocumentStatus::Invoice);
PurchFormLetter purchFormLetterConfirm = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);

;

axPurchTable.parmPurchId();

axPurchTable.parmOrderAccount(‘INMF-000001’);

axPurchTable.save();

axPurchLine.parmPurchId(axPurchTable.parmPurchId());

axPurchLine.parmItemId(‘D0003’);

axPurchLine.axInventDim().parmInventSiteId(“Site 1”);

axPurchLine.axInventDim().parmInventLocationId(“11”);

axPurchLine.parmPurchQty(1000);

axPurchLine.parmPurchPrice(20);

axPurchLine.save();

purchFormLetterCOnfirm.update(axPurchTable.purchTable(),axPurchTable.parmPurchId());
purchFormLetterInvoice.update(axPurchTable.purchTable(),axPurchTable.parmPurchId());

}