save_recorded_time_in_table.py 966 B

12345678910111213141516171819202122232425262728
  1. from time_recoder.time_recoder_config import HOURLY_WAGE_IN_EURO, PATH
  2. from personal_income_calculator.income_calculator_main import calc_income_by_time
  3. from tool_lib import create_excel_tables
  4. from os import path
  5. def create_recorded_time_dict(worked_time, income, sales_taxes):
  6. return {'Arbeitszeit' : worked_time,
  7. 'Einkommen': income,
  8. 'Umsatzsteuern': sales_taxes}
  9. def table_exists(path):
  10. return path.isfile(path)
  11. def add_to_xlsx_table(table_object):
  12. pass
  13. def create_xlsx_table(table_object):
  14. pass
  15. def save_recorded_time_in_table(worked_time_in_minutes):
  16. income, sales_taxes = calc_income_by_time(worked_time_in_minutes, HOURLY_WAGE_IN_EURO)
  17. table_dict = create_recorded_time_dict(worked_time_in_minutes, income, sales_taxes)
  18. xlsx_table= create_excel_tables.CreateTable(table_dict, path=PATH)
  19. if table_exists(PATH):
  20. add_to_xlsx_table(xlsx_table)
  21. else:
  22. create_xlsx_table(xlsx_table)