From ec3a677ca87971bf7497210276c6789f237b52c3 Mon Sep 17 00:00:00 2001 From: Developer01 Date: Tue, 11 Nov 2025 17:42:08 +0100 Subject: [PATCH] MS Jobs Sichtbeleg --- Jobs/App.config | 2 +- Jobs/Jobs.vbproj | 99 +++++----- Jobs/My Project/AssemblyInfo.vb | 4 +- Jobs/ZUGFeRD/XRechnungViewDocument.vb | 260 +++++++++++++++++--------- Jobs/packages.config | 8 +- 5 files changed, 232 insertions(+), 141 deletions(-) diff --git a/Jobs/App.config b/Jobs/App.config index 34ac9da4..d05987f0 100644 --- a/Jobs/App.config +++ b/Jobs/App.config @@ -43,7 +43,7 @@ - + diff --git a/Jobs/Jobs.vbproj b/Jobs/Jobs.vbproj index dfb41c91..0df947a0 100644 --- a/Jobs/Jobs.vbproj +++ b/Jobs/Jobs.vbproj @@ -134,74 +134,80 @@ ..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.1d.writer.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.barcode.1d.writer.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.barcode.2d.writer.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.barcode.2d.writer.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.CAD.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.CAD.DWG.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.CAD.DWG.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Common.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Common.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Document.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Document.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Email.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Email.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.HTML.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.HTML.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.Formats.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Formats.Conversion.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.Formats.Conversion.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.Imaging.Rendering.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.Imaging.Rendering.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.MSOfficeBinary.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.MSOfficeBinary.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenDocument.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.OpenDocument.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.OpenXML.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.OpenXML.Templating.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.OpenXML.Templating.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.PDF.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.PDF.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.RTF.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.RTF.dll - - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.SVG.dll + + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.SVG.dll - ..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.wia.gateway.dll + ..\packages\GdPicture.14.3.19\lib\net462\GdPicture.NET.14.wia.gateway.dll True ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\GdPicture.14.3.19\lib\net462\NativeSDK.Settings.dll + + + ..\packages\GdPicture.14.3.19\lib\net462\NativeSDK.Settings.Edition.dll + ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll @@ -227,9 +233,6 @@ ..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll - - ..\packages\System.CodeDom.8.0.0\lib\net462\System.CodeDom.dll - ..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll @@ -264,8 +267,8 @@ ..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll - - ..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll + + ..\packages\System.Text.Json.8.0.6\lib\net462\System.Text.Json.dll ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll @@ -282,11 +285,11 @@ powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }" - + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - + \ No newline at end of file diff --git a/Jobs/My Project/AssemblyInfo.vb b/Jobs/My Project/AssemblyInfo.vb index 49811d3f..23a3e63c 100644 --- a/Jobs/My Project/AssemblyInfo.vb +++ b/Jobs/My Project/AssemblyInfo.vb @@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices ' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern ' übernehmen, indem Sie "*" eingeben: - - + + diff --git a/Jobs/ZUGFeRD/XRechnungViewDocument.vb b/Jobs/ZUGFeRD/XRechnungViewDocument.vb index 9c99b9f2..aea1b2a2 100644 --- a/Jobs/ZUGFeRD/XRechnungViewDocument.vb +++ b/Jobs/ZUGFeRD/XRechnungViewDocument.vb @@ -17,7 +17,7 @@ Public Class XRechnungViewDocument Private fontResName As String Private fontResNameBold As String Private fontResNameItalic As String - Private MyGDPicturePDF As GdPicturePDF + Public Sub New(LogConfig As LogConfig, MSSQL As MSSQLServer, GDPictureLicenseKey As String) _logConfig = LogConfig @@ -31,6 +31,8 @@ Public Class XRechnungViewDocument _logger.Debug("Create_PDFfromXML() Start") Try + Dim LicenseManager = New LicenseManager() + LicenseManager.RegisterKEY(_gdpictureLicenseKey) Dim oXRechnungFile = pXmlFile.FullName Dim oNewFileinfo As FileInfo Dim oXmlFilePath = pXmlFile.FullName @@ -45,13 +47,21 @@ Public Class XRechnungViewDocument File.Delete(oTempFilePath) End If - _logger.Debug("Vor MOVE... oxmlFilePath: [{0}] / oTempFilePath: [{1}]", oXmlFilePath, oTempFilePath) - File.Move(oXmlFilePath, oTempFilePath) + + pXmlFile = New FileInfo(oTempFilePath) 'oViewRecieptFilename = oViewRecieptFilename.Replace(".xml", ".pdf") oViewRecieptFilename = Regex.Replace(oViewRecieptFilename, ".xml", ".pdf", RegexOptions.IgnoreCase) + Dim MyGDPicturePDF = New GdPicturePDF + + Dim oPDFStatus As GdPictureStatus = MyGDPicturePDF.NewPDF(PdfConformance.PDF_A_3a) + + If oPDFStatus <> GdPictureStatus.OK Then + _logger.Warn($"Error initializing PDF: {oPDFStatus}") + Return Nothing + End If Dim oOutputPath = Path.Combine(Path.GetDirectoryName(oXmlFilePath), oViewRecieptFilename) _logger.Debug("Create_PDFfromXML() Resulting PDF Filepath: [{0}]", oOutputPath) @@ -59,13 +69,13 @@ Public Class XRechnungViewDocument File.Delete(oOutputPath) End If - MyGDPicturePDF = New GdPicturePDF() - MyGDPicturePDF.NewPDF(PdfConformance.PDF_A_2a) - Dim oPDFStatus As GdPictureStatus = MyGDPicturePDF.NewPDF() - If oPDFStatus <> GdPictureStatus.OK Then - _logger.Warn($"Error initializing PDF: {oPDFStatus}") - Return Nothing - End If + + Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {Now.ToString}" + + + + MyGDPicturePDF.EnableCompression(True) + MyGDPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft) MyGDPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter) MyGDPicturePDF.SetLineWidth(1) @@ -77,9 +87,24 @@ Public Class XRechnungViewDocument 'Create a New page MyGDPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) ' Dim oCurrent As Integer = MyGDPicturePDF.GetCurrentPage() + 'Den HEader erzeugen + Dim yPosition As Integer = 15 + MyGDPicturePDF.SetTextSize(18) + MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt") + yPosition += 10 + MyGDPicturePDF.SetTextSize(10) + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1) + yPosition += 5 + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2) + yPosition += 5 + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1) + yPosition += 5 + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2) + 'Den Footer erzeugen + MyGDPicturePDF.DrawLine(10, 280, 200, 280) + + MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString) - Dim yPosition As Single = Create_PageHeader(False) - Create_PageFooter() Dim oArea As String = "" Dim oIsPosition As Boolean = False @@ -95,6 +120,7 @@ Public Class XRechnungViewDocument Dim oIndex As Integer = 0 Dim oYPlus As Integer = 0 Dim oCreateTextBox As Boolean = False + Dim oInvHasDiscount As Boolean = False For Each oRow As DataRow In pDTItemValues.Rows Dim Y_eq_lastrow As Boolean = CBool(oRow.Item("Y_eq_lastrow")) Dim oRowCaption As String = oRow.Item("Row_Caption") @@ -102,7 +128,9 @@ Public Class XRechnungViewDocument Dim oItemValue As String = oRow.Item("ITEM_VALUE") Dim oDisplay As Boolean = oRow.Item("Display") Dim oAreaSwitch As Boolean = False - + If oItemSPECNAME = "RECEIPT_ALLOWANCE_REASON" Then + Console.WriteLine("Uiuiu") + End If If oRow.Item("Area") = "INTERNAL" Then If oItemSPECNAME = "STATIC_Y_SWITCH" Then yPosition = oItemValue @@ -114,8 +142,23 @@ Public Class XRechnungViewDocument _logger.Warn($"Could not create a second page. The error was: {oPDFStatus}") Exit For Else - yPosition = Create_PageHeader(True) - Create_PageFooter() + 'Wieder einen Header und Footer erzeugen + yPosition = 15 + MyGDPicturePDF.SetTextSize(18) + MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt") + yPosition += 10 + MyGDPicturePDF.SetTextSize(10) + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1) + yPosition += 5 + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2) + yPosition += 5 + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1) + yPosition += 5 + MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2) + + MyGDPicturePDF.DrawLine(10, 280, 200, 280) + 'Footer erzeugen + MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString) End If 'oCurrent = MyGDPicturePDF.GetCurrentPage() End If @@ -144,7 +187,17 @@ Public Class XRechnungViewDocument oAREACaption = "Positionen / Positions:" oIsPosition = True ElseIf oArea = "ALLOWANCE" Then - oAREACaption = "Zu- oder Abschlag/Surcharge or Discount:" + If oItemSPECNAME = "RECEIPT_ALLOWANCE_CHARGE_INDICATOR" Then + If oItemValue = "False" Then + oAREACaption = "Rabatt/Discount:" + oInvHasDiscount = True + Else + oAREACaption = "Zuschlag/Surcharge:" + End If + Else + oAREACaption = "Zu- oder Abschlag/Surcharge or Discount:" + End If + oIsPosition = True ElseIf oArea = "AMOUNT" Then oAREACaption = "Beträge / Amounts:" oCreateTextBox = True @@ -173,15 +226,23 @@ Public Class XRechnungViewDocument ' gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line) yPosition += 5 ElseIf oArea = "POSITION" Then - 'Tabellendarstellung + MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#") MyGDPicturePDF.DrawText(fontResName, 19, yPosition, "Anz./am.") - MyGDPicturePDF.DrawText(fontResName, 35, yPosition, "Einh/unt") + MyGDPicturePDF.DrawText(fontResName, 35, yPosition, "Einh/Unit") MyGDPicturePDF.DrawText(fontResName, 50, yPosition, "Pos.Text") - MyGDPicturePDF.DrawText(fontResName, 164, yPosition, "Steuer/tax") - MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/sum") + MyGDPicturePDF.DrawText(fontResName, 163, yPosition, "Steuer/Tax") + MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/Sum") yPosition += 5 - 'Tabellendarstellung Ende + ElseIf oArea = "ALLOWANCE" Then + MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#") + ' MyGDPicturePDF.DrawText(fontResName, 20, yPosition, "Betrag/Amount") + MyGDPicturePDF.DrawText(fontResName, 20, yPosition, "Grund/Reason") + MyGDPicturePDF.DrawText(fontResName, 163, yPosition, "Steuer/Tax") + MyGDPicturePDF.DrawText(fontResName, 163, yPosition, "Steuer/Tax") + MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/Sum") + yPosition += 5 + oPosCount = 0 ElseIf oArea = "EXEMPTION" Then End If @@ -196,9 +257,9 @@ Public Class XRechnungViewDocument oIsPosition = True If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then oPosCount += 1 - 'oPosTerm = $"{oPosCount}. {oItemValue} * " - 'oItemValue = oPosTerm - 'Tabellendarstellung + + + oPosTerm = "" MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount) ' @@ -211,6 +272,18 @@ Public Class XRechnungViewDocument oDisplay = False ' yPosition -= 5 End If + ElseIf oArea = "ALLOWANCE" Then + oIsPosition = True + Dim validNames As String() = {"POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_RECEIPT_ALLOWANCE_CHARGE_INDICATOR"} + If validNames.Contains(oItemSPECNAME) Then + oPosCount += 1 + oPosTerm = "" + MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount) + ' + Dim oCurrTerm = FormatCurrency(oItemValue, oCurrencySymbol) + MyGDPicturePDF.DrawText(fontResName, 20, yPosition, oCurrTerm) + oDisplay = False + End If ElseIf oArea = "TAXPOS" Then oIsPosition = True If oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then @@ -226,29 +299,50 @@ Public Class XRechnungViewDocument 'INDIVIDUELLES VERHALTEN BEI Folge-ITEMS _logger.Debug($"FollowItem - Area: [{oArea}] - ItemSpecname: [{oItemSPECNAME}] - ItemValue: [{oItemValue}]") 'Dim otextBoxYPos As Integer - If oArea = "POSITION" Then - If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then + If oArea = "POSITION" Or oArea = "ALLOWANCE" Then + + If {"INVOICE_POSITION_AMOUNT", "POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT"}.Contains(oItemSPECNAME) Then oPosCount += 1 oYPlus = 0 - 'Tabellendarstellung + yPosition += 5 oPosTerm = "" MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount) - 'otextBoxYPos = yPosition - 3.5 - 'MyGDPicturePDF.DrawTextBox(fontResName, 10, otextBoxYPos, 16, YCoo_TextBoxPlus5(otextBoxYPos), - ' TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear, - ' oPosCount) - MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue) - 'Tabellendarstellung Ende + If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then + MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue) + ElseIf {"POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT"}.Contains(oItemSPECNAME) Then + Dim oTerm = FormatCurrency(oItemValue, oCurrencySymbol) + If oInvHasDiscount And oItemSPECNAME = "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT" And Not oTerm.StartsWith("-") Then + oTerm = "-" + oTerm + End If + MyGDPicturePDF.DrawText(fontResName, 181, yPosition, oTerm) + Else + Dim oYDyn As Integer = yPosition - 5 + Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue) + For Each olinepart As String In oPartsNL + Dim oParts As List(Of String) = StringFunctions.SplitText_Length(olinepart, 67) + ' Durchlaufen der einzelnen Teile in einer Schleife + For Each part As String In oParts + oYDyn += 5 + oYPlus += 5 + MyGDPicturePDF.DrawText(fontResName, 19, oYDyn, part) + Next + Next + End If + oDisplay = False ElseIf oItemSPECNAME = "INVOICE_POSITION_UNIT_TYPE" Then oYPlus = 0 Dim oUnit = Return_UnitType(oItemValue) MyGDPicturePDF.DrawText(fontResName, 35, yPosition, oUnit) oDisplay = False - ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE" Then + ElseIf {"POSITION_ALLOWANCE_REASON", "RECEIPT_ALLOWANCE_REASON", "INVOICE_POSITION_ARTICLE", "INVOICE_POSITION_ARTICLE_DESCRIPTION"}.Contains(oItemSPECNAME) Then 'Tabellendarstellung oYPlus = 0 + Dim oX = 50 + If oItemSPECNAME.Contains("ALLOWANCE") Then + oX = 20 + End If oPosDesc = "" oPosDesc = oItemValue Dim oYDyn As Integer = yPosition - 5 @@ -259,11 +353,11 @@ Public Class XRechnungViewDocument For Each part As String In oParts oYDyn += 5 oYPlus += 5 - MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part) + MyGDPicturePDF.DrawText(fontResName, oX, oYDyn, part) Next Next - 'Tabellendarstellung Ende - ' oPosTerm += $" {oItemValue}" + + oDisplay = False ElseIf oItemSPECNAME = "INVOICE_POSITION_NOTE" Then 'Tabellendarstellung @@ -300,29 +394,22 @@ Public Class XRechnungViewDocument MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part) Next Next - 'oPosTerm += $" {oItemValue}" oDisplay = False - ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TAX_RATE" Or oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then - 'Tabellendarstellung - MyGDPicturePDF.DrawText(fontResName, 164, yPosition, $"{oItemValue} %") - 'Tabellendarstellung ENDE - ' oPosTerm += $" - {oItemValue} %" + ElseIf {"INVOICE_TAXPOS_TAX_RATE", "INVOICE_TAXPOS_RATE", "POSITION_ALLOWANCE_CALCULATION_PERCENT", "RECEIPT_ALLOWANCE_CALCULATION_PERCENT", "RECEIPT_ALLOWANCE_VAT_RATE"}.Contains(oItemSPECNAME) Then + MyGDPicturePDF.DrawText(fontResName, 163, yPosition, $"{oItemValue} %") oDisplay = False - ElseIf oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" Then - 'Tabellendarstellung + ElseIf {"INVOICE_POSITION_TAX_AMOUNT"}.Contains(oItemSPECNAME) Then + Dim oYPos = yPosition - 3.5 Dim TAXTERM = FormatCurrency(oItemValue, oCurrencySymbol) MyGDPicturePDF.DrawTextBox(fontResName, 177, oYPos, 198, YCoo_TextBoxPlus5(oYPos), TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear, TAXTERM) - ' MyGDPicturePDF.DrawText(fontResName, 180, yPosition, $"{oItemValue} {oCurrencySymbol}") - - 'Tabellendarstellung Ende End If oItemValue = oPosTerm ElseIf oArea = "HEAD" Then - If oItemSPECNAME = "INVOICE_DATE" Or oItemSPECNAME = "INVOICE_SERVICE_DATE" Then + If {"INVOICE_DATE", "INVOICE_SERVICE_DATE"}.Contains(oItemSPECNAME) Then oItemValue = StringFunctions.DatetimeStringToGermanStringConverter(oItemValue, _logger) End If ElseIf oArea = "TAXPOS" Then @@ -348,14 +435,12 @@ Public Class XRechnungViewDocument End If If oArea = "AMOUNT" Or oArea = "ALLOWANCE" Then - Dim oCURRENCYFORMAT = {"INVOICE_TOTAL_TAX", "INVOICE_TOTAL_NET", "INVOICE_TOTAL_GROSS", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT", - "RECEIPT_ALLOWANCE_CALCULATION_PERCENT"} + Dim oCURRENCYFORMAT = {"INVOICE_TOTAL_TAX", "INVOICE_TOTAL_NET", "INVOICE_TOTAL_GROSS", "POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT", + "POSITION_ALLOWANCE_CALCULATION_PERCENT", "RECEIPT_ALLOWANCE_CALCULATION_PERCENT"} If oCURRENCYFORMAT.Contains(oItemSPECNAME) Then oItemValue = FormatCurrency(oItemValue, oCurrencySymbol) End If End If - - If oRowCaption <> String.Empty Then 'Zuerst die RowCaption MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oRowCaption) @@ -368,7 +453,6 @@ Public Class XRechnungViewDocument Else MyGDPicturePDF.DrawText(fontResName, 70, yPosition, oItemValue) End If - Else If Y_eq_lastrow = True Then MyGDPicturePDF.DrawText(fontResName, oRow.Item("xPosition"), yPosition, oItemValue) @@ -396,35 +480,41 @@ Public Class XRechnungViewDocument End If End If Else - 'Tabellendarstellung If oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" And oYPlus > 0 Then yPosition += oYPlus - 5 + ElseIf oItemSPECNAME = "RECEIPT_ALLOWANCE_CHARGE_INDICATOR" Then + yPosition -= 5 End If - 'Tabellendarstellung Ende End If oIndex += 1 Next + ' Dim oeinv_Format As PdfInvoiceDataFormat = PdfInvoiceDataFormat.ZUGFeRD_2_0 + Dim oAttString = "E-invoice XML attachment" + If File.Exists(oXmlFilePath) Then + MyGDPicturePDF.EmbedFile(oXmlFilePath, oAttString) + Else + _logger.Info("XML File is not existing and could not be embedded!") + Return Nothing + End If - Dim oeinv_Format As PdfInvoiceDataFormat = PdfInvoiceDataFormat.ZUGFeRD_2_0 - MyGDPicturePDF.EmbedFile(oTempFilePath, "Rechnungsdaten im ZUGFeRD-XML-Format") 'Finalize And save the PDF oPDFStatus = MyGDPicturePDF.SaveToFile(oOutputPath) If oPDFStatus = GdPictureStatus.OK Then _logger.Info("PDF VisualReceipt generated successfully!") + _logger.Debug("Vor MOVE... oxmlFilePath: [{0}] / oTempFilePath: [{1}]", oXmlFilePath, oTempFilePath) + File.Move(oXmlFilePath, oTempFilePath) Else _logger.Warn($"Error generating PDF VisualReceipt: {oPDFStatus}") End If - 'Release resources MyGDPicturePDF.CloseDocument() If oPDFStatus = GdPictureStatus.OK Then - File.Delete(oXRechnungFile) + ' File.Delete(oXRechnungFile) oNewFileinfo = New FileInfo(oOutputPath) - - _logger.Debug("Create_PDFfromXML() End successfully. File [{0}] written.", oNewFileinfo.FullName) + _logger.Info("Create_PDFfromXML() End successfully. File [{0}] written.", oNewFileinfo.FullName) Return oNewFileinfo Else - _logger.Debug("Create_PDFfromXML() Ends with nothing") + _logger.Warn("Create_PDFfromXML() Ends with nothing") Return Nothing End If @@ -434,7 +524,7 @@ Public Class XRechnungViewDocument End Try End Function Private Function FormatCurrency(ByVal pValue As String, pCurrencySymbol As String) As String - pValue = pValue.replace(".", ",") + pValue = pValue.Replace(".", ",") Dim oBetrag As Decimal = pValue Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE")) oFormatiert = $"{oFormatiert} {pCurrencySymbol}" @@ -463,28 +553,28 @@ Public Class XRechnungViewDocument Dim lines As List(Of String) = text.Split({vbCrLf, vbLf, vbCr}, StringSplitOptions.None).ToList() Return lines End Function - Public Function Create_PageHeader(pFollowPage As Boolean) As Integer - 'Draw content on the PDF - Dim yPosition As Integer = 15 - MyGDPicturePDF.SetTextSize(18) - MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt") - yPosition += 10 - MyGDPicturePDF.SetTextSize(10) - MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row1) - yPosition += 5 - MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_DE_Row2) - yPosition += 5 - MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row1) - yPosition += 5 - MyGDPicturePDF.DrawText(fontResNameItalic, 10, yPosition, XRechnungStrings.CommentSichtbeleg_EN_Row2) - Return yPosition - End Function - Public Sub Create_PageFooter() - MyGDPicturePDF.DrawLine(10, 280, 200, 280) - Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {Now.ToString}" - MyGDPicturePDF.DrawText(fontResName, 10, 285, oCreatedString) - End Sub + + + + + + + + + + + + + + + + + + + + + Private Function Return_InvType(pType As String) As String Dim oReturn As String = "Rechnung/invoice" diff --git a/Jobs/packages.config b/Jobs/packages.config index 985076f0..5ce66aaf 100644 --- a/Jobs/packages.config +++ b/Jobs/packages.config @@ -4,8 +4,8 @@ - - + + @@ -18,16 +18,14 @@ - - - + \ No newline at end of file