Tuesday, July 23, 2019

How to get cost price of an Item based on Warehouse X++

public  real  GetCostPrice(ItemId _itemId, InventLocationId _inventLocationId)
    {
        InventDimParm inventDimParm;
        InventOnHand inventOnHand;
        InventSum inventSum;
        InventDim inventDim;
        ;

        select firstOnly1 inventSum where inventSum.ItemId == _itemId;
       
        //inventDim.InventSiteId = "SiteId";
        inventDim.InventLocationId = _inventLocationId;
        inventDimParm.initFromInventDim(inventDim);
        inventOnHand = InventOnHand::newItemDim(inventSum.ItemId, inventDim, inventDimParm);
        return inventOnHand.costPricePcs();
       // info(strfmt("%1", inventOnHand.costPricePcs()));
    }

Thanks
Uma

No comments:

Post a Comment

using SQL Query in X++

 If you need to execute sql query inside your X++ code then below example can help you. To pass value to SQL query we need to use strfmt() f...