Imports System.Data.SqlClient
Imports System.Reflection
Imports System.Windows.Forms
Imports VERAG_PROG_ALLGEMEIN.TESTJSON

Public Class cDakosyEZA

    Property eza_Id As Integer = -1
    Property eza_Status As Object = DAKOSY_Worker.cDY_Statusliste.S_00
    Property eza_Status_KEWILL_Equivalent As Object = DAKOSY_Worker.cDY_Statusliste.S_00
    Property eza_dyaArt As String = ""
    Property eza_dyaAnmID As Integer

    Property eza_ANR As Object = Nothing
    Property eza_MRN As Object = Nothing

    Property eza_Erstellung As DateTime = Now
    Property eza_Erstellung_SB As Object = Nothing
    Property eza_LetzteBearbeitung As DateTime = Now
    Property eza_LetzteBearbeitung_SB As Object = Nothing
    Property eza_firma As Object = Nothing
    Property eza_niederlassung As Object = Nothing


    Property eza_Trans_Partner As Object = Nothing
    Property eza_Trans_Div1 As Object = Nothing
    Property eza_Trans_Div2 As Object = Nothing
    Property eza_Trans_Div3 As Object = Nothing
    Property eza_Trans_Referenz As Object = Nothing
    Property eza_Trans_DatumZeit As DateTime = Now
    Property eza_Trans_Version As Object = Nothing
    Property eza_NachrichtenSenderTIN As Object = Nothing
    Property eza_NachrichtenSenderNLNR As Object = Nothing
    Property eza_NachrichtenempfaengerDST As Object = Nothing

    Property eza_ObjectName As Object = Nothing
    Property eza_ObjectAlias As Object = Nothing

    Property eza_BezugsnummerVorblendung As Object = Nothing
    Property eza_Bearbeiter As Object = Nothing
    Property eza_AnmeldungArt As Object = Nothing
    Property eza_CompliancePruefung As Object = Nothing
    Property eza_AnfBemerkungStatusanzeige As Object = Nothing
    Property eza_AdressierteZollstelle As Object = Nothing
    Property eza_AnmelderistEmpfaenger As Object = Nothing
    Property eza_VertretungsVerhaeltnisCode As Object = Nothing
    Property eza_Vorsteuerabzug As Object = Nothing
    Property eza_AnmeldenderBearbeiterName As Object = Nothing
    Property eza_AnmeldenderBearbeiterTel As Object = Nothing
    Property eza_AnmeldenderBearbeiterStellung As Object = Nothing
    Property eza_AnmeldenderBearbeiterEMail As Object = Nothing
    Property eza_FiskalvertretungKz As Object = Nothing
    Property eza_Ausstellungsort As Object = Nothing
    Property eza_ZollrechtlicherStatus As Object = Nothing
    Property eza_GesamtRohmasse As Object = Nothing
    Property eza_VerfahrenBeantragtCode As Object = Nothing
    Property eza_VerkehrszweigInland As Object = Nothing
    Property eza_VerkehrszweigGrenze As Object = Nothing
    Property eza_VersendungsLandCode As Object = Nothing
    Property eza_Bestimmungsbundesland As Object = Nothing
    Property eza_Bestimmungsland As Object = Nothing
    Property eza_KennzeichenNameBefoerderungsmittelAnkunft As Object = Nothing
    Property eza_BeförderungsmittelGrenzeStaatszugehörigkeitCode As Object = Nothing
    Property eza_BeförderungsmittelGrenzeArt As Object = Nothing
    Property eza_BeförderungsmittelGrenze As Object = Nothing
    Property eza_LieferbedingungCode As Object = Nothing
    Property eza_LieferbedingungText As Object = Nothing
    Property eza_LieferbedingungSchluessel As Object = Nothing
    Property eza_LieferbedingungOrt As Object = Nothing
    Property eza_VorpapierArtCode As Object = Nothing
    Property eza_VorpapierNr As Object = Nothing
    Property eza_ArtGeschaeftCode As Object = Nothing
    Property eza_Statistikstatus As Object = Nothing
    Property eza_Warenort As Object = Nothing
    Property eza_Rechnungspreis As Object = Nothing
    Property eza_Rechnungswaehrung As Object = Nothing
    Property eza_DV1Kz As Object = Nothing
    Property eza_DV1Vertretungsverhaeltnis As Object = Nothing
    Property eza_DV1FruehereEntscheidungen As Object = Nothing
    Property eza_DV1Verbundenheit As Object = Nothing
    Property eza_DV1VerbungenheitEinzelheiten As Object = Nothing
    Property eza_DV1EinschraenkungenKz As Object = Nothing
    Property eza_DV1BedingungenLeistungenKz As Object = Nothing
    Property eza_DV1BedingungenLeistungenArt As Object = Nothing
    Property eza_DV1LizenzgebuehrenKz As Object = Nothing
    Property eza_DV1LizenzgebuehrenUmstand As Object = Nothing
    Property eza_DV1SpezielleVereinbarungKz As Object = Nothing
    Property eza_DV1SpezielleVereinbarungUmstand As Object = Nothing
    Property eza_ZusatzangabenAnmeldung As Object = Nothing
    Property eza_KzAutoBestaetigung As Object = Nothing
    Property eza_AnschreibungDatum As Object = Nothing
    Property eza_Eingangszollstelle As Object = Nothing
    Property eza_Zahlungsart As Object = Nothing
    Property eza_ContainerNr1 As Object = Nothing
    Property eza_ContainerNr2 As Object = Nothing
    Property eza_ContainerNr3 As Object = Nothing
    Property eza_ContainerNr4 As Object = Nothing
    Property eza_ContainerNr5 As Object = Nothing
    Property eza_ContainerNr6 As Object = Nothing
    Property eza_ContainerNr7 As Object = Nothing
    Property eza_ContainerNr8 As Object = Nothing
    Property eza_ContainerNr9 As Object = Nothing
    Property eza_BeendigungsanteilArtCode As Object = Nothing
    Property eza_BewilligungsIDZLAVUV As Object = Nothing
    Property eza_BezugsnummerBEAnteilZL As Object = Nothing
    Property eza_UstIdAnmelder As Object = Nothing
    Property eza_FinanzamtAnmelder As Object = Nothing
    Property eza_Anmeldedatum As Object = Nothing




    Property eza_UNTERLAGEN As New List(Of cDakosy_EZA_Unterlagen)
    Property eza_WARENPOS As New List(Of cDakosy_EZA_Warenposition)

    Property eza_ADRESSEN As New List(Of cDakosy_EZA_Adressen)
    Property eza_AUFSCHUB As New List(Of cDakosy_EZA_Aufschub)
    Property eza_SUMABA As New List(Of cDakosy_EZA_SumABeendigungsAnteil)
    Property eza_BEA_ZLAvuv As New List(Of cDakosy_EZA_BEAnteilZLAVUV)


    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL


    Sub New()

    End Sub

    Sub New(eza_dyaAnmID As Integer, eza_Erstellung_SB As Integer)
        Me.eza_dyaAnmID = eza_dyaAnmID
        Me.eza_Erstellung_SB = eza_Erstellung_SB
        Me.eza_LetzteBearbeitung_SB = eza_Erstellung_SB
    End Sub

    Sub New(eza_Id)
        Me.eza_Id = eza_Id
        LOAD()
    End Sub

    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Id", eza_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Status", eza_Status))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Status_KEWILL_Equivalent", eza_Status_KEWILL_Equivalent))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_dyaArt", eza_dyaArt))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_dyaAnmID", eza_dyaAnmID))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ANR", eza_ANR))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_MRN", eza_MRN))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Erstellung", eza_Erstellung))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Erstellung_SB", eza_Erstellung_SB))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_LetzteBearbeitung", eza_LetzteBearbeitung))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_LetzteBearbeitung_SB", eza_LetzteBearbeitung_SB))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_firma", eza_firma))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_niederlassung", eza_niederlassung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Trans_Partner", eza_Trans_Partner))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Trans_Div1", eza_Trans_Div1))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Trans_Div2", eza_Trans_Div2))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Trans_Div3", eza_Trans_Div3))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Trans_Referenz", eza_Trans_Referenz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Trans_DatumZeit", eza_Trans_DatumZeit))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Trans_Version", eza_Trans_Version))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_NachrichtenSenderTIN", eza_NachrichtenSenderTIN))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_NachrichtenSenderNLNR", eza_NachrichtenSenderNLNR))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_NachrichtenempfaengerDST", eza_NachrichtenempfaengerDST))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ObjectName", eza_ObjectName))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ObjectAlias", eza_ObjectAlias))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BezugsnummerVorblendung", eza_BezugsnummerVorblendung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Bearbeiter", eza_Bearbeiter))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnmeldungArt", eza_AnmeldungArt))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_CompliancePruefung", eza_CompliancePruefung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnfBemerkungStatusanzeige", eza_AnfBemerkungStatusanzeige))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AdressierteZollstelle", eza_AdressierteZollstelle))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnmelderistEmpfaenger", eza_AnmelderistEmpfaenger))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_VertretungsVerhaeltnisCode", eza_VertretungsVerhaeltnisCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Vorsteuerabzug", eza_Vorsteuerabzug))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnmeldenderBearbeiterName", eza_AnmeldenderBearbeiterName))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnmeldenderBearbeiterTel", eza_AnmeldenderBearbeiterTel))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnmeldenderBearbeiterStellung", eza_AnmeldenderBearbeiterStellung))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnmeldenderBearbeiterEMail", eza_AnmeldenderBearbeiterEMail))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_FiskalvertretungKz", eza_FiskalvertretungKz))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Ausstellungsort", eza_Ausstellungsort))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ZollrechtlicherStatus", eza_ZollrechtlicherStatus))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_GesamtRohmasse", eza_GesamtRohmasse))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_VerfahrenBeantragtCode", eza_VerfahrenBeantragtCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_VerkehrszweigInland", eza_VerkehrszweigInland))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_VerkehrszweigGrenze", eza_VerkehrszweigGrenze))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_VersendungsLandCode", eza_VersendungsLandCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Bestimmungsbundesland", eza_Bestimmungsbundesland))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Bestimmungsland", eza_Bestimmungsland))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_KennzeichenNameBefoerderungsmittelAnkunft", eza_KennzeichenNameBefoerderungsmittelAnkunft))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BeförderungsmittelGrenzeStaatszugehörigkeitCode", eza_BeförderungsmittelGrenzeStaatszugehörigkeitCode))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BeförderungsmittelGrenzeArt", eza_BeförderungsmittelGrenzeArt))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BeförderungsmittelGrenze", eza_BeförderungsmittelGrenze))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_LieferbedingungCode", eza_LieferbedingungCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_LieferbedingungText", eza_LieferbedingungText))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_LieferbedingungSchluessel", eza_LieferbedingungSchluessel))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_LieferbedingungOrt", eza_LieferbedingungOrt))



        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_VorpapierArtCode", eza_VorpapierArtCode))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_VorpapierNr", eza_VorpapierNr))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ArtGeschaeftCode", eza_ArtGeschaeftCode))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Statistikstatus", eza_Statistikstatus))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Warenort", eza_Warenort))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Rechnungspreis", eza_Rechnungspreis))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Rechnungswaehrung", eza_Rechnungswaehrung))
            list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1Kz", eza_DV1Kz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1Vertretungsverhaeltnis", eza_DV1Vertretungsverhaeltnis))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1FruehereEntscheidungen", eza_DV1FruehereEntscheidungen))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1Verbundenheit", eza_DV1Verbundenheit))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1VerbungenheitEinzelheiten", eza_DV1VerbungenheitEinzelheiten))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1EinschraenkungenKz", eza_DV1EinschraenkungenKz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1BedingungenLeistungenKz", eza_DV1BedingungenLeistungenKz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1BedingungenLeistungenArt", eza_DV1BedingungenLeistungenArt))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1LizenzgebuehrenKz", eza_DV1LizenzgebuehrenKz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1LizenzgebuehrenUmstand", eza_DV1LizenzgebuehrenUmstand))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1SpezielleVereinbarungKz", eza_DV1SpezielleVereinbarungKz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_DV1SpezielleVereinbarungUmstand", eza_DV1SpezielleVereinbarungUmstand))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ZusatzangabenAnmeldung", eza_ZusatzangabenAnmeldung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_KzAutoBestaetigung", eza_KzAutoBestaetigung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_AnschreibungDatum", eza_AnschreibungDatum))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Eingangszollstelle", eza_Eingangszollstelle))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Zahlungsart", eza_Zahlungsart))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr1", eza_ContainerNr1))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr2", eza_ContainerNr2))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr3", eza_ContainerNr3))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr4", eza_ContainerNr4))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr5", eza_ContainerNr5))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr6", eza_ContainerNr6))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr8", eza_ContainerNr8))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_ContainerNr9", eza_ContainerNr9))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BeendigungsanteilArtCode", eza_BeendigungsanteilArtCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BewilligungsIDZLAVUV", eza_BewilligungsIDZLAVUV))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BezugsnummerBEAnteilZL", eza_BezugsnummerBEAnteilZL))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_UstIdAnmelder", eza_UstIdAnmelder))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_FinanzamtAnmelder", eza_FinanzamtAnmelder))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Anmeldedatum", eza_Anmeldedatum))

        Return list
    End Function

    Public Function UPDATE_STATUS(status) As Boolean
        Me.eza_Status = status
        Return Me.SAVE
    End Function




    Public Function SAVE() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()

        If Not VERAG_PROG_ALLGEMEIN.cProgramFunctions.ValidateSQLFieldLengths(list, "tblDakosy_EZA", "", "FMZOLL") Then
            Return False
        End If


        Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblDakosy_eza WITH(updlock,serializable) WHERE eza_Id=@eza_Id) " &
                       " BEGIN " & getUpdateCmd() & " END " &
                       " Else " &
                       " BEGIN " & getInsertCmd() & " END " &
                       " commit tran "

        eza_Id = SQL.doSQLVarListID(eza_Id, sqlstr, "FMZOLL", , list)
        Return eza_Id > 0
    End Function

    Public Function SAVE_ALL() As Boolean
        If Not SAVE() Then Return False
        If Not SAVE_Warenposition() Then Return False
        If Not SAVE_Unterlagen() Then Return False

        If Not SAVE_Adressen() Then Return False
        If Not SAVE_Aufschub() Then Return False
        If Not SAVE_BEAnteilZLAVUV() Then Return False
        If Not SAVE_SumABeendigungsAnteil() Then Return False
        Return True
    End Function

    Public Function LOAD(Optional loadALL As Boolean = True) As Boolean
        Try
            LOAD = False
            If loadALL Then
                'eza_Unterlagen.Clear()
                eza_WARENPOS.Clear()
                eza_UNTERLAGEN.Clear()

                eza_ADRESSEN.Clear()
                eza_AUFSCHUB.Clear()
                eza_BEA_ZLAvuv.Clear()
                eza_SUMABA.Clear()
            End If
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_eza WHERE eza_Id=@eza_Id  ", conn)
                    cmd.Parameters.AddWithValue("@eza_Id", eza_Id)
                    Dim dr = cmd.ExecuteReader()
                    If dr.Read Then
                        For Each l In getParameterList()
                            Dim propInfo As PropertyInfo = Me.GetType.GetProperty(l.Scalarvariable)

                            If dr.Item(l.Text) Is DBNull.Value Then
                                propInfo.SetValue(Me, Nothing)
                            Else
                                propInfo.SetValue(Me, dr.Item(l.Text))
                            End If

                        Next
                        If loadALL Then
                            LOAD_Unterlagen()
                            LOAD_Warenposition()

                            LOAD_Adressen()
                            LOAD_Aufschub()
                            LOAD_BEAnteilZLAVUV()
                            LOAD_SumABeendigungsAnteil()
                        End If
                        LOAD = True
                    End If
                    dr.Close()

                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return LOAD
    End Function


    Shared Function LOADByAnmIDFull(eza_dyaAnmID As String, loadALL As Boolean) As cDakosyEZA
        Try
            Dim EZA As New cDakosyEZA
            Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT TOP 1 * FROM tblDakosy_EZA WHERE eza_dyaAnmID=@eza_dyaAnmID  ", conn)
                    cmd.Parameters.AddWithValue("@eza_dyaAnmID", eza_dyaAnmID)
                    Dim dr = cmd.ExecuteReader()
                    If dr.Read Then
                        For Each l In EZA.getParameterList()
                            Dim propInfo As PropertyInfo = EZA.GetType.GetProperty(l.Scalarvariable)

                            If dr.Item(l.Text) Is DBNull.Value Then
                                propInfo.SetValue(EZA, Nothing)
                            Else
                                propInfo.SetValue(EZA, dr.Item(l.Text))
                            End If

                        Next
                        If loadALL Then
                            EZA.LOAD_Unterlagen()
                            EZA.LOAD_Warenposition()

                            EZA.LOAD_Adressen()
                            EZA.LOAD_Aufschub()
                            EZA.LOAD_BEAnteilZLAVUV()
                            EZA.LOAD_SumABeendigungsAnteil()
                        End If

                        dr.Close()
                        Return EZA
                    End If
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return Nothing
    End Function



    Shared Function UPDATE_StatusById(eza_id As Integer, status As Integer) As String
        If eza_id > 0 Then
            Try
                Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
                list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_id", eza_id, , True))
                list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Status_KEWILL_Equivalent", status, , True))
                list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Status", status, , True))
                'dy_Status_KEWILL_Equivalent = status
                'dy_Status = status
                Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

                Return SQL.doSQLVarList(" UPDATE [tblDakosy_EZA] SET eza_Status_KEWILL_Equivalent=@eza_Status_KEWILL_Equivalent,eza_Status=@eza_Status WHERE eza_id=@eza_id ", "FMZOLL", , list)

            Catch ex As Exception
                VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
            End Try
        End If
        Return ""
    End Function


    Public Function LOADByAnmID(eza_dyaAnmID As String, loadALL As Boolean) As Boolean
        Try
            LOADByAnmID = False
            If loadALL Then
                eza_UNTERLAGEN.Clear()
                eza_WARENPOS.Clear()

                eza_ADRESSEN.Clear()
                eza_AUFSCHUB.Clear()
                eza_BEA_ZLAvuv.Clear()
                eza_SUMABA.Clear()
            End If
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT TOP 1 * FROM tblDakosy_EZA WHERE eza_dyaAnmID=@eza_dyaAnmID  ", conn)
                    cmd.Parameters.AddWithValue("@eza_dyaAnmID", eza_dyaAnmID)
                    Dim dr = cmd.ExecuteReader()
                    If dr.Read Then
                        For Each l In getParameterList()
                            Dim propInfo As PropertyInfo = Me.GetType.GetProperty(l.Scalarvariable)

                            If dr.Item(l.Text) Is DBNull.Value Then
                                propInfo.SetValue(Me, Nothing)
                            Else
                                propInfo.SetValue(Me, dr.Item(l.Text))
                            End If

                        Next
                        If loadALL Then
                            LOAD_Unterlagen()
                            LOAD_Warenposition()

                            LOAD_Adressen()
                            LOAD_Aufschub()
                            LOAD_BEAnteilZLAVUV()
                            LOAD_SumABeendigungsAnteil()
                        End If
                        LOADByAnmID = True
                    End If
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return LOADByAnmID
    End Function
    Sub loadAll()

        Me.LOAD_Unterlagen()
        Me.LOAD_Warenposition()

        Me.LOAD_Adressen()
        Me.LOAD_Aufschub()
        Me.LOAD_BEAnteilZLAVUV()
        Me.LOAD_SumABeendigungsAnteil()


    End Sub
    Shared Function LOADByBezugsNr(bezugsNr As String, loadALL As Boolean, Optional checkValidStatus As Boolean = False) As cDakosyEZA
        Try
            Dim EZA As New cDakosyEZA
            Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                '  Using cmd As New SqlCommand("SELECT TOP 1 * FROM (SELECT *  FROM tblDakosy_EZA WHERE eza_ObjectName LIKE @bezugsNr " & If(checkValidStatus, " AND eza_status BETWEEN 40 and 90 ", "") & " ) AS T order by eza_status desc, (SELECT top 1 dySt_ts  FROM [tblDakosy_Statusmeldungen] WHERE eza_dyaAnmID=dySt_dyId order by dySt_ts desc)  desc,eza_LetzteBearbeitung desc  ", conn)
                Using cmd As New SqlCommand("SELECT TOP 1 * FROM tblDakosy_EZA WHERE eza_ObjectName LIKE @bezugsNr " & If(checkValidStatus, " AND eza_status BETWEEN 40 and 90 ", "") & " order by eza_LetzteBearbeitung desc ", conn)
                    '    MsgBox("SELECT TOP 1 * FROM tblDakosy_EZA WHERE eza_ObjectName Like " & bezugsNr & " " & If(checkValidStatus, " And eza_status BETWEEN 40 And 90 ", "") & " order by eza_status desc, (SELECT top 1 dySt_ts  FROM [tblDakosy_Statusmeldungen] inner join tblDakosy_Zollanmeldungen on dy_id = dySt_dyId WHERE eza_dyaAnmID=dy_id order by dySt_ts desc)  desc,eza_LetzteBearbeitung desc  ")
                    cmd.Parameters.AddWithValue("@bezugsNr", bezugsNr)
                    Dim dr = cmd.ExecuteReader()
                    If dr.Read Then
                        For Each l In EZA.getParameterList()
                            Dim propInfo As PropertyInfo = EZA.GetType.GetProperty(l.Scalarvariable)

                            If dr.Item(l.Text) Is DBNull.Value Then
                                propInfo.SetValue(EZA, Nothing)
                            Else
                                propInfo.SetValue(EZA, dr.Item(l.Text))
                            End If
                        Next

                        If loadALL Then
                            EZA.LOAD_Unterlagen()
                            EZA.LOAD_Warenposition()

                            EZA.LOAD_Adressen()
                            EZA.LOAD_Aufschub()
                            EZA.LOAD_BEAnteilZLAVUV()
                            EZA.LOAD_SumABeendigungsAnteil()
                        End If

                        dr.Close()
                        Return EZA
                    End If
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return Nothing
    End Function

    Shared Function LOADByMRN(MRN As String, loadALL As Boolean, Optional checkValidStatus As Boolean = False) As cDakosyEZA
        Try
            Dim EZA As New cDakosyEZA
            Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                '  Using cmd As New SqlCommand("SELECT TOP 1 * FROM (SELECT *  FROM tblDakosy_EZA WHERE eza_ObjectName LIKE @bezugsNr " & If(checkValidStatus, " AND eza_status BETWEEN 40 and 90 ", "") & " ) AS T order by eza_status desc, (SELECT top 1 dySt_ts  FROM [tblDakosy_Statusmeldungen] WHERE eza_dyaAnmID=dySt_dyId order by dySt_ts desc)  desc,eza_LetzteBearbeitung desc  ", conn)
                Using cmd As New SqlCommand("SELECT TOP 1 * FROM tblDakosy_EZA WHERE isnull(eza_MRN,eza_ANR) LIKE @MRN " & If(checkValidStatus, " AND eza_status BETWEEN 40 and 90 ", "") & " order by eza_LetzteBearbeitung desc ", conn)
                    '    MsgBox("SELECT TOP 1 * FROM tblDakosy_EZA WHERE eza_ObjectName Like " & bezugsNr & " " & If(checkValidStatus, " And eza_status BETWEEN 40 And 90 ", "") & " order by eza_status desc, (SELECT top 1 dySt_ts  FROM [tblDakosy_Statusmeldungen] inner join tblDakosy_Zollanmeldungen on dy_id = dySt_dyId WHERE eza_dyaAnmID=dy_id order by dySt_ts desc)  desc,eza_LetzteBearbeitung desc  ")
                    cmd.Parameters.AddWithValue("@MRN", MRN)
                    Dim dr = cmd.ExecuteReader()
                    If dr.Read Then
                        For Each l In EZA.getParameterList()
                            Dim propInfo As PropertyInfo = EZA.GetType.GetProperty(l.Scalarvariable)

                            If dr.Item(l.Text) Is DBNull.Value Then
                                propInfo.SetValue(EZA, Nothing)
                            Else
                                propInfo.SetValue(EZA, dr.Item(l.Text))
                            End If
                        Next

                        If loadALL Then
                            EZA.LOAD_Unterlagen()
                            EZA.LOAD_Warenposition()

                            EZA.LOAD_Adressen()
                            EZA.LOAD_Aufschub()
                            EZA.LOAD_BEAnteilZLAVUV()
                            EZA.LOAD_SumABeendigungsAnteil()
                        End If

                        dr.Close()
                        Return EZA
                    End If
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return Nothing
    End Function


    Public Function UPDATE_Status(status As Integer) As String
        If eza_Id > 0 Then
            Try
                Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
                list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Id", eza_Id, , True))
                list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Status", status, , True))
                list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_Status_KEWILL_Equivalent", status, , True))
                eza_Status = status
                eza_Status_KEWILL_Equivalent = status
                Return SQL.doSQLVarList(" UPDATE [tblDakosy_eza] SET eza_Status_KEWILL_Equivalent=@eza_Status_KEWILL_Equivalent,eza_Status=@eza_Status WHERE eza_Id=@eza_Id ", "FMZOLL", , list)

            Catch ex As Exception
                VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
            End Try
        End If
        Return ""
    End Function


    Public Function getUpdateCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()

            Dim str As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            Return (" UPDATE [tblDakosy_EZA] SET " & str & " WHERE eza_id=@eza_id ")

        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return ""
    End Function


    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA  (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return ""
    End Function

    Public Sub LOAD_Unterlagen()
        Try
            eza_UNTERLAGEN.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_Unterlagen WHERE ezaUL_ezaId=@eza_id  ", conn)
                    cmd.Parameters.AddWithValue("@eza_id", Me.eza_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_Unterlagen
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        eza_UNTERLAGEN.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub


    Public Sub LOAD_Adressen()
        Try
            eza_ADRESSEN.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_Adressen WHERE ezaAd_ezaId=@eza_id  ", conn)
                    cmd.Parameters.AddWithValue("@eza_id", Me.eza_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_Adressen
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        eza_ADRESSEN.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub
    Public Sub LOAD_Aufschub()
        Try
            eza_AUFSCHUB.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_Aufschub WHERE ezaAfb_EZAId=@eza_id  ", conn)
                    cmd.Parameters.AddWithValue("@eza_id", Me.eza_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_Aufschub
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        eza_AUFSCHUB.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub
    Public Sub LOAD_BEAnteilZLAVUV()
        Try
            eza_BEA_ZLAvuv.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_BEAnteilZLAVUV WHERE ezaBAZ_ezaId=@eza_id  ", conn)
                    cmd.Parameters.AddWithValue("@eza_id", Me.eza_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_BEAnteilZLAVUV
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        eza_BEA_ZLAvuv.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub
    Public Sub LOAD_SumABeendigungsAnteil()
        Try
            eza_SUMABA.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_SumABeendigungsAnteil WHERE ezaBa_ezaId=@eza_id  ", conn)
                    cmd.Parameters.AddWithValue("@eza_id", Me.eza_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_SumABeendigungsAnteil
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        eza_SUMABA.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub

    Public Sub LOAD_Warenposition()
        Try
            eza_WARENPOS.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_Warenposition WHERE ezaWP_EzaId=@eza_id  ", conn)
                    cmd.Parameters.AddWithValue("@eza_id", Me.eza_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_Warenposition()
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        l.LOAD_WarenpositionPackstuecke()
                        l.LOAD_WarenpositionUnterlagen()
                        eza_WARENPOS.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub

    Function DELETE_Warenpositionen() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_Warenposition] WHERE ezaWP_EzaId=" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function

    Function DELETE_WarenpositionSonderfalldaten() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_WarenpositionSonderfalldaten] WHERE ezaWpSfd_ezaId=" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function

    Function DELETE_WarenpositionUnterlagen() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_WarenpositionUnterlagen] WHERE ezaWpUl_ezaId =" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function

    Function DELETE_WarenpositionVerbrauchssteuer() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_WarenpositionVerbrauchssteuer] WHERE ezaWpVs_ezaId =" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function


    Function DELETE_Adressen() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_Adressen] WHERE ezaAd_ezaId =" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function


    Function DELETE_Aufschub() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_Aufschub] WHERE ezaAfb_ezaId =" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function


    Function DELETE_BEAnteilZLAVUV() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_BEAnteilZLAVUV] WHERE ezaBAZ_ezaId =" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function


    Function DELETE_SumABeendigungsAnteil() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_SumABeendigungsAnteil] WHERE ezaBa_ezaId =" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function


    Function DELETE_Unterlagen() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_Unterlagen] WHERE ezaUL_ezaId=" & Me.eza_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function




    Public Function SAVE_Warenposition() As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen
        If DELETE_Warenpositionen() And DELETE_WarenpositionSonderfalldaten() And DELETE_WarenpositionUnterlagen() And DELETE_WarenpositionVerbrauchssteuer() Then
            'jetzt die Standartofferten  einfügen
            For Each p In eza_WARENPOS
                p.ezaWP_EzaId = eza_Id
                If p.INSERT() Then
                    p.INSERT_WarenpositionSonderfalldaten(p.ezaWP_Id, Me.eza_Id)
                    p.INSERT_WarenpositionUnterlagen(p.ezaWP_Id, Me.eza_Id)
                    p.INSERT_WarenpositionVerbrauchssteuer(p.ezaWP_Id, Me.eza_Id)
                Else
                    Return False
                End If
            Next
        Else
            Return False
        End If

        Return True
    End Function


    Public Function SAVE_Unterlagen() As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen
        If DELETE_Unterlagen() Then
            'jetzt die Standartofferten  einfügen
            For Each p In eza_UNTERLAGEN
                p.ezaUl_EZAId = eza_Id
                If Not p.INSERT() Then
                    Return False
                End If
            Next
        Else
            Return False
        End If
        Return True
    End Function



    Public Function SAVE_Adressen() As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen
        If DELETE_Adressen() Then
            'jetzt die Standartofferten  einfügen
            For Each p In eza_ADRESSEN
                p.ezaAd_EZAId = eza_Id
                If Not p.INSERT() Then
                    Return False
                End If
            Next
        Else
            Return False
        End If
        Return True
    End Function


    Public Function SAVE_Aufschub() As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen
        If DELETE_Aufschub() Then
            'jetzt die Standartofferten  einfügen
            For Each p In eza_AUFSCHUB
                p.ezaAfb_EZAId = eza_Id
                If Not p.INSERT() Then
                    Return False
                End If
            Next
        Else
            Return False
        End If
        Return True
    End Function

    Public Function SAVE_BEAnteilZLAVUV() As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen
        If DELETE_BEAnteilZLAVUV() Then
            'jetzt die Standartofferten  einfügen
            For Each p In eza_BEA_ZLAvuv
                p.ezaBAZ_EZAId = eza_Id
                If Not p.INSERT() Then
                    Return False
                End If
            Next
        Else
            Return False
        End If
        Return True
    End Function

    Public Function SAVE_SumABeendigungsAnteil() As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen
        If DELETE_SumABeendigungsAnteil() Then
            'jetzt die Standartofferten  einfügen
            For Each p In eza_SUMABA
                p.ezaBa_EZAId = eza_Id
                If Not p.INSERT() Then
                    Return False
                End If
            Next
        Else
            Return False
        End If
        Return True
    End Function



    Function countSpedbuchEntrys(filiale, ncts) As Integer
        If If(ncts, "") = "" Then Return 0
        Return SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM Speditionsbuch WHERE [FilialenNr]='" & filiale & "' AND AtlasBezNrEZA='" & ncts & "'", "FMZOLL")
    End Function



    Shared Function countSpedbuchEntrysFilialeAbf(filiale, abfertigungsnummer) As Integer
        Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
        If If(abfertigungsnummer, "") = "" Then Return 0
        Return SQL.getValueTxtBySqlVarList("SELECT isnull(count(*),0) FROM Speditionsbuch WHERE [FilialenNr]='" & filiale & "' AND AbfertigungsNr='" & abfertigungsnummer & "'", "FMZOLL")
    End Function


    Function insertIntoSpedBuch(DY As cDakosy_Zollanmeldungen) As Boolean
        Dim SPEDBUCH As New VERAG_PROG_ALLGEMEIN.cSpeditionsbuch
        Dim cZOLL_IMPORT As New cZOLL_IMPORT
        If False Then 'If(Me.eza_firma, "") = "IMEX" Then

            'If countSpedbuchEntrys(5501, Me.eza_ObjectName) = 0 Then
            '    SPEDBUCH.FilialenNr = 5501
            '    SPEDBUCH.AbfertigungsNr = VERAG_PROG_ALLGEMEIN.cAllgemein.getMaxPosNrIncrement(SPEDBUCH.FilialenNr, Now.Year)
            '    SPEDBUCH.NewUNTER_NR()

            '    'Ermittlung Abfertigungsart
            '    Dim EZA As DAKOSY_Worker.cDakosyEZA = DAKOSY_Worker.cDakosyEZA.LOADByBezugsNr(Me.eza_ObjectName, True)
            '    If EZA IsNot Nothing Then
            '        If EZA.eza_FiskalvertretungKz Then
            '            SPEDBUCH.Abfertigungsart = 28
            '        Else
            '            SPEDBUCH.Abfertigungsart = 1
            '        End If
            '    End If
            '    SPEDBUCH.Abfertigungsanzahl = 1
            '    SPEDBUCH.Fakturiert = 1

            '    SPEDBUCH.Sachbearbeiter = "AUTO"
            '    SPEDBUCH.AtlasBezNrEZA = Me.eza_ObjectName
            '    SPEDBUCH.Zollsystem = "D"

            '    Dim notfound = False
            '    Dim posAnzahl = 0
            '    ' DakosyEZADatenbereitstellung(SPEDBUCH, Me.eza_ObjectName, notfound, posAnzahl)

            '    If Not notfound Then
            '        Return SPEDBUCH.SAVE
            '    Else
            '        Return False
            '    End If
            'End If
        Else
            Dim firmaTmp = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
            VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = If(If(Me.eza_firma, "") <> "", Me.eza_firma, "VERAG")
            If DY.dy_SendungsId IsNot Nothing Then
                'Filiale erkennen:
                Dim filialeBez = ""
                Dim filiale = getFiliale(Me.eza_ObjectName, filialeBez)
                Dim abfertigungsnummer = getAbfertigungsnummer(Me.eza_ObjectName)

                If abfertigungsnummer = "" Then
                    getFilialeAbfertigungsnummerFromSendung(filiale, abfertigungsnummer, DY.dy_SendungsId)
                End If

                If filiale <> "" And abfertigungsnummer <> "" Then
                    If countSpedbuchEntrysFilialeAbf(filiale, abfertigungsnummer) = 0 Then
                        '  VERAG_PROG_ALLGEMEIN.cErrorHandler.sendERRORperMail("HEUREKA EZA ", "" & Me.eza_ObjectName, Now.ToString("yyyy.MM.dd HH:mm"), "al@verag.ag", "")
                        SPEDBUCH.FilialenNr = filiale
                        SPEDBUCH.AbfertigungsNr = abfertigungsnummer
                        SPEDBUCH.NewUNTER_NR()

                        SPEDBUCH.Abfertigungsanzahl = 1
                        SPEDBUCH.Fakturiert = 0
                        SPEDBUCH.AtlasBezNrEZA = Me.eza_ObjectName
                        SPEDBUCH.Zollsystem = "D"
                        SPEDBUCH.Sachbearbeiter = "AUTO"

                        SPEDBUCH.AvisoID = DY.dy_AvisoId
                        SPEDBUCH.SendungID = DY.dy_SendungsId

                        Dim ZOLL_IMPORT As New cZOLL_IMPORT
                        Dim notfound = False
                        Dim posAnzahl = 0
                        SPEDBUCH = ZOLL_IMPORT.IMPORT(SPEDBUCH, DY.dy_AvisoId, DY.dy_SendungsId, "VERA", filialeBez, 2, Me.eza_ObjectName, "", notfound, True)

                        If notfound Then Return False
                        '   VERAG_PROG_ALLGEMEIN.cErrorHandler.sendERRORperMail("HEUREKA EZA !!", "" & Me.eza_ObjectName, Now.ToString("yyyy.MM.dd HH:mm"), "al@verag.ag", "")

                        ' MsgBox(SPEDBUCH.FilialenNr & " - " & SPEDBUCH.AbfertigungsNr)
                        VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = firmaTmp

                        If SPEDBUCH.SAVE Then
                            VERAG_PROG_ALLGEMEIN.cSendungen.SET_SpedbuchEntry(DY.dy_SendungsId, True)
                            Return True
                        Else
                            Return False
                        End If


                        '  MsgBox(SQL.getValueTxtBySql("select count(*)                         FROM [VERAG].[dbo].[Speditionsbuch]                        where AbfertigungsNr = 18035380", "FMZOLL"))

                    End If
                End If
            Else
                Return False 'Ohne Sendungsverweis kein eintrag...
            End If
        End If
        Return False

    End Function




    Shared Function getFiliale(ByVal bezugsNr, ByRef filialeBez) As String
        If If(bezugsNr, "").ToString.Length > 4 Then
            Select Case bezugsNr.ToString.Substring(0, 4)
                Case "4803" : Return bezugsNr.ToString.Substring(0, 4) '...... derzeit nur 4803
                Case "4805" : Return bezugsNr.ToString.Substring(0, 4) '...... derzeit nur 4803
                Case "4811" : Return bezugsNr.ToString.Substring(0, 4) '...... derzeit nur 4803
                Case "5003" : Return bezugsNr.ToString.Substring(0, 4) '...... derzeit nur 4803
                Case "5103" : Return bezugsNr.ToString.Substring(0, 4) '...... derzeit nur 4803
                Case "5303" : Return bezugsNr.ToString.Substring(0, 4) '...... derzeit nur 4803

                Case "5501", "5601", "5701", "5801" : Return bezugsNr.ToString.Substring(0, 4) '...... derzeit nur 4803
                Case Else
                    If IsNumeric(bezugsNr.ToString.Substring(0, 4)) Then Return bezugsNr.ToString.Substring(0, 4)
                    'Case "4801", "4803", "4805", "4807", "4811", "5003", "5103", "5303" : Return bezugsNr.ToString.Substring(0, 4) ...... derzeit nur 4803
                    'filialeBez SUB, NKD, WAI,.-..
            End Select
        End If
        Return ""
    End Function

    Shared Function getAbfertigungsnummer(ByVal bezugsNr) As String
        getAbfertigungsnummer = ""
        If If(bezugsNr, "").ToString.Length > 5 Then

            Dim abf = ""
            For Each s In bezugsNr.ToString.Substring(5)
                If Not IsNumeric(s) Then Exit For
                abf &= s
            Next
            If IsNumeric(abf) Then
                If CLng(abf) < 99000000 Then
                    If CLng(abf) > 18000000 Then
                        Return abf
                    Else
                        Return Now.ToString("yy") & CInt(abf).ToString("000000")
                    End If
                End If
            End If
        End If
        Return ""
    End Function

    Shared Sub getFilialeAbfertigungsnummerFromSendung(ByRef filiale, ByRef abfertigungsnummer, dy_SendungsId)
        If dy_SendungsId IsNot Nothing AndAlso IsNumeric(dy_SendungsId) Then
            Dim SND As New VERAG_PROG_ALLGEMEIN.cSendungen(dy_SendungsId)
            If SND IsNot Nothing Then
                If SND.FilialenNr > 0 Then filiale = SND.FilialenNr
                If SND.AbfertigungsNr > 0 Then abfertigungsnummer = SND.AbfertigungsNr
            End If
        End If
    End Sub

    Public Shared Sub DakosyEZADatenbereitstellung(ByRef SPEDITIONSBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch, EZA_Nr As String, ByRef notFound As Boolean, ByRef PosAnzahl As Integer)
        Dim DY As DAKOSY_Worker.cDakosyEZA = DAKOSY_Worker.cDakosyEZA.LOADByBezugsNr(EZA_Nr, True)
        If DY Is Nothing Then
            notFound = True
            Exit Sub
        End If
        DakosyEZADatenbereitstellung(SPEDITIONSBUCH, DY, notFound, PosAnzahl)
    End Sub

    Public Shared Sub DakosyAESDatenbereitstellung(ByRef SPEDITIONSBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch, EZA_Nr As String, ByRef notFound As Boolean, ByRef PosAnzahl As Integer)
        Dim DY As DAKOSY_Worker.cDakosyAES = DAKOSY_Worker.cDakosyAES.LOADByBezugsNr(EZA_Nr, True)
        If DY Is Nothing Then
            notFound = True
            Exit Sub
        End If
        DakosyAESDatenbereitstellung(SPEDITIONSBUCH, DY, notFound, PosAnzahl)
    End Sub





    Public Shared Sub DakosyEZADatenbereitstellung(ByRef SPEDITIONSBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch, DY As DAKOSY_Worker.cDakosyEZA, ByRef notFound As Boolean, ByRef PosAnzahl As Integer)
        Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

        notFound = False


        Try

            If SPEDITIONSBUCH.Abfertigungsdatum Is Nothing Then SPEDITIONSBUCH.Abfertigungsdatum = Now 'CDate(DY.eza_Trans_DatumZeit).ToShortDateString

            Try

                Dim ANM As New DAKOSY_Worker.cDakosy_Zollanmeldungen(DY.eza_dyaAnmID)
                SPEDITIONSBUCH.DokumentId_Steuerbeleg = ANM.dy_Steuerbescheid_dsId
                SPEDITIONSBUCH.DokumentId_VBD = ANM.dy_VBD_dsId

            Catch ex As Exception

                ' MsgBox("ERR: " & ex.Message & ex.StackTrace)
                VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)


            End Try

            'Falls DocId nicht gefunden wird.. warum auch immer..
            If SPEDITIONSBUCH.DokumentId_Steuerbeleg Is Nothing Then
                SPEDITIONSBUCH.DokumentId_Steuerbeleg = SQL.getValueTxtBySql("SELECT [da_id] FROM tblDatenarchiv where da_kategorie='ZOLLDATEN' and [da_ordner]='STEUERBESCHEID'  and da_name='" & SPEDITIONSBUCH.AtlasBezNrEZA.Replace("/", "-") & "' ", "FMZOLL",,, Nothing)
            End If


            SPEDITIONSBUCH.Versendungsland = DY.eza_VersendungsLandCode
            SPEDITIONSBUCH.Bestimmungsland = DY.eza_Bestimmungsland
            SPEDITIONSBUCH.LKW_Kennzeichen = DY.eza_KennzeichenNameBefoerderungsmittelAnkunft
            SPEDITIONSBUCH.BelegNr = If(DY.eza_MRN, DY.eza_ANR)
            If DY.eza_Rechnungswaehrung IsNot Nothing Then
                SPEDITIONSBUCH.Währungsschlüssel = If(DY.eza_Rechnungswaehrung = "EUR", "900", getWaehr(DY.eza_Rechnungswaehrung, SQL))
            End If


            For Each ADR In DY.eza_ADRESSEN
                'Verkäufer
                If ADR.ezaAd_AdressTyp = "CZ" Then
                    Dim AD = getAdresseFromEORI(ADR.ezaAd_TeilnehmerEORI, ADR.ezaAd_TeilnehmerNLNR, SQL, DY.eza_firma)
                    If AD IsNot Nothing Then
                        SPEDITIONSBUCH.AbsenderKundenNr = AD.AdressenNr
                        SPEDITIONSBUCH.Absender = AD.Ordnungsbegriff
                    End If
                    If If(SPEDITIONSBUCH.Absender, "").Trim = String.Empty Then
                        SPEDITIONSBUCH.Absender = (If(ADR.ezaAd_NameFirma1, "") & " " & If(ADR.ezaAd_NameFirma1, "") & " " & If(ADR.ezaAd_NameFirma1, "")).trim
                        SPEDITIONSBUCH.Absender &= ", " & If(ADR.ezaAd_LandCode, "")
                        SPEDITIONSBUCH.Absender &= " " & If(ADR.ezaAd_PLZ, "")
                        SPEDITIONSBUCH.Absender &= " " & If(ADR.ezaAd_Ort, "")
                        SPEDITIONSBUCH.Absender = SPEDITIONSBUCH.Absender.Trim
                        If SPEDITIONSBUCH.Absender.Length > 50 Then
                            SPEDITIONSBUCH.Absender = SPEDITIONSBUCH.Absender.Substring(0, 50)
                        End If
                    End If
                    ' If If(SPEDITIONSBUCH.Absender, "").Trim = String.Empty Then SPEDITIONSBUCH.Absender &= " " & If(ADR.ezaAd_TeilnehmerEORI, "")
                    If If(SPEDITIONSBUCH.Absender, "").Trim.Replace(",", "") = String.Empty Then SPEDITIONSBUCH.Absender = ""
                End If


                'Empfänger
                If ADR.ezaAd_AdressTyp = "CN" Then
                    Dim AD = getAdresseFromEORI(ADR.ezaAd_TeilnehmerEORI, ADR.ezaAd_TeilnehmerNLNR, SQL, DY.eza_firma)

                    If AD IsNot Nothing Then
                        SPEDITIONSBUCH.EmpfängerKundenNr = AD.AdressenNr
                        SPEDITIONSBUCH.Empfänger = AD.Ordnungsbegriff 'Oranier Küchentechnik GmbH; Haiger
                    End If
                    If If(SPEDITIONSBUCH.Empfänger, "").Trim = String.Empty Then
                        SPEDITIONSBUCH.Empfänger = (If(ADR.ezaAd_NameFirma1, "") & " " & If(ADR.ezaAd_NameFirma1, "") & " " & If(ADR.ezaAd_NameFirma1, "")).trim
                        SPEDITIONSBUCH.Empfänger &= ", " & If(ADR.ezaAd_LandCode, "")
                        SPEDITIONSBUCH.Empfänger &= " " & If(ADR.ezaAd_PLZ, "")
                        SPEDITIONSBUCH.Empfänger &= " " & If(ADR.ezaAd_Ort, "")
                        SPEDITIONSBUCH.Empfänger = SPEDITIONSBUCH.Empfänger.Trim
                        If SPEDITIONSBUCH.Empfänger.Length > 50 Then
                            SPEDITIONSBUCH.Empfänger = SPEDITIONSBUCH.Empfänger.Substring(0, 50)
                        End If
                    End If
                    'If If(SPEDITIONSBUCH.Empfänger, "").Trim = String.Empty Then SPEDITIONSBUCH.Empfänger &= " " & If(ADR.ezaAd_TeilnehmerEORI, "")
                    If If(SPEDITIONSBUCH.Empfänger, "").Trim.Replace(",", "") = String.Empty Then SPEDITIONSBUCH.Empfänger = ""

                End If

            Next


            If If(SPEDITIONSBUCH.Abfertigungsart, 0) < 1 Then
                If DY.eza_FiskalvertretungKz Then
                    SPEDITIONSBUCH.Abfertigungsart = 28
                Else
                    SPEDITIONSBUCH.Abfertigungsart = 1
                End If
            End If


            SPEDITIONSBUCH.Rechnungsbetrag = DY.eza_Rechnungspreis
            ' SPEDITIONSBUCH.Umrechnungskurs = DY.eza_Rechnungswaehrung
            SPEDITIONSBUCH.Rohmasse = DY.eza_GesamtRohmasse


            'Personal Abfertigung:
            Try
                If DY.eza_Bearbeiter IsNot Nothing Then
                    Dim p = SQL.getValueTxtBySql("SELECT  ISNULL(CASE WHEN [mit_FMZollPersIDKasseIsnotSpedBuch]=1 THEN [mit_FMZollPersIDSpedBuch] ELSE [mit_FMZollPersID] END ,-1) as [mit_FMZollPersID]  FROM [ADMIN].[dbo].[tblMitarbeiter] WHERE [mit_DAKOSY_SB]='" & DY.eza_Bearbeiter & "'", "ADMIN")
                    SPEDITIONSBUCH.Personalnummer = If(IsNumeric(p), p, Nothing)
                End If

                If If(SPEDITIONSBUCH.Personalnummer, "") = "" Then ' Falls nciht gefunden, mit vollem Namen
                    If DY.eza_AnmeldenderBearbeiterName IsNot Nothing Then
                        Dim p = SQL.getValueTxtBySql("SELECT  ISNULL(CASE WHEN [mit_FMZollPersIDKasseIsnotSpedBuch]=1 THEN [mit_FMZollPersIDSpedBuch] ELSE [mit_FMZollPersID] END ,-1) as [mit_FMZollPersID]  FROM [ADMIN].[dbo].[tblMitarbeiter] WHERE mit_DAKOSY_SBFull='" & DY.eza_AnmeldenderBearbeiterName & "' ", "ADMIN")
                        SPEDITIONSBUCH.Personalnummer = If(IsNumeric(p), p, Nothing)
                    End If

                End If
            Catch ex As Exception
                ' MsgBox( vbNewLine & ex.Message & vbNewLine & ex.StackTrace)
                VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, "Fehler DAKOSY Personal: " & ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)

            End Try


            Dim PackstAnz As Integer = 0
            Dim cnt = 0
            Dim rohmasseTmp As Double = 0
            Dim rechnungspreisTmp As Double = 0
            Dim packst As String = ""
            For Each p In DY.eza_WARENPOS
                If p.ezaWP_PackstueckAnzahl IsNot Nothing AndAlso IsNumeric(p.ezaWP_PackstueckAnzahl) Then
                    PackstAnz += p.ezaWP_PackstueckAnzahl
                    packst &= p.ezaWP_PackstueckAnzahl & " "
                End If
                If p.ezaWP_PackstueckArt IsNot Nothing Then
                    packst &= p.ezaWP_PackstueckArt & " "
                End If
                packst &= If(p.ezaWP_Warenbezeichnung, "") & vbNewLine
                rohmasseTmp += If(p.ezaWP_Eigenmasse, 0)
                rechnungspreisTmp += If(p.ezaWP_Artikelpreis, 0)
                If cnt = 0 Then

                End If
                cnt += 1
            Next
            packst = packst.Trim
            PosAnzahl = DY.eza_WARENPOS.Count
            If packst.Length > 185 Then packst = packst.Substring(0, 185) & "..."
            SPEDITIONSBUCH.Packstücke = packst & ", " & rohmasseTmp.ToString("N1") & " kg"

            If If(SPEDITIONSBUCH.Rohmasse, 0) = 0 AndAlso rohmasseTmp > 0 Then SPEDITIONSBUCH.Rohmasse = CInt(rohmasseTmp)
            If If(SPEDITIONSBUCH.Rechnungsbetrag, 0) = 0 AndAlso rechnungspreisTmp > 0 Then SPEDITIONSBUCH.Rechnungsbetrag = (rechnungspreisTmp)


        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

        End Try
    End Sub


    Public Shared Sub DakosyAESDatenbereitstellung(ByRef SPEDITIONSBUCH As VERAG_PROG_ALLGEMEIN.cSpeditionsbuch, DY As DAKOSY_Worker.cDakosyAES, ByRef notFound As Boolean, ByRef PosAnzahl As Integer)
        Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

        notFound = False


        Try

            If SPEDITIONSBUCH.Abfertigungsdatum Is Nothing Then SPEDITIONSBUCH.Abfertigungsdatum = Now 'CDate(DY.aes_Trans_DatumZeit).ToShortDateString

            Try

                Dim ANM As New DAKOSY_Worker.cDakosy_Zollanmeldungen(DY.aes_dyaAnmID)
                'SPEDITIONSBUCH.DokumentId_Steuerbeleg = ANM.dy_Steuerbescheid_dsId
                'SPEDITIONSBUCH.DokumentId_VBD = ANM.dy_VBD_dsId
                SPEDITIONSBUCH.DokumentId_ABD = ANM.dy_ABD_dsId
                SPEDITIONSBUCH.DokumentId_AVM = ANM.dy_AVM_dsId

            Catch ex As Exception
                VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

            End Try


            SPEDITIONSBUCH.Versendungsland = DY.aes_AusfuehrerTeilnehmerLandCode
            SPEDITIONSBUCH.Bestimmungsland = DY.aes_BestimmungslandCode
            SPEDITIONSBUCH.LKW_Kennzeichen = DY.aes_BefoerderungsmittelAbgangKennzeichen
            SPEDITIONSBUCH.BelegNr = If(DY.aes_MRN, DY.aes_ANR)
            'If DY.aes_Rechnungswaehrung IsNot Nothing Then
            '    SPEDITIONSBUCH.Währungsschlüssel = If(DY.aes_Rechnungswaehrung = "EUR", "900", getWaehr(DY.aes_Rechnungswaehrung, SQL))
            'End If


            'Absender
            Dim AD = getAdresseFromEORI(DY.aes_AusfuehrerTeilnehmerEORI, DY.aes_AusfuehrerTeilnehmerNLNR, SQL, DY.aes_firma)
            If AD IsNot Nothing Then
                SPEDITIONSBUCH.AbsenderKundenNr = AD.AdressenNr
                SPEDITIONSBUCH.Absender = AD.Ordnungsbegriff 'Oranier Küchentechnik GmbH; Haiger
            End If
            If If(SPEDITIONSBUCH.Absender, "").Trim = String.Empty Then
                SPEDITIONSBUCH.Absender = (If(DY.aes_AusfuehrerTeilnehmerName, "")).Trim
                SPEDITIONSBUCH.Absender &= ", " & If(DY.aes_AusfuehrerTeilnehmerLandCode, "")
                SPEDITIONSBUCH.Absender &= " " & If(DY.aes_AusfuehrerTeilnehmerPLZ, "")
                SPEDITIONSBUCH.Absender &= " " & If(DY.aes_AusfuehrerTeilnehmerOrt, "")
                SPEDITIONSBUCH.Absender = SPEDITIONSBUCH.Absender.Trim
                If SPEDITIONSBUCH.Absender.Length > 50 Then
                    SPEDITIONSBUCH.Absender = SPEDITIONSBUCH.Absender.Substring(0, 50)
                End If
            End If

            'Empfänger
            AD = Nothing
            AD = getAdresseFromEORI(DY.aes_EmpfaengerTeilnehmerEORI, DY.aes_EmpfaengerTeilnehmerNLNR, SQL, DY.aes_firma)
            If AD IsNot Nothing Then
                SPEDITIONSBUCH.EmpfängerKundenNr = AD.AdressenNr
                SPEDITIONSBUCH.Empfänger = AD.Ordnungsbegriff 'Oranier Küchentechnik GmbH; Haiger
            End If
            If If(SPEDITIONSBUCH.Empfänger, "").Trim = String.Empty Then
                SPEDITIONSBUCH.Empfänger = (If(DY.aes_EmpfaengerTeilnehmerName, "")).Trim
                SPEDITIONSBUCH.Empfänger &= ", " & If(DY.aes_EmpfaengerTeilnehmerLandCode, "")
                SPEDITIONSBUCH.Empfänger &= " " & If(DY.aes_EmpfaengerTeilnehmerPLZ, "")
                SPEDITIONSBUCH.Empfänger &= " " & If(DY.aes_EmpfaengerTeilnehmerOrt, "")
                SPEDITIONSBUCH.Empfänger = SPEDITIONSBUCH.Empfänger.Trim
                If SPEDITIONSBUCH.Empfänger.Length > 50 Then
                    SPEDITIONSBUCH.Empfänger = SPEDITIONSBUCH.Empfänger.Substring(0, 50)
                End If
            End If



            SPEDITIONSBUCH.Rechnungsbetrag = DY.aes_Rechnungspreis
            ' SPEDITIONSBUCH.Umrechnungskurs = DY.aes_Rechnungswaehrung
            SPEDITIONSBUCH.Rohmasse = DY.aes_GesamtRohmasse


            'Personal Abfertigung:
            Try
                If DY.aes_Bearbeiter IsNot Nothing Then
                    Dim p = SQL.getValueTxtBySql("SELECT  ISNULL(CASE WHEN [mit_FMZollPersIDKasseIsnotSpedBuch]=1 THEN [mit_FMZollPersIDSpedBuch] ELSE [mit_FMZollPersID] END ,-1) as [mit_FMZollPersID]  FROM [ADMIN].[dbo].[tblMitarbeiter] WHERE [mit_DAKOSY_SB]='" & DY.aes_Bearbeiter & "'", "ADMIN")
                    SPEDITIONSBUCH.Personalnummer = If(IsNumeric(p), p, Nothing)
                End If

            Catch ex As Exception
                VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, "Fehler DAKOSY Personal: " & ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

            End Try


            Dim PackstAnz As Integer = 0
            Dim cnt = 0
            Dim rohmasseTmp As Double = 0
            Dim rechnungspreisTmp As Double = 0
            Dim packst As String = ""
            For Each p In DY.aes_WARENPOS
                For Each pk In p.aesWP_PACKSTUECKE
                    PackstAnz += pk.aesWpPk_PackstueckeAnzahl
                Next
                packst &= PackstAnz

                'If p.ezaWP_PackstueckArt IsNot Nothing Then
                '    packst &= p.ezaWP_PackstueckArt & " "
                'End If
                packst &= If(p.aesWP_Warenbezeichnung, "") & vbNewLine
                rohmasseTmp += If(p.aesWP_Eigenmasse, 0)
                'rechnungspreisTmp += If(p.bet, 0)
                If cnt = 0 Then

                End If
                cnt += 1
            Next
            packst = packst.Trim
            PosAnzahl = DY.aes_WARENPOS.Count
            If packst.Length > 185 Then packst = packst.Substring(0, 185) & "..."
            SPEDITIONSBUCH.Packstücke = packst & ", " & rohmasseTmp.ToString("N1") & " kg"

            If If(SPEDITIONSBUCH.Rohmasse, 0) = 0 AndAlso rohmasseTmp > 0 Then SPEDITIONSBUCH.Rohmasse = CInt(rohmasseTmp)
            If If(SPEDITIONSBUCH.Rechnungsbetrag, 0) = 0 AndAlso rechnungspreisTmp > 0 Then SPEDITIONSBUCH.Rechnungsbetrag = (rechnungspreisTmp)


        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

        End Try
    End Sub

    Shared Function getWaehr(s As String, SQL As VERAG_PROG_ALLGEMEIN.SQL) As String
        'Return KDSQL.getValueTxtBySql("SELECT TOP 1 isnull([LandNr],-1) FROM [Länderverzeichnis für die Außenhandelsstatistik] WHERE [Währungscode]='" & s & "'", "FMZOLL")
        s = s.Replace("TRY", "TRL") ' Türkische Lira
        Return SQL.getValueTxtBySql("SELECT TOP 1 isnull([Währungsschlüssel],-1) FROM [Währungstabelle] WHERE [Währungscode]='" & s & "'", "FMZOLL")

    End Function

    Shared Function getAdresseFromEORI(EORI As String, EORI_NL As String, SQL As VERAG_PROG_ALLGEMEIN.SQL, Firma As String)
        If EORI Is Nothing Then Return Nothing
        If If(EORI, "") <> "" Then
            Dim kdNrTmp = SQL.getFMZOLLKdNrFromEORI(EORI, EORI_NL, Firma)
            If IsNumeric(kdNrTmp) Then
                Dim ADRESSE As New VERAG_PROG_ALLGEMEIN.cAdressen(kdNrTmp)
                Return ADRESSE
            End If
        End If
        Return Nothing
    End Function







