Browse Source

Time Recorder Update:

Netto Income is now without salestax(pays the Customer)
Calendar_Week added to table
Danny 2 years ago
parent
commit
7a13acd188

+ 9 - 5
personal_income_calculator/income_calculator_main.py

@@ -1,6 +1,10 @@
-def calc_income_by_time_in_euro(worked_time, hourly_wage_in_euro):
+def calc_income_by_time_in_euro_with_sales_tax(worked_time_in_minutes, hourly_wage_in_euro):
     sales_tax_percent = 0.19
-    brutto_income_in_euro = worked_time*(hourly_wage_in_euro/60)
-    sales_tax = sales_tax_percent*brutto_income_in_euro
-    netto_income_in_euro= brutto_income_in_euro- sales_tax
-    return netto_income_in_euro, sales_tax
+    brutto_income_in_euro = worked_time_in_minutes * (hourly_wage_in_euro / 60)
+    sales_tax = sales_tax_percent * brutto_income_in_euro
+    netto_income_in_euro = brutto_income_in_euro - sales_tax
+    return netto_income_in_euro, sales_tax
+
+
+def calc_income_by_time_in_euro_without_sales_tax(worked_time_in_minutes, hourly_wage_in_euro):
+    return worked_time_in_minutes * (hourly_wage_in_euro / 60)

+ 1 - 1
time_recoder/Readme

@@ -1 +1 @@
-pip install styleframe xlsxwriter pysimplegui
+pip install styleframe xlsxwriter pysimplegui datetime

+ 8 - 7
time_recoder/save_recorded_time_in_table.py

@@ -1,15 +1,16 @@
 from time_recoder.time_recoder_config import HOURLY_WAGE_IN_EURO, PATH, NAME
-from personal_income_calculator.income_calculator_main import calc_income_by_time_in_euro
+from personal_income_calculator.income_calculator_main import calc_income_by_time_in_euro_without_sales_tax
+from tool_lib import datetime_functions
 from tool_lib import create_excel_tables
 from os import path
 from time import time
-from datetime import date
-def create_recorded_time_dict(worked_time, income, sales_taxes):
+
+def create_recorded_time_dict(worked_time, income):
     return {'Name': NAME,
-            'Datum': str(date.today()),
+            'Datum': str(datetime_functions.get_current_date()) ,
             'Arbeitszeit' : worked_time,
             'Einkommen': income,
-            'Umsatzsteuern': sales_taxes}
+            'Kalenderwoche': datetime_functions.get_calendarweek_from_datetime(datetime_functions.get_current_date())}
 
 def table_exists(path_):
     return path.isfile(path_)
@@ -24,8 +25,8 @@ def create_xlsx_table(table_object):
     table_object.export_to_excel(table_object.create_writer())
 
 def save_recorded_time_in_table(worked_time_in_minutes):
-    income, sales_taxes = calc_income_by_time_in_euro(worked_time_in_minutes, HOURLY_WAGE_IN_EURO)
-    table_dict = create_recorded_time_dict(worked_time_in_minutes, income, sales_taxes)
+    income = calc_income_by_time_in_euro_without_sales_tax(worked_time_in_minutes, HOURLY_WAGE_IN_EURO)
+    table_dict = create_recorded_time_dict(worked_time_in_minutes, income)
     xlsx_table = create_excel_tables.CreateTable(table_dict, path=PATH)
     if table_exists(PATH):
         add_to_xlsx_table(xlsx_table)

+ 7 - 0
tool_lib/datetime_functions.py

@@ -0,0 +1,7 @@
+import datetime
+
+def get_calendarweek_from_datetime(datetime_obj):
+    return datetime_obj.strftime('%V')
+
+def get_current_date():
+    return datetime.date.today()