conversor-horas-trabalho 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- conversor_horas_trabalho/__init__.py +0 -0
- conversor_horas_trabalho/cli.py +84 -0
- conversor_horas_trabalho/converte_horas.py +50 -0
- conversor_horas_trabalho/converte_horas_semanais.py +99 -0
- conversor_horas_trabalho/total_horas_mes.py +95 -0
- conversor_horas_trabalho-0.1.0.dist-info/LICENSE +5 -0
- conversor_horas_trabalho-0.1.0.dist-info/METADATA +232 -0
- conversor_horas_trabalho-0.1.0.dist-info/RECORD +10 -0
- conversor_horas_trabalho-0.1.0.dist-info/WHEEL +4 -0
- conversor_horas_trabalho-0.1.0.dist-info/entry_points.txt +3 -0
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from rich.console import Console
|
|
2
|
+
from rich.table import Table
|
|
3
|
+
from typer import Argument, Typer
|
|
4
|
+
|
|
5
|
+
from conversor_horas_trabalho.converte_horas import converte_horas
|
|
6
|
+
from conversor_horas_trabalho.converte_horas_semanais import (
|
|
7
|
+
converte_horas_semanais,
|
|
8
|
+
)
|
|
9
|
+
from conversor_horas_trabalho.total_horas_mes import (
|
|
10
|
+
total_horas_mes as _total_horas_mes,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
console = Console()
|
|
14
|
+
app = Typer()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command()
|
|
18
|
+
def converte_hora(
|
|
19
|
+
hora: str = Argument('12:30', help='Hora em formato 12:30 ou 12.50')
|
|
20
|
+
):
|
|
21
|
+
table = Table()
|
|
22
|
+
hora_convertida = converte_horas(hora)
|
|
23
|
+
for hr in hora_convertida:
|
|
24
|
+
table.add_column(hr)
|
|
25
|
+
table.add_row(hora_convertida['hora'][0])
|
|
26
|
+
|
|
27
|
+
console.print(table)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@app.command()
|
|
31
|
+
def converte_hora_semanal(
|
|
32
|
+
horas_semana: str = Argument('nm09.00,nm09.00', help='Tag mais Hora'),
|
|
33
|
+
formato: int = Argument(
|
|
34
|
+
'1', help='Formato de retorno com 1 para ":" ou 2 para "."'
|
|
35
|
+
),
|
|
36
|
+
):
|
|
37
|
+
table = Table()
|
|
38
|
+
lista_semana = []
|
|
39
|
+
lista_semana_split = horas_semana.split(',')
|
|
40
|
+
for hrstr in lista_semana_split:
|
|
41
|
+
prefix = hrstr[:2]
|
|
42
|
+
hr = hrstr[2:]
|
|
43
|
+
lista_semana.append([prefix, hr])
|
|
44
|
+
|
|
45
|
+
total_horas = converte_horas_semanais(lista_semana, formato)
|
|
46
|
+
|
|
47
|
+
table.add_column('total_horas_da_semana')
|
|
48
|
+
table.add_column('total_horas_extra')
|
|
49
|
+
table.add_column('total_horas_faltantes')
|
|
50
|
+
table.add_row(
|
|
51
|
+
total_horas['total_horas_da_semana'],
|
|
52
|
+
total_horas['total_horas_extra'],
|
|
53
|
+
total_horas['total_horas_faltantes'],
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
console.print(table)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@app.command()
|
|
60
|
+
def total_horas_mes(
|
|
61
|
+
horas_semana: str = Argument(
|
|
62
|
+
'44,44,44,44', help='Horas totais de cada semana seguido de virgula'
|
|
63
|
+
),
|
|
64
|
+
ano: int = Argument('2024', help='Digite o Ano que deseja calcular'),
|
|
65
|
+
mes: int = Argument('09', help='Digite o Mes que deseja calcular'),
|
|
66
|
+
):
|
|
67
|
+
table = Table()
|
|
68
|
+
total_horas_mes = []
|
|
69
|
+
total_horas_mes_split = horas_semana.split(',')
|
|
70
|
+
for hr in enumerate(total_horas_mes_split):
|
|
71
|
+
total_horas_mes_split[hr[0]] = int(hr[1])
|
|
72
|
+
|
|
73
|
+
total_horas = _total_horas_mes(total_horas_mes_split, ano, mes)
|
|
74
|
+
|
|
75
|
+
table.add_column('total_de_horas_esperadas_no_mes')
|
|
76
|
+
table.add_column('total_horas_trabalhadas')
|
|
77
|
+
table.add_column('total_horas_faltantes')
|
|
78
|
+
table.add_row(
|
|
79
|
+
total_horas['total_de_horas_esperadas_no_mes'],
|
|
80
|
+
total_horas['total_horas_trabalhadas'],
|
|
81
|
+
total_horas['total_horas_faltantes'],
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
console.print(table)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
def converte_horas(hr_recebida: str) -> dict[str, list[str]] | None:
|
|
2
|
+
"""
|
|
3
|
+
Recebe uma Hora e modifica para outro sistema
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
hr_recebida: hora no formato ex: 12:30 ou 12.50
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
>>> converte_horas('12:30')
|
|
10
|
+
{'hora': ['12.50']}
|
|
11
|
+
|
|
12
|
+
>>> converte_horas('12.50')
|
|
13
|
+
{'hora': ['12:30']}
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
Um dicionario com a hora convertida
|
|
17
|
+
|
|
18
|
+
Raises:
|
|
19
|
+
ValueError: Caso a hora nao seja uma hora válida
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
temp = []
|
|
23
|
+
if len(hr_recebida) < 5:
|
|
24
|
+
raise ValueError(
|
|
25
|
+
'Sua hora deve conter pelo menos 5 caracteres, EX: 12:30 ou 12.50'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
if ':' in hr_recebida:
|
|
29
|
+
hora_int = int(hr_recebida[0:2])
|
|
30
|
+
minutos_int = int(hr_recebida[3:5])
|
|
31
|
+
minutos_int_calc = int(minutos_int // 0.6 * 1)
|
|
32
|
+
minutos_int_show = round(minutos_int_calc / 5) * 5
|
|
33
|
+
if f'{minutos_int_show:02d}' == '100':
|
|
34
|
+
hora_int = hora_int + 1
|
|
35
|
+
minutos_int_show = 00
|
|
36
|
+
temp.append(f'{hora_int:02d}.{minutos_int_show:02d}')
|
|
37
|
+
elif '.' in hr_recebida:
|
|
38
|
+
hora_total_float = float(hr_recebida)
|
|
39
|
+
hora_int = int(hora_total_float)
|
|
40
|
+
hora_calc = hora_total_float - hora_int
|
|
41
|
+
minutos_int_calc = int(hora_calc * 60)
|
|
42
|
+
minutos_int_show = round(minutos_int_calc / 5) * 5
|
|
43
|
+
if f'{minutos_int_show:02d}' == '60':
|
|
44
|
+
hora_int = hora_int + 1
|
|
45
|
+
minutos_int_show = 00
|
|
46
|
+
temp.append(f'{hora_int:02d}:{minutos_int_show:02d}')
|
|
47
|
+
else:
|
|
48
|
+
raise ValueError(f'Hora invalida, tente neste formato 12:30 ou 12.50')
|
|
49
|
+
|
|
50
|
+
return {'hora': temp}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from conversor_horas_trabalho.converte_horas import converte_horas
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def converte_horas_semanais(
|
|
5
|
+
lista_horas: dict[str, list[str]], formato: int
|
|
6
|
+
) -> dict[str, list[str]]:
|
|
7
|
+
"""
|
|
8
|
+
Recebe um Dicionario de horas e calcula a quantidade para fechar a semana
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
lista_horas: Dicionario contendo o lançamento das horas
|
|
12
|
+
formato: Inteiro que define qual formato de saida dos horarios
|
|
13
|
+
|
|
14
|
+
Examples:
|
|
15
|
+
>>> converte_horas_semanais([['nm', '09.00']], 1)
|
|
16
|
+
{'total_horas_da_semana': '09:00', 'total_horas_extra': '00:00', 'total_horas_faltantes': '35:00'}
|
|
17
|
+
|
|
18
|
+
>>> converte_horas_semanais([['nm', '09.00'],['nm', '09.00']], 1)
|
|
19
|
+
{'total_horas_da_semana': '18:00', 'total_horas_extra': '00:00', 'total_horas_faltantes': '26:00'}
|
|
20
|
+
|
|
21
|
+
>>> converte_horas_semanais([['nm', '09.00'],['ov', '02.00']], 1)
|
|
22
|
+
{'total_horas_da_semana': '09:00', 'total_horas_extra': '02:00', 'total_horas_faltantes': '35:00'}
|
|
23
|
+
|
|
24
|
+
>>> converte_horas_semanais([['nm', '09.00']], 2)
|
|
25
|
+
{'total_horas_da_semana': '09.00', 'total_horas_extra': '00.00', 'total_horas_faltantes': '35.00'}
|
|
26
|
+
|
|
27
|
+
>>> converte_horas_semanais([['nm', '09.00'],['ov', '02.00']], 2)
|
|
28
|
+
{'total_horas_da_semana': '09.00', 'total_horas_extra': '02.00', 'total_horas_faltantes': '35.00'}
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
Um Dicionario contendo a totalização das horas
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
ValueError: Caso a hora nao seja uma hora válida
|
|
35
|
+
KeyError: Não foi encontrado o tipo de lançamento ou formato informado
|
|
36
|
+
|
|
37
|
+
"""
|
|
38
|
+
retorna = {}
|
|
39
|
+
qnt_tot_hr_seg = 0
|
|
40
|
+
qnt_tot_hr_ext_seg = 0
|
|
41
|
+
qnt_tot_hr_falt_diff_seg = 0
|
|
42
|
+
for lancamento in lista_horas:
|
|
43
|
+
tipo_lancamento = lancamento[0]
|
|
44
|
+
try:
|
|
45
|
+
qnt_hr_result = converte_horas(lancamento[1])
|
|
46
|
+
hr, minutos = map(int, qnt_hr_result['hora'][0].split(':'))
|
|
47
|
+
except ValueError:
|
|
48
|
+
raise ValueError(
|
|
49
|
+
f'Não foi possivel extrair a hora corretamente {lancamento[1]}'
|
|
50
|
+
)
|
|
51
|
+
qnt_horas_seg = hr * 3600 + minutos * 60
|
|
52
|
+
|
|
53
|
+
if tipo_lancamento == 'nm':
|
|
54
|
+
qnt_tot_hr_seg = qnt_tot_hr_seg + qnt_horas_seg
|
|
55
|
+
elif tipo_lancamento == 'ov':
|
|
56
|
+
qnt_tot_hr_ext_seg = qnt_tot_hr_ext_seg + qnt_horas_seg
|
|
57
|
+
else:
|
|
58
|
+
raise KeyError(
|
|
59
|
+
f'Não existe esse tipo de lancamento {tipo_lancamento}'
|
|
60
|
+
)
|
|
61
|
+
if qnt_tot_hr_seg > 158400:
|
|
62
|
+
total_horas_faltantes = '00:00'
|
|
63
|
+
else:
|
|
64
|
+
qnt_tot_hr_falt_diff_seg = 158400 - qnt_tot_hr_seg
|
|
65
|
+
total_horas_faltantes = _segundos_para_hh_mm(qnt_tot_hr_falt_diff_seg)
|
|
66
|
+
total_horas_da_semana = _segundos_para_hh_mm(qnt_tot_hr_seg)
|
|
67
|
+
total_horas_extra = _segundos_para_hh_mm(qnt_tot_hr_ext_seg)
|
|
68
|
+
if formato == 2:
|
|
69
|
+
total_horas_da_semana = converte_horas(total_horas_da_semana)['hora'][
|
|
70
|
+
0
|
|
71
|
+
]
|
|
72
|
+
total_horas_extra = converte_horas(total_horas_extra)['hora'][0]
|
|
73
|
+
total_horas_faltantes = converte_horas(total_horas_faltantes)['hora'][
|
|
74
|
+
0
|
|
75
|
+
]
|
|
76
|
+
elif formato == 1:
|
|
77
|
+
pass
|
|
78
|
+
else:
|
|
79
|
+
raise KeyError(f'Não existe esse tipo de formato {formato}')
|
|
80
|
+
|
|
81
|
+
retorna = {
|
|
82
|
+
'total_horas_da_semana': total_horas_da_semana,
|
|
83
|
+
'total_horas_extra': total_horas_extra,
|
|
84
|
+
'total_horas_faltantes': total_horas_faltantes,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return retorna
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _segundos_para_hh_mm(segundos: int) -> str:
|
|
91
|
+
"""
|
|
92
|
+
Transforma segundos no formato 00:00
|
|
93
|
+
"""
|
|
94
|
+
hr = segundos // 3600
|
|
95
|
+
minuto = (segundos % 3600) // 60
|
|
96
|
+
|
|
97
|
+
hora_formatada = '{:02}:{:02}'.format(int(hr), int(minuto))
|
|
98
|
+
|
|
99
|
+
return hora_formatada
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import calendar
|
|
2
|
+
import datetime as dt
|
|
3
|
+
|
|
4
|
+
from conversor_horas_trabalho.converte_horas import converte_horas
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def total_horas_mes(
|
|
8
|
+
lista_horas: list[int], ano: int, mes: int
|
|
9
|
+
) -> dict[str, list[str]]:
|
|
10
|
+
"""
|
|
11
|
+
Recebe um Dicionario de horas e calcula a quantidade para fechar o mes
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
lista_horas: Lista contendo o lançamento das horas
|
|
15
|
+
ano: Ano que deseja calcular
|
|
16
|
+
mes: Mes que deseja calcular
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
>>> total_horas_mes([44,44,44,44,30], 2024, 10)
|
|
20
|
+
{'total_de_horas_esperadas_no_mes': '206:00', 'total_horas_trabalhadas': '206:00', 'total_horas_faltantes': '000:00'}
|
|
21
|
+
|
|
22
|
+
>>> total_horas_mes([44,44,44,44], 2024, 9)
|
|
23
|
+
{'total_de_horas_esperadas_no_mes': '186:00', 'total_horas_trabalhadas': '176:00', 'total_horas_faltantes': '010:00'}
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Um Dicionario contendo a totalização das horas
|
|
27
|
+
|
|
28
|
+
Raises:
|
|
29
|
+
ValueError: Caso valor passado não seja o esperado
|
|
30
|
+
"""
|
|
31
|
+
retorna = {}
|
|
32
|
+
qnt_tot_hr_seg = 0
|
|
33
|
+
qnt_tot_hr_falt_diff_seg = 0
|
|
34
|
+
total_de_horas_esperadas_no_mes = 0
|
|
35
|
+
for hr in lista_horas:
|
|
36
|
+
try:
|
|
37
|
+
qnt_horas_seg = hr * 3600
|
|
38
|
+
qnt_tot_hr_seg = qnt_tot_hr_seg + qnt_horas_seg
|
|
39
|
+
except:
|
|
40
|
+
raise ValueError(
|
|
41
|
+
f'Erro ao converter o valor de horas indicado {hr}'
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
maximo_horas_mes = _maximo_horas_trabalhadas(ano, mes)
|
|
45
|
+
maximo_horas_mes_seg = maximo_horas_mes * 3600
|
|
46
|
+
|
|
47
|
+
if qnt_tot_hr_seg >= maximo_horas_mes_seg:
|
|
48
|
+
total_horas_faltantes = '000:00'
|
|
49
|
+
else:
|
|
50
|
+
qnt_tot_hr_falt_diff_seg = maximo_horas_mes_seg - qnt_tot_hr_seg
|
|
51
|
+
total_horas_faltantes = _segundos_para_hhh_mm(qnt_tot_hr_falt_diff_seg)
|
|
52
|
+
|
|
53
|
+
total_horas_trabalhadas = _segundos_para_hhh_mm(qnt_tot_hr_seg)
|
|
54
|
+
total_de_horas_esperadas_no_mes = _segundos_para_hhh_mm(
|
|
55
|
+
maximo_horas_mes_seg
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
retorna = {
|
|
59
|
+
'total_de_horas_esperadas_no_mes': total_de_horas_esperadas_no_mes,
|
|
60
|
+
'total_horas_trabalhadas': total_horas_trabalhadas,
|
|
61
|
+
'total_horas_faltantes': total_horas_faltantes,
|
|
62
|
+
}
|
|
63
|
+
return retorna
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _segundos_para_hhh_mm(segundos: int) -> str:
|
|
67
|
+
"""
|
|
68
|
+
Transforma segundos no formato 000:00
|
|
69
|
+
"""
|
|
70
|
+
hr = segundos // 3600
|
|
71
|
+
minuto = (segundos % 3600) // 60
|
|
72
|
+
|
|
73
|
+
hora_formatada = '{:03}:{:02}'.format(int(hr), int(minuto))
|
|
74
|
+
|
|
75
|
+
return hora_formatada
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _maximo_horas_trabalhadas(ano: int, mes: int) -> int:
|
|
79
|
+
try:
|
|
80
|
+
dias_no_mes = calendar.monthrange(ano, mes)[1]
|
|
81
|
+
except:
|
|
82
|
+
raise ValueError(f'Mes {mes} ou Ano {ano} indicados errado')
|
|
83
|
+
|
|
84
|
+
horas_trabalhadas_por_dia = {0: 10, 1: 10, 2: 10, 3: 10, 4: 4}
|
|
85
|
+
total_horas_trabalhadas = 0
|
|
86
|
+
|
|
87
|
+
primeiro_dia_semana = calendar.monthrange(ano, mes)[0]
|
|
88
|
+
|
|
89
|
+
for dia in range(1, dias_no_mes + 1):
|
|
90
|
+
dia_semana = (primeiro_dia_semana + (dia - 1)) % 7
|
|
91
|
+
|
|
92
|
+
if dia_semana in horas_trabalhadas_por_dia:
|
|
93
|
+
total_horas_trabalhadas += horas_trabalhadas_por_dia[dia_semana]
|
|
94
|
+
|
|
95
|
+
return total_horas_trabalhadas
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: conversor-horas-trabalho
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary:
|
|
5
|
+
License: FreeFreeWare
|
|
6
|
+
Author: Gabriel Nadai
|
|
7
|
+
Author-email: denadai123@gmail.com
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: License :: Other/Proprietary License
|
|
12
|
+
Classifier: Natural Language :: Portuguese (Brazilian)
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Education
|
|
18
|
+
Requires-Dist: rich (>=13.9.2,<14.0.0)
|
|
19
|
+
Requires-Dist: typer (>=0.12.5,<0.13.0)
|
|
20
|
+
Project-URL: Bug Tracker, https://github.com/ogabrielnadai/conversor-horas-trabalho/issues
|
|
21
|
+
Project-URL: Código, https://github.com/ogabrielnadai/conversor-horas-trabalho
|
|
22
|
+
Project-URL: Documentação, https://conversor-horas-trabalho.readthedocs.io/en/latest/
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
<img src='https://conversor-horas-trabalho.readthedocs.io/pt-br/latest/assets/logo.png' width='200'>
|
|
26
|
+
|
|
27
|
+
# Conversor Horas Trabalho
|
|
28
|
+
|
|
29
|
+
[](https://conversor-horas-trabalho.readthedocs.io/pt-br/latest/?badge=latest)
|
|
30
|
+
[](https://codecov.io/gh/ogabrielnadai/conversor-horas-trabalho)
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
O Conversor de horas de trabalho é um CLI responsável por fazer algumas conversões
|
|
34
|
+
entre horas para calculo de horas de trabalho.
|
|
35
|
+
|
|
36
|
+
Temos tres comandos disponíveis: `converte-hora`, `converte-hora-semanal` e `total-horas-mes`
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Como Usar?
|
|
40
|
+
|
|
41
|
+
### Converte Horas
|
|
42
|
+
Você pode chamar o conversor de hora via linha de comando. Por exemplo:
|
|
43
|
+
```bash
|
|
44
|
+
conversor-hora-trabalho converte-hora
|
|
45
|
+
```
|
|
46
|
+
```bash
|
|
47
|
+
┏━━━━━━━┓
|
|
48
|
+
┃ hora ┃
|
|
49
|
+
┡━━━━━━━┩
|
|
50
|
+
│ 12.50 │
|
|
51
|
+
└───────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Alteração do horário
|
|
55
|
+
O unico parametro do CLI é a hora que deseja converter
|
|
56
|
+
Voce pode usar passando um horário contendo ":" ou "."
|
|
57
|
+
Todos os tipos de conversoes possiveis:
|
|
58
|
+
* Tipos de Horas: '12:50' ou '12.30' sendo as duas correspondentes. Por exemplo:
|
|
59
|
+
```bash
|
|
60
|
+
poetry conversor-hora-trabalho converte-hora 12:40
|
|
61
|
+
```
|
|
62
|
+
```
|
|
63
|
+
┏━━━━━━━┓
|
|
64
|
+
┃ hora ┃
|
|
65
|
+
┡━━━━━━━┩
|
|
66
|
+
│ 12.65 │
|
|
67
|
+
└───────┘
|
|
68
|
+
```
|
|
69
|
+
Ou no outro formato. Por exemplo:
|
|
70
|
+
```bash
|
|
71
|
+
poetry conversor-hora-trabalho converte-hora 12.30
|
|
72
|
+
```
|
|
73
|
+
```
|
|
74
|
+
┏━━━━━━━┓
|
|
75
|
+
┃ hora ┃
|
|
76
|
+
┡━━━━━━━┩
|
|
77
|
+
│ 12:20 │
|
|
78
|
+
└───────┘
|
|
79
|
+
```
|
|
80
|
+
## Converte horas semanal
|
|
81
|
+
Você pode chamar o conversor de hora via linha de comando. Por exemplo:
|
|
82
|
+
```bash
|
|
83
|
+
conversor-hora-trabalho converte-hora-semanal
|
|
84
|
+
```
|
|
85
|
+
```bash
|
|
86
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
87
|
+
┃ total_horas_da_semana ┃ total_horas_extra ┃ total_horas_faltantes ┃
|
|
88
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
89
|
+
│ 18:00 │ 00:00 │ 26:00 │
|
|
90
|
+
└───────────────────────┴───────────────────┴───────────────────────┘
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Contabilizando as horas com comando
|
|
94
|
+
Como você pode chamar o conversor de hora semanal via linha de comando. Por exemplo:
|
|
95
|
+
```bash
|
|
96
|
+
conversor-hora-trabalho converte-hora-semanal --help
|
|
97
|
+
```
|
|
98
|
+
#### Informações sobre o comando converte-hora-semanal
|
|
99
|
+
Para você descobrir outras opções você pode usar a flag `--help`
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Usage: conversor-hora-trabalho converte-hora-semanal
|
|
103
|
+
[OPTIONS] [HORAS_SEMANA] [FORMATO]
|
|
104
|
+
|
|
105
|
+
╭─ Arguments ────────────────────────────────────────────────────╮
|
|
106
|
+
│ horas_semana [HORAS_SEMANA] Tag mais Hora │
|
|
107
|
+
│ [default: nm09.00,nm09.00] │
|
|
108
|
+
│ formato [FORMATO] Formato de retorno com 1 │
|
|
109
|
+
│ para ":" ou 2 para "." │
|
|
110
|
+
│ [default: 1] │
|
|
111
|
+
╰────────────────────────────────────────────────────────────────╯
|
|
112
|
+
╭─ Options ──────────────────────────────────────────────────────╮
|
|
113
|
+
│ --help Show this message and exit. │
|
|
114
|
+
╰────────────────────────────────────────────────────────────────╯
|
|
115
|
+
```
|
|
116
|
+
#### Tags e Uso
|
|
117
|
+
Podemos observar que existem duas tags: `nm (normal)` e `ov (overtime)`
|
|
118
|
+
quando indicados que uma hora é normal ela será contabilizada nas horas totais
|
|
119
|
+
da semana.
|
|
120
|
+
Ja quando definimo que uma hora é overtime ela é contabilizada nas horas extras
|
|
121
|
+
|
|
122
|
+
O ultimo parametro é o formato como queremos retornar as horas `1 para decimal`
|
|
123
|
+
e `2 para real`.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
127
|
+
┃ total_horas_da_semana ┃ total_horas_extra ┃ total_horas_faltantes ┃
|
|
128
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
129
|
+
│ 09:00 │ 09:00 │ 35:00 │
|
|
130
|
+
└───────────────────────┴───────────────────┴───────────────────────┘
|
|
131
|
+
```
|
|
132
|
+
```bash
|
|
133
|
+
conversor-hora-trabalho converte-hora-semanal nm09.00,ov09.00 2
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
138
|
+
┃ total_horas_da_semana ┃ total_horas_extra ┃ total_horas_faltantes ┃
|
|
139
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
140
|
+
│ 09.00 │ 09.00 │ 35.00 │
|
|
141
|
+
└───────────────────────┴───────────────────┴───────────────────────┘
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
conversor-hora-trabalho converte-hora-semanal nm09.00,nm09.00,nm09.00,nm09.00,nm08.00 1
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
150
|
+
┃ total_horas_da_semana ┃ total_horas_extra ┃ total_horas_faltantes ┃
|
|
151
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
152
|
+
│ 44:00 │ 00:00 │ 00:00 │
|
|
153
|
+
└───────────────────────┴───────────────────┴───────────────────────┘
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
conversor-hora-trabalho converte-hora-semanal nm05.00,ov02.00,nm09.00,nm09.00,nm09.00 1
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
162
|
+
┃ total_horas_da_semana ┃ total_horas_extra ┃ total_horas_faltantes ┃
|
|
163
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
164
|
+
│ 32:00 │ 02:00 │ 12:00 │
|
|
165
|
+
└───────────────────────┴───────────────────┴───────────────────────┘
|
|
166
|
+
```
|
|
167
|
+
## Total Horas Mensal
|
|
168
|
+
Você pode chamar o total horas mes via linha de comando. Por exemplo:
|
|
169
|
+
```bash
|
|
170
|
+
conversor-hora-trabalho total-horas-mes
|
|
171
|
+
```
|
|
172
|
+
```bash
|
|
173
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
174
|
+
┃ total_de_horas_esperadas_no_mes ┃ total_horas_trabalhadas ┃ total_horas_faltantes ┃
|
|
175
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
176
|
+
│ 186:00 │ 176:00 │ 010:00 │
|
|
177
|
+
└─────────────────────────────────┴─────────────────────────┴───────────────────────┘
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### Informações sobre o comando total-horas-mes
|
|
181
|
+
Para você descobrir outras opções você pode usar a flag `--help`
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
Usage: conversor-hora-trabalho total-horas-mes [OPTIONS] [HORAS_SEMANA] [ANO]
|
|
185
|
+
[MES]
|
|
186
|
+
|
|
187
|
+
╭─ Arguments ─────────────────────────────────────────────────────────────────────────╮
|
|
188
|
+
│ horas_semana [HORAS_SEMANA] Horas totais de cada semana seguido de virgula │
|
|
189
|
+
│ [default: 44,44,44,44] │
|
|
190
|
+
│ ano [ANO] Digite o Ano que deseja calcular │
|
|
191
|
+
│ [default: 2024] │
|
|
192
|
+
│ mes [MES] Digite o Mes que deseja calcular [default: 09] │
|
|
193
|
+
╰─────────────────────────────────────────────────────────────────────────────────────╯
|
|
194
|
+
╭─ Options ───────────────────────────────────────────────────────────────────────────╮
|
|
195
|
+
│ --help Show this message and exit. │
|
|
196
|
+
╰─────────────────────────────────────────────────────────────────────────────────────╯
|
|
197
|
+
```
|
|
198
|
+
#### Tags e Uso
|
|
199
|
+
Podemos observar que existem 3 parametros `horas_semana` que é informado em formato csv
|
|
200
|
+
ou seja podemos colocar o total de horas daquela semana seguido de uma virgula, por exemplo,
|
|
201
|
+
`10,10,10`, temos o parametro ano onde indicamos o ano e o ultimo para indicar o mês.
|
|
202
|
+
Exemplo de Uso:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
conversor-hora-trabalho total-horas-mes 44,43,45,44 2024 05
|
|
206
|
+
```
|
|
207
|
+
```bash
|
|
208
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
209
|
+
┃ total_de_horas_esperadas_no_mes ┃ total_horas_trabalhadas ┃ total_horas_faltantes ┃
|
|
210
|
+
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
211
|
+
│ 200:00 │ 176:00 │ 024:00 │
|
|
212
|
+
└─────────────────────────────────┴─────────────────────────┴───────────────────────┘
|
|
213
|
+
```
|
|
214
|
+
---
|
|
215
|
+
### Mais Informações sobre o CLI
|
|
216
|
+
Para você descobrir outras opções você pode usar a flag `--help`
|
|
217
|
+
```
|
|
218
|
+
Usage: conversor-hora-trabalho [OPTIONS] COMMAND [ARGS]...
|
|
219
|
+
|
|
220
|
+
╭─ Options ────────────────────────────────────────────────────────────────────╮
|
|
221
|
+
│ --install-completion Install completion for the current shell. │
|
|
222
|
+
│ --show-completion Show completion for the current shell, to copy │
|
|
223
|
+
│ it or customize the installation. │
|
|
224
|
+
│ --help Show this message and exit. │
|
|
225
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
226
|
+
╭─ Commands ───────────────────────────────────────────────────────────────────╮
|
|
227
|
+
│ converte-hora │
|
|
228
|
+
│ converte-hora-semanal │
|
|
229
|
+
│ total-horas-mes │
|
|
230
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
231
|
+
```
|
|
232
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
conversor_horas_trabalho/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
conversor_horas_trabalho/cli.py,sha256=bU0O5NtdSlniaF9Ag-WqFaP6NLPLA1qBkkgL-262Q34,2539
|
|
3
|
+
conversor_horas_trabalho/converte_horas.py,sha256=Ni58qgM9uauAr0e8CVinhT35lwGekp3X9_QGLsCEWjA,1654
|
|
4
|
+
conversor_horas_trabalho/converte_horas_semanais.py,sha256=IxE-QObL39kqQGB8L9tEa6AKGwAMALPOSXRKa8A_Q2w,3715
|
|
5
|
+
conversor_horas_trabalho/total_horas_mes.py,sha256=BtbI8hCIrfNFK68D63M8uZnzCmx8DLRGE63yVk66fXk,3092
|
|
6
|
+
conversor_horas_trabalho-0.1.0.dist-info/entry_points.txt,sha256=hNiWM6A1kCZsBqjtbpE8AbrGWRNPjv-c6Ur20mZ_ycw,76
|
|
7
|
+
conversor_horas_trabalho-0.1.0.dist-info/LICENSE,sha256=LPZSexgmOHGmPT236UtRB2UuPYZrrpRF_0M8vLcCywA,168
|
|
8
|
+
conversor_horas_trabalho-0.1.0.dist-info/METADATA,sha256=LI7fC-w4w7Vzr6Aorp18GtQHQ6MMEHW1-YewQcG70_Y,15111
|
|
9
|
+
conversor_horas_trabalho-0.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
10
|
+
conversor_horas_trabalho-0.1.0.dist-info/RECORD,,
|