From 5290d442f94a12eeb43a94121b07d2bd54486c41 Mon Sep 17 00:00:00 2001 From: pitzm Date: Tue, 11 Feb 2025 15:34:13 +0100 Subject: [PATCH] Modules: Speichern des Dateityps des Belegs in den EDMI_ITEM_DATA --- Interfaces/ZUGFeRDInterface.vb | 7 +++++++ Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb | 26 ++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Interfaces/ZUGFeRDInterface.vb b/Interfaces/ZUGFeRDInterface.vb index 7da0e288..e7917500 100644 --- a/Interfaces/ZUGFeRDInterface.vb +++ b/Interfaces/ZUGFeRDInterface.vb @@ -32,6 +32,9 @@ Public Class ZUGFeRDInterface Public Const XMLSCHEMA_PEPPOL_3017_INVOICE = "Version3017_INVOICE" Public Const XMLSCHEMA_PEPPOL_3017_CREDITNOTE = "Version3017_CREDITNOTE" + Public Const RECEIPT_TYPE_XML = "XML" + Public Const RECEIPT_TYPE_PDF = "PDF" + Private ReadOnly ValidFilenames As New List(Of String) From { PDFEmbeds.ZUGFERD_XML_FILENAME.ToUpper, PDFEmbeds.FACTUR_X_XML_FILENAME_DE.ToUpper, @@ -67,6 +70,10 @@ Public Class ZUGFeRDInterface Public Property SchemaObject As Object Public Property Specification As String Public Property UsedXMLSchema As String + ''' + ''' Dateityp des Belegs: PDF oder XML + ''' + Public Property ReceiptFileType As String Public Property ValidationErrors As New List(Of ZugferdValidationError) End Class diff --git a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb index 3de68633..d572f28f 100644 --- a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -551,6 +551,7 @@ Public Class ImportZUGFeRDFiles End Try Try + oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_XML Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs) Catch ex As Exception Throw ex @@ -640,6 +641,7 @@ Public Class ImportZUGFeRDFiles End If Try + oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_PDF Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs) Catch ex As Exception Throw ex @@ -679,7 +681,7 @@ Public Class ImportZUGFeRDFiles End If ' DataTable vorbereiten - Dim oDataTable As DataTable = FillDataTable(pMessageId, oCheckResult, pDocument.Specification, pDocument.UsedXMLSchema) + Dim oDataTable As DataTable = FillDataTable(pMessageId, oCheckResult, pDocument) ' ColumnList initialisieren Dim oColumnNames As List(Of String) = New List(Of String) From { @@ -702,7 +704,7 @@ Public Class ImportZUGFeRDFiles Return True End Function - Private Function FillDataTable(pMessageId As String, pCheckResult As PropertyValues.CheckPropertyValuesResult, pSpecification As String, pUsedXMLSchema As String) As DataTable + Private Function FillDataTable(pMessageId As String, pCheckResult As PropertyValues.CheckPropertyValuesResult, pDocument As ZUGFeRDInterface.ZugferdResult) As DataTable Dim oDataTable As DataTable = New DataTable() oDataTable.Columns.Add(New DataColumn("REFERENCE_GUID", GetType(String))) @@ -716,26 +718,38 @@ Public Class ImportZUGFeRDFiles Dim oFirstRow As DataRow = oDataTable.NewRow() oFirstRow("REFERENCE_GUID") = pMessageId oFirstRow("ITEM_DESCRIPTION") = "ZUGFeRDSpezifikation" - oFirstRow("ITEM_VALUE") = pSpecification + oFirstRow("ITEM_VALUE") = pDocument.Specification oFirstRow("GROUP_COUNTER") = 0 oFirstRow("SPEC_NAME") = "ZUGFERD_SPECIFICATION" oFirstRow("IS_REQUIRED") = False - _logger.Debug("Mapping Property [ZUGFERD_SPECIFICATION] with value [{0}]", pSpecification) + _logger.Debug("Mapping Property [ZUGFERD_SPECIFICATION] with value [{0}]", pDocument.Specification) oDataTable.Rows.Add(oFirstRow) ' Zweite Zeile enthält das verwendete XML Schema Dim oSecondRow As DataRow = oDataTable.NewRow() oSecondRow("REFERENCE_GUID") = pMessageId oSecondRow("ITEM_DESCRIPTION") = "ZUGFeRDXMLSchema" - oSecondRow("ITEM_VALUE") = pUsedXMLSchema + oSecondRow("ITEM_VALUE") = pDocument.UsedXMLSchema oSecondRow("GROUP_COUNTER") = 0 oSecondRow("SPEC_NAME") = "ZUGFERD_XML_SCHEMA" oSecondRow("IS_REQUIRED") = False - _logger.Debug("Mapping Property [ZUGFERD_XML_SCHEMA] with value [{0}]", pUsedXMLSchema) + _logger.Debug("Mapping Property [ZUGFERD_XML_SCHEMA] with value [{0}]", pDocument.UsedXMLSchema) oDataTable.Rows.Add(oSecondRow) + ' Dritte Zeile enthält das verwendete Datei-Format des Belegs (PDF/XML) + Dim oThirdRow As DataRow = oDataTable.NewRow() + oThirdRow("REFERENCE_GUID") = pMessageId + oThirdRow("ITEM_DESCRIPTION") = "ReceiptFileType" + oThirdRow("ITEM_VALUE") = pDocument.ReceiptFileType + oThirdRow("GROUP_COUNTER") = 0 + oThirdRow("SPEC_NAME") = "RECEIPT_FILE_TYPE" + oThirdRow("IS_REQUIRED") = False + + _logger.Debug("Mapping Property [RECEIPT_FILE_TYPE] with value [{0}]", pDocument.ReceiptFileType) + oDataTable.Rows.Add(oThirdRow) + For Each oProperty In pCheckResult.ValidProperties ' If GroupCounter is -1, it means this is a default property that can only occur once.