From 65b73b45bf85bbe742996a193f584763072f7a6e Mon Sep 17 00:00:00 2001 From: Developer01 Date: Wed, 3 Dec 2025 14:29:18 +0100 Subject: [PATCH] Currency Summary EUR --- app/TaskFlow/ClassControlCreator.vb | 4 +-- app/TaskFlow/ControlCreator/GridControl.vb | 15 ++++++++--- app/TaskFlow/frmFormDesigner.vb | 2 +- app/TaskFlow/frmMassValidator.vb | 2 +- app/TaskFlow/frmValidator.vb | 29 +++++++++++----------- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/app/TaskFlow/ClassControlCreator.vb b/app/TaskFlow/ClassControlCreator.vb index 6052688..95fb9e9 100644 --- a/app/TaskFlow/ClassControlCreator.vb +++ b/app/TaskFlow/ClassControlCreator.vb @@ -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 diff --git a/app/TaskFlow/ControlCreator/GridControl.vb b/app/TaskFlow/ControlCreator/GridControl.vb index e87a889..63935e9 100644 --- a/app/TaskFlow/ControlCreator/GridControl.vb +++ b/app/TaskFlow/ControlCreator/GridControl.vb @@ -144,8 +144,16 @@ Namespace ControlCreator Return oEditor End If End Function - - Public Sub ConfigureViewColumns(pColumnTable As DataTable, pGridView As GridView, pGrid As DevExpress.XtraGrid.GridControl) + ' 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}" + + ' 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 diff --git a/app/TaskFlow/frmFormDesigner.vb b/app/TaskFlow/frmFormDesigner.vb index 77e743e..84d0bef 100644 --- a/app/TaskFlow/frmFormDesigner.vb +++ b/app/TaskFlow/frmFormDesigner.vb @@ -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 diff --git a/app/TaskFlow/frmMassValidator.vb b/app/TaskFlow/frmMassValidator.vb index 332faec..fa5f710 100644 --- a/app/TaskFlow/frmMassValidator.vb +++ b/app/TaskFlow/frmMassValidator.vb @@ -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 diff --git a/app/TaskFlow/frmValidator.vb b/app/TaskFlow/frmValidator.vb index c98daf0..42126c2 100644 --- a/app/TaskFlow/frmValidator.vb +++ b/app/TaskFlow/frmValidator.vb @@ -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! ")