jenner/LstGen

Validation of reference data

Closed this issue · 2 comments

Hi, first of all thank you for a quick update!

My next steps are now to check the codes against other sources to get an idea whether there could be a match. So, my assumption is that if I take an example from my own loan sheet or a reference loan sheet, it should have "more or less" same numbers like LstGen, or?

So my first example is here: https://www.lohnexperte.de/files/root-pdfs/pdf/Muster.pdf

There is a Steuer-Brutto 4926.59, resulting in LSt 1000.75 and SoliZ 42.20 as test data.


Python code ( a unit test method):

def test_lohnexample1(self):

        # source: https://www.lohnexperte.de/files/root-pdfs/pdf/Muster.pdf

        brutto = 4926.59 * 100 # Brutto in ¢ent

        l = Lohnsteuer2018()
        l.setRe4(brutto) # cent
        l.setPkv(1)
        l.setAlter1(0)
        l.setAf(0)
        l.setF(1)
        l.setPvs(0)
        l.setR(0)
        l.setLzzhinzu(0)
        l.setPvz(0)
        l.setStkl(1)
        l.setLzz(2)
        l.setKrv(2)
        l.MAIN()
        print("results lohnexample1:")
        print_lst(l)

        steuer = math.floor(float(l.getLstlzz()) + float(l.getStv()) + float(l.getSts())) / 100.0
        soli = math.floor(float(l.getSolzlzz()) + float(l.getSolzs()) + float(l.getSolzv())) / 100
        stges = steuer + soli

        assert steuer == 1000.75
        assert soli == 42.20


Asserts fail, as the output of LstGen class is:

results lohnexample1:

steuer: 1247.91
soli: 68.63
stges: 1316.54

Do you have an idea why is so?

Same Steuer-Brutto put into , here I get:

Solidaritätszuschlag: 55,18 € 
Lohnsteuer: 1.003,41 €

Actually LstGen seems to be best source of truth as we have evidence that it uses algorithms our government provides us with. :-)

Finally, the formula given in wikipedia provides the following values:

soli   51.53 
lohnsteuer   936.91

See also:
https://money.stackexchange.com/questions/102867/which-is-the-correct-source-is-the-correct-german-lohnsteuer-deduction

With the proper inputs, the example works now exactly as desired! :-)

def test_lohnexample1(self):

        # source: https://www.lohnexperte.de/files/root-pdfs/pdf/Muster.pdf

        brutto = 4926.59 * 100 # Brutto in ¢ent

        l = Lohnsteuer2018()
        l.setRe4(brutto) # cent

        l.setStkl(1) # Steuerklasse
        l.setLzz(2) # Lohnzahlungszeitraum, 2 = Monat

        l.setZkf(1) # Kinder

        l.setPkv(0) # GKV (default)
        l.setKvz(1.5) # Krankenkassenzusatzbeitrag (1.50%)
        l.setKrv(0) # RV-WEST (default)

        l.setAlter1(0) # setze 1, wenn das 64. Lebensjahr zu Beginn des Kalenderjahres vollendet wurde
        l.setAf(0) # # 1, wenn die Anwendung des Faktorverfahrens gewählt wurden (nur in Steuerklasse IV)
        l.setF(1) # Faktor
        l.setPvs(0) # Nur wenn in Sachsen
        l.setR(0) # Religion ja/nein
        l.setLzzhinzu(0) # Hinzurechnungsbetrag auf der Lohnsteuerkarte
        l.setPvz(0) # 1, wenn Zuschlag zur sozialen Pflegeversicherung

        l.MAIN()
        print("results lohnexample1:")
        print_lst(l)

        steuer = math.floor(float(l.getLstlzz()) + float(l.getStv()) + float(l.getSts())) / 100.0
        soli = math.floor(float(l.getSolzlzz()) + float(l.getSolzs()) + float(l.getSolzv())) / 100
        stges = steuer + soli

        assert steuer == 1000.75
        assert soli == 42.20

You should consider validating the results using the official BMF service: https://www.bmf-steuerrechner.de/interface/einganginterface.xhtml