public PersonReport(IPensionAgeCalc pensionAgeCalc, IIncomeTaxCalculator incomeTaxCalculator, Person person, DateTime now, DateTime?givenRetirementDate, IAssumptions assumptions, decimal monthlySpending, ITaxSystem taxSystem) { Person = person; StatePensionDate = pensionAgeCalc.StatePensionDate(person.Dob, person.Sex); PrivatePensionDate = pensionAgeCalc.PrivatePensionDate(StatePensionDate, person.Dob); TargetRetirementDate = givenRetirementDate; var salaryAfterDeductions = person.EmployeeContribution.SubtractContribution(person.Salary); var taxResult = incomeTaxCalculator.TaxFor(salaryAfterDeductions); var taxResultWithRental = incomeTaxCalculator.TaxFor(salaryAfterDeductions, rentalIncome: person.RentalPortfolio.RentalIncome()); NationalInsuranceBill = Convert.ToInt32(taxResult.NationalInsurance); IncomeTaxBill = Convert.ToInt32(taxResult.IncomeTax); RentalTaxBill = Convert.ToInt32(taxResultWithRental.TotalTaxFor(IncomeType.RentalIncome)); TakeHomeSalary = Convert.ToInt32(taxResult.AfterTaxIncome); TakeHomeRentalIncome = Convert.ToInt32(person.RentalPortfolio.TotalNetIncome() - RentalTaxBill); SalarySteps = SetupSalarySteps(person, now).ToList(); var niContributingYearsSoFar = NiContributingYearsCalc.CalculateContributingYearsSoFar(person, MonthlySalaryAfterDeductionsAt(now), now, taxSystem); var mode = givenRetirementDate.HasValue ? StepType.GivenDate : StepType.CalcMinimum; StepReport = new StepsReport(person, niContributingYearsSoFar, mode, now, assumptions, monthlySpending, PrivatePensionDate, taxSystem); _take25 = assumptions.Take25; }
public RetirementIncrementalApproachCalculator(IDateProvider dateProvider, IAssumptions assumptions, IPensionAgeCalc pensionAgeCalc, IStatePensionAmountCalculator statePensionAmountCalculator, ITaxSystem taxSystem) { _assumptions = assumptions; _pensionAgeCalc = pensionAgeCalc; _statePensionAmountCalculator = statePensionAmountCalculator; _taxSystem = taxSystem; _now = dateProvider.Now(); }
public StepsReport(Person person, int niContributingYearsSoFar, StepType stepType, DateTime now, IAssumptions assumptions, decimal monthlySpendingNow, DateTime privatePensionDate, ITaxSystem taxSystem) { _person = person; _stepType = stepType; _now = now; _assumptions = assumptions; _taxSystem = taxSystem; _privatePensionDate = privatePensionDate; Steps.Add(Step.CreateInitialStep(now, niContributingYearsSoFar, (int)person.ExistingSavings, (int)person.ExistingPrivatePension, person.EmergencyFundSpec, monthlySpendingNow)); }
public Step(Step previousStep, DateTime stepStepDate, Person person, bool calcdMinimum, IAssumptions assumptions, DateTime privatePensionDate, decimal spending, ITaxSystem taxSystem, DateTime?givenRetirementDate = null, MoneyPots pots = null) { StepDate = stepStepDate; PrivatePensionAmount = previousStep.PrivatePensionAmount; Spending = spending; NiContributingYears = previousStep.NiContributingYears; _previousStep = previousStep; _person = person; _calcdMinimum = calcdMinimum; _assumptions = assumptions; _privatePensionDate = privatePensionDate; _givenRetirementDate = givenRetirementDate; _taxSystem = taxSystem; Pots = pots ?? MoneyPots.From(previousStep.Pots, _person.EmergencyFundSpec.RequiredEmergencyFund(Spending)); }
public RetirementReport(IPensionAgeCalc pensionAgeCalc, IIncomeTaxCalculator incomeTaxCalculator, Family family, DateTime now, DateTime?givenRetirementDate, IAssumptions assumptions, ITaxSystem taxSystem) { _family = family; _assumptions = assumptions; TimeToRetirement = new DateAmount(DateTime.MinValue, DateTime.MinValue); TargetRetirementDate = givenRetirementDate; var spendingStepInputs = family.SpendingStepInputs.OrderBy(input => input.Date).ToList(); for (int i = 0; i < spendingStepInputs.Count; i++) { var endDate = i < spendingStepInputs.Count - 1 ? spendingStepInputs[i + 1].Date : family.PrimaryPerson.Dob.AddYears(100); SpendingSteps.Add(new SpendingStepReport(spendingStepInputs[i].Date, endDate.AddDays(-1), spendingStepInputs[i].NewAmount)); } var monthlySpending = MonthlySpendingAt(now) / family.Persons.Count; foreach (var person in family.Persons) { Persons.Add(new PersonReport(pensionAgeCalc, incomeTaxCalculator, person, now, givenRetirementDate, _assumptions, monthlySpending, taxSystem)); } }
public static int CalculateContributingYearsSoFar(Person person, Money monthlySalary, DateTime now, ITaxSystem taxSystem) { int contributingYearsFromEmployment = 0; int contributingYearsFromChildren = 0; if (person.NiContributingYears.HasValue) { return(person.NiContributingYears.Value); } else { if (monthlySalary * 12 <= taxSystem.LowerEarningsLimit) { contributingYearsFromEmployment = 0; } else { contributingYearsFromEmployment = AgeCalc.Age(person.Dob, now) - 21; } if (person.Children.Count > 0) { var age = EldestChildAge(person, now); contributingYearsFromChildren = Math.Max(12, age); } } return(Math.Max(contributingYearsFromEmployment, contributingYearsFromChildren)); }