MDM. USTVA, SammelRE, Leistender, etc.

This commit is contained in:
2025-04-01 17:38:15 +02:00
parent 3d1a26c644
commit 722e32b9b4
9 changed files with 284 additions and 45 deletions

View File

@@ -293,7 +293,7 @@ Public Class cUStVPositionen
Property UStVPo_ReNr As Object = Nothing ' NVARCHAR(20) NULL,
Property UStVPo_USteuerbetrag As Object = Nothing ' MONEY Not NULL,
Property UStVPo_Leistungsbezeichnung As Object = Nothing ' NVARCHAR(255) NULL,
Property UStVPo_Leistender As Object = Nothing ' NVARCHAR(65) NULL,
Property UStVPo_Leistender As String = "" ''NVARCHAR(65) NULL,
Property UStVPo_Schnittstelle As Object = Nothing ' BIT Default ((0)) Not NULL,
Property UStVPo_SchnittstellenNr As Object = Nothing ' SMALLINT Default ((0)) Not NULL,
Property UStVPo_Umrechnungskurs As Object = Nothing ' FLOAT(53) NULL,
@@ -302,6 +302,7 @@ Public Class cUStVPositionen
Property UStVPo_Zeitstempel As Object = Nothing ' DATETIME Default (getdate()) NULL,
Property UStVPo_daId As Object = Nothing
Property UStVPo_daId_loeschbar As Boolean = True
Property UStVPo_LeistenderId As Integer '
Dim SQL As New SQL
@@ -401,6 +402,7 @@ Public Class cUStVPositionen
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))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStVPo_LeistenderId", UStVPo_LeistenderId))
Return list
End Function

View File

@@ -11,17 +11,28 @@ Public Class cUStVLeistender
Property UstV_Leistender_Land As Object = Nothing
Property UstV_Leistender_UstNr As Object = Nothing
Property UstV_Leistender_Adresse As Boolean
Property UStV_LeistenderId As Integer
Public hasEntry = False
Dim SQL As New SQL
Sub New(UStV_Leistender)
Sub New(UStV_Leistender As String)
Me.UStV_Leistender = UStV_Leistender
LOAD()
End Sub
Sub New(Id As Integer)
Me.UStV_LeistenderId = Id
LOADBYID()
End Sub
Sub New(UStV_Leistender As String, Land As String)
Me.UStV_Leistender = UStV_Leistender
LOADByLand(Land)
End Sub
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
@@ -33,6 +44,7 @@ Public Class cUStVLeistender
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_Land", UstV_Leistender_Land))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_UstNr", UstV_Leistender_UstNr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstV_Leistender_Adresse", UstV_Leistender_Adresse))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UStV_LeistenderId", UStV_LeistenderId))
Return list
End Function
@@ -60,9 +72,9 @@ Public Class cUStVLeistender
End Function
Public Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblUStVLeistender WHERE UStV_Leistender=@UStV_Leistender ", conn)
cmd.Parameters.AddWithValue("@UStV_Leistender", UStV_Leistender)
Dim dr = cmd.ExecuteReader()
@@ -82,14 +94,73 @@ Public Class cUStVLeistender
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
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
Public Sub LOADBYID()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblUStVLeistender WHERE UStV_LeistenderId=@UStV_LeistenderId ", conn)
cmd.Parameters.AddWithValue("@UStV_LeistenderId", UStV_LeistenderId)
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 LOADByLand(Land As String)
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblUStVLeistender WHERE UStV_Leistender=@UStV_Leistender and left(UstV_Leistender_UstNr, 2) = '" & Land & "'", conn)
cmd.Parameters.AddWithValue("@UStV_Leistender", UStV_Leistender)
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()