Example #1
0
        /// <summary>
        /// Convert qty to target UOM and round.
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="C_UOM_ID"></param>
        /// <param name="qty"></param>
        /// <returns>minutes - 0 if not found</returns>
        static public int ConvertToMinutes(Ctx ctx, int C_UOM_ID, Decimal?qty)
        {
            if (qty == null)
            {
                return(0);
            }
            int C_UOM_To_ID = MUOM.GetMinute_UOM_ID(ctx);

            if (C_UOM_ID == C_UOM_To_ID)
            {
                return(Decimal.ToInt32(qty.Value));
            }

            Decimal?result = (Decimal?)Convert(ctx, C_UOM_ID, C_UOM_To_ID, qty);

            if (result == null)
            {
                return(0);
            }
            return(Decimal.ToInt32(result.Value));
        }