This commit is contained in:
Jonathan Jenne 2023-11-30 16:37:45 +01:00
parent c2de72be74
commit ca0c427908
5 changed files with 65 additions and 30 deletions

View File

@ -2,8 +2,8 @@
Imports DevExpress.XtraPrinting
Public Class ReportCreator
Public Shared Async Function CreateReport(pReportItems As List(Of ReportItem)) As Task(Of Byte())
Dim oSource As New ReportSource With {.Items = pReportItems}
Public Shared Async Function CreateReport(pEnvelope As Envelope, pReportItems As List(Of ReportItem)) As Task(Of Byte())
Dim oSource As New ReportSource With {.Items = pReportItems, .Envelope = pEnvelope}
Dim oReport As New rptEnvelopeHistory() With {.DataSource = oSource, .DataMember = "Items"}
Await oReport.CreateDocumentAsync()

View File

@ -1,5 +1,9 @@
Public Class ReportItem
Public Property EnvelopeId As Integer
Public Property EnvelopeTitle As String
Public Property EnvelopeSubject As String
Public Property ItemStatus As Constants.EnvelopeStatus
Public Property ItemUserReference As String
Public Property ItemDate As Date

View File

@ -1,3 +1,4 @@
Public Class ReportSource
Public Property Items As List(Of ReportItem)
Public Property Envelope As Envelope
End Class

View File

