Public Class usrcntlEORI_Antrag
    Implements FormualrInterface

    Property BEZEICHNUNG = ""
    '  Property DS_ORDNER = ""
    Public Event KDNR_CHANGED(kdnr)
    Public Event DELETE(c As Control)
    Public Event MOVE_UP(c As Control)
    Public Event MOVE_DOWN(c As Control)

    Public KdNR As Integer = -1
    Public Sub ChangeKDNr(kdnr As Integer) _
       Implements FormualrInterface.ChangeKDNr
        initKdNR(kdnr)
    End Sub

    Sub New(BEZEICHNUNG As String, DS_ORDNER As String, Optional displayName As String = "")
        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()
        Me.BEZEICHNUNG = BEZEICHNUNG
        '   Me.DS_ORDNER = DS_ORDNER
        Me.lblText.Text = If(displayName <> "", displayName, BEZEICHNUNG)
        ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.

    End Sub

    Private Sub btnDel_Click(sender As Object, e As EventArgs) Handles btnDel.Click
        RaiseEvent DELETE(Me)
    End Sub

    Private Sub btnup_Click(sender As Object, e As EventArgs) Handles btnUp.Click
        RaiseEvent MOVE_UP(Me)
    End Sub

    Private Sub btnDown_Click(sender As Object, e As EventArgs) Handles btnDown.Click
        RaiseEvent MOVE_DOWN(Me)
    End Sub

    Private Sub pic_Click(sender As Object, e As EventArgs) Handles pic.Click
        FormularManagerNEU.genPDF(Me, True)
    End Sub

    Private Sub usrcntlFormOhneFelder_Load(sender As Object, e As EventArgs) Handles Me.Load

        Select Case BEZEICHNUNG
            Case FormularManagerArten.AT_InformationsblattFiskalverzollung
                cboSprache.Items.Clear()
                cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Deutsch", "DE"))
                cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Englisch", "EN"))
                cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Französisch", "FR"))

            Case FormularManagerArten.DE_InformationsblattFiskalverzollung
                cboSprache.Items.Clear()
                cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Deutsch", "DE"))
                cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Englisch", "EN"))
                cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Französisch", "FR"))
                cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Niederländisch", "NL"))
        End Select

        cboSprache.Items.Clear()
        cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Deutsch", "DE"))
        cboSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Englisch", "EN"))

        cbxAntragsart.Items.Clear()
        cbxAntragsart.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Neuzugang", "Neuzugang"))
        cbxAntragsart.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Änderung", "Änderung"))
        cbxAntragsart.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Beendigung", "Beendigung"))

        cboPrivatperson.Checked = False

        If KdNR > 0 Then
            initKdNR(KdNR)
        End If
    End Sub

    Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
        Dim kdsrch As New SDL.frmKundenSuche
        'Panel1.Enabled = False
        If kdsrch.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK Then
            If IsNumeric(kdsrch.kundenNrSearch.Text) Then
                initKdNR(kdsrch.kundenNrSearch.Text)
                'RaiseEvent ChangeKDNr(KdNR)
            End If
        End If
        '  Panel1.Enabled = True
    End Sub

    Public Sub initKdNR(KdNR)
        If KdNR > 0 Then
            Me.KdNR = KdNR

            Dim KUNDE As New VERAG_PROG_ALLGEMEIN.cKunde(KdNR)
            Dim ADRESSE As New VERAG_PROG_ALLGEMEIN.cAdressen(KdNR)



            txtFirma.Text = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(If(ADRESSE.Name_1, "") & If(If(ADRESSE.Name_2, "") <> "", " " & ADRESSE.Name_2, ""))
            txtAdresse1.Text = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(If(ADRESSE.Straße, ""))
            txtLand.Text = If(ADRESSE.LandKz, "")
            txtPLZ.Text = If(ADRESSE.PLZ, "")
            txtOrt.Text = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(If(ADRESSE.Ort, "").ToString.Trim)
            txtUid.Text = If(ADRESSE.UstIdKz, "") & If(ADRESSE.UstIdNr, "")
            txtEori.Text = If(KUNDE.EORITIN, "")
            txtTel.Text = If(ADRESSE.Telefon, "")
            txtEmail.Text = If(ADRESSE.E_Mail, "")
            '  txtAnsprechpartnerVERAG.Text = If(ADRESSE.Ansprechpartner, "")
        Else
            'txtFirma.Text = KdFirma
        End If

    End Sub

    Private Sub cboPrivatperson_CheckedChanged(sender As Object, e As EventArgs) Handles cboPrivatperson.CheckedChanged
        If cboPrivatperson.Checked Then
            Label2.Text = "Geburtsdat:"
            txtUid.Visible = False
            gebDatum.Visible = True
            lblHerrFrau.Text = "Vor - Nachname:"
            cbxGebDatu.Visible = True

        Else
            Label2.Text = "UID-Nr:"
            txtUid.Visible = True
            gebDatum.Visible = False
            lblHerrFrau.Text = "Herr/Frau:"
            cbxGebDatu.Visible = False
        End If
    End Sub

    Private Sub linkBMF_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles linkBMF.LinkClicked
        If cboPrivatperson.Checked Then
            Process.Start("https://www.formulare-bfinv.de/ffw/catalog/openForm.do?path=catalog%3A%2F%2FUnternehmen%2Fzoelle%2Fatlas%2F0870c")
        Else
            Process.Start("https://www.formulare-bfinv.de/ffw/catalog/openForm.do?path=catalog%3A%2F%2FUnternehmen%2Fzoelle%2Fatlas%2F0870a")
        End If

    End Sub
End Class
