-
Notifications
You must be signed in to change notification settings - Fork 0
/
f_retenciones
36 lines (26 loc) · 856 Bytes
/
f_retenciones
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
RANGOS = [12450,20200, 35200, 60000, 300000]
PORCENTAJES = [19, 24, 30, 37, 45, 47]
RETENCIONES = [[0, 0], [12450, 19], [20200, 24], [35200, 30], [60000, 37], [300000, 45],[float('inf'), 47]
]
SITUACIONES = {
'1': [0, 15947, 7100],
'2': [15546, 16481, 17634],
'3': [14000, 14516, 15063]
}
def obtener_exencion(sit, nhijos):
if nhijos > 2:
nhijos = 2
elif nhijos < 0:
nhijos = 0
return SITUACIONES[sit] [nhijos]
def obtener_retencion_while(base):
i = 0
while i < len(RANGOS):
if base <= RANGOS[i]:
break
i += 1
return PORCENTAJES[i]
def obtener_retencion(base):
for retencion in RETENCIONES:
if base <= retencion[0]:
return retencion[1]