' SwitchExportWinLineDoc_TableContent ' ---------------------------------------------------------------------------- ' Diese Subroutine läd Daten beim Zeilenwechel im Grid und zeigt diese ggf. an. ' Parameter 1 (LEVEL) = Das aktuelle Showlevel übergeben. ' Parameter 2 (GRID) = Falls mehrere Grids auf einem Level vorkommen, kann über diesen Parameter nochmals unterscheiden werden. ' Parameter 3 (UPDATE) = Falls vor dem Wechsel eine Prüfung auf geänderte Daten durchgeführt werden soll. ' ' ---------------------------------------------------------------------------- ' Copyright (c) 2021 by Digital Data GmbH ' ' Digital Data GmbH • Ludwig-Rinn-Strasse 16 • D-35452 Heuchelheim ' Tel.: 0641/202360 • E-Mail: info-flow@digitaldata.works ' ---------------------------------------------------------------------------- ' Creation Date / Author: 15.07.2021 / MK ' Version Date / Editor: 15.07.2021 / MK ' Version Number: 1.0.0.0 Sub SwitchExportWinLineDoc_TableContent(LEVEL,GRID,UPDATE) 'Set global var to prevent focus change -> "rumflackern" PREVENT_FOCUS_CHANGE = True If (LEVEL = 1) or (LEVEL = "1") Then If (GRID = LEVEL1_GRID_ID) Then 'Check if there are unsaved changes before switch line If (LEVEL1_GRID_CURRENT_ROW > 0) and ((LEVEL1_GRID_CURRENT_GUID > 0) and (LEVEL1_GRID_CURRENT_GUID <> -1)) and (UPDATE = true) Then SaveExportWinLineDoc_Record CURRENT_LEVEL,LEVEL1_GRID_CURRENT_GUID,False End If LEVEL1_GRID.GetCurrentCell CURRENT_ROW, CURRENT_COLUMN GRIDSelectedLines = LEVEL1_GRID.SelectedLines If isarray (GRIDSelectedLines) Then If Ubound(GRIDSelectedLines) = 0 Then LEVEL1_GRID_CURRENT_ROW = GRIDSelectedLines(0) LEVEL1_GRID_CURRENT_GUID = LEVEL1_GRID.GetCellValue(CURRENT_ROW,LEVEL1_GRID_COLUMN_GUID) LEVEL1_GRID_CURRENT_AKTIV = LEVEL1_GRID.GetCellValue(CURRENT_ROW,LEVEL1_GRID_COLUMN_AKTIV) LEVEL1_GRID_CURRENT_Beschreibung = LEVEL1_GRID.GetCellValue(CURRENT_ROW,LEVEL1_GRID_COLUMN_BESCHREIBUNG) LEVEL1_GRID_CURRENT_Mandant = LEVEL1_GRID.GetCellValue(CURRENT_ROW,LEVEL1_GRID_COLUMN_MANDANT) If (DEBUG_ON = True) Or (DebugMode = "Enabled") Then msgbox "CURRENT_ROW: " & LEVEL1_GRID_CURRENT_ROW & vbCrlf & _ "CURRENT_GUID: " & LEVEL1_GRID_CURRENT_GUID & vbCrlf & _ "CURRENT_AKTIV: " & LEVEL1_GRID_CURRENT_AKTIV & vbCrlf & _ "CURRENT_Beschreibung: " & LEVEL1_GRID_CURRENT_Beschreibung & vbCrlf & _ "CURRENT_Mandant: " & LEVEL1_GRID_CURRENT_Mandant & vbCrlf & _ "",vbOkayonly+vbInformation, DEBUG_TITLE & "SwitchExportWinLineDoc_TableContent" End If If (LEVEL1_GRID_CURRENT_GUID > 0) Then 'For the first call the value allocation (.contents) must run through all fields 'Otherwise every "Must-Field" must be clicked manually! 'This is corresponding with the "bResult.Value" in the OnCheckUserfield Event LEVEL1_GRID_CALLCOUNT = LEVEL1_GRID_CALLCOUNT + 1 'Set static fields to activ EnableExportWinLineDoc_InputControls CURRENT_LEVEL,"static" 'get data for selected line GetExportWinLineDoc_Record CURRENT_LEVEL,LEVEL1_GRID_ID,CURRENT_GUID 'set data to the read only fields SetExportWinLineDoc_ReadOnlyControls CURRENT_LEVEL 'set data to the writable fields SetExportWinLineDoc_InputControls CURRENT_LEVEL,"static" 'Enable / Disable correponding Toolbar Buttons DisableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" EnableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" End If 'For the first call set focus once to the "Must-Fields" IF ((LEVEL1_GRID_CURRENT_ROW > 0) and (LEVEL1_GRID_CURRENT_GUID > 0) and (LEVEL1_GRID_CALLCOUNT < 2)) Then SetExportWinLineDoc_FocusToRequiredFields CURRENT_LEVEL End if Else 'Important in this case, to set these vars to 0 at first LEVEL1_GRID_CURRENT_ROW = 0 LEVEL1_GRID_CURRENT_GUID = 0 LEVEL1_GRID_CURRENT_AKTIV = 0 LEVEL1_GRID_CURRENT_Beschreibung = 0 LEVEL1_GRID_CURRENT_Mandant = 0 'If no valid line was selected, clear and disable input area EnableExportWinLineDoc_InputControls CURRENT_LEVEL,"static" SetExportWinLineDoc_InputControls CURRENT_LEVEL,"clear" DisableExportWinLineDoc_InputControls CURRENT_LEVEL,"static" SetExportWinLineDoc_ReadOnlyControls CURRENT_LEVEL 'Disable correponding Toolbar Buttons DisableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" EnableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" End If End If End If '-------------------------------------------------------------------------------------------------------------------------------------------- ElseIf (LEVEL = 2) or (LEVEL = "2") Then If (GRID = LEVEL2_GRID_ID) Then 'Check if there are unsaved changes before switch line If (LEVEL2_GRID_CURRENT_ROW > 0) and ((LEVEL2_GRID_CURRENT_GUID > 0) and (LEVEL2_GRID_CURRENT_GUID <> -1)) and (UPDATE = true) Then SaveExportWinLineDoc_Record CURRENT_LEVEL,LEVEL2_GRID_CURRENT_GUID,False End If LEVEL2_GRID.GetCurrentCell CURRENT_ROW, CURRENT_COLUMN GRIDSelectedLines = LEVEL2_GRID.SelectedLines If isarray (GRIDSelectedLines) Then If Ubound(GRIDSelectedLines) = 0 Then LEVEL2_GRID_CURRENT_ROW = GRIDSelectedLines(0) LEVEL2_GRID_CURRENT_GUID = LEVEL2_GRID.GetCellValue(CURRENT_ROW,LEVEL2_GRID_COLUMN_GUID) LEVEL2_GRID_CURRENT_AKTIV = LEVEL2_GRID.GetCellValue(CURRENT_ROW,LEVEL2_GRID_COLUMN_AKTIV) LEVEL2_GRID_CURRENT_Beschreibung = LEVEL2_GRID.GetCellValue(CURRENT_ROW,LEVEL2_GRID_COLUMN_BESCHREIBUNG) LEVEL2_GRID_CURRENT_Mandant = LEVEL2_GRID.GetCellValue(CURRENT_ROW,LEVEL2_GRID_COLUMN_MANDANT) If (DEBUG_ON = True) Or (DebugMode = "Enabled") Then msgbox "CURRENT_ROW: " & LEVEL2_GRID_CURRENT_ROW & vbCrlf & _ "CURRENT_GUID: " & LEVEL2_GRID_CURRENT_GUID & vbCrlf & _ "CURRENT_AKTIV: " & LEVEL2_GRID_CURRENT_AKTIV & vbCrlf & _ "CURRENT_Beschreibung: " & LEVEL2_GRID_CURRENT_Beschreibung & vbCrlf & _ "CURRENT_Mandant: " & LEVEL2_GRID_CURRENT_Mandant & vbCrlf & _ "",vbOkayonly+vbInformation, DEBUG_TITLE & "SwitchExportWinLineDoc_TableContent" End If If (LEVEL2_GRID_CURRENT_GUID > 0) Then 'For the first call the value allocation (.contents) must run through all fields 'Otherwise every "Must-Field" must be clicked manually! 'This is corresponding with the "bResult.Value" in the OnCheckUserfield Event LEVEL2_GRID_CALLCOUNT = LEVEL2_GRID_CALLCOUNT + 1 'Set static fields to activ EnableExportWinLineDoc_InputControls CURRENT_LEVEL,"static" 'get data for selected line GetExportWinLineDoc_Record CURRENT_LEVEL,LEVEL2_GRID_ID,CURRENT_GUID 'set data to the read only fields SetExportWinLineDoc_ReadOnlyControls CURRENT_LEVEL 'set data to the writable fields SetExportWinLineDoc_InputControls CURRENT_LEVEL,"dynamic" 'Enable / Disable correponding Toolbar Buttons DisableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" EnableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" 'SPECIAL: set data type fileds depending on selcted type on/off DisableExportWinLineDoc_InputControls CURRENT_LEVEL,"dynamic" 'Check for duplicate on changing data, or new data, or changing someting else and pressing the save button SQLQuery_ConfigCount = SQLQuery_ConfigCount_Template SQLQuery_ConfigCount = Replace(SQLQuery_ConfigCount,"%LEVEL2_TXT_Platzhalter_Value%",LEVEL2_TXT_Platzhalter_DBValue) Set SQLResult_ConfigCount = Conn.Select(SQLQuery_ConfigCount) IF ((SQLResult_ConfigCount.Rowcount > 1) and (LEVEL2_GRID_CALLCOUNT > 2)) Then Msgbox "Achtung: Der Platzerhalter " & LEVEL2_TXT_Platzhalter_DBValue & ", " & vbCrlf & _ "wird bereits (" & SQLResult_ConfigCount.Rowcount & "x) verwendet!" & vbCrlf & vbCrlf & _ "Bitte ändern Sie Ihre Eingabe, " & vbCrlf & _ "ansonsten wird es zu Fehlern bei der Dateiablage kommen!" & vbCrlf & vbCrlf & _ "Muster: %PLATZHALTER%" & vbCrlf & _ "",vbInformation+vbOKOnly,DEFAULT_TITLE & " - Zeilenwechsel" MacroCommands.MSetFieldFocus MAIN_WINDOW_ID,LEVEL2_TXT_Platzhalter_ID End if End If 'For the first call set focus once to the "Must-Fields" IF ((LEVEL2_GRID_CURRENT_ROW > 0) and (LEVEL2_GRID_CURRENT_GUID > 0) and (LEVEL2_GRID_CALLCOUNT < 2)) Then SetExportWinLineDoc_FocusToRequiredFields CURRENT_LEVEL End if Else 'Important in this case, to set these vars to 0 at first LEVEL2_GRID_CURRENT_ROW = 0 LEVEL2_GRID_CURRENT_GUID = 0 LEVEL2_GRID_CURRENT_AKTIV = 0 LEVEL2_GRID_CURRENT_Beschreibung = 0 LEVEL2_GRID_CURRENT_Mandant = 0 'If no valid line was selected, clear and disable input area EnableExportWinLineDoc_InputControls CURRENT_LEVEL,"static" SetExportWinLineDoc_InputControls CURRENT_LEVEL,"clear" DisableExportWinLineDoc_InputControls CURRENT_LEVEL,"static" SetExportWinLineDoc_ReadOnlyControls CURRENT_LEVEL 'Disable correponding Toolbar Buttons DisableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" EnableExportWinLineDoc_ButtonControls CURRENT_LEVEL,"dynamic" End If End If End If End if PREVENT_FOCUS_CHANGE = False End Sub