Add placeholder for Report Filename

This commit is contained in:
Jonathan Jenne
2022-04-25 10:41:13 +02:00
parent 69f4c640a8
commit 13af72dee5
3 changed files with 39 additions and 27 deletions

View File

@@ -91,8 +91,8 @@ Public Class frmImportMain
lookupMandator.ForceInitialize()
lookupMandator.Properties.View.BestFitColumns()
DocumentLoader = New Documents.DocumentLoader(LogConfig, Winline, My.MappingConfiguration, My.TemplateConfiguration, ConfigManager.Config)
DocumentCleaner = New Documents.DocumentCleaner(LogConfig, CurrentTemplate)
DocumentLoader = New DocumentLoader(LogConfig, Winline, My.MappingConfiguration, My.TemplateConfiguration, ConfigManager.Config)
DocumentCleaner = New DocumentCleaner(LogConfig, CurrentTemplate)
GridLoader = New GridLoader(LogConfig)
ReportGenerator = New ReportGenerator(Of OrderReport)(LogConfig, Database, My.TemplateConfiguration, My.GeneralConfiguration)
@@ -280,19 +280,18 @@ Public Class frmImportMain
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
' Generate the report
Dim oReport = ReportGenerator.GenerateReport(oDocument, CurrentTemplate)
Dim oFilePath = ReportGenerator.GetReportFilePath(oDocument, CurrentTemplate)
Dim oFileInfo = New FileInfo(oFilePath)
Dim oReportResult = ReportGenerator.GenerateReport(oDocument, CurrentTemplate)
Dim oFileInfo = New FileInfo(oReportResult.FileName)
' Export it to pdf
oReport.ExportToPdf(oFilePath)
oReportResult.Report.ExportToPdf(oReportResult.FileName)
Dim oMessage = $"Die Datei wurde im Verzeichnis '{oFileInfo.Directory}' abgelegt. Möchten Sie die Datei jetzt öffnen?"
Dim oResult = MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text)
Dim oDialogResult = MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text)
If oResult = MsgBoxResult.Yes Then
If oDialogResult = MsgBoxResult.Yes Then
Try
Process.Start(oFilePath)
Process.Start(oReportResult.FileName)
Catch ex As Exception
FormHelper.ShowError(ex, "Export Report")
End Try
@@ -539,8 +538,8 @@ Public Class frmImportMain
Dim oReport As OrderReport = oReportGenerator.GenerateReport(oDocument, CurrentTemplate)
Dim oPrintTool As New ReportPrintTool(oReport)
Dim oResult = oReportGenerator.GenerateReport(oDocument, CurrentTemplate)
Dim oPrintTool As New ReportPrintTool(oResult.Report)
oPrintTool.Report.CreateDocument(False)
oPrintTool.ShowPreview()
@@ -754,17 +753,14 @@ Public Class frmImportMain
' TODO: Call GetReportFilePath in GenerateReport to better control
' when filename is generated and use it as placeholder
Dim oReport = ReportGenerator.GenerateReport(pDocument, CurrentTemplate)
Dim oFilePath = ReportGenerator.GetReportFilePath(pDocument, CurrentTemplate)
Dim oReportResult = ReportGenerator.GenerateReport(pDocument, CurrentTemplate)
WebService.RaiseWebServiceProgress("Bericht exportieren")
' Export it to pdf
oReport.ExportToPdf(oFilePath)
oReportResult.Report.ExportToPdf(oReportResult.FileName)
WebService.RaiseWebServiceProgress("Datei archivieren")
' Mark Document as Imported, will be moved on Form Close
' Mark Document as Imported, will be moved on Form Close or File Reload
pDocument.Imported = True
Return True