public static NetIncome Generate(IGrossIncome grossIncome, IncomeTax incomeTax) { return(new NetIncome() { Amount = grossIncome.Amount - incomeTax.Amount }); }
public static IncomeTax Generate(ITaxTable taxTable, IGrossIncome grossIncome, IPayPeriod payPeriod) { return(new IncomeTax() { Amount = TaxTableCalculator.GetTaxForPeriod(payPeriod, grossIncome, taxTable) }); }
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()); }
public static Super Generate(string superRate, IGrossIncome grossIncome) { if (string.IsNullOrWhiteSpace(superRate)) { throw new Exception("Super must be greater than 0"); } if (superRate.Contains('%')) { var indexOfPercentageSign = superRate.IndexOf('%'); superRate = superRate.Substring(0, indexOfPercentageSign); } var superRateAsANumber = ConvertSuperStringToNumber(superRate); var superOverPeriod = SuperCalculator.GetSuper(superRateAsANumber, grossIncome); return(new Super { Amount = superOverPeriod }); }
public static PaySlip Create(IEmployeeDetails employeeDetails, IPayPeriod payPeriod, IGrossIncome grossIncome, IIncomeTax incomeTax, INetIncome netIncome, ISuper super) { return(new PaySlip() { FullName = FullNameBuilder.Combine(employeeDetails), PayPeriod = DateCalculator.GetDateString(payPeriod), GrossIncome = grossIncome.Amount, IncomeTax = incomeTax.Amount, NetIncome = netIncome.Amount, Super = super.Amount }); }
private static ITaxBracket GetTaxBracket(IGrossIncome grossIncome, ITaxTable taxTable) { return(taxTable.TaxBrackets.Single(t => grossIncome.AnnualAmount > t.LowerLimit && grossIncome.AnnualAmount <= t.UpperLimit)); }
public static int GetSuper(decimal superRate, IGrossIncome grossIncome) { var superAmount = grossIncome.Amount * (superRate / 100M); return(superAmount.Rounding()); }