コード例 #1
0
        private static Tax GetStateIncomeTax(IncomeAndDeductions incomeAndDeductions)
        {
            int numStandardDeductions = 0;

            if (incomeAndDeductions.Status == Status.MarriedFilingJointly)
            {
                numStandardDeductions = 1;
            }

            decimal taxableIncome = incomeAndDeductions.GrossAnnualIncome -
                                    incomeAndDeductions.PensionDeduction -
                                    incomeAndDeductions.PreTaxDeductions -
                                    (c_californiaStandardDeduction * numStandardDeductions);

            List <TaxLine> taxLines = new List <TaxLine>();
            TaxTable       taxTable = TaxTable.CreateCaliforniaTaxTable(incomeAndDeductions.Status);

            foreach (TaxTableEntry entry in taxTable.Entries)
            {
                if (taxableIncome > 0)
                {
                    decimal taxableAtThisEntry = Math.Min(entry.Limit, taxableIncome);
                    taxLines.Add(
                        new TaxLine(
                            String.Format("California State at {0}%", (entry.Rate * 100).ToString("0.00")),
                            entry.Rate,
                            taxableAtThisEntry));

                    taxableIncome -= taxableAtThisEntry;
                }
            }

            return(new Tax("California State Income Tax", taxLines));
        }
コード例 #2
0
        private static Tax GetMedicareTax(IncomeAndDeductions incomeAndDeductions)
        {
            // what about pre tax deductions and 401(k)?
            TaxLine[] lines = new TaxLine[] {
                new TaxLine("Hospital Insurance", .0145m, incomeAndDeductions.GrossAnnualIncome)
            };

            return(new Tax("Medicare", lines));
        }
コード例 #3
0
        private static Tax GetStateDisabilityInsuranceTax(IncomeAndDeductions incomeAndDeductions)
        {
            // what about pre tax deductions and 401(k)?
            decimal sdiTaxable = Math.Min(incomeAndDeductions.GrossAnnualIncome, c_californiaStateDisabilityInsuranceTaxableLimit);

            TaxLine[] lines = new TaxLine[] {
                new TaxLine("State Disability Insurance", .009m, sdiTaxable)
            };

            return(new Tax("State Disability Insurance Tax", lines));
        }
コード例 #4
0
        private static Tax GetSocialSecurityTax(IncomeAndDeductions incomeAndDeductions)
        {
            // what about pre tax deductions and 401(k)?
            decimal oasiTaxable = Math.Min(incomeAndDeductions.GrossAnnualIncome, c_socialSecurityTaxableLimit);
            decimal diTaxable   = Math.Min(incomeAndDeductions.GrossAnnualIncome, c_socialSecurityTaxableLimit);

            TaxLine[] lines = new TaxLine[] {
                new TaxLine("Old-Age and Survivors Insurance", .053m, oasiTaxable),
                new TaxLine("Disability Insurance", .009m, diTaxable)
            };

            return(new Tax("Social Security", lines));
        }
コード例 #5
0
        public static TaxBreakdown Calculate(IncomeAndDeductions incomeAndDeductions)
        {
            Tax[] taxes = new Tax[] {
                GetFederalIncomeTax(incomeAndDeductions),
                GetStateIncomeTax(incomeAndDeductions),
                GetSocialSecurityTax(incomeAndDeductions),
                GetMedicareTax(incomeAndDeductions),
                GetStateDisabilityInsuranceTax(incomeAndDeductions)
            };
            TaxBreakdown taxBreakdown = new TaxBreakdown(
                incomeAndDeductions.GrossAnnualIncome,
                incomeAndDeductions.PensionDeduction,
                incomeAndDeductions.PreTaxDeductions,
                taxes,
                incomeAndDeductions.PostTaxDeductions);

            return(taxBreakdown);
        }