diff --git a/DAKOSY_Worker/DAKOSY_Worker_lib.vbproj b/DAKOSY_Worker/DAKOSY_Worker_lib.vbproj
index f8c5c54..7121f6f 100644
--- a/DAKOSY_Worker/DAKOSY_Worker_lib.vbproj
+++ b/DAKOSY_Worker/DAKOSY_Worker_lib.vbproj
@@ -72,6 +72,8 @@
+
+
diff --git a/DAKOSY_Worker/cImporter_DHFToVERAG.vb b/DAKOSY_Worker/cImporter_DHFToVERAG.vb
new file mode 100644
index 0000000..39908c1
--- /dev/null
+++ b/DAKOSY_Worker/cImporter_DHFToVERAG.vb
@@ -0,0 +1,594 @@
+Imports System.Data.SqlClient
+Imports System.Reflection
+Imports java.lang
+Imports TELOTEC_Worker
+Imports VERAG_PROG_ALLGEMEIN
+
+Public Class cImporter_DHFToVERAG
+
+ Private SQL As New VERAG_PROG_ALLGEMEIN.SQL
+ Private Const EZOLL_DB As String = "EZOLL"
+
+
+ ' =====================================================================
+ ' MAIN ENTRY
+ ' =====================================================================
+ Public Function ImportEZOLLByLRN(CRN As String, EZOLL_DB As String, Optional overwrite As Boolean = True) As Boolean
+ Try
+ If String.IsNullOrWhiteSpace(CRN) Then Return False
+
+ ' ---------------------------------------------------------------
+ ' BASIS-REFERENZ (zsAnmRefs)
+ ' ---------------------------------------------------------------
+ Dim dtRefs As DataTable =
+ SQL.loadDgvBySql(
+ "SELECT TOP 1 * FROM zsAnmRefs WHERE CRN='" & CRN & "' ORDER BY GeaendertAm DESC",
+ EZOLL_DB)
+
+ If dtRefs Is Nothing OrElse dtRefs.Rows.Count = 0 Then Return False
+ Dim rRef = dtRefs.Rows(0)
+
+ Dim LizenzNr = rRef("LizenzNr")
+ Dim OperatorID = rRef("OperatorID")
+ Dim VorgangID = rRef("VorgangID")
+ Dim AnmID = rRef("AnmID")
+ ' MsgBox(AnmID)
+ Dim LRN As String = ToStringSafe(rRef("LRN"))
+
+ ' ---------------------------------------------------------------
+ ' DUPLIKAT
+ ' ---------------------------------------------------------------
+ If Not overwrite AndAlso ExistsInVERAG(CRN) Then Return False
+
+ ' ---------------------------------------------------------------
+ ' HEADER (zsAnmHea)
+ ' ---------------------------------------------------------------
+ Dim dtHea = SQL.loadDgvBySql(
+ $"SELECT * FROM zsAnmHea WHERE LizenzNr='{LizenzNr}' AND OperatorID={OperatorID} AND VorgangID='{VorgangID}' AND AnmID={AnmID}",
+ EZOLL_DB)
+
+ If dtHea.Rows.Count = 0 Then Return False
+ Dim h = dtHea.Rows(0)
+
+ Dim ZA As cVERAG_CustomsDeclarations = cVERAG_CustomsDeclarations.loadByMRN(CRN, False)
+
+ ZA.za_System = "DHF"
+ If EZOLL_DB = "EZOLL_UNISPED" Then ZA.za_System = "DHF_UNISPED"
+ ZA.za_CustomsSystem = "ACCS"
+ ZA.za_CustomsSystemCountry = "AT"
+ ZA.za_REGIME = "IMPORT"
+ ZA.za_IsExternalSystem = False
+ ZA.za_IsFinalDeclaration = True
+
+ ZA.za_MRN = CRN
+ ZA.za_LRN = LRN
+
+ ZA.za_DeclarationDate = ToNullableDate(h("DecDT"))
+ ZA.za_AcceptanceDate = ToNullableDate(h("AccDT"))
+ ZA.za_ReleaseDate = ToNullableDate(h("DecDT"))
+
+ ''ZA.za_CountryDispatch = ToStringSafe(h("Locs_Disp"))
+ ' ZA.za_CountryDestination = ToStringSafe(h("Locs_Dest"))
+ ZA.za_CountryImport = "AT"
+
+ ' ZA.za_MainProcedure = Left(ToStringSafe(h("ProcCd")), 2)
+
+
+ ' ZA.za_WarehouseCode = ToStringSafe(h("Locs_GdsLocCd"))
+
+ ' ---------------------------------------------------------------
+ ' TRANSPORT (zsAnmTransp)
+ ' ---------------------------------------------------------------
+ Dim dtTransp = SQL.loadDgvBySql(
+ $"SELECT * FROM zsAnmTransp WHERE LizenzNr='{LizenzNr}' AND OperatorID={OperatorID} AND VorgangID='{VorgangID}' AND AnmID={AnmID}",
+ EZOLL_DB)
+
+ If dtTransp.Rows.Count > 0 Then
+ ZA.za_MeansOfTransport_Vehicle = ToStringSafe(dtTransp.Rows(0)("DepIdnt"))
+ ZA.za_TransportModeBorder = ToStringSafe(dtTransp.Rows(0)("BordMo"))
+ End If
+
+ ' ---------------------------------------------------------------
+ ' VALUE DATA (zsAnmValData)
+ ' ---------------------------------------------------------------
+ Dim dtVal = SQL.loadDgvBySql(
+ $"SELECT * FROM zsAnmValData WHERE LizenzNr='{LizenzNr}' AND OperatorID={OperatorID} AND VorgangID='{VorgangID}' AND AnmID={AnmID}",
+ EZOLL_DB)
+
+ If dtVal.Rows.Count > 0 Then
+ ZA.za_InvoiceAmount = ToNullableDecimal(dtVal.Rows(0)("InvVal"))
+ ZA.za_InvoiceCurrency = ToStringSafe(dtVal.Rows(0)("InvCurr"))
+ End If
+
+ ' ---------------------------------------------------------------
+ ' PARTIES
+ ' ---------------------------------------------------------------
+ AddPartyFromEZOLL(ZA, "IMPORTER", "zsAnmConeeTra", LizenzNr, OperatorID, VorgangID, AnmID)
+ AddPartyFromEZOLL(ZA, "EXPORTER", "zsAnmConorTra", LizenzNr, OperatorID, VorgangID, AnmID)
+ AddPartyFromEZOLL(ZA, "DECLARANT", "zsAnmDeclarant", LizenzNr, OperatorID, VorgangID, AnmID)
+ LoadPartiesFromEZOLL(ZA, LizenzNr, OperatorID, VorgangID, AnmID)
+
+ ' ---------------------------------------------------------------
+ ' DOCUMENTS
+ ' ---------------------------------------------------------------
+ LoadEZOLL_HeaderDocuments_FromZsAnmDocument(ZA, LizenzNr, OperatorID, VorgangID, AnmID)
+
+ ' ---------------------------------------------------------------
+ ' DUTIES
+ ' ---------------------------------------------------------------
+ LoadEZOLL_Duties(ZA, LizenzNr, OperatorID, VorgangID, AnmID)
+
+
+ ' ---------------------------------------------------------------
+ ' POSITIONEN (zsAnmGdsitem)
+ ' ---------------------------------------------------------------
+ Dim dtItems = SQL.loadDgvBySql(
+ $"SELECT * FROM zsAnmGdsitem WHERE LizenzNr='{LizenzNr}' AND OperatorID={OperatorID} AND VorgangID='{VorgangID}' AND AnmID={AnmID} ORDER BY GdsItemID",
+ EZOLL_DB)
+
+ For Each r In dtItems.Rows
+ Dim it As New cVERAG_CustomsDeclarations_Item
+
+ it.zaItem_PosNo = r("GdsItemID")
+ it.zaItem_HSCode = ToStringSafe(r("ComCd"))
+ it.zaItem_HSAddCodes4 = ToStringSafe(r("ComCd"))
+ it.zaItem_Description = ToStringSafe(r("GdsDes"))
+ it.zaItem_OriginCountry = ToStringSafe(r("Orig"))
+ it.zaItem_NetMass = ToNullableDecimal(r("Net"))
+ it.zaItem_InvoiceValueEUR = ToNullableDecimal(r("ItVal"))
+ it.zaItem_StatisticalValueEUR = ToNullableDecimal(r("StatVal"))
+ it.zaItem_StatisticalValueEUR = ToNullableDecimal(r("StatVal"))
+
+ LoadEZOLL_HSAddCodes(it, LizenzNr, OperatorID, VorgangID, AnmID, r("GdsItemID"))
+ LoadEZOLL_ItemDocuments(it, LizenzNr, OperatorID, VorgangID, AnmID)
+
+ it.zaItem_MainProcedure = ToStringSafe(r("ProcCd"))
+ it.zaItem_AdditionalProc = ToStringSafe(r("ProcAddCd"))
+ it.zaItem_OriginCountry = ToStringSafe(r("Orig"))
+ it.zaItem_PreferenceCode = ToStringSafe(r("Pref"))
+ it.zaItem_QuotaNo = ToStringSafe(r("Quota"))
+ ' -------------------------------
+ ' POSITIONS-DOKUMENTE
+ ' -------------------------------
+ Dim dtDocs = SQL.loadDgvBySql(
+ $"SELECT * FROM zsAnmGdsItemDocCerts WHERE LizenzNr='{LizenzNr}' AND OperatorID={OperatorID} AND VorgangID='{VorgangID}' AND AnmID={AnmID} AND GdsItemID={r("GdsItemID")}",
+ EZOLL_DB)
+
+ 'For Each d In dtDocs.Rows
+ ' Dim doc As New cVERAG_CustomsDeclarations_Document With {
+ ' .zaDoc_Code = ToStringSafe(d("DocCd")),
+ ' .zaDoc_Reference = ToStringSafe(d("DRef")),
+ ' .zaDoc_Date = ToNullableDate(d("IssD"))
+ ' }
+ ' it.Documents.Add(doc)
+ 'Next
+
+ ZA.Items.Add(it)
+ Next
+
+ ' ---------------------------------------------------------------
+ ' SAVE
+ ' ---------------------------------------------------------------
+ Return ZA.SAVE()
+
+ Catch ex As Exception
+ cErrorHandler.ERR(ex.Message, ex.StackTrace, MethodInfo.GetCurrentMethod.Name)
+ Return False
+ End Try
+ End Function
+
+ Private Sub LoadEZOLL_Duties(ByRef ZA As cVERAG_CustomsDeclarations,
+ LizenzNr As String,
+ OperatorID As Integer,
+ VorgangID As String,
+ AnmID As Integer)
+
+ Dim sql As String =
+ " SELECT d.GdsItemID,
+ dc.Ty,
+ dc.Amnt,
+ dc.Curr,
+ dc.Base,
+ dc.RateUsed,
+ h.DefPayRef
+ FROM zzAktivitaet a
+ INNER JOIN ztIMsgGdsItem i
+ ON a.LizenzNr=i.LizenzNr AND a.OperatorID=i.OperatorID AND a.IMsgID=i.IMsgID
+ INNER JOIN ztIMsgGdsItemDutyCalc dc
+ ON i.LizenzNr=dc.LizenzNr AND i.OperatorID=dc.OperatorID
+ AND i.IMsgID=dc.IMsgID AND i.GdsItemID=dc.GdsItemID
+ INNER JOIN zsAnmGdsItem d
+ ON a.LizenzNr=d.LizenzNr AND a.OperatorID=d.OperatorID
+ AND a.VorgangID=d.VorgangID AND a.AnmID=d.AnmID
+ AND i.ItNr=d.ItNr
+ INNER JOIN zsAnmHea h
+ ON d.LizenzNr=h.LizenzNr AND d.OperatorID=h.OperatorID
+ AND d.VorgangID=h.VorgangID AND d.AnmID=h.AnmID
+ WHERE a.MsgTyp='EZ922'
+ AND NOT EXISTS (
+ SELECT 1 FROM zzAktivitaet b
+ WHERE b.MsgTyp='EZ922'
+ AND a.LizenzNr=b.LizenzNr
+ AND a.OperatorID=b.OperatorID
+ AND a.VorgangID=b.VorgangID
+ AND a.AnmID=b.AnmID
+ AND a.AktivitaetID < b.AktivitaetID
+ )
+ AND dc.Amnt IS NOT NULL
+ AND d.LizenzNr=@liz
+ AND d.OperatorID=@op
+ AND d.VorgangID=@vg
+ AND d.AnmID=@anm"
+
+ Dim p As New List(Of SQLVariable) From {
+ New SQLVariable("liz", LizenzNr),
+ New SQLVariable("op", OperatorID),
+ New SQLVariable("vg", VorgangID),
+ New SQLVariable("anm", AnmID)
+ }
+
+ Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql_Param(sql, "EZOLL", , p)
+ If dt Is Nothing OrElse dt.Rows.Count = 0 Then Exit Sub
+
+ For Each r As DataRow In dt.Rows
+
+ Dim duty As New cVERAG_CustomsDeclarations_Duty
+
+ duty.zaDuty_DutyType = ToStringSafe(r("Ty"))
+ duty.zaDuty_AmountEUR = ToNullableDecimal(r("Amnt"))
+ duty.zaDuty_Currency = If(ToStringSafe(r("Curr")) = "", "EUR", ToStringSafe(r("Curr")))
+
+ ' duty.zaDuty_BaseAmount = ToNullableDecimal(r("Base"))
+ ' duty.zaDuty_Rate = ToNullableDecimal(r("RateUsed"))
+
+ duty.zaDuty_AccountNo = ToStringSafe(r("DefPayRef"))
+
+ ZA.Duties.Add(duty)
+
+ Next
+
+ End Sub
+
+
+ Private Sub LoadEZOLL_ItemDocuments(ByRef IT As cVERAG_CustomsDeclarations_Item,
+ LizenzNr As String,
+ OperatorID As Integer,
+ VorgangID As String,
+ AnmID As Integer)
+
+ Dim sql As String =
+ "SELECT * FROM zsAnmGdsItemDocCerts " &
+ "WHERE LizenzNr=@liz " &
+ " AND OperatorID=@op " &
+ " AND VorgangID=@vg " &
+ " AND AnmID=@anm " &
+ "ORDER BY DocCertsID"
+
+ Dim p As New List(Of SQLVariable) From {
+ New SQLVariable("liz", LizenzNr),
+ New SQLVariable("op", OperatorID),
+ New SQLVariable("vg", VorgangID),
+ New SQLVariable("anm", AnmID)
+ }
+
+ Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql_Param(sql, EZOLL_DB, , p)
+ If dt Is Nothing OrElse dt.Rows.Count = 0 Then Exit Sub
+
+ For Each r As DataRow In dt.Rows
+
+ Dim doc As New cVERAG_CustomsDeclarations_Document
+
+ ' ------------------------------------------------------------
+ ' Kerndaten
+ ' ------------------------------------------------------------
+ doc.zaDoc_Code = ToStringSafe(r("DocCd"))
+ doc.zaDoc_Reference = ToStringSafe(r("DRef"))
+ doc.zaDoc_Date = ToStringSafe(r("IssD"))
+
+ doc.zaDoc_Presentation = ToStringSafe(r("Avail"))
+ doc.zaDoc_Description = ToStringSafe(r("DTy"))
+
+ ' ------------------------------------------------------------
+ ' Zusatzinformationen (optional, aber sauber)
+ ' ------------------------------------------------------------
+ 'doc.zaDoc_DepreciationAmount = ToNullableDecimal(r("Quant"))
+ doc.zaDoc_DepreciationUnitmeasurement = ToStringSafe(r("Unit"))
+ doc.zaDoc_DepreciationUnitmeasurementQualifier = ToStringSafe(r("WOUnit"))
+
+ IT.Documents.Add(doc)
+ Next
+
+ End Sub
+
+ ' =====================================================================
+ ' HELPER
+ ' =====================================================================
+ Private Sub AddPartyFromEZOLL(ByRef ZA As cVERAG_CustomsDeclarations,
+ role As String,
+ tableName As String,
+ LizenzNr As String, OperatorID As String, VorgangID As String, AnmID As String)
+
+ Dim dt = SQL.loadDgvBySql(
+ $"SELECT * FROM {tableName} WHERE LizenzNr='{LizenzNr}' AND OperatorID={OperatorID} AND VorgangID='{VorgangID}' AND AnmID={AnmID}",
+ EZOLL_DB)
+
+ If dt.Rows.Count = 0 Then Exit Sub
+ Dim r = dt.Rows(0)
+
+ Dim p As New cVERAG_CustomsDeclarations_Parties With {
+ .zaParty_Role = role,
+ .zaParty_Name = ToStringSafe(r("Na")),
+ .zaParty_Street = ToStringSafe(r("Strt")),
+ .zaParty_PostalCode = ToStringSafe(r("Pst")),
+ .zaParty_City = ToStringSafe(r("Cty")),
+ .zaParty_Country = ToStringSafe(r("Ctry")),
+ .zaParty_EORI = ToStringSafe(r("TIN"))
+ }
+
+ ZA.Parties.Add(p)
+ End Sub
+
+ Private Sub LoadEZOLL_HSAddCodes(ByRef item As cVERAG_CustomsDeclarations_Item,
+ LizenzNr As String,
+ OperatorID As Integer,
+ VorgangID As String,
+ AnmID As Integer,
+ GdsItemID As Integer)
+
+ Dim sql As String =
+ "SELECT AddCd " &
+ "FROM zsAnmGdsItemComCdAdd " &
+ "WHERE LizenzNr=@liz " &
+ " AND OperatorID=@op " &
+ " AND VorgangID=@vg " &
+ " AND AnmID=@anm " &
+ " AND GdsItemID=@gid " &
+ "ORDER BY sequenceNumber"
+
+ Dim p As New List(Of SQLVariable) From {
+ New SQLVariable("liz", LizenzNr),
+ New SQLVariable("op", OperatorID),
+ New SQLVariable("vg", VorgangID),
+ New SQLVariable("anm", AnmID),
+ New SQLVariable("gid", GdsItemID)
+ }
+
+ Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql_Param(sql, EZOLL_DB, , p)
+ If dt Is Nothing OrElse dt.Rows.Count = 0 Then Exit Sub
+
+ Dim idx As Integer = 1
+
+ For Each r As DataRow In dt.Rows
+ If idx > 10 Then Exit For ' VERAG-Modell: max. 10 Zusatzcodes
+
+ Dim code As String = ToStringSafe(r("AddCd"))
+ If String.IsNullOrWhiteSpace(code) Then Continue For
+
+ Select Case idx
+ Case 1 : item.zaItem_HSAddCodes1 = code
+ Case 2 : item.zaItem_HSAddCodes2 = code
+ Case 3 : item.zaItem_HSAddCodes3 = code
+ Case 4 : item.zaItem_HSAddCodes4 = code
+ Case 5 : item.zaItem_HSAddCodes5 = code
+ Case 6 : item.zaItem_HSAddCodes6 = code
+ Case 7 : item.zaItem_HSAddCodes7 = code
+ Case 8 : item.zaItem_HSAddCodes8 = code
+ Case 9 : item.zaItem_HSAddCodes9 = code
+ Case 10 : item.zaItem_HSAddCodes10 = code
+ End Select
+
+ idx += 1
+ Next
+
+ End Sub
+
+ Private Sub LoadEZOLL_HeaderDocuments_FromZsAnmDocument(
+ ByRef ZA As cVERAG_CustomsDeclarations,
+ LizenzNr As String,
+ OperatorID As Integer,
+ VorgangID As String,
+ AnmID As Integer)
+
+ Dim sql As String =
+ "SELECT * FROM zsAnmDocument " &
+ "WHERE LizenzNr=@liz " &
+ " AND OperatorID=@op " &
+ " AND VorgangID=@vg " &
+ " AND AnmID=@anm " &
+ " AND ISNULL(KzDeleted,0)=0 " &
+ "ORDER BY sequenceNumber"
+
+ Dim p As New List(Of SQLVariable) From {
+ New SQLVariable("liz", LizenzNr),
+ New SQLVariable("op", OperatorID),
+ New SQLVariable("vg", VorgangID),
+ New SQLVariable("anm", AnmID)
+ }
+
+ Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql_Param(sql, EZOLL_DB, , p)
+ If dt Is Nothing OrElse dt.Rows.Count = 0 Then Exit Sub
+
+ For Each r As DataRow In dt.Rows
+
+ Dim doc As New cVERAG_CustomsDeclarations_Document
+
+ ' ------------------------------------------------------------
+ ' Kerndaten
+ ' ------------------------------------------------------------
+ doc.zaDoc_Code = ToStringSafe(r("type"))
+
+
+ doc.zaDoc_Reference = ToStringSafe(r("referenceNumber"))
+ doc.zaDoc_Date = ToNullableDate(r("validityDate"))
+ 'doc.zaDoc_Section = ToStringSafe(r("DocumentTypID"))
+ doc.zaDoc_Description = ToStringSafe(r("text"))
+
+ ' ------------------------------------------------------------
+ ' Zusatzinformationen (optional, aber strukturell korrekt)
+ ' ------------------------------------------------------------
+ doc.zaDoc_Presentation = ToStringSafe(r("typeOfPackages"))
+
+ doc.zaDoc_DepreciationAmount = ToNullableDecimal(r("amount"))
+
+ doc.zaDoc_DepreciationUnitmeasurement =
+ ToStringSafe(r("measurementUnitAndQualifier"))
+
+ ' ------------------------------------------------------------
+ ' Freitext / Hinweise
+ ' ------------------------------------------------------------
+ If Not IsDBNull(r("text")) AndAlso ToStringSafe(r("text")) <> "" Then
+ doc.zaDoc_Reference =
+ (doc.zaDoc_Reference & " " & ToStringSafe(r("text"))).Trim()
+ End If
+
+ ZA.Documents.Add(doc)
+ Next
+
+ End Sub
+
+ Private Sub LoadPartiesFromEZOLL(ByRef ZA As cVERAG_CustomsDeclarations,
+ LizenzNr As String,
+ OperatorID As Integer,
+ VorgangID As String,
+ AnmID As Integer)
+
+ Dim sqlAdr As String =
+ "SELECT * FROM zsAnmAdr " &
+ "WHERE LizenzNr=@liz AND OperatorID=@op AND VorgangID=@vg AND AnmID=@anm"
+
+ Dim p As New List(Of SQLVariable) From {
+ New SQLVariable("liz", LizenzNr),
+ New SQLVariable("op", OperatorID),
+ New SQLVariable("vg", VorgangID),
+ New SQLVariable("anm", AnmID)
+ }
+
+ Dim dtAdr = SQL.loadDgvBySql_Param(sqlAdr, EZOLL_DB, , p)
+ If dtAdr Is Nothing OrElse dtAdr.Rows.Count = 0 Then Exit Sub
+
+ For Each r As DataRow In dtAdr.Rows
+
+ Dim party As New cVERAG_CustomsDeclarations_Parties
+
+ party.zaParty_Role = r("AdressTypID")
+
+ party.zaParty_EORI = ToStringSafe(r("identificationNumber"))
+ party.zaParty_Name = ToStringSafe(r("name"))
+ party.zaParty_Street = ToStringSafe(r("streetAndNumber"))
+ party.zaParty_PostalCode = ToStringSafe(r("postcode"))
+ party.zaParty_City = ToStringSafe(r("city"))
+ party.zaParty_Country = ToStringSafe(r("country"))
+
+ party.zaParty_ContactName = ToStringSafe(r("Contactname"))
+ party.zaParty_Phone = ToStringSafe(r("ContactphoneNumber"))
+ party.zaParty_Email = ToStringSafe(r("ContacteMailAdress"))
+
+ ZA.Parties.Add(party)
+ Next
+
+ End Sub
+ Private Function ExistsInVERAG(CRN As String) As Boolean
+ Dim sql =
+ "SELECT TOP 1 1 FROM tblVERAG_CustomsDeclarations " &
+ "WHERE za_System='EZOLL' AND (za_MRN=@CRN )"
+
+ Dim p As New List(Of SQLVariable) From {
+ New SQLVariable("CRN", CRN)
+ }
+
+ Dim dt = New SQL().loadDgvBySql_Param(sql, "VERAG", , p)
+ Return dt IsNot Nothing AndAlso dt.Rows.Count > 0
+ End Function
+
+ ' =====================================================================
+ ' PARTY HELPER
+ ' =====================================================================
+ Private Sub AddParty(ByRef za As cVERAG_CustomsDeclarations,
+ eori As String,
+ role As String,
+ name As Object,
+ street As Object,
+ plz As Object,
+ city As Object,
+ country As Object,
+ uid As Object)
+
+ If String.IsNullOrWhiteSpace(ToStringSafe(name)) Then Exit Sub
+
+ Dim p As New cVERAG_CustomsDeclarations_Parties With {
+ .zaParty_EORI = eori,
+ .zaParty_Role = role,
+ .zaParty_Name = ToStringSafe(name),
+ .zaParty_Street = ToStringSafe(street),
+ .zaParty_PostalCode = ToStringSafe(plz),
+ .zaParty_City = ToStringSafe(city),
+ .zaParty_Country = ToStringSafe(country),
+ .zaParty_VATNumber = ToStringSafe(uid)
+ }
+
+ za.Parties.Add(p)
+ End Sub
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ' =========================================================================
+ ' Small helpers (falls du sie schon hast, kannst du diese entfernen)
+ ' =========================================================================
+ Private Function ToStringSafe(v As Object) As String
+ If v Is Nothing Then Return Nothing
+ If v Is DBNull.Value Then Return Nothing
+ Dim s As String = TryCast(v, String)
+ If s IsNot Nothing Then Return s
+ Return Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ End Function
+
+ Private Function ToInt(v As Object) As Integer
+ If v Is Nothing Then Return 0
+ If v Is DBNull.Value Then Return 0
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim i As Integer
+ If Integer.TryParse(s, Globalization.NumberStyles.Any, Globalization.CultureInfo.InvariantCulture, i) Then Return i
+ Return 0
+ End Function
+
+ Private Function ToNullableDecimal(v As Object) As Decimal?
+ If v Is Nothing Then Return Nothing
+ If v Is DBNull.Value Then Return Nothing
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim d As Decimal
+ If Decimal.TryParse(s, Globalization.NumberStyles.Any, Globalization.CultureInfo.InvariantCulture, d) Then Return d
+ Return Nothing
+ End Function
+
+ Private Function ToNullableDate(v As Object) As Date?
+ If v Is Nothing Then Return Nothing
+ If v Is DBNull.Value Then Return Nothing
+ If TypeOf v Is Date Then Return CType(v, Date)
+
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim dt As Date
+ If Date.TryParse(s, Globalization.CultureInfo.InvariantCulture, Globalization.DateTimeStyles.None, dt) Then Return dt
+ Return Nothing
+ End Function
+
+ Private Function ToNullableBool(v As Object) As Boolean?
+ If v Is Nothing Then Return Nothing
+ If v Is DBNull.Value Then Return Nothing
+ If TypeOf v Is Boolean Then Return CType(v, Boolean)
+
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture).Trim().ToLowerInvariant()
+ If s = "J" OrElse s = "1" OrElse s = "true" OrElse s = "y" OrElse s = "yes" Then Return True
+ If s = "N" OrElse s = "0" OrElse s = "false" OrElse s = "n" OrElse s = "no" Then Return False
+ Return Nothing
+ End Function
+End Class
\ No newline at end of file
diff --git a/DAKOSY_Worker/cImporter_DakosyToVERAG.vb b/DAKOSY_Worker/cImporter_DakosyToVERAG.vb
index 0a16b1e..1b6bdd9 100644
--- a/DAKOSY_Worker/cImporter_DakosyToVERAG.vb
+++ b/DAKOSY_Worker/cImporter_DakosyToVERAG.vb
@@ -7,251 +7,352 @@ Public Class cImporter_DakosyToVERAG
' ========================================================================
' MAIN ENTRY
' ========================================================================
- Public Function ImportDakosyEZA(eza As cDakosyEZA) As Boolean
+ Public Function ImportDakosyEZA(MRN As String, Optional overwrite As Boolean = True) As Boolean
+ If MRN Is Nothing Then Return False
+ If MRN = "" Then Return False
+
+ Dim EZA = cDakosyEZA.LOADByMRN(MRN, True)
+ If EZA IsNot Nothing Then Return ImportDakosyEZA(EZA)
+ Return False
+ End Function
+ Public Function ImportDakosyEZA(eza As cDakosyEZA, Optional overwrite As Boolean = True) As Boolean
Try
- ' 1) Duplikatscheck auf Kopfebene (MRN / LRN + System)
- If ExistsInVERAG(eza) Then
- Console.WriteLine($"Skip import (duplicate): MRN={If(eza.eza_MRN, "")} / LRN={If(eza.eza_ANR, "")}")
+ If eza Is Nothing Then Return False
+ If String.IsNullOrWhiteSpace(eza.eza_MRN) AndAlso String.IsNullOrWhiteSpace(eza.eza_ANR) Then Return False
+
+ If If(eza.eza_MRN, "") = "" AndAlso eza.eza_ANR.ToString.StartsWith("ATA") Then ' Keine finale Anmeldung!
Return False
End If
- ' 2) HEADER anlegen
- Dim zaId = Save_Header(eza)
- If zaId <= 0 Then
- Console.WriteLine("Error: Header save failed")
- Return False
+ ' ================================================================
+ ' DUPLIKATSPRÜFUNG
+ ' ================================================================
+ If Not overwrite Then
+ If ExistsInVERAG(eza) Then Return False
End If
- ' 3) ITEMS speichern (alle Positionen – kein eigener Duplikatscheck)
- Save_Items(eza, zaId)
+ ' ================================================================
+ ' HEADER
+ ' ================================================================
+ Dim VERAG_ZA As cVERAG_CustomsDeclarations
+ If If(eza.eza_MRN, If(eza.eza_ANR, "")) = "" Then
+ VERAG_ZA = New cVERAG_CustomsDeclarations
+ Else
+ VERAG_ZA = cVERAG_CustomsDeclarations.loadByMRN(If(eza.eza_MRN, If(eza.eza_ANR, "")), False)
+ End If
- ' 4) DUTIES speichern (aus AUFSCHUB – kein eigener Duplikatscheck)
- Save_Duties(eza, zaId)
+ VERAG_ZA.za_System = "DAKOSY"
+ VERAG_ZA.za_CustomsSystem = "ATLAS"
+ VERAG_ZA.za_REGIME = "IMPORT"
+ VERAG_ZA.za_CustomsSystemCountry = "DE"
+ VERAG_ZA.za_IsExternalSystem = False
+ VERAG_ZA.za_IsFinalDeclaration = True
- ' 5) DOCS speichern (Unterlagen auf Kopfebene – kein eigener Duplikatscheck)
- Save_Docs(eza, zaId)
+ VERAG_ZA.za_Firma = eza.eza_firma
+ VERAG_ZA.za_Niederlassung = eza.eza_niederlassung
- Return True
+ VERAG_ZA.za_MRN = If(eza.eza_MRN, eza.eza_ANR)
+ VERAG_ZA.za_LRN = eza.eza_ObjectName
+
+ If eza.eza_Anmeldedatum IsNot Nothing AndAlso eza.eza_Anmeldedatum.ToString <> "" Then
+ VERAG_ZA.za_DeclarationDate = CDate(eza.eza_Anmeldedatum)
+ VERAG_ZA.za_ReleaseDate = CDate(eza.eza_Anmeldedatum)
+ Else
+
+ Dim dateumRelease As String = (New VERAG_PROG_ALLGEMEIN.SQL).DLookup("isnull(dySt_DakosyTransaktionsDatum,'')", "[tblDakosy_Statusmeldungen]", " dySt_status = 60 And dySt_dyId = '" & eza.eza_dyaAnmID & "' Order By [dySt_DakosyTransaktionsDatum] desc", "FMZOLL",)
+ If dateumRelease <> "" AndAlso IsDate(dateumRelease) Then
+ VERAG_ZA.za_DeclarationDate = CDate(dateumRelease)
+ VERAG_ZA.za_ReleaseDate = CDate(dateumRelease)
+ Else
+ VERAG_ZA.za_DeclarationDate = ToNullableDate(If(eza.eza_Anmeldedatum, eza.eza_LetzteBearbeitung))
+ VERAG_ZA.za_ReleaseDate = ToNullableDate(If(eza.eza_Anmeldedatum, eza.eza_LetzteBearbeitung))
+ End If
+ End If
+
+ VERAG_ZA.za_MainProcedure = eza.eza_VerfahrenBeantragtCode
+ VERAG_ZA.za_RepresentationCode = eza.eza_VertretungsVerhaeltnisCode
+ VERAG_ZA.za_FiscalRepFlag = ToNullableBool(eza.eza_FiskalvertretungKz)
+ VERAG_ZA.za_ApplicantVATNo = ToStringSafe(eza.eza_UstIdAnmelder)
+ VERAG_ZA.za_ApplicantTaxOffice = ToStringSafe(eza.eza_FinanzamtAnmelder)
+ VERAG_ZA.za_TaxDeduction = ToNullableBool(eza.eza_Vorsteuerabzug)
+
+ VERAG_ZA.za_CountryDispatch = eza.eza_VersendungsLandCode
+ VERAG_ZA.za_CountryDestination = eza.eza_Bestimmungsland
+ VERAG_ZA.za_CountryDestinationState = eza.eza_Bestimmungsbundesland
+
+ VERAG_ZA.za_ContainerNr1 = eza.eza_ContainerNr1
+ VERAG_ZA.za_ContainerNr2 = eza.eza_ContainerNr2
+ VERAG_ZA.za_ContainerNr3 = eza.eza_ContainerNr3
+ VERAG_ZA.za_ContainerNr4 = eza.eza_ContainerNr4
+ VERAG_ZA.za_ContainerNr5 = eza.eza_ContainerNr5
+ VERAG_ZA.za_ContainerNr6 = eza.eza_ContainerNr6
+ VERAG_ZA.za_ContainerNr7 = eza.eza_ContainerNr7
+ VERAG_ZA.za_ContainerNr8 = eza.eza_ContainerNr8
+ VERAG_ZA.za_ContainerNr9 = eza.eza_ContainerNr9
+
+ VERAG_ZA.za_MeansOfTransport_Vehicle = eza.eza_KennzeichenNameBefoerderungsmittelAnkunft
+ VERAG_ZA.za_MeansOfTransport_Nationality = eza.eza_BeförderungsmittelGrenzeStaatszugehörigkeitCode
+ VERAG_ZA.za_MeansOfTransport_Type = eza.eza_BeförderungsmittelGrenzeArt
+ VERAG_ZA.za_CountryImport = "DE"
+ VERAG_ZA.za_WarehouseCode = eza.eza_Warenort
+ VERAG_ZA.za_InvoiceAmount = eza.eza_Rechnungspreis
+ VERAG_ZA.za_InvoiceCurrency = eza.eza_Rechnungswaehrung
+ VERAG_ZA.za_DV1Flag = ToNullableBool(eza.eza_DV1Kz)
+ VERAG_ZA.za_PrevDocument_No = eza.eza_VorpapierNr
+ VERAG_ZA.za_PrevDocument_Type = eza.eza_VorpapierArtCode
+
+ VERAG_ZA.za_Incoterms = eza.eza_LieferbedingungCode
+ VERAG_ZA.za_IncotermsPlace = eza.eza_LieferbedingungOrt
+
+ VERAG_ZA.za_Sachbearbeiter = eza.eza_AnmeldenderBearbeiterName
+
+ Dim DY = cDakosy_Zollanmeldungen.LOADById(eza.eza_dyaAnmID)
+ If DY IsNot Nothing Then
+ VERAG_ZA.za_AvisoId = DY.dy_AvisoId
+ VERAG_ZA.za_SendungsId = DY.dy_SendungsId
+ End If
+
+ VERAG_ZA.za_TransportModeBorder = ToStringSafe(eza.eza_VerkehrszweigGrenze)
+
+ ' ================================================================
+ ' ADRESSEN
+ ' ================================================================
+ If eza.eza_ADRESSEN IsNot Nothing Then
+ For Each p In eza.eza_ADRESSEN
+
+ Dim party As New cVERAG_CustomsDeclarations_Parties
+
+ party.zaParty_Role = p.ezaAd_AdressTyp
+ party.zaParty_EORI = p.ezaAd_TeilnehmerEORI
+ party.zaParty_EORI_NL = p.ezaAd_TeilnehmerNLNR
+ party.zaParty_Name = p.ezaAd_NameFirma1
+ party.zaParty_Street = p.ezaAd_StrasseHausNr1
+ party.zaParty_PostalCode = p.ezaAd_PLZ
+ party.zaParty_City = p.ezaAd_Ort
+ party.zaParty_Country = p.ezaAd_LandCode
+ 'party.zaParty_TIN = p.
+ party.zaParty_VATNumber = p.ezaAd_UStIDAnmelder
+ party.zaParty_TaxOffice = p.ezaAd_FinanzamtIDAnmelder
+
+
+ If If(party.zaParty_EORI, "") <> "" Then
+
+ Dim AD As VERAG_PROG_ALLGEMEIN.cAdressen = cZOLL_IMPORT.getAdresseFromEORI(party.zaParty_EORI, "", "", True)
+
+ If AD IsNot Nothing Then
+ party.zaParty_Name = (If(AD.Name_1, "") & " " & If(AD.Name_2, "")).trim
+ party.zaParty_Country = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2Land(AD.LandKz)
+ party.zaParty_City = AD.Ort
+ party.zaParty_Street = AD.Straße
+ 'party.ImporterAddressNumber = ""
+ party.zaParty_PostalCode = AD.PLZ
+ 'party.ImporterEmail = AD.E_Mail
+ 'party.ImporterPhone = AD.Telefon
+ End If
+
+ End If
+
+
+ VERAG_ZA.Parties.Add(party)
+ Next
+ End If
+
+ ' ================================================================
+ ' ABGABEN
+ ' ================================================================
+ If eza.eza_AUFSCHUB IsNot Nothing Then
+ For Each d In eza.eza_AUFSCHUB
+
+ Dim duty As New cVERAG_CustomsDeclarations_Duty
+
+ duty.zaDuty_ApplicationType = d.ezaAfb_ArtAufschubantrag
+ duty.zaDuty_AccountType = d.ezaAfb_Aufschubart
+ duty.zaDuty_AccountHeadCustoms = d.ezaAfb_HZA
+ duty.zaDuty_AccountNo = d.ezaAfb_KontoNr
+ duty.zaDuty_AccountEORI = d.ezaAfb_AufschubnehmerEORI
+ duty.zaDuty_AccountHolderName = d.AufschubnehmerName
+ duty.zaDuty_DutyType = d.ezaAfb_AbgabeArt
+ duty.zaDuty_BIN = d.ezaAfb_AufschuBIN
+ duty.zaDuty_AmountEUR = ToNullableDecimal(d.ezaAfb_Abgabenbetrag)
+ duty.zaDuty_AmountForeign = ToNullableDecimal(d.ezaAfb_Abgabenbetrag)
+ duty.zaDuty_Currency = "EUR"
+ duty.zaDuty_LimitDate = ToNullableDate(d.ezaAfb_Faelligkeit)
+
+ VERAG_ZA.Duties.Add(duty)
+ Next
+ End If
+
+ ' ================================================================
+ ' HEADER-UNTERLAGEN (ItemId = NULL)
+ ' ================================================================
+ If eza.eza_UNTERLAGEN IsNot Nothing Then
+ For Each ul In eza.eza_UNTERLAGEN
+
+ Dim doc As New cVERAG_CustomsDeclarations_Document
+ doc.zaDoc_Section = ul.ezaUl_Bereich
+ doc.zaDoc_ItemId = Nothing
+ doc.zaDoc_Code = ul.ezaUl_Art
+ doc.zaDoc_Reference = ul.ezaUl_Nummer
+
+ doc.zaDoc_Date = ul.ezaUl_DatumAusstellung
+
+
+
+ VERAG_ZA.Documents.Add(doc)
+ Next
+ End If
+
+ ' ================================================================
+ ' POSITIONEN + POSITIONS-UNTERLAGEN
+ ' ================================================================
+ If eza.eza_WARENPOS IsNot Nothing Then
+ For Each wp In eza.eza_WARENPOS
+
+ Dim item As New cVERAG_CustomsDeclarations_Item
+
+ item.zaItem_PosNo = ToInt(wp.ezaWP_PositionsNummer)
+ item.zaItem_ArticleCode = wp.ezaWP_Artikelnummer
+
+ item.zaItem_HSCode = wp.ezaWP_WarennummerEZT
+ item.zaItem_HSAddition1 = wp.ezaWP_Warennummerzusatz1
+ item.zaItem_HSAddition2 = wp.ezaWP_Warennummerzusatz2
+ item.zaItem_HSAddCodes1 = wp.ezaWP_WarennummerZusatzCode1
+ item.zaItem_HSAddCodes2 = wp.ezaWP_WarennummerZusatzCode2
+ item.zaItem_HSAddCodes3 = wp.ezaWP_WarennummerZusatzCode3
+ item.zaItem_HSAddCodes4 = wp.ezaWP_WarennummerZusatzCode4
+ item.zaItem_HSAddCodes5 = wp.ezaWP_WarennummerZusatzCode5
+ item.zaItem_HSAddCodes6 = wp.ezaWP_WarennummerZusatzCode6
+ item.zaItem_HSAddCodes7 = wp.ezaWP_WarennummerZusatzCode7
+ item.zaItem_HSAddCodes8 = wp.ezaWP_WarennummerZusatzCode8
+ item.zaItem_HSAddCodes9 = wp.ezaWP_WarennummerZusatzCode9
+ item.zaItem_HSAddCodes10 = wp.ezaWP_WarennummerZusatzCode10
+
+ item.zaItem_Description = wp.ezaWP_Warenbezeichnung
+ item.zaItem_PrevProcedure = wp.ezaWP_VerfahrensCodeVorangegangenesVerfahren
+ item.zaItem_PreferentialCountry = wp.ezaWP_Praeferenzursprungsland
+
+
+ item.zaItem_PackageColli = (wp.ezaWP_PackstueckAnzahl)
+ item.zaItem_PackageType = wp.ezaWP_PackstueckArt
+
+ item.zaItem_GrossMass = ToNullableDecimal(wp.ezaWP_Rohmasse)
+ item.zaItem_NetMass = ToNullableDecimal(wp.ezaWP_Eigenmasse)
+
+
+ item.zaItem_InvoiceValueForeign = ToNullableDecimal(wp.ezaWP_Artikelpreis)
+ item.zaItem_InvoiceCurrency = wp.ezaWP_ArtikelpreisWaehrung
+ If If(wp.ezaWP_ArtikelpreisWaehrung, "") = "EUR" Then
+ item.zaItem_InvoiceValueEUR = ToNullableDecimal(wp.ezaWP_Artikelpreis)
+ End If
+
+ item.zaItem_CustomsValueEUR = ToNullableDecimal(wp.ezaWP_Zollwert)
+ item.zaItem_StatisticalValueEUR = ToNullableDecimal(wp.ezaWP_AHStatWert)
+
+ item.zaItem_OriginCountry = wp.ezaWP_UrsprungslandCode
+ item.zaItem_PreferenceCode = wp.ezaWP_BeguenstigungBenatragtCode
+ item.zaItem_PosAddition = If(wp.ezaWP_PositionsZusatz, "")
+
+ ' -------------------------------
+ ' POSITIONS-UNTERLAGEN
+ ' -------------------------------
+ If wp.ezaWP_UNTERLAGEN IsNot Nothing Then
+ For Each ul In wp.ezaWP_UNTERLAGEN
+
+ Dim doc As New cVERAG_CustomsDeclarations_Document
+ doc.zaDoc_Section = ul.ezaWpUl_Bereich
+ doc.zaDoc_Code = ul.ezaWpUl_Art
+ doc.zaDoc_Reference = ul.ezaWpUl_Nummer
+
+ doc.zaDoc_Date = ToNullableDate(ul.ezaWpUl_DatumAusstellung)
+
+ doc.zaDoc_Presentation = ul.ezaWpUl_VorlageKz
+
+ doc.zaDoc_DepreciationAmount = (ul.ezaWpUl_AbschreibungsMenge)
+ doc.zaDoc_DepreciationUnitmeasurement = ul.ezaWpUl_AbschreibungsMengeMasseinheit
+ doc.zaDoc_DepreciationUnitmeasurementQualifier = ul.ezaWpUl_AbschreibungsMengeMasseinheitQualifier
+
+
+
+ item.Documents.Add(doc)
+ Next
+ End If
+
+ VERAG_ZA.Items.Add(item)
+ Next
+ End If
+
+ ' ================================================================
+ ' SAVE
+ ' ================================================================
+ Return VERAG_ZA.SAVE()
Catch ex As Exception
- VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(
- ex.Message,
- ex.StackTrace,
- Reflection.MethodInfo.GetCurrentMethod().Name
- )
+ cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
Return False
End Try
End Function
-
- ' ========================================================================
- ' DUPLICATE CHECK : MRN / LRN + SYSTEM
- ' ========================================================================
+ ' =====================================================================
+ ' DUPLIKATSPRÜFUNG
+ ' =====================================================================
Private Function ExistsInVERAG(eza As cDakosyEZA) As Boolean
- Dim sqlStr As String =
- "SELECT TOP 1 1
- FROM tblVERAG_Zollanmeldung
- WHERE za_System = 'DAKOSY'
- AND (
- (za_MRN = @mrn AND @mrn IS NOT NULL)
- OR (za_LRN = @lrn AND @lrn IS NOT NULL)
- )"
+ Dim sql As String =
+ "SELECT TOP 1 1 FROM tblVERAG_CustomsDeclarations " &
+ "WHERE za_System='DAKOSY' " &
+ "AND (za_MRN=@mrn OR za_MRN=@anr)"
Dim p As New List(Of SQLVariable) From {
- New SQLVariable("@mrn", If(eza.eza_MRN, DBNull.Value)),
- New SQLVariable("@lrn", If(eza.eza_ANR, DBNull.Value))
- }
-
- Dim dt = SQL.loadDgvBySql_Param(sqlStr, "FMZOLL",, p)
- Return (dt IsNot Nothing AndAlso dt.Rows.Count > 0)
+ New SQLVariable("mrn", eza.eza_MRN),
+ New SQLVariable("anr", eza.eza_ANR)
+ }
+ Dim dt = New SQL().loadDgvBySql_Param(sql, "VERAG", , p)
+ Return dt IsNot Nothing AndAlso dt.Rows.Count > 0
+ End Function
+ ' =========================================================================
+ ' Small helpers (falls du sie schon hast, kannst du diese entfernen)
+ ' =========================================================================
+ Private Function ToStringSafe(v As Object) As String
+ If v Is Nothing Then Return Nothing
+ Dim s As String = TryCast(v, String)
+ If s IsNot Nothing Then Return s
+ Return Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
End Function
-
- ' ========================================================================
- ' HEADER SAVE
- ' ========================================================================
- Private Function Save_Header(eza As cDakosyEZA) As Integer
-
- Dim list As New List(Of SQLVariable)
-
- ' PK wird von SQL doSQLVarListID gesetzt
- list.Add(New SQLVariable("za_Id", Nothing, , True, True))
-
- list.Add(New SQLVariable("za_System", "DAKOSY"))
- list.Add(New SQLVariable("za_MRN", eza.eza_MRN))
- list.Add(New SQLVariable("za_LRN", eza.eza_ObjectName))
-
- list.Add(New SQLVariable("za_Firma", eza.eza_firma))
- list.Add(New SQLVariable("za_Zollstelle", eza.eza_AdressierteZollstelle))
- list.Add(New SQLVariable("za_Sachbearbeiter", eza.eza_Bearbeiter))
-
- ' interne Zuordnungen
- list.Add(New SQLVariable("AvisoId", eza.eza_dyaAnmID))
- list.Add(New SQLVariable("SendungsId", Nothing))
-
- Dim cmd As String =
- "INSERT INTO tblVERAG_Zollanmeldung
- (za_System,
- za_MRN,
- za_LRN,
- za_Firma,
- za_Zollstelle,
- za_Sachbearbeiter,
- AvisoId,
- SendungsId)
- VALUES
- (@za_System,
- @za_MRN,
- @za_LRN,
- @za_Firma,
- @za_Zollstelle,
- @za_Sachbearbeiter,
- @AvisoId,
- @SendungsId);
- SELECT SCOPE_IDENTITY()"
-
- Dim newId = SQL.doSQLVarListID(0, cmd, "FMZOLL", , list)
-
-
- Return CInt(newId)
-
+ Private Function ToInt(v As Object) As Integer
+ If v Is Nothing Then Return 0
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim i As Integer
+ If Integer.TryParse(s, Globalization.NumberStyles.Any, Globalization.CultureInfo.InvariantCulture, i) Then Return i
+ Return 0
End Function
+ Private Function ToNullableDecimal(v As Object) As Decimal?
+ If v Is Nothing Then Return Nothing
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim d As Decimal
+ If Decimal.TryParse(s, Globalization.NumberStyles.Any, Globalization.CultureInfo.InvariantCulture, d) Then Return d
+ Return Nothing
+ End Function
- ' ========================================================================
- ' ITEMS SAVE (alle Positionen, kein Duplikatscheck)
- ' ========================================================================
- Private Sub Save_Items(eza As cDakosyEZA, zaId As Integer)
+ Private Function ToNullableDate(v As Object) As Date?
+ If v Is Nothing Then Return Nothing
+ If TypeOf v Is Date Then Return CType(v, Date)
- If eza.eza_WARENPOS Is Nothing Then Exit Sub
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim dt As Date
+ If Date.TryParse(s, Globalization.CultureInfo.InvariantCulture, Globalization.DateTimeStyles.None, dt) Then Return dt
+ Return Nothing
+ End Function
- For Each pos As cDakosy_EZA_Warenposition In eza.eza_WARENPOS
-
- Dim list As New List(Of SQLVariable)
-
- list.Add(New SQLVariable("za_Id", zaId))
-
- ' PosNr / Artikel / HS
- list.Add(New SQLVariable("zaItem_PosNo", pos.ezaWP_PositionsNummer))
- list.Add(New SQLVariable("zaItem_ArticleCode", pos.ezaWP_Artikelnummer))
- list.Add(New SQLVariable("zaItem_HSCode", pos.ezaWP_WarennummerEZT))
-
- ' Ursprung / Origin
- list.Add(New SQLVariable("zaItem_OriginCountry", pos.ezaWP_UrsprungslandCode))
-
- ' Zollwert / Statistikwert
- list.Add(New SQLVariable("zaItem_CustomsValue", pos.ezaWP_Zollwert))
- list.Add(New SQLVariable("zaItem_StatisticalValue", pos.ezaWP_AHStatWert))
-
- ' Begünstigungscode (Dakosy: ezaWP_BeguenstigungBenatragtCode)
- list.Add(New SQLVariable("zaItem_BeguenstigungCode", pos.ezaWP_BeguenstigungBenatragtCode))
-
- Dim cmd As String =
- "INSERT INTO tblVERAG_Zollanmeldung_Items
- (za_Id,
- zaItem_PosNo,
- zaItem_ArticleCode,
- zaItem_HSCode,
- zaItem_OriginCountry,
- zaItem_CustomsValue,
- zaItem_StatisticalValue,
- zaItem_BeguenstigungCode)
- VALUES
- (@za_Id,
- @zaItem_PosNo,
- @zaItem_ArticleCode,
- @zaItem_HSCode,
- @zaItem_OriginCountry,
- @zaItem_CustomsValue,
- @zaItem_StatisticalValue,
- @zaItem_BeguenstigungCode)"
-
- SQL.doSQLVarList(cmd, "FMZOLL", , list)
-
- Next
-
- End Sub
-
-
- ' ========================================================================
- ' DUTIES SAVE (alle AUFSCHUB-Einträge, kein Duplikatscheck)
- ' ========================================================================
- Private Sub Save_Duties(eza As cDakosyEZA, zaId As Integer)
-
- If eza.eza_AUFSCHUB Is Nothing Then Exit Sub
-
- For Each duty As cDakosy_EZA_Aufschub In eza.eza_AUFSCHUB
-
- Dim list As New List(Of SQLVariable)
-
- list.Add(New SQLVariable("za_Id", zaId))
-
- ' Dakosy-Aufschub Felder:
- ' ezaAfb_AbgabeArt -> DutyType
- ' ezaAfb_Abgabenbetrag -> Amount / AmountEUR
- list.Add(New SQLVariable("DutyType", duty.ezaAfb_AbgabeArt))
- list.Add(New SQLVariable("Amount", duty.ezaAfb_Abgabenbetrag))
-
- ' In der Aufschubtabelle gibt es keine Fremdwährungsspalte,
- ' i.d.R. ist der Betrag EUR -> Currency/AmountEUR entsprechend setzen
- list.Add(New SQLVariable("Currency", "EUR"))
- list.Add(New SQLVariable("AmountEUR", duty.ezaAfb_Abgabenbetrag))
-
- Dim cmd As String =
-"INSERT INTO tblVERAG_Zollanmeldung_Duties
- (za_Id,
- DutyType,
- Amount,
- Currency,
- AmountEUR)
- VALUES
- (@za_Id,
- @DutyType,
- @Amount,
- @Currency,
- @AmountEUR)"
-
- SQL.doSQLVarList(cmd, "FMZOLL", , list)
-
- Next
-
- End Sub
-
-
- ' ========================================================================
- ' DOCS SAVE (alle Unterlagen auf Kopfebene, kein Duplikatscheck)
- ' ========================================================================
- Private Sub Save_Docs(eza As cDakosyEZA, zaId As Integer)
-
- If eza.eza_UNTERLAGEN Is Nothing Then Exit Sub
-
- For Each d As cDakosy_EZA_Unterlagen In eza.eza_UNTERLAGEN
-
- Dim list As New List(Of SQLVariable)
-
- list.Add(New SQLVariable("za_Id", zaId))
- list.Add(New SQLVariable("Level", "H")) ' H = Header
- list.Add(New SQLVariable("DocType", d.ezaUl_Art))
- list.Add(New SQLVariable("DocNumber", d.ezaUl_Nummer))
-
- Dim cmd As String =
-"INSERT INTO tblVERAG_Zollanmeldung_Docs
- (za_Id,
- Level,
- DocType,
- DocNumber)
- VALUES
- (@za_Id,
- @Level,
- @DocType,
- @DocNumber)"
-
- SQL.doSQLVarList(cmd, "FMZOLL", , list)
-
- Next
-
- End Sub
+ Private Function ToNullableBool(v As Object) As Boolean?
+ If v Is Nothing Then Return Nothing
+ If TypeOf v Is Boolean Then Return CType(v, Boolean)
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture).Trim().ToLowerInvariant()
+ If s = "J" OrElse s = "1" OrElse s = "true" OrElse s = "y" OrElse s = "yes" Then Return True
+ If s = "N" OrElse s = "0" OrElse s = "false" OrElse s = "n" OrElse s = "no" Then Return False
+ Return Nothing
+ End Function
End Class
\ No newline at end of file
diff --git a/DAKOSY_Worker/cImporter_TelotecToVERAG.vb b/DAKOSY_Worker/cImporter_TelotecToVERAG.vb
new file mode 100644
index 0000000..5094516
--- /dev/null
+++ b/DAKOSY_Worker/cImporter_TelotecToVERAG.vb
@@ -0,0 +1,289 @@
+Imports System.Data.SqlClient
+Imports System.Reflection
+Imports java.lang
+Imports TELOTEC_Worker
+Imports VERAG_PROG_ALLGEMEIN
+
+Public Class cImporter_TelotecToVERAG
+
+ Private SQL As New VERAG_PROG_ALLGEMEIN.SQL
+
+ ' =====================================================================
+ ' MAIN ENTRY
+ ' =====================================================================
+ Public Function ImportTelotec(CRN As String, Optional overwrite As Boolean = True) As Boolean
+
+ If CRN Is Nothing Then Return False
+ If CRN = "" Then Return False
+
+ Dim cTelotec_Anmeldung = TELOTEC_Worker.cTelotec_Anmeldung.LOADByCRN(CRN, True)
+
+ If cTelotec_Anmeldung IsNot Nothing Then Return ImportTelotec(cTelotec_Anmeldung, overwrite)
+ Return False
+ End Function
+
+ Public Function ImportTelotec(tel As cTelotec_Anmeldung, Optional overwrite As Boolean = True) As Boolean
+ Try
+ If tel Is Nothing Then Return False
+ If String.IsNullOrWhiteSpace(ToStringSafe(tel.Refs_LRN)) AndAlso
+ String.IsNullOrWhiteSpace(ToStringSafe(tel.Refs_CRN)) Then Return False
+
+ ' ================================================================
+ ' DUPLIKATSPRÜFUNG
+ ' ================================================================
+ If Not overwrite Then
+ If ExistsInVERAG(tel) Then Return False
+ End If
+
+ ' ================================================================
+ ' HEADER
+ ' ================================================================
+ 'Dim mrnOrLrn As String = If(ToStringSafe(tel.Refs_CRN)
+ Dim ZA As cVERAG_CustomsDeclarations = cVERAG_CustomsDeclarations.loadByMRN(tel.Refs_CRN, False)
+
+ ZA.za_System = "TELOTEC"
+ ZA.za_CustomsSystem = "ACCS"
+ ZA.za_CustomsSystemCountry = "AT"
+ ZA.za_REGIME = "IMPORT"
+ ZA.za_IsExternalSystem = False
+ ZA.za_IsFinalDeclaration = True
+
+ ZA.za_Firma = ToStringSafe(tel.telanm_firma)
+ ZA.za_Niederlassung = ToStringSafe(tel.telanm_niederlassung)
+
+ ZA.za_MRN = ToStringSafe(tel.Refs_CRN)
+ ZA.za_LRN = ToStringSafe(tel.Refs_LRN)
+
+
+ ZA.za_RepresentationCode = ToStringSafe(tel.Declarant_DecRep)
+
+
+ ZA.za_CustomsOffice = ToStringSafe(tel.Locs_CustPlc)
+ ZA.za_EntryCustomsOffice = ToStringSafe(tel.EntryCO_Ref)
+
+ ZA.za_DeclarationDate = ToNullableDate(tel.Hea_DecDT)
+ ZA.za_AcceptanceDate = ToNullableDate(tel.Hea_AccDT)
+ ZA.za_ReleaseDate = ToNullableDate(tel.Hea_DecDT)
+
+ ZA.za_MainProcedure = ToStringSafe(tel.Hea_DecTy)
+
+ ZA.za_MeansOfTransport_Vehicle = ToStringSafe(tel.Transp_DepIdnt)
+ ZA.za_MeansOfTransport_Nationality = ToStringSafe(tel.Transp_DepNat)
+ ZA.za_MeansOfTransport_Type = ToStringSafe(tel.Transp_DepTy)
+
+ ZA.za_TransportModeBorder = ToStringSafe(tel.Transp_BordMo)
+ ZA.za_TransportModeInland = ToStringSafe(tel.Transp_InMo)
+
+ ZA.za_CountryDispatch = ToStringSafe(tel.Locs_Disp)
+ ZA.za_CountryDestination = ToStringSafe(tel.Locs_Dest)
+ ZA.za_CountryImport = "AT"
+
+ ZA.za_WarehouseCode = ToStringSafe(tel.Locs_ArrLocAuth)
+
+ ZA.za_InvoiceAmount = ToNullableDecimal(tel.ValData_InvVal)
+ ZA.za_InvoiceCurrency = ToStringSafe(tel.ValData_InvCurr)
+
+ ZA.za_Incoterms = ToStringSafe(tel.ValData_TermDelCd)
+ ZA.za_IncotermsPlace = ToStringSafe(tel.ValData_TermDelPlc)
+
+ ZA.za_AvisoId = tel.telanm_AvisoId
+ ZA.za_SendungsId = tel.telanm_SendungsId
+
+ ZA.za_Sachbearbeiter = tel.telanm_LetzteBearbeitung_SB
+
+ ' ================================================================
+ ' PARTIES (direkt aus Header-Feldern)
+ ' ================================================================
+ AddParty(ZA, "CONSIGNOR", tel.ConorTra_TIN, tel.ConorTra_Na, tel.ConorTra_Strt, tel.ConorTra_Pst, tel.ConorTra_Cty, tel.ConorTra_Ctry, tel.ConorTra_UID)
+ AddParty(ZA, "CONSIGNEE", tel.ConeeTra_TIN, tel.ConeeTra_Na, tel.ConeeTra_Strt, tel.ConeeTra_Pst, tel.ConeeTra_Cty, tel.ConeeTra_Ctry, tel.ConeeTra_UID)
+ AddParty(ZA, "EXPORTER", tel.ExpTra_TIN, tel.ExpTra_Na, tel.ExpTra_Strt, tel.ExpTra_Pst, tel.ExpTra_Cty, tel.ExpTra_Ctry, tel.ExpTra_UID)
+ AddParty(ZA, "DECLARANT", tel.Declarant_TIN, tel.Declarant_Na, tel.Declarant_Strt, tel.Declarant_Pst, tel.Declarant_Cty, tel.Declarant_Ctry, tel.Declarant_UID)
+
+ ' ================================================================
+ ' ABGABEN (HEADER)
+ ' ================================================================
+ For Each a In tel.ABGABEN
+ Dim d As New cVERAG_CustomsDeclarations_Duty With {
+ .zaDuty_DutyType = ToStringSafe(a.Ty),
+ .zaDuty_AmountEUR = ToNullableDecimal(a.Amnt),
+ .zaDuty_Currency = "EUR"
+ }
+ ZA.Duties.Add(d)
+ Next
+
+ ' ================================================================
+ ' POSITIONEN
+ ' ================================================================
+ For Each p In tel.POSITIONSDATEN
+ Dim it As New cVERAG_CustomsDeclarations_Item
+
+ it.zaItem_PosNo = p.Pos_ID
+ it.zaItem_HSCode = ToStringSafe(p.Item_ComCd)
+ it.zaItem_Description = ToStringSafe(p.Item_GdsDes)
+ it.zaItem_GrossMass = ToNullableDecimal(p.Item_Gross)
+ it.zaItem_NetMass = ToNullableDecimal(p.Item_Net)
+ it.zaItem_OriginCountry = ToStringSafe(p.Item_Orig)
+ it.zaItem_MainProcedure = ToStringSafe(p.Item_ProcCd)
+ it.zaItem_AdditionalProc = ToStringSafe(p.Item_ProcAddCd)
+
+ Dim colli = 0
+ Dim cnt = 0
+ For Each pk In p.PACKSTUECKE
+ colli += pk.Pack_Nr
+ If cnt = 0 Then
+ it.zaItem_PackageMark = ToStringSafe(pk.Pack_Mark)
+ it.zaItem_PackageType = ToStringSafe(pk.Pack_Kind)
+ End If
+ cnt += 1
+ Next
+
+ it.zaItem_PackageColli = ToNullableDecimal(colli)
+
+
+ it.zaItem_PreferenceCode = ToStringSafe(p.Item_Pref)
+ it.zaItem_InvoiceValueEUR = ToNullableDecimal(p.Item_ItVal)
+ it.zaItem_StatisticalValueEUR = ToNullableDecimal(p.Item_StatVal)
+
+ '' ------------------------------------------------------------
+ '' POSITIONS-ABGABEN
+ '' ------------------------------------------------------------
+ 'For Each pa In p.ABGABEN
+ ' Dim d As New cVERAG_CustomsDeclarations_Duty With {
+ ' .zaDuty_DutyType = ToStringSafe(pa.Ty),
+ ' .zaDuty_AmountEUR = ToNullableDecimal(pa.Amnt),
+ ' .zaDuty_Currency = ToStringSafe(pa.Curr)
+ ' }
+ ' ZA.Duties.Add(d)
+ 'Next
+
+ ' ------------------------------------------------------------
+ ' DOKUMENTE
+ ' ------------------------------------------------------------
+ For Each doc In p.DOC_CERTS
+ Dim dd As New cVERAG_CustomsDeclarations_Document With {
+ .zaDoc_ItemId = Nothing,
+ .zaDoc_Code = ToStringSafe(doc.DocCerts_DocCd),
+ .zaDoc_Reference = ToStringSafe(doc.DocCerts_DRef),
+ .zaDoc_Date = ToNullableDate(doc.DocCerts_IssD)
+ }
+ it.Documents.Add(dd)
+ Next
+
+ ZA.Items.Add(it)
+ Next
+
+ ' ================================================================
+ ' SAVE
+ ' ================================================================
+ Return ZA.SAVE()
+
+ Catch ex As Exception
+ cErrorHandler.ERR(ex.Message, ex.StackTrace, MethodInfo.GetCurrentMethod.Name)
+ Return False
+ End Try
+ End Function
+
+ ' =====================================================================
+ ' DUPLIKATSPRÜFUNG
+ ' =====================================================================
+ Private Function ExistsInVERAG(tel As cTelotec_Anmeldung) As Boolean
+ Dim sql As String =
+ "SELECT TOP 1 1 FROM tblVERAG_CustomsDeclarations " &
+ "WHERE za_System='TELOTEC' AND (za_MRN=@mrn OR za_LRN=@lrn)"
+
+ Dim p As New List(Of SQLVariable) From {
+ New SQLVariable("mrn", tel.Refs_CRN),
+ New SQLVariable("lrn", tel.Refs_LRN)
+ }
+
+ Dim dt = New SQL().loadDgvBySql_Param(sql, "VERAG", , p)
+ Return dt IsNot Nothing AndAlso dt.Rows.Count > 0
+ End Function
+
+ ' =====================================================================
+ ' PARTY HELPER
+ ' =====================================================================
+ Private Sub AddParty(za As cVERAG_CustomsDeclarations,
+ eori As String,
+ role As String,
+ name As Object,
+ street As Object,
+ plz As Object,
+ city As Object,
+ country As Object,
+ uid As Object)
+
+ If String.IsNullOrWhiteSpace(ToStringSafe(name)) Then Exit Sub
+
+ Dim p As New cVERAG_CustomsDeclarations_Parties With {
+ .zaParty_EORI = eori,
+ .zaParty_Role = role,
+ .zaParty_Name = ToStringSafe(name),
+ .zaParty_Street = ToStringSafe(street),
+ .zaParty_PostalCode = ToStringSafe(plz),
+ .zaParty_City = ToStringSafe(city),
+ .zaParty_Country = ToStringSafe(country),
+ .zaParty_VATNumber = ToStringSafe(uid)
+ }
+
+ za.Parties.Add(p)
+ End Sub
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ' =========================================================================
+ ' Small helpers (falls du sie schon hast, kannst du diese entfernen)
+ ' =========================================================================
+ Private Function ToStringSafe(v As Object) As String
+ If v Is Nothing Then Return Nothing
+ Dim s As String = TryCast(v, String)
+ If s IsNot Nothing Then Return s
+ Return Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ End Function
+
+ Private Function ToInt(v As Object) As Integer
+ If v Is Nothing Then Return 0
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim i As Integer
+ If Integer.TryParse(s, Globalization.NumberStyles.Any, Globalization.CultureInfo.InvariantCulture, i) Then Return i
+ Return 0
+ End Function
+
+ Private Function ToNullableDecimal(v As Object) As Decimal?
+ If v Is Nothing Then Return Nothing
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim d As Decimal
+ If Decimal.TryParse(s, Globalization.NumberStyles.Any, Globalization.CultureInfo.InvariantCulture, d) Then Return d
+ Return Nothing
+ End Function
+
+ Private Function ToNullableDate(v As Object) As Date?
+ If v Is Nothing Then Return Nothing
+ If TypeOf v Is Date Then Return CType(v, Date)
+
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture)
+ Dim dt As Date
+ If Date.TryParse(s, Globalization.CultureInfo.InvariantCulture, Globalization.DateTimeStyles.None, dt) Then Return dt
+ Return Nothing
+ End Function
+
+ Private Function ToNullableBool(v As Object) As Boolean?
+ If v Is Nothing Then Return Nothing
+ If TypeOf v Is Boolean Then Return CType(v, Boolean)
+
+ Dim s = Convert.ToString(v, Globalization.CultureInfo.InvariantCulture).Trim().ToLowerInvariant()
+ If s = "J" OrElse s = "1" OrElse s = "true" OrElse s = "y" OrElse s = "yes" Then Return True
+ If s = "N" OrElse s = "0" OrElse s = "false" OrElse s = "n" OrElse s = "no" Then Return False
+ Return Nothing
+ End Function
+End Class
\ No newline at end of file
diff --git a/TELOTEK_Worker_lib/cTelokec.vb b/TELOTEK_Worker_lib/cTelokec.vb
index 1dd8290..114300c 100644
--- a/TELOTEK_Worker_lib/cTelokec.vb
+++ b/TELOTEK_Worker_lib/cTelokec.vb
@@ -637,6 +637,48 @@ Public Class cTelotec_Anmeldung
End Function
+
+ Shared Function LOADByCRN(telanm_CRN As String, Optional loadALL As Boolean = True) As cTelotec_Anmeldung
+ Try
+ Dim NCTS As New cTelotec_Anmeldung
+ Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
+ If loadALL Then
+ NCTS.POSITIONSDATEN.Clear()
+ NCTS.SICHERHEIT.Clear()
+ NCTS.ABGABEN.Clear()
+ End If
+ Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
+ Using cmd As New SqlCommand("SELECT TOP 1 * FROM tblTelotec_Anmeldung WHERE telanm_CRN=@telanm_CRN ", conn)
+ cmd.Parameters.AddWithValue("@telanm_CRN", telanm_CRN)
+ Dim dr = cmd.ExecuteReader()
+ If dr.Read Then
+ For Each l In NCTS.getParameterList()
+ Dim propInfo As PropertyInfo = NCTS.GetType.GetProperty(l.Scalarvariable)
+
+ If dr.Item(l.Text) Is DBNull.Value Then
+ propInfo.SetValue(NCTS, Nothing)
+ Else
+ propInfo.SetValue(NCTS, dr.Item(l.Text))
+ End If
+
+ Next
+ If loadALL Then
+ NCTS.LOAD_Positionsdaten()
+ NCTS.LOAD_Sicherheit()
+ NCTS.LOAD_Abgaben()
+ End If
+ dr.Close()
+ Return NCTS
+ 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
+ Return Nothing
+ End Function
+
Shared Function LOADByBezugsNr(bezugsNr As String, Optional MsgType As String = "", Optional loadALL As Boolean = True) As cTelotec_Anmeldung
Try
Dim NCTS As New cTelotec_Anmeldung
diff --git a/UID/My Project/AssemblyInfo.vb b/UID/My Project/AssemblyInfo.vb
index f84ad35..3284232 100644
--- a/UID/My Project/AssemblyInfo.vb
+++ b/UID/My Project/AssemblyInfo.vb
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
'
-
-
+
+
diff --git a/UID/usrctlProcedures.Designer.vb b/UID/usrctlProcedures.Designer.vb
index 573265b..397fd74 100644
--- a/UID/usrctlProcedures.Designer.vb
+++ b/UID/usrctlProcedures.Designer.vb
@@ -59,6 +59,8 @@ Partial Class usrctlProcedures
Me.Button11 = New System.Windows.Forms.Button()
Me.Button10 = New System.Windows.Forms.Button()
Me.DataGridView1 = New System.Windows.Forms.DataGridView()
+ Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
+ Me.Column2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Button9 = New System.Windows.Forms.Button()
Me.Button8 = New System.Windows.Forms.Button()
Me.Button7 = New System.Windows.Forms.Button()
@@ -85,6 +87,8 @@ Partial Class usrctlProcedures
Me.Button48 = New System.Windows.Forms.Button()
Me.Button47 = New System.Windows.Forms.Button()
Me.TabPage6 = New System.Windows.Forms.TabPage()
+ Me.Label23 = New System.Windows.Forms.Label()
+ Me.Button54 = New System.Windows.Forms.Button()
Me.Label19 = New System.Windows.Forms.Label()
Me.Label18 = New System.Windows.Forms.Label()
Me.Label17 = New System.Windows.Forms.Label()
@@ -93,7 +97,7 @@ Partial Class usrctlProcedures
Me.Button50 = New System.Windows.Forms.Button()
Me.Button49 = New System.Windows.Forms.Button()
Me.TabPage7 = New System.Windows.Forms.TabPage()
- Me.btnT1Data = New System.Windows.Forms.Button()
+ Me.Button53 = New System.Windows.Forms.Button()
Me.Label22 = New System.Windows.Forms.Label()
Me.dtpbis = New System.Windows.Forms.DateTimePicker()
Me.lblDakosyImport = New System.Windows.Forms.Label()
@@ -104,6 +108,14 @@ Partial Class usrctlProcedures
Me.Button52 = New System.Windows.Forms.Button()
Me.TabPage8 = New System.Windows.Forms.TabPage()
Me.btnImportTrStat = New System.Windows.Forms.Button()
+ Me.TabPage9 = New System.Windows.Forms.TabPage()
+ Me.btnT1Data = New System.Windows.Forms.Button()
+ Me.TabPage10 = New System.Windows.Forms.TabPage()
+ Me.txtListTCMrn = New System.Windows.Forms.TextBox()
+ Me.btnTCtoVERAEZA = New System.Windows.Forms.Button()
+ Me.btnCBAM_ATEZ = New System.Windows.Forms.Button()
+ Me.txtListDYMrn = New System.Windows.Forms.TextBox()
+ Me.btnDYtoVERAEZA = New System.Windows.Forms.Button()
Me.Button18 = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.lblAnzahl = New System.Windows.Forms.Label()
@@ -157,14 +169,10 @@ Partial Class usrctlProcedures
Me.Button99 = New System.Windows.Forms.Button()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
- Me.TabPage9 = New System.Windows.Forms.TabPage()
- Me.Button53 = New System.Windows.Forms.Button()
+ Me.txtListDHFMrn = New System.Windows.Forms.TextBox()
+ Me.btnDHFtoVERAEZA = New System.Windows.Forms.Button()
+ Me.btnDHFUNItoVERAEZA = New System.Windows.Forms.Button()
Me.tbTRStat.SuspendLayout()
- Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
- Me.Column2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
- Me.Button54 = New System.Windows.Forms.Button()
- Me.Label23 = New System.Windows.Forms.Label()
- 'Me.TabControl1.SuspendLayout()
Me.TabPage3.SuspendLayout()
Me.TabPage1.SuspendLayout()
CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -177,6 +185,7 @@ Partial Class usrctlProcedures
Me.TabPage7.SuspendLayout()
Me.TabPage8.SuspendLayout()
Me.TabPage9.SuspendLayout()
+ Me.TabPage10.SuspendLayout()
Me.SuspendLayout()
'
'tbTRStat
@@ -190,6 +199,7 @@ Partial Class usrctlProcedures
Me.tbTRStat.Controls.Add(Me.TabPage7)
Me.tbTRStat.Controls.Add(Me.TabPage8)
Me.tbTRStat.Controls.Add(Me.TabPage9)
+ Me.tbTRStat.Controls.Add(Me.TabPage10)
Me.tbTRStat.Location = New System.Drawing.Point(7, 407)
Me.tbTRStat.Name = "tbTRStat"
Me.tbTRStat.SelectedIndex = 0
@@ -550,6 +560,16 @@ Partial Class usrctlProcedures
Me.DataGridView1.Size = New System.Drawing.Size(240, 431)
Me.DataGridView1.TabIndex = 5
'
+ 'Column1
+ '
+ Me.Column1.HeaderText = "dat"
+ Me.Column1.Name = "Column1"
+ '
+ 'Column2
+ '
+ Me.Column2.HeaderText = "anz"
+ Me.Column2.Name = "Column2"
+ '
'Button9
'
Me.Button9.Location = New System.Drawing.Point(131, 131)
@@ -810,6 +830,24 @@ Partial Class usrctlProcedures
Me.TabPage6.Text = "MDM Importe"
Me.TabPage6.UseVisualStyleBackColor = True
'
+ 'Label23
+ '
+ Me.Label23.AutoSize = True
+ Me.Label23.Location = New System.Drawing.Point(11, 141)
+ Me.Label23.Name = "Label23"
+ Me.Label23.Size = New System.Drawing.Size(16, 13)
+ Me.Label23.TabIndex = 73
+ Me.Label23.Text = "3."
+ '
+ 'Button54
+ '
+ Me.Button54.Location = New System.Drawing.Point(33, 133)
+ Me.Button54.Name = "Button54"
+ Me.Button54.Size = New System.Drawing.Size(106, 28)
+ Me.Button54.TabIndex = 72
+ Me.Button54.Text = "ZNB Zinssätze"
+ Me.Button54.UseVisualStyleBackColor = True
+ '
'Label19
'
Me.Label19.AutoSize = True
@@ -993,6 +1031,89 @@ Partial Class usrctlProcedures
Me.btnImportTrStat.Text = "Import TrStat"
Me.btnImportTrStat.UseVisualStyleBackColor = True
'
+ 'TabPage9
+ '
+ Me.TabPage9.Controls.Add(Me.btnT1Data)
+ Me.TabPage9.Location = New System.Drawing.Point(4, 22)
+ Me.TabPage9.Name = "TabPage9"
+ Me.TabPage9.Padding = New System.Windows.Forms.Padding(3)
+ Me.TabPage9.Size = New System.Drawing.Size(601, 288)
+ Me.TabPage9.TabIndex = 8
+ Me.TabPage9.Text = "T1 Serice"
+ Me.TabPage9.UseVisualStyleBackColor = True
+ '
+ 'btnT1Data
+ '
+ Me.btnT1Data.Location = New System.Drawing.Point(228, 120)
+ Me.btnT1Data.Name = "btnT1Data"
+ Me.btnT1Data.Size = New System.Drawing.Size(145, 49)
+ Me.btnT1Data.TabIndex = 25
+ Me.btnT1Data.Text = "T1 Servcie"
+ Me.btnT1Data.UseVisualStyleBackColor = True
+ '
+ 'TabPage10
+ '
+ Me.TabPage10.Controls.Add(Me.btnDHFUNItoVERAEZA)
+ Me.TabPage10.Controls.Add(Me.txtListDHFMrn)
+ Me.TabPage10.Controls.Add(Me.btnDHFtoVERAEZA)
+ Me.TabPage10.Controls.Add(Me.txtListTCMrn)
+ Me.TabPage10.Controls.Add(Me.btnTCtoVERAEZA)
+ Me.TabPage10.Controls.Add(Me.btnCBAM_ATEZ)
+ Me.TabPage10.Controls.Add(Me.txtListDYMrn)
+ Me.TabPage10.Controls.Add(Me.btnDYtoVERAEZA)
+ Me.TabPage10.Location = New System.Drawing.Point(4, 22)
+ Me.TabPage10.Name = "TabPage10"
+ Me.TabPage10.Padding = New System.Windows.Forms.Padding(3)
+ Me.TabPage10.Size = New System.Drawing.Size(601, 288)
+ Me.TabPage10.TabIndex = 9
+ Me.TabPage10.Text = "TabPageDY"
+ Me.TabPage10.UseVisualStyleBackColor = True
+ '
+ 'txtListTCMrn
+ '
+ Me.txtListTCMrn.Location = New System.Drawing.Point(197, 14)
+ Me.txtListTCMrn.Multiline = True
+ Me.txtListTCMrn.Name = "txtListTCMrn"
+ Me.txtListTCMrn.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
+ Me.txtListTCMrn.Size = New System.Drawing.Size(145, 155)
+ Me.txtListTCMrn.TabIndex = 42
+ '
+ 'btnTCtoVERAEZA
+ '
+ Me.btnTCtoVERAEZA.Location = New System.Drawing.Point(197, 175)
+ Me.btnTCtoVERAEZA.Name = "btnTCtoVERAEZA"
+ Me.btnTCtoVERAEZA.Size = New System.Drawing.Size(145, 49)
+ Me.btnTCtoVERAEZA.TabIndex = 41
+ Me.btnTCtoVERAEZA.Text = "TELOTEC->VERAG ZA"
+ Me.btnTCtoVERAEZA.UseVisualStyleBackColor = True
+ '
+ 'btnCBAM_ATEZ
+ '
+ Me.btnCBAM_ATEZ.Location = New System.Drawing.Point(133, 239)
+ Me.btnCBAM_ATEZ.Name = "btnCBAM_ATEZ"
+ Me.btnCBAM_ATEZ.Size = New System.Drawing.Size(145, 49)
+ Me.btnCBAM_ATEZ.TabIndex = 40
+ Me.btnCBAM_ATEZ.Text = "Überschreibe CBAM von ATEZ"
+ Me.btnCBAM_ATEZ.UseVisualStyleBackColor = True
+ '
+ 'txtListDYMrn
+ '
+ Me.txtListDYMrn.Location = New System.Drawing.Point(33, 14)
+ Me.txtListDYMrn.Multiline = True
+ Me.txtListDYMrn.Name = "txtListDYMrn"
+ Me.txtListDYMrn.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
+ Me.txtListDYMrn.Size = New System.Drawing.Size(145, 155)
+ Me.txtListDYMrn.TabIndex = 39
+ '
+ 'btnDYtoVERAEZA
+ '
+ Me.btnDYtoVERAEZA.Location = New System.Drawing.Point(33, 175)
+ Me.btnDYtoVERAEZA.Name = "btnDYtoVERAEZA"
+ Me.btnDYtoVERAEZA.Size = New System.Drawing.Size(145, 49)
+ Me.btnDYtoVERAEZA.TabIndex = 36
+ Me.btnDYtoVERAEZA.Text = "DY->VERAG ZA"
+ Me.btnDYtoVERAEZA.UseVisualStyleBackColor = True
+ '
'Button18
'
Me.Button18.Location = New System.Drawing.Point(59, 183)
@@ -1472,53 +1593,32 @@ Partial Class usrctlProcedures
Me.DataGridViewTextBoxColumn2.HeaderText = "anz"
Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"
'
- 'Column1
+ 'txtListDHFMrn
'
- Me.Column1.HeaderText = "dat"
- Me.Column1.Name = "Column1"
+ Me.txtListDHFMrn.Location = New System.Drawing.Point(348, 14)
+ Me.txtListDHFMrn.Multiline = True
+ Me.txtListDHFMrn.Name = "txtListDHFMrn"
+ Me.txtListDHFMrn.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
+ Me.txtListDHFMrn.Size = New System.Drawing.Size(163, 155)
+ Me.txtListDHFMrn.TabIndex = 44
'
- 'Column2
+ 'btnDHFtoVERAEZA
'
- Me.Column2.HeaderText = "anz"
- Me.Column2.Name = "Column2"
+ Me.btnDHFtoVERAEZA.Location = New System.Drawing.Point(348, 175)
+ Me.btnDHFtoVERAEZA.Name = "btnDHFtoVERAEZA"
+ Me.btnDHFtoVERAEZA.Size = New System.Drawing.Size(163, 49)
+ Me.btnDHFtoVERAEZA.TabIndex = 43
+ Me.btnDHFtoVERAEZA.Text = "DHF VERAG->VERAG ZA"
+ Me.btnDHFtoVERAEZA.UseVisualStyleBackColor = True
'
- 'Button54
+ 'btnDHFUNItoVERAEZA
'
- Me.Button54.Location = New System.Drawing.Point(33, 133)
- Me.Button54.Name = "Button54"
- Me.Button54.Size = New System.Drawing.Size(106, 28)
- Me.Button54.TabIndex = 72
- Me.Button54.Text = "ZNB Zinssätze"
- Me.Button54.UseVisualStyleBackColor = True
- '
- 'Label23
- '
- Me.Label23.AutoSize = True
- Me.Label23.Location = New System.Drawing.Point(11, 141)
- Me.Label23.Name = "Label23"
- Me.Label23.Size = New System.Drawing.Size(16, 13)
- Me.Label23.TabIndex = 73
- Me.Label23.Text = "3."
- '
- 'TabPage9
- '
- Me.TabPage9.Controls.Add(Me.btnT1Data)
- Me.TabPage9.Location = New System.Drawing.Point(4, 22)
- Me.TabPage9.Name = "TabPage9"
- Me.TabPage9.Padding = New System.Windows.Forms.Padding(3)
- Me.TabPage9.Size = New System.Drawing.Size(601, 288)
- Me.TabPage9.TabIndex = 8
- Me.TabPage9.Text = "T1 Serice"
- Me.TabPage9.UseVisualStyleBackColor = True
- '
- 'Button53
- '
- Me.btnT1Data.Location = New System.Drawing.Point(228, 120)
- Me.btnT1Data.Name = "btnT1Data"
- Me.btnT1Data.Size = New System.Drawing.Size(145, 49)
- Me.btnT1Data.TabIndex = 25
- Me.btnT1Data.Text = "T1 Servcie"
- Me.btnT1Data.UseVisualStyleBackColor = True
+ Me.btnDHFUNItoVERAEZA.Location = New System.Drawing.Point(348, 230)
+ Me.btnDHFUNItoVERAEZA.Name = "btnDHFUNItoVERAEZA"
+ Me.btnDHFUNItoVERAEZA.Size = New System.Drawing.Size(163, 49)
+ Me.btnDHFUNItoVERAEZA.TabIndex = 45
+ Me.btnDHFUNItoVERAEZA.Text = "DHF UNISPED ->VERAG ZA"
+ Me.btnDHFUNItoVERAEZA.UseVisualStyleBackColor = True
'
'usrctlProcedures
'
@@ -1598,6 +1698,8 @@ Partial Class usrctlProcedures
Me.TabPage7.PerformLayout()
Me.TabPage8.ResumeLayout(False)
Me.TabPage9.ResumeLayout(False)
+ Me.TabPage10.ResumeLayout(False)
+ Me.TabPage10.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -1743,4 +1845,13 @@ Partial Class usrctlProcedures
Friend WithEvents btnImportTrStat As Button
Friend WithEvents TabPage9 As TabPage
Friend WithEvents Button53 As Button
+ Friend WithEvents TabPage10 As TabPage
+ Friend WithEvents txtListDYMrn As TextBox
+ Friend WithEvents btnDYtoVERAEZA As Button
+ Friend WithEvents btnCBAM_ATEZ As Button
+ Friend WithEvents txtListTCMrn As TextBox
+ Friend WithEvents btnTCtoVERAEZA As Button
+ Friend WithEvents btnDHFUNItoVERAEZA As Button
+ Friend WithEvents txtListDHFMrn As TextBox
+ Friend WithEvents btnDHFtoVERAEZA As Button
End Class
diff --git a/UID/usrctlProcedures.resx b/UID/usrctlProcedures.resx
index 508fc32..c9977e7 100644
--- a/UID/usrctlProcedures.resx
+++ b/UID/usrctlProcedures.resx
@@ -123,4 +123,10 @@
True
+
+ True
+
+
+ True
+
\ No newline at end of file
diff --git a/UID/usrctlProcedures.vb b/UID/usrctlProcedures.vb
index d7b198d..b23cea5 100644
--- a/UID/usrctlProcedures.vb
+++ b/UID/usrctlProcedures.vb
@@ -4534,6 +4534,94 @@ OPTION (MAXRECURSION 1000);", "AVISO") '
End Sub
+ Private Sub btnDYtoVERAEZA_Click(sender As Object, e As EventArgs) Handles btnDYtoVERAEZA.Click
+
+ If txtListDYMrn Is Nothing OrElse String.IsNullOrWhiteSpace(txtListDYMrn.Text) Then Exit Sub
+
+ ' Trennzeichen definieren
+ Dim separators() As Char = {ControlChars.Cr, ControlChars.Lf, ";"c, ","c, " "c}
+
+ Dim entries = txtListDYMrn.Text.Split(separators, StringSplitOptions.RemoveEmptyEntries)
+
+ Dim WRK As New DAKOSY_Worker.cImporter_DakosyToVERAG
+ Dim cnt = 0
+ For Each entry As String In entries
+
+ Dim value As String = entry.Trim()
+
+ If value.Length = 18 Then
+ WRK.ImportDakosyEZA(value)
+ End If
+ cnt += 1
+ btnDYtoVERAEZA.Text = "DY->VERAG ZA" & vbNewLine & cnt & "/" & entries.Count
+ Me.Refresh()
+ Application.DoEvents()
+ Next
+
+ End Sub
+
+ Private Sub btnCBAM_ATEZ_Click(sender As Object, e As EventArgs) Handles btnCBAM_ATEZ.Click
+ Dim cATEZ_Greenpulse_CBAM_CostCalculation As New cATEZ_Greenpulse_CBAM_CostCalculation
+ Dim resp = cATEZ_Greenpulse_CBAM_CostCalculation.GetCnCodes
+ If resp.success Then
+ MsgBox("Anzahl CnCodes: " & resp.data.Count)
+ cATEZ_Greenpulse_CBAM_CostCalculation.insertinto_Greendeal_CBAM_Trn(resp)
+ Else
+ MsgBox("Fehler: " & resp.error.ToString)
+ End If
+
+ End Sub
+
+ Private Sub btnTCtoVERAEZA_Click(sender As Object, e As EventArgs) Handles btnTCtoVERAEZA.Click
+ If txtListTCMrn Is Nothing OrElse String.IsNullOrWhiteSpace(txtListTCMrn.Text) Then Exit Sub
+
+ ' Trennzeichen definieren
+ Dim separators() As Char = {ControlChars.Cr, ControlChars.Lf, ";"c, ","c, " "c}
+
+ Dim entries = txtListTCMrn.Text.Split(separators, StringSplitOptions.RemoveEmptyEntries)
+
+ Dim WRK As New DAKOSY_Worker.cImporter_TelotecToVERAG
+ Dim cnt = 0
+ For Each entry As String In entries
+
+ Dim value As String = entry.Trim()
+
+ If value.Length = 18 Then
+ WRK.ImportTelotec(value)
+ End If
+ cnt += 1
+ btnTCtoVERAEZA.Text = "TELOTEC->VERAG ZA" & vbNewLine & cnt & "/" & entries.Count
+ Me.Refresh()
+ Application.DoEvents()
+ Next
+ End Sub
+
+ Private Sub btnDHFtoVERAEZA_Click(sender As Object, e As EventArgs) Handles btnDHFtoVERAEZA.Click, btnDHFUNItoVERAEZA.Click
+ If txtListDHFMrn Is Nothing OrElse String.IsNullOrWhiteSpace(txtListDHFMrn.Text) Then Exit Sub
+
+ ' Trennzeichen definieren
+ Dim separators() As Char = {ControlChars.Cr, ControlChars.Lf, ";"c, ","c, " "c}
+
+ Dim entries = txtListDHFMrn.Text.Split(separators, StringSplitOptions.RemoveEmptyEntries)
+
+ Dim WRK As New DAKOSY_Worker.cImporter_DHFToVERAG
+ Dim cnt = 0
+ For Each entry As String In entries
+
+ Dim value As String = entry.Trim()
+
+ If value.Length = 18 Then
+ If sender Is btnDHFtoVERAEZA Then WRK.ImportEZOLLByLRN(value, "EZOLL")
+ If sender Is btnDHFUNItoVERAEZA Then WRK.ImportEZOLLByLRN(value, "EZOLL_UNISPED")
+ End If
+ cnt += 1
+ If sender Is btnDHFtoVERAEZA Then sender.Text = "DHF VERAG ->VERAG ZA" & vbNewLine & cnt & "/" & entries.Count
+ If sender Is btnDHFUNItoVERAEZA Then sender.Text = "DHF UNISPED ->VERAG ZA" & vbNewLine & cnt & "/" & entries.Count
+ Me.Refresh()
+ Application.DoEvents()
+ Next
+ End Sub
+
'Private Sub Button26_Click(sender As Object, e As EventArgs)
diff --git a/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb b/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb
index c376ee8..9e07fb3 100644
--- a/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb
+++ b/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb
@@ -9133,6 +9133,10 @@ Public Class frmDYNachrichtenVerarbeitung
'If If(EZA_TMP.eza_firma, "") = "IMEX" Then EZA_TMP.insertIntoSpedBuch(DY_TMP)
EZA_TMP.insertIntoSpedBuch(DY_TMP)
+ '=====IMPORT IN VERAG DATENMODELL==========
+ Dim IMP As New DAKOSY_Worker.cImporter_DakosyToVERAG
+ IMP.ImportDakosyEZA(EZA_TMP)
+ '==================================
'=====ATEZ BEREITSTELLUNG==========
cWorker_NCTS.checkATEZ_BereitstellungDHUB(DY_TMP, d)
@@ -10333,6 +10337,12 @@ Public Class frmDYNachrichtenVerarbeitung
EZA_TMP.insertIntoSpedBuch(DY_TMP)
+ '=====IMPORT IN VERAG DATENMODELL==========
+ Dim IMP As New DAKOSY_Worker.cImporter_DakosyToVERAG
+ IMP.ImportDakosyEZA(EZA_TMP)
+ '==================================
+
+
'=====ATEZ BEREITSTELLUNG==========
cWorker_NCTS.checkATEZ_BereitstellungDHUB(DY_TMP, d)
'==================================
diff --git a/initATLASAufschubkonten/frmStartOptions.vb b/initATLASAufschubkonten/frmStartOptions.vb
index 3b3fdb9..a125a73 100644
--- a/initATLASAufschubkonten/frmStartOptions.vb
+++ b/initATLASAufschubkonten/frmStartOptions.vb
@@ -994,43 +994,52 @@ Public Class frmStartOptions
Select Case row("MsgTyp")
Case "EZ922" 'STEUERBESCHEID
DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "EZA", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
- sql.doSQL("Update Speditionsbuch SET [DokumentId_Steuerbeleg]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND [DokumentId_Steuerbeleg] is null", "FMZOLL")
- doMailZollbeleg(destFull, "STB", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
- Case "TR109"
- DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "NCTS", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
- sql.doSQL("Update Speditionsbuch SET [DokumentId_VBD]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND [DokumentId_VBD] is null", "FMZOLL")
- ' BEREITSTELLUNG DER DATEN AN FREMDSYSTEME
- cVERAG_out_ncts.copyFileFTP_VERAGncts_EZOLL(cDHF_Anhaenge.AnmID)
- doMailZollbeleg(destFull, "VBD", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
- Case "EZ923" ' STB/ABD
- Select Case row("VorgangID")
- Case "AF" ' --> AUSFUHR --> ABD
- 'AES Stuff....
- DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "AES", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
- sql.doSQL("Update Speditionsbuch SET [DokumentId_ABD]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND DokumentId_ABD is null", "FMZOLL")
- 'Zeitspanne ? 3 Tage , älter nicht senden..
- If destFull <> "" AndAlso SPEDBUCH_TMP IsNot Nothing AndAlso SPEDBUCH_TMP.SendungID IsNot Nothing Then
- doMailZollbeleg(destFull, "ABD", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
- End If
- Case Else '' --> EINFUHR --> 'Ergänzung STB - Mitteilung
- DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "EZA", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
- sql.doSQL("Update Speditionsbuch SET DokumentId_Mitteilung='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND DokumentId_Mitteilung is null", "FMZOLL")
- doMailZollbeleg(destFull, "STB", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
+ '=====IMPORT IN VERAG DATENMODELL==========
+ Dim IMP As New DAKOSY_Worker.cImporter_DHFToVERAG
+ Select Case VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
+ Case "UNIDPED" : IMP.ImportEZOLLByLRN(cDHF_Anhaenge.CRN, "EZOLL_UNISPED")
+ Case Else : IMP.ImportEZOLLByLRN(cDHF_Anhaenge.CRN, "EZOLL")
+ End Select
+ '==========================================
+
+ sql.doSQL("Update Speditionsbuch SET [DokumentId_Steuerbeleg]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND [DokumentId_Steuerbeleg] is null", "FMZOLL")
+ doMailZollbeleg(destFull, "STB", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
+ Case "TR109"
+ DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "NCTS", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
+ sql.doSQL("Update Speditionsbuch SET [DokumentId_VBD]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND [DokumentId_VBD] is null", "FMZOLL")
+ ' BEREITSTELLUNG DER DATEN AN FREMDSYSTEME
+ cVERAG_out_ncts.copyFileFTP_VERAGncts_EZOLL(cDHF_Anhaenge.AnmID)
+ doMailZollbeleg(destFull, "VBD", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
+ Case "EZ923" ' STB/ABD
+ Select Case row("VorgangID")
+ Case "AF" ' --> AUSFUHR --> ABD
+ 'AES Stuff....
+ DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "AES", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
+ sql.doSQL("Update Speditionsbuch SET [DokumentId_ABD]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND DokumentId_ABD is null", "FMZOLL")
+ 'Zeitspanne ? 3 Tage , älter nicht senden..
+ If destFull <> "" AndAlso SPEDBUCH_TMP IsNot Nothing AndAlso SPEDBUCH_TMP.SendungID IsNot Nothing Then
+ doMailZollbeleg(destFull, "ABD", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
+ End If
+ Case Else '' --> EINFUHR --> 'Ergänzung STB - Mitteilung
+
+ DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "EZA", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
+ sql.doSQL("Update Speditionsbuch SET DokumentId_Mitteilung='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND DokumentId_Mitteilung is null", "FMZOLL")
+ doMailZollbeleg(destFull, "STB", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
+
+ End Select
+
+ Case "EX431" 'AVM --> EZoll Anhänge & Mail senden
+ 'AES Stuff....
+ DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "AES", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
+ sql.doSQL("Update Speditionsbuch SET [DokumentId_AVM]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND DokumentId_AVM is null", "FMZOLL")
+
+ If destFull <> "" AndAlso SPEDBUCH_TMP IsNot Nothing AndAlso SPEDBUCH_TMP.SendungID IsNot Nothing Then
+ doMailZollbeleg(destFull, "AVM", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
+ End If
End Select
- Case "EX431" 'AVM --> EZoll Anhänge & Mail senden
- 'AES Stuff....
- DAKOSY_Worker.cZOLL_IMPORT.EZOLLImport(cDHF_Anhaenge.LRN, "AES", SPEDBUCH_TMP) 'Versucht den SpedBucheintrag, falls noch nicht vorhanden
- sql.doSQL("Update Speditionsbuch SET [DokumentId_AVM]='" & cDHF_Anhaenge.docID & "' WHERE AtlasBezNrEZA='" & cDHF_Anhaenge.LRN & "' AND DokumentId_AVM is null", "FMZOLL")
-
- If destFull <> "" AndAlso SPEDBUCH_TMP IsNot Nothing AndAlso SPEDBUCH_TMP.SendungID IsNot Nothing Then
- doMailZollbeleg(destFull, "AVM", SPEDBUCH_TMP.SendungID, cDHF_Anhaenge.LRN)
- End If
-
- End Select
-
End If
End If
diff --git a/initATLASAufschubkonten/frmTCNachrichtenVerarbeitung.vb b/initATLASAufschubkonten/frmTCNachrichtenVerarbeitung.vb
index ab69b29..8c485cc 100644
--- a/initATLASAufschubkonten/frmTCNachrichtenVerarbeitung.vb
+++ b/initATLASAufschubkonten/frmTCNachrichtenVerarbeitung.vb
@@ -1054,6 +1054,14 @@ Public Class frmTCNachrichtenVerarbeitung
Dim ZOLLIMPORT As New DAKOSY_Worker.cZOLL_IMPORT
ZOLLIMPORT.TelotecImport(TC)
ZOLLIMPORT.insertAbgabenTELOTEC(TC)
+
+ '=====IMPORT IN VERAG DATENMODELL==========
+ If TC.Hea_DecTy = "EUA" Then
+ Dim IMP As New DAKOSY_Worker.cImporter_TelotecToVERAG
+ IMP.ImportTelotec(TC)
+ End If
+ '==================================
+
End If
' BEREITSTELLUNG DER DATEN AN FREMDSYSTEME
If TC.telanm_ART = "T1" Or TC.telanm_ART.ToString.Contains("T2") Or TC.telanm_ART.ToString.StartsWith("T-") Then