Пример #1
0
 public static IncomeTax Generate(ITaxTable taxTable, IGrossIncome grossIncome, IPayPeriod payPeriod)
 {
     return(new IncomeTax()
     {
         Amount = TaxTableCalculator.GetTaxForPeriod(payPeriod, grossIncome, taxTable)
     });
 }
Пример #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
                       ));
        }
Пример #3
0
 public TaxService(ITaxTable taxTable)
 {
     this._taxTable = taxTable;
 }
Пример #4
0
 public MonthlyPay(ITaxTable taxTable)
 {
     CurrentTaxTable = taxTable;
 }
Пример #5
0
 public TaxTableParser(ITaxTable getTaxBracket)
 {
     _taxTable = getTaxBracket.GetTaxTable();
 }
Пример #6
0
		public TaxCalculator(ITaxTable taxTable, IBenefits benefits)
		{
			this.taxTable = taxTable;
			this.benefits = benefits;
		}
Пример #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());
        }
Пример #8
0
 private static ITaxBracket GetTaxBracket(IGrossIncome grossIncome, ITaxTable taxTable)
 {
     return(taxTable.TaxBrackets.Single(t =>
                                        grossIncome.AnnualAmount > t.LowerLimit && grossIncome.AnnualAmount <= t.UpperLimit));
 }
Пример #9
0
 public PayslipGenerator(IPayCalculator payCalculator, ITaxTable taxTable)
 {
     _payCalculator = payCalculator;
     _taxTable      = taxTable;
 }