@ -38,12 +38,13 @@ Partial Public Class rptEnvelopeHistory
Me.tableCell4 = New DevExpress.XtraReports.UI.XRTableCell()
Me.tableCell5 = New DevExpress.XtraReports.UI.XRTableCell()
Me.tableCell6 = New DevExpress.XtraReports.UI.XRTableCell()
Me.ObjectDataSource1 = New DevExpress.DataAccess.ObjectBinding.ObjectDataSource(Me.components)
Me.Title = New DevExpress.XtraReports.UI.XRControlStyle()
Me.DetailCaption1 = New DevExpress.XtraReports.UI.XRControlStyle()
Me.DetailData1 = New DevExpress.XtraReports.UI.XRControlStyle()
Me.DetailData3_Odd = New DevExpress.XtraReports.UI.XRControlStyle()
Me.PageInfo = New DevExpress.XtraReports.UI.XRControlStyle()
Me.XrLabel1 = New DevExpress.XtraReports.UI.XRLabel()
Me.ObjectDataSource1 = New DevExpress.DataAccess.ObjectBinding.ObjectDataSource(Me.components)
CType(Me.table1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.table2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.ObjectDataSource1, System.ComponentModel.ISupportInitialize).BeginInit()
@ -52,21 +53,19 @@ Partial Public Class rptEnvelopeHistory
'TopMargin
'
Me.TopMargin.Dpi = 254.0!
Me.TopMargin.HeightF = 254.0!
Me.TopMargin.Name = "TopMargin"
'
'BottomMargin
'
Me.BottomMargin.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {Me.pageInfo1, Me.pageInfo2})
Me.BottomMargin.Dpi = 254.0!
Me.BottomMargin.HeightF = 254.0!
Me.BottomMargin.Name = "BottomMargin"
'
'ReportHeader
'
Me.ReportHeader.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {Me.label1})
Me.ReportHeader.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {Me.XrLabel1, Me.label1})
Me.ReportHeader.Dpi = 254.0!
Me.ReportHeader.HeightF = 152.4!
Me.ReportHeader.HeightF = 236.0459!
Me.ReportHeader.Name = "ReportHeader"
'
'GroupHeader1
@ -99,7 +98,7 @@ Partial Public Class rptEnvelopeHistory
Me.pageInfo2.Dpi = 254.0!
Me.pageInfo2.LocationFloat = New DevExpress.Utils.PointFloat(796.0!, 0!)
Me.pageInfo2.Name = "pageInfo2"
Me.pageInfo2.SizeF = New System.Drawing.SizeF(796.0!, 58.0!)
Me.pageInfo2.SizeF = New System.Drawing.SizeF(1104.0!, 58.0!)
Me.pageInfo2.StyleName = "PageInfo"
Me.pageInfo2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight
Me.pageInfo2.TextFormatString = "Seite {0} von {1}"
@ -109,9 +108,9 @@ Partial Public Class rptEnvelopeHistory
Me.label1.Dpi = 254.0!
Me.label1.LocationFloat = New DevExpress.Utils.PointFloat(0!, 0!)
Me.label1.Name = "label1"
Me.label1.SizeF = New System.Drawing.SizeF(1592.0!, 61.45361!)
Me.label1.SizeF = New System.Drawing.SizeF(1900.0!, 61.4536!)
Me.label1.StyleName = "Title"
Me.label1.Text = "Envelope History"
Me.label1.Text = "Signierungs Zertifikat"
'
'table1
'
@ -119,7 +118,7 @@ Partial Public Class rptEnvelopeHistory
Me.table1.LocationFloat = New DevExpress.Utils.PointFloat(0!, 0!)
Me.table1.Name = "table1"
Me.table1.Rows.AddRange(New DevExpress.XtraReports.UI.XRTableRow() {Me.tableRow1})
Me.table1.SizeF = New System.Drawing.SizeF(1592.0!, 71.12!)
Me.table1.SizeF = New System.Drawing.SizeF(1900.0!, 71.12!)
'
'tableRow1
'
@ -135,24 +134,24 @@ Partial Public Class rptEnvelopeHistory
Me.tableCell1.Name = "tableCell1"
Me.tableCell1.StyleName = "DetailCaption1"
Me.tableCell1.StylePriority.UseBorders = False
Me.tableCell1.Text = "Item Status"
Me.tableCell1.Weight = 0.28459106138603174R
Me.tableCell1.Text = "Aktion"
Me.tableCell1.Weight = 0.626953898336187R
'
'tableCell2
'
Me.tableCell2.Dpi = 254.0!
Me.tableCell2.Name = "tableCell2"
Me.tableCell2.StyleName = "DetailCaption1"
Me.tableCell2.Text = "Item User Reference"
Me.tableCell2.Weight = 0.46912142499607412R
Me.tableCell2.Text = "Benutzer"
Me.tableCell2.Weight = 0.30791185539648991R
'
'tableCell3
'
Me.tableCell3.Dpi = 254.0!
Me.tableCell3.Name = "tableCell3"
Me.tableCell3.StyleName = "DetailCaption1"
Me.tableCell3.Text = "Item Date"
Me.tableCell3.Weight = 0.24628753278722715R
Me.tableCell3.Text = "Datum"
Me.tableCell3.Weight = 0.25860160582871317R
'
'table2
'
@ -161,7 +160,7 @@ Partial Public Class rptEnvelopeHistory
Me.table2.Name = "table2"
Me.table2.OddStyleName = "DetailData3_Odd"
Me.table2.Rows.AddRange(New DevExpress.XtraReports.UI.XRTableRow() {Me.tableRow2})
Me.table2.SizeF = New System.Drawing.SizeF(1592.0!, 63.42!)
Me.table2.SizeF = New System.Drawing.SizeF(1900.0!, 63.42!)
'
'tableRow2
'
@ -178,7 +177,7 @@ Partial Public Class rptEnvelopeHistory
Me.tableCell4.Name = "tableCell4"
Me.tableCell4.StyleName = "DetailData1"
Me.tableCell4.StylePriority.UseBorders = False
Me.tableCell4.Weight = 0.28459106138603174R
Me.tableCell4.Weight = 0.62695389177331973R
'
'tableCell5
'
@ -186,7 +185,7 @@ Partial Public Class rptEnvelopeHistory
Me.tableCell5.ExpressionBindings.AddRange(New DevExpress.XtraReports.UI.ExpressionBinding() {New DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[ItemUserReference]")})
Me.tableCell5.Name = "tableCell5"
Me.tableCell5.StyleName = "DetailData1"
Me.tableCell5.Weight = 0.46912142499607412R
Me.tableCell5.Weight = 0.30791178180943785R
'
'tableCell6
'
@ -194,13 +193,7 @@ Partial Public Class rptEnvelopeHistory
Me.tableCell6.ExpressionBindings.AddRange(New DevExpress.XtraReports.UI.ExpressionBinding() {New DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[ItemDate]")})
Me.tableCell6.Name = "tableCell6"
Me.tableCell6.StyleName = "DetailData1"
Me.tableCell6.Weight = 0.24628751361789417R
'
'ObjectDataSource1
'
Me.ObjectDataSource1.DataMember = "Items"
Me.ObjectDataSource1.DataSource = GetType(EnvelopeGenerator.Common.ReportSource)
Me.ObjectDataSource1.Name = "ObjectDataSource1"
Me.tableCell6.Weight = 0.25860166310065952R
'
'Title
'
@ -255,6 +248,23 @@ Partial Public Class rptEnvelopeHistory
Me.PageInfo.Name = "PageInfo"
Me.PageInfo.Padding = New DevExpress.XtraPrinting.PaddingInfo(15, 15, 0, 0, 254.0!)
'
'XrLabel1
'
Me.XrLabel1.Dpi = 254.0!
Me.XrLabel1.ExpressionBindings.AddRange(New DevExpress.XtraReports.UI.ExpressionBinding() {New DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[EnvelopeSubject]")})
Me.XrLabel1.LocationFloat = New DevExpress.Utils.PointFloat(0!, 159.105!)
Me.XrLabel1.Multiline = True
Me.XrLabel1.Name = "XrLabel1"
Me.XrLabel1.Padding = New DevExpress.XtraPrinting.PaddingInfo(5, 5, 0, 0, 254.0!)
Me.XrLabel1.SizeF = New System.Drawing.SizeF(857.25!, 76.94083!)
Me.XrLabel1.Text = "XrLabel1"
'
'ObjectDataSource1
'
Me.ObjectDataSource1.DataMember = "Items"
Me.ObjectDataSource1.DataSource = GetType(EnvelopeGenerator.Common.ReportSource)
Me.ObjectDataSource1.Name = "ObjectDataSource1"
'
'rptEnvelopeHistory
'
Me.Bands.AddRange(New DevExpress.XtraReports.UI.Band() {Me.TopMargin, Me.BottomMargin, Me.ReportHeader, Me.GroupHeader1, Me.Detail})
@ -262,7 +272,7 @@ Partial Public Class rptEnvelopeHistory
Me.DataSource = Me.ObjectDataSource1
Me.Dpi = 254.0!
Me.Font = New System.Drawing.Font("Arial", 9.75!)
Me.Margins = New System.Drawing.Printing.Margins(254, 254, 254, 254)
Me.Margins = New System.Drawing.Printing.Margins(100, 100, 100, 100)
Me.PageHeight = 2970
Me.PageWidth = 2100
Me.PaperKind = System.Drawing.Printing.PaperKind.A4
@ -301,4 +311,5 @@ Partial Public Class rptEnvelopeHistory
Friend WithEvents DetailData1 As DevExpress.XtraReports.UI.XRControlStyle
Friend WithEvents DetailData3_Odd As DevExpress.XtraReports.UI.XRControlStyle
Friend WithEvents PageInfo As DevExpress.XtraReports.UI.XRControlStyle
Friend WithEvents XrLabel1 As DevExpress.XtraReports.UI.XRLabel
End Class

View File

@ -10,17 +10,33 @@ Public Class frmReportViewer
Private ConfigManager As ConfigManager(Of Config)
Private Database As MSSQLServer
Private EnvelopeModel As EnvelopeModel
Private Async Sub frmReportViewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath, CompanyName:="Digital Data", ProductName:="EnvelopeGenerator")
Logger = LogConfig.GetLogger()
ConfigManager = New ConfigManager(Of Config)(LogConfig, "C:\Users\JenneJ\AppData\Roaming\Digital Data\Envelope Generator\1.0.0.0")
Database = New MSSQLServer(LogConfig, MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString))
Dim oTable As DataTable = Database.GetDatatable("SELECT * FROM VWSIG_ENVELOPE_REPORT")
Dim oItems = GetReportSource(oTable)
Dim oBuffer = Await ReportCreator.CreateReport(oItems)
If oItems.Count = 0 Then
Exit Sub
End If
Dim oEnvelopeId = oItems.First().EnvelopeId
Dim oState As New State() With {
.Database = Database,
.LogConfig = LogConfig
}
EnvelopeModel = New EnvelopeModel(oState)
Dim oEnvelope = EnvelopeModel.GetById(oEnvelopeId)
Dim oBuffer = Await ReportCreator.CreateReport(oEnvelope, oItems)
Using oStream As New IO.MemoryStream(oBuffer)
PdfViewer1.LoadDocument(oStream)
@ -37,6 +53,9 @@ Public Class frmReportViewer
Private Function ToReportItem(pRow As DataRow) As ReportItem
Return New ReportItem() With {
.EnvelopeId = pRow.Item("ENVELOPE_ID"),
.EnvelopeTitle = pRow.ItemEx("HEAD_TITLE", String.Empty),
.EnvelopeSubject = pRow.ItemEx("HEAD_SUBJECT", String.Empty),
.ItemDate = pRow.ItemEx(Of Date)("POS_WHEN", Nothing),
.ItemStatus = pRow.ItemEx("POS_STATUS", 0),
.ItemUserReference = pRow.ItemEx("POS_WHO", "")