Update Report, Fix Paths issues, Small Tweaks, Work on Exports
This commit is contained in:
@@ -13,6 +13,7 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly TemplateConfig As TemplateConfig
|
||||
Private ReadOnly GeneralConfig As GeneralConfig
|
||||
Private ReadOnly Patterns As Patterns
|
||||
Private ReadOnly FileEx As DigitalData.Modules.Filesystem.File
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pTemplateConfig As TemplateConfig, pGeneralConfig As GeneralConfig)
|
||||
@@ -20,11 +21,12 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
Database = pDatabase
|
||||
GeneralConfig = pGeneralConfig
|
||||
TemplateConfig = pTemplateConfig
|
||||
Patterns = New Patterns(pLogConfig, pGeneralConfig)
|
||||
FileEx = New DigitalData.Modules.Filesystem.File(LogConfig)
|
||||
End Sub
|
||||
|
||||
Public Function GetReportFilePath(pDocument As Document, pTemplate As Template)
|
||||
Dim oFinalDirectory = FileEx.GetDateDirectory(pTemplate.OutputReportDirectory)
|
||||
Dim oFinalDirectory = FileEx.CreateDateDirectory(pTemplate.OutputReportDirectory)
|
||||
Dim oFileName = FileEx.GetFilenameWithSuffix(IO.Path.GetFileNameWithoutExtension(pDocument.File.Name), FileEx.GetDateTimeString, "pdf")
|
||||
Dim oFilePath As String = IO.Path.Combine(oFinalDirectory, oFileName)
|
||||
Return oFilePath
|
||||
@@ -34,7 +36,7 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
|
||||
Dim oMapperConfig As New Mapper(LogConfig)
|
||||
Dim oHeadMapper = oMapperConfig.GetMapper(Of ReportHead)(New Dictionary(Of String, String) From {
|
||||
{"Fakt_Kontonummer[External]", "Text1"},
|
||||
{"Fakt_Kontoname", "Text1"},
|
||||
{"Fakt_Kontonummer[Final]", "Text2"},
|
||||
{"Auftrags-Bestellnummer", "Text3"},
|
||||
{"Datum_Auftrag-Bestellung", "Text4"},
|
||||
@@ -44,6 +46,7 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
Dim oPositionMapper = oMapperConfig.GetMapper(Of ReportPosition)(New Dictionary(Of String, String) From {
|
||||
{"Artikelnummer", "Text1"},
|
||||
{"Lieferantenartikelnummer", "Text2"},
|
||||
{"Bezeichnung", "Text3"},
|
||||
{"Menge_bestellt", "Text4"},
|
||||
{"Menge_geliefert", "Text5"},
|
||||
{"Colli", "Text6"},
|
||||
@@ -112,35 +115,8 @@ Public Class ReportGenerator(Of TReport As IReport)
|
||||
Where(Function(field) field.Key = oSQLConfigItem.Name).
|
||||
SingleOrDefault()
|
||||
|
||||
Dim oRegex = New Regex("{#(\w+)#([\w\s_-]+)}+")
|
||||
Dim oSQL = oSQLConfigItem.Function.Params
|
||||
Dim oMatches As MatchCollection = oRegex.Matches(oSQL)
|
||||
|
||||
For Each oMatch As Match In oMatches
|
||||
Dim oPlaceholderString As String = oMatch.Groups.Item(0)?.Value
|
||||
Dim oPlaceholderType As String = oMatch.Groups.Item(1)?.Value
|
||||
Dim oPlaceholderValue As String = oMatch.Groups.Item(2)?.Value
|
||||
|
||||
Select Case oPlaceholderType.ToUpper
|
||||
Case "FIELD"
|
||||
Dim oFieldName = oPlaceholderValue
|
||||
Dim oTargetField = oRow.Fields.
|
||||
Where(Function(field) field.Key = oFieldName).
|
||||
SingleOrDefault()
|
||||
|
||||
oSQL = oSQL.Replace(oPlaceholderString, oTargetField.Value.Final)
|
||||
|
||||
Case "CONST"
|
||||
Select Case oMatch.Groups.Item(2).Value.ToUpper
|
||||
Case "MESOYEAR"
|
||||
oSQL = oSQL.Replace(oPlaceholderString, GeneralConfig.GetWinLineYear())
|
||||
|
||||
Case "MESOCOMP"
|
||||
oSQL = oSQL.Replace(oPlaceholderString, pDocument.Mandator.Id)
|
||||
|
||||
End Select
|
||||
End Select
|
||||
Next
|
||||
oSQL = Patterns.Replace(pDocument, oRow, oSQL)
|
||||
|
||||
Dim oValue = Database.GetScalarValue(oSQL)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user