From eaae1e2b562304743d6bc5e45ff170c899edd2f9 Mon Sep 17 00:00:00 2001 From: Jared Self Date: Tue, 12 Jan 2021 15:22:47 -0700 Subject: [PATCH] MO Missouri --- l10n_us_hr_payroll/data/state/mo_missouri.xml | 78 ++++---- .../tests/test_us_mo_missouri_payslip_2019.py | 188 ------------------ .../tests/test_us_mo_missouri_payslip_2021.py | 34 ++++ 3 files changed, 76 insertions(+), 224 deletions(-) delete mode 100755 l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py create mode 100755 l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2021.py diff --git a/l10n_us_hr_payroll/data/state/mo_missouri.xml b/l10n_us_hr_payroll/data/state/mo_missouri.xml index 73ea5109..1e2cd863 100644 --- a/l10n_us_hr_payroll/data/state/mo_missouri.xml +++ b/l10n_us_hr_payroll/data/state/mo_missouri.xml @@ -7,16 +7,17 @@ - - 12000.0 - - - 11500.0 + + + 11000.0 + + + @@ -26,16 +27,18 @@ - - 2.376 - - - 2.376 + + + + 2.7 + + + @@ -44,22 +47,6 @@ - - - [ - (1053.0, 1.5), - (1053.0, 2.0), - (1053.0, 2.5), - (1053.0, 3.0), - (1053.0, 3.5), - (1053.0, 4.0), - (1053.0, 4.5), - (1053.0, 5.0), - ( 'inf', 5.4), - ] - - - @@ -77,6 +64,24 @@ + + + + + [ + (1088.0, 1.5), + (1088.0, 2.0), + (1088.0, 2.5), + (1088.0, 3.0), + (1088.0, 3.5), + (1088.0, 4.0), + (1088.0, 4.5), + (1088.0, 5.0), + ( 'inf', 5.4), + ] + + + @@ -85,16 +90,6 @@ - - - { - 'single': 12400.0, - 'married': 24800.0, - 'head_of_household': 18650.0, - } - - - @@ -106,6 +101,17 @@ + + + + { + 'single': 12550.0, + 'married': 25100.0, + 'head_of_household': 18800.0, + } + + + diff --git a/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py deleted file mode 100755 index 27a0ad93..00000000 --- a/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py +++ /dev/null @@ -1,188 +0,0 @@ - -from datetime import date -from .common import TestUsPayslip - - -class TestUsMoPayslip(TestUsPayslip): - # Calculations from http://dor.mo.gov/forms/4282_2019.pdf - SALARY = 12000.0 - MO_UNEMP = -2.376 / 100.0 - - TAX = [ - (1053.0, 1.5), - (1053.0, 2.0), - (1053.0, 2.5), - (1053.0, 3.0), - (1053.0, 3.5), - (1053.0, 4.0), - (1053.0, 4.5), - (1053.0, 5.0), - (999999999.0, 5.4), - ] - - def test_2019_taxes_single(self): - # Payroll Period Monthly - salary = self.SALARY - pp = 12.0 - gross_salary = salary * pp - spouse_employed = False - - # Single - standard_deduction = 12400.0 - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MO'), - mo_mow4_sit_filing_status='single', - state_income_tax_additional_withholding=0.0, - schedule_pay='monthly') - - self._log('2019 Missouri tax single 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.MO_UNEMP) - - mo_taxable_income = gross_salary - standard_deduction - self._log('%s = %s - %s -' % (mo_taxable_income, gross_salary, standard_deduction)) - - remaining_taxable_income = mo_taxable_income - tax = 0.0 - for amt, rate in self.TAX: - amt = float(amt) - rate = rate / 100.0 - self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income)) - if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0: - tax += rate * amt - else: - tax += rate * remaining_taxable_income - break - remaining_taxable_income = remaining_taxable_income - amt - - tax = -tax - self._log('Computed annual tax: ' + str(tax)) - - tax = tax / pp - tax = round(tax) - self._log('Computed period tax: ' + str(tax)) - self.assertPayrollEqual(cats['EE_US_SIT'], tax) - - def test_2019_spouse_not_employed(self): - # Payroll Period Semi-monthly - salary = self.SALARY - pp = 24.0 - gross_salary = salary * pp - - # Married - standard_deduction = 24800.0 - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MO'), - mo_mow4_sit_filing_status='married', - state_income_tax_additional_withholding=0.0, - schedule_pay='semi-monthly') - - self._log('2019 Missouri tax first payslip:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - mo_taxable_income = gross_salary - standard_deduction - self._log(mo_taxable_income) - - remaining_taxable_income = mo_taxable_income - tax = 0.0 - for amt, rate in self.TAX: - amt = float(amt) - rate = rate / 100.0 - self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income)) - if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0: - tax += rate * amt - else: - tax += rate * remaining_taxable_income - break - remaining_taxable_income = remaining_taxable_income - amt - - tax = -tax - self._log('Computed annual tax: ' + str(tax)) - - tax = tax / pp - tax = round(tax) - self._log('Computed period tax: ' + str(tax)) - self.assertPayrollEqual(cats['EE_US_SIT'], tax) - - def test_2019_head_of_household(self): - # Payroll Period Weekly - salary = self.SALARY - - # Payroll Period Weekly - salary = self.SALARY - pp = 52.0 - gross_salary = salary * pp - - # Single HoH - standard_deduction = 18650.0 - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MO'), - mo_mow4_sit_filing_status='head_of_household', - state_income_tax_additional_withholding=0.0, - schedule_pay='weekly') - - self._log('2019 Missouri tax first payslip:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - - mo_taxable_income = gross_salary - standard_deduction - self._log(mo_taxable_income) - - remaining_taxable_income = mo_taxable_income - tax = 0.0 - for amt, rate in self.TAX: - amt = float(amt) - rate = rate / 100.0 - self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income)) - if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0: - tax += rate * amt - else: - tax += rate * remaining_taxable_income - break - remaining_taxable_income = remaining_taxable_income - amt - tax = -tax - self._log('Computed annual tax: ' + str(tax)) - - tax = tax / pp - tax = round(tax) - self._log('Computed period tax: ' + str(tax)) - self.assertPayrollEqual(cats['EE_US_SIT'], tax) - - def test_2019_underflow(self): - # Payroll Period Weekly - salary = 200.0 - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MO')) - - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - payslip.compute_sheet() - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['EE_US_SIT'], 0.0) diff --git a/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2021.py b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2021.py new file mode 100755 index 00000000..0824e2b9 --- /dev/null +++ b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2021.py @@ -0,0 +1,34 @@ +# 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 TestUsMoPayslip(TestUsPayslip): + # Calculations from http://dor.mo.gov/forms/4282_2021.pdf + MO_UNEMP_MAX_WAGE = 11000.0 + MO_UNEMP = 2.7 + + def _test_sit(self, wage, filing_status, additional_withholding, schedule_pay, date_start, expected_withholding): + employee = self._createEmployee() + contract = self._createContract(employee, + wage=wage, + state_id=self.get_us_state('MO'), + mo_mow4_sit_filing_status=filing_status, + 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.assertPayrollAlmostEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding) + + def test_2021_taxes_example(self): + self._test_er_suta('MO', self.MO_UNEMP, date(2021, 1, 1), wage_base=self.MO_UNEMP_MAX_WAGE) + self._test_sit(750.0, 'single', 0.0, 'weekly', date(2021, 1, 1), 24.00) + self._test_sit(2500.0, 'single', 5.0, 'bi-weekly', date(2021, 1, 1), 107.00) + self._test_sit(7000.0, 'married', 0.0, 'monthly', date(2021, 1, 1), 249.00) + self._test_sit(5000.0, 'married', 10.0, 'semi-monthly', date(2021, 1, 1), 216.00) + self._test_sit(6000.0, '', 0.0, 'monthly', date(2021, 1, 1), 0.00) +