Improve Loading report, add TODOs

This commit is contained in:
Jonathan Jenne
2021-11-15 10:59:45 +01:00
parent 29960916a0
commit e764c310ea
6 changed files with 60 additions and 16 deletions

View File

@@ -169,28 +169,28 @@ Public Class frmImportMain
If oTableCounter = 0 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl1, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell
AddHandler GridView1.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid)
End If
If oTableCounter = 1 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl2, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell
AddHandler GridView2.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid)
End If
If oTableCounter = 2 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl3, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell
AddHandler GridView3.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid)
End If
If oTableCounter = 3 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl4, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell
AddHandler GridView4.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid)
End If
@@ -515,7 +515,37 @@ Public Class frmImportMain
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)
Try
SplashScreenManager.ShowWaitForm()
SplashScreenManager.SetWaitFormDescription(My.Resources.frmImportMainExtra.Erstellen_der_Berichtsvorschau)
SetDocumentButtonsEnabled(False)
GridControlFiles.Enabled = False
btnLoadFiles.Enabled = False
SplitContainerGrids.Enabled = False
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
Dim oPrintTool As ReportPrintTool = GenerateReport(oDocument)
oPrintTool.ShowPreview()
SplitContainerGrids.Enabled = True
btnLoadFiles.Enabled = True
GridControlFiles.Enabled = True
SetDocumentButtonsEnabled(True)
SplashScreenManager.CloseWaitForm()
Catch ex As Exception
FormHelper.ShowError(ex, My.Resources.frmImportMainExtra.Erstellen_der_Berichtsvorschau)
End Try
End Sub
Private Function GenerateReport(pDocument As Document) As ReportPrintTool
Dim oPrintTool As ReportPrintTool = Nothing
Dim oMapperConfig As New Mapper(LogConfig)
Dim oHeadMapper = oMapperConfig.GetMapper(Of ReportHead)(New Dictionary(Of String, String) From {
{"Fakt_Kontonummer[Final]", "Text2"},
@@ -534,11 +564,11 @@ Public Class frmImportMain
{"Umsatzsteuerprozent_Zeile", "Text9"}
})
Dim oHeadRow = oDocument.Rows.
Dim oHeadRow = pDocument.Rows.
Where(Function(r) r.Name.EndsWith("T025")).
Select(Function(r) r.Fields).
FirstOrDefault()
Dim oPositionRows = oDocument.Rows.
Dim oPositionRows = pDocument.Rows.
Where(Function(r) r.Name.EndsWith("T026")).
ToList()
@@ -570,10 +600,11 @@ Public Class frmImportMain
oDataSource.Fill()
oReport.DataSource = oDataSource
Dim printTool As New ReportPrintTool(oReport)
printTool.Report.CreateDocument(False)
printTool.ShowPreviewDialog()
End Sub
oPrintTool = New ReportPrintTool(oReport)
oPrintTool.Report.CreateDocument(False)
Return oPrintTool
End Function
Private Sub GridViewFiles_CustomDrawCell(sender As Object, e As Views.Base.RowCellCustomDrawEventArgs) Handles GridViewFiles.CustomDrawCell
Dim oDocument As Document = GridViewFiles.GetRow(e.RowHandle)