vendredi 2 décembre 2011

Sales order creation at the most basic with ax Classes

Programmatic creation of a sales order can range from complex to easy, this is by far the Easy example making use of the axSalesTable and axSalesLine classes you dont get much easier than this.   The example should be a good starting point the ID’s used are part of the standard Demo data.
static void CreateSalesOrder_Job(Args _args)
{
    axSalesTable axSalesTable;
    salesID salesID;
    axSalesline axSalesLine;
 
    ;
    ttsBegin;
    axSalesTable = new axSalesTable();
 
    axSalesTable.parmCustAccount('1101');
    axSalesTable.save();
 
    salesID = axSalestable.salesTable().SalesId;
 
    info(salesID);
 
    axSalesline = new axSalesLine();
    axSalesLine.parmSalesId(salesID);
    axSalesline.parmItemId('7009');
    axSalesLine.parmSalesQty(10);
    axSalesLine.save();
    
    //Line with dimensions
    axSalesline = new axSalesLine();
    axSalesLine.parmSalesId(salesID);
    axSalesline.parmItemId('1001');
    axSalesLine.parmSalesQty(1);
    axSalesLine.axInventDim().parmConfigId('HD');
    axSalesLine.axInventDim().parmInventSizeId('42');
    axSalesLine.axInventDim().parmInventColorId('02');
    axSalesLine.save();
    ttsCommit;
 
}

Aucun commentaire:

Enregistrer un commentaire