WIP
This commit is contained in:
@@ -15,6 +15,8 @@ Imports MultiTool.Shared.Documents
|
||||
Imports MultiTool.Shared.Schemas
|
||||
Imports MultiTool.Shared.Winline
|
||||
Imports MultiTool.Shared.Constants
|
||||
Imports DevExpress.XtraReports.UI
|
||||
Imports MultiTool.Shared.DocumentRow
|
||||
|
||||
Public Class frmImportMain
|
||||
Private LogConfig As LogConfig
|
||||
@@ -476,4 +478,56 @@ Public Class frmImportMain
|
||||
LoadDocument(oDocument)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnOpenReport_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenReport.ItemClick
|
||||
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
|
||||
Dim oMapperConfig As New Mapper(LogConfig)
|
||||
Dim oHeadMapper = oMapperConfig.GetMapper(Of ReportHead)(New Dictionary(Of String, String) From {
|
||||
{"Fakt_Kontonummer[Original]", "Text1"},
|
||||
{"Auftrags-Bestellnummer", "Text2"},
|
||||
{"Datum_Auftrag-Bestellung", "Text5"}
|
||||
})
|
||||
|
||||
Dim oPositionMapper = oMapperConfig.GetMapper(Of ReportPosition)(New Dictionary(Of String, String) From {
|
||||
{"BELEGKEY", "Text1"},
|
||||
{"Artikelnummer", "Text2"}
|
||||
})
|
||||
|
||||
Dim oHeadRow = oDocument.Rows.
|
||||
Where(Function(r) r.Name.EndsWith("T025")).
|
||||
Select(Function(r) r.Fields).
|
||||
FirstOrDefault()
|
||||
Dim oPositionRows = oDocument.Rows.
|
||||
Where(Function(r) r.Name.EndsWith("T026")).
|
||||
ToList()
|
||||
|
||||
Dim oReportHead = oHeadMapper.Map(Of Dictionary(Of String, FieldValue), ReportHead)(oHeadRow)
|
||||
Dim oReportPositions As New List(Of ReportPosition)
|
||||
|
||||
Dim oCounter = 0
|
||||
|
||||
For Each oRow As DocumentRow In oPositionRows
|
||||
Dim oReportPosition As ReportPosition = oPositionMapper.Map(Of Dictionary(Of String, FieldValue), ReportPosition)(oRow.Fields)
|
||||
oReportPosition.Id = oCounter
|
||||
oReportPositions.Add(oReportPosition)
|
||||
|
||||
oCounter += 1
|
||||
Next
|
||||
|
||||
Dim oReportSource As New ReportSource With {
|
||||
.Head = oReportHead,
|
||||
.Positions = oReportPositions
|
||||
}
|
||||
|
||||
Dim oReport As New XtraReport3
|
||||
Dim oDataSource = New DevExpress.DataAccess.ObjectBinding.ObjectDataSource With {
|
||||
.DataSource = oReportSource
|
||||
}
|
||||
oDataSource.Fill()
|
||||
oReport.DataSource = oDataSource
|
||||
|
||||
Dim printTool As New ReportPrintTool(oReport)
|
||||
printTool.Report.CreateDocument(False)
|
||||
printTool.ShowPreviewDialog()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user