Tuesday, 18 August 2015

Price Conversion - based on units

public SalesQuoteUOMPrice TotalConversionUnit(UnitOfMeasureSymbol _fromunit,UnitOfMeasureSymbol _tounit,SalesOrderedQty _qty,ItemId _itemid)
{
    SalesQuoteUOMPrice  totalConversionUnit;
    Qty         convertQty;
    UnitOfMeasureConverter_Product  unitConverter   = UnitOfMeasureConverter_Product::construct();

    unitConverter.parmProduct(InventTable::find(_itemid).Product);
    unitConverter.parmFromUnitOfMeasure(UnitOfMeasure::unitOfMeasureIdBySymbol(_fromunit));
    unitConverter.parmToUnitOfMeasure(UnitOfMeasure::unitOfMeasureIdBySymbol(_tounit));
    unitConverter.parmRoundAbsoluteValue(NoYes::Yes);
    unitConverter.parmApplyRounding(NoYes::Yes);

    return unitConverter.convertValue(1);

}

No comments:

Post a Comment