1 |
wilde |
61 |
#! /usr/bin/python |
2 |
|
|
# -*- coding: iso-8859-1 -*- |
3 |
|
|
# -------------------------------------------------------------------- |
4 |
|
|
# Lohnsteuer und Sozialabgaben Rechner |
5 |
|
|
# $Id: lohnrechner.py 42 2005-11-02 10:11:50Z wilde $ |
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 |
|
|
__version__ = "$Revision: 42 $" |
18 |
|
|
# $Source$ |
19 |
|
|
|
20 |
|
|
_release_version = "0.%s beta" % __version__[11:-2] |
21 |
|
|
|
22 |
|
|
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 |
|
|
# 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 |
|
|
frame = Frame(self.root) |
62 |
|
|
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) |
68 |
|
|
self.lohn.grid(row=0, column=1, sticky=W) |
69 |
|
|
|
70 |
|
|
Label(frame, text="Steuerklasse:").grid(row=1, sticky=E) |
71 |
|
|
self.stkl = IntVar() |
72 |
|
|
stklframe = Frame(frame) |
73 |
|
|
stklframe.grid(row=1, column=1, sticky=W) |
74 |
|
|
for text, val in [("I", 1), |
75 |
|
|
("II", 2), |
76 |
|
|
("III", 3), |
77 |
|
|
("IV", 4), |
78 |
|
|
("V", 5), |
79 |
|
|
("VI", 6)]: |
80 |
|
|
stklradio = Radiobutton(stklframe, text=text, value=val, |
81 |
|
|
indicatoron=0, command=self.NewInput, |
82 |
|
|
variable=self.stkl) |
83 |
|
|
if text == "I": |
84 |
|
|
stklradio.select() |
85 |
|
|
stklradio.pack(side=LEFT) |
86 |
|
|
|
87 |
|
|
Label(frame, text="Kirchensteuer:").grid(row=2, sticky=E) |
88 |
|
|
self.kirche = IntVar() |
89 |
|
|
Checkbutton(frame, onvalue=1, offvalue=0, command=self.NewInput, |
90 |
|
|
variable=self.kirche).grid(row=2, column=1,sticky=W) |
91 |
|
|
|
92 |
|
|
Label(frame, text="Kinderfreibetrag:").grid(row=3, sticky=E) |
93 |
|
|
self.kfb = Entry(frame) |
94 |
|
|
self.kfb.bind("<Return>", self.NewInput) |
95 |
|
|
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) |
114 |
|
|
|
115 |
|
|
Label(frame, text="Solidaritätszuschlag:").grid(row=1, column=2, sticky=E) |
116 |
|
|
self.soli = Entry(frame) |
117 |
|
|
self.soli.grid(row=1, column=3, sticky=W) |
118 |
|
|
|
119 |
|
|
Label(frame, text="Kirchensteuer:").grid(row=2, column=2, sticky=E) |
120 |
|
|
self.kist = Entry(frame) |
121 |
|
|
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="Krankenkassenzuschlag (0.9%):").grid(row=10, sticky=E) |
141 |
|
|
self.kvsoli = IntVar() |
142 |
|
|
kvsoliradio = Checkbutton(frame, onvalue=1, offvalue=0, |
143 |
|
|
command=self.NewInput, variable=self.kvsoli) |
144 |
|
|
kvsoliradio.select() |
145 |
|
|
kvsoliradio.grid(row=10, column=1, sticky=W) |
146 |
|
|
|
147 |
|
|
|
148 |
|
|
Label(frame, text="Rentenversicherung:").grid(row=4, column=2, sticky=E) |
149 |
|
|
self.rv = Entry(frame) |
150 |
|
|
self.rv.grid(row=4, column=3, sticky=W) |
151 |
|
|
|
152 |
|
|
Label(frame, text="Krankenversicherung:").grid(row=5, column=2, sticky=E) |
153 |
|
|
self.kv = Entry(frame) |
154 |
|
|
self.kv.grid(row=5, column=3, sticky=W) |
155 |
|
|
|
156 |
|
|
Label(frame, text="Arbeitslosenversicherung:").grid(row=6, column=2, |
157 |
|
|
sticky=E) |
158 |
|
|
self.av = Entry(frame) |
159 |
|
|
self.av.grid(row=6, column=3, sticky=W) |
160 |
|
|
|
161 |
|
|
Label(frame, text="Pflegeversicherung:").grid(row=7, column=2, sticky=E) |
162 |
|
|
self.pv = Entry(frame) |
163 |
|
|
self.pv.grid(row=7, column=3, sticky=W) |
164 |
|
|
|
165 |
|
|
Label(frame, text="Netto Lohn:").grid(row=8, column=2, sticky=E) |
166 |
|
|
self.netto2 = Entry(frame) |
167 |
|
|
self.netto2.grid(row=8, column=3, sticky=W) |
168 |
|
|
|
169 |
|
|
# Allgemeine UI Elemente |
170 |
|
|
buttons = Frame(frame) |
171 |
|
|
buttons.grid(row=9, column=2, rowspan=2, columnspan=2) |
172 |
|
|
Button(buttons, text="Quit", command=self.root.quit).pack(side=LEFT) |
173 |
|
|
Button(buttons, text="Info", command=self.Info).pack(side=LEFT) |
174 |
|
|
Button(buttons, text="Berechnen", command=self.CalcOutput).pack(side=LEFT) |
175 |
|
|
|
176 |
|
|
def NewInput(self, event=0): |
177 |
|
|
# Es ist möglich alle Einträge in der Listbox zu deselektieren, |
178 |
|
|
# es ist aber immer genau ein Eintrag aktuell, darum wird er ggf. |
179 |
|
|
# zwangsselektiert: |
180 |
|
|
# FIX ME: eigendlich wäre das ein Fall für ein custom widget! |
181 |
|
|
if len(self.landbox.curselection()) == 0: |
182 |
|
|
self.landbox.select_set(self.land) |
183 |
|
|
self.CalcOutput() |
184 |
|
|
|
185 |
|
|
def UpdateLand(self): |
186 |
|
|
self.land = int(self.landbox.curselection()[0]) |
187 |
|
|
|
188 |
|
|
def NewLandSel(self, event=0): |
189 |
|
|
self.UpdateLand() |
190 |
|
|
self.CalcOutput() |
191 |
|
|
|
192 |
|
|
def ResetInput(self): |
193 |
|
|
self.ResetInputLohn() |
194 |
|
|
self.ResetInputKfb() |
195 |
|
|
self.ResetInputKVsatz() |
196 |
|
|
self.NewLandSel() |
197 |
|
|
|
198 |
|
|
def ResetInputLohn(self): |
199 |
|
|
self.lohn.delete(0, END) |
200 |
|
|
self.lohn.insert(0, "0") |
201 |
|
|
|
202 |
|
|
def ResetInputKfb(self): |
203 |
|
|
self.kfb.delete(0, END) |
204 |
|
|
self.kfb.insert(0, "0") |
205 |
|
|
|
206 |
|
|
def ResetInputKVsatz(self): |
207 |
|
|
self.kvsatz.delete(0, END) |
208 |
|
|
self.kvsatz.insert(0, "13.8") |
209 |
|
|
|
210 |
|
|
def InitCalc(self): |
211 |
|
|
try: |
212 |
|
|
self.SetLohn(float(self.lohn.get())) |
213 |
|
|
except: |
214 |
|
|
self.ResetInputLohn() |
215 |
|
|
|
216 |
|
|
try: |
217 |
|
|
self.SetKinderfreibetrag(float(self.kfb.get())) |
218 |
|
|
except: |
219 |
|
|
self.ResetInputKfb() |
220 |
|
|
|
221 |
|
|
try: |
222 |
|
|
self.SetKV(float(self.kvsatz.get())) |
223 |
|
|
except: |
224 |
|
|
self.ResetInputKVsatz() |
225 |
|
|
|
226 |
|
|
self.SetSteuerklasse(self.stkl.get()) |
227 |
|
|
self.SetKirchensteuerProzent(self.kirche.get() * |
228 |
|
|
self.laender[self.land][1]) |
229 |
|
|
|
230 |
|
|
def CalcOutput(self): |
231 |
|
|
self.InitCalc() |
232 |
|
|
self.Calc() |
233 |
|
|
self.lst.delete(0, END) |
234 |
|
|
self.lst.insert(0, "%.2f" % self.GetLohnsteuer()) |
235 |
|
|
self.soli.delete(0, END) |
236 |
|
|
self.soli.insert(0, "%.2f" % self.GetSoli()) |
237 |
|
|
self.kist.delete(0, END) |
238 |
|
|
self.kist.insert(0, "%.2f" % self.GetKirchensteuer()) |
239 |
|
|
netto1 = self.GetLohn() - self.GetLohnsteuer() \ |
240 |
|
|
- self.GetSoli() - self.GetKirchensteuer() |
241 |
|
|
self.netto1.delete(0, END) |
242 |
|
|
self.netto1.insert(0, "%.2f" % netto1) |
243 |
|
|
self.rv.delete(0, END) |
244 |
|
|
self.rv.insert(0, "%.2f" % self.GetRV()) |
245 |
|
|
self.pv.delete(0, END) |
246 |
|
|
self.pv.insert(0, "%.2f" % self.GetPV()) |
247 |
|
|
self.av.delete(0, END) |
248 |
|
|
self.av.insert(0, "%.2f" % self.GetAV()) |
249 |
|
|
self.kv.delete(0, END) |
250 |
|
|
self.kv.insert(0, "%.2f" % self.GetKV()) |
251 |
|
|
netto2 = netto1 - self.GetRV() - self.GetAV() \ |
252 |
|
|
- self.GetPV() - self.GetKV() |
253 |
|
|
self.netto2.delete(0, END) |
254 |
|
|
self.netto2.insert(0, "%.2f" % netto2) |
255 |
|
|
|
256 |
|
|
def Info(self): |
257 |
|
|
infowin = Toplevel(self.root) |
258 |
|
|
infowin.title("Info") |
259 |
|
|
Label(infowin, text="Lohnrechner 2005 v%s" % _release_version, |
260 |
|
|
font=("Times", 14, "bold italic")).grid(row=0, pady=20) |
261 |
|
|
Label(infowin, text= |
262 |
|
|
"Copyright (C) 2005 Intevation GmbH \n\n\ |
263 |
|
|
Lohnrechner 2005 comes with ABSOLUTELY NO WARRANTY.\n\ |
264 |
|
|
This is free software, and you are welcome to redistribute it\n\ |
265 |
|
|
under the terms of the GNU General Public License.\n\ |
266 |
|
|
For more information about these matters, see the file named COPYING.\n\n\ |
267 |
|
|
Dieses Programm verwendet LST2005 %s" % LST2005._ModulVersion()).grid(row=1, padx=10) |
268 |
|
|
Button(infowin, text="Ok", command=infowin.destroy).grid(row=2, pady=10) |
269 |
|
|
|
270 |
|
|
# |
271 |
|
|
# Funktionen zur Berechnung der Sozialversicherungsbeiträge. |
272 |
|
|
# |
273 |
|
|
# FIX ME: Dieser Teil könnte evl. in ein eigenes Modul ausgelagert werden. |
274 |
|
|
# |
275 |
|
|
|
276 |
|
|
def InitSozv(self): |
277 |
|
|
self.AVsatz = 0.065 / 2 |
278 |
|
|
self.RVsatz = 0.195 / 2 |
279 |
|
|
# PVsatz ist in self.laender definiert! |
280 |
|
|
self.PVkinderlose = 0.0025 |
281 |
|
|
self.BMG1 = 3525 |
282 |
|
|
self.BMG2 = 5200 |
283 |
|
|
|
284 |
|
|
def SetKV(self, value): |
285 |
|
|
assert value >= 0.0 and value <= 100.0, \ |
286 |
|
|
"must be in range 0.0-100.0 (Percent)" |
287 |
|
|
self.KVsatz = (value / 100.0) |
288 |
|
|
|
289 |
|
|
def GetAV(self): |
290 |
|
|
lohn = self.GetLohn() |
291 |
|
|
if lohn > self.BMG2 : lohn = self.BMG2 |
292 |
|
|
return round(self.sozv.get() * self.AVsatz * lohn, 2) |
293 |
|
|
|
294 |
|
|
def GetRV(self): |
295 |
|
|
lohn = self.GetLohn() |
296 |
|
|
if lohn > self.BMG2 : lohn = self.BMG2 |
297 |
|
|
return round(self.sozv.get() * self.RVsatz * lohn, 2) |
298 |
|
|
|
299 |
|
|
def GetPV(self): |
300 |
|
|
self.PVsatz = self.laender[self.land][2] |
301 |
|
|
lohn = self.GetLohn() |
302 |
|
|
if lohn > self.BMG1 : lohn = self.BMG1 |
303 |
|
|
PV = self.PVsatz * lohn |
304 |
|
|
if float(self.kfb.get()) == 0.0 : |
305 |
|
|
PV += lohn * self.PVkinderlose |
306 |
|
|
return round(self.sozv.get() * PV, 2) |
307 |
|
|
|
308 |
|
|
def GetKV(self): |
309 |
|
|
self.KVsoli = self.kvsoli.get() |
310 |
|
|
lohn = self.GetLohn() |
311 |
|
|
if lohn > self.BMG1 : lohn = self.BMG1 |
312 |
|
|
if self.KVsoli : |
313 |
|
|
return round(self.sozv.get() * ((self.KVsatz / 2) + 0.009) * lohn, 2) |
314 |
|
|
else : |
315 |
|
|
return round(self.sozv.get() * self.KVsatz * lohn / 2, 2) |
316 |
|
|
|
317 |
|
|
|
318 |
|
|
if __name__ == "__main__": |
319 |
|
|
root = Tk() |
320 |
|
|
lr = Lohnrechner(root) |
321 |
|
|
root.mainloop() |