Imports GrapeCity.ActiveReports
Imports GrapeCity.ActiveReports.Document

Public Class rptMittagsMenue
    Public dt As DataTable



    Private Sub rptMittagsMenue_ReportStart(sender As Object, e As EventArgs) Handles Me.ReportStart
        DataSource = dt

        Try
            Select Case SQLTools.DBNull2emptyString(Fields.Item("MenuArt").Value)
                Case ""

                Case Else
                    For Each meh As String() In cListe.Hintergrund
                        If meh(0) = SQLTools.DBNull2emptyString(Fields.Item("MenuArt").Value) Then
                            Me.Watermark = Image.FromFile(Application.StartupPath & meh(1))     ' rel. Pfad zur Bilddatei
                            Picture1.Image = Image.FromFile(Application.StartupPath & meh(2))   ' Banner oben
                            Picture2.Image = Image.FromFile(Application.StartupPath & meh(3))   ' Banner unten
                        End If

                    Next


                    'Case "Frühling"
                    '    Me.Watermark = Image.FromFile(Application.StartupPath & "\Images\BackFrühling.jpg")
                    '    Picture1.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_TOP_Speisekarte2.png")
                    '    Picture2.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_BOTTOM_Speisekarte.png")

                    'Case "Sommer"
                    '    Me.Watermark = Image.FromFile(Application.StartupPath & "\Images\BackSommer.jpg")
                    '    Picture1.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_TOP_Speisekarte2.png")
                    '    Picture2.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_BOTTOM_Speisekarte.png")

                    'Case "Herbst"
                    '    Me.Watermark = Image.FromFile(Application.StartupPath & "\Images\BackHerbst.jpg")
                    '    Picture1.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_TOP_Speisekarte2.png")
                    '    Picture2.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_BOTTOM_Speisekarte.png")

                    'Case "Winter"
                    '    Me.Watermark = Image.FromFile(Application.StartupPath & "\Images\BackWinter.jpg")
                    '    Picture1.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_TOP_Speisekarte2.png")
                    '    Picture2.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_BOTTOM_Speisekarte.png")

                    'Case "Ostern"
                    '    Me.Watermark = Image.FromFile(Application.StartupPath & "\Images\BackOstern.jpg")
                    '    Picture1.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_TOP_Speisekarte2.png")
                    '    Picture2.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_BOTTOM_Speisekarte.png")

                    'Case "Weihnachten"
                    '    Me.Watermark = Image.FromFile(Application.StartupPath & "\Images\BackWeihnachten.jpg")
                    '    Picture1.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_TOP_Speisekarte2.png")
                    '    Picture2.Image = Image.FromFile(Application.StartupPath & "\Images\Banner_BOTTOM_Speisekarte.png")

            End Select
        Catch ex As Exception
            MsgBox("Eingestellter Hintergrund konnte im Dateisystem nicht gefunden werden.")
        End Try
    End Sub


    Private Sub Detail_Format(sender As Object, e As EventArgs) Handles Detail.Format

        If Fields.Item("MenuPrint").Value = True Then
            txtTitel.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuTitel").Value)
            txtDatum.Text = "vom " & SQLTools.DBNull2emptyString(Fields.Item("MenuDateVon").Value) & " bis " & SQLTools.DBNull2emptyString(Fields.Item("MenuDateBis").Value)
        Else
            txtTitel.Text = "Wochenkarte"
            txtDatum.Text = "vom " & SQLTools.DBNull2emptyString(Fields.Item("MenuDateVon").Value) & " bis " & SQLTools.DBNull2emptyString(Fields.Item("MenuDateBis").Value)
        End If

        If (Fields.Item("MenuPrintSuppe").Value) = True Then
            txtSuppe.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuSuppe").Value)
        Else
            txtSuppe.Visible = False
            txtTitelSuppe.Visible = False
        End If

        txtDetails.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuDetail1").Value) & vbCrLf & SQLTools.DBNull2emptyString(Fields.Item("MenuDetail2").Value) & vbCrLf & SQLTools.DBNull2emptyString(Fields.Item("MenuDetail3").Value)

        Dim Datum As Date = Fields.Item("MenuDateVon").Value

        txtTitelMontag.Text = "Montag, " & Datum
        txtMontag.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuEssenMo").Value)
        txtTitelDienstag.Text = "Dienstag, " & Datum.AddDays(1)
        txtDienstag.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuEssenDi").Value)
        txtTitelMittwoch.Text = "Mittwoch, " & Datum.AddDays(2)
        txtMittwoch.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuEssenMi").Value)
        txtTitelDonnerstag.Text = "Donnerstag, " & Datum.AddDays(3)
        txtDonnerstag.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuEssenDo").Value)
        txtTitelFreitag.Text = "Freitag, " & Datum.AddDays(4)
        txtFreitag.Text = SQLTools.DBNull2emptyString(Fields.Item("MenuEssenFr").Value)

    End Sub


End Class
