From 5654a569e8fd8169144ce750eb85eeceabaab64c Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Wed, 16 Jan 2019 09:47:58 -0800 Subject: [PATCH] FIX Correct payslip wage base for payslips in two years. Add 2019 Ohio Tax Withholding rate. --- l10n_us_oh_hr_payroll/data/rules.xml | 57 +++++++++++++------ .../tests/test_us_oh_payslip_2019.py | 2 +- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/l10n_us_oh_hr_payroll/data/rules.xml b/l10n_us_oh_hr_payroll/data/rules.xml index 372cbc54..56175d24 100755 --- a/l10n_us_oh_hr_payroll/data/rules.xml +++ b/l10n_us_oh_hr_payroll/data/rules.xml @@ -14,7 +14,7 @@ ### rate = payslip.dict.get_rate('US_OH_UNEMP') -year = int(payslip.dict.date_from[:4]) +year = int(payslip.dict.date_to[:4]) ytd = payslip.sum('WAGE_US_OH_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01') ytd += contract.external_wages remaining = rate.wage_limit_year - ytd @@ -57,6 +57,7 @@ if result_rate == 0.0: result = True code +year = int(payslip.dict.date_to[:4]) wages = categories.GROSS allowances = contract.oh_income_allowances schedule_pay = contract.schedule_pay @@ -80,24 +81,44 @@ elif 'annually' == schedule_pay: else: raise Exception('Invalid schedule_pay="' + schedule_pay + '" for OH Income Withholding calculation') -# Algorithm from http://www.tax.ohio.gov/Portals/0/employer_withholding/August2015Rates/WTH_OptionalComputerFormula_073015.pdf -TW = (wages * PP) - (650 * allowances) -if TW <= 5000.0: - WD = ((TW * 0.005) / PP) * 1.112 -elif TW <= 10000.0: - WD = ((((TW - 5000.0) * 0.01) + 25.0) / PP) * 1.112 -elif TW <= 15000.0: - WD = ((((TW - 10000.0) * 0.02) + 75.0) / PP) * 1.112 -elif TW <= 20000.0: - WD = ((((TW - 15000.0) * 0.025) + 175.0) / PP) * 1.112 -elif TW <= 40000.0: - WD = ((((TW - 20000.0) * 0.03) + 300.0) / PP) * 1.112 -elif TW <= 80000.0: - WD = ((((TW - 40000.0) * 0.035) + 900.0) / PP) * 1.112 -elif TW <= 100000.0: - WD = ((((TW - 80000.0) * 0.04) + 2300.0) / PP) * 1.112 +# Algorithm from https://www.tax.ohio.gov/Portals/0/employer_withholding/2019%20tables/WTH_OptionalComputerFormula_2019.pdf +if year == 2018: + TW = (wages * PP) - (650 * allowances) + if TW <= 5000.0: + WD = ((TW * 0.005) / PP) * 1.112 + elif TW <= 10000.0: + WD = ((((TW - 5000.0) * 0.01) + 25.0) / PP) * 1.112 + elif TW <= 15000.0: + WD = ((((TW - 10000.0) * 0.02) + 75.0) / PP) * 1.112 + elif TW <= 20000.0: + WD = ((((TW - 15000.0) * 0.025) + 175.0) / PP) * 1.112 + elif TW <= 40000.0: + WD = ((((TW - 20000.0) * 0.03) + 300.0) / PP) * 1.112 + elif TW <= 80000.0: + WD = ((((TW - 40000.0) * 0.035) + 900.0) / PP) * 1.112 + elif TW <= 100000.0: + WD = ((((TW - 80000.0) * 0.04) + 2300.0) / PP) * 1.112 + else: + WD = ((((TW - 100000.0) * 0.05) + 3100.0) / PP) * 1.112 else: - WD = ((((TW - 100000.0) * 0.05) + 3100.0) / PP) * 1.112 + TW = (wages * PP) - (650 * allowances) + if TW <= 5000.0: + WD = ((TW * 0.005) / PP) * 1.112 + elif TW <= 10000.0: + WD = ((((TW - 5000.0) * 0.01) + 25.0) / PP) * 1.075 + elif TW <= 15000.0: + WD = ((((TW - 10000.0) * 0.02) + 75.0) / PP) * 1.075 + elif TW <= 20000.0: + WD = ((((TW - 15000.0) * 0.025) + 175.0) / PP) * 1.075 + elif TW <= 40000.0: + WD = ((((TW - 20000.0) * 0.03) + 300.0) / PP) * 1.075 + elif TW <= 80000.0: + WD = ((((TW - 40000.0) * 0.035) + 900.0) / PP) * 1.075 + elif TW <= 100000.0: + WD = ((((TW - 80000.0) * 0.04) + 2300.0) / PP) * 1.075 + else: + WD = ((((TW - 100000.0) * 0.05) + 3100.0) / PP) * 1.075 + result = -WD diff --git a/l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2019.py b/l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2019.py index ee597c5e..1687d654 100755 --- a/l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2019.py +++ b/l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2019.py @@ -17,7 +17,7 @@ class TestUsOhPayslip(TestUsPayslip): # For formula here # http://www.tax.ohio.gov/Portals/0/employer_withholding/August2015Rates/WTH_OptionalComputerFormula_073015.pdf tw = salary * 12 # = 60000 - wd = ((tw - 40000) * 0.035 + 900) / 12 * 1.112 + wd = ((tw - 40000) * 0.035 + 900) / 12 * 1.075 employee = self._createEmployee()