Public Class usrcntlEinheitspapierPos

    Public Event ADD()
    Public Event REMOVE(PosNr As Integer)
    Public Event KGchanged()

    Public WT_LIST As VERAG_PROG_ALLGEMEIN.cZollTarifAtlas_LIST = Nothing
    '   Public WT_LIST_ITEMS As List(Of VERAG_PROG_ALLGEMEIN.MyListItem)
    Public PosNr As Integer = 1

    Sub New()
        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()
    End Sub



    Sub New(PosNr)
        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()
        Me.PosNr = PosNr

    End Sub

    Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
        RaiseEvent ADD()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        RaiseEvent REMOVE(PosNr)
    End Sub

    Private Sub usrcntlEinheitspapierPos_Load(sender As Object, e As EventArgs) Handles Me.Load
        setPos(PosNr)
        ' WT_LIST = New VERAG_PROG_ALLGEMEIN.cZollTarifAtlas_LIST
        '     MyComboBox3.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", ""))
        If WT_LIST IsNot Nothing Then
            '   Dim secs() As Integer = {2, 3, 1}
            '    MyComboBox3.fillWithSQL("SELECT ezttxt_code,ezttxt_text FROM [ezttxt] WHERE [ezttxt_datend] >= getdate() ORDER BY [ezttxt_code] ", True, "ATLAS", True)
          
            ' MyComboBox3.fillWithMyListItem(WT_LIST_ITEMS)
            ' MyComboBox3.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(l.ezttxt_code & " " & l.ezttxt_text, l.ezttxt_code.ToString.Trim))
            ' Next
        End If
        cboUrsprungsland.fillWithSQL("SELECT LandNr, LandKz + ' - ' + LandBez FROM [Länderverzeichnis für die Außenhandelsstatistik] ORDER BY LandKz ", False, "VERAG", True)

    End Sub
   
    Public Sub setPos(p)
        txtPosNr.Text = p
        txtPosNr2.Text = p
    End Sub

    Private Sub MyComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs)

        ' MsgBox(MyComboBox3._value)

        '  If MyComboBox3._value <> "" Then
        'TextBox11.Text = WT_LIST.getFullTxtByCode(MyComboBox3._value)
        '  End If

    End Sub

    ' Private Sub Warennummer1_AfterUpdate()
    '    fktTextfarbe(16711680)
    '    If Not IsNull(Me![Warennummer1].Column(0)) Then
    '        Me![Warennummer2] = Me![Warennummer1].Column(1)
    '        If Me![Warennummer1].Column(2) <> "0000" Then Me![Warennummer3] = Me![Warennummer1].Column(2)
    '        If Me![Warennummer1].Column(3) <> "0000" Then Me![Warennummer4] = Me![Warennummer1].Column(3)
    '        Me![Warennummer5] = Me![Warennummer1].Column(4)
    '     End If
    '    Me![Warenbezeichnung] = fktWarenbezeichnungLesen(Me![Warennummer1], Me![Warennummer2], Me![Warennummer3], Me![Warennummer4], Me![Warennummer5])
    ' End Sub


    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If WT_LIST IsNot Nothing Then
            Dim frmSearchWT As New frmSearchWT
            Dim wt_tmp = txtWtNr1.Text & txtWtNr2.Text & txtWtNr5.Text.Replace(" ", "").Trim
            If IsNumeric(wt_tmp) Then frmSearchWT.WT_Nr = wt_tmp
            frmSearchWT.WT_LIST = WT_LIST
            frmSearchWT.ShowDialog(Me)
            Dim wt = frmSearchWT.WT_Nr
            If IsNumeric(wt) And wt > 0 Then
                '  MsgBox(frmSearchWT.WT_Nr)
                If frmSearchWT.cbxTextUbernehmen.Checked Then txtWarenbezeichnung.Text = WT_LIST.getFullTxtByCode(wt)
                If wt.ToString.Length = 11 Then
                    txtWtNr1.Text = wt.ToString.Substring(0, 8)
                    txtWtNr2.Text = wt.ToString.Substring(8, 2)
                    txtWtNr5.Text = wt.ToString.Substring(10, 1)
                End If
            End If
        End If
    End Sub

    Private Sub txtVerfahren_TextChanged(sender As Object, e As EventArgs) Handles txtVerfahren.Leave
        txtVerfahren.Text = txtVerfahren.Text.Replace(" ", "")
        While txtVerfahren.Text.Length < 7
            txtVerfahren.Text = txtVerfahren.Text & "0"
        End While
    End Sub

    Private Sub txtEigenmasse_TextChanged(sender As Object, e As EventArgs) Handles txtEigenmasse.Leave
        RaiseEvent KGchanged()
    End Sub


End Class

