Imports IntraSell_DLL
Imports IntraSell_Net_Base

Public Class Berichte
    Inherits AbstractForm

    Private Sub FahrerAbrechnung_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            ParentBindingNavigator.Visible = False

            DatumVon.Value = AdaptZeiten(AdaptToday())
            DatumUntil.Value = AdaptZeiten(AdaptToday().AddDays(1).AddSeconds(-1))

            DatumVon.Format = DateTimePickerFormat.Custom
            DatumVon.CustomFormat = "dd MM yyyy HH mm"

            DatumUntil.Format = DateTimePickerFormat.Custom
            DatumUntil.CustomFormat = "dd MM yyyy HH mm"

            CheckBoxPOSFormat.Checked = VarValue_Default(Variablen.KASSA_REPORTS_FORMAT_POS, True)
            CheckBoxOhneTrinkgeld.Checked = VarValue_Default(Variablen.KASSA_REPORTS_UMSATZ_OHNE_TRINKGELD, False)
        Catch ex As Exception
            HandleAppError(ex, Silent:=True)
        End Try
    End Sub

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

    Private Sub FilterButton_Click(sender As Object, e As EventArgs) Handles FilterButton.Click
        Try
            VorgangStat.MdiParent = Main
            VorgangStat.Show()
            VorgangStat.MWSTStatistik(DatumVon.Value, DatumUntil.Value)
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="ButtonKasseMWSTStatistik_Click", Silent:=True)
        End Try
    End Sub

    Private Sub ButtonKassa_Click(sender As Object, e As EventArgs) Handles ButtonKassa.Click
        Try
            KassaListe.MdiParent = Main
            KassaListe.Show()
            KassaListe.TagesReport()
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="ButtonKassa_Click", Silent:=True)
        End Try
    End Sub

    Private Sub ButtonKassaMonat_Click(sender As Object, e As EventArgs) Handles ButtonKassaMonat.Click
        Try
            KassaListe.MdiParent = Main
            KassaListe.Show()
            KassaListe.MonatsReport()
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="ButtonKassaMonat_Click", Silent:=True)
        End Try
    End Sub

    Private Sub ButtonKasseMWSTStatistik_Click(sender As Object, e As EventArgs) Handles ButtonKasseMWSTStatistik.Click
        Try
            DatumVon.Value = AdaptZeiten(AdaptToday())
            DatumUntil.Value = AdaptZeiten(AdaptToday().AddDays(1).AddSeconds(-1))

            VorgangStat.MdiParent = Main
            VorgangStat.Show()
            VorgangStat.MWSTStatistik(DatumVon.Value, DatumUntil.Value)
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="ButtonKasseMWSTStatistik_Click", Silent:=True)
        End Try
    End Sub

    Private Sub ButtonKasseMWSTStatistikMonat_Click(sender As Object, e As EventArgs) Handles ButtonKasseMWSTStatistikMonat.Click
        Try
            VorgangStat.MdiParent = Main
            VorgangStat.Show()
            VorgangStat.MWSTStatistikMonat()
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="ButtonKasseMWSTStatistikMonat_Click", Silent:=True)
        End Try
    End Sub

    Private Sub CheckBoxPOSFormat_Click(sender As Object, e As EventArgs) Handles CheckBoxPOSFormat.Click
        Try
            SetVarValue(Variablen.KASSA_REPORTS_FORMAT_POS, CheckBoxPOSFormat.Checked)
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="CheckBoxPOSFormat_Click", Silent:=True)
        End Try
    End Sub

    Private Sub ButtonBerichtePerEmail_Click(sender As Object, e As EventArgs) Handles ButtonBerichtePerEmail.Click
        Try
            AutomAufgabenEinstellungen.Show()
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="ButtonBerichtePerEmail_Click", Silent:=True)
        End Try
    End Sub

    Private Sub CheckBoxOhneTrinkgeld_Click(sender As Object, e As EventArgs) Handles CheckBoxOhneTrinkgeld.Click
        Try
            SetVarValue(Variablen.KASSA_REPORTS_UMSATZ_OHNE_TRINKGELD, CheckBoxOhneTrinkgeld.Checked)
        Catch ex As Exception
            HandleAppError(ex, Hilfe:="CheckBoxPOSFormat_Click", Silent:=True)
        End Try
    End Sub
End Class