Added elif statement to ensure wages are over $0.00, and returning 0 in that case, before checking and assigning a tax rate table.

Additionally, also check that wages are greater than 0 for the 'married' filing status.
This commit is contained in:
Kristen Marie Kulha
2018-07-25 09:04:18 -07:00
parent e5ff1b9018
commit c50fc91b1e

View File

@@ -60,11 +60,14 @@ allowances = contract.ks_k4_allowances
additional_withholding = contract.ks_additional_withholding additional_withholding = contract.ks_additional_withholding
schedule_pay = contract.schedule_pay schedule_pay = contract.schedule_pay
filing_status = contract.ks_k4_filing_status filing_status = contract.ks_k4_filing_status
tax_rate_table = []
# Tables are found in https://www.ksrevenue.org/pdf/kw1002017.pdf # Tables are found in https://www.ksrevenue.org/pdf/kw1002017.pdf
# First check for exemption status (Step 1) # First check for exemption status (Step 1)
if filing_status == 'exempt': if filing_status == 'exempt':
result = 0 result = 0
elif wages <= 0:
result = 0
else: else:
# Calculate Withholding Allowance Amounts using table (allowance multipliers are from table). # Calculate Withholding Allowance Amounts using table (allowance multipliers are from table).
@@ -94,7 +97,7 @@ else:
(float('inf'), 0.057, 24.09), (float('inf'), 0.057, 24.09),
] ]
elif filing_status == 'married': elif filing_status == 'married' and wages > 0:
tax_rate_table = [ tax_rate_table = [
(144, 0.0, 0.0), (144, 0.0, 0.0),
(721, 0.031, 0.0), (721, 0.031, 0.0),
@@ -112,7 +115,7 @@ else:
(float('inf'), 0.057, 48.17), (float('inf'), 0.057, 48.17),
] ]
elif filing_status == 'married': elif filing_status == 'married' and wages > 0:
tax_rate_table = [ tax_rate_table = [
(288, 0.0, 0.0), (288, 0.0, 0.0),
(1442, 0.031, 0.0), (1442, 0.031, 0.0),
@@ -130,7 +133,7 @@ else:
(float('inf'), 0.057, 52.19), (float('inf'), 0.057, 52.19),
] ]
elif filing_status == 'married': elif filing_status == 'married' and wages > 0:
tax_rate_table = [ tax_rate_table = [
(313, 0.0, 0.0), (313, 0.0, 0.0),
(1563, 0.031, 0.0), (1563, 0.031, 0.0),
@@ -148,7 +151,7 @@ else:
(float('inf'), 0.057, 104.38), (float('inf'), 0.057, 104.38),
] ]
elif filing_status == 'married': elif filing_status == 'married' and wages > 0:
tax_rate_table = [ tax_rate_table = [
(625, 0.0, 0.0), (625, 0.0, 0.0),
(3125, 0.031, 0.0), (3125, 0.031, 0.0),
@@ -166,7 +169,7 @@ else:
(float('inf'), 0.057, 313.13), (float('inf'), 0.057, 313.13),
] ]
elif filing_status == 'married': elif filing_status == 'married' and wages > 0:
tax_rate_table = [ tax_rate_table = [
(1875, 0.0, 0.0), (1875, 0.0, 0.0),
(9375, 0.031, 0.0), (9375, 0.031, 0.0),
@@ -184,7 +187,7 @@ else:
(float('inf'), 0.057, 626.25), (float('inf'), 0.057, 626.25),
] ]
elif filing_status == 'married': elif filing_status == 'married' and wages > 0:
tax_rate_table = [ tax_rate_table = [
(3750, 0.0, 0.0), (3750, 0.0, 0.0),
(18750, 0.031, 0.0), (18750, 0.031, 0.0),
@@ -202,7 +205,7 @@ else:
(float('inf'), 0.057, 1252.50), (float('inf'), 0.057, 1252.50),
] ]
elif filing_status == 'married': elif filing_status == 'married' and wages > 0:
tax_rate_table = [ tax_rate_table = [
(7500, 0.0, 0.0), (7500, 0.0, 0.0),
(37500, 0.031, 0.0), (37500, 0.031, 0.0),