Files
Doku/Dokumentation/Drucken/rptLeer.vb
2020-05-12 14:55:03 +02:00

74 lines
2.6 KiB
VB.net

Imports GrapeCity.ActiveReports
Imports GrapeCity.ActiveReports.Document
Public Class rptLeer
Public dt As DataTable
Dim HP As Integer = 0
Public counter As Integer = 0
Public AltColor As Color = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer))
Private Sub Detail_Format(sender As Object, e As EventArgs) Handles Detail.Format
For Each txtbox As SectionReportModel.TextBox In Sections(1).Controls
txtbox.Text = Class1.DBNull2emptyString(Fields.Item(txtbox.Name).Value)
Next
counter = counter + 1
If counter Mod 2 = 0 Then
Detail.BackColor = Color.Transparent
Else
Detail.BackColor = AltColor
End If
End Sub
Private Sub rptLeer_ReportStart(sender As Object, e As EventArgs) Handles Me.ReportStart
DataSource = dt
Dim ColSize As Size
For i = 0 To (Fields.Count - 1)
Select Case Fields(i).Name
Case "FQDN"
ColSize = New Size(1.5, 5)
Case "IPAdresse"
ColSize = New Size(1, 5)
Case "Modell"
ColSize = New Size(1.2, 5)
Case "Standort"
ColSize = New Size(1.9, 5)
Case "Type"
ColSize = New Size(1, 5)
Case "QINFO"
ColSize = New Size(1.7, 5)
End Select
Dim tb As New GrapeCity.ActiveReports.SectionReportModel.TextBox
tb.Size = ColSize 'New System.Drawing.Size(2, 5)
tb.Location = New Point(ReturnHP(i, tb.Size.Width, False), 0)
tb.Name = Fields(i).Name
tb.Text = Fields(i).Name
tb.Height = 0.3
Me.Sections(1).Controls.Add(tb)
Dim tb2 As New GrapeCity.ActiveReports.SectionReportModel.TextBox
tb2.Size = ColSize 'New System.Drawing.Size(2, 5)
tb2.Location = New Point(ReturnHP(i, tb2.Size.Width, True), 0)
tb2.Font = New Font(tb2.Font.FontFamily, 9, FontStyle.Bold)
tb2.Name = Fields(i).Name & "_Oben"
tb2.Text = Fields(i).Name
Me.Sections(0).Controls.Add(tb2)
Next
End Sub
Function ReturnHP(i As Integer, HL As Integer, addieren As Boolean)
If i = 0 Then
If addieren = True Then HP = HP + HL
Return 0
Exit Function
End If
Dim ret As Integer = HP
If addieren = True Then HP = HP + HL
Return ret
End Function
End Class