Thursday, April 2, 2015

Creating, Confirming, Invoicing Purchase Order using X++ in AX 2012

To Create a Purchase Order follow the below code :

static void Esh_CreatePO(Args _args)
{

PurchTable purchTable;
PurchLine purchLine;
VendTable vendTable = VendTable::find("US_TX_001"); //Specify Vendor Account which is nothing but selecting a Purchase Order
AxPurchTable axPurchTable;
AxPurchLine axPurchLine;
PurchFormLetter purchFormLetter;
;

//Create Purchase order
purchTable.initFromVendTable(vendTable);

axPurchTable = axPurchTable::newPurchTable(purchTable);
axPurchTable.parmPurchaseType(PurchaseType::Purch);
axPurchTable.parmDocumentStatus(DocumentStatus::PurchaseOrder);


axPurchTable.parmDeliveryDate(str2date("08/18/2014",213)); // Important because system check the transaction date.
axPurchTable.parmAccountingDate(str2date("08/18/2014",213));
axPurchTable.parmPurchStatus(PurchStatus::Backorder);

axPurchTable.doSave();


purchLine.initFromPurchTable(purchTable);

axPurchLine = AxPurchLine::newPurchLine(purchLine);
axpurchLine.parmItemId("A0001");
axpurchLine.parmInventDimId('000458');//important because Wherhouse, dimension location, dimension inventory status must be specified.
axPurchLine.parmPurchQty(10);
axPurchLine.parmPurchPrice(100);
axPurchLine.doSave();

//PO confirmation 
purchTable = axPurchTable.purchTable();
purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
purchFormLetter.update(purchTable, strFmt("Inv_%1", purchTable.PurchId));

// PO invoicing
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchTable, strFmt("Inv_%1", purchTable.PurchId));
info(strFmt("purchase order %1 invoiced",purchTable.PurchId));

}


Run the job and check the Invoiced Purchase Order using the PurchId in the Infolog.

4 comments:

  1. You content is really worth able Thanks for update keep trying to update

    Tally Sales

    ReplyDelete
  2. https://www.youtube.com/playlist?list=PLWSxgDbjVWTjxvgnaAZ0iK8o5dYHAYhrq

    Collection of Microsoft ERP Clips || ERP Licensing, Technical, Functional ,Manager Learning Videos Listing

    ReplyDelete

  3. Multi Channel Inventory Management Software | ERP Gold
    As more stores differentiate their sales functions and channels for income generation, inventory management becomes more and more difficult. Managing inventory for one or two stores can be simple, but managing multiple products in stock requires more insight and speed, and faster responses to the challenging trends. To cope up with those challenges,ERP gold inventory management software can be integrated with ecommerce marketplace Almost we cover all the ecommerce marketplace from ebay to amazon, to big commerce to shopify, to other online platforms. One of the most important thing is it is customizable as per business needs.
    Features of ERP Gold's Order Management Software includes:
    • It is cloud based with SSL connection
    • Business Operation Integration
    • Top Level Security with SSL
    • Adaptability with fast deployment
    • For more information, visit our website: https://www.erp.gold/small-business-inventory-software/

    • Or Get in touch with us: 1-888-334-4472
    • Address: Suite 183411, Shelby TWP, MI 48318
    • Email us: support@erp.gold

    multi channel inventory management software for online marketplace
    https://www.erp.gold/multi-channel-inventory-management-software/
    https://www.erp.gold/why-is-a-multi-channel-inventory-management-software-necessary-for-a-small-business/

    ReplyDelete

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...