End Class
Public Class cDakosy_EZA_Adressen



    Property ezaAd_Id As Integer  '                             INT           IDENTITY (1, 1) NOT NULL,
    Property ezaAd_EZAId As Integer  '                          INT           NOT NULL,
    Property ezaAd_AdressTyp As Object = Nothing  '                      VARCHAR (10)  NULL,
    Property ezaAd_AdressCode As Object = Nothing  '                     VARCHAR (10)  NULL,
    Property ezaAd_TeilnehmerEORI As Object = Nothing  '                 VARCHAR (17)  NULL,
    Property ezaAd_TeilnehmerNLNR As Object = Nothing  '                 DECIMAL (4)   NULL,
    Property ezaAd_NameFirma1 As Object = Nothing  '                     VARCHAR (120) NULL,
    Property ezaAd_NameFirma2 As Object = Nothing  '                     VARCHAR (120) NULL,
    Property ezaAd_NameFirma3 As Object = Nothing  '                     VARCHAR (120) NULL,
    Property ezaAd_StrasseHausNr1 As Object = Nothing  '                 VARCHAR (35)  NULL,
    Property ezaAd_StrasseHausNr2 As Object = Nothing  '                 VARCHAR (35)  NULL,
    Property ezaAd_Ortsteil As Object = Nothing  '                       VARCHAR (35)  NULL,
    Property ezaAd_LandCode As Object = Nothing  '                       VARCHAR (3)   NULL,
    Property ezaAd_PLZ As Object = Nothing  '                            VARCHAR (9)   NULL,
    Property ezaAd_Ort As Object = Nothing  '                            VARCHAR (35)  NULL,
    Property ezaAd_UStIDAnmelder As Object = Nothing  '                  VARCHAR (14)  NULL,
    Property ezaAd_FinanzamtIDAnmelder As Object = Nothing  '            VARCHAR (4)   NULL,
    Property ezaAd_Bewilligungsnummer As Object = Nothing  '             VARCHAR (35)  NULL,
    Property ezaAd_BewilligungsFachVerfahren As Object = Nothing  '      VARCHAR (35)  NULL,
    Property ezaAd_BewilligungsnummerEndverwender As Object = Nothing  ' VARCHAR (35)  NULL,
    '   Property ezaAd_VERAGKdNr As Object = Nothing  '                 VARCHAR (35)  NULL,

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
    End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_Id", ezaAd_Id, , True, True))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_EZAId", ezaAd_EZAId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_AdressTyp", ezaAd_AdressTyp))  '                      VARCHAR (10)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_AdressCode", ezaAd_AdressCode))  '                     VARCHAR (10)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_TeilnehmerEORI", ezaAd_TeilnehmerEORI))  '                 VARCHAR (17)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_TeilnehmerNLNR", ezaAd_TeilnehmerNLNR))  '                 DECIMAL (4)   NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_NameFirma1", ezaAd_NameFirma1))  '                     VARCHAR (120) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_NameFirma2", ezaAd_NameFirma2))  '                     VARCHAR (120) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_NameFirma3", ezaAd_NameFirma3))  '                     VARCHAR (120) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_StrasseHausNr1", ezaAd_StrasseHausNr1))  '                 VARCHAR (35)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_StrasseHausNr2", ezaAd_StrasseHausNr2))  '                 VARCHAR (35)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_Ortsteil", ezaAd_Ortsteil))  '                       VARCHAR (35)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_LandCode", ezaAd_LandCode))  '                       VARCHAR (3)   NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_PLZ", ezaAd_PLZ))  '                            VARCHAR (9)   NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_Ort", ezaAd_Ort))  '                            VARCHAR (35)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_UStIDAnmelder", ezaAd_UStIDAnmelder))  '                  VARCHAR (14)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_FinanzamtIDAnmelder", ezaAd_FinanzamtIDAnmelder))  '            VARCHAR (4)   NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_Bewilligungsnummer", ezaAd_Bewilligungsnummer))  '             VARCHAR (35)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_BewilligungsFachVerfahren", ezaAd_BewilligungsFachVerfahren))  '      VARCHAR (35)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_BewilligungsnummerEndverwender", ezaAd_BewilligungsnummerEndverwender))  ' VARCHAR (35)  NULL,
        'list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAd_VERAGKdNr", ezaAd_VERAGKdNr))  ' VARCHAR (35)  NULL,

        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        'Return SQL.doSQLVarList(getInsertCmd, "FMZOLL", , list)
        ezaAd_Id = SQL.doSQLVarListID(ezaAd_Id, getInsertCmd, "FMZOLL", , list)
        Return ezaAd_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_Adressen  (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            '   VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine , System.Reflection.MethodInfo.GetCurrentMethod.Name)
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

        End Try
        Return ""
    End Function

End Class




Public Class cDakosy_EZA_Aufschub

    Property ezaAfb_Id As Integer
    Property ezaAfb_EZAId As Integer
    Property ezaAfb_Aufschubart As Object = Nothing
    Property ezaAfb_ArtAufschubantrag As Object = Nothing
    Property ezaAfb_AufschubnehmerEORI As Object = Nothing
    Property ezaAfb_KontoNr As Object = Nothing
    Property ezaAfb_HZA As Object = Nothing
    Property ezaAfb_AufschuBIN As Object = Nothing

    Property ezaAfb_Faelligkeit As Object = Nothing
    Property ezaAfb_Zahlungsart As Object = Nothing
    Property ezaAfb_Abgabenbetrag As Object = Nothing
    Property ezaAfb_AbgabeArt As Object = Nothing
    Property AufschubnehmerName As Object = Nothing
    Property ezaAfb_PositionsNummer As Object = Nothing
    Property ezaAfb_Prozentsatz As Object = Nothing


    'Public selButton As Object = Nothing ' Für die GUI
    'Public SA_OBJECT As Object = Nothing ' Für die GUI

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
    End Sub

    'Sub New(ezaUl_Id)
    '    Me.ezaUl_Id = ezaUl_Id
    ' LOAD()
    ' End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_Id", ezaAfb_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_EZAId", ezaAfb_EZAId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_Aufschubart", ezaAfb_Aufschubart))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_ArtAufschubantrag", ezaAfb_ArtAufschubantrag))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_AufschubnehmerEORI", ezaAfb_AufschubnehmerEORI))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_KontoNr", ezaAfb_KontoNr))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_AufschuBIN", ezaAfb_AufschuBIN))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_HZA", ezaAfb_HZA))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_Faelligkeit", ezaAfb_Faelligkeit))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_Zahlungsart", ezaAfb_Zahlungsart))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_Abgabenbetrag", ezaAfb_Abgabenbetrag))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_AbgabeArt", ezaAfb_AbgabeArt))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("AufschubnehmerName", AufschubnehmerName))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_PositionsNummer", ezaAfb_PositionsNummer))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaAfb_Prozentsatz", ezaAfb_Prozentsatz))


        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        'Return SQL.doSQLVarList(getInsertCmd, "FMZOLL", , list)
        ezaAfb_Id = SQL.doSQLVarListID(ezaAfb_Id, getInsertCmd, "FMZOLL", , list)
        Return ezaAfb_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_Aufschub  (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            '   VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine , System.Reflection.MethodInfo.GetCurrentMethod.Name)
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

        End Try
        Return ""
    End Function

End Class

Public Class cDakosy_EZA_Unterlagen

    Property ezaUl_Id As Integer
    Property ezaUl_EZAId As Integer
    Property ezaUl_Bereich As Object = Nothing
    Property ezaUl_Art As Object = Nothing
    Property ezaUl_Nummer As Object = Nothing
    Property ezaUl_DatumAusstellung As Object = Nothing

    'Public selButton As Object = Nothing ' Für die GUI
    'Public SA_OBJECT As Object = Nothing ' Für die GUI

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
    End Sub

    'Sub New(ezaUl_Id)
    '    Me.ezaUl_Id = ezaUl_Id
    ' LOAD()
    ' End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaUl_Id", ezaUl_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaUl_EZAId", ezaUl_EZAId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaUl_Bereich", ezaUl_Bereich))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaUl_Art", ezaUl_Art))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaUl_Nummer", ezaUl_Nummer))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaUl_DatumAusstellung", ezaUl_DatumAusstellung))

        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        'Return SQL.doSQLVarList(getInsertCmd, "FMZOLL", , list)
        ezaUl_Id = SQL.doSQLVarListID(ezaUl_Id, getInsertCmd, "FMZOLL", , list)
        Return ezaUl_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_Unterlagen  (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            '      VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine , System.Reflection.MethodInfo.GetCurrentMethod.Name)
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

        End Try
        Return ""
    End Function

End Class





Public Class cDakosy_EZA_BEAnteilZLAVUV

    Property ezaBAZ_Id As Integer
    Property ezaBAZ_EZAId As Integer
    Property ezaBAZ_RegistrierNummerZugang As Object = Nothing  '   VARCHAR (35)    NULL,
    Property ezaBAZ_PositionZugang As Object = Nothing  '           VARCHAR (5)     NULL,
    Property ezaBAZ_ArtikelCodeATZL As Object = Nothing  '          VARCHAR (35)    NULL,
    Property ezaBAZ_EigentuemerATUL As Object = Nothing  '          VARCHAR (20)    NULL,
    Property ezaBAZ_ChargennummerATZL As Object = Nothing  '        VARCHAR (35)    NULL,
    Property ezaBAZ_UrsprungslandATZL As Object = Nothing  '        VARCHAR (2)     NULL,
    Property ezaBAZ_AtlasKz As Object = Nothing  '                  VARCHAR (1)     NULL,
    Property ezaBAZ_Wartennummer As Object = Nothing  '             DECIMAL (11)    NULL,
    Property ezaBAZ_UeblicheBehandlungKz As Object = Nothing  '     VARCHAR (1)     NULL,
    Property ezaBAZ_Handelsmenge As Object = Nothing  '             DECIMAL (15, 3) NULL,
    Property ezaBAZ_MasseinheitHandelsmenge As Object = Nothing  '  VARCHAR (3)     NULL,
    Property ezaBAZ_QualifikatorHandelsmenge As Object = Nothing  ' VARCHAR (1)     NULL,
    Property ezaBAZ_Abgangsmenge As Object = Nothing  '             DECIMAL (15, 3) NULL,
    Property ezaBAZ_MasseinheitAbgangsmenge As Object = Nothing  '  VARCHAR (3)     NULL,
    Property ezaBAZ_QualifikatorAbgangsmenge As Object = Nothing  ' VARCHAR (1)     NULL,
    Property ezaBAZ_Positionszusatz As Object = Nothing  '          VARCHAR (100)   NULL,
    Property ezaBAZ_WarenbezogeneAngaben As Object = Nothing  '     VARCHAR (350)   NULL,

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
    End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_Id", ezaBAZ_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_EZAId", ezaBAZ_EZAId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_RegistrierNummerZugang", ezaBAZ_RegistrierNummerZugang))  '   VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_PositionZugang", ezaBAZ_PositionZugang))  '           VARCHAR (5)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_ArtikelCodeATZL", ezaBAZ_ArtikelCodeATZL))  '          VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_EigentuemerATUL", ezaBAZ_EigentuemerATUL))  '          VARCHAR (20)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_ChargennummerATZL", ezaBAZ_ChargennummerATZL))  '        VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_UrsprungslandATZL", ezaBAZ_UrsprungslandATZL))  '        VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_AtlasKz", ezaBAZ_AtlasKz))  '                  VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_Wartennummer", ezaBAZ_Wartennummer))  '             DECIMAL (11)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_UeblicheBehandlungKz", ezaBAZ_UeblicheBehandlungKz))  '     VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_Handelsmenge", ezaBAZ_Handelsmenge))  '             DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_MasseinheitHandelsmenge", ezaBAZ_MasseinheitHandelsmenge))  '  VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_QualifikatorHandelsmenge", ezaBAZ_QualifikatorHandelsmenge))  ' VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_Abgangsmenge", ezaBAZ_Abgangsmenge))  '             DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_MasseinheitAbgangsmenge", ezaBAZ_MasseinheitAbgangsmenge))  '  VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_QualifikatorAbgangsmenge", ezaBAZ_QualifikatorAbgangsmenge))  ' VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_Positionszusatz", ezaBAZ_Positionszusatz))  '          VARCHAR (100)   NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBAZ_WarenbezogeneAngaben", ezaBAZ_WarenbezogeneAngaben))  '     VARCHAR (350)   NULL,


        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        'Return SQL.doSQLVarList(getInsertCmd, "FMZOLL", , list)
        ezaBAZ_Id = SQL.doSQLVarListID(ezaBAZ_Id, getInsertCmd, "FMZOLL", , list)
        Return ezaBAZ_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_BEAnteilZLAVUV  (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            '    VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine , System.Reflection.MethodInfo.GetCurrentMethod.Name)
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)

        End Try
        Return ""
    End Function

