Exemple #1
0
 public static NetIncome Generate(IGrossIncome grossIncome, IncomeTax incomeTax)
 {
     return(new NetIncome()
     {
         Amount = grossIncome.Amount - incomeTax.Amount
     });
 }
Exemple #2
0
 public static IncomeTax Generate(ITaxTable taxTable, IGrossIncome grossIncome, IPayPeriod payPeriod)
 {
     return(new IncomeTax()
     {
         Amount = TaxTableCalculator.GetTaxForPeriod(payPeriod, grossIncome, taxTable)
     });
 }
Exemple #3
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());
        }
Exemple #4
0
        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
            });
        }
Exemple #5
0
 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
     });
 }
Exemple #6
0
 private static ITaxBracket GetTaxBracket(IGrossIncome grossIncome, ITaxTable taxTable)
 {
     return(taxTable.TaxBrackets.Single(t =>
                                        grossIncome.AnnualAmount > t.LowerLimit && grossIncome.AnnualAmount <= t.UpperLimit));
 }
Exemple #7
0
        public static int GetSuper(decimal superRate, IGrossIncome grossIncome)
        {
            var superAmount = grossIncome.Amount * (superRate / 100M);

            return(superAmount.Rounding());
        }