AW: Lohnsteuerberechnung (UDF, XLM-Datei, Webabfra
21.07.2008 20:17:00
Rolf
Hallo Kurt,
meine erste Version:
Option Explicit
'Eingangsparameter
Dim AJAHR, ALTER1, JFREIB, JHINZU, JRE4, JVBEZ, KRV, LZZ, LZZHINZU, LZZFREIB, _
R, RE4, SONSTB, STERBE, STKL, VBEZ, VBEZM, VBEZS, VBS, VJAHR, VKAPA, VMT, _
ZKF, ZMVB
'Ausgangsparameter
Dim BK, BKS, BKV, LSTLZZ, _
SOLZLZZ, SOLZS, SOLZV, STS, STV
Dim sUrlAlt As String
Public Function xlLSTJAHR_BMF(GiltAb, UE_64, _
E_AJAHR, _
RV_FREI, _
E_STKL, _
E_ZKF, _
E_ZMVB, _
E_VJAHR, _
E_R, _
E_LZZ, _
E_JFREIB, _
E_JHINZU, _
E_LZZFREIB, _
E_LZZHINZU, _
BRUTTO, _
BRUTTO_VB, _
VB_Jan, _
E_VBEZS, _
SB, _
E_STERBE, _
SB_VB, _
E_VMT, _
E_VKAPA, _
VJAL, _
VJAL_VB, _
Auswahl)
If Len(GiltAb) 6 Or _
Year(GiltAb) 2008 Then
Exit Function
End If
Dim sUrl$, sTxt$, vTxt, vRes, i&
Dim oIE As Object
sUrl = "https://www.abgabenrechner.de/interface/" & Year(GiltAb) & ".jsp?"
sUrl = sUrl & "ALTER1=" & UE_64 & "&"
sUrl = sUrl & "AJAHR=" & E_AJAHR & "&"
sUrl = sUrl & "LZZHINZU=" & E_LZZHINZU * 100 & "&"
sUrl = sUrl & "HINZUR=" & E_LZZHINZU * 100 & "&"
sUrl = sUrl & "JFREIB=" & E_JFREIB * 100 & "&"
sUrl = sUrl & "JHINZU=" & E_JHINZU * 100 & "&"
sUrl = sUrl & "JRE4=" & VJAL * 100 & "&"
sUrl = sUrl & "JVBEZ=" & VJAL_VB * 100 & "&"
sUrl = sUrl & "KRV=" & RV_FREI & "&"
sUrl = sUrl & "LZZ=" & E_LZZ & "&"
sUrl = sUrl & "R=" & E_R & "&"
sUrl = sUrl & "RE4=" & BRUTTO * 100 & "&"
sUrl = sUrl & "SONSTB=" & SB * 100 & "&"
sUrl = sUrl & "STERBE=" & E_STERBE * 100 & "&"
sUrl = sUrl & "STKL=" & E_STKL & "&"
sUrl = sUrl & "VBEZ=" & BRUTTO_VB * 100 & "&"
sUrl = sUrl & "VBEZM=" & VB_Jan * 100 & "&"
sUrl = sUrl & "VBEZS=" & E_VBEZS * 100 & "&"
sUrl = sUrl & "VBS=" & SB_VB * 100 & "&"
sUrl = sUrl & "VJAHR=" & E_VJAHR & "&"
sUrl = sUrl & "VKAPA=" & E_VKAPA * 100 & "&"
sUrl = sUrl & "VMT=" & E_VMT * 100 & "&"
sUrl = sUrl & "LZZFREIB=" & E_LZZFREIB * 100 & "&"
sUrl = sUrl & "WFUNDF=" & E_LZZFREIB * 100 & "&"
sUrl = sUrl & "ZKF=" & Replace(E_ZKF, ",", ".") & "&"
sUrl = sUrl & "ZMVB=" & E_ZMVB
If sUrlAlt sUrl Then
Set oIE = CreateObject("InternetExplorer.Application")
oIE.navigate sUrl
Do: Loop Until oIE.Busy = False
Do: Loop Until oIE.Busy = False
sTxt = oIE.document.documentElement.outerTEXT
Set oIE = Nothing
vTxt = Split(sTxt, vbCrLf)
For i = 0 To UBound(vTxt)
If InStr(vTxt(i), "name=") > 0 Then
vRes = Trim(Replace(Replace(vTxt(i), "", ""))
vRes = Trim(Replace(vRes, "eingabe", ""))
vRes = Trim(Replace(vRes, "ausgabe", ""))
vRes = Trim(Replace(vRes, "name=", ""))
vRes = Trim(Replace(vRes, "value=", ""))
vRes = Trim(Replace(vRes, """", ""))
vRes = Split(vRes)
Select Case vRes(0)
Case Is = "BK"
BK = vRes(1)
Case Is = "BKS"
BKS = vRes(1)
Case Is = "BKV"
BKV = vRes(1)
Case Is = "LSTLZZ"
LSTLZZ = vRes(1)
Case Is = "SOLZLZZ"
SOLZLZZ = vRes(1)
Case Is = "SOLZS"
SOLZS = vRes(1)
Case Is = "SOLZV"
SOLZV = vRes(1)
Case Is = "STS"
STS = vRes(1)
Case Is = "STV"
STV = vRes(1)
End Select
End If
Next
sUrlAlt = sUrl
End If
Select Case Auswahl
Case 1 'Rückgabe Lohnsteuer
xlLSTJAHR_BMF = LSTLZZ / 100
Case 11 'Rückgabe Lohnsteuer _
(sonstige Einkünfte)
xlLSTJAHR_BMF = STS / 100
Case 111 'Rückgabe Lohnsteuer _
(mehrjährige Tätigkeit)
xlLSTJAHR_BMF = STV / 100
Case 2 'Rückgabe Solidaritätszuschlag
xlLSTJAHR_BMF = SOLZLZZ / 100
Case 22 'Rückgabe Solidaritätszuschlag _
(sonstige Einkünfte)
xlLSTJAHR_BMF = SOLZS / 100
Case 222 'Rückgabe Solidaritätszuschlag _
(mehrjährige Tätigkeit)
xlLSTJAHR_BMF = SOLZV / 100
Case 3 'Bemessungsgrundlage für die Kirchensteuer
xlLSTJAHR_BMF = BK / 100
Case 33 'Bemessungsgrundlage für die Kirchensteuer _
(sonstige Einkünfte)
xlLSTJAHR_BMF = BKS / 100
Case 333 'Bemessungsgrundlage für die Kirchensteuer _
(mehrjährige Tätigkeit)
xlLSTJAHR_BMF = BKV / 100
Case Else
xlLSTJAHR_BMF = 0
End Select
End Function
Gruß Rolf