End Class



Public Class cDakosy_EZA_SumABeendigungsAnteil

    Property ezaBa_Id As Integer
    Property ezaBa_EZAId As Integer
    Property ezaBa_SumARegistriernummer As Object = Nothing
    Property ezaBa_SumAPosNr As Object = Nothing
    Property ezaBa_BeendigungsPackstueckzahl As Object = Nothing
    Property ezaBa_Artidentifikation As Object = Nothing
    Property ezaBa_VerwahrerEORI As Object = Nothing
    Property ezaBa_SpezifOrdnungsbegriffArt As Object = Nothing
    Property ezaBa_SpezifOrdnungsbegriff As Object = Nothing


    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
    End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_Id", ezaBa_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_EZAId", ezaBa_EZAId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_SumARegistriernummer", ezaBa_SumARegistriernummer))  '   VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_SumAPosNr", ezaBa_SumAPosNr))  '           VARCHAR (5)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_BeendigungsPackstueckzahl", ezaBa_BeendigungsPackstueckzahl))  '          VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_Artidentifikation", ezaBa_Artidentifikation))  '          VARCHAR (20)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_VerwahrerEORI", ezaBa_VerwahrerEORI))  '        VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_SpezifOrdnungsbegriffArt", ezaBa_SpezifOrdnungsbegriffArt))  '        VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaBa_SpezifOrdnungsbegriff", ezaBa_SpezifOrdnungsbegriff))


        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        'Return SQL.doSQLVarList(getInsertCmd, "FMZOLL", , list)
        ezaBa_Id = SQL.doSQLVarListID(ezaBa_Id, getInsertCmd, "FMZOLL", , list)
        Return ezaBa_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_SumABeendigungsAnteil  (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return ""
    End Function

End Class


Public Class cDakosy_EZA_Warenposition
    Implements ICloneable
    'Property ezaWP_Id As Integer
    Property ezaWP_Id As Integer
    Property ezaWP_EzaId As Integer
    Property ezaWP_PositionsNummer As Object = Nothing  '                                                           DECIMAL (5)     NULL,
    Property ezaWP_Artikelnummer As Object = Nothing  '                                                             VARCHAR (35)    NULL,
    Property ezaWP_WarennummerEZT As Object = Nothing  '                                                            VARCHAR (11)    NULL,
    Property ezaWP_WarennummerZusatzCode1 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode2 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode3 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode4 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode5 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode6 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode7 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode8 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode9 As Object = Nothing  '                                                    VARCHAR (4)     NULL,
    Property ezaWP_WarennummerZusatzCode10 As Object = Nothing  '                                                   VARCHAR (4)     NULL,
    Property ezaWP_Warennummerzusatz1 As Object = Nothing  '                                                        VARCHAR (4)     NULL,
    Property ezaWP_Warennummerzusatz2 As Object = Nothing  '                                                        VARCHAR (4)     NULL,
    Property ezaWP_Warenbezeichnung As Object = Nothing  '                                                          VARCHAR (240)   NULL,
    Property ezaWP_VerfahrensCodeVorangegangenesVerfahren As Object = Nothing  '                                    VARCHAR (2)     NULL,
    Property ezaWP_AbgabensteuerungKz As Object = Nothing  '                                                        VARCHAR (2)     NULL,
    Property ezaWP_EUCode As Object = Nothing  '                                                                    VARCHAR (3)     NULL,
    Property ezaWP_UrsprungslandCode As Object = Nothing  '                                                         VARCHAR (2)     NULL,
    Property ezaWP_Praeferenzursprungsland As Object = Nothing  '                                                         VARCHAR (2)     NULL,
    Property ezaWP_Rohmasse As Object = Nothing  '                                                                  DECIMAL (11, 1) NULL,
    Property ezaWP_Eigenmasse As Object = Nothing  '                                                                DECIMAL (11, 1) NULL,
    Property ezaWP_AHStatMenge As Object = Nothing  '                                                               DECIMAL (15, 3) NULL,
    Property ezaWP_AHStatMengeMasseinheit As Object = Nothing  '                                                    VARCHAR (3)     NULL,
    Property ezaWP_AHStatMengeQualifier As Object = Nothing  '                                                      VARCHAR (1)     NULL,
    Property ezaWP_KostenEUSt As Object = Nothing  '                                                                DECIMAL (13, 2) NULL,
    Property ezaWP_AHStatWert As Object = Nothing  '                                                                DECIMAL (9)     NULL,
    Property ezaWP_PackstueckAnzahl As Object = Nothing  '                                                          DECIMAL (9)     NULL,
    Property ezaWP_PackstueckArt As Object = Nothing  '                                                             VARCHAR (2)     NULL,
    Property ezaWP_PackstueckZeichen As Object = Nothing  '                                                         VARCHAR (70)    NULL,
    Property ezaWP_Warenmenge1 As Object = Nothing  '                                                               DECIMAL (15, 3) NULL,
    Property ezaWP_WarenMasseinheit1 As Object = Nothing  '                                                         VARCHAR (3)     NULL,
    Property ezaWP_WarenQualifier1 As Object = Nothing  '                                                           VARCHAR (1)     NULL,
    Property ezaWP_Warenmenge2 As Object = Nothing  '                                                               DECIMAL (15, 3) NULL,
    Property ezaWP_WarenMasseinheit2 As Object = Nothing  '                                                         VARCHAR (3)     NULL,
    Property ezaWP_WarenQualifier2 As Object = Nothing  '                                                           VARCHAR (1)     NULL,
    Property ezaWP_Warenmenge3 As Object = Nothing  '                                                               DECIMAL (15, 3) NULL,
    Property ezaWP_WarenMasseinheit3 As Object = Nothing  '                                                         VARCHAR (3)     NULL,
    Property ezaWP_WarenQualifier3 As Object = Nothing  '                                                           VARCHAR (1)     NULL,
    Property ezaWP_Warenmenge4 As Object = Nothing  '                                                               DECIMAL (15, 3) NULL,
    Property ezaWP_WarenMasseinheit4 As Object = Nothing  '                                                         VARCHAR (3)     NULL,
    Property ezaWP_WarenQualifier4 As Object = Nothing  '                                                           VARCHAR (1)     NULL,
    Property ezaWP_Warenmenge5 As Object = Nothing  '                                                               DECIMAL (15, 3) NULL,
    Property ezaWP_WarenMasseinheit5 As Object = Nothing  '                                                         VARCHAR (3)     NULL,
    Property ezaWP_WarenQualifier5 As Object = Nothing  '                                                           VARCHAR (1)     NULL,
    Property ezaWP_BeguenstigungBenatragtCode As Object = Nothing  '                                                VARCHAR (3)     NULL,
    Property ezaWP_Kentigentnummer1 As Object = Nothing  '                                                          VARCHAR (4)     NULL,
    Property ezaWP_Kentigentnummer2 As Object = Nothing  '                                                          VARCHAR (4)     NULL,
    Property ezaWP_PositionsZusatz As Object = Nothing  '                                                           VARCHAR (100)   NULL,
    Property ezaWP_AHStatWertManuellKZ As Object = Nothing  '                                                       VARCHAR (1)     NULL,
    Property ezaWP_Artikelpreis As Object = Nothing  '                                                              DECIMAL (13, 2) NULL,
    Property ezaWP_ArtikelpreisWaehrung As Object = Nothing  '                                                              DECIMAL (13, 2) NULL,
    Property ezaWP_OrtVerbringens As Object = Nothing  '                                                            VARCHAR (35)    NULL,
    Property ezaWP_AbflughafenIATACode As Object = Nothing  '                                                       VARCHAR (3)     NULL,
    Property ezaWP_WarenmengeAVUVZugang As Object = Nothing  '                                                      DECIMAL (15, 3) NULL,
    Property ezaWP_WarenmengeAVUVZugangMasseinheit As Object = Nothing  '                                           VARCHAR (3)     NULL,
    Property ezaWP_WarenmengeAVUVZugangMasseinheitQualifier As Object = Nothing  '                                  VARCHAR (1)     NULL,
    Property ezaWP_Sachbereich As Object = Nothing  '                                                               VARCHAR (2)     NULL,
    Property ezaWP_BedingungCode As Object = Nothing  '                                                             VARCHAR (1)     NULL,
    Property ezaWP_VeredelungWertsteigerung As Object = Nothing  '                                                  DECIMAL (13, 2) NULL,
    Property ezaWP_TabakSteuerzeichenID As Object = Nothing  '                                                      VARCHAR (5)     NULL,
    Property ezaWP_GehaltsAngabenArtCode1 As Object = Nothing  '                                                    VARCHAR (2)     NULL,
    Property ezaWP_GehaltsAngabenGradProzent1 As Object = Nothing  '                                                DECIMAL (7, 2)  NULL,
    Property ezaWP_GehaltsAngabenArtCode2 As Object = Nothing  '                                                    VARCHAR (2)     NULL,
    Property ezaWP_GehaltsAngabenGradProzent2 As Object = Nothing  '                                                DECIMAL (7, 2)  NULL,
    Property ezaWP_GehaltsAngabenArtCode3 As Object = Nothing  '                                                    VARCHAR (2)     NULL,
    Property ezaWP_GehaltsAngabenGradProzent3 As Object = Nothing  '                                                DECIMAL (7, 2)  NULL,
    Property ezaWP_BeguenstigungsMengeMenge As Object = Nothing  '                                                  DECIMAL (9)     NULL,
    Property ezaWP_BeguenstigungsMengeMasseinheitCode As Object = Nothing  '                                        VARCHAR (3)     NULL,
    Property ezaWP_BeguenstigungsMengeQualifier As Object = Nothing  '                                              VARCHAR (1)     NULL,
    Property ezaWP_Abgabenminderung_AbgabengruppeCode1 As Object = Nothing  '                                       VARCHAR (2)     NULL,
    Property ezaWP_Abgabenminderung_Minderungsbetrag1 As Object = Nothing  '                                        DECIMAL (13, 2) NULL,
    Property ezaWP_Abgabenminderung_AbgabengruppeCode2 As Object = Nothing  '                                       VARCHAR (2)     NULL,
    Property ezaWP_Abgabenminderung_Minderungsbetrag2 As Object = Nothing  '                                        DECIMAL (13, 2) NULL,
    Property ezaWP_Abgabenminderung_AbgabengruppeCode3 As Object = Nothing  '                                       VARCHAR (2)     NULL,
    Property ezaWP_Abgabenminderung_Minderungsbetrag3 As Object = Nothing  '                                        DECIMAL (13, 2) NULL,
    Property ezaWP_BesondereWertangabe_Wert1 As Object = Nothing  '                                                 DECIMAL (13, 2) NULL,
    Property ezaWP_BesondereWertangabe_PreisartCode1 As Object = Nothing  '                                         VARCHAR (1)     NULL,
    Property ezaWP_BesondereWertangabe_Wert2 As Object = Nothing  '                                                 DECIMAL (13, 2) NULL,
    Property ezaWP_BesondereWertangabe_PreisartCode2 As Object = Nothing  '                                         VARCHAR (1)     NULL,
    Property ezaWP_BesondereWertangabe_Wert3 As Object = Nothing  '                                                 DECIMAL (13, 2) NULL,
    Property ezaWP_BesondereWertangabe_PreisartCode3 As Object = Nothing  '                                         VARCHAR (1)     NULL,
    Property ezaWP_BesondereWertangabe_Wert4 As Object = Nothing  '                                                 DECIMAL (13, 2) NULL,
    Property ezaWP_BesondereWertangabe_PreisartCode4 As Object = Nothing  '                                         VARCHAR (1)     NULL,
    Property ezaWP_BesondereWertangabe_Wert5 As Object = Nothing  '                                                 DECIMAL (13, 2) NULL,
    Property ezaWP_BesondereWertangabe_PreisartCode5 As Object = Nothing  '                                         VARCHAR (1)     NULL,
    Property ezaWP_VZAStatus As Object = Nothing  '                                                                 VARCHAR (1)     NULL,
    Property ezaWP_EGZStatus As Object = Nothing  '                                                                 VARCHAR (1)     NULL,
    Property ezaWP_DV1Status As Object = Nothing  '                                                                 VARCHAR (1)     NULL,
    Property ezaWP_AnmeldeArt As Object = Nothing  '                                                                VARCHAR (2)     NULL,
    Property ezaWP_BefundDatum As Object = Nothing  '                                                               DATE            NULL,
    Property ezaWP_AnmelderAdressCodeEORI As Object = Nothing  '                                                    VARCHAR (17)    NULL,
    Property ezaWP_Zollverfahren As Object = Nothing  '                                                             VARCHAR (2)     NULL,
    Property ezaWP_AbrechnungszollstelleCode As Object = Nothing  '                                                 VARCHAR (4)     NULL,
    Property ezaWP_SachbereichCode As Object = Nothing  '                                                           VARCHAR (2)     NULL,
    Property ezaWP_RegistriernummerZA As Object = Nothing  '                                                        VARCHAR (21)    NULL,
    Property ezaWP_AnmeldeVErfahren As Object = Nothing  '                                                          VARCHAR (2)     NULL,
    Property ezaWP_Bewilligungsnummer As Object = Nothing  '                                                        VARCHAR (35)    NULL,
    Property ezaWP_BewilligungsnummerEndverwenderEGZDurchDritte As Object = Nothing  '                              VARCHAR (35)    NULL,
    Property ezaWP_Zollwert As Object = Nothing  '                                                                  DECIMAL (13, 2) NULL,
    Property ezaWP_LuftfrachtkostenGesamt As Object = Nothing  '                                                    DECIMAL (13, 2) NULL,
    Property ezaWP_IATAKursKz As Object = Nothing  '                                                                VARCHAR (1)     NULL,
    Property ezaWP_LuftfrachtkostenGesamtWaehrung As Object = Nothing  '                                            VARCHAR (3)     NULL,
    Property ezaWP_KursVereinbartKz As Object = Nothing  '                                                          VARCHAR (1)     NULL,
    Property ezaWP_KursBetragVereinbart As Object = Nothing  '                                                      DECIMAL (27, 9) NULL,
    Property ezaWP_KursDatum As Object = Nothing  '                                                                 DATE            NULL,
    Property ezaWP_Aussenhandelsstatistik_VerkehrszweigInland As Object = Nothing  '                                VARCHAR (1)     NULL,
    Property ezaWP_Aussenhandelsstatistik_VerkehrszweigGrenze As Object = Nothing  '                                VARCHAR (1)     NULL,
    Property ezaWP_Aussenhandelsstatistik_Versendungsland As Object = Nothing  '                                    VARCHAR (2)     NULL,
    Property ezaWP_Aussenhandelsstatistik_BEstimmungsbundesland As Object = Nothing  '                              VARCHAR (2)     NULL,
    Property ezaWP_Aussenhandelsstatistik_Bestimmungsland As Object = Nothing  '                                    VARCHAR (2)     NULL,
    Property ezaWP_Aussenhandelsstatistik_BefoerderungsmittelGranzeStaatszugehoeriglkeitCode As Object = Nothing  ' VARCHAR (2)     NULL,
    Property ezaWP_Aussenhandelsstatistik_BefoerderungsmittelGrenzeArt As Object = Nothing  '                       VARCHAR (2)     NULL,
    Property ezaWP_Aussenhandelsstatistik_BefoerderungsmittelBeschreibung As Object = Nothing  '                    VARCHAR (17)    NULL,
    Property ezaWP_Aussenhandelsstatistik_ArtGeschaeft As Object = Nothing  '                                       VARCHAR (2)     NULL,
    Property ezaWP_Aussenhandelsstatistik_Statistikstatus As Object = Nothing  '                                    VARCHAR (2)     NULL,




    Property ezaWP_SONDERFALLDATEN As New List(Of cDakosy_EZA_WarenpositionSonderfalldaten)
    Property ezaWP_UNTERLAGEN As New List(Of cDakosy_EZA_WarenpositionVorgelegteUnterlagen)
    Property ezaWP_VERBRAUCHSSTEUER As New List(Of cDakosy_EZA_WarenpositionVerbrauchssteuer)


    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
        '  Me.ezaWP_EzaId = ezaWP_EzaId
    End Sub

    'Sub New(ezaUl_Id)
    '    Me.ezaUl_Id = ezaUl_Id
    ' LOAD()
    ' End Sub


    Public Function Clone() As Object Implements ICloneable.Clone 'Muss noch probiert werden!
        Return DirectCast(MemberwiseClone(), cDakosy_EZA_Warenposition)
    End Function

    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Id", ezaWP_Id, , True, True))


        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_EzaId", ezaWP_EzaId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_PositionsNummer", ezaWP_PositionsNummer))  '                                                           DECIMAL (5)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Artikelnummer", ezaWP_Artikelnummer))  '                                                             VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerEZT", ezaWP_WarennummerEZT))  '                                                            VARCHAR (11)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode1", ezaWP_WarennummerZusatzCode1))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode2", ezaWP_WarennummerZusatzCode2))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode3", ezaWP_WarennummerZusatzCode3))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode4", ezaWP_WarennummerZusatzCode4))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode5", ezaWP_WarennummerZusatzCode5))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode6", ezaWP_WarennummerZusatzCode6))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode7", ezaWP_WarennummerZusatzCode7))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode8", ezaWP_WarennummerZusatzCode8))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode9", ezaWP_WarennummerZusatzCode9))  '                                                    VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarennummerZusatzCode10", ezaWP_WarennummerZusatzCode10))  '                                                   VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warennummerzusatz1", ezaWP_Warennummerzusatz1))  '                                                        VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warennummerzusatz2", ezaWP_Warennummerzusatz2))  '                                                        VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warenbezeichnung", ezaWP_Warenbezeichnung))  '                                                          VARCHAR (240)   NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_VerfahrensCodeVorangegangenesVerfahren", ezaWP_VerfahrensCodeVorangegangenesVerfahren))  '                                    VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AbgabensteuerungKz", ezaWP_AbgabensteuerungKz))  '                                                        VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_EUCode", ezaWP_EUCode))  '                                                                    VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_UrsprungslandCode", ezaWP_UrsprungslandCode))  '                                                         VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Praeferenzursprungsland", ezaWP_Praeferenzursprungsland))  '                                                         VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Rohmasse", ezaWP_Rohmasse))  '                                                                  DECIMAL (11, 1) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Eigenmasse", ezaWP_Eigenmasse))  '                                                                DECIMAL (11, 1) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AHStatMenge", ezaWP_AHStatMenge))  '                                                               DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AHStatMengeMasseinheit", ezaWP_AHStatMengeMasseinheit))  '                                                    VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AHStatMengeQualifier", ezaWP_AHStatMengeQualifier))  '                                                      VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_KostenEUSt", ezaWP_KostenEUSt))  '                                                                DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AHStatWert", ezaWP_AHStatWert))  '                                                                DECIMAL (9)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_PackstueckAnzahl", ezaWP_PackstueckAnzahl))  '                                                          DECIMAL (9)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_PackstueckArt", ezaWP_PackstueckArt))  '                                                             VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_PackstueckZeichen", ezaWP_PackstueckZeichen))  '                                                         VARCHAR (70)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warenmenge1", ezaWP_Warenmenge1))  '                                                               DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenMasseinheit1", ezaWP_WarenMasseinheit1))  '                                                         VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenQualifier1", ezaWP_WarenQualifier1))  '                                                           VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warenmenge2", ezaWP_Warenmenge2))  '                                                               DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenMasseinheit2", ezaWP_WarenMasseinheit2))  '                                                         VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenQualifier2", ezaWP_WarenQualifier2))  '                                                           VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warenmenge3", ezaWP_Warenmenge3))  '                                                               DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenMasseinheit3", ezaWP_WarenMasseinheit3))  '                                                         VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenQualifier3", ezaWP_WarenQualifier3))  '                                                           VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warenmenge4", ezaWP_Warenmenge4))  '                                                               DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenMasseinheit4", ezaWP_WarenMasseinheit4))  '                                                         VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenQualifier4", ezaWP_WarenQualifier4))  '                                                           VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Warenmenge5", ezaWP_Warenmenge5))  '                                                               DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenMasseinheit5", ezaWP_WarenMasseinheit5))  '                                                         VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenQualifier5", ezaWP_WarenQualifier5))  '                                                           VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BeguenstigungBenatragtCode", ezaWP_BeguenstigungBenatragtCode))  '                                                VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Kentigentnummer1", ezaWP_Kentigentnummer1))  '                                                          VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Kentigentnummer2", ezaWP_Kentigentnummer2))  '                                                          VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_PositionsZusatz", ezaWP_PositionsZusatz))  '                                                           VARCHAR (100)   NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AHStatWertManuellKZ", ezaWP_AHStatWertManuellKZ))  '                                                       VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Artikelpreis", ezaWP_Artikelpreis))  '                                                              DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_ArtikelpreisWaehrung", ezaWP_ArtikelpreisWaehrung))  '                                                              DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_OrtVerbringens", ezaWP_OrtVerbringens))  '                                                            VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AbflughafenIATACode", ezaWP_AbflughafenIATACode))  '                                                       VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenmengeAVUVZugang", ezaWP_WarenmengeAVUVZugang))  '                                                      DECIMAL (15, 3) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenmengeAVUVZugangMasseinheit", ezaWP_WarenmengeAVUVZugangMasseinheit))  '                                           VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_WarenmengeAVUVZugangMasseinheitQualifier", ezaWP_WarenmengeAVUVZugangMasseinheitQualifier))  '                                  VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Sachbereich", ezaWP_Sachbereich))  '                                                               VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BedingungCode", ezaWP_BedingungCode))  '                                                             VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_VeredelungWertsteigerung", ezaWP_VeredelungWertsteigerung))  '                                                  DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_TabakSteuerzeichenID", ezaWP_TabakSteuerzeichenID))  '                                                      VARCHAR (5)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_GehaltsAngabenArtCode1", ezaWP_GehaltsAngabenArtCode1))  '                                                    VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_GehaltsAngabenGradProzent1", ezaWP_GehaltsAngabenGradProzent1))  '                                                DECIMAL (7, 2)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_GehaltsAngabenArtCode2", ezaWP_GehaltsAngabenArtCode2))  '                                                    VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_GehaltsAngabenGradProzent2", ezaWP_GehaltsAngabenGradProzent2))  '                                                DECIMAL (7, 2)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_GehaltsAngabenArtCode3", ezaWP_GehaltsAngabenArtCode3))  '                                                    VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_GehaltsAngabenGradProzent3", ezaWP_GehaltsAngabenGradProzent3))  '                                                DECIMAL (7, 2)  NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BeguenstigungsMengeMenge", ezaWP_BeguenstigungsMengeMenge))  '                                                  DECIMAL (9)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BeguenstigungsMengeMasseinheitCode", ezaWP_BeguenstigungsMengeMasseinheitCode))  '                                        VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BeguenstigungsMengeQualifier", ezaWP_BeguenstigungsMengeQualifier))  '                                              VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Abgabenminderung_AbgabengruppeCode1", ezaWP_Abgabenminderung_AbgabengruppeCode1))  '                                       VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Abgabenminderung_Minderungsbetrag1", ezaWP_Abgabenminderung_Minderungsbetrag1))  '                                        DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Abgabenminderung_AbgabengruppeCode2", ezaWP_Abgabenminderung_AbgabengruppeCode2))  '                                       VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Abgabenminderung_Minderungsbetrag2", ezaWP_Abgabenminderung_Minderungsbetrag2))  '                                        DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Abgabenminderung_AbgabengruppeCode3", ezaWP_Abgabenminderung_AbgabengruppeCode3))  '                                       VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Abgabenminderung_Minderungsbetrag3", ezaWP_Abgabenminderung_Minderungsbetrag3))  '                                        DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_Wert1", ezaWP_BesondereWertangabe_Wert1))  '                                                 DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_PreisartCode1", ezaWP_BesondereWertangabe_PreisartCode1))  '                                         VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_Wert2", ezaWP_BesondereWertangabe_Wert2))  '                                                 DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_PreisartCode2", ezaWP_BesondereWertangabe_PreisartCode2))  '                                         VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_Wert3", ezaWP_BesondereWertangabe_Wert3))  '                                                 DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_PreisartCode3", ezaWP_BesondereWertangabe_PreisartCode3))  '                                         VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_Wert4", ezaWP_BesondereWertangabe_Wert4))  '                                                 DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_PreisartCode4", ezaWP_BesondereWertangabe_PreisartCode4))  '                                         VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_Wert5", ezaWP_BesondereWertangabe_Wert5))  '                                                 DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BesondereWertangabe_PreisartCode5", ezaWP_BesondereWertangabe_PreisartCode5))  '                                         VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_VZAStatus", ezaWP_VZAStatus))  '                                                                 VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_EGZStatus", ezaWP_EGZStatus))  '                                                                 VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_DV1Status", ezaWP_DV1Status))  '                                                                 VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AnmeldeArt", ezaWP_AnmeldeArt))  '                                                                VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BefundDatum", ezaWP_BefundDatum))  '                                                               DATE            NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AnmelderAdressCodeEORI", ezaWP_AnmelderAdressCodeEORI))  '                                                    VARCHAR (17)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Zollverfahren", ezaWP_Zollverfahren))  '                                                             VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AbrechnungszollstelleCode", ezaWP_AbrechnungszollstelleCode))  '                                                 VARCHAR (4)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_SachbereichCode", ezaWP_SachbereichCode))  '                                                           VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_RegistriernummerZA", ezaWP_RegistriernummerZA))  '                                                        VARCHAR (21)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_AnmeldeVErfahren", ezaWP_AnmeldeVErfahren))  '                                                          VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Bewilligungsnummer", ezaWP_Bewilligungsnummer))  '                                                        VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_BewilligungsnummerEndverwenderEGZDurchDritte", ezaWP_BewilligungsnummerEndverwenderEGZDurchDritte))  '                              VARCHAR (35)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Zollwert", ezaWP_Zollwert))  '                                                                  DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_LuftfrachtkostenGesamt", ezaWP_LuftfrachtkostenGesamt))  '                                                    DECIMAL (13, 2) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_IATAKursKz", ezaWP_IATAKursKz))  '                                                                VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_LuftfrachtkostenGesamtWaehrung", ezaWP_LuftfrachtkostenGesamtWaehrung))  '                                            VARCHAR (3)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_KursVereinbartKz", ezaWP_KursVereinbartKz))  '                                                          VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_KursBetragVereinbart", ezaWP_KursBetragVereinbart))  '                                                      DECIMAL (27, 9) NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_KursDatum", ezaWP_KursDatum))  '                                                                 DATE            NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_VerkehrszweigInland", ezaWP_Aussenhandelsstatistik_VerkehrszweigInland))  '                                VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_VerkehrszweigGrenze", ezaWP_Aussenhandelsstatistik_VerkehrszweigGrenze))  '                                VARCHAR (1)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_Versendungsland", ezaWP_Aussenhandelsstatistik_Versendungsland))  '                                    VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_BEstimmungsbundesland", ezaWP_Aussenhandelsstatistik_BEstimmungsbundesland))  '                              VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_Bestimmungsland", ezaWP_Aussenhandelsstatistik_Bestimmungsland))  '                                    VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_BefoerderungsmittelGranzeStaatszugehoeriglkeitCode", ezaWP_Aussenhandelsstatistik_BefoerderungsmittelGranzeStaatszugehoeriglkeitCode))  ' VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_BefoerderungsmittelGrenzeArt", ezaWP_Aussenhandelsstatistik_BefoerderungsmittelGrenzeArt))  '                       VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_BefoerderungsmittelBeschreibung", ezaWP_Aussenhandelsstatistik_BefoerderungsmittelBeschreibung))  '                    VARCHAR (17)    NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_ArtGeschaeft", ezaWP_Aussenhandelsstatistik_ArtGeschaeft))  '                                       VARCHAR (2)     NULL,
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWP_Aussenhandelsstatistik_Statistikstatus", ezaWP_Aussenhandelsstatistik_Statistikstatus))  '                                    VARCHAR (2)     NULL,




        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        'Return SQL.doSQLVarList(getInsertCmd, "FMZOLL", , list)
        ezaWP_Id = SQL.doSQLVarListID(ezaWP_Id, getInsertCmd, "FMZOLL", , list)
        Return ezaWP_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_Warenposition (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return ""
    End Function


    Public Function INSERT_WarenpositionSonderfalldaten(wp_id, eza_id) As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen

        'jetzt die Standartofferten  einfügen
        For Each p In ezaWP_SONDERFALLDATEN
            p.ezaWpSfd_EzaWpId = wp_id
            p.ezaWpSfd_EzaId = eza_id
            If Not p.INSERT() Then
                Return False
            End If
        Next

        Return True
    End Function


    Public Function INSERT_WarenpositionVerbrauchssteuer(wp_id, eza_id) As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen

        'jetzt die Standartofferten  einfügen
        For Each p In ezaWP_VERBRAUCHSSTEUER
            p.ezaWpVs_EzaWpId = wp_id
            p.ezaWpVs_EzaId = eza_id
            If Not p.INSERT() Then
                Return False
            End If
        Next

        Return True
    End Function

    Public Function INSERT_WarenpositionUnterlagen(wp_id, eza_id) As Boolean
        'Zuserst alle OffertenPos von dem Offert löschen

        'jetzt die Standartofferten  einfügen
        For Each p In ezaWP_UNTERLAGEN
            p.ezaWpUl_EzaWpId = wp_id
            p.ezaWpUl_EzaId = eza_id
            If Not p.INSERT() Then
                Return False
            End If
        Next

        Return True
    End Function




    Public Sub LOAD_WarenpositionPackstuecke()
        Try
            ezaWP_SONDERFALLDATEN.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_WarenpositionSonderfalldaten WHERE ezaWpSfd_ezaWPId=@ezaWP_Id  ", conn)
                    cmd.Parameters.AddWithValue("@ezaWP_Id", Me.ezaWP_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_WarenpositionSonderfalldaten()
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        ezaWP_SONDERFALLDATEN.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub

    Public Sub LOAD_WarenpositionUnterlagen()
        Try
            ezaWP_UNTERLAGEN.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_WarenpositionUnterlagen WHERE ezaWpUl_ezaWPId=@ezaWP_Id  ", conn)
                    cmd.Parameters.AddWithValue("@ezaWP_Id", Me.ezaWP_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_WarenpositionVorgelegteUnterlagen
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        ezaWP_UNTERLAGEN.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub

    Public Sub LOAD_WarenpositionVerbrauchssteuer()
        Try
            ezaWP_VERBRAUCHSSTEUER.Clear()
            Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
                Using cmd As New SqlCommand("SELECT * FROM tblDakosy_EZA_WarenpositionVerbrauchssteuer WHERE ezaWpVs_ezaWPId=@ezaWP_Id  ", conn)
                    cmd.Parameters.AddWithValue("@ezaWP_Id", Me.ezaWP_Id)
                    Dim dr = cmd.ExecuteReader()
                    While dr.Read
                        Dim l As New cDakosy_EZA_WarenpositionVerbrauchssteuer
                        For Each i In l.getParameterList()
                            Dim propInfo As PropertyInfo = l.GetType.GetProperty(i.Scalarvariable)
                            If dr.Item(i.Text) Is DBNull.Value Then
                                propInfo.SetValue(l, Nothing)
                            Else
                                propInfo.SetValue(l, dr.Item(i.Text))
                            End If
                        Next
                        ezaWP_VERBRAUCHSSTEUER.Add(l)
                    End While
                    dr.Close()
                End Using
            End Using
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
    End Sub



    Public Function DELETE_WarenpositionUnterlagen() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_WarenpositionUnterlagen] WHERE ezaWpUl_ezaWPId=" & Me.ezaWP_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function




    Public Function DELETE_WarenpositionSonderfalldaten() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_WarenpositionSonderfalldaten] WHERE ezaWpSfd_ezaWPId=" & Me.ezaWP_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function



    Public Function DELETE_WarenpositionVerbrauchssteuer() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblDakosy_EZA_WarenpositionVerbrauchssteuer] WHERE ezaWpVs_ezaWPId=" & Me.ezaWP_Id & " "
        Return SQL.doSQL(sqlstr, "FMZOLL")
    End Function



End Class



Public Class cDakosy_EZA_WarenpositionSonderfalldaten


    Property ezaWpSfd_Id As Integer
    Property ezaWpSfd_EzaWpId As Integer
    Property ezaWpSfd_EzaId As Integer
    Property ezaWpSfd_SonderabgabenGruppeCode As Object = Nothing
    Property ezaWpSfd_AnwendungArt As Object = Nothing
    Property ezaWpSfd_SatzBetragFaktor As Object = Nothing

    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
        '   Me.ezaWpPk_ezaWPId = ezaWpPk_ezaWPId
    End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpSfd_Id", ezaWpSfd_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpSfd_EzaWpId", ezaWpSfd_EzaWpId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpSfd_EzaId", ezaWpSfd_EzaId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpSfd_SonderabgabenGruppeCode", ezaWpSfd_SonderabgabenGruppeCode))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpSfd_AnwendungArt", ezaWpSfd_AnwendungArt))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpSfd_SatzBetragFaktor", ezaWpSfd_SatzBetragFaktor))
        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        ezaWpSfd_Id = SQL.doSQLVarListID(ezaWpSfd_Id, getInsertCmd(), "FMZOLL", , list)
        Return ezaWpSfd_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_WarenpositionSonderfalldaten (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return ""
    End Function

End Class

Public Class cDakosy_EZA_WarenpositionVorgelegteUnterlagen


    Property ezaWpUl_Id As Integer
    Property ezaWpUl_EzaWpId As Integer
    Property ezaWpUl_EzaId As Integer
    Property ezaWpUl_Bereich As Object = Nothing
    Property ezaWpUl_Art As Object = Nothing
    Property ezaWpUl_Nummer As Object = Nothing
    Property ezaWpUl_DatumAusstellung As Object = Nothing
    Property ezaWpUl_VorlageKz As Object = Nothing
    Property ezaWpUl_AbschreibungsMenge As Object = Nothing
    Property ezaWpUl_AbschreibungsMengeMasseinheit As Object = Nothing
    Property ezaWpUl_AbschreibungsMengeMasseinheitQualifier As Object = Nothing



    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
        '  Me.ezaWpUl_ezaWPId = ezaWpUl_ezaWPId
    End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_Id", ezaWpUl_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_EzaWpId", ezaWpUl_EzaWpId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_EzaId", ezaWpUl_EzaId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_Bereich", ezaWpUl_Bereich))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_Art", ezaWpUl_Art))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_Nummer", ezaWpUl_Nummer))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_DatumAusstellung", ezaWpUl_DatumAusstellung))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_VorlageKz", ezaWpUl_VorlageKz))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_AbschreibungsMenge", ezaWpUl_AbschreibungsMenge))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_AbschreibungsMengeMasseinheit", ezaWpUl_AbschreibungsMengeMasseinheit))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpUl_AbschreibungsMengeMasseinheitQualifier", ezaWpUl_AbschreibungsMengeMasseinheitQualifier))
        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        ezaWpUl_Id = SQL.doSQLVarListID(ezaWpUl_Id, getInsertCmd(), "FMZOLL", , list)
        Return ezaWpUl_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_WarenpositionUnterlagen (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return ""
    End Function

End Class

Public Class cDakosy_EZA_WarenpositionVerbrauchssteuer

    Property ezaWpVs_Id As Integer
    Property ezaWpVs_EzaWpId As Integer
    Property ezaWpVs_EzaId As Integer
    Property ezaWpVs_VerbrauchsteuerCode As Object = Nothing '                  VARCHAR (4)     NULL,
    Property ezaWpVs_VerbrauchssteuerMenge As Object = Nothing '                DECIMAL (15, 3) NULL,
    Property ezaWpVs_VerbrauchssteuerMasseinheitCode As Object = Nothing '      VARCHAR (3)     NULL,
    Property ezaWpVs_VerbrauchssteuerMasseinheitQualifier As Object = Nothing ' VARCHAR (1)     NULL,
    Property ezaWpVs_GradProzent As Object = Nothing '                          DECIMAL (7, 2)  NULL,
    Property ezaWpVs_VerbrauchssteuerWertbasis As Object = Nothing '            DECIMAL (13, 2) NULL,


    Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

    Sub New()
        '   Me.ezaWpPk_ezaWPId = ezaWpPk_ezaWPId
    End Sub


    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_Id", ezaWpVs_Id, , True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_EzaWpId", ezaWpVs_EzaWpId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_EzaId", ezaWpVs_EzaId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_VerbrauchsteuerCode", ezaWpVs_VerbrauchsteuerCode))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_VerbrauchssteuerMenge", ezaWpVs_VerbrauchssteuerMenge))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_VerbrauchssteuerMasseinheitCode", ezaWpVs_VerbrauchssteuerMasseinheitCode))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_VerbrauchssteuerMasseinheitQualifier", ezaWpVs_VerbrauchssteuerMasseinheitQualifier))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_GradProzent", ezaWpVs_GradProzent))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ezaWpVs_VerbrauchssteuerWertbasis", ezaWpVs_VerbrauchssteuerWertbasis))

        Return list
    End Function


    Public Function INSERT() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        ezaWpVs_Id = SQL.doSQLVarListID(ezaWpVs_Id, getInsertCmd(), "FMZOLL", , list)
        Return ezaWpVs_Id > 0
    End Function

    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblDakosy_EZA_WarenpositionVerbrauchssteuer (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine, System.Reflection.MethodInfo.GetCurrentMethod.Name)
        End Try
        Return ""
    End Function

End Class