
Imports GrapeCity.ActiveReports
Imports GrapeCity.ActiveReports.Document
Imports System.Globalization

Public Class subrptKontrolleLKW_Zolaris
    Public Kennzeichen As String
    ' Public OperatorId As Integer
    Public AnmeldungsDatum As Date
    Public AnzT = 0
    Private Sub PageFooter1_Format(sender As System.Object, e As System.EventArgs) Handles PageFooter.Format
    End Sub

    Private Sub rptAuswertung_NoData(sender As Object, e As System.EventArgs) Handles Me.NoData
        ' MsgBox("Es wurden keine Daten zum Drucken gefunden.", vbInformation, "Druck Aviso-Auswertung")
        Me.Cancel()  'ev. abbrechen, falls noch aufgebaut wird
    End Sub

    '''''''' ADD AT RUNTIME:
    'Dim d As New GrapeCity.ActiveReports.SectionReportModel.TextBox
    Private Sub rptAuswertung_ReportStart(sender As System.Object, e As System.EventArgs) Handles MyBase.ReportStart

        'Format + Ränder setzen
        Me.PageSettings.Orientation = Section.PageOrientation.Portrait
        Me.PageSettings.Margins.Left = 0.3
        Me.PageSettings.Margins.Right = 0.3
        Me.PageSettings.Margins.Top = 0.5
        Me.PageSettings.Margins.Bottom = 0.4
       
    End Sub

    Dim dummycount As Integer = 0
    Private Sub Detail1_Format(sender As System.Object, e As System.EventArgs) Handles Detail.Format
        dummycount = dummycount + 1
        lblBezugsnrValue.Text = nullStr(Fields.Item("LRN").Value)
        'lblArbNrValue.Text = nullStr(Fields.Item("ArbNr").Value)
        lblMRNValue.Text = nullStr(Fields.Item("CRN").Value)
        '.Text = nullStr(Fields.Item("Pos").Value)
        lblAnDatValue.Text = nullStr(Fields.Item("AnmeldungsDatum").Value)
        lblGestDatValue.Text = nullStr(Fields.Item("DatumBestimmungErreicht").Value)
        lblSBValue.Text = nullStr(Fields.Item("UserID").Value)
        lblBuergschaft.Text = nullStr(Fields.Item("GRN").Value)
        If Not Fields.Item("GarantieWert").Value Is DBNull.Value Then
            lblSiBetragValue.Text = "€ " & CDbl(Fields.Item("GarantieWert").Value).ToString("N2", CultureInfo.InvariantCulture)
        End If

        AnzT += 1

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

    Function nullStr(o As Object) As String
        Try
            If o Is DBNull.Value Then Return ""
            Return CStr(o)
        Catch ex As Exception
            Return ""
        End Try
    End Function

End Class
