CBAM
This commit is contained in:
@@ -70,6 +70,7 @@ Public Class cVERAG_CustomsDeclarations
|
||||
Public Property za_Remarks As String
|
||||
Public Property za_Sachbearbeiter As String
|
||||
Public Property za_SachbearbeiterId As String
|
||||
Public Property za_TotGrossMass As Decimal?
|
||||
|
||||
Public Property Parties As New List(Of cVERAG_CustomsDeclarations_Parties)
|
||||
Public Property Items As New List(Of cVERAG_CustomsDeclarations_Item)
|
||||
@@ -142,7 +143,8 @@ Public Class cVERAG_CustomsDeclarations
|
||||
New SQLVariable("za_SendungsId", za_SendungsId),
|
||||
New SQLVariable("za_Remarks", za_Remarks),
|
||||
New SQLVariable("za_Sachbearbeiter", za_Sachbearbeiter),
|
||||
New SQLVariable("za_SachbearbeiterId", za_SachbearbeiterId)
|
||||
New SQLVariable("za_SachbearbeiterId", za_SachbearbeiterId),
|
||||
New SQLVariable("za_TotGrossMass", za_TotGrossMass)
|
||||
}
|
||||
End Function
|
||||
|
||||
@@ -204,6 +206,107 @@ Public Class cVERAG_CustomsDeclarations
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
||||
Dim LIST As New List(Of cVERAG_CustomsDeclarations)
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Try
|
||||
' ------------------------------------------------------------
|
||||
' CBAM Pattern (HSCode)
|
||||
' ------------------------------------------------------------
|
||||
Dim cbamWhere As String =
|
||||
VERAG_PROG_ALLGEMEIN.cGreendeal_CBAM_Trn.BuildCBAMPatternWhereClause("i.zaItem_HSCode")
|
||||
|
||||
' ------------------------------------------------------------
|
||||
' SQL: ZA-IDs ermitteln
|
||||
' ------------------------------------------------------------
|
||||
Dim sqlstr As String =
|
||||
"SELECT DISTINCT z.* " &
|
||||
"FROM VERAG.dbo.tblVERAG_CustomsDeclarations z " &
|
||||
"INNER JOIN VERAG.dbo.tblVERAG_CustomsDeclarations_Items i " &
|
||||
" ON z.za_Id = i.zaItem_zaId " &
|
||||
"INNER JOIN VERAG.dbo.tblVERAG_CustomsDeclarations_Parties p " &
|
||||
" ON z.za_Id = p.zaParty_zaId " &
|
||||
"WHERE z.za_REGIME = 'IMPORT' " &
|
||||
" AND z.za_IsFinalDeclaration = 1 " &
|
||||
" AND z.za_DeclarationDate >= @dateFrom " &
|
||||
" AND z.za_DeclarationDate <= @dateTo " &
|
||||
" AND p.zaParty_EORI = @eori " &
|
||||
" AND " & cbamWhere
|
||||
|
||||
If ImportCountry <> "" Then
|
||||
sqlstr &= " AND z.za_CountryImport = @importCountry "
|
||||
End If
|
||||
|
||||
If CustomsSystem <> "" Then
|
||||
sqlstr &= " AND z.za_System = @sys "
|
||||
End If
|
||||
|
||||
Using conn = sql.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand(sqlstr, conn)
|
||||
|
||||
cmd.Parameters.AddWithValue("@eori", EORI)
|
||||
cmd.Parameters.AddWithValue("@dateFrom", datFrom)
|
||||
cmd.Parameters.AddWithValue("@dateTo", datTo)
|
||||
|
||||
If ImportCountry <> "" Then
|
||||
cmd.Parameters.AddWithValue("@importCountry", ImportCountry)
|
||||
End If
|
||||
|
||||
If CustomsSystem <> "" Then
|
||||
cmd.Parameters.AddWithValue("@sys", CustomsSystem)
|
||||
End If
|
||||
|
||||
Using dr = cmd.ExecuteReader()
|
||||
|
||||
While dr.Read()
|
||||
|
||||
Dim CD As New cVERAG_CustomsDeclarations
|
||||
CD.hasEntry = False
|
||||
|
||||
' ------------------------------------------------
|
||||
' DIREKTE BEFÜLLUNG (wie gewünscht)
|
||||
' ------------------------------------------------
|
||||
For Each li In CD.getParameterList()
|
||||
Dim pi = CD.GetType().GetProperty(li.Scalarvariable)
|
||||
If pi Is Nothing Then Continue For
|
||||
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
pi.SetValue(CD, Nothing)
|
||||
Else
|
||||
pi.SetValue(CD, dr.Item(li.Text))
|
||||
End If
|
||||
Next
|
||||
|
||||
CD.hasEntry = True
|
||||
|
||||
' ------------------------------------------------
|
||||
' OPTIONALES NACHLADEN
|
||||
' ------------------------------------------------
|
||||
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)
|
||||
CD.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(CD.za_Id)
|
||||
CD.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(CD.za_Id)
|
||||
End If
|
||||
|
||||
LIST.Add(CD)
|
||||
|
||||
End While
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Catch ex As Exception
|
||||
cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
|
||||
Return LIST
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function loadByMRN(MRN As String, loadall As Boolean) As cVERAG_CustomsDeclarations
|
||||
Dim ZA As New cVERAG_CustomsDeclarations
|
||||
If If(MRN, "") = "" Then Return ZA
|
||||
@@ -717,7 +820,7 @@ Public Class cVERAG_CustomsDeclarations_Document
|
||||
New SQLVariable("zaDoc_DepreciationAmount", zaDoc_DepreciationAmount),
|
||||
New SQLVariable("zaDoc_DepreciationUnitmeasurement", zaDoc_DepreciationUnitmeasurement),
|
||||
New SQLVariable("zaDoc_DepreciationUnitmeasurementQualifier", zaDoc_DepreciationUnitmeasurementQualifier),
|
||||
New SQLVariable("zaDoc_Description ", zaDoc_Description)
|
||||
New SQLVariable("zaDoc_Description", zaDoc_Description)
|
||||
}
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user