MS Jobs 2.7.0 xRechnung Sichtbeleg
This commit is contained in:
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("2.6.4.0")>
|
<Assembly: AssemblyVersion("2.7.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("2.6.4.0")>
|
<Assembly: AssemblyFileVersion("2.7.0.0")>
|
||||||
|
|||||||
@@ -139,15 +139,6 @@ Public Class ImportZUGFeRDFiles
|
|||||||
' This way we can rollback database changes for the whole filegroup in case something goes wrong.
|
' This way we can rollback database changes for the whole filegroup in case something goes wrong.
|
||||||
Dim oSQLConnection As SqlConnection = _mssql.GetConnection()
|
Dim oSQLConnection As SqlConnection = _mssql.GetConnection()
|
||||||
|
|
||||||
If oArgs.AllowXRechnung Then
|
|
||||||
'but before we need to get all Data we need
|
|
||||||
MyTemplateValues_xInvDT = Nothing
|
|
||||||
Dim oSQL_MsgIDReplacec = SQL_xRechnung_ItemTemplate
|
|
||||||
oSQL_MsgIDReplacec = oSQL_MsgIDReplacec.Replace("@MSG_ID", oFileGroup.Key)
|
|
||||||
MyTemplateValues_xInvDT = _mssql.GetDatatable(oSQL_MsgIDReplacec)
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim oSQLTransaction As SqlTransaction = oSQLConnection?.BeginTransaction()
|
Dim oSQLTransaction As SqlTransaction = oSQLConnection?.BeginTransaction()
|
||||||
|
|
||||||
@@ -424,12 +415,25 @@ Public Class ImportZUGFeRDFiles
|
|||||||
ElseIf oArgs.AllowXRechnung And oIsSuccess And oEInvoiceFileGroup.Item(0).Extension = ".xml" Then
|
ElseIf oArgs.AllowXRechnung And oIsSuccess And oEInvoiceFileGroup.Item(0).Extension = ".xml" Then
|
||||||
oxRechnungHandle = True
|
oxRechnungHandle = True
|
||||||
' Hier das neue PDF erzeugen
|
' Hier das neue PDF erzeugen
|
||||||
|
'but before we need to get all Data we need
|
||||||
|
MyTemplateValues_xInvDT = Nothing
|
||||||
|
Dim oSQL_MsgIDReplace = SQL_xRechnung_ItemTemplate
|
||||||
|
oSQL_MsgIDReplace = oSQL_MsgIDReplace.Replace("@MSG_ID", oFileGroup.Key)
|
||||||
|
If oSQLTransaction IsNot Nothing Then
|
||||||
|
' Commit Transaction
|
||||||
|
oSQLTransaction.Commit()
|
||||||
|
End If
|
||||||
|
MyTemplateValues_xInvDT = _mssql.GetDatatable(oSQL_MsgIDReplace)
|
||||||
|
|
||||||
If Not IsNothing(MyTemplateValues_xInvDT) Then
|
If Not IsNothing(MyTemplateValues_xInvDT) Then
|
||||||
Dim oViewReceiptFileInfo As FileInfo = _xRechnungCreator.Create_PDFfromXML(oEInvoiceFileGroup.Item(0), MyTemplateValues_xInvDT)
|
If MyTemplateValues_xInvDT.rows.count > 0 Then
|
||||||
If Not IsNothing(oViewReceiptFileInfo) Then
|
Dim oViewReceiptFileInfo As FileInfo = _xRechnungCreator.Create_PDFfromXML(oEInvoiceFileGroup.Item(0), MyTemplateValues_xInvDT)
|
||||||
oEInvoiceFileGroup.Item(0) = oViewReceiptFileInfo
|
If Not IsNothing(oViewReceiptFileInfo) Then
|
||||||
oRegularMove = True
|
oEInvoiceFileGroup.Item(0) = oViewReceiptFileInfo
|
||||||
|
oRegularMove = True
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|||||||
@@ -3,5 +3,4 @@
|
|||||||
Public Const CommentSichtbeleg_DE_Row2 = "Die Darstellung basiert auf den Inhalten der xml-Datei, welche als Anhang in diese PDF integriert wurde!"
|
Public Const CommentSichtbeleg_DE_Row2 = "Die Darstellung basiert auf den Inhalten der xml-Datei, welche als Anhang in diese PDF integriert wurde!"
|
||||||
Public Const CommentSichtbeleg_EN_Row1 = "Please note: this is a technically created image of a digital invoice."
|
Public Const CommentSichtbeleg_EN_Row1 = "Please note: this is a technically created image of a digital invoice."
|
||||||
Public Const CommentSichtbeleg_EN_Row2 = "The representation is based on the contents of the xml file, which has been integrated into this PDF as an attachment!"
|
Public Const CommentSichtbeleg_EN_Row2 = "The representation is based on the contents of the xml file, which has been integrated into this PDF as an attachment!"
|
||||||
Public Const Seperator_Line = "-------------------------------------------------------------------------"
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
Imports System.Data
|
Imports System.Collections.Generic
|
||||||
|
Imports System.Data
|
||||||
Imports System.Data.SqlClient
|
Imports System.Data.SqlClient
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports DigitalData.Modules.Base
|
Imports DigitalData.Modules.Base
|
||||||
@@ -11,7 +12,6 @@ Public Class XRechnungViewDocument
|
|||||||
Private ReadOnly _logger As Logger
|
Private ReadOnly _logger As Logger
|
||||||
Private ReadOnly _logConfig As LogConfig
|
Private ReadOnly _logConfig As LogConfig
|
||||||
Private ReadOnly _filesystem As FilesystemEx
|
Private ReadOnly _filesystem As FilesystemEx
|
||||||
'Private ReadOnly _mssql As MSSQLServer
|
|
||||||
Private ReadOnly _file As ZUGFeRD.FileFunctions
|
Private ReadOnly _file As ZUGFeRD.FileFunctions
|
||||||
Private ReadOnly _gdpictureLicenseKey As String
|
Private ReadOnly _gdpictureLicenseKey As String
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ Public Class XRechnungViewDocument
|
|||||||
'Create a New page
|
'Create a New page
|
||||||
gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
|
gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4)
|
||||||
'Draw content on the PDF
|
'Draw content on the PDF
|
||||||
Dim yPosition As Integer = 20
|
Dim yPosition As Integer = 15
|
||||||
gdpicturePDF.SetTextSize(18)
|
gdpicturePDF.SetTextSize(18)
|
||||||
gdpicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
|
gdpicturePDF.DrawText(fontResName, 10, yPosition, "xRechnung Sichtbeleg - xInvoice Visual Receipt")
|
||||||
yPosition += 10
|
yPosition += 10
|
||||||
@@ -88,7 +88,6 @@ Public Class XRechnungViewDocument
|
|||||||
Dim oItemSPECNAME As String = oRow.Item("SPEC_NAME")
|
Dim oItemSPECNAME As String = oRow.Item("SPEC_NAME")
|
||||||
Dim oItemValue As String = oRow.Item("ITEM_VALUE")
|
Dim oItemValue As String = oRow.Item("ITEM_VALUE")
|
||||||
Dim oDisplay As Boolean = oRow.Item("Display")
|
Dim oDisplay As Boolean = oRow.Item("Display")
|
||||||
Dim oRowGUID As String = oRow.Item("GUID")
|
|
||||||
Dim oAreaSwitch As Boolean = False
|
Dim oAreaSwitch As Boolean = False
|
||||||
_logger.Debug($"Working on SPEC_NAME: {oItemSPECNAME}")
|
_logger.Debug($"Working on SPEC_NAME: {oItemSPECNAME}")
|
||||||
|
|
||||||
@@ -107,7 +106,10 @@ Public Class XRechnungViewDocument
|
|||||||
oAREACaption = "Positionen / Positions:"
|
oAREACaption = "Positionen / Positions:"
|
||||||
oIsPosition = True
|
oIsPosition = True
|
||||||
ElseIf oArea = "AMOUNT" Then
|
ElseIf oArea = "AMOUNT" Then
|
||||||
oAREACaption = "Steuern / Taxes:"
|
oAREACaption = "Beträge / Amounts:"
|
||||||
|
ElseIf oArea = "TAXPOS" Then
|
||||||
|
oAREACaption = "Steuerbeträge / Tax amounts:"
|
||||||
|
oIsPosition = True
|
||||||
ElseIf oArea = "PAYMENT" Then
|
ElseIf oArea = "PAYMENT" Then
|
||||||
oAREACaption = "Zahlungsinformationen / Payment details:"
|
oAREACaption = "Zahlungsinformationen / Payment details:"
|
||||||
Else
|
Else
|
||||||
@@ -116,12 +118,13 @@ Public Class XRechnungViewDocument
|
|||||||
|
|
||||||
If Not oAREACaption = String.Empty Then
|
If Not oAREACaption = String.Empty Then
|
||||||
'erste Area-Linie
|
'erste Area-Linie
|
||||||
yPosition += 8
|
yPosition += 5
|
||||||
gdpicturePDF.DrawLine(10, yPosition, 125, yPosition)
|
gdpicturePDF.DrawLine(10, yPosition, 125, yPosition)
|
||||||
'gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line)
|
'gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line)
|
||||||
yPosition += 5
|
yPosition += 5
|
||||||
'Area caption
|
'Area caption
|
||||||
gdpicturePDF.DrawText(fontResNameBold, 10, yPosition, oAREACaption)
|
gdpicturePDF.DrawText(fontResNameBold, 10, yPosition, oAREACaption)
|
||||||
|
|
||||||
yPosition += 5
|
yPosition += 5
|
||||||
If oArea = "TYPE" Then
|
If oArea = "TYPE" Then
|
||||||
gdpicturePDF.DrawLine(10, yPosition, 125, yPosition)
|
gdpicturePDF.DrawLine(10, yPosition, 125, yPosition)
|
||||||
@@ -130,28 +133,40 @@ Public Class XRechnungViewDocument
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If oArea = "TYPE" Then
|
If oArea = "TYPE" Then
|
||||||
If oItemSPECNAME = "INVOICE_CURRENCY" Then
|
If oItemSPECNAME = "INVOICE_CURRENCY" Then
|
||||||
If oItemValue <> "EUR" Then
|
If oItemValue <> "EUR" Then
|
||||||
oCurrencySymbol = oItemValue
|
oCurrencySymbol = oItemValue
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If oArea = "POSITION" Then
|
ElseIf oArea = "POSITION" Then
|
||||||
oIsPosition = True
|
oIsPosition = True
|
||||||
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
||||||
oPosCount += 1
|
oPosCount += 1
|
||||||
oPosTerm = $"{oPosCount}. {oItemValue} * "
|
oPosTerm = $"{oPosCount}. {oItemValue} * "
|
||||||
|
oItemValue = oPosTerm
|
||||||
|
oDisplay = False
|
||||||
|
yPosition -= 5
|
||||||
|
End If
|
||||||
|
ElseIf oArea = "TAXPOS" Then
|
||||||
|
oIsPosition = True
|
||||||
|
If oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
||||||
|
oPosCount = 1
|
||||||
|
oPosTerm = $"{oItemValue} %:"
|
||||||
|
oItemValue = oPosTerm
|
||||||
|
oDisplay = False
|
||||||
|
yPosition -= 5
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
'INDIVIDUELLES VERHALTEN BEI Folge-ITEMS
|
'INDIVIDUELLES VERHALTEN BEI Folge-ITEMS
|
||||||
If oArea = "POSITION" Then
|
If oArea = "POSITION" Then
|
||||||
oIsPosition = True
|
|
||||||
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
||||||
oPosCount += 1
|
oPosCount += 1
|
||||||
oPosTerm = $"{oPosCount}. {oItemValue} * "
|
oPosTerm = $"{oPosCount}. {oItemValue} * "
|
||||||
|
oDisplay = False
|
||||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE" Then
|
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE" Then
|
||||||
oPosTerm += $" {oItemValue}"
|
oPosTerm += $" {oItemValue}"
|
||||||
|
oDisplay = False
|
||||||
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TAX_RATE" Or oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TAX_RATE" Or oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
||||||
oPosTerm += $" - ({oItemValue} %)"
|
oPosTerm += $" - ({oItemValue} %)"
|
||||||
End If
|
End If
|
||||||
@@ -159,23 +174,37 @@ Public Class XRechnungViewDocument
|
|||||||
If oPosCount >= 9 Then
|
If oPosCount >= 9 Then
|
||||||
oDisplay = False
|
oDisplay = False
|
||||||
End If
|
End If
|
||||||
ElseIf oArea = "AMOUNT" Then
|
|
||||||
If oItemSPECNAME = "INVOICE_TOTAL_NET" Or oItemSPECNAME = "INVOICE_TOTAL_TAX" Then
|
|
||||||
oItemValue += $" {oCurrencySymbol}"
|
|
||||||
End If
|
|
||||||
ElseIf oArea = "HEAD" Then
|
ElseIf oArea = "HEAD" Then
|
||||||
If oItemSPECNAME = "INVOICE_DATE" Or oItemSPECNAME = "INVOICE_SERVICE_DATE" Then
|
If oItemSPECNAME = "INVOICE_DATE" Or oItemSPECNAME = "INVOICE_SERVICE_DATE" Then
|
||||||
Dim oDateString As String = oItemValue
|
Dim oDateString As String = oItemValue
|
||||||
Dim oParsedDate As DateTime = DateTime.ParseExact(oDateString, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
|
Dim oParsedDate As DateTime = DateTime.ParseExact(oDateString, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
|
||||||
oItemValue = oParsedDate.ToString("dd.MM.yyyy")
|
oItemValue = oParsedDate.ToString("dd.MM.yyyy")
|
||||||
End If
|
End If
|
||||||
|
ElseIf oArea = "TAXPOS" Then
|
||||||
|
If oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
||||||
|
oPosCount += 1
|
||||||
|
oPosTerm = $"{oItemValue} %:"
|
||||||
|
oDisplay = False
|
||||||
|
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_AMOUNT" Then
|
||||||
|
oPosTerm += $" {oItemValue} {oCurrencySymbol}"
|
||||||
|
oDisplay = False
|
||||||
|
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TYPE" Then
|
||||||
|
oPosTerm += $" - {oItemValue}"
|
||||||
|
End If
|
||||||
|
oItemValue = oPosTerm
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If oDisplay = True Then
|
If oDisplay = True Then
|
||||||
If Y_eq_lastrow = False And oAreaSwitch = False Then
|
If Y_eq_lastrow = False And oAreaSwitch = False Then
|
||||||
yPosition += 5
|
yPosition += 5
|
||||||
End If
|
End If
|
||||||
|
If oArea = "AMOUNT" Then
|
||||||
|
If oItemSPECNAME = "INVOICE_TOTAL_NET" Or oItemSPECNAME = "INVOICE_TOTAL_GROSS" Then
|
||||||
|
oItemValue += $" {oCurrencySymbol}"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
If oRowCaption <> String.Empty Then
|
If oRowCaption <> String.Empty Then
|
||||||
gdpicturePDF.DrawText(fontResName, 10, yPosition, oRowCaption)
|
gdpicturePDF.DrawText(fontResName, 10, yPosition, oRowCaption)
|
||||||
gdpicturePDF.DrawText(fontResName, 70, yPosition, oItemValue)
|
gdpicturePDF.DrawText(fontResName, 70, yPosition, oItemValue)
|
||||||
@@ -188,7 +217,26 @@ Public Class XRechnungViewDocument
|
|||||||
gdpicturePDF.DrawText(fontResName, oRow.Item("xPosition"), yPosition, oItemValue)
|
gdpicturePDF.DrawText(fontResName, oRow.Item("xPosition"), yPosition, oItemValue)
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
gdpicturePDF.DrawText(fontResName, 10, yPosition, oItemValue)
|
If oItemValue.Length > 112 Then
|
||||||
|
' Liste zur Speicherung der Teilstrings
|
||||||
|
Dim teilStrings As New List(Of String)
|
||||||
|
' Schleife, um den String in Teilstrings zu zerlegen
|
||||||
|
For i As Integer = 0 To oItemValue.Length - 1 Step 112
|
||||||
|
' Sicherstellen, dass wir nicht über die Länge des Strings hinausgehen
|
||||||
|
Dim laenge As Integer = Math.Min(112, oItemValue.Length - i)
|
||||||
|
Dim teilString As String = oItemValue.Substring(i, laenge)
|
||||||
|
teilStrings.Add(teilString)
|
||||||
|
Next
|
||||||
|
|
||||||
|
' Ausgabe der Teilstrings
|
||||||
|
For Each teilString As String In teilStrings
|
||||||
|
gdpicturePDF.DrawText(fontResName, 10, yPosition, teilString)
|
||||||
|
yPosition += 5
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
gdpicturePDF.DrawText(fontResName, 10, yPosition, oItemValue)
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -197,8 +245,7 @@ Public Class XRechnungViewDocument
|
|||||||
Dim oCreated = Now.ToString
|
Dim oCreated = Now.ToString
|
||||||
|
|
||||||
gdpicturePDF.DrawLine(10, 280, 200, 280)
|
gdpicturePDF.DrawLine(10, 280, 200, 280)
|
||||||
'gdpicturePDF.DrawText(fontResName, 10, 285, XRechnungStrings.Seperator_Line)
|
Dim oCreatedString = $"Maschinell erstellt durch / Automatically created by Digital Data E-Rechnung Parser: {oCreated}"
|
||||||
Dim oCreatedString = $"Maschinell erstellt durch/Automatically created by Digital Data E-Rechnung Parser: {oCreated}"
|
|
||||||
gdpicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
|
gdpicturePDF.DrawText(fontResName, 10, 285, oCreatedString)
|
||||||
Dim oeinv_Format As PdfInvoiceDataFormat = PdfInvoiceDataFormat.ZUGFeRD_2_0
|
Dim oeinv_Format As PdfInvoiceDataFormat = PdfInvoiceDataFormat.ZUGFeRD_2_0
|
||||||
gdpicturePDF.EmbedFile(oTempFilePath, "Rechnungsdaten im ZUGFeRD-XML-Format")
|
gdpicturePDF.EmbedFile(oTempFilePath, "Rechnungsdaten im ZUGFeRD-XML-Format")
|
||||||
|
|||||||
Reference in New Issue
Block a user