private static void ConvertUOM(PXCache cache, int?inventoryID, string sourceUom, string destinationUom, bool viceVersa, ref decimal cost) { if (sourceUom != destinationUom && cost != 0) { INUnit conversion = INUnit.UK.ByInventory.FindDirty(cache.Graph, inventoryID, viceVersa ? sourceUom : destinationUom); if (conversion == null) { throw new PXUnitConversionException(); } cost = INUnitAttribute.Convert(cache, conversion, cost, INPrecision.UNITCOST, viceVersa); } }