Update GDPIcture
This commit is contained in:
@@ -8,6 +8,8 @@ Imports GdPicture14
|
||||
Imports System.Drawing
|
||||
Imports System.Linq
|
||||
Imports System.Text.RegularExpressions
|
||||
'11.11.2025
|
||||
|
||||
Public Class XRechnungViewDocument
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
@@ -74,8 +76,6 @@ Public Class XRechnungViewDocument
|
||||
|
||||
|
||||
|
||||
MyGDPicturePDF.EnableCompression(True)
|
||||
|
||||
MyGDPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
|
||||
MyGDPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
|
||||
MyGDPicturePDF.SetLineWidth(1)
|
||||
@@ -121,6 +121,7 @@ Public Class XRechnungViewDocument
|
||||
Dim oYPlus As Integer = 0
|
||||
Dim oCreateTextBox As Boolean = False
|
||||
Dim oInvHasDiscount As Boolean = False
|
||||
Dim oYDyn As Integer = 0
|
||||
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")
|
||||
@@ -226,14 +227,12 @@ Public Class XRechnungViewDocument
|
||||
' gdpicturePDF.DrawText(fontResName, 10, yPosition, XRechnungStrings.Seperator_Line)
|
||||
yPosition += 5
|
||||
ElseIf oArea = "POSITION" Then
|
||||
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#")
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, "Anz./am.")
|
||||
MyGDPicturePDF.DrawText(fontResName, 35, yPosition, "Einh/Unit")
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, yPosition, "Pos.Text")
|
||||
MyGDPicturePDF.DrawText(fontResName, 163, yPosition, "Steuer/Tax")
|
||||
MyGDPicturePDF.DrawText(fontResName, 181, yPosition, "Betrag/Sum")
|
||||
yPosition += 5
|
||||
ElseIf oArea = "ALLOWANCE" Then
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, "Pos#")
|
||||
' MyGDPicturePDF.DrawText(fontResName, 20, yPosition, "Betrag/Amount")
|
||||
@@ -257,9 +256,8 @@ Public Class XRechnungViewDocument
|
||||
oIsPosition = True
|
||||
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
||||
oPosCount += 1
|
||||
|
||||
|
||||
|
||||
oYDyn = 0
|
||||
yPosition += 5
|
||||
oPosTerm = ""
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
|
||||
'
|
||||
@@ -304,7 +302,7 @@ Public Class XRechnungViewDocument
|
||||
If {"INVOICE_POSITION_AMOUNT", "POSITION_ALLOWANCE_ACTUAL_AMOUNT", "RECEIPT_ALLOWANCE_ACTUAL_AMOUNT"}.Contains(oItemSPECNAME) Then
|
||||
oPosCount += 1
|
||||
oYPlus = 0
|
||||
|
||||
oYDyn = 0
|
||||
yPosition += 5
|
||||
oPosTerm = ""
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
|
||||
@@ -317,15 +315,17 @@ Public Class XRechnungViewDocument
|
||||
End If
|
||||
MyGDPicturePDF.DrawText(fontResName, 181, yPosition, oTerm)
|
||||
Else
|
||||
Dim oYDyn As Integer = yPosition - 5
|
||||
If oYDyn = 0 Then
|
||||
oYDyn = yPosition
|
||||
End If
|
||||
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
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, oYDyn, part)
|
||||
oYDyn += 5
|
||||
oYPlus += 5
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
@@ -345,15 +345,19 @@ Public Class XRechnungViewDocument
|
||||
End If
|
||||
oPosDesc = ""
|
||||
oPosDesc = oItemValue
|
||||
Dim oYDyn As Integer = yPosition - 5
|
||||
If oYDyn = 0 Then
|
||||
oYDyn = yPosition
|
||||
End If
|
||||
|
||||
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
|
||||
MyGDPicturePDF.DrawText(fontResName, oX, oYDyn, part)
|
||||
oYDyn += 5
|
||||
oYPlus += 5
|
||||
MyGDPicturePDF.DrawText(fontResName, oX, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
|
||||
@@ -364,15 +368,17 @@ Public Class XRechnungViewDocument
|
||||
Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue)
|
||||
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
Dim oYDyn As Integer = yPosition
|
||||
If oYDyn = 0 Then
|
||||
oYDyn = yPosition
|
||||
End If
|
||||
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
|
||||
For Each olinepart As String In oPartsNL
|
||||
Dim oPartsPN As List(Of String) = StringFunctions.SplitText_Length(olinepart, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
For Each part As String In oPartsPN
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
oYDyn += 5
|
||||
oYPlus += 5
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
|
||||
@@ -383,15 +389,17 @@ Public Class XRechnungViewDocument
|
||||
Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue)
|
||||
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
Dim oYDyn As Integer = yPosition
|
||||
If oYDyn = 0 Then
|
||||
oYDyn = yPosition
|
||||
End If
|
||||
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
|
||||
For Each olinepart As String In oPartsNL
|
||||
Dim oPartsPN As List(Of String) = StringFunctions.SplitText_Length(olinepart, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
For Each part As String In oPartsPN
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
oYDyn += 5
|
||||
oYPlus += 5
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
'oPosTerm += $" {oItemValue}"
|
||||
@@ -481,9 +489,12 @@ Public Class XRechnungViewDocument
|
||||
End If
|
||||
Else
|
||||
If oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" And oYPlus > 0 Then
|
||||
yPosition += oYPlus - 5
|
||||
yPosition += oYPlus
|
||||
ElseIf oItemSPECNAME = "RECEIPT_ALLOWANCE_CHARGE_INDICATOR" Then
|
||||
yPosition -= 5
|
||||
Else
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
oIndex += 1
|
||||
@@ -497,6 +508,8 @@ Public Class XRechnungViewDocument
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
MyGDPicturePDF.EnableCompression(True)
|
||||
|
||||
'Finalize And save the PDF
|
||||
oPDFStatus = MyGDPicturePDF.SaveToFile(oOutputPath)
|
||||
If oPDFStatus = GdPictureStatus.OK Then
|
||||
@@ -523,13 +536,40 @@ Public Class XRechnungViewDocument
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
'Private Function FormatCurrency(ByVal pValue As String, pCurrencySymbol As String) As String
|
||||
' pValue = pValue.Replace(".", ",")
|
||||
' Dim oBetrag As Decimal = pValue
|
||||
' Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
|
||||
' oFormatiert = $"{oFormatiert} {pCurrencySymbol}"
|
||||
' Return oFormatiert
|
||||
'End Function
|
||||
Private Function FormatCurrency(ByVal pValue As String, pCurrencySymbol As String) As String
|
||||
pValue = pValue.Replace(".", ",")
|
||||
Dim oBetrag As Decimal = pValue
|
||||
pValue = pValue.Trim()
|
||||
|
||||
Dim oBetrag As Decimal
|
||||
Dim culture As Globalization.CultureInfo
|
||||
|
||||
' Erkennung des Dezimaltrennzeichens
|
||||
If pValue.Contains(",") AndAlso Not pValue.Contains(".") Then
|
||||
culture = New Globalization.CultureInfo("de-DE") ' Komma → deutsches Format
|
||||
ElseIf pValue.Contains(".") AndAlso Not pValue.Contains(",") Then
|
||||
culture = New Globalization.CultureInfo("en-US") ' Punkt → englisches Format
|
||||
Else
|
||||
' Mischformat oder Tausendertrennzeichen → Fallback auf aktuelle Culture
|
||||
culture = Globalization.CultureInfo.CurrentCulture
|
||||
End If
|
||||
|
||||
' Parsen mit gewählter Culture
|
||||
If Not Decimal.TryParse(pValue, Globalization.NumberStyles.Any, culture, oBetrag) Then
|
||||
Throw New FormatException($"Ungültiger Zahlenwert: {pValue}")
|
||||
End If
|
||||
|
||||
' Formatieren mit deutscher Culture
|
||||
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
|
||||
oFormatiert = $"{oFormatiert} {pCurrencySymbol}"
|
||||
Return oFormatiert
|
||||
Return $"{oFormatiert} {pCurrencySymbol}"
|
||||
End Function
|
||||
|
||||
|
||||
Private Function FormatStringT(ByVal text As String) As String
|
||||
Return text.Replace(vbCr, " - ").Replace(vbLf, "").Replace(vbTab, " ")
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user