div. Änderungen

This commit is contained in:
2026-09-15 17:07:48 +02:00
parent d397579b4f
commit 436f5e5f7f
15 changed files with 852 additions and 601 deletions

View File

@@ -64,6 +64,10 @@ Public Class cNCTSGestellungsadressen
Public Function SAVE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
If Not VERAG_PROG_ALLGEMEIN.cProgramFunctions.ValidateSQLFieldLengths(list, "tblNCTSGestellungsadressen", "", "FMZOLL") Then
Return False
End If
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblNCTSGestellungsadressen WITH(updlock,serializable) WHERE nga_id=@nga_id) " &
" BEGIN " & getUpdateCmd() & " END " &

View File

@@ -2512,7 +2512,7 @@ Public Class DATENVERVER_OPTIONS
End Function
Public Shared Function addZugferdXML(pdfPath As String, xmlPath As String) As String
Public Shared Function addZugferdXML(pdfPath As String, xmlPath As String, Optional fixedIssuerAssignedID As Boolean = True) As String
Dim tempFile As String = pdfPath & ".tmp"
@@ -2522,6 +2522,12 @@ Public Class DATENVERVER_OPTIONS
Dim xmlBytes = File.ReadAllBytes(xmlPath)
If fixedIssuerAssignedID Then
fixIssuerAssignedID(xmlBytes)
End If
Dim fileName As String = "factur-x.xml"
If HasAttachment(pdf, fileName) Then
@@ -2557,6 +2563,75 @@ Public Class DATENVERVER_OPTIONS
End Function
Public Shared Sub fixIssuerAssignedID(ByRef xmlBytes As Byte())
Dim xmlDoc As New System.Xml.XmlDocument()
xmlDoc.PreserveWhitespace = True
Using ms As New MemoryStream(xmlBytes)
xmlDoc.Load(ms)
End Using
Dim ns As New System.Xml.XmlNamespaceManager(xmlDoc.NameTable)
ns.AddNamespace(
"ram",
"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
)
Dim documents = xmlDoc.SelectNodes(
"//ram:AdditionalReferencedDocument",
ns
)
For Each document As XmlElement In documents
Dim idNode As XmlNode =
document.SelectSingleNode("ram:ID", ns)
If idNode Is Nothing Then
Continue For
End If
' Wert der bisherigen ID merken
Dim idValue As String = idNode.InnerText
' Neue IssuerAssignedID erzeugen
Dim issuerAssignedID As XmlElement =
xmlDoc.CreateElement(
"ram",
"IssuerAssignedID",
"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
)
issuerAssignedID.InnerText = idValue
' ID entfernen
document.RemoveChild(idNode)
' IssuerAssignedID an ERSTE Stelle setzen
document.InsertBefore(
issuerAssignedID,
document.FirstChild
)
Next
Using ms As New MemoryStream()
xmlDoc.Save(ms)
xmlBytes = ms.ToArray()
End Using
End Sub
Private Shared Function HasAttachment(pdf As iText.Kernel.Pdf.PdfDocument, fileName As String) As Boolean
Dim catalog = pdf.GetCatalog().GetPdfObject()