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

Diff of /trunk/lohnrechner2007.py

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

trunk/RCS/lohnrechner.py revision 23 by wilde, Fri Jan 14 13:46:49 2005 UTC lohnrechner.py revision 41 by wilde, Wed Nov 2 08:56:13 2005 UTC
# Line 27  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          # Land, Kirchensteuersatz          # Land, Kirchensteuersatz, Pflegeversicherung AG-Anteil
31          self.laender = [("Baden-W�rttemberg", 8),          self.laender = [("Baden-W�rttemberg", 8, 0.0085),
32                          ("Bayern", 8),                          ("Bayern", 8, 0.0085),
33                          ("Berlin", 9),                          ("Berlin", 9, 0.0085),
34                          ("Brandenburg", 9),                          ("Brandenburg", 9, 0.0085),
35                          ("Bremen", 9),                          ("Bremen", 9, 0.0085),
36                          ("Bremerhaven", 9),                          ("Bremerhaven", 9, 0.0085),
37                          ("Hamburg", 9),                          ("Hamburg", 9, 0.0085),
38                          ("Hessen", 9),                          ("Hessen", 9, 0.0085),
39                          ("Mecklenburg-Vorpommern", 9),                          ("Mecklenburg-Vorpommern", 9, 0.0085),
40                          ("Niedersachsen" ,9),                          ("Niedersachsen" ,9, 0.0085),
41                          ("Nordrhein-Westfalen", 9),                          ("Nordrhein-Westfalen", 9, 0.0085),
42                          ("Rheinland-Pfalz", 9),                          ("Rheinland-Pfalz", 9, 0.0085),
43                          ("Saarland", 9),                          ("Saarland", 9, 0.0085),
44                          ("Sachsen", 9),                          ("Sachsen", 9, 0.0135),
45                          ("Sachsen-Anhalt", 9),                          ("Sachsen-Anhalt", 9, 0.0085),
46                          ("Schleswig-Holstein", 9),                          ("Schleswig-Holstein", 9, 0.0085),
47                          ("Th�ringen", 9)]                          ("Th�ringen", 9, 0.0085)]
48            
         root.title("Lohnrechner 2005 - v%s" % _release_version)  
         root.resizable(NO, NO)  
49          self.root = root          self.root = root
50    
51          frame = Frame(root)          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            frame = Frame(self.root)
62          frame.grid(padx=10, pady=10)          frame.grid(padx=10, pady=10)
63    
64          Label(frame, text="Lohn:").grid(row=0, sticky=E)          # Steuern Ein/Ausgabe
65            Label(frame, text="Lohn (monatlich):").grid(row=0, sticky=E)
66          self.lohn = Entry(frame)          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)
# Line 69  class Lohnrechner(LST2005.LStRechner2005 Line 78  class Lohnrechner(LST2005.LStRechner2005
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()
# Line 77  class Lohnrechner(LST2005.LStRechner2005 Line 86  class Lohnrechner(LST2005.LStRechner2005
86    
87          Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E)          Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E)
88          self.kirche = IntVar()          self.kirche = IntVar()
89          kircheradio = Checkbutton(frame, onvalue=1, offvalue=0,          Checkbutton(frame, onvalue=1, offvalue=0, command=self.NewInput,
90                                    command=self.CalcOutput,                      variable=self.kirche).grid(row=2, column=1,sticky=W)
                                   variable=self.kirche).grid(row=2, column=1, sticky=W)  
91    
92          Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E)          Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E)
93          self.kfb = Entry(frame)          self.kfb = Entry(frame)
94          self.kfb.bind("<Return>", self.NewInput)          self.kfb.bind("<Return>", self.NewInput)
95          self.kfb.grid(row=3, column=1, sticky=W)          self.kfb.grid(row=3, column=1, sticky=W)
96    
97          Label(frame, text="Bundesland:").grid(row=4, sticky=E)          Label(frame, text="Bundesland:").grid(row=4, sticky=NE)
98          landframe = Frame(frame)          landframe = Frame(frame)
99          scrollbar = Scrollbar(landframe, orient=VERTICAL)          scrollbar = Scrollbar(landframe, orient=VERTICAL)
100          self.land = Listbox(landframe, height=4, selectmode=SINGLE,          self.landbox = Listbox(landframe, height=4, selectmode=SINGLE,
101                              yscrollcommand=scrollbar.set)                                 yscrollcommand=scrollbar.set)
102          for land in self.laender:          for land in self.laender:
103              self.land.insert(END, land[0])              self.landbox.insert(END, land[0])
104          self.land.select_set(0)          self.landbox.select_set(0)
105          self.land.bind("<<ListboxSelect>>", self.NewInput)          self.landbox.bind("<<ListboxSelect>>", self.NewLandSel)
106          self.land.pack(side=RIGHT, fill=Y)          self.landbox.pack(side=RIGHT, fill=Y)
107          scrollbar.config(command=self.land.yview)          scrollbar.config(command=self.landbox.yview)
108          scrollbar.pack(side=LEFT, fill=BOTH, expand=1)          scrollbar.pack(side=LEFT, fill=BOTH, expand=1)
109          landframe.grid(row=4, column=1, sticky=W)          landframe.grid(row=4, rowspan=4, column=1, sticky=W)
110                    
         self.ResetInput()  
   
111          Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E)          Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E)
112          self.lst = Entry(frame)          self.lst = Entry(frame)
113          self.lst.grid(row=0, column=3, sticky=W)          self.lst.grid(row=0, column=3, sticky=W)
# Line 114  class Lohnrechner(LST2005.LStRechner2005 Line 120  class Lohnrechner(LST2005.LStRechner2005
120          self.kist = Entry(frame)          self.kist = Entry(frame)
121          self.kist.grid(row=2, column=3, sticky=W)          self.kist.grid(row=2, column=3, sticky=W)
122    
123            Label(frame, text="Lohn nach Steuern:").grid(row=3, column=2, sticky=E)
124            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)          buttons = Frame(frame)
163          buttons.grid(row=4, column=2, columnspan=2)          buttons.grid(row=9, column=2, columnspan=2)
164          Button(buttons, text="Quit", command=root.quit).pack(side=LEFT)          Button(buttons, text="Quit", command=self.root.quit).pack(side=LEFT)
165          Button(buttons, text="Info", command=self.Info).pack(side=LEFT)          Button(buttons, text="Info", command=self.Info).pack(side=LEFT)
166          Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT)          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.ResetInputKfb()          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)
# Line 137  class Lohnrechner(LST2005.LStRechner2005 Line 195  class Lohnrechner(LST2005.LStRechner2005
195          self.kfb.delete(0, END)          self.kfb.delete(0, END)
196          self.kfb.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:
204              self.SetLohn(float(self.lohn.get()))              self.SetLohn(float(self.lohn.get()))
# Line 148  class Lohnrechner(LST2005.LStRechner2005 Line 210  class Lohnrechner(LST2005.LStRechner2005
210          except:          except:
211              self.ResetInputKfb()              self.ResetInputKfb()
212    
213            try:
214                self.SetKV(float(self.kvsatz.get()))
215            except:
216                self.ResetInputKVsatz()
217    
218          self.SetSteuerklasse(self.stkl.get())          self.SetSteuerklasse(self.stkl.get())
219          self.SetKirchensteuer(self.kirche.get() *          self.SetKirchensteuerProzent(self.kirche.get() *
220                                self.laender[int(self.land.curselection()[0])][1])                                       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.kist.delete(0, END)          self.kist.delete(0, END)
230          self.kist.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):      def Info(self):
249          infowin = Toplevel(self.root)          infowin = Toplevel(self.root)
# Line 176  For more information about these matters Line 259  For more information about these matters
259  Dieses Programm verwendet LST2005 %s" % LST2005._ModulVersion()).grid(row=1, padx=10)  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)          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            # KVsoli should be setable by the UI
302            self.KVsoli = 1
303            lohn = self.GetLohn()
304            if lohn > self.BMG1 : lohn = self.BMG1
305            if self.KVsoli :
306                return round(self.sozv.get() * ((self.KVsatz / 2) + 0.009) * lohn, 2)
307            else :
308                return round(self.sozv.get() * self.KVsatz * lohn / 2, 2)
309        
310    
311  if __name__ == "__main__":  if __name__ == "__main__":
312      root = Tk()      root = Tk()
313      lr = Lohnrechner(root)      lr = Lohnrechner(root)
314      root.mainloop()      root.mainloop()
   

Legend:
Removed from v.23  
changed lines
  Added in v.41

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26