This commit is contained in:
2026-01-07 13:56:33 +01:00
parent 3a30253c2d
commit afcbfd37ac
4 changed files with 117 additions and 51 deletions

View File

@@ -208,7 +208,7 @@ Public Class cVERAG_CustomsDeclarations
Public Shared Function LOAD_List_CBAM(EORI As String, ImportCountry As String, datFrom As Date, datTo As Date, Optional CustomsSystem As String = "", Optional loadAll As Boolean = True) As List(Of cVERAG_CustomsDeclarations)
Public Shared Function LOAD_List_CBAM(EORI() As String, ImportCountry As String, datFrom As Date, datTo As Date, Optional CustomsSystem As String = "", Optional loadAll As Boolean = True, Optional indirect As Boolean = False) As List(Of cVERAG_CustomsDeclarations)
Dim LIST As New List(Of cVERAG_CustomsDeclarations)
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
@@ -222,6 +222,10 @@ Public Class cVERAG_CustomsDeclarations
' ------------------------------------------------------------
' SQL: ZA-IDs ermitteln
' ------------------------------------------------------------
Dim eoriIn As String =
String.Join(",", EORI.
Where(Function(x) Not String.IsNullOrWhiteSpace(x)).
Select(Function(x) "'" & x.Replace("'", "''") & "'"))
Dim sqlstr As String =
"SELECT DISTINCT z.* " &
"FROM VERAG.dbo.tblVERAG_CustomsDeclarations z " &
@@ -233,9 +237,17 @@ Public Class cVERAG_CustomsDeclarations
" AND z.za_IsFinalDeclaration = 1 " &
" AND z.za_DeclarationDate >= @dateFrom " &
" AND z.za_DeclarationDate <= @dateTo " &
" AND p.zaParty_EORI = @eori " &
" AND p.zaParty_EORI IN (" & eoriIn & ") " &
" AND " & cbamWhere
If indirect Then
sqlstr &= " AND (
(za_System IN('DHF','DHF_UNISPED') AND za_RepresentationCode=3) OR
(za_System IN('TELOTEC') AND za_RepresentationCode=3) OR
(za_System IN('DAKOSY') AND za_RepresentationCode=2)
)"
End If
If ImportCountry <> "" Then
sqlstr &= " AND z.za_CountryImport = @importCountry "
End If
@@ -244,10 +256,10 @@ Public Class cVERAG_CustomsDeclarations
sqlstr &= " AND z.za_System = @sys "
End If
Using conn = sql.GetNewOpenConnectionFMZOLL()
Using conn = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand(sqlstr, conn)
cmd.Parameters.AddWithValue("@eori", EORI)
' cmd.Parameters.AddWithValue("@eori", EORI)
cmd.Parameters.AddWithValue("@dateFrom", datFrom)
cmd.Parameters.AddWithValue("@dateTo", datTo)
@@ -636,7 +648,7 @@ Public Class cVERAG_CustomsDeclarations_Item
Dim pi As PropertyInfo =
it.GetType().GetProperty(li.Scalarvariable)
If dr.Item(li.Text) Is DBNull.Value Then
If dr.Item(li.Text) Is DBNull.Value Then
pi.SetValue(it, Nothing)
Else
pi.SetValue(it, dr.Item(li.Text))