/[lohnrechner]/trunk/lohnrechner.py
ViewVC logotype

Diff of /trunk/lohnrechner.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 71 by wilde, Fri Jan 26 10:38:26 2007 UTC revision 81 by frank, Wed Feb 11 11:04:42 2009 UTC
# Line 5  Line 5 
5  # $Id$  # $Id$
6  # --------------------------------------------------------------------  # --------------------------------------------------------------------
7  #  #
8  # Copyright (c) 2005,2006,2007 by Intevation GmbH  # Copyright (c) 2005,2006,2007,2008 by Intevation GmbH
9  # Authors:  # Authors:
10  # Sascha Wilde <[email protected]>  # Sascha Wilde <[email protected]>
11  #  #
12  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
13  # Read the file COPYING coming with this package for details.  # Read the file COPYING coming with this package for details.
14    
15  """Lohn/Gehaltsrechner f�r das Jahr 2007"""  """Lohn/Gehaltsrechner f�r das Jahr 2008"""
16    
17  __version__ = "$Revision$"  __version__ = "$Revision$"
18  # $Source$  # $Source$
19                    
20  _release_version = "0.%s" % __version__[11:-2]  _release_version = "0.%s" % __version__[11:-2]
21    
22  import LST2007  import LST2008
23  from Tkinter import *  from Tkinter import *
24    
25  class Lohnrechner(LST2007.LStRechner2007):  class Lohnrechner(LST2008.LStRechner2008):
26    
27      def __init__(self, root):      def __init__(self, root):
28          LST2007.LStRechner2007.__init__(self)          LST2008.LStRechner2008.__init__(self)
29    
30          # Land, Kirchensteuersatz, Pflegeversicherung AG-Anteil          # Land, Kirchensteuersatz, Pflegeversicherung AG-Anteil
31          self.laender = [("Baden-W�rttemberg", 8, 0.0085),          self.laender = [("Baden-W�rttemberg", 8, 0.0085, 5300),
32                          ("Bayern", 8, 0.0085),                          ("Bayern", 8, 0.0085, 5300),
33                          ("Berlin", 9, 0.0085),                          ("Berlin (ost)", 9, 0.0085, 4500),
34                          ("Brandenburg", 9, 0.0085),                          ("Berlin (west)", 9, 0.0085, 5300),
35                          ("Bremen", 9, 0.0085),                          ("Brandenburg", 9, 0.0085, 4500),
36                          ("Bremerhaven", 9, 0.0085),                          ("Bremen", 9, 0.0085, 5300),
37                          ("Hamburg", 9, 0.0085),                          ("Bremerhaven", 9, 0.0085, 5300),
38                          ("Hessen", 9, 0.0085),                          ("Hamburg", 9, 0.0085, 5300),
39                          ("Mecklenburg-Vorpommern", 9, 0.0085),                          ("Hessen", 9, 0.0085, 5300),
40                          ("Niedersachsen" ,9, 0.0085),                          ("Mecklenburg-Vorpommern", 9, 0.0085, 4500),
41                          ("Nordrhein-Westfalen", 9, 0.0085),                          ("Niedersachsen" ,9, 0.0085, 5300),
42                          ("Rheinland-Pfalz", 9, 0.0085),                          ("Nordrhein-Westfalen", 9, 0.0085, 5300),
43                          ("Saarland", 9, 0.0085),                          ("Rheinland-Pfalz", 9, 0.0085, 5300),
44                          ("Sachsen", 9, 0.0135),                          ("Saarland", 9, 0.0085, 5300),
45                          ("Sachsen-Anhalt", 9, 0.0085),                          ("Sachsen", 9, 0.0135, 4500),
46                          ("Schleswig-Holstein", 9, 0.0085),                          ("Sachsen-Anhalt", 9, 0.0085, 4500),
47                          ("Th�ringen", 9, 0.0085)]                          ("Schleswig-Holstein", 9, 0.0085, 5300),
48                            ("Th�ringen", 9, 0.0085, 4500)]
49                    
50          self.root = root          self.root = root
51    
52          self.root.title("Lohnrechner 2007 - v%s" % _release_version)          self.root.title("Lohnrechner 2008 - v%s" % _release_version)
53    
54          self.SetupUI()          self.SetupUI()
55          self.UpdateLand()          self.UpdateLand()
# Line 72  class Lohnrechner(LST2007.LStRechner2007 Line 73  class Lohnrechner(LST2007.LStRechner2007
73          self.lohn.bind("<Return>", self.NewInput)          self.lohn.bind("<Return>", self.NewInput)
74          self.lohn.grid(row=1, column=1, sticky=W)          self.lohn.grid(row=1, column=1, sticky=W)
75    
76          Label(frame, text="Steuerklasse:").grid(row=2, sticky=E)          sonstbezlabel = Label(frame, text="Sonstige Bez�ge:")
77            self.sonstbez = Entry(frame)
78            self.sonstbez.bind("<Return>", self.NewInput)
79            # Sonstige Bezuege bisher nur unter Randbedingungen:
80            # - Einmalig im Kalenderjahr
81            # - Keine Ber�cksichtigung bei der Berechnung Sozialbeitr�ge
82            # Daher per Vorgabe "versteckt", bei Bedarf einfuegen:
83            # sonstbezlabel.grid(row=2, sticky=E)
84            # self.sonstbez.grid(row=2, column=1, sticky=W)
85            
86            Label(frame, text="Steuerklasse:").grid(row=3, sticky=E)
87          self.stkl = IntVar()          self.stkl = IntVar()
88          stklframe = Frame(frame)          stklframe = Frame(frame)
89          stklframe.grid(row=2, column=1, sticky=W)          stklframe.grid(row=3, column=1, sticky=W)
90          for text, val in [("I", 1),          for text, val in [("I", 1),
91                            ("II", 2),                            ("II", 2),
92                            ("III", 3),                            ("III", 3),
# Line 89  class Lohnrechner(LST2007.LStRechner2007 Line 100  class Lohnrechner(LST2007.LStRechner2007
100                  stklradio.select()                  stklradio.select()
101              stklradio.pack(side=LEFT)              stklradio.pack(side=LEFT)
102    
103          Label(frame, text="Kirchensteuer:").grid(row=3, sticky=E)          Label(frame, text="Kirchensteuer:").grid(row=4, sticky=E)
104          self.kirche = IntVar()          self.kirche = IntVar()
105          Checkbutton(frame, onvalue=1, offvalue=0, command=self.NewInput,          Checkbutton(frame, onvalue=1, offvalue=0, command=self.NewInput,
106                      variable=self.kirche).grid(row=3, column=1,sticky=W)                      variable=self.kirche).grid(row=4, column=1,sticky=W)
107    
108          Label(frame, text="Kinderfreibetrag:").grid(row=4, sticky=E)          Label(frame, text="Kinderfreibetrag:").grid(row=5, sticky=E)
109          self.kfb = Entry(frame)          self.kfb = Entry(frame)
110          self.kfb.bind("<Return>", self.NewInput)          self.kfb.bind("<Return>", self.NewInput)
111          self.kfb.grid(row=4, column=1, sticky=W)          self.kfb.grid(row=5, column=1, sticky=W)
112    
113          Label(frame, text="Bundesland:").grid(row=5, sticky=NE)          Label(frame, text="Kinder:").grid(row=6, sticky=E)
114            self.kinder = IntVar()
115            self.kinderradio = Checkbutton(frame, onvalue=1, offvalue=0,
116                                           command=self.NewInput,
117                                           variable=self.kinder)
118            self.kinderradio.grid(row=6, column=1, sticky=W)
119            
120            Label(frame, text="Bundesland:").grid(row=7, sticky=NE)
121          landframe = Frame(frame)          landframe = Frame(frame)
122          scrollbar = Scrollbar(landframe, orient=VERTICAL)          scrollbar = Scrollbar(landframe, orient=VERTICAL)
123          self.landbox = Listbox(landframe, height=4, selectmode=SINGLE,          self.landbox = Listbox(landframe, height=4, selectmode=SINGLE,
# Line 111  class Lohnrechner(LST2007.LStRechner2007 Line 129  class Lohnrechner(LST2007.LStRechner2007
129          self.landbox.pack(side=RIGHT, fill=Y)          self.landbox.pack(side=RIGHT, fill=Y)
130          scrollbar.config(command=self.landbox.yview)          scrollbar.config(command=self.landbox.yview)
131          scrollbar.pack(side=LEFT, fill=BOTH, expand=1)          scrollbar.pack(side=LEFT, fill=BOTH, expand=1)
132          landframe.grid(row=5, rowspan=4, column=1, sticky=W)          landframe.grid(row=7, rowspan=4, column=1, sticky=W)
133                    
134          Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E)          Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E)
135          self.lst = Entry(frame)          self.lst = Entry(frame)
# Line 130  class Lohnrechner(LST2007.LStRechner2007 Line 148  class Lohnrechner(LST2007.LStRechner2007
148          self.netto1.grid(row=3, column=3, sticky=W)          self.netto1.grid(row=3, column=3, sticky=W)
149    
150          # Sozialversicherung Ein/Ausgabe          # Sozialversicherung Ein/Ausgabe
151          Label(frame, text="Sozialversicherung:").grid(row=9, sticky=E)          Label(frame, text="Sozialversicherung:").grid(row=11, sticky=E)
152          self.sozv = IntVar()          self.sozv = IntVar()
153          sozvradio = Checkbutton(frame, onvalue=1, offvalue=0,          sozvradio = Checkbutton(frame, onvalue=1, offvalue=0,
154                                  command=self.NewInput, variable=self.sozv)                                  command=self.NewInput, variable=self.sozv)
155          sozvradio.select()          sozvradio.select()
156          sozvradio.grid(row=9, column=1, sticky=W)          sozvradio.grid(row=11, column=1, sticky=W)
157    
158          Label(frame, text="Krankenkassenbeitrag:").grid(row=10, sticky=E)          Label(frame, text="Krankenkassenbeitrag:").grid(row=12, sticky=E)
159          self.kvsatz = Entry(frame)          self.kvsatz = Entry(frame)
160          self.kvsatz.bind("<Return>", self.NewInput)          self.kvsatz.bind("<Return>", self.NewInput)
161          self.kvsatz.grid(row=10, column=1, sticky=W)          self.kvsatz.grid(row=12, column=1, sticky=W)
162    
163          Label(frame, text="Krankenkassenzuschlag (0.9%):").grid(row=11, sticky=E)          Label(frame, text="Krankenkassenzuschlag (0.9%):").grid(row=13, sticky=E)
164          self.kvsoli = IntVar()          self.kvsoli = IntVar()
165          kvsoliradio = Checkbutton(frame, onvalue=1, offvalue=0,          kvsoliradio = Checkbutton(frame, onvalue=1, offvalue=0,
166                                  command=self.NewInput, variable=self.kvsoli)                                    command=self.NewInput, variable=self.kvsoli)
167          kvsoliradio.select()          kvsoliradio.select()
168          kvsoliradio.grid(row=11, column=1, sticky=W)          kvsoliradio.grid(row=13, column=1, sticky=W)
169    
170    
171          Label(frame, text="Rentenversicherung:").grid(row=4, column=2, sticky=E)          Label(frame, text="Rentenversicherung:").grid(row=4, column=2, sticky=E)
# Line 173  class Lohnrechner(LST2007.LStRechner2007 Line 191  class Lohnrechner(LST2007.LStRechner2007
191    
192          # Allgemeine UI Elemente          # Allgemeine UI Elemente
193          buttons = Frame(frame)          buttons = Frame(frame)
194          buttons.grid(row=10, column=2, rowspan=2, columnspan=2)          buttons.grid(row=10, column=2, rowspan=3, columnspan=2)
195          Button(buttons, text="Quit", command=self.root.quit).pack(side=LEFT)          Button(buttons, text="Quit", command=self.root.quit).pack(side=LEFT)
196          Button(buttons, text="Info", command=self.Info).pack(side=LEFT)          Button(buttons, text="Info", command=self.Info).pack(side=LEFT)
197          Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT)          Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT)
# Line 184  class Lohnrechner(LST2007.LStRechner2007 Line 202  class Lohnrechner(LST2007.LStRechner2007
202          # zwangsselektiert:          # zwangsselektiert:
203          # FIX ME: eigendlich w�re das ein Fall f�r ein custom widget!          # FIX ME: eigendlich w�re das ein Fall f�r ein custom widget!
204          if len(self.landbox.curselection()) == 0:          if len(self.landbox.curselection()) == 0:
205              self.landbox.select_set(self.land)                          self.landbox.select_set(self.land)
206            if float(self.kfb.get()) > 0.0:
207                self.kinderradio.select()
208          self.CalcOutput()          self.CalcOutput()
209    
210      def UpdateLand(self):      def UpdateLand(self):
# Line 197  class Lohnrechner(LST2007.LStRechner2007 Line 217  class Lohnrechner(LST2007.LStRechner2007
217      def ResetInput(self):      def ResetInput(self):
218          self.ResetInputGeb()          self.ResetInputGeb()
219          self.ResetInputLohn()          self.ResetInputLohn()
220            self.ResetInputSonstBez()
221          self.ResetInputKfb()          self.ResetInputKfb()
222          self.ResetInputKVsatz()          self.ResetInputKVsatz()
223          self.NewLandSel()          self.NewLandSel()
# Line 209  class Lohnrechner(LST2007.LStRechner2007 Line 230  class Lohnrechner(LST2007.LStRechner2007
230          self.lohn.delete(0, END)          self.lohn.delete(0, END)
231          self.lohn.insert(0, "0")          self.lohn.insert(0, "0")
232    
233        def ResetInputSonstBez(self):
234            self.sonstbez.delete(0, END)
235            self.sonstbez.insert(0, "0")
236    
237      def ResetInputKfb(self):      def ResetInputKfb(self):
238          self.kfb.delete(0, END)          self.kfb.delete(0, END)
239          self.kfb.insert(0, "0")          self.kfb.insert(0, "0")
# Line 224  class Lohnrechner(LST2007.LStRechner2007 Line 249  class Lohnrechner(LST2007.LStRechner2007
249              self.ResetInputLohn()              self.ResetInputLohn()
250    
251          try:          try:
252                self.SetSonstigeBezuege(float(self.sonstbez.get()))
253            except:
254                self.ResetInputSonstBez()
255    
256            # JRE4: N�tig f�r Sonstige Bez�ge.
257            # Voraussichtlicher Jahresarbeitslohn ohne sonstige Bez�ge und ohne
258            # Verg�tung f�r mehrj�hrige T�tigkeit in Cent (ggf. 0)
259            # lohnrechner berechnet diesen aus dem monatlichen Lohn.
260            try:
261                self.Set_JRE4(round(float(self.lohn.get())*100.0,2)*12)
262            except:
263                pass
264    
265            # JVBEZ: N�tig f�r Sonstige Bez�ge.
266            # lohnrechner ber�cksichtigt keine Versorgungsbez�ge, daher 0.
267            self.Set_JVBEZ(0)
268    
269            try:
270              self.SetGeb(int(self.geb.get()))              self.SetGeb(int(self.geb.get()))
271          except:          except:
272              self.ResetInputGeb()              self.ResetInputGeb()
# Line 246  class Lohnrechner(LST2007.LStRechner2007 Line 289  class Lohnrechner(LST2007.LStRechner2007
289          self.InitCalc()          self.InitCalc()
290          self.Calc()          self.Calc()
291          self.lst.delete(0, END)          self.lst.delete(0, END)
292          self.lst.insert(0, "%.2f" % self.GetLohnsteuer())          self.lst.insert(0, "%.2f" % self.GetLohnsteuerGesamt())
293          self.soli.delete(0, END)          self.soli.delete(0, END)
294          self.soli.insert(0, "%.2f" % self.GetSoli())          self.soli.insert(0, "%.2f" % self.GetSoliGesamt())
295          self.kist.delete(0, END)          self.kist.delete(0, END)
296          self.kist.insert(0, "%.2f" % self.GetKirchensteuer())          self.kist.insert(0, "%.2f" % self.GetKirchensteuerGesamt())
297          netto1 = self.GetLohn() - self.GetLohnsteuer() \          netto1 = self.GetLohn() + self.GetSonstigeBezuege() \
298                   - self.GetSoli() - self.GetKirchensteuer()                   - self.GetLohnsteuerGesamt() \
299                     - self.GetSoliGesamt() - self.GetKirchensteuerGesamt()
300          self.netto1.delete(0, END)          self.netto1.delete(0, END)
301          self.netto1.insert(0, "%.2f" % netto1)          self.netto1.insert(0, "%.2f" % netto1)
302          self.rv.delete(0, END)          self.rv.delete(0, END)
# Line 271  class Lohnrechner(LST2007.LStRechner2007 Line 315  class Lohnrechner(LST2007.LStRechner2007
315      def Info(self):      def Info(self):
316          infowin = Toplevel(self.root)          infowin = Toplevel(self.root)
317          infowin.title("Info")          infowin.title("Info")
318          Label(infowin, text="Lohnrechner 2007 v%s" % _release_version,          Label(infowin, text="Lohnrechner 2008 v%s" % _release_version,
319                font=("Times", 14, "bold italic")).grid(row=0, pady=20)                font=("Times", 14, "bold italic")).grid(row=0, pady=20)
320          Label(infowin, text=          Label(infowin, text=
321                "Copyright (C) 2005,2006,2007 Intevation GmbH \n\n\                "Copyright (C) 2005,2006,2007,2008 Intevation GmbH \n\n\
322  Lohnrechner 2007 comes with ABSOLUTELY NO WARRANTY.\n\  Lohnrechner 2008 comes with ABSOLUTELY NO WARRANTY.\n\
323  This is free software, and you are welcome to redistribute it\n\  This is free software, and you are welcome to redistribute it\n\
324  under the terms of the GNU General Public License.\n\  under the terms of the GNU General Public License.\n\
325  For more information about these matters, see the file named COPYING.\n\n\  For more information about these matters, see the file named COPYING.\n\n\
326  Dieses Programm verwendet LST2007 %s" % LST2007._ModulVersion()).grid(row=1, padx=10)  Dieses Programm verwendet LST2008 %s" % LST2008._ModulVersion()).grid(row=1, padx=10)
327          Button(infowin, text="Ok", command=infowin.destroy).grid(row=2, pady=10)          Button(infowin, text="Ok", command=infowin.destroy).grid(row=2, pady=10)
328    
329      #      #
# Line 289  Dieses Programm verwendet LST2007 %s" % Line 333  Dieses Programm verwendet LST2007 %s" %
333      #      #
334    
335      def InitSozv(self):      def InitSozv(self):
336          self.AVsatz = 0.042 / 2          self.AVsatz = 0.033 / 2
337          self.RVsatz = 0.199 / 2          self.RVsatz = 0.199 / 2
338          # PVsatz ist in self.laender definiert!          # PVsatz ist in self.laender definiert!
339          self.PVkinderlose = 0.0025          self.PVkinderlose = 0.0025
340          self.BMG1 = 3562.5          self.BMG1 = 3600
341          self.BMG2 = 5250          # BMG2 f�r RV und ALV ist in self.laender definiert!
342    
343      def SetKV(self, value):      def SetKV(self, value):
344          assert value >= 0.0 and value <= 100.0, \          assert value >= 0.0 and value <= 100.0, \
# Line 302  Dieses Programm verwendet LST2007 %s" % Line 346  Dieses Programm verwendet LST2007 %s" %
346          self.KVsatz = (value / 100.0)          self.KVsatz = (value / 100.0)
347    
348      def GetAV(self):      def GetAV(self):
349          lohn = self.GetLohn()          lohn = self.GetLohnGesamt()
350          if lohn > self.BMG2 : lohn = self.BMG2          BMG2 = self.laender[self.land][3]
351            if lohn > BMG2 : lohn = BMG2
352          return round(self.sozv.get() * self.AVsatz * lohn, 2)          return round(self.sozv.get() * self.AVsatz * lohn, 2)
353    
354      def GetRV(self):      def GetRV(self):
355          lohn = self.GetLohn()          lohn = self.GetLohnGesamt()
356          if lohn > self.BMG2 : lohn = self.BMG2          BMG2 = self.laender[self.land][3]
357            if lohn > BMG2 : lohn = BMG2
358          return round(self.sozv.get() * self.RVsatz * lohn, 2)          return round(self.sozv.get() * self.RVsatz * lohn, 2)
359    
360      def GetPV(self):      def GetPV(self):
361          self.PVsatz = self.laender[self.land][2]          self.PVsatz = self.laender[self.land][2]
362          lohn = self.GetLohn()          lohn = self.GetLohnGesamt()
363          if lohn > self.BMG1 : lohn = self.BMG1          if lohn > self.BMG1 : lohn = self.BMG1
364          PV =  self.PVsatz * lohn          PV =  self.PVsatz * lohn
365          if float(self.kfb.get()) == 0.0 :          if self.kinder.get() == 0 :
366              PV += lohn * self.PVkinderlose              PV += lohn * self.PVkinderlose
367          return round(self.sozv.get() * PV, 2)          return round(self.sozv.get() * PV, 2)
368    
369      def GetKV(self):      def GetKV(self):
370          self.KVsoli = self.kvsoli.get()          self.KVsoli = self.kvsoli.get()
371          lohn = self.GetLohn()          lohn = self.GetLohnGesamt()
372          if lohn > self.BMG1 : lohn = self.BMG1          if lohn > self.BMG1 : lohn = self.BMG1
373          if self.KVsoli :          if self.KVsoli :
374              return round(self.sozv.get() * ((self.KVsatz / 2) + 0.009) * lohn, 2)              return round(self.sozv.get() * ((self.KVsatz / 2) + 0.009) * lohn, 2)

Legend:
Removed from v.71  
changed lines
  Added in v.81

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26