Kalkulator zasiłku chorobowego

def calculate_sick_leave(*args, **kwargs): try: wage = float(Element('wage').value) days_off = int(Element('days_off').value) reason = Element('reason').value print(reason) print(wage) if not wage or not days_off or not reason: Element('result').write("Uzupełnij wszystkie pola.") return if days_off < 0 or wage < 0: Element('result').write("Dni choroby i wynagrodzenie nie mogą być wartością ujemną.") return if reason not in ["sickness", "pregnancy", "accident"]: Element('result').write("Nieprawidłowy powód choroby.") return # calculate the sickness wage base wage_base = wage - (0.1371 * wage) # calculate the daily sickness wage daily_sick_wage = wage_base / 30 if reason == "sickness": daily_sick_wage *= 0.8 elif reason in ["pregnancy", "accident"]: daily_sick_wage *= 1.0 # calculate the total sickness wage sick_wage = daily_sick_wage * days_off # calculate the work wage for the days worked in the month work_wage = (wage / 30) * (30 - days_off) # calculate the total wage total_wage = work_wage + sick_wage Element('output').write(f"Wynagrodzenie za okres choroby wynosi: {sick_wage:.2f} zł.") except Exception as e: Element('output').write(f"Wystąpił błąd: {str(e)}")
Oceń kalkulator

No comment

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *