-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions_pit_ethiopia.py
More file actions
110 lines (100 loc) · 3.59 KB
/
functions_pit_ethiopia.py
File metadata and controls
110 lines (100 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
"""
pitaxcalc-demo functions that calculate personal income tax liability.
"""
# CODING-STYLE CHECKS:
# pycodestyle functions.py
# pylint --disable=locally-disabled functions.py
import math
import copy
import numpy as np
from taxcalc.decorators import iterate_jit
@iterate_jit(nopython=True)
def cal_gross_income(Employment_Income, Other_Income_Federal,
gross_income):
"""
Compute gross income.
"""
gross_income = Employment_Income + Other_Income_Federal
return gross_income
@iterate_jit(nopython=True)
def cal_employment_income(deduction_employment, Employment_Income,
employment_income_taxable):
"""
Compute total gross income.
"""
employment_income_taxable = Employment_Income - deduction_employment
return employment_income_taxable
@iterate_jit(nopython=True)
def cal_other_income(Other_Income_Federal):
"""
Compute Other Income.
"""
Other_Income_Federal = Other_Income_Federal
return Other_Income_Federal
@iterate_jit(nopython=True)
def cal_taxable_income(tax_global_income_federal, standard_deduction,
employment_income_taxable, Other_Income_Federal,
taxable_income):
"""
Compute Taxable Income.
"""
if (tax_global_income_federal>=0.9999):
taxable_income = employment_income_taxable + Other_Income_Federal - standard_deduction
else:
taxable_income = employment_income_taxable - standard_deduction
return taxable_income
@iterate_jit(nopython=True)
def cal_pit_before_credit(rate1, rate2, rate3, rate4, rate5, rate6, rate7,
tbrk1, tbrk2, tbrk3, tbrk4, tbrk5, tbrk6, tbrk7,
taxable_income, bracket1, bracket2, bracket3,
bracket4, bracket5, bracket6, bracket7,
pitax_before_tax_credit):
"""
Compute PIT.
"""
bracket1, bracket2, bracket3, bracket4, bracket5, bracket6, bracket7 = 0,0,0,0,0,0,0
inc=taxable_income
if (inc<tbrk1):
bracket1 = (inc-0)*rate1
elif (inc<tbrk2):
bracket1 = (tbrk1-0)*rate1
bracket2 = (inc-tbrk1)*rate2
elif (inc<tbrk3):
bracket1 = (tbrk1-0)*rate1
bracket2 = (tbrk2-tbrk1)*rate2
bracket3 = (inc-tbrk2)*rate3
elif (inc<tbrk4):
bracket1 = (tbrk1-0)*rate1
bracket2 = (tbrk2-tbrk1)*rate2
bracket3 = (tbrk3-tbrk2)*rate3
bracket4 = (inc-tbrk3)*rate4
elif (inc<tbrk5):
bracket1 = (tbrk1-0)*rate1
bracket2 = (tbrk2-tbrk1)*rate2
bracket3 = (tbrk3-tbrk2)*rate3
bracket4 = (tbrk4-tbrk3)*rate4
bracket5 = (inc-tbrk4)*rate5
elif (inc<tbrk6):
bracket1 = (tbrk1-0)*rate1
bracket2 = (tbrk2-tbrk1)*rate2
bracket3 = (tbrk3-tbrk2)*rate3
bracket4 = (tbrk4-tbrk3)*rate4
bracket5 = (tbrk5-tbrk4)*rate5
bracket6 = (inc-tbrk5)*rate6
elif (inc<tbrk7):
bracket1 = (tbrk1-0)*rate1
bracket2 = (tbrk2-tbrk1)*rate2
bracket3 = (tbrk3-tbrk2)*rate3
bracket4 = (tbrk4-tbrk3)*rate4
bracket5 = (tbrk5-tbrk4)*rate5
bracket6 = (tbrk6-tbrk5)*rate6
bracket7 = (inc-tbrk6)*rate7
pitax_before_tax_credit = bracket1+bracket2+bracket3+bracket4+bracket5+bracket6+bracket7
return pitax_before_tax_credit
@iterate_jit(nopython=True)
def cal_pit(tax_credit, pitax_before_tax_credit, pitax):
"""
Compute PIT after Tax Credits.
"""
pitax = pitax_before_tax_credit - tax_credit
return pitax