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

Diff of /trunk/lohnrechner2006.py

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

trunk/RCS/lohnrechner.py revision 10 by wilde, Thu Jan 13 10:51:19 2005 UTC lohnrechner.py revision 37 by wilde, Wed Jul 20 14:18:07 2005 UTC
# Line 1  Line 1 
1  #! /usr/bin/python  #! /usr/bin/python
2    # -*- coding: iso-8859-1 -*-
3  # --------------------------------------------------------------------  # --------------------------------------------------------------------
4  # Lohnsteuer und Sozialabgaben Rechner  # Lohnsteuer und Sozialabgaben Rechner
5  # $Id$  # $Id$
# Line 16  Line 17 
17  __version__ = "$Revision$"  __version__ = "$Revision$"
18  # $Source$  # $Source$
19                    
20  _release_version = "0.1alpha"  _release_version = "0.%s beta" % __version__[11:-2]
21    
22  import LST2005  import LST2005
23  from Tkinter import *  from Tkinter import *
# Line 26  class Lohnrechner(LST2005.LStRechner2005 Line 27  class Lohnrechner(LST2005.LStRechner2005
27      def __init__(self, root):      def __init__(self, root):
28          LST2005.LStRechner2005.__init__(self)          LST2005.LStRechner2005.__init__(self)
29    
30          root.title("Lohnrechner 2005 - v%s" % _release_version)          # Land, Kirchensteuersatz, Pflegeversicherung AG-Anteil
31            self.laender = [("Baden-W�rttemberg", 8, 0.0085),
32                            ("Bayern", 8, 0.0085),
33                            ("Berlin", 9, 0.0085),
34                            ("Brandenburg", 9, 0.0085),
35                            ("Bremen", 9, 0.0085),
36                            ("Bremerhaven", 9, 0.0085),
37                            ("Hamburg", 9, 0.0085),
38                            ("Hessen", 9, 0.0085),
39                            ("Mecklenburg-Vorpommern", 9, 0.0085),
40                            ("Niedersachsen" ,9, 0.0085),
41                            ("Nordrhein-Westfalen", 9, 0.0085),
42                            ("Rheinland-Pfalz", 9, 0.0085),
43                            ("Saarland", 9, 0.0085),
44                            ("Sachsen", 9, 0.0135),
45                            ("Sachsen-Anhalt", 9, 0.0085),
46                            ("Schleswig-Holstein", 9, 0.0085),
47                            ("Th�ringen", 9, 0.0085)]
48            
49            self.root = root
50    
51            self.root.title("Lohnrechner 2005 - v%s" % _release_version)
52    
53            self.SetupUI()
54            self.UpdateLand()
55            self.InitSozv()
56            self.ResetInput()
57    
58        def SetupUI(self):
59            self.root.resizable(NO, NO)
60    
61          Label(root, text="Lohn:").grid(row=0, sticky=E)          frame = Frame(self.root)
62          self.lohn = Entry(root)          frame.grid(padx=10, pady=10)
63    
64            # Steuern Ein/Ausgabe
65            Label(frame, text="Lohn (monatlich):").grid(row=0, sticky=E)
66            self.lohn = Entry(frame)
67          self.lohn.bind("<Return>", self.NewInput)          self.lohn.bind("<Return>", self.NewInput)
68          self.lohn.grid(row=0, column=1, sticky=W)          self.lohn.grid(row=0, column=1, sticky=W)
69    
70          Label(root, text="Steuerklasse:").grid(row=1, sticky=E)          Label(frame, text="Steuerklasse:").grid(row=1, sticky=E)
71          self.stkl = StringVar()          self.stkl = IntVar()
72          stklframe = Frame(root)          stklframe = Frame(frame)
73          stklframe.grid(row=1, column=1, sticky=W)          stklframe.grid(row=1, column=1, sticky=W)
74          for text, val in [("I", "1"),          for text, val in [("I", 1),
75                            ("II", "2"),                            ("II", 2),
76                            ("III", "3"),                            ("III", 3),
77                            ("IV", "4"),                            ("IV", 4),
78                            ("V", "5"),                            ("V", 5),
79                            ("VI", "6")]:                            ("VI", 6)]:
80              stklradio = Radiobutton(stklframe, text=text, value=val,              stklradio = Radiobutton(stklframe, text=text, value=val,
81                                      indicatoron=0, command=self.CalcOutput,                                      indicatoron=0, command=self.NewInput,
82                                      variable=self.stkl)                                      variable=self.stkl)
83              if text == "I":              if text == "I":
84                  stklradio.select()                  stklradio.select()
85              stklradio.pack(side=LEFT)              stklradio.pack(side=LEFT)
86    
87          Label(root, text="Kirchensteuer (%):").grid(row=2, sticky=E)          Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E)
88          self.kirche = Entry(root)          self.kirche = IntVar()
89          self.kirche.bind("<Return>", self.NewInput)          Checkbutton(frame, onvalue=1, offvalue=0, command=self.NewInput,
90          self.kirche.grid(row=2, column=1, sticky=W)                      variable=self.kirche).grid(row=2, column=1,sticky=W)
91    
92          self.ResetInput()          Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E)
93            self.kfb = Entry(frame)
94          Label(root, text="Lohnsteuer:").grid(row=0, column=2, sticky=E)          self.kfb.bind("<Return>", self.NewInput)
95          self.lst = Entry(root)          self.kfb.grid(row=3, column=1, sticky=W)
96    
97            Label(frame, text="Bundesland:").grid(row=4, sticky=NE)
98            landframe = Frame(frame)
99            scrollbar = Scrollbar(landframe, orient=VERTICAL)
100            self.landbox = Listbox(landframe, height=4, selectmode=SINGLE,
101                                   yscrollcommand=scrollbar.set)
102            for land in self.laender:
103                self.landbox.insert(END, land[0])
104            self.landbox.select_set(0)
105            self.landbox.bind("<<ListboxSelect>>", self.NewLandSel)
106            self.landbox.pack(side=RIGHT, fill=Y)
107            scrollbar.config(command=self.landbox.yview)
108            scrollbar.pack(side=LEFT, fill=BOTH, expand=1)
109            landframe.grid(row=4, rowspan=4, column=1, sticky=W)
110            
111            Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E)
112            self.lst = Entry(frame)
113          self.lst.grid(row=0, column=3, sticky=W)          self.lst.grid(row=0, column=3, sticky=W)
114    
115          Label(root, text="Lolidarit�tszuschlag:").grid(row=1, column=2, sticky=E)          Label(frame, text="Solidarit�tszuschlag:").grid(row=1, column=2, sticky=E)
116          self.soli = Entry(root)          self.soli = Entry(frame)
117          self.soli.grid(row=1, column=3, sticky=W)          self.soli.grid(row=1, column=3, sticky=W)
118    
119          Label(root, text="Kirchensteuer:").grid(row=2, column=2, sticky=E)          Label(frame, text="Kirchensteuer:").grid(row=2, column=2, sticky=E)
120          self.kirchest = Entry(root)          self.kist = Entry(frame)
121          self.kirchest.grid(row=2, column=3, sticky=W)          self.kist.grid(row=2, column=3, sticky=W)
122    
123          self.calcbutton = Button(root, text="Berechnen", command=self.CalcOutput)          Label(frame, text="Lohn nach Steuern:").grid(row=3, column=2, sticky=E)
124          self.calcbutton.grid(row=3, columnspan=4)          self.netto1 = Entry(frame)
125                    self.netto1.grid(row=3, column=3, sticky=W)
126    
127            # Sozialversicherung Ein/Ausgabe
128            Label(frame, text="Sozialversicherung:").grid(row=8, sticky=E)
129            self.sozv = IntVar()
130            sozvradio = Checkbutton(frame, onvalue=1, offvalue=0,
131                                    command=self.NewInput, variable=self.sozv)
132            sozvradio.select()
133            sozvradio.grid(row=8, column=1, sticky=W)
134    
135            Label(frame, text="Krankenkassenbeitrag:").grid(row=9, sticky=E)
136            self.kvsatz = Entry(frame)
137            self.kvsatz.bind("<Return>", self.NewInput)
138            self.kvsatz.grid(row=9, column=1, sticky=W)
139    
140            Label(frame, text="Rentenversicherung:").grid(row=4, column=2, sticky=E)
141            self.rv = Entry(frame)
142            self.rv.grid(row=4, column=3, sticky=W)
143    
144            Label(frame, text="Krankenversicherung:").grid(row=5, column=2, sticky=E)
145            self.kv = Entry(frame)
146            self.kv.grid(row=5, column=3, sticky=W)
147    
148            Label(frame, text="Arbeitslosenversicherung:").grid(row=6, column=2,
149                                                                sticky=E)
150            self.av = Entry(frame)
151            self.av.grid(row=6, column=3, sticky=W)
152    
153            Label(frame, text="Pflegeversicherung:").grid(row=7, column=2, sticky=E)
154            self.pv = Entry(frame)
155            self.pv.grid(row=7, column=3, sticky=W)
156    
157            Label(frame, text="Netto Lohn:").grid(row=8, column=2, sticky=E)
158            self.netto2 = Entry(frame)
159            self.netto2.grid(row=8, column=3, sticky=W)
160    
161            # Allgemeine UI Elemente
162            buttons = Frame(frame)
163            buttons.grid(row=9, column=2, columnspan=2)
164            Button(buttons, text="Quit", command=self.root.quit).pack(side=LEFT)
165            Button(buttons, text="Info", command=self.Info).pack(side=LEFT)
166            Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT)
167    
168        def NewInput(self, event=0):
169            # Es ist m�glich alle Eintr�ge in der Listbox zu deselektieren,
170            # es ist aber immer genau ein Eintrag aktuell, darum wird er ggf.
171            # zwangsselektiert:
172            # FIX ME: eigendlich w�re das ein Fall f�r ein custom widget!
173            if len(self.landbox.curselection()) == 0:
174                self.landbox.select_set(self.land)            
175          self.CalcOutput()          self.CalcOutput()
176    
177      def NewInput(self, event):      def UpdateLand(self):
178            self.land = int(self.landbox.curselection()[0])
179    
180        def NewLandSel(self, event=0):
181            self.UpdateLand()
182          self.CalcOutput()          self.CalcOutput()
183    
184      def ResetInput(self):      def ResetInput(self):
185          self.ResetInputLohn()          self.ResetInputLohn()
186          self.ResetInputKirche()          self.ResetInputKfb()
187            self.ResetInputKVsatz()
188            self.NewLandSel()
189    
190      def ResetInputLohn(self):      def ResetInputLohn(self):
191          self.lohn.delete(0, END)          self.lohn.delete(0, END)
192          self.lohn.insert(0, "0")          self.lohn.insert(0, "0")
193    
194      def ResetInputKirche(self):      def ResetInputKfb(self):
195          self.kirche.delete(0, END)          self.kfb.delete(0, END)
196          self.kirche.insert(0, "0")          self.kfb.insert(0, "0")
197    
198        def ResetInputKVsatz(self):
199            self.kvsatz.delete(0, END)
200            self.kvsatz.insert(0, "14.7")
201    
202      def InitCalc(self):      def InitCalc(self):
203          try:          try:
# Line 96  class Lohnrechner(LST2005.LStRechner2005 Line 206  class Lohnrechner(LST2005.LStRechner2005
206              self.ResetInputLohn()              self.ResetInputLohn()
207    
208          try:          try:
209              self.SetKirchensteuer(float(self.kirche.get()))              self.SetKinderfreibetrag(float(self.kfb.get()))
210          except:          except:
211              self.ResetInputKirche()              self.ResetInputKfb()
212                
213          self.SetSteuerklasse(int(self.stkl.get()))          try:
214                self.SetKV(float(self.kvsatz.get()))
215            except:
216                self.ResetInputKVsatz()
217    
218            self.SetSteuerklasse(self.stkl.get())
219            self.SetKirchensteuerProzent(self.kirche.get() *
220                                         self.laender[self.land][1])
221    
222      def CalcOutput(self):      def CalcOutput(self):
223          self.InitCalc()          self.InitCalc()
224          self.Calc()          self.Calc()
225          self.lst.delete(0, END)          self.lst.delete(0, END)
226          self.lst.insert(0, "%.2f" % self.GetLohnsteuer())                  self.lst.insert(0, "%.2f" % self.GetLohnsteuer())
227          self.soli.delete(0, END)          self.soli.delete(0, END)
228          self.soli.insert(0, "%.2f" % self.GetSoli())                  self.soli.insert(0, "%.2f" % self.GetSoli())
229          self.kirchest.delete(0, END)          self.kist.delete(0, END)
230          self.kirchest.insert(0, "%.2f" % self.GetKirchensteuer())                  self.kist.insert(0, "%.2f" % self.GetKirchensteuer())
231            netto1 = self.GetLohn() - self.GetLohnsteuer() \
232                     - self.GetSoli() - self.GetKirchensteuer()
233            self.netto1.delete(0, END)
234            self.netto1.insert(0, "%.2f" % netto1)
235            self.rv.delete(0, END)
236            self.rv.insert(0, "%.2f" % self.GetRV())
237            self.pv.delete(0, END)
238            self.pv.insert(0, "%.2f" % self.GetPV())
239            self.av.delete(0, END)
240            self.av.insert(0, "%.2f" % self.GetAV())
241            self.kv.delete(0, END)
242            self.kv.insert(0, "%.2f" % self.GetKV())
243            netto2 = netto1 - self.GetRV() - self.GetAV() \
244                     - self.GetPV() - self.GetKV()
245            self.netto2.delete(0, END)
246            self.netto2.insert(0, "%.2f" % netto2)        
247    
248        def Info(self):
249            infowin = Toplevel(self.root)
250            infowin.title("Info")
251            Label(infowin, text="Lohnrechner 2005 v%s" % _release_version,
252                  font=("Times", 14, "bold italic")).grid(row=0, pady=20)
253            Label(infowin, text=
254                  "Copyright (C) 2005 Intevation GmbH \n\n\
255    Lohnrechner 2005 comes with ABSOLUTELY NO WARRANTY.\n\
256    This is free software, and you are welcome to redistribute it\n\
257    under the terms of the GNU General Public License.\n\
258    For more information about these matters, see the file named COPYING.\n\n\
259    Dieses Programm verwendet LST2005 %s" % LST2005._ModulVersion()).grid(row=1, padx=10)
260            Button(infowin, text="Ok", command=infowin.destroy).grid(row=2, pady=10)
261    
262        #
263        # Funktionen zur Berechnung der Sozialversicherungsbeitr�ge.
264        #
265        # FIX ME: Dieser Teil k�nnte evl. in ein eigenes Modul ausgelagert werden.
266        #
267    
268        def InitSozv(self):
269            self.AVsatz = 0.065 / 2
270            self.RVsatz = 0.195 / 2
271            # PVsatz ist in self.laender definiert!
272            self.PVkinderlose = 0.0025
273            self.BMG1 = 3525
274            self.BMG2 = 5200
275    
276        def SetKV(self, value):
277            assert value >= 0.0 and value <= 100.0, \
278                   "must be in range 0.0-100.0 (Percent)"
279            self.KVsatz = (value / 100.0)
280    
281        def GetAV(self):
282            lohn = self.GetLohn()
283            if lohn > self.BMG2 : lohn = self.BMG2
284            return round(self.sozv.get() * self.AVsatz * lohn, 2)
285    
286        def GetRV(self):
287            lohn = self.GetLohn()
288            if lohn > self.BMG2 : lohn = self.BMG2
289            return round(self.sozv.get() * self.RVsatz * lohn, 2)
290    
291        def GetPV(self):
292            self.PVsatz = self.laender[self.land][2]
293            lohn = self.GetLohn()
294            if lohn > self.BMG1 : lohn = self.BMG1
295            PV =  self.PVsatz * lohn
296            if float(self.kfb.get()) == 0.0 :
297                PV += lohn * self.PVkinderlose
298            return round(self.sozv.get() * PV, 2)
299    
300        def GetKV(self):
301            lohn = self.GetLohn()
302            if lohn > self.BMG1 : lohn = self.BMG1
303            return round(self.sozv.get() * self.KVsatz * lohn / 2, 2)
304        
305    
306  if __name__ == "__main__":  if __name__ == "__main__":
307      root = Tk()      root = Tk()
308      lr = Lohnrechner(root)      lr = Lohnrechner(root)
309      root.mainloop()      root.mainloop()
   

Legend:
Removed from v.10  
changed lines
  Added in v.37

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26