Merge branch 'newMaster2024' of https://dev.azure.com/VeragAG/_git/SDL into newMaster2024
This commit is contained in:
@@ -158,6 +158,7 @@ Public Class usrcntlPDFScanList
|
||||
Private Sub DateiHochladenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem2.Click
|
||||
If DS.uploadDataToDATENSERVERFileDialog_MULTI(, , , _TYPE) Then
|
||||
initPdf()
|
||||
RaiseEvent FileAdded(DS.da_id, DS.GET_TOP1_PATH, DS.da_name)
|
||||
End If
|
||||
'If DS.uploadDataToDATENSERVERFileDialog(, ".pdf", , "PDF") <> "" Then
|
||||
' If DS.DATA_LIST.LIST.Count > 0 Then
|
||||
@@ -376,7 +377,6 @@ Public Class usrcntlPDFScanList
|
||||
ElseIf files.Count > 0 Then
|
||||
If files(0) <> "" Then
|
||||
Dim fio As New System.IO.FileInfo(files(0))
|
||||
|
||||
If DS.uploadDataToDATENSERVER(files(0), fio.Name, ".pdf") Then
|
||||
RaiseEvent FileAdded(DS.da_id, DS.GET_TOP1_PATH, DS.da_name)
|
||||
MsgBox("Dokument wurde hochgeladen.")
|
||||
|
||||
@@ -301,6 +301,7 @@ Public Class cUStVPositionen
|
||||
Property UStVPo_Sachbearbeiter As Object = Nothing ' NVARCHAR(15) NULL,
|
||||
Property UStVPo_Zeitstempel As Object = Nothing ' DATETIME Default (getdate()) NULL,
|
||||
Property UStVPo_daId As Object = Nothing
|
||||
Property UStVPo_daId_loeschbar As Object = Nothing
|
||||
|
||||
Dim SQL As New SQL
|
||||
|
||||
@@ -399,6 +400,7 @@ Public Class cUStVPositionen
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVPo_Sachbearbeiter", UStVPo_Sachbearbeiter))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVPo_Zeitstempel", UStVPo_Zeitstempel))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVPo_daId", UStVPo_daId))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVPo_daId_loeschbar", UStVPo_daId_loeschbar))
|
||||
Return list
|
||||
End Function
|
||||
|
||||
@@ -455,6 +457,7 @@ Public Class cUStVErstattungPositionen
|
||||
Property UStVEr_USteuerbetragEUR As Object = Nothing
|
||||
Property UStVEr_Sachbearbeiter As Object = Nothing
|
||||
Property UStVEr_Zeitstempel As Object = Nothing
|
||||
Property UStVEr_daId As Object = Nothing
|
||||
|
||||
Dim SQL As New SQL
|
||||
|
||||
@@ -477,6 +480,7 @@ Public Class cUStVErstattungPositionen
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVEr_USteuerbetragEUR", UStVEr_USteuerbetragEUR))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVEr_Sachbearbeiter", UStVEr_Sachbearbeiter))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVEr_Zeitstempel", UStVEr_Zeitstempel))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVEr_daId", UStVEr_daId))
|
||||
Return list
|
||||
End Function
|
||||
|
||||
|
||||
@@ -664,6 +664,173 @@ End Class
|
||||
|
||||
|
||||
|
||||
Public Class cIDSInvoiceSplittedByCountry
|
||||
|
||||
Property invoice_id As Integer
|
||||
Property YearMonthDay As Object = Nothing
|
||||
Property CustomerCode As Object = Nothing
|
||||
Property TotalInvoiceId As Object = Nothing
|
||||
Property Country As Object = Nothing
|
||||
Property Invoicenumber As Object = Nothing
|
||||
Property DocumentName As Object = Nothing
|
||||
Property Zeitstempel As Object = Nothing
|
||||
Property daid As Object = Nothing
|
||||
Property archiv As Boolean
|
||||
Property archiviertDatum As Object = Nothing
|
||||
|
||||
|
||||
|
||||
Public hasEntry = False
|
||||
|
||||
Dim SQL As New SQL
|
||||
|
||||
Sub New()
|
||||
|
||||
End Sub
|
||||
|
||||
Sub New(invoice_id)
|
||||
Me.invoice_id = invoice_id
|
||||
LOADID()
|
||||
End Sub
|
||||
|
||||
Sub New(YearMonthDay, CustomerCode, Invoicenumber, Country)
|
||||
Me.YearMonthDay = YearMonthDay
|
||||
Me.Invoicenumber = Invoicenumber
|
||||
Me.CustomerCode = CustomerCode
|
||||
Me.Country = Country
|
||||
LOAD()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("invoice_id", invoice_id,, True))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("YearMonthDay", YearMonthDay))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("TotalInvoiceId", TotalInvoiceId))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CustomerCode", CustomerCode))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Invoicenumber", Invoicenumber))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("DocumentName", DocumentName))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Country", Country))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Zeitstempel", Zeitstempel))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("daid", daid))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("archiv", archiv))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("archiviertDatum", archiviertDatum))
|
||||
|
||||
|
||||
|
||||
Return list
|
||||
End Function
|
||||
Public Function SAVE() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country) " &
|
||||
" BEGIN " & getUpdateCmd() & " END " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
" commit tran "
|
||||
|
||||
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
|
||||
End Function
|
||||
Public Sub LOADID()
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE invoice_id=@invoice_id ", conn)
|
||||
cmd.Parameters.AddWithValue("@invoice_id", invoice_id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(Me, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||
End If
|
||||
Next
|
||||
hasEntry = True
|
||||
End If
|
||||
dr.Close()
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country", conn)
|
||||
cmd.Parameters.AddWithValue("@YearMonthDay", YearMonthDay)
|
||||
cmd.Parameters.AddWithValue("@Invoicenumber", Invoicenumber)
|
||||
cmd.Parameters.AddWithValue("@CustomerCode", CustomerCode)
|
||||
cmd.Parameters.AddWithValue("@Country", Country)
|
||||
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(Me, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||
End If
|
||||
Next
|
||||
hasEntry = True
|
||||
End If
|
||||
dr.Close()
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
End Sub
|
||||
Public Function getUpdateCmd() As String
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
Dim str As String = ""
|
||||
For Each i In list
|
||||
If Not i.isPrimaryParam Then
|
||||
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
Return (" UPDATE [tblIDSInvoicesNewSplittedByCountry] SET " & str & " WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country")
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
Public Function getInsertCmd() As String
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
Dim str As String = ""
|
||||
Dim values As String = ""
|
||||
For Each i In list
|
||||
If Not i.isPrimaryParam Then
|
||||
str &= "[" & i.Text & "],"
|
||||
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
values = values.Substring(0, values.Length - 1) 'wg. ','
|
||||
Return (" INSERT INTO tblIDSInvoicesNewSplittedByCountry (" & str & ") VALUES(" & values & ") ")
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -240,6 +240,7 @@ Public Class cUTA
|
||||
Property daId As Object
|
||||
Property charged As Boolean = False
|
||||
Property chargedDatetime As Object = Nothing
|
||||
Property daIdgesetztDatum As Object = Nothing
|
||||
|
||||
|
||||
Public hasEntry = False
|
||||
@@ -345,6 +346,7 @@ Public Class cUTA
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("daId", daId))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("charged", charged))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("chargedDatetime", chargedDatetime))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("daIdgesetztDatum", daIdgesetztDatum))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
|
||||
@@ -4,6 +4,7 @@ Imports System.Globalization
|
||||
Imports System.Net
|
||||
Imports io.konik.zugferd.entity
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Windows.Forms
|
||||
|
||||
' Definieren der Klasse, um die Daten zu repräsentieren
|
||||
Public Class cTariffKN8
|
||||
@@ -91,4 +92,114 @@ Public Class cTariffKN8_Interface
|
||||
End Try
|
||||
Return False
|
||||
End Function
|
||||
Public Shared Function UPDATE_KN8_DESTAT()
|
||||
' URL zur Datei
|
||||
Dim fileUrl As String = "https://www.destatis.de/DE/Methoden/Klassifikationen/Aussenhandel/sova-leitdatei.html"
|
||||
'--> Manuell laden
|
||||
|
||||
Try
|
||||
Dim openFileDialog As New OpenFileDialog()
|
||||
openFileDialog.Title = "Wähle eine Textdatei"
|
||||
openFileDialog.Filter = "Textdateien (*.txt)|*.txt|Alle Dateien (*.*)|*.*"
|
||||
|
||||
If openFileDialog.ShowDialog() = DialogResult.OK Then
|
||||
Dim filePath As String = openFileDialog.FileName
|
||||
If File.Exists(filePath) Then
|
||||
Dim lines() As String = File.ReadAllLines(filePath)
|
||||
|
||||
' Verbindung zur Datenbank öffnen
|
||||
Using connection As New SqlConnection(VERAG_PROG_ALLGEMEIN.SQL.GetFMZOLLConnectionString)
|
||||
connection.Open()
|
||||
|
||||
Using command As New SqlCommand("DELETE tblEZTKN8_DE ", connection)
|
||||
|
||||
command.ExecuteNonQuery()
|
||||
|
||||
End Using
|
||||
|
||||
|
||||
For Each line As String In lines
|
||||
' Sicherstellen, dass die Zeile nicht leer ist
|
||||
If Not String.IsNullOrWhiteSpace(line) Then
|
||||
' Annahme: Der Code besteht aus den ersten 8 Zeichen, danach folgt die Beschreibung
|
||||
Dim code As String = line.Substring(0, 8).Trim()
|
||||
Dim description As String = line.Substring(9).Trim()
|
||||
|
||||
|
||||
Using command As New SqlCommand("INSERT INTO tblEZTKN8_DE (code, description) VALUES (@code, @description )", connection)
|
||||
command.Parameters.AddWithValue("@code", code.Trim().Replace("""", ""))
|
||||
command.Parameters.AddWithValue("@description", description.Trim().Replace("""", ""))
|
||||
|
||||
command.ExecuteNonQuery()
|
||||
|
||||
End Using
|
||||
|
||||
|
||||
' Entferne unnötige Leerzeichen aus der Beschreibung
|
||||
description = System.Text.RegularExpressions.Regex.Replace(description, "\s{2,}", " ")
|
||||
|
||||
Console.WriteLine($"Code: {code}, Beschreibung: {description}")
|
||||
End If
|
||||
Next
|
||||
|
||||
End Using
|
||||
Else
|
||||
Console.WriteLine("Datei nicht gefunden!")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
' WebClient verwenden, um die Datei direkt herunterzuladen
|
||||
Using client As New WebClient()
|
||||
Dim fileContent As String = client.DownloadString(fileUrl)
|
||||
|
||||
' Datei-Inhalt in Zeilen aufteilen
|
||||
Dim lines As String() = fileContent.Split(New String() {Environment.NewLine}, StringSplitOptions.None)
|
||||
|
||||
' Verbindung zur Datenbank öffnen
|
||||
Using connection As New SqlConnection(VERAG_PROG_ALLGEMEIN.SQL.GetFMZOLLConnectionString)
|
||||
connection.Open()
|
||||
|
||||
Using command As New SqlCommand("DELETE tblEZTKN8_DE ", connection)
|
||||
|
||||
command.ExecuteNonQuery()
|
||||
|
||||
End Using
|
||||
|
||||
' Zeilen durchlaufen, Kopfzeile überspringen
|
||||
For i As Integer = 1 To lines.Length - 1
|
||||
Dim line As String = lines(i).Trim()
|
||||
|
||||
' Überspringen leerer Zeilen
|
||||
If String.IsNullOrEmpty(line) Then Continue For
|
||||
|
||||
' Spalten trennen (Semikolon als Trennzeichen)
|
||||
Dim columns As String() = line.Split(";")
|
||||
|
||||
' Sicherstellen, dass genügend Spalten vorhanden sind
|
||||
If columns.Length >= 4 Then
|
||||
' Daten in die Datenbank einfügen
|
||||
Using command As New SqlCommand("INSERT INTO tblEZTKN8_DE (Ebene, EDV_Code, Code, Kurztitel) VALUES (@Spalte1, @Spalte2, @Spalte3, @Spalte4)", connection)
|
||||
command.Parameters.AddWithValue("@Spalte1", columns(0).Trim().Replace("""", ""))
|
||||
command.Parameters.AddWithValue("@Spalte2", columns(1).Trim().Replace("""", ""))
|
||||
command.Parameters.AddWithValue("@Spalte3", columns(2).Trim().Replace("""", ""))
|
||||
command.Parameters.AddWithValue("@Spalte4", columns(3).Trim().Replace("""", ""))
|
||||
|
||||
command.ExecuteNonQuery()
|
||||
|
||||
End Using
|
||||
End If
|
||||
Next
|
||||
End Using
|
||||
End Using
|
||||
Return True
|
||||
|
||||
Console.WriteLine("Daten erfolgreich in die Datenbank geladen.")
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Return False
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -553,6 +553,12 @@ BindingFlags.Instance Or BindingFlags.NonPublic, Nothing, [Control], New Object(
|
||||
End Function
|
||||
|
||||
|
||||
Shared Function getISO2LandFromISO1Land(Iso1Land As String)
|
||||
Dim sqlstr = "SELECT TOP 1 isnull([Länderverzeichnis für die Außenhandelsstatistik].LandKz,'') AS LandKzISO2 FROM [Länderverzeichnis für die Außenhandelsstatistik] LEFT JOIN Währungstabelle ON [Länderverzeichnis für die Außenhandelsstatistik].LandNr = Währungstabelle.Währungsschlüssel WHERE Währungstabelle.LandKz='" & Iso1Land & "' "
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Return SQL.getValueTxtBySql(sqlstr, "FMZOLL")
|
||||
End Function
|
||||
|
||||
Shared Function getISO1Land(LandKz As String)
|
||||
Dim sqlstr = "SELECT TOP 1 isnull(Währungstabelle.LandKz,'') AS LandKzISO1 FROM [Länderverzeichnis für die Außenhandelsstatistik] LEFT JOIN Währungstabelle ON [Länderverzeichnis für die Außenhandelsstatistik].LandNr = Währungstabelle.Währungsschlüssel WHERE [Länderverzeichnis für die Außenhandelsstatistik].LandKz='" & LandKz & "' "
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
Reference in New Issue
Block a user