Public Class usrcntlCMR
    Dim POS_Zeahler = 0
    Public WT_LIST As VERAG_PROG_ALLGEMEIN.cZollTarifAtlas_LIST = Nothing

    Public Event ADD()
    Public Event DEC()
    Public Event KGchanged()

    Private Sub usrcntlCMR_Load(sender As Object, e As EventArgs) Handles Me.Load
        '     txtDatum.Text = Now.ToShortDateString
        For i As Integer = 0 To 6
            dgvLadungen.Rows.Add("", "", "", "", "", "", "")
            dgvLadungenKurz.Rows.Add("", "", "", "", "", "", "")
        Next
    End Sub

    Public Sub init()



    End Sub

  

  


    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
        fillWithKdTxt(txtAbsender)
    End Sub

    Function fillWithKdTxt(c As Control) As Boolean
        Dim f As New SDL.frmKundenSuche
        If f.ShowDialog = DialogResult.OK Then
            If f.kundenNrSearch.Text IsNot Nothing AndAlso f.kundenNrSearch.Text <> "" Then
                Dim KUNDE As New VERAG_PROG_ALLGEMEIN.cAdressen(CInt(f.kundenNrSearch.Text))
                'MsgBox(f.kundenNrSearch.Text)
                c.Text = If(KUNDE.Name_1, "") & If(KUNDE.Name_2, "") & Environment.NewLine & If(KUNDE.Straße, "") & Environment.NewLine & If(KUNDE.LandKz, "") & " " & If(KUNDE.PLZ, "") & " " & If(KUNDE.Ort, "")
                Return True
            End If
        End If
        c.Focus()
        Return False
    End Function

    Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
        fillWithKdTxt(txtEmpfänger)
    End Sub

    Private Sub PictureBox3_Click(sender As Object, e As EventArgs) Handles PictureBox3.Click
        fillWithKdTxt(txtFrachtführer)
    End Sub

    Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click
        fillWithKdTxt(txtNachfolgendeFF)
    End Sub

    Private Sub lklVERAG_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles lklVERAG.LinkClicked
        txtUnterschriftAbsender.Text = getverag("VERAG_AG")
    End Sub

    Function getverag(firma) As String
        Select Case firma
            Case "VERAG_AG"
                Return "VERAG Spedition AG" & Environment.NewLine & "A 4975 Suben, Nr. 14-15"
                'Select Case VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
                '            Case "SUB" : Return "VERAG Spedition AG" & Environment.NewLine  & "A 4975 Suben, Nr. 14-15"
                'Case "SBG" : Return "VERAG Spedition GmbH" & Environment.NewLine  & "D 83435 Bad Reichenhall, Europaplatz 8"
                'Case "WAI" : Return "VERAG Spedition GmbH" & Environment.NewLine  & "D 92726 Waidhaus, Am Autohof 3"
                'Case "NKD" : Return "VERAG Spedition AG" & Environment.NewLine  & "A-2425 Nickelsdorf, Zollamtsplatz-Nord"
                'End Select
            Case "VERAG_GMBH"
                Return "VERAG Spedition GmbH" & Environment.NewLine & "D 94152 Neuhaus,Hartham 6"
            Case "ATILLA"
                Return "ATILLA Spedition GmbH" & Environment.NewLine & "A 4975 Suben, Nr. 15"
            Case "IMEX"
                Return "IMEX Customs Service GmbH" & Environment.NewLine & "A 4975 Suben, Nr. 15"

        End Select
        Return ""
    End Function

    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        txtUnterschriftFrachtführer.Text = getverag("VERAG_AG")
    End Sub

    Private Sub LinkLabel3_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
        txtUnterschriftAbsender.Text = getverag("VERAG_GMBH")
    End Sub

    Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
        txtUnterschriftAbsender.Text = getverag("ATILLA")
    End Sub

    Private Sub LinkLabel4_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel4.LinkClicked
        txtUnterschriftFrachtführer.Text = getverag("VERAG_GMBH")
    End Sub

    Private Sub LinkLabel5_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel5.LinkClicked
        txtUnterschriftFrachtführer.Text = getverag("ATILLA")
    End Sub

    Private Sub cbxKurz_CheckedChanged(sender As Object, e As EventArgs) Handles cbxKurz.CheckedChanged
        dgvLadungenKurz.Visible = cbxKurz.Checked
        dgvLadungen.Visible = Not cbxKurz.Checked
    End Sub

    Private Sub LinkLabel6_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel6.LinkClicked
        txtUnterschriftAbsender.Text = getverag("IMEX")
    End Sub

    Private Sub LinkLabel7_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel7.LinkClicked
        txtUnterschriftFrachtführer.Text = getverag("IMEX")
    End Sub
End Class
