Esempio n. 1
0
        /// <summary>
        /// 功能:将参数按照【见角进元】的规则计算并返回
        /// 日期:2013-04-02
        /// </summary>
        /// <param name="obj">要计算的对象</param>
        /// <returns>计算后的结果</returns>
        public static decimal GetJianJiaoJinYuan(object obj)
        {
            decimal value = DecimalHelper.ToDecimal(obj);

            value = decimal.Floor(value + 1m);
            return(value);
        }
Esempio n. 2
0
        /// <summary>
        /// 功能:将参数按照【见分进角】的规则计算并返回
        /// 日期:2013-04-02
        /// </summary>
        /// <param name="obj">要转成见分进角的对象</param>
        /// <returns>见分进角后的结果</returns>
        public static decimal GetJianFenJinJiao(object obj)
        {
            decimal value = DecimalHelper.ToDecimal(obj);

            value = decimal.Floor(value * 10 + 1m);
            value = value / 10;
            return(value);
        }
Esempio n. 3
0
 /// <summary>
 /// 功能:转成百分比
 /// 日期:2013-03-25
 /// </summary>
 /// <param name="obj">要转成百分比的对象</param>
 /// <returns>转成百分比之后的对象</returns>
 public static string ToPercent(object obj)
 {
     if (Convert.IsDBNull(obj) || obj == null || string.IsNullOrEmpty(obj.ToString()) || obj.ToString() == "0")
     {
         return("0");
     }
     return((DecimalHelper.ToDecimal(obj) * 100) + "%");
 }
Esempio n. 4
0
        /// <summary>
        /// 功能:将参数按照【舍去分】的规则计算并返回
        /// 日期:2013-04-02
        /// </summary>
        /// <param name="obj">要计算的对象</param>
        /// <returns>计算后的结果</returns>
        public static decimal GetSheQuFen(object obj)
        {
            decimal value = DecimalHelper.ToDecimal(obj);

            value  = value * 10;
            value  = Math.Floor(value);
            value /= 10;
            return(value);
        }
Esempio n. 5
0
        /// <summary>
        /// 功能:根据公积金申报基数由规则得到公积金申报缴存额
        /// 日期:2013-03-25
        /// </summary>
        /// <param name="gjjBase">公积申报基数</param>
        /// <returns>公积金申报缴存额</returns>
        /// 公积金缴存额计算规则:公积金基数乘以12%后四舍五入到整数,再乘以2,生成缴存额。计算的缴存额不允许超过上限,不能小于0
        public static int GetGjjFeeByBase(decimal gjjBase)
        {
            decimal dRate   = DecimalHelper.ToDecimal(WebConfigHelper.GetConfigurationApp("GjjFeeCalculator"));//0.12
            decimal decRate = decimal.Parse(dRate.ToString());
            decimal decData = gjjBase * decRate;
            int     iR      = Convert.ToInt32(MathRound(decData, 2));

            return(iR * 2);
        }
Esempio n. 6
0
        /// <summary>
        /// 功能:将参数按照【四舍五入】的规则计算并返回
        /// 日期:2013-04-02
        /// </summary>
        /// <param name="obj">要计算的对象</param>
        /// <returns>计算后的结果</returns>
        public static decimal GetSiSheWuRu(object obj)
        {
            decimal value = DecimalHelper.ToDecimal(obj);
            decimal vt    = Convert.ToDecimal(Math.Pow(10, 2));
            decimal vx    = value * vt;

            vx    = Math.Round(vx, 2);
            vx   += 0.5M;
            value = Convert.ToDecimal(Math.Floor((double)vx)) / vt;
            return(value);
        }
Esempio n. 7
0
        /// <summary>
        /// 功能:将参数按照【舍去角】的规则计算并返回
        /// 日期:2013-04-02
        /// </summary>
        /// <param name="obj">要计算的对象</param>
        /// <returns>计算后的结果</returns>
        public static decimal GetSheQuJiao(object obj)
        {
            decimal value = DecimalHelper.ToDecimal(obj);

            return(Math.Floor(value));
        }
Esempio n. 8
0
        /// <summary>
        /// 功能:将参数按照【四舍五入到元】的规则计算并返回
        /// 日期:2013-04-02
        /// </summary>
        /// <param name="obj">要计算的对象</param>
        /// <returns>计算后的结果</returns>
        public static decimal GetSiSheWuRuToYuan(object obj)
        {
            decimal value = DecimalHelper.ToDecimal(obj);

            return(BusinessHelper.MathRound(value, 0));
        }