public static IncomeTax Generate(ITaxTable taxTable, IGrossIncome grossIncome, IPayPeriod payPeriod) { return(new IncomeTax() { Amount = TaxTableCalculator.GetTaxForPeriod(payPeriod, grossIncome, taxTable) }); }
/// <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; }
public MonthlyPay(ITaxTable taxTable) { CurrentTaxTable = taxTable; }
public TaxTableParser(ITaxTable getTaxBracket) { _taxTable = getTaxBracket.GetTaxTable(); }
public TaxCalculator(ITaxTable taxTable, IBenefits benefits) { this.taxTable = taxTable; this.benefits = benefits; }
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()); }
private static ITaxBracket GetTaxBracket(IGrossIncome grossIncome, ITaxTable taxTable) { return(taxTable.TaxBrackets.Single(t => grossIncome.AnnualAmount > t.LowerLimit && grossIncome.AnnualAmount <= t.UpperLimit)); }
public PayslipGenerator(IPayCalculator payCalculator, ITaxTable taxTable) { _payCalculator = payCalculator; _taxTable = taxTable; }