diff --git a/l10n_us_hr_payroll/data/state/nc_northcarolina.xml b/l10n_us_hr_payroll/data/state/nc_northcarolina.xml index d09f8e3f..5134c4d0 100644 --- a/l10n_us_hr_payroll/data/state/nc_northcarolina.xml +++ b/l10n_us_hr_payroll/data/state/nc_northcarolina.xml @@ -1,41 +1,43 @@ + US NC North Carolina SUTA Wage Base us_nc_suta_wage_base - - 24300.0 - - - 25200.0 + + 26000.0 + + + + US NC North Carolina SUTA Rate us_nc_suta_rate - - 1.0 - - - 1.0 + + 1.0 + + + @@ -44,18 +46,6 @@ - - - - { - 'weekly': {'allowance': 48.08, 'standard_deduction': 192.31, 'standard_deduction_hh': 288.46}, - 'bi-weekly': {'allowance': 96.15, 'standard_deduction': 384.62, 'standard_deduction_hh': 576.92}, - 'semi-monthly': {'allowance': 104.17, 'standard_deduction': 416.67, 'standard_deduction_hh': 625.00}, - 'monthly': {'allowance': 208.33, 'standard_deduction': 833.33, 'standard_deduction_hh': 1250.00}, - } - - - @@ -68,6 +58,20 @@ + + + + + + { + 'weekly': {'allowance': 48.08, 'standard_deduction': 206.73, 'standard_deduction_hh': 310.10}, + 'bi-weekly': {'allowance': 96.15, 'standard_deduction': 413.46, 'standard_deduction_hh': 620.19}, + 'semi-monthly': {'allowance': 104.17, 'standard_deduction': 447.92, 'standard_deduction_hh': 671.88}, + 'monthly': {'allowance': 208.33, 'standard_deduction': 895.83, 'standard_deduction_hh': 1343.75}, + } + + + diff --git a/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2019.py deleted file mode 100755 index 14c1c5b2..00000000 --- a/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2019.py +++ /dev/null @@ -1,270 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from .common import TestUsPayslip, process_payslip - - -class TestUsNCPayslip(TestUsPayslip): - ### - # Taxes and Rates - ### - NC_UNEMP_MAX_WAGE = 24300.0 - NC_UNEMP = -1.0 / 100.0 - NC_INC_TAX = -0.0535 - - - def test_2019_taxes_weekly(self): - salary = 20000.0 - # allowance_multiplier and Portion of Standard Deduction for weekly - allowance_multiplier = 48.08 - PST = 192.31 - exemption = 1 - # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf - wh = -round((salary - (PST + (allowance_multiplier * exemption))) * -self.NC_INC_TAX) - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('NC'), - nc_nc4_sit_filing_status='married', - state_income_tax_additional_withholding=0.0, - nc_nc4_sit_allowances=1.0, - schedule_pay='weekly') - - self._log('2019 North Carolina tax first payslip weekly:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['EE_US_SIT'], wh) - - process_payslip(payslip) - - # Make a new payslip, this one will have maximums - - remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2*salary < salary) \ - else salary - self._log('2019 North Carolina tax second payslip weekly:') - payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_NC_UNEMP_wages * self.NC_UNEMP) - - def test_2019_taxes_with_external_weekly(self): - salary = 5000.0 - schedule_pay = 'weekly' - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('NC'), - nc_nc4_sit_filing_status='married', - state_income_tax_additional_withholding=0.0, - nc_nc4_sit_allowances=1.0, - schedule_pay='weekly') - - self._log('2019 NorthCarolina_external tax first payslip weekly:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.NC_UNEMP) - - def test_2019_taxes_biweekly(self): - salary = 5000.0 - schedule_pay = 'bi-weekly' - # allowance_multiplier and Portion of Standard Deduction for weekly - allowance_multiplier = 96.15 - PST = 384.62 - - allowances = 2 - # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf - - wh = -round((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX) - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('NC'), - nc_nc4_sit_filing_status='married', - state_income_tax_additional_withholding=0.0, - nc_nc4_sit_allowances=2.0, - schedule_pay='bi-weekly') - - self._log('2019 North Carolina tax first payslip bi-weekly:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.NC_UNEMP) - self.assertPayrollEqual(cats['EE_US_SIT'], wh) - - process_payslip(payslip) - - # Make a new payslip, this one will have maximums - - remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2*salary < salary) \ - else salary - - self._log('2019 North Carolina tax second payslip bi-weekly:') - payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_NC_UNEMP_wages * self.NC_UNEMP) - - def test_2019_taxes_semimonthly(self): - salary = 4000.0 - # allowance_multiplier and Portion of Standard Deduction for weekly - allowance_multiplier = 104.17 - PST = 625.00 - - allowances = 1 - # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf - - wh = -round((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX) - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('NC'), - nc_nc4_sit_filing_status='head_household', - state_income_tax_additional_withholding=0.0, - nc_nc4_sit_allowances=1.0, - schedule_pay='semi-monthly') - - self._log('2019 North 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'], salary * self.NC_UNEMP) - self.assertPayrollEqual(cats['EE_US_SIT'], wh) - - process_payslip(payslip) - - # Make a new payslip, this one will have maximums - - remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2 * salary < salary) \ - else salary - - self._log('2019 North Carolina tax second payslip:') - payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_NC_UNEMP_wages * self.NC_UNEMP) - - def test_2019_taxes_monthly(self): - salary = 4000.0 - schedule_pay = 'monthly' - # allowance_multiplier and Portion of Standard Deduction for weekly - allowance_multiplier = 208.33 - PST = 833.33 - - allowances = 1 - # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf - - wh = -round((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX) - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('NC'), - nc_nc4_sit_filing_status='single', - state_income_tax_additional_withholding=0.0, - nc_nc4_sit_allowances=1.0, - schedule_pay='monthly') - - self._log('2019 North 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'], salary * self.NC_UNEMP) - self.assertPayrollEqual(cats['EE_US_SIT'], wh) - - process_payslip(payslip) - - # Make a new payslip, this one will have maximums - - remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if ( - self.NC_UNEMP_MAX_WAGE - 2 * salary < salary) \ - else salary - - self._log('2019 North Carolina tax second payslip:') - payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_NC_UNEMP_wages * self.NC_UNEMP) - - def test_additional_withholding(self): - salary = 4000.0 - # allowance_multiplier and Portion of Standard Deduction for weekly - allowance_multiplier = 48.08 - PST = 192.31 - additional_wh = 40.0 - - #4000 - (168.27 + (48.08 * 1) - - allowances = 1 - # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf - - wh = -round(((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX) + additional_wh) - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('NC'), - nc_nc4_sit_filing_status='married', - state_income_tax_additional_withholding=40.0, - nc_nc4_sit_allowances=1.0, - schedule_pay='weekly') - - self._log('2019 North Carolina tax first payslip weekly:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - self.assertPayrollEqual(cats['EE_US_SIT'], wh) - - process_payslip(payslip) - - # Make a new payslip, this one will have maximums - - remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2 * salary < salary) \ - else salary - - self._log('2019 North Carolina tax second payslip weekly:') - payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_NC_UNEMP_wages * self.NC_UNEMP) diff --git a/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2021.py b/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2021.py new file mode 100755 index 00000000..b8119f21 --- /dev/null +++ b/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2021.py @@ -0,0 +1,39 @@ +# 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 TestUsNCPayslip(TestUsPayslip): + ### + # 2021 Taxes and Rates + ### + # Example based on https://files.nc.gov/ncdor/documents/files/2021-NC-30-Final.pdf page 19 + NC_UNEMP_MAX_WAGE = 26000.0 + NC_UNEMP = 1.0 + # get NC_INC_TAX from 'Annualized Tax" line 8 in the example on page 19 + NC_INC_TAX = 0.0535 + + def _test_sit(self, wage, filing_status, allowances, additional_withholding, schedule_pay, date_start, expected_withholding): + + employee = self._createEmployee() + contract = self._createContract(employee, + wage=wage, + state_id=self.get_us_state('NC'), + nc_nc4_sit_filing_status=filing_status, + nc_nc4_sit_allowances=allowances, + state_income_tax_additional_withholding=additional_withholding, + 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.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding if filing_status else 0.0) + + def test_2021_taxes_example(self): + self._test_er_suta('NC', self.NC_UNEMP, date(2021, 1, 1), wage_base=self.NC_UNEMP_MAX_WAGE) + self._test_sit(20000.0, 'single', 1, 100.0, 'weekly', date(2021, 1, 1), 1156.0) + self._test_sit(5000.0, 'married', 1, 0.0, 'weekly', date(2021, 1, 1), 254.0) + self._test_sit(4000.0, 'head_household', 1, 5.0, 'semi-monthly', date(2021, 1, 1), 177.0) + self._test_sit(7000.0, '', 1, 5.0, 'monthly', date(2021, 1, 1), 0.0)