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