Currency Summary EUR

This commit is contained in:
Developer01 2025-12-03 14:29:18 +01:00
parent 4554c5841d
commit 65b73b45bf
5 changed files with 29 additions and 21 deletions

View File

@ -482,7 +482,7 @@ Public Class ClassControlCreator
Return control
End Function
Public Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean) As GridControl
Public Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean, pcurrencySymbol As String) As GridControl
Dim oGridControlCreator = New ControlCreator.GridControl(LogConfig, GridTables)
Dim oControl As GridControl = CreateBaseControl(New GridControl(), row, designMode)
Dim oControlId = DirectCast(oControl.Tag, ControlMetadata).Guid
@ -586,7 +586,7 @@ Public Class ClassControlCreator
End Try
End If
oGridControlCreator.ConfigureViewColumns(DT_MY_COLUMNS, oView, oControl)
oGridControlCreator.ConfigureViewColumns(DT_MY_COLUMNS, oView, oControl, pcurrencySymbol)
oGridControlCreator.ConfigureViewEvents(DT_MY_COLUMNS, oView, oControl, oControlId)
' 08.11.2021: Fix editor being empty on first open

View File

@ -144,8 +144,16 @@ Namespace ControlCreator
Return oEditor
End If
End Function
' Hilfsroutine: passt NUR das Summary-Item an (ohne FormatInfo)
Private Sub ApplyCurrencySummaryFormat(oCol As GridColumn, currencySymbol As String)
oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum
' Variante A: Standard-Währungsformat aus aktueller Kultur
' oCol.SummaryItem.DisplayFormat = "SUM: {0:C2}"
Public Sub ConfigureViewColumns(pColumnTable As DataTable, pGridView As GridView, pGrid As DevExpress.XtraGrid.GridControl)
' Variante B: Kulturunabhängig, Symbol explizit anhängen
oCol.SummaryItem.DisplayFormat = $"SUM: {{0:N2}} {currencySymbol}"
End Sub
Public Sub ConfigureViewColumns(pColumnTable As DataTable, pGridView As GridView, pGrid As DevExpress.XtraGrid.GridControl, pcurrencySymbol As String)
Dim oShouldDisplayFooter As Boolean = False
@ -192,8 +200,7 @@ Namespace ControlCreator
oShouldDisplayFooter = True
Case Constants.AGGREGATE_TOTAL_CURRENCY
oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum
oCol.SummaryItem.DisplayFormat = "SUM: {0:C2}"
ApplyCurrencySummaryFormat(oCol, pcurrencySymbol)
oShouldDisplayFooter = True
Case Constants.AGGREGATE_TOTAL_AVG

View File

@ -295,7 +295,7 @@ Public Class frmFormDesigner
Dim oDTColumnsPerDevExGrid As DataTable = DatabaseFallback.GetDatatableECM(oSQL) ', "FDesignLaodControls")
Dim table = ControlCreator.CreateExistingGridControl(row, oDTColumnsPerDevExGrid, True)
Dim table = ControlCreator.CreateExistingGridControl(row, oDTColumnsPerDevExGrid, True, "EUR")
AddHandler table.MouseClick, AddressOf gridControl_MouseClick
' AddHandler table.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick

View File

@ -355,7 +355,7 @@ Public Class frmMassValidator
LOGGER.Debug("Versuch Tabelle zu laden")
Dim oDTMyColumns As DataTable = DatabaseFallback.GetDatatableECM($"SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = {oControlRow.Item("GUID")} ORDER BY SEQUENCE") ', "MV_LoadControls1")
oControl = ControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False)
oControl = ControlCreator.CreateExistingGridControl(oControlRow, oDTMyColumns, False, CURRENT_DOC_CURRENCY)
End Select
If oControl IsNot Nothing AndAlso TypeOf oControl IsNot Label Then

View File

@ -75,6 +75,7 @@ Public Class frmValidator
Private CountAction As Int16 = 0
Public Shared Property WMDocPathWindows As String
Private Property DocPathWindows As String
Private Property DocCurrency As String = "EUR"
'Anzahl der Validierungsdokumente
Private Property Amount_Docs2Validate As Integer
Private Property first_control As Control
@ -1137,7 +1138,7 @@ Public Class frmValidator
Continue For
End If
Dim oGrid = ControlCreator.CreateExistingGridControl(oControlRow, oFilteredDatatable, False)
Dim oGrid = ControlCreator.CreateExistingGridControl(oControlRow, oFilteredDatatable, False, DocCurrency)
oMyControl = oGrid
'AddHandler oGrid.Views(0).c AddressOf GridView_CustomColumnDisplayText
@ -2795,24 +2796,24 @@ Public Class frmValidator
End If
If Not IsNothing(oCurrency) Then
Dim oValueType = oCurrency.GetType.ToString
If IsDBNull(oCurrency) Then
oCurrency = "EUR"
DocCurrency = oCurrency
Dim oValueType = DocCurrency.GetType.ToString
If IsDBNull(DocCurrency) Then
DocCurrency = "EUR"
Else
Try
oCurrency = oCurrency.ToString
DocCurrency = DocCurrency.ToString
Catch ex As Exception
MyValidationLogger.Warn($"Unexpected error in Converting oCurreny to string: " & ex.Message)
oCurrency = "EUR"
DocCurrency = "EUR"
End Try
End If
If oCurrency <> String.Empty Then
If oCurrency.ToString.Length <> 3 Then
MyValidationLogger.Info("oCurrency-Length = 3 - Setting to EUR")
oCurrency = "EUR"
If DocCurrency <> String.Empty Then
If DocCurrency.ToString.Length <> 3 Then
MyValidationLogger.Info("DocCurrency-Length = 3 - Setting to EUR")
DocCurrency = "EUR"
End If
MyValidationLogger.Debug($"oCurrency = {oCurrency}")
MyValidationLogger.Debug($"DocCurrency = {DocCurrency}")
For Each oControl As Control In PanelValidatorControl.Controls
Try
Dim oMeta = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata)
@ -2824,7 +2825,7 @@ Public Class frmValidator
DT_COLUMNS_GRID.Select(oExpression, "SEQUENCE").CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
Dim oCultureInfo As CultureInfo = New CultureInfo("de-DE")
oCultureInfo.NumberFormat.CurrencySymbol = oCurrency
oCultureInfo.NumberFormat.CurrencySymbol = DocCurrency
Dim riTextEdit As RepositoryItemTextEdit = New RepositoryItemTextEdit()
riTextEdit.MaskSettings.Configure(Of MaskSettings.Numeric)(Sub(settings)
settings.MaskExpression = "c"
@ -2858,7 +2859,7 @@ Public Class frmValidator
End Try
Next
Else
MyValidationLogger.Warn($"oCurrency is String.empty! ")
MyValidationLogger.Warn($"DocCurrency is String.empty! ")
End If
Else
MyValidationLogger.Warn($"oCurrency is Nothing - Check PROFIL_CURRENCY_ATTRIBUTE! ")