Beispiel #1
0
        /// <summary>
        /// Return the basic rate for this tax
        /// </summary>
        /// <param name="limitBase"></param>
        /// <returns></returns>
        public decimal PercentPerTax(decimal limitBase)
        {
            // Find the interval for this limitBase
            TaxInterval interval     = this.TaxIntervals.Find(limitBase);
            decimal     intervalRate = interval.Value;

            switch (this.TaxBase)
            {
            case TaxBase.PercentPerTax:
                if (!String.IsNullOrEmpty(this.TaxOnTax) && this.TaxOnTaxInstance != null)
                {
                    return((intervalRate * this.TaxOnTaxInstance.Value) / 100);
                }
                else
                {
                    return(decimal.Zero);
                }

            case TaxBase.PercentPerGross:
                if (!String.IsNullOrEmpty(this.TaxOnTax) && this.TaxOnTaxInstance != null)
                {
                    return(intervalRate + ((intervalRate * this.TaxOnTaxInstance.Value) / 100));
                }
                else
                {
                    return(intervalRate);
                }

            case TaxBase.PercentGrossOnNet:
                return(PercentGrossOnNet(intervalRate));

            case TaxBase.AmountByUnit:
            case TaxBase.PercentPerNet:
            default:
                return(intervalRate);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Determine whether any portion of the given amount is within the given interval
 /// </summary>
 /// <param name="interval"></param>
 /// <param name="amount"></param>
 /// <returns></returns>
 /// <example>
 /// Interval = $25 - $100
 /// Amount = $10  => FALSE
 /// Amount = $50  => TRUE
 /// Amount = $150 => TRUE
 /// </example>
 public static bool AmountInInterval(this TaxInterval interval, decimal amount)
 {
     return((interval.TaxLimitMin == decimal.Zero) || (interval.TaxLimitMin < amount));
 }
Beispiel #3
0
 /// <summary>
 /// Determine whether the given amount is wholly within the interval
 /// </summary>
 /// <param name="interval"></param>
 /// <param name="amount"></param>
 /// <returns></returns>
 /// <example>
 /// Interval = $25 - $100
 /// Amount = $10  => FALSE
 /// Amount = $50  => TRUE
 /// Amount = $150 => FALSE
 /// </example>
 public static bool WholeAmountInInterval(this TaxInterval interval, decimal amount)
 {
     // return if the amount is in within the interval or equal to either end.
     return((interval.TaxLimitMin == decimal.Zero || interval.TaxLimitMin <= amount) &&
            (interval.TaxLimitMax == decimal.Zero || interval.TaxLimitMax >= amount));
 }