From 493a6361de0fe0e7fb81dc8bb7ca73ec5ecd00b2 Mon Sep 17 00:00:00 2001 From: Jared Self Date: Thu, 14 Jan 2021 13:32:23 -0700 Subject: [PATCH] SC South Carolina --- .../data/state/sc_south_carolina.xml | 46 +++++---- .../test_us_sc_south_carolina_payslip_2019.py | 97 ------------------- .../test_us_sc_south_carolina_payslip_2020.py | 16 +-- .../test_us_sc_south_carolina_payslip_2021.py | 36 +++++++ 4 files changed, 70 insertions(+), 125 deletions(-) delete mode 100644 l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py create mode 100644 l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2021.py diff --git a/l10n_us_hr_payroll/data/state/sc_south_carolina.xml b/l10n_us_hr_payroll/data/state/sc_south_carolina.xml index b2a46192..04a10d70 100644 --- a/l10n_us_hr_payroll/data/state/sc_south_carolina.xml +++ b/l10n_us_hr_payroll/data/state/sc_south_carolina.xml @@ -7,11 +7,7 @@ - - 14000.0 - - - + 14000.0 @@ -26,12 +22,8 @@ - - 1.09 - - - + 0.55 @@ -70,6 +62,19 @@ + + + [ + ( 2800, 0.5, 0.0), + ( 5610, 3.0, 70.00), + ( 8410, 4.0, 126.10), + (11220, 5.0, 210.20), + (14030, 6.0, 322.40), + ('inf', 7.0, 462.70), + ] + + + @@ -78,16 +83,17 @@ - - 2510 - - - 2590 + + + 2670 + + + @@ -96,16 +102,16 @@ - - 3470.0 - - - 3820.0 + + 4200 + + + diff --git a/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py deleted file mode 100644 index 793f84c4..00000000 --- a/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py +++ /dev/null @@ -1,97 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from .common import TestUsPayslip, process_payslip - - -class TestUsSCPayslip(TestUsPayslip): - - # Taxes and Rates - SC_UNEMP_MAX_WAGE = 14000.0 - US_SC_UNEMP = -1.09 / 100 - US_SC_exemption_amount = 2510.00 - - def test_2019_taxes_weekly(self): - # We will hand calculate the amount to test for state withholding. - schedule_pay = 'weekly' - salary = 50000.00 # Employee is paid 50000 per week to be in top tax bracket - allowances = 2 - # Calculate annual wages - annual = 50000 * 52.0 - # From our annual we deduct personal exemption amounts. - # We deduct 2510.00 per exemption. Since we have two exemptions: - personal_exemption = self.US_SC_exemption_amount * allowances # 5020.0 - # From annual, we will also deduct a standard_deduction of 3470.00 or .1 of salary, which ever - # is small -> if 1 or more exemptions, else 0 - standard_deduction = 3470.00 - taxable_income = annual - personal_exemption - standard_deduction # 2591510.0 - # We then calculate the amounts off the SC tax pdf tables. - # 2591478.0 is in the highest bracket - test_amt = (taxable_income * (7.0 / 100.0)) - 467.95 - test_amt = 180935.51 - # Make it per period then negative - test_amt = (test_amt / 52.0) # Divided by 52 since it is weekly. - # test_amt = 3479.52 - test_amt = -test_amt - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('SC'), - state_income_tax_exempt=False, - sc_w4_sit_allowances=allowances, - schedule_pay=schedule_pay) - - self._log('2019 South Carolina tax first payslip:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - payslip.compute_sheet() - cats = self._getCategories(payslip) - - self.assertPayrollAlmostEqual(cats['ER_US_SUTA'], self.SC_UNEMP_MAX_WAGE * self.US_SC_UNEMP) - self.assertPayrollAlmostEqual(cats['EE_US_SIT'], test_amt) - - process_payslip(payslip) - - remaining_SC_UNEMP_wages = self.SC_UNEMP_MAX_WAGE - annual if (annual < self.SC_UNEMP_MAX_WAGE) \ - else 0.00 - - self._log('2019 South Carolina tax second payslip:') - - payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28') - payslip.compute_sheet() - cats = self._getCategories(payslip) - - self.assertEqual(0.0, remaining_SC_UNEMP_wages) - self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_SC_UNEMP_wages * self.US_SC_UNEMP) - - def test_2019_taxes_filing_status(self): - salary = 20000.00 # Wages per pay period - schedule_pay = 'monthly' - annual = salary * 12 - allowances = 1 - # Hand Calculations - personal_exemption = 2510.00 - standard_deduction = min(3470.00, .1 * annual) # 3470.0 but min is shown for the process - taxable = annual - personal_exemption - standard_deduction - # taxable = 234020 - test_amt = ((taxable) * (7.0 / 100.0)) - 467.95 # 15991.850000000002 - test_amt = test_amt / 12.0 # Put it into monthly -> 1332.654166666667 - # Make it negative - test_amt = -test_amt - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('SC'), - state_income_tax_exempt=False, - sc_w4_sit_allowances=allowances, - schedule_pay=schedule_pay) - - self._log('2019 South Carolina tax first payslip: ') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - payslip.compute_sheet() - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], self.SC_UNEMP_MAX_WAGE * self.US_SC_UNEMP) - self.assertPayrollAlmostEqual(cats['EE_US_SIT'], test_amt) - - process_payslip(payslip) diff --git a/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py index 170c3bf5..086af309 100644 --- a/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py +++ b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py @@ -6,11 +6,11 @@ from .common import TestUsPayslip class TestUsSCPayslip(TestUsPayslip): ### - # 2020 Taxes and Rates + # 2021 Taxes and Rates ### SC_UNEMP_MAX_WAGE = 14000.0 SC_UNEMP = 0.55 - # Calculation based on https://dor.sc.gov/forms-site/Forms/WH1603F_2020.pdf + # Calculation based on https://dor.sc.gov/forms-site/Forms/WH1603F_2021.pdf def _test_sit(self, wage, additional_withholding, exempt, allowances, schedule_pay, date_start, expected_withholding): employee = self._createEmployee() @@ -28,9 +28,9 @@ class TestUsSCPayslip(TestUsPayslip): self._log('Computed period tax: ' + str(expected_withholding)) self.assertPayrollAlmostEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding) - def test_2020_taxes_example(self): - self._test_er_suta('SC', self.SC_UNEMP, date(2020, 1, 1), wage_base=self.SC_UNEMP_MAX_WAGE) - self._test_sit(750.0, 0.0, False, 3.0, 'weekly', date(2020, 1, 1), 28.73) - self._test_sit(800.0, 0.0, True, 0.0, 'weekly', date(2020, 1, 1), 0.00) - self._test_sit(9000.0, 0.0, False, 0.0, 'monthly', date(2020, 1, 1), 594.61) - self._test_sit(5000.0, 10.0, False, 2.0, 'semi-monthly', date(2020, 1, 1), 316.06) + def test_2021_taxes_example(self): + self._test_er_suta('SC', self.SC_UNEMP, date(2021, 1, 1), wage_base=self.SC_UNEMP_MAX_WAGE) + self._test_sit(750.0, 0.0, False, 3.0, 'weekly', date(2021, 1, 1), 28.73) + self._test_sit(800.0, 0.0, True, 0.0, 'weekly', date(2021, 1, 1), 0.00) + self._test_sit(9000.0, 0.0, False, 0.0, 'monthly', date(2021, 1, 1), 594.61) + self._test_sit(5000.0, 10.0, False, 2.0, 'semi-monthly', date(2021, 1, 1), 316.06) diff --git a/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2021.py b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2021.py new file mode 100644 index 00000000..3fb11459 --- /dev/null +++ b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2021.py @@ -0,0 +1,36 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + +from datetime import date, timedelta +from .common import TestUsPayslip + + +class TestUsSCPayslip(TestUsPayslip): + ### + # 2021 Taxes and Rates + ### + SC_UNEMP_MAX_WAGE = 14000.0 + SC_UNEMP = 0.55 + # Calculation based on https://dor.sc.gov/forms-site/Forms/WH1603F_2021.pdf + + def _test_sit(self, wage, additional_withholding, exempt, allowances, schedule_pay, date_start, expected_withholding): + employee = self._createEmployee() + contract = self._createContract(employee, + wage=wage, + state_id=self.get_us_state('SC'), + state_income_tax_additional_withholding=additional_withholding, + state_income_tax_exempt=exempt, + sc_w4_sit_allowances=allowances, + schedule_pay=schedule_pay) + payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7)) + payslip.compute_sheet() + cats = self._getCategories(payslip) + + self._log('Computed period tax: ' + str(expected_withholding)) + self.assertPayrollAlmostEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding) + + def test_2021_taxes_example(self): + self._test_er_suta('SC', self.SC_UNEMP, date(2021, 1, 1), wage_base=self.SC_UNEMP_MAX_WAGE) + self._test_sit(750.0, 0.0, False, 3.0, 'weekly', date(2021, 1, 1), 27.57) + self._test_sit(800.0, 0.0, True, 0.0, 'weekly', date(2021, 1, 1), 0.00) + self._test_sit(9000.0, 0.0, False, 0.0, 'monthly', date(2021, 1, 1), 591.44) + self._test_sit(5000.0, 10.0, False, 2.0, 'semi-monthly', date(2021, 1, 1), 312.90)