Example #1
0
 public static IncomeTax Generate(ITaxTable taxTable, IGrossIncome grossIncome, IPayPeriod payPeriod)
 {
     return(new IncomeTax()
     {
         Amount = TaxTableCalculator.GetTaxForPeriod(payPeriod, grossIncome, taxTable)
     });
 }
Example #2
0
        /// <summary>
        /// Calculate income tax for given salary and tax table
        /// </summary>
        /// <param name="salary"></param>
        /// <param name="taxTable"></param>
        /// <returns></returns>
        public decimal CalculateIncomeTax(decimal salary, ITaxTable taxTable)
        {
            var taxBracket = taxTable.GetTaxBracket(salary);

            if (taxBracket == null)
            {
                throw new TaxBracketNotFoundException(salary);
            }

            return(Math.Round(
                       (taxBracket.MandatoryTax + (salary - taxBracket.Minimum - 1) * (taxBracket.Rate / 100)) / 12
                       , 0
                       , MidpointRounding.AwayFromZero
                       ));
        }
 public TaxService(ITaxTable taxTable)
 {
     this._taxTable = taxTable;
 }
Example #4
0
 public MonthlyPay(ITaxTable taxTable)
 {
     CurrentTaxTable = taxTable;
 }
Example #5
0
 public TaxTableParser(ITaxTable getTaxBracket)
 {
     _taxTable = getTaxBracket.GetTaxTable();
 }
Example #6
0
		public TaxCalculator(ITaxTable taxTable, IBenefits benefits)
		{
			this.taxTable = taxTable;
			this.benefits = benefits;
		}
Example #7
0
        public static int GetTaxForPeriod(IPayPeriod payPeriod, IGrossIncome grossIncome, ITaxTable taxTable)
        {
            var taxBracket = GetTaxBracket(grossIncome, taxTable);

            var accumulatedTax = taxBracket.AccumulatedTaxFromPreviousBracket;
            var marginalTax    = (grossIncome.AnnualAmount - taxBracket.LowerLimit) * taxBracket.MarginalTaxRate;

            var totalTax = (accumulatedTax + marginalTax) * DateCalculator.GetPayPeriodAsAFractionOfAYear(payPeriod);

            return(totalTax.Rounding());
        }
Example #8
0
 private static ITaxBracket GetTaxBracket(IGrossIncome grossIncome, ITaxTable taxTable)
 {
     return(taxTable.TaxBrackets.Single(t =>
                                        grossIncome.AnnualAmount > t.LowerLimit && grossIncome.AnnualAmount <= t.UpperLimit));
 }
Example #9
0
 public PayslipGenerator(IPayCalculator payCalculator, ITaxTable taxTable)
 {
     _payCalculator = payCalculator;
     _taxTable      = taxTable;
 }