reportgedöns

This commit is contained in:
Jonathan Jenne
2023-12-01 08:57:19 +01:00
parent ca0c427908
commit 3ca992e043
5 changed files with 118 additions and 58 deletions

View File

@@ -2,8 +2,15 @@
Imports DevExpress.XtraPrinting
Public Class ReportCreator
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}
Private Envelope As Envelope
Public Sub New(pEnvelope As Envelope)
Envelope = pEnvelope
End Sub
Public Async Function CreateReport(pReportItems As List(Of ReportItem)) As Task(Of Byte())
Dim oItems = pReportItems.Select(AddressOf MergeEnvelope).ToList()
Dim oSource As New ReportSource With {.Items = oItems}
Dim oReport As New rptEnvelopeHistory() With {.DataSource = oSource, .DataMember = "Items"}
Await oReport.CreateDocumentAsync()
@@ -13,4 +20,11 @@ Public Class ReportCreator
Return oStream.ToArray()
End Using
End Function
Private Function MergeEnvelope(pItem As ReportItem) As ReportItem
If pItem.Envelope Is Nothing Then
pItem.Envelope = Envelope
End If
Return pItem
End Function
End Class