Monday, 28 September 2020

Get Batch Reserve Quantity with Item Id Unit Conversion

Below code will return batch reserve quantity with item id unit conversion, if you do not need unit conversion simply use without conversion method.

/// <summary>

    /// Get reserve physical Quantity

    /// </summary>

    /// <param name = "_salesLine">Sales line</param>

    /// <returns>Reserve physical Qty</returns>

    public InventQtyReservPhysical getReservedPhysicalQty(SalesLine  _salesLine)

    {

        InventQtyReservPhysical inventQtyReservPhysical;

       

        if(_salesLine!=null)

        {

            InventTable inventTable = InventTable::find(_salesLine.ItemId);

            inventQtyReservPhysical = decRound(UnitOfMeasureConverter::convert(_salesLine.reservedPhysical(),

            UnitOfMeasure::unitOfMeasureIdBySymbol(inventTable.inventUnitId()),

            UnitOfMeasure::unitOfMeasureIdBySymbol(_salesLine.SalesUnit),

            NoYes::No,

            InventTable::itemProduct(inventTable.ItemId),

            NoYes::No), 0);

        }

        return inventQtyReservPhysical;

    }


No comments:

Post a Comment

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...