Add placeholder for Report Filename
This commit is contained in:
@@ -32,8 +32,8 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
Return oFilePath
|
||||
End Function
|
||||
|
||||
Public Function GenerateReport(pDocument As Document, pTemplate As Template) As TReport
|
||||
|
||||
Public Function GenerateReport(pDocument As Document, pTemplate As Template) As ReportResult(Of TReport)
|
||||
Dim oFilePath = GetReportFilePath(pDocument, pTemplate)
|
||||
Dim oMapperConfig As New Mapper(LogConfig)
|
||||
Dim oHeadMapper = oMapperConfig.GetMapper(Of ReportHead)(New Dictionary(Of String, String) From {
|
||||
{"Fakt_Kontoname", "Text1"},
|
||||
@@ -60,7 +60,7 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
Where(Function(item) item.Function.Name = Constants.FUNCTION_SQL).
|
||||
ToList()
|
||||
|
||||
FillFieldValuesFromSQL(pDocument, oSQLConfig)
|
||||
pDocument = FillFieldValuesFromSQL(pDocument, oSQLConfig, oFilePath)
|
||||
|
||||
Dim oHeadRow = pDocument.Rows.
|
||||
Where(Function(r) r.TableName.EndsWith("T025")).
|
||||
@@ -99,11 +99,16 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
oDataSource.Fill()
|
||||
oReport.DataSource = oDataSource
|
||||
|
||||
Return oReport
|
||||
Dim oResult = New ReportResult(Of TReport) With {
|
||||
.Report = oReport,
|
||||
.FileName = oFilePath
|
||||
}
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Sub FillFieldValuesFromSQL(pDocument As Document, oSQLConfig As List(Of TemplateConfigItem))
|
||||
For Each oSQLConfigItem In oSQLConfig
|
||||
Private Function FillFieldValuesFromSQL(pDocument As Document, pSQLConfig As List(Of TemplateConfigItem), pReportFileName As String) As Document
|
||||
For Each oSQLConfigItem In pSQLConfig
|
||||
' FieldList is a list of fields that will be changed
|
||||
' Example: Setting SQL for Article StorageLocation will invoke the sql for each row
|
||||
Dim oRowList = pDocument.Rows.
|
||||
@@ -116,7 +121,7 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
SingleOrDefault()
|
||||
|
||||
Dim oSQL = oSQLConfigItem.Function.Params
|
||||
oSQL = Patterns.ReplaceForImport(pDocument, oRow, oSQL)
|
||||
oSQL = Patterns.ReplaceForImport(pDocument, oRow, pReportFileName, oSQL)
|
||||
|
||||
Dim oValue = Database.GetScalarValue(oSQL)
|
||||
|
||||
@@ -125,5 +130,13 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Return pDocument
|
||||
End Function
|
||||
|
||||
Public Structure ReportResult(Of T)
|
||||
Public Report As T
|
||||
Public FileName As String
|
||||
End Structure
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user