Imports IntraSell_DLL
Imports IntraSell_Net_Base

Public Class ArtikelEtikette
    Inherits AbstractForm

    Public Property ArtNr As Integer
        Get
            If ArtikelControl1 Is Nothing Then
                Return Nothing
            Else
                Return ArtikelControl1.ArtNr
            End If

        End Get
        Set(value As Integer)
            ArtikelControl1.ArtNr = value
        End Set
    End Property

    Private Sub Form_Verlassen() Handles MyBase.Verlassen
        Me.Close()
    End Sub

    Private Sub btnDruck_Click(sender As Object, e As EventArgs) Handles btnPrintEtiketten.Click
        Try
            ModuleReports.ShowReportEtikette(ArtikelControl1.ArtNr, ComboBoxLanguage.Text)
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub

    Private Sub ArtikelEtikette_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            FillComboBox(ComboBoxLanguage, "select code from language order by language", "code", "language")
            Me.cmbReportNamePreise.Text = VarValue_Default("REPORT_PREISE", "ArtikelPreis.rdlc")
            Me.cmbReportNamePreise.SelectedItem = VarValue_Default("REPORT_PREISE", "ArtikelPreis.rdlc")
            AddHandler Me.cmbReportNamePreise.SelectedValueChanged, AddressOf cmbReportNamePreise_SelectedValueChanged
        Catch ex As Exception

        End Try
    End Sub

    Private Sub cmbReportNamePreise_SelectedValueChanged(sender As Object, e As EventArgs)
        Try
            SetVarValue("REPORT_PREISE", cmbReportNamePreise.SelectedItem)
        Catch ex As Exception
        End Try
    End Sub

    Private Sub BtnPrintPreis_Click(sender As Object, e As EventArgs) Handles btnPrintPreis.Click
        Try
            ModuleReports.ShowReportEtikette(ArtikelControl1.ArtNr, ComboBoxLanguage.Text, cmbReportNamePreise.Text)
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub

    Private Sub ButtonBarcodes_Click(sender As Object, e As EventArgs) Handles btnBarcodes.Click
        Try
            ModuleReports.ShowReportBarcodes(ArtikelControl1.ArtNr, TextBoxZeilen.Text, TextBoxSpalten.Text, ComboBoxLanguage.Text, ComboBoxZweckform.Text) '"ArtikelBarcodes_38x21")
        Catch ex As Exception
            HandleAppError(ex)
        End Try
    End Sub

    Private Sub ComboBoxZweckform_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxZweckform.SelectedIndexChanged

        If ComboBoxZweckform.Text = "ArtikelBarcodes_30x20.rdlc" Then
            TextBoxZeilen.Text = "14"
            TextBoxSpalten.Text = "7"
        End If

        If ComboBoxZweckform.Text = "ArtikelBarcodes_38x21.rdlc" Then
            TextBoxZeilen.Text = "13"
            TextBoxSpalten.Text = "5"
        End If

        If ComboBoxZweckform.Text = "ArtikelBarcodes_70x36.rdlc" Then
            TextBoxZeilen.Text = "8"
            TextBoxSpalten.Text = "3"
        End If

        btnBarcodes.Enabled = ComboBoxZweckform.Text <> ""

    End Sub
End Class