Imports GrapeCity.ActiveReports 
Imports GrapeCity.ActiveReports.Document 

Public Class rptLeereOBU
    Public sdlNr As Integer = -1
    Public von As Date = Nothing
    Public bis As Date = Nothing
    Public sdlText As String = ""

    Private Sub rptAuswertung_ReportStart(sender As System.Object, e As System.EventArgs) Handles MyBase.ReportStart

        Dim kundenSQL As New kundenSQL
        Dim where = ""
        If sdlNr > 0 Then where = " AND SDLNr=" & sdlNr
        'MsgBox("SELECT * FROM [SDL].[dbo].[SDL] WHERE (OBUID is null or OBUID = '') AND SDLNr IN (200,203,201,209,210,213) " & where & " AND Bestelldatum between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' ORDER BY SDLNr, KundenNr, KfzKennzeichen, Bestelldatum,Lieferdatum")
        Me.DataSource = kundenSQL.loadDgvBySql("SELECT * FROM [SDL].[dbo].[SDL] WHERE (OBUID is null or OBUID = '') AND SDLNr IN (200,203,201,209,210,213) " & where & " AND Änderungsdatum between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' ORDER BY SDLNr, KundenNr, KfzKennzeichen, Bestelldatum,Lieferdatum", "SDL")
       
        If sdlText <> "" Then lblSDLLeistung.Text = sdlText
    End Sub


    Dim dummycount As Integer = 0
    Private Sub Detail1_Format(sender As System.Object, e As System.EventArgs) Handles Detail.Format
        dummycount += 1

        lblSDL.Text = cSqlDb.checkNullStr(Fields.Item("SDLNr").Value)
        lblKunde.Text = cSqlDb.checkNullStr(Fields.Item("KundenNr").Value)
        lblKartenNr.Text = cSqlDb.checkNullStr(Fields.Item("KartenNr").Value)
        lblLKW.Text = cSqlDb.checkNullStr(Fields.Item("KfzKennzeichen").Value)
        lblBestelldatum.Text = cSqlDb.checkNullStr(Fields.Item("Bestelldatum").Value)
        lblLieferdatum.Text = cSqlDb.checkNullStr(Fields.Item("Lieferdatum").Value)

        'Abwechselnd grauen und weißen Hintergrund
        If (dummycount Mod 2) = 0 Then
            Detail.BackColor = System.Drawing.Color.White
        Else
            Detail.BackColor = System.Drawing.Color.WhiteSmoke
        End If
    End Sub

End Class
