Created
August 25, 2022 10:41
-
-
Save dolohow/ebf06becad72547e1761d00d43bd8a09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import openpyxl | |
worktime = openpyxl.load_workbook(sys.argv[1]).active | |
absence1 = openpyxl.load_workbook(sys.argv[2]).active | |
absence2 = openpyxl.load_workbook(sys.argv[3]).active | |
people = {} | |
for row in worktime.iter_rows(min_row=2, min_col=1, max_col=6): | |
people[f'{row[0].value} {row[1].value}'] = [row[5].value, 0] | |
for row in absence1.iter_rows(min_row=2, min_col=1, max_col=6): | |
try: | |
name = f'{row[0].value} {row[1].value}' | |
p = people[name] | |
p[1] += int(row[4].value) * 8 | |
except KeyError: | |
print(f'Nie znaleziono "{name}" w {sys.argv[2]}') | |
for row in absence2.iter_rows(min_row=2, min_col=1, max_col=6): | |
try: | |
name = f'{row[0].value} {row[1].value}' | |
p = people[name] | |
p[1] += int(row[5].value) | |
except KeyError: | |
print(f'Nie znaleziono "{name}" w {sys.argv[3]}') | |
for p in people.items(): | |
d = p[1][0] - p[1][1] | |
if d != 0: | |
print(f'{p[0]} brakuje {d} godzin') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment