/[lohnrechner]/lohnrechner.py
ViewVC logotype

Annotation of /lohnrechner.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25 - (hide annotations)
Thu Jan 27 10:08:27 2005 UTC (20 years, 3 months ago) by wilde
Original Path: trunk/RCS/lohnrechner.py
File MIME type: text/x-python
File size: 7512 byte(s)
Bugfix: Der in der letzten Version hinzugekommene Select-Workaround
f�r die L�nder wurde nicht immer benutzt.

Bugfix: Bei neuer L�nderauswahl wurde keine neu Berechnung durchgef�hrt.

Hinzugef�gt: "Lohn nach Steuern" Feld.

SetKirchensteuer durch SetKirchensteuerProzent ersetzt
(API �nderung in LST2005)

1 wilde 6 #! /usr/bin/python
2 wilde 19 # -*- coding: iso-8859-1 -*-
3 wilde 6 # --------------------------------------------------------------------
4     # Lohnsteuer und Sozialabgaben Rechner
5     # $Id$
6     # --------------------------------------------------------------------
7     #
8     # Copyright (c) 2005 by Intevation GmbH
9     # Authors:
10     # Sascha Wilde <[email protected]>
11     #
12     # This program is free software under the GPL (>=v2)
13     # Read the file COPYING coming with this package for details.
14    
15     """Lohn/Gehaltsrechner für das Jahr 2005"""
16    
17 wilde 7 __version__ = "$Revision$"
18     # $Source$
19    
20 wilde 21 _release_version = "0.%s beta" % __version__[11:-2]
21 wilde 7
22 wilde 6 import LST2005
23     from Tkinter import *
24    
25     class Lohnrechner(LST2005.LStRechner2005):
26    
27     def __init__(self, root):
28     LST2005.LStRechner2005.__init__(self)
29    
30 wilde 22 # Land, Kirchensteuersatz
31     self.laender = [("Baden-Württemberg", 8),
32     ("Bayern", 8),
33     ("Berlin", 9),
34     ("Brandenburg", 9),
35     ("Bremen", 9),
36     ("Bremerhaven", 9),
37     ("Hamburg", 9),
38     ("Hessen", 9),
39     ("Mecklenburg-Vorpommern", 9),
40     ("Niedersachsen" ,9),
41     ("Nordrhein-Westfalen", 9),
42     ("Rheinland-Pfalz", 9),
43     ("Saarland", 9),
44     ("Sachsen", 9),
45     ("Sachsen-Anhalt", 9),
46     ("Schleswig-Holstein", 9),
47     ("Thüringen", 9)]
48    
49 wilde 7 root.title("Lohnrechner 2005 - v%s" % _release_version)
50 wilde 17 root.resizable(NO, NO)
51     self.root = root
52 wilde 7
53 wilde 22 frame = Frame(root)
54     frame.grid(padx=10, pady=10)
55    
56     Label(frame, text="Lohn:").grid(row=0, sticky=E)
57     self.lohn = Entry(frame)
58 wilde 9 self.lohn.bind("<Return>", self.NewInput)
59 wilde 6 self.lohn.grid(row=0, column=1, sticky=W)
60    
61 wilde 22 Label(frame, text="Steuerklasse:").grid(row=1, sticky=E)
62 wilde 21 self.stkl = IntVar()
63 wilde 22 stklframe = Frame(frame)
64 wilde 6 stklframe.grid(row=1, column=1, sticky=W)
65 wilde 21 for text, val in [("I", 1),
66     ("II", 2),
67     ("III", 3),
68     ("IV", 4),
69     ("V", 5),
70     ("VI", 6)]:
71 wilde 6 stklradio = Radiobutton(stklframe, text=text, value=val,
72 wilde 25 indicatoron=0, command=self.NewInput,
73 wilde 6 variable=self.stkl)
74     if text == "I":
75     stklradio.select()
76     stklradio.pack(side=LEFT)
77    
78 wilde 22 Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E)
79     self.kirche = IntVar()
80     kircheradio = Checkbutton(frame, onvalue=1, offvalue=0,
81 wilde 25 command=self.NewInput,
82 wilde 22 variable=self.kirche).grid(row=2, column=1, sticky=W)
83 wilde 10
84 wilde 22 Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E)
85     self.kfb = Entry(frame)
86 wilde 19 self.kfb.bind("<Return>", self.NewInput)
87     self.kfb.grid(row=3, column=1, sticky=W)
88    
89 wilde 22 Label(frame, text="Bundesland:").grid(row=4, sticky=E)
90     landframe = Frame(frame)
91     scrollbar = Scrollbar(landframe, orient=VERTICAL)
92 wilde 24 self.landbox = Listbox(landframe, height=4, selectmode=SINGLE,
93     yscrollcommand=scrollbar.set)
94 wilde 22 for land in self.laender:
95 wilde 24 self.landbox.insert(END, land[0])
96 wilde 25 self.landbox.select_set(0)
97 wilde 24 self.landbox.bind("<<ListboxSelect>>", self.NewLandSel)
98     self.landbox.pack(side=RIGHT, fill=Y)
99     scrollbar.config(command=self.landbox.yview)
100 wilde 22 scrollbar.pack(side=LEFT, fill=BOTH, expand=1)
101     landframe.grid(row=4, column=1, sticky=W)
102 wilde 25 self.UpdateLand()
103 wilde 22
104 wilde 6 self.ResetInput()
105    
106 wilde 22 Label(frame, text="Lohnsteuer:").grid(row=0, column=2, sticky=E)
107     self.lst = Entry(frame)
108 wilde 6 self.lst.grid(row=0, column=3, sticky=W)
109    
110 wilde 22 Label(frame, text="Solidaritätszuschlag:").grid(row=1, column=2, sticky=E)
111     self.soli = Entry(frame)
112 wilde 6 self.soli.grid(row=1, column=3, sticky=W)
113    
114 wilde 22 Label(frame, text="Kirchensteuer:").grid(row=2, column=2, sticky=E)
115     self.kist = Entry(frame)
116 wilde 16 self.kist.grid(row=2, column=3, sticky=W)
117 wilde 10
118 wilde 25 Label(frame, text="Lohn nach Steuern:").grid(row=3, column=2, sticky=E)
119     self.netto = Entry(frame)
120     self.netto.grid(row=3, column=3, sticky=W)
121    
122 wilde 22 buttons = Frame(frame)
123     buttons.grid(row=4, column=2, columnspan=2)
124 wilde 17 Button(buttons, text="Quit", command=root.quit).pack(side=LEFT)
125     Button(buttons, text="Info", command=self.Info).pack(side=LEFT)
126     Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT)
127 wilde 6
128 wilde 25 self.NewInput()
129 wilde 9
130 wilde 25 def NewInput(self, event=0):
131 wilde 24 # Es ist möglich alle Einträge in der Listbox zu deselektieren,
132     # es ist aber immer genau ein Eintrag aktuell, darum wird er ggf.
133     # zwangsselektiert:
134     # FIX ME: eigendlich wäre das ein Fall für ein custom widget!
135     if len(self.landbox.curselection()) == 0:
136     self.landbox.select_set(self.land)
137 wilde 9 self.CalcOutput()
138    
139 wilde 25 def UpdateLand(self):
140 wilde 24 self.land = int(self.landbox.curselection()[0])
141    
142 wilde 25 def NewLandSel(self, event=0):
143     self.UpdateLand()
144     self.CalcOutput()
145    
146 wilde 6 def ResetInput(self):
147 wilde 9 self.ResetInputLohn()
148 wilde 23 self.ResetInputKfb()
149 wilde 9
150     def ResetInputLohn(self):
151     self.lohn.delete(0, END)
152 wilde 6 self.lohn.insert(0, "0")
153 wilde 10
154 wilde 19 def ResetInputKfb(self):
155     self.kfb.delete(0, END)
156     self.kfb.insert(0, "0")
157    
158 wilde 6 def InitCalc(self):
159 wilde 9 try:
160     self.SetLohn(float(self.lohn.get()))
161     except:
162     self.ResetInputLohn()
163 wilde 10
164 wilde 19 try:
165     self.SetKinderfreibetrag(float(self.kfb.get()))
166     except:
167     self.ResetInputKfb()
168    
169 wilde 21 self.SetSteuerklasse(self.stkl.get())
170 wilde 25 self.SetKirchensteuerProzent(self.kirche.get() *
171     self.laender[self.land][1])
172 wilde 6
173     def CalcOutput(self):
174     self.InitCalc()
175     self.Calc()
176     self.lst.delete(0, END)
177 wilde 25 self.lst.insert(0, "%.2f" % self.GetLohnsteuer())
178 wilde 6 self.soli.delete(0, END)
179 wilde 25 self.soli.insert(0, "%.2f" % self.GetSoli())
180 wilde 16 self.kist.delete(0, END)
181 wilde 25 self.kist.insert(0, "%.2f" % self.GetKirchensteuer())
182     self.netto.delete(0, END)
183     self.netto.insert(0, "%.2f" %
184     (self.GetLohn() - self.GetLohnsteuer()
185     - self.GetSoli() - self.GetKirchensteuer()))
186 wilde 6
187 wilde 17 def Info(self):
188     infowin = Toplevel(self.root)
189     infowin.title("Info")
190 wilde 18 Label(infowin, text="Lohnrechner 2005 v%s" % _release_version,
191 wilde 17 font=("Times", 14, "bold italic")).grid(row=0, pady=20)
192     Label(infowin, text=
193     "Copyright (C) 2005 Intevation GmbH \n\n\
194     Lohnrechner 2005 comes with ABSOLUTELY NO WARRANTY.\n\
195     This is free software, and you are welcome to redistribute it\n\
196     under the terms of the GNU General Public License.\n\
197     For more information about these matters, see the file named COPYING.\n\n\
198     Dieses Programm verwendet LST2005 %s" % LST2005._ModulVersion()).grid(row=1, padx=10)
199     Button(infowin, text="Ok", command=infowin.destroy).grid(row=2, pady=10)
200 wilde 6
201 wilde 17
202 wilde 6 if __name__ == "__main__":
203     root = Tk()
204     lr = Lohnrechner(root)
205     root.mainloop()
206    

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26