unisped VorlageProv

This commit is contained in:
2026-05-05 11:28:07 +02:00
parent d2f34d49c8
commit 925baf2818
3 changed files with 96 additions and 40 deletions

View File

@@ -206,7 +206,7 @@ Public Class cVERAG_CustomsDeclarations
Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(za_Id)
Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(za_Id)
Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(za_Id)
Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(za_Id)
Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(za_Id)
Catch ex As Exception
@@ -323,7 +323,7 @@ Public Class cVERAG_CustomsDeclarations
If loadAll Then
CD.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(CD.za_Id)
CD.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(CD.za_Id, cbamWhereSnd)
CD.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(CD.za_Id)
CD.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(CD.za_Id)
CD.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(CD.za_Id)
End If
@@ -371,7 +371,7 @@ Public Class cVERAG_CustomsDeclarations
ZA.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(ZA.za_Id)
ZA.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(ZA.za_Id)
ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(ZA.za_Id)
ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(ZA.za_Id)
ZA.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(ZA.za_Id)
End If
@@ -411,7 +411,7 @@ Public Class cVERAG_CustomsDeclarations
ZA.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(ZA.za_Id)
ZA.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(ZA.za_Id)
ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(ZA.za_Id)
ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(ZA.za_Id)
ZA.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(ZA.za_Id)
End If
@@ -572,13 +572,13 @@ Public Class cVERAG_CustomsDeclarations
' )
''=========================================================
Else
'==================>> DIRECT <<=========================
'==================>> DIRECT <<=========================
Try
If KD IsNot Nothing Then
Dim ERW As New cKundenErweitert(KD.KundenNr)
Try
If KD IsNot Nothing Then
Dim ERW As New cKundenErweitert(KD.KundenNr)
Select Case ERW.kde_CBAM_Status
Select Case ERW.kde_CBAM_Status
Case "", "50to" ' Nur hier wird eine Warnung gesendet!! -> WEnn der Kunde bereits Registriert ist, nicht notwendig.
Dim dateCBAM = If(If(za_ReleaseDate, za_DeclarationDate), Now)
@@ -607,10 +607,10 @@ Public Class cVERAG_CustomsDeclarations
End If
'geprüft werden die bisherigen CBAM Waren im Jahr + die aktuelle Sendung
If eigenmasseSumme_YEAR < Warn1 And (eigenmasseSumme_Shipment + eigenmasseSumme_YEAR) >= Warn1 Then
'--> WARN 1 überschritten
WarnLevel = "1"
Schwellenwert = Warn1
End If
'--> WARN 1 überschritten
WarnLevel = "1"
Schwellenwert = Warn1
End If
'===========>>>> WARNUNG <<<<<<<=================================
If WarnLevel <> "" Then
@@ -677,13 +677,13 @@ Public Class cVERAG_CustomsDeclarations
End If
'================================================================
End Select
End If
'=========================================================
Catch ex As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End If
End If
'=========================================================
Catch ex As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End If
End If
Catch ex As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
@@ -818,10 +818,14 @@ Public Class cVERAG_CustomsDeclarations
If za_Id <= 0 Then Return False
cVERAG_CustomsDeclarations_Parties.REPLACE_ALL(za_Id, Parties)
cVERAG_CustomsDeclarations_Duty.REPLACE_ALL(za_Id, Duties)
cVERAG_CustomsDeclarations_Document.REPLACE_HEAD(za_Id, Documents)
' Items zuerst speichern, damit zaItem_Id für Item-Duties vorhanden ist
cVERAG_CustomsDeclarations_Item.REPLACE_ALL(za_Id, Items)
' Nur Header-Duties speichern (zaDuty_zaItemId bleibt NULL)
cVERAG_CustomsDeclarations_Duty.REPLACE_HEAD(za_Id, Duties)
Return True
End Function
End Class
@@ -991,6 +995,10 @@ Public Class cVERAG_CustomsDeclarations_Item
Public Property zaItem_Remarks As String
Public Property Documents As New List(Of cVERAG_CustomsDeclarations_Document)
' Duties auf Positionsebene; werden mit zaDuty_zaItemId = zaItem_Id gespeichert
Public Property Duties As New List(Of cVERAG_CustomsDeclarations_Duty)
Public Property hasEntry As Boolean = False
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
@@ -1063,11 +1071,17 @@ Public Class cVERAG_CustomsDeclarations_Item
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=" & zaId, "FMZOLL")
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId is not null", "FMZOLL")
' Nur Item-Duties löschen; Header-Duties bleiben erhalten und werden separat gespeichert
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId & " AND zaDuty_zaItemId IS NOT NULL", "FMZOLL")
If list Is Nothing Then Exit Sub
For Each it In list
it.zaItem_zaId = zaId
it.zaItem_Id = SQL.doSQLVarListID(it.zaItem_Id, it.getInsertCmd(), "FMZOLL", , it.getParameterList())
'MsgBox(it.zaItem_Id)
cVERAG_CustomsDeclarations_Document.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Documents)
cVERAG_CustomsDeclarations_Duty.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Duties)
Next
End Sub
@@ -1108,10 +1122,13 @@ Public Class cVERAG_CustomsDeclarations_Item
End Using
End Using
' ===== Documents NACHLADEN (pro Item) =====
' ===== Documents und Duties NACHLADEN (pro Item) =====
For Each it In result
it.Documents =
cVERAG_CustomsDeclarations_Document.LOAD_ITEM_BY_ITEMID(zaId, it.zaItem_Id)
it.Duties =
cVERAG_CustomsDeclarations_Duty.LOAD_ITEM_BY_ITEMID(zaId, it.zaItem_Id)
Next
Catch ex As Exception
@@ -1151,14 +1168,15 @@ Public Class cVERAG_CustomsDeclarations_Duty
Public Property zaDuty_Id As Integer
Public Property zaDuty_zaId As Integer
' NULL = Duty auf Kopfebene; Wert = Duty gehört zur jeweiligen Position
Public Property zaDuty_zaItemId As Integer?
Public Property zaDuty_AccountType As String
Public Property zaDuty_AccountHeadCustoms As String
Public Property zaDuty_ApplicationType As String
Public Property zaDuty_AccountNo As String
Public Property zaDuty_AccountEORI As String
Public Property zaDuty_AccountHolderName As String
Public Property zaDuty_DutyType As String
@@ -1167,12 +1185,16 @@ Public Class cVERAG_CustomsDeclarations_Duty
Public Property zaDuty_AmountForeign As Decimal?
Public Property zaDuty_Currency As String
Public Property zaDuty_LimitDate As Date?
Public Property zaDuty_Prozentsatz As Decimal?
Public Property hasEntry As Boolean = False
Public Function getParameterList() As List(Of SQLVariable)
Return New List(Of SQLVariable) From {
New SQLVariable("zaDuty_Id", zaDuty_Id,, True),
New SQLVariable("zaDuty_zaId", zaDuty_zaId),
New SQLVariable("zaDuty_zaItemId", zaDuty_zaItemId),
New SQLVariable("zaDuty_AccountType", zaDuty_AccountType),
New SQLVariable("zaDuty_AccountHeadCustoms", zaDuty_AccountHeadCustoms),
New SQLVariable("zaDuty_ApplicationType", zaDuty_ApplicationType),
@@ -1184,7 +1206,8 @@ Public Class cVERAG_CustomsDeclarations_Duty
New SQLVariable("zaDuty_AmountEUR", zaDuty_AmountEUR),
New SQLVariable("zaDuty_AmountForeign", zaDuty_AmountForeign),
New SQLVariable("zaDuty_Currency", zaDuty_Currency),
New SQLVariable("zaDuty_LimitDate", zaDuty_LimitDate)
New SQLVariable("zaDuty_LimitDate", zaDuty_LimitDate),
New SQLVariable("zaDuty_Prozentsatz", zaDuty_Prozentsatz)
}
End Function
@@ -1203,40 +1226,70 @@ Public Class cVERAG_CustomsDeclarations_Duty
' ---------- DELETE + INSERT ----------
Public Shared Sub REPLACE_ALL(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Duty))
Public Shared Sub REPLACE_HEAD(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Duty))
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId, "FMZOLL")
' Nur Header-Duties löschen
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId & " AND zaDuty_zaItemId IS NULL", "FMZOLL")
If list Is Nothing Then Exit Sub
For Each d In list
d.zaDuty_zaId = zaId
d.zaDuty_zaItemId = Nothing
d.zaDuty_Id = SQL.doSQLVarListID(d.zaDuty_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList())
Next
End Sub
Public Shared Function LOAD_BY_ZAID(zaId As Integer) _
As List(Of cVERAG_CustomsDeclarations_Duty)
Public Shared Sub INSERT_ITEM(zaId As Integer, itemId As Integer, list As List(Of cVERAG_CustomsDeclarations_Duty))
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
If list Is Nothing Then Exit Sub
For Each d In list
d.zaDuty_zaId = zaId
d.zaDuty_zaItemId = itemId
d.zaDuty_Id = SQL.doSQLVarListID(d.zaDuty_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList())
Next
End Sub
Public Shared Function LOAD_HEAD_BY_ZAID(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_Duty)
Return LOAD_BY_WHERE(zaId, " AND zaDuty_zaItemId IS NULL")
End Function
Public Shared Function LOAD_ITEM_BY_ITEMID(zaId As Integer, itemId As Integer) As List(Of cVERAG_CustomsDeclarations_Duty)
Return LOAD_BY_WHERE(zaId, " AND zaDuty_zaItemId=" & itemId)
End Function
Public Shared Function LOAD_BY_ZAID(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_Duty)
' Kompatibilität: lädt weiterhin alle Duties zur Anmeldung
Return LOAD_BY_WHERE(zaId, "")
End Function
Private Shared Function LOAD_BY_WHERE(zaId As Integer, Optional where As String = "") As List(Of cVERAG_CustomsDeclarations_Duty)
Dim result As New List(Of cVERAG_CustomsDeclarations_Duty)
Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand(
"SELECT * FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=@zaId",
"SELECT * FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=@zaId " & where,
conn)
cmd.Parameters.AddWithValue("@zaId", zaId)
Using dr As SqlDataReader = cmd.ExecuteReader()
While dr.Read()
While dr.Read
Dim d As New cVERAG_CustomsDeclarations_Duty
d.hasEntry = False
' ===== DEINE LOAD-VORLAGE (1:1, nur in While) =====
For Each li In d.getParameterList()
Dim pi As PropertyInfo =
d.GetType().GetProperty(li.Scalarvariable)
If pi Is Nothing Then Continue For
If dr.Item(li.Text) Is DBNull.Value Then
pi.SetValue(d, Nothing)
Else