--- trunk/RCS/lohnrechner.py 2005/02/04 13:25:36 33 +++ trunk/lohnrechner.py 2007/01/26 11:23:49 72 @@ -5,54 +5,55 @@ # $Id$ # -------------------------------------------------------------------- # -# Copyright (c) 2005 by Intevation GmbH +# Copyright (c) 2005,2006,2007 by Intevation GmbH # Authors: # Sascha Wilde # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with this package for details. -"""Lohn/Gehaltsrechner für das Jahr 2005""" +"""Lohn/Gehaltsrechner für das Jahr 2007""" __version__ = "$Revision$" # $Source$ -_release_version = "0.%s beta" % __version__[11:-2] +_release_version = "0.%s" % __version__[11:-2] -import LST2005 +import LST2007 from Tkinter import * -class Lohnrechner(LST2005.LStRechner2005): +class Lohnrechner(LST2007.LStRechner2007): def __init__(self, root): - LST2005.LStRechner2005.__init__(self) + LST2007.LStRechner2007.__init__(self) - # Land, Kirchensteuersatz - self.laender = [("Baden-Württemberg", 8), - ("Bayern", 8), - ("Berlin", 9), - ("Brandenburg", 9), - ("Bremen", 9), - ("Bremerhaven", 9), - ("Hamburg", 9), - ("Hessen", 9), - ("Mecklenburg-Vorpommern", 9), - ("Niedersachsen" ,9), - ("Nordrhein-Westfalen", 9), - ("Rheinland-Pfalz", 9), - ("Saarland", 9), - ("Sachsen", 9), - ("Sachsen-Anhalt", 9), - ("Schleswig-Holstein", 9), - ("Thüringen", 9)] - - self.InitSozv() + # Land, Kirchensteuersatz, Pflegeversicherung AG-Anteil + self.laender = [("Baden-Württemberg", 8, 0.0085, 5250), + ("Bayern", 8, 0.0085, 5250), + ("Berlin (ost)", 9, 0.0085, 4550), + ("Berlin (west)", 9, 0.0085, 5250), + ("Brandenburg", 9, 0.0085, 4550), + ("Bremen", 9, 0.0085, 5250), + ("Bremerhaven", 9, 0.0085, 5250), + ("Hamburg", 9, 0.0085, 5250), + ("Hessen", 9, 0.0085, 5250), + ("Mecklenburg-Vorpommern", 9, 0.0085, 4550), + ("Niedersachsen" ,9, 0.0085, 5250), + ("Nordrhein-Westfalen", 9, 0.0085, 5250), + ("Rheinland-Pfalz", 9, 0.0085, 5250), + ("Saarland", 9, 0.0085, 5250), + ("Sachsen", 9, 0.0135, 4550), + ("Sachsen-Anhalt", 9, 0.0085, 4550), + ("Schleswig-Holstein", 9, 0.0085, 5250), + ("Thüringen", 9, 0.0085, 4550)] self.root = root - self.root.title("Lohnrechner 2005 - v%s" % _release_version) + self.root.title("Lohnrechner 2007 - v%s" % _release_version) self.SetupUI() + self.UpdateLand() + self.InitSozv() self.ResetInput() def SetupUI(self): @@ -62,15 +63,20 @@ frame.grid(padx=10, pady=10) # Steuern Ein/Ausgabe - Label(frame, text="Lohn:").grid(row=0, sticky=E) + Label(frame, text="Geburtsjahr:").grid(row=0, sticky=E) + self.geb = Entry(frame) + self.geb.bind("", self.NewInput) + self.geb.grid(row=0, column=1, sticky=W) + + Label(frame, text="Lohn (monatlich):").grid(row=1, sticky=E) self.lohn = Entry(frame) self.lohn.bind("", self.NewInput) - self.lohn.grid(row=0, column=1, sticky=W) + self.lohn.grid(row=1, column=1, sticky=W) - Label(frame, text="Steuerklasse:").grid(row=1, sticky=E) + Label(frame, text="Steuerklasse:").grid(row=2, sticky=E) self.stkl = IntVar() stklframe = Frame(frame) - stklframe.grid(row=1, column=1, sticky=W) + stklframe.grid(row=2, column=1, sticky=W) for text, val in [("I", 1), ("II", 2), ("III", 3), @@ -84,17 +90,24 @@ stklradio.select() stklradio.pack(side=LEFT) - Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E) + Label(frame, text="Kirchensteuer:").grid(row=3, sticky=E) self.kirche = IntVar() Checkbutton(frame, onvalue=1, offvalue=0, command=self.NewInput, - variable=self.kirche).grid(row=2, column=1,sticky=W) + variable=self.kirche).grid(row=3, column=1,sticky=W) - Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E) + Label(frame, text="Kinderfreibetrag:").grid(row=4, sticky=E) self.kfb = Entry(frame) self.kfb.bind("", self.NewInput) - self.kfb.grid(row=3, column=1, sticky=W) + self.kfb.grid(row=4, column=1, sticky=W) - Label(frame, text="Bundesland:").grid(row=4, sticky=NE) + Label(frame, text="Kinder:").grid(row=5, sticky=E) + self.kinder = IntVar() + self.kinderradio = Checkbutton(frame, onvalue=1, offvalue=0, + command=self.NewInput, + variable=self.kinder) + self.kinderradio.grid(row=5, column=1, sticky=W) + + Label(frame, text="Bundesland:").grid(row=6, sticky=NE) landframe = Frame(frame) scrollbar = Scrollbar(landframe, orient=VERTICAL) self.landbox = Listbox(landframe, height=4, selectmode=SINGLE, @@ -106,7 +119,7 @@ self.landbox.pack(side=RIGHT, fill=Y) scrollbar.config(command=self.landbox.yview) scrollbar.pack(side=LEFT, fill=BOTH, expand=1) - landframe.grid(row=4, rowspan=4, column=1, sticky=W) + landframe.grid(row=6, rowspan=4, column=1, sticky=W) Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E) self.lst = Entry(frame) @@ -125,17 +138,25 @@ self.netto1.grid(row=3, column=3, sticky=W) # Sozialversicherung Ein/Ausgabe - Label(frame, text="Sozialversicherung:").grid(row=8, sticky=E) + Label(frame, text="Sozialversicherung:").grid(row=10, sticky=E) self.sozv = IntVar() sozvradio = Checkbutton(frame, onvalue=1, offvalue=0, command=self.NewInput, variable=self.sozv) sozvradio.select() - sozvradio.grid(row=8, column=1, sticky=W) + sozvradio.grid(row=10, column=1, sticky=W) - Label(frame, text="Krankenkassenbeitrag:").grid(row=9, sticky=E) + Label(frame, text="Krankenkassenbeitrag:").grid(row=11, sticky=E) self.kvsatz = Entry(frame) self.kvsatz.bind("", self.NewInput) - self.kvsatz.grid(row=9, column=1, sticky=W) + self.kvsatz.grid(row=11, column=1, sticky=W) + + Label(frame, text="Krankenkassenzuschlag (0.9%):").grid(row=12, sticky=E) + self.kvsoli = IntVar() + kvsoliradio = Checkbutton(frame, onvalue=1, offvalue=0, + command=self.NewInput, variable=self.kvsoli) + kvsoliradio.select() + kvsoliradio.grid(row=12, column=1, sticky=W) + Label(frame, text="Rentenversicherung:").grid(row=4, column=2, sticky=E) self.rv = Entry(frame) @@ -160,7 +181,7 @@ # Allgemeine UI Elemente buttons = Frame(frame) - buttons.grid(row=9, column=2, columnspan=2) + buttons.grid(row=10, column=2, rowspan=3, columnspan=2) Button(buttons, text="Quit", command=self.root.quit).pack(side=LEFT) Button(buttons, text="Info", command=self.Info).pack(side=LEFT) Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT) @@ -171,7 +192,9 @@ # zwangsselektiert: # FIX ME: eigendlich wäre das ein Fall für ein custom widget! if len(self.landbox.curselection()) == 0: - self.landbox.select_set(self.land) + self.landbox.select_set(self.land) + if float(self.kfb.get()) > 0.0: + self.kinderradio.select() self.CalcOutput() def UpdateLand(self): @@ -182,11 +205,16 @@ self.CalcOutput() def ResetInput(self): + self.ResetInputGeb() self.ResetInputLohn() self.ResetInputKfb() self.ResetInputKVsatz() self.NewLandSel() + def ResetInputGeb(self): + self.geb.delete(0, END) + self.geb.insert(0, "1964") + def ResetInputLohn(self): self.lohn.delete(0, END) self.lohn.insert(0, "0") @@ -197,7 +225,7 @@ def ResetInputKVsatz(self): self.kvsatz.delete(0, END) - self.kvsatz.insert(0, "14.7") + self.kvsatz.insert(0, "13.8") def InitCalc(self): try: @@ -206,6 +234,11 @@ self.ResetInputLohn() try: + self.SetGeb(int(self.geb.get())) + except: + self.ResetInputGeb() + + try: self.SetKinderfreibetrag(float(self.kfb.get())) except: self.ResetInputKfb() @@ -248,15 +281,15 @@ def Info(self): infowin = Toplevel(self.root) infowin.title("Info") - Label(infowin, text="Lohnrechner 2005 v%s" % _release_version, + Label(infowin, text="Lohnrechner 2007 v%s" % _release_version, font=("Times", 14, "bold italic")).grid(row=0, pady=20) Label(infowin, text= - "Copyright (C) 2005 Intevation GmbH \n\n\ -Lohnrechner 2005 comes with ABSOLUTELY NO WARRANTY.\n\ + "Copyright (C) 2005,2006,2007 Intevation GmbH \n\n\ +Lohnrechner 2007 comes with ABSOLUTELY NO WARRANTY.\n\ This is free software, and you are welcome to redistribute it\n\ under the terms of the GNU General Public License.\n\ For more information about these matters, see the file named COPYING.\n\n\ -Dieses Programm verwendet LST2005 %s" % LST2005._ModulVersion()).grid(row=1, padx=10) +Dieses Programm verwendet LST2007 %s" % LST2007._ModulVersion()).grid(row=1, padx=10) Button(infowin, text="Ok", command=infowin.destroy).grid(row=2, pady=10) # @@ -266,12 +299,12 @@ # def InitSozv(self): - self.AVsatz = 0.065 - self.RVsatz = 0.195 - self.PVsatz = 0.017 + self.AVsatz = 0.042 / 2 + self.RVsatz = 0.199 / 2 + # PVsatz ist in self.laender definiert! self.PVkinderlose = 0.0025 - self.BMG1 = 3525 - self.BMG2 = 5200 + self.BMG1 = 3562.5 + # BMG2 für RV und ALV ist in self.laender definiert! def SetKV(self, value): assert value >= 0.0 and value <= 100.0, \ @@ -280,26 +313,33 @@ def GetAV(self): lohn = self.GetLohn() - if lohn > self.BMG2 : lohn = self.BMG2 - return round(self.sozv.get() * self.AVsatz * lohn / 2, 2) + BMG2 = self.laender[self.land][3] + if lohn > BMG2 : lohn = BMG2 + return round(self.sozv.get() * self.AVsatz * lohn, 2) def GetRV(self): lohn = self.GetLohn() - if lohn > self.BMG2 : lohn = self.BMG2 - return round(self.sozv.get() * self.RVsatz * lohn / 2, 2) + BMG2 = self.laender[self.land][3] + if lohn > BMG2 : lohn = BMG2 + return round(self.sozv.get() * self.RVsatz * lohn, 2) def GetPV(self): + self.PVsatz = self.laender[self.land][2] lohn = self.GetLohn() if lohn > self.BMG1 : lohn = self.BMG1 - PV = self.PVsatz * lohn / 2 - if float(self.kfb.get()) == 0.0 : + PV = self.PVsatz * lohn + if self.kinder.get() == 0 : PV += lohn * self.PVkinderlose return round(self.sozv.get() * PV, 2) def GetKV(self): + self.KVsoli = self.kvsoli.get() lohn = self.GetLohn() if lohn > self.BMG1 : lohn = self.BMG1 - return round(self.sozv.get() * self.KVsatz * lohn / 2, 2) + if self.KVsoli : + return round(self.sozv.get() * ((self.KVsatz / 2) + 0.009) * lohn, 2) + else : + return round(self.sozv.get() * self.KVsatz * lohn / 2, 2) if __name__ == "__main__":