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

Public Class subrptKontrolleLKW_NCTSTR_Abrechnung
    Public AnzT = 0
    Public GesSumme As Double = 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
        lblGarantieBis.Text = "bis € " & CDbl(Fields.Item("GARANTIEBIS").Value).ToString("N2", CultureInfo.InvariantCulture)
        lblAnzahl.Text = CInt(Fields.Item("ANZAHL").Value)
        Select Case Fields.Item("ART").Value
            Case "LKW"
                lblEinzelpreis.Text = "€ " & CDbl(Fields.Item("EINZALBETRAG").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblGesamtpreis.Text = "€ " & CDbl(Fields.Item("GESAMTBETRAG").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblAbrechnugnsart.Text = "per LKW"
            Case "Versandschein"
                lblEinzelpreis.Text = "€ " & CDbl(Fields.Item("EINZALBETRAG").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblGesamtpreis.Text = "€ " & CDbl(Fields.Item("GESAMTBETRAG").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblAbrechnugnsart.Text = "per Versandschein"
            Case "%"
                lblEinzelpreis.Text = "€ " & CDbl(Fields.Item("BETRAG").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblGesamtpreis.Text = "€ " & CDbl(Fields.Item("BETRAG").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblAbrechnugnsart.Text = "% vom Sicherheit"
            Case "SPEZIAL"
                lblGarantieBis.Text = "€ " & CDbl(Fields.Item("GARANTIEBIS").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblEinzelpreis.Text = ""
                lblGesamtpreis.Text = "€ " & CDbl(Fields.Item("BETRAG").Value).ToString("N2", CultureInfo.InvariantCulture)
                lblAbrechnugnsart.Text = "Spezial"
        End Select


        GesSumme += "€ " & CDbl(Fields.Item("GESAMTBETRAG").Value)

        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

    Private Sub ReportFooter1_Format(sender As Object, e As EventArgs) Handles ReportFooter1.Format
        lblGesamtsumme.Text = "€ " & GesSumme.ToString("N2", CultureInfo.InvariantCulture)
    End Sub
End Class
