Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         Console.WriteLine("Type GenerateMonthlyPayslip \"YOUR NAME\" ANNUAL_SALARY to start..");
         string   line  = Console.ReadLine();
         string[] words = line.Split(' ');
         if (words[0] == "GenerateMonthlyPayslip")
         {
             var            employee             = new Employee(words[1], Convert.ToDecimal(words[2]));
             var            taxTable             = new TaxTable();
             var            computeIncomeCommand = new ComputeIncomeTaxCommand(taxTable, employee.AnnualSalary);
             MonthlyPaySlip monthlyPaySlip       = new MonthlyPaySlip(employee, computeIncomeCommand);
             Console.WriteLine(string.Format("Monthly Payslip for: \"{0:#.00}\"", monthlyPaySlip.EmployeeName));
             Console.WriteLine(string.Format("Gross Monthly Income: ${0:#.00}", monthlyPaySlip.GrossMonthlyIncome));
             Console.WriteLine(string.Format("Monthly Income Tax: ${0:#.00}", monthlyPaySlip.MonthlyIncomeTax));
             Console.WriteLine(string.Format("Net Monthly Income: ${0:#.00}", monthlyPaySlip.NetMonthlyIncome));
             Console.ReadLine();
         }
         else
         {
             Console.WriteLine("Unrecognized command");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Ejemplo n.º 2
0
        private decimal CalculateTaxForBracket(int salary, TaxTable taxbracket)
        {
            var dollarAmount = taxbracket.FactorInCents / 100;
            var tax          = taxbracket.Taxable ? (taxbracket.BaseAmount + (salary - taxbracket.LowerLimit) * dollarAmount) / 12 : 0;

            return(tax);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,TaxCode,TaxPercentage")] TaxTable taxTable)
        {
            if (id != taxTable.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(taxTable);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TaxTableExists(taxTable.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(taxTable));
        }
Ejemplo n.º 4
0
        public void GeneratePayslip_creates_valid_payslip()
        {
            // Arrange
            var payCalculator = new PayCalculator();
            var taxTable      = new TaxTable();

            // Act
            var payslipGenerator = new PayslipGenerator(payCalculator, taxTable);
            var payslip          = payslipGenerator.GeneratePayslip(_employee)
                                   .Split(',')
                                   .Select(x => x.Trim())
                                   .ToArray();

            // Name
            Assert.AreEqual(payslip[0], "John Smith");

            // Pay period
            Assert.AreEqual(payslip[1].Trim(), "01 March - 31 March");

            // Gross income
            Assert.AreEqual(payslip[2], "10000");

            // Income tax
            Assert.AreEqual(payslip[3], "2696");

            // Net income
            Assert.AreEqual(payslip[4], "7304");

            // Super
            Assert.AreEqual(payslip[5], "900");
        }
        public void ComputeIncomeTaxCommand_ReturnsExpectedValue(decimal annual_salary, decimal expected_income_tax)
        {
            var taxTable = new TaxTable();
            var computeIncomeTaxCommand = new ComputeIncomeTaxCommand(taxTable, annual_salary);
            var actual = computeIncomeTaxCommand.Call();

            Assert.Equal(expected_income_tax, actual);
        }
Ejemplo n.º 6
0
        //Federal Unemployment (FUTA) Tax

        //The Federal Unemployment Tax Act, with state unemployment systems, provides for payments of unemployment
        //compensation to workers who have lost their jobs. Most employers pay both a federal and a state unemployment tax.
        //For a list of state unemployment agencies, visit the U.S. Department of Labor’s website at
        //www.workforcesecurity.doleta.gov/unemploy/agencies.asp. Only the employer pays FUTA tax; it is not
        //withheld from the employee's wages. For more information, see the Instructions for Form 940.

        //Computing FUTA tax.   For 2014, the FUTA tax rate is 6.0%. The tax applies to the first $7,000 you pay to each
        //employee as wages during the year. The $7,000 is the federal wage base. Your state wage base may be different.
        //Generally, you can take a credit against your FUTA tax for amounts you paid into state unemployment funds.
        //The credit may be as much as 5.4% of FUTA taxable wages. If you are entitled to the maximum 5.4% credit, the FUTA
        //tax rate after credit is 0.6%. You are entitled to the maximum credit if you paid your state unemployment taxes in
        //full, on time, and on all the same wages as are subject to FUTA tax, and as long as the state is not determined to
        //be a credit reduction state. See the Instructions for Form 940 to determine the credit.

        //In some states, the wages subject to state unemployment tax are the same as the wages subject to FUTA tax.
        //However, certain states exclude some types of wages from state unemployment tax, even though they are subject to FUTA tax
        //(for example, wages paid to corporate officers, certain payments of sick pay by unions, and certain fringe benefits).
        //In such a case, you may be required to deposit more than 0.6% FUTA tax on those wages. See the Instructions for Form 940 for further guidance.

        // 2015, the FUTA Tax Rate remains 6.0%

        public Decimal Calculate(int year, Decimal adjustedGrossIncome)
        {
            TaxTable table = TaxTables.Values.Single(t => t.Year == year);

            Decimal taxable = Math.Min(table.FUTA_WageBase, adjustedGrossIncome);

            return((taxable * (table.FUTA_EmployerPercentage / 100)).Round());
        }
Ejemplo n.º 7
0
        public static TaxTable CreateTaxTable(string dataAreaId, string code)
        {
            TaxTable taxTable = new TaxTable();

            taxTable.dataAreaId = dataAreaId;
            taxTable.Code       = code;
            return(taxTable);
        }
Ejemplo n.º 8
0
        public void Setup()
        {
            base.SetUp();
            EmployeeDetails = BaseFixture.Create <EmployeeDetails>();
            EmployeeDetails.AnnualSalary = 60050;
            EmployeeDetails.SuperRate    = 9;
            var taxTable = new TaxTable()
            {
                TaxYears =
                {
                    new TaxYear()
                    {
                        Year     = 2019,
                        TaxSlabs =
                        {
                            new TaxSlab()
                            {
                                Base       = 0,
                                Rate       = 0,
                                LowerLimit = 0,
                                UpperLimit = 18200
                            },
                            new TaxSlab()
                            {
                                Base       = 0,
                                Rate       = 19,
                                LowerLimit = 18201,
                                UpperLimit = 37000
                            },
                            new TaxSlab()
                            {
                                Base       = 3572,
                                Rate       = 32.5,
                                LowerLimit = 37001,
                                UpperLimit = 87000
                            },
                            new TaxSlab()
                            {
                                Base       = 19822,
                                Rate       = 37,
                                LowerLimit = 87001,
                                UpperLimit = 180000
                            },
                            new TaxSlab()
                            {
                                Base       = 54232,
                                Rate       = 45,
                                LowerLimit = 180001,
                                UpperLimit = 1000000
                            }
                        }
                    }
                }
            };

            TaxTable = Options.Create(taxTable);
            Logger   = BaseFixture.Create <ILogger <ITaxYearManager> >();
        }
Ejemplo n.º 9
0
 public CustomerReceipt()
 {
     Tax                         = new TaxTable();
     Currency                    = new Currency();
     DocumentSerial              = new SerialCommercialDocuments();
     Customer                    = new Customer();
     OriginDocumentType          = new CommercialDocuments();
     CustomerReceiptInvoicesList = new HashSet <CustomerReceiptInvoices>();
 }
Ejemplo n.º 10
0
        public Guid Create(TaxTable taxtable)
        {
            PayrollDataContext context = new PayrollDataContext();
            if (taxtable.Id == Guid.Empty)
                taxtable.Id = Guid.NewGuid();

            context.TaxTables.InsertOnSubmit(taxtable);
            context.SubmitChanges();

            return taxtable.Id;
        }
        public async Task <IActionResult> Create([Bind("Id,TaxCode,TaxPercentage")] TaxTable taxTable)
        {
            if (ModelState.IsValid)
            {
                _context.Add(taxTable);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(taxTable));
        }
Ejemplo n.º 12
0
        public void Update(TaxTable taxtable)
        {
            PayrollDataContext context = new PayrollDataContext();

            var tax = context.TaxTables.Where(x=> x.Id == taxtable.Id).FirstOrDefault();
            tax.TaxCode = taxtable.TaxCode;
            tax.Description = taxtable.Description;
            tax.Exemption = taxtable.Exemption;

            context.SubmitChanges();
        }
        public decimal GetNetPayWithTaxDeductionOnly(int empId)
        {
            //Expression<Func<TaxTable, bool>> filterTaxTable = (x) => x.MaxSalary

            var      model    = _employeeRepository.FindItem(empId);
            TaxTable taxTable = _taxTableRepository.QueryItem(x => x.MaxSalary >= model.CurrentSalary && x.MinSalary <= model.CurrentSalary);

            decimal result = model.CurrentSalary - (model.CurrentSalary * (taxTable.DeductionPercentage * 0.01M));

            return(result);
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("Enter Amount to Calculate Tax");
            var amount        = Convert.ToDecimal(System.Console.ReadLine());
            var taxVariations = new TaxTable().Taxes;

            _cumulativetax = TaxTable.GetTaxPayable(amount, taxVariations);
            System.Console.WriteLine($"Cumulative Tax: {Math.Round(_cumulativetax,2)}");

            System.Console.ReadLine();
        }
Ejemplo n.º 15
0
        public void CalculateIncomeTax_should_return_correct_amount(decimal salary, decimal expected)
        {
            // Arrange
            var taxTable   = new TaxTable();
            var taxBracket = taxTable.GetTaxBracket(salary);

            // Act
            var actual = _payCalculator.CalculateIncomeTax(salary, taxBracket);

            // Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 16
0
 public Branch()
 {
     TaxGroup                = new TaxTable();
     Company                 = new Branch();
     AcademicSettings        = new AcademicSettings();
     AcademicYearList        = new HashSet <AcademicYear>();
     StudentRegistrationList = new HashSet <StudentRegistration>();
     BranchesList            = new HashSet <Branch>();
     SessionsList            = new HashSet <CurrentSession>();
     UserProfileBranchesList = new HashSet <UserProfileBranch>();
     StudentsList            = new HashSet <Student>();
     CandidatesList          = new HashSet <Candidate>();
     EmailsList              = new HashSet <EmailMonitor>();
 }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TaxTable = await _context.TaxTable.FirstOrDefaultAsync(m => m.Id == id);

            if (TaxTable == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 18
0
        public void TaxTable_Serialize_PropertyNamesAsExpected()
        {
            // Arrange
            var taxTable = new TaxTable();

            // Act
            var serializedObject = JsonConvert.SerializeObject(taxTable);

            // Assert
            Assert.AreEqual(@"{
				""name"": null,
                ""shipping_taxed"": false,
                ""rules"": null,
				""standalone"": false
			}"            .RemoveWhiteSpace(), serializedObject.RemoveWhiteSpace());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TaxTable = await _context.TaxTable.FindAsync(id);

            if (TaxTable != null)
            {
                _context.TaxTable.Remove(TaxTable);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            var firstNameInput = StandardMessage.CaptureData("first name");
            var surnameInput   = StandardMessage.CaptureData("surname");

            var annualSalaryInput = StandardMessage.CaptureData("annual salary");

            var superRateInput = StandardMessage.CaptureData("super rate");

            var startDate = StandardMessage.CaptureData("payment start date");
            var endDate   = StandardMessage.CaptureData("payment end date");

            var bracket1 = TaxBracket.Generate(0M, 18200M, 0M, 0M);
            var bracket2 = TaxBracket.Generate(18201M, 37000M, 0M, 0.325M);
            var bracket3 = TaxBracket.Generate(37001M, 87000M, 3572M, 0.325M);
            var bracket4 = TaxBracket.Generate(87001M, 180000M, 19822M, 0.37M);
            var bracket5 = TaxBracket.Generate(180000M, Int32.MaxValue, 54232M, 0.45M);

            var taxTable = TaxTable.Build(bracket1, bracket2, bracket3, bracket4, bracket5);

            EmployeeDetails employeeDetails = EmployeeDetails.ConstructFullName(firstNameInput, surnameInput);

            PayPeriod payPeriod = PayPeriod.Generate(startDate, endDate);

            GrossIncome grossIncome = GrossIncome.Generate(annualSalaryInput, payPeriod);
            IncomeTax   incomeTax   = IncomeTax.Generate(taxTable, grossIncome, payPeriod);
            NetIncome   netIncome   = NetIncome.Generate(grossIncome, incomeTax);

            Super super = Super.Generate(superRateInput, grossIncome);

            var paySlip = PaySlip.Create(
                employeeDetails,
                payPeriod,
                grossIncome,
                incomeTax,
                netIncome,
                super
                );

            var payslipOutput = PayslipBuilder.Print(paySlip);

            Console.WriteLine(payslipOutput);
//
        }
Ejemplo n.º 21
0
        // From: Wikipedia http://en.wikipedia.org/wiki/Federal_Insurance_Contributions_Act_tax

        // For 2014, the employee's share of the Social Security portion of the
        // FICA tax is 6.2% of gross compensation up to a limit of $117,000 of gross
        // compensation (resulting in a maximum Social Security tax of $7,254).[8] This limit,
        // known as the Social Security Wage Base, goes up each year based on average national wages
        // and, in general, at a faster rate than the Consumer Price Index (CPI-U). For the calendar
        // years of 2011 and 2012, the employee's share was temporarily reduced to 4.2% of gross
        // compensation with a limit of $106,800 for 2011 and $110,100 for 2012.[9] The employee's
        // share of the Medicare portion of the tax is 1.45% of wages, with no limit on the amount of
        // wages subject to the Medicare portion of the tax.[10] Because some payroll compensation is
        // subject to state income tax withholding in addition to Social Security tax withholding and
        // Medicare tax withholding, the Social Security and Medicare taxes account for only a portion
        // of the total percentage an employee constructively pays.

        // The employer is also liable for 6.2% Social Security and 1.45% Medicare taxes,[11] making the
        // total Social Security tax 12.4% of wages and the total Medicare tax 2.9%. (Self-employed people are
        // responsible for the entire FICA percentage of 15.3% (= 12.4% + 2.9%), since they are in a sense
        // both the employer and the employed; however, see the section on self-employed people for more details.)

        // Self-Employed People

        // A tax similar to the FICA tax is imposed on the earnings of self-employed individuals, such as
        // independent contractors and members of a partnership. This tax is imposed not by the Federal Insurance
        // Contributions Act but instead by the Self-Employment Contributions Act of 1954, which is codified as
        // Chapter 2 of Subtitle A of the Internal Revenue Code, 26 U.S.C. § 1401  through 26 U.S.C. § 1403
        // (the "SE Tax Act"). Under the SE Tax Act, self-employed people are responsible for the entire percentage
        // of 15.3% (= 12.4% [Soc. Sec.] + 2.9% [Medicare]); however, the 15.3% multiplier is applied to 92.35% of
        // the business's net earnings from self-employment, rather than 100% of the gross earnings; the difference,
        // 7.65%, is half of the 15.3%, and makes the calculation fair in comparison to that of regular
        // (non-self-employed) employees. It does this by adjusting for the fact that employees' 7.65% share of
        // their SE tax is multiplied against a number (their gross income) that does not include the putative
        // "employer's half" of the self-employment tax. In other words, it makes the calculation fair because
        // employees do not get taxed on their employers' contribution of the second half of FICA, therefore
        // self-employed people should not get taxed on the second half of the self-employment tax. Similarly,
        // self-employed people also deduct half of their self-employment tax (schedule SE) from their gross
        // income on the way to arriving at their adjusted gross income (AGI). This levels the amount paid by
        // self-employed persons in comparison to regular employees, who do not pay general income tax on their
        // employers' contribution of the second half of FICA, just as they did not pay FICA tax on it either.

        // A number of state and local employers and their employees in the states of Alaska, California, Colorado,
        // Illinois, Louisiana, Maine, Massachusetts, Nevada, Ohio and Texas are currently exempt from paying the
        // Social Security portion of FICA taxes. They provide alternative retirement and pension plans to their
        // employees. FICA initially did not apply to state and local governments, which were later given the option
        // of participating. Over time, most have elected to participate but a substantial number remain outside the system.

        public FICAResult Calculate(int year, decimal adjustedGrossIncome)
        {
            // TODO We don't handle self-employed people here

            if (year < TaxTables.Minimum_Year)
            {
                throw new ArgumentOutOfRangeException("Unable to process tax years before " + TaxTables.Minimum_Year);
            }

            if (adjustedGrossIncome < 0)
            {
                throw new ArgumentOutOfRangeException("AdjustedGrossIncome cannot be negative");
            }

            TaxTable table = TaxTables.Values.SingleOrDefault(t => t.Year == year);

            if (table == null)
            {
                throw new ArgumentOutOfRangeException("Unable to find tax table that matches parameters");
            }

            // TODO We're not taking into account the Medicare Surtax (0.9% for income over $200k) that was implemented as part of the ACA in tax years 2013+

            var result = new FICAResult {
            };

            Decimal social_security_taxable = Math.Min(table.SocialSecurityWageBase, adjustedGrossIncome);

            result.SocialSecurity = (social_security_taxable * (table.FICA_EmployeePercentage / 100)).Round();

            result.SocialSecurity_Employer = (social_security_taxable * (table.FICA_EmployerPercentage / 100)).Round();

            // Medicare does not have a "wage base", it's applicable to all earned income

            result.Medicare = result.Medicare_Employer = (adjustedGrossIncome * (table.MedicarePercentage / 100)).Round();

            return(result);
        }
Ejemplo n.º 22
0
 public TaxTableParser(ITaxTable getTaxBracket)
 {
     _taxTable = getTaxBracket.GetTaxTable();
 }
Ejemplo n.º 23
0
        public Decimal GetWageBase(int year)
        {
            TaxTable table = TaxTables.Values.Single(t => t.Year == year);

            return(table.FUTA_WageBase);
        }
 public void Setup()
 {
     _taxBracket = new TaxTable();
 }