Merge branch 'newMaster2024' of https://dev.azure.com/VeragAG/_git/SDL into newMaster2024
This commit is contained in:
@@ -109,6 +109,30 @@ Public Class cAbgaben
|
||||
Dim count = SQL.getValueTxtBySqlVarList("SELECT count(*) FROM Zkteing WHERE LeistungsNr=@LeistungsNr AND Betrag=@Betrag AND Registriernummer=@Registriernummer AND AOFD=@AOFD AND AKTO=@AKTO AND Fälligkeitsdatum=@Fälligkeitsdatum ", "FMZOLL", list, 0)
|
||||
Return (count > 0)
|
||||
End Function
|
||||
|
||||
Public Shared Function LOAD_LIST(Registriernummer) As List(Of cAbgaben)
|
||||
Dim Abgaben_LIST = New List(Of cAbgaben)
|
||||
Dim SQL As New SQL
|
||||
Dim dt As DataTable = SQL.loadDgvBySql("SELECT * FROM Zkteing WHERE Registriernummer='" & Registriernummer & "'", "FMZOLL")
|
||||
If dt IsNot Nothing Then
|
||||
For Each r In dt.Rows
|
||||
Dim obj As New cAbgaben()
|
||||
obj.[Index] = r.Item("Index")
|
||||
For Each li In obj.getParameterList()
|
||||
Dim propInfo As PropertyInfo = obj.GetType.GetProperty(li.Scalarvariable)
|
||||
If r.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(obj, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(obj, r.Item(li.Text))
|
||||
End If
|
||||
Next
|
||||
obj.hasEntry = True
|
||||
Abgaben_LIST.Add(obj)
|
||||
Next
|
||||
End If
|
||||
Return Abgaben_LIST
|
||||
End Function
|
||||
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
|
||||
@@ -128,15 +128,15 @@ Public Class cEmailBenachrichtigung
|
||||
|
||||
'Prüfen, ob die Art für den Kunden im Kundenstamm aktiviert ist:
|
||||
Dim kdn_er As New cKundenErweitert(Kdnr)
|
||||
If art = 3 Then '> Ankunft Export
|
||||
If kdn_er Is Nothing OrElse Not kdn_er.EmailAnkunft_Export Then
|
||||
art = 1
|
||||
End If
|
||||
ElseIf art = 4 Then '> Freigabe Export
|
||||
If kdn_er Is Nothing OrElse Not kdn_er.EmailFreigabe_Export Then
|
||||
art = 2
|
||||
End If
|
||||
If art = 3 Then '> Ankunft Export
|
||||
If kdn_er Is Nothing OrElse Not kdn_er.EmailAnkunft_Export Then
|
||||
art = 1
|
||||
End If
|
||||
ElseIf art = 4 Then '> Freigabe Export
|
||||
If kdn_er Is Nothing OrElse Not kdn_er.EmailFreigabe_Export Then
|
||||
art = 2
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'In diesen Strings werden die Mailadressen übergeben:
|
||||
|
||||
@@ -40,6 +40,7 @@ Public Class cKundenErweitert
|
||||
Property EmailFreigabe_Export_Art As String = "FG" ' STB/VBD/.. bei Freigabe ; BLG --> wenn Beleg da ist.
|
||||
Property EmailFreigabe_VBDPDF As Boolean = False
|
||||
Property EmailFreigabe_ABDPDF As Boolean = False
|
||||
Property EmailFreigabeBeleg_Sendungsunterlagen As Boolean = False
|
||||
Property Email_AVM As Boolean = False
|
||||
Property Depot_Kunde As Boolean = False
|
||||
Property FiBuSchnittstelleLG As Boolean = False
|
||||
@@ -141,6 +142,7 @@ Public Class cKundenErweitert
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("EmailFreigabe_Export_Art", EmailFreigabe_Export_Art))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("EmailFreigabe_VBDPDF", EmailFreigabe_VBDPDF))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("EmailFreigabe_ABDPDF", EmailFreigabe_ABDPDF))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("EmailFreigabeBeleg_Sendungsunterlagen", EmailFreigabeBeleg_Sendungsunterlagen))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Email_AVM", Email_AVM))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Depot_Kunde", Depot_Kunde))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("FiBuSchnittstelleLG", FiBuSchnittstelleLG))
|
||||
|
||||
@@ -379,7 +379,27 @@ Public Class cUTA
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(Me, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||
Dim value = dr.Item(li.Text)
|
||||
Dim targetType As Type = If(Nullable.GetUnderlyingType(propInfo.PropertyType), propInfo.PropertyType)
|
||||
|
||||
Try
|
||||
If targetType Is GetType(Char) AndAlso TypeOf value Is String Then
|
||||
Dim strValue As String = value.ToString()
|
||||
If strValue.Length > 0 Then
|
||||
propInfo.SetValue(Me, strValue(0)) ' String → erster Buchstabe als Char
|
||||
Else
|
||||
propInfo.SetValue(Me, Nothing) ' oder ein Standardwert wie " " (Leerzeichen)
|
||||
End If
|
||||
ElseIf targetType Is GetType(String) AndAlso TypeOf value Is Char Then
|
||||
propInfo.SetValue(Me, value.ToString()) ' Char → String
|
||||
Else
|
||||
Dim convertedValue = Convert.ChangeType(value, targetType)
|
||||
propInfo.SetValue(Me, convertedValue)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Console.WriteLine("Fehler beim Setzen von " & li.Text & " auf " & value.ToString() & ": " & ex.Message)
|
||||
MsgBox("Fehler beim Setzen von " & li.Text & " auf " & value.ToString() & vbCrLf & ex.ToString())
|
||||
End Try
|
||||
End If
|
||||
|
||||
Next
|
||||
@@ -454,9 +474,9 @@ Public Class cUTA
|
||||
Property Belegnummer_des_Lieferanten As Object
|
||||
Property Kilometerstand As Object
|
||||
Property Fakturierwarenart As Object
|
||||
Property Vorzeichen_Statusfeld_für_alle_Beträge_und_Mengen As Object
|
||||
Property Vorzeichen_Statusfeld_für_alle_Beträge_und_Mengen As String 'HIER object
|
||||
Property Menge As Object
|
||||
Property SB_BT As Object
|
||||
Property SB_BT As String 'HIER object
|
||||
Property Umsatzsteuerprozentsatz As Object
|
||||
Property Lieferlandwährung_ISO As Object
|
||||
Property Einzelpreis_Netto_in_Lieferlandwährung As Object
|
||||
|
||||
@@ -1396,6 +1396,19 @@ Public Class cFormularManager
|
||||
|
||||
Dim doc As New Spire.Pdf.PdfDocument(pdfPath)
|
||||
|
||||
'Versuche, die Seitengröße zu überprüfen
|
||||
'-----------------------------------------
|
||||
If doc.Pages.Count = 0 Then
|
||||
' Leeres Dokument, überspringen
|
||||
Continue For
|
||||
End If
|
||||
Dim pageSize = doc.Pages(0).Size
|
||||
If pageSize.Width <= 0 OrElse pageSize.Height <= 0 Then
|
||||
' Ungültige Seitengröße, überspringen
|
||||
Continue For
|
||||
End If
|
||||
'-----------------------------------------
|
||||
|
||||
doc.PageSettings.Size = Spire.Pdf.PdfPageSize.A4
|
||||
|
||||
doc.PageSettings.Orientation = Spire.Pdf.PdfPageOrientation.Landscape
|
||||
|
||||
108
VERAG_PROG_ALLGEMEIN/Schnittstellen/BZST/cBZST_UID.vb
Normal file
108
VERAG_PROG_ALLGEMEIN/Schnittstellen/BZST/cBZST_UID.vb
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
Imports System.IO
|
||||
Imports System.Net
|
||||
Imports System.Security.Cryptography
|
||||
Imports System.Text
|
||||
Imports Newtonsoft.Json
|
||||
|
||||
Public Class cBZST_UID_REST
|
||||
|
||||
Shared ReadOnly ApiHost As String = "api.evatr.vies.bzst.de"
|
||||
Shared ReadOnly ApiPort As Integer = 443
|
||||
Shared ReadOnly ApiBasePath As String = "/v1"
|
||||
|
||||
' === 1. MAC Authentication Header Builder ===
|
||||
Shared Function BuildMacHeader(httpMethod As String, path As String, body As String, id As String, base64Key As String) As String
|
||||
Dim ts As String = CLng((DateTime.UtcNow - #1/1/1970#).TotalSeconds).ToString()
|
||||
Dim nonce As String = Guid.NewGuid().ToString("N").Substring(0, 12)
|
||||
|
||||
Dim bodyHashPart As String = ""
|
||||
If httpMethod = "POST" AndAlso body IsNot Nothing Then
|
||||
Using sha = SHA256.Create()
|
||||
bodyHashPart = Convert.ToBase64String(sha.ComputeHash(Encoding.UTF8.GetBytes(body)))
|
||||
End Using
|
||||
End If
|
||||
|
||||
Dim macInput As String = $"{ts}{vbLf}{nonce}{vbLf}{httpMethod}{vbLf}{path}{vbLf}{ApiHost}{vbLf}{ApiPort}{vbLf}{bodyHashPart}{vbLf}"
|
||||
Dim keyBytes As Byte() = Convert.FromBase64String(base64Key)
|
||||
Dim hmac As New HMACSHA256(keyBytes)
|
||||
Dim macSig As String = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(macInput)))
|
||||
|
||||
Return $"MAC id=""{id}"", ts=""{ts}"", nonce=""{nonce}"", mac=""{macSig}"""
|
||||
End Function
|
||||
|
||||
' === 2. HTTP Call Helper ===
|
||||
Shared Function DoRequest(httpMethod As String, path As String, body As String, authHeader As String) As String
|
||||
Dim url As String = $"https://{ApiHost}{path}"
|
||||
Dim req = CType(WebRequest.Create(url), HttpWebRequest)
|
||||
req.Method = httpMethod
|
||||
req.Headers.Add("Authorization", authHeader)
|
||||
If httpMethod = "POST" Then
|
||||
req.ContentType = "application/json"
|
||||
Dim bodyBytes = Encoding.UTF8.GetBytes(body)
|
||||
req.ContentLength = bodyBytes.Length
|
||||
Using s = req.GetRequestStream()
|
||||
s.Write(bodyBytes, 0, bodyBytes.Length)
|
||||
End Using
|
||||
Else
|
||||
req.Accept = "application/json"
|
||||
End If
|
||||
|
||||
Using resp = CType(req.GetResponse(), HttpWebResponse)
|
||||
Using sr = New StreamReader(resp.GetResponseStream())
|
||||
Return sr.ReadToEnd()
|
||||
End Using
|
||||
End Using
|
||||
End Function
|
||||
|
||||
' === 3. CheckVat (einfach) ===
|
||||
Public Shared Function CheckVat(countryCode As String, vatNumber As String, apiId As String, apiKeyBase64 As String) As String
|
||||
|
||||
Dim path = $"{ApiBasePath}/euvat/{countryCode}{vatNumber}"
|
||||
Dim auth = BuildMacHeader("GET", path, Nothing, apiId, apiKeyBase64)
|
||||
Return DoRequest("GET", path, Nothing, auth)
|
||||
End Function
|
||||
|
||||
' === 4. CheckVatQualified (mit Zusatzdaten) ===
|
||||
Public Shared Function CheckVatQualified(countryCode As String, vatNumber As String,
|
||||
street As String, postalCode As String, city As String,
|
||||
apiId As String, apiKeyBase64 As String) As String
|
||||
|
||||
Dim path = $"{ApiBasePath}/euvat/qualified"
|
||||
Dim payload = New With {
|
||||
.countryCode = countryCode,
|
||||
.vatNumber = vatNumber,
|
||||
.street = street,
|
||||
.postalCode = postalCode,
|
||||
.city = city
|
||||
}
|
||||
Dim jsonBody As String = JsonConvert.SerializeObject(payload)
|
||||
Dim auth = BuildMacHeader("POST", path, jsonBody, apiId, apiKeyBase64)
|
||||
Return DoRequest("POST", path, jsonBody, auth)
|
||||
End Function
|
||||
|
||||
' === 5. Statusmeldungen abrufen ===
|
||||
Public Function GetStatusMessages(apiId As String, apiKeyBase64 As String) As String
|
||||
Dim path = $"{ApiBasePath}/info/statusmeldungen"
|
||||
Dim auth = BuildMacHeader("GET", path, Nothing, apiId, apiKeyBase64)
|
||||
Return DoRequest("GET", path, Nothing, auth)
|
||||
End Function
|
||||
|
||||
|
||||
Sub EXAMPLE()
|
||||
Dim apiId As String = "DEINE_ID"
|
||||
Dim apiKey As String = "DEIN_BASE64_KEY"
|
||||
|
||||
' 1) Einfache Prüfung
|
||||
Dim simple = CheckVat("AT", "U18522105", apiId, apiKey)
|
||||
Console.WriteLine("Simple VAT Response: " & simple)
|
||||
|
||||
' 2) Qualifizierte Prüfung
|
||||
Dim qual = CheckVatQualified("DE", "123456789", "Musterstr. 1", "12345", "Musterstadt", apiId, apiKey)
|
||||
Console.WriteLine("Qualified VAT Response: " & qual)
|
||||
|
||||
' 3) Statusmeldungen
|
||||
Dim status = GetStatusMessages(apiId, apiKey)
|
||||
Console.WriteLine("Status Messages: " & status)
|
||||
End Sub
|
||||
End Class
|
||||
75
VERAG_PROG_ALLGEMEIN/Schnittstellen/BZST/cBZST_UID_XML.vb
Normal file
75
VERAG_PROG_ALLGEMEIN/Schnittstellen/BZST/cBZST_UID_XML.vb
Normal file
@@ -0,0 +1,75 @@
|
||||
'VERALTET!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
'Imports CookComputing.XmlRpc
|
||||
|
||||
'Public Interface IEvatR
|
||||
' <XmlRpcMethod("evatrRPC.checkVatSimple")>
|
||||
' Function CheckVatSimple(tnID As String, ländercode As String, ustid As String) As XmlRpcStruct
|
||||
|
||||
' <XmlRpcMethod("evatrRPC.checkVatQualified")>
|
||||
' Function CheckVatQualified(tnID As String, ländercode As String, ustid As String,
|
||||
' firmenname As String, ort As String, plz As String, strasse As String) As XmlRpcStruct
|
||||
'End Interface
|
||||
|
||||
'Public Class cBZST_UID_XML
|
||||
|
||||
' Shared tnid As String = "DE813570890" ' BZSt Teilnehmer-ID
|
||||
|
||||
' Public Sub TEST()
|
||||
' ' Zum manuellen Testen
|
||||
' Dim gültig1 = checkVATSimple("AT", "U12345678")
|
||||
' Console.WriteLine("checkVATSimple returned: " & gültig1)
|
||||
|
||||
' Dim gültig2 = checkVATQualified("DE", "123456789", "Beispielfirma GmbH", "Musterstadt", "12345", "Musterstraße 1")
|
||||
' Console.WriteLine("checkVATQualified returned: " & gültig2)
|
||||
' End Sub
|
||||
|
||||
' Public Shared Function checkVATSimple(ByVal countryCode As String, ByVal vatNumber As String) As Boolean
|
||||
' Try
|
||||
' Console.WriteLine("==== Einfache UID-Abfrage ====")
|
||||
' Dim proxy = XmlRpcProxyGen.Create(Of IEvatR)()
|
||||
' Dim client = CType(proxy, XmlRpcClientProtocol)
|
||||
' client.Url = "https://evatr.bzst.de/eVatR/xmlrpc"
|
||||
' client.XmlEncoding = System.Text.Encoding.UTF8
|
||||
|
||||
' Dim res As XmlRpcStruct = proxy.CheckVatSimple(tnid, countryCode, vatNumber)
|
||||
' Console.WriteLine("Land: " & countryCode)
|
||||
' Console.WriteLine("USt-IdNr.: " & vatNumber)
|
||||
' Console.WriteLine("Ergebniscode: " & res("erg_code"))
|
||||
' Console.WriteLine("Ergebnistext: " & res("erg_text"))
|
||||
' Console.WriteLine("Gültig: " & res("gueltig"))
|
||||
|
||||
' Return Convert.ToBoolean(res("gueltig"))
|
||||
' Catch ex As Exception
|
||||
' Console.WriteLine("Fehler bei einfacher Prüfung: " & ex.Message)
|
||||
' Return False
|
||||
' End Try
|
||||
' End Function
|
||||
|
||||
' Public Shared Function checkVATQualified(ByVal countryCode As String, ByVal vatNumber As String,
|
||||
' ByVal companyName As String, ByVal city As String,
|
||||
' ByVal postalCode As String, ByVal street As String) As Boolean
|
||||
' Try
|
||||
' Dim proxy = XmlRpcProxyGen.Create(Of IEvatR)()
|
||||
' Dim client = CType(proxy, XmlRpcClientProtocol)
|
||||
' client.Url = "https://evatr.bzst.de/eVatR/xmlrpc"
|
||||
' client.XmlEncoding = System.Text.Encoding.UTF8
|
||||
|
||||
' Dim res As XmlRpcStruct = proxy.CheckVatQualified(tnid, countryCode, vatNumber, companyName, city, postalCode, street)
|
||||
|
||||
' Console.WriteLine("==== Qualifizierte UID-Abfrage ====")
|
||||
' Console.WriteLine("Land: " & countryCode)
|
||||
' Console.WriteLine("USt-IdNr.: " & vatNumber)
|
||||
' Console.WriteLine("Firma: " & companyName)
|
||||
' Console.WriteLine("Adresse: " & street & ", " & postalCode & " " & city)
|
||||
' Console.WriteLine("Ergebniscode: " & res("erg_code"))
|
||||
' Console.WriteLine("Ergebnistext: " & res("erg_text"))
|
||||
' Console.WriteLine("Gültig: " & res("gueltig"))
|
||||
|
||||
' Return Convert.ToBoolean(res("gueltig"))
|
||||
' Catch ex As Exception
|
||||
' Console.WriteLine("Fehler bei qualifizierter Prüfung: " & ex.Message)
|
||||
' Return False
|
||||
' End Try
|
||||
' End Function
|
||||
|
||||
'End Class
|
||||
@@ -165,6 +165,11 @@ Public Class cTelotecAPI
|
||||
|
||||
|
||||
Function GetTAMessages(Company) As List(Of TAMessage)
|
||||
|
||||
Console.WriteLine("-------------LOS-------------")
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
|
||||
Dim messages As New List(Of TAMessage)()
|
||||
|
||||
Dim http As New Http()
|
||||
|
||||
@@ -371,6 +371,8 @@
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Schnittstellen\ATEZ\RELAYHUB\cRelayHub.vb" />
|
||||
<Compile Include="Schnittstellen\BZST\cBZST_UID_XML.vb" />
|
||||
<Compile Include="Schnittstellen\BZST\cBZST_UID.vb" />
|
||||
<Compile Include="Schnittstellen\cHMRC.vb" />
|
||||
<Compile Include="Schnittstellen\TELOTEC\cTelotecAPI.vb" />
|
||||
<Compile Include="Schnittstellen\HMRC\cHMRCToken.vb" />
|
||||
@@ -1409,6 +1411,9 @@
|
||||
<PackageReference Include="SSH.NET">
|
||||
<Version>2024.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xmlrpcnet">
|
||||
<Version>3.0.0.266</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ZUGFeRD.NET">
|
||||
<Version>1.0.1</Version>
|
||||
</PackageReference>
|
||||
|
||||
Reference in New Issue
Block a user