9 Ağustos 2016 Salı

AXAPTA - Eldeki miktar (invent on hand)

//source: http://microsoft-dynamics-ax-erp.blogspot.com.tr/2012/07/find-inventonhand-in-axapta-x.html
static InventOnHand findOnHandByLocationId(ItemId _itemId, InventLocationId _inventLocationId = "")
{
    InventDim           inventDim;
    InventDimParm       inventDimParm;
    InventOnHand        inventOnHand = new InventOnHand();
    ;

    if (_inventLocationId == "")

         return InventOnhand::newItemId(_itemId);
    //Take a combination of dimension , against which you want to find the stock
    inventDim.InventLocationId  = _inventLocationId;

    //Set the flag for the selected dimensions as active
    inventDimParm.initFromInventDim(inventDim);

    //Initialize the inventSumDateDim with Date,item,dimension and dim parameter
    inventOnHand = InventOnHand::newParameters(_itemid,
                                               inventDim,
                                               inventDimParm);

    return inventOnHand;
}