VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "mscomctl.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "ComDlg32.OCX"
Begin VB.UserControl DPC_Ref_Sys 
   ClientHeight    =   11985
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   22140
   ScaleHeight     =   11985
   ScaleWidth      =   22140
   Begin VB.Frame fra_DetailItem 
      Caption         =   "MatThick Detail"
      Height          =   6615
      Index           =   5
      Left            =   840
      TabIndex        =   193
      Top             =   1440
      Width           =   12975
      Begin Project1.ArmCombobox cbo_MTH_System 
         Height          =   345
         Left            =   1320
         TabIndex        =   211
         Tag             =   "SYS_Id®©SYS_Name"
         Top             =   1320
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   3735
         Index           =   2
         Left            =   240
         TabIndex        =   204
         Top             =   1920
         Width           =   11655
         Begin VB.Frame fra_SubDetailItem 
            Height          =   735
            Index           =   2
            Left            =   120
            TabIndex        =   206
            Top             =   240
            Width           =   10575
            Begin VB.TextBox txt_MTH_BMin 
               Height          =   375
               Left            =   4320
               TabIndex        =   542
               TabStop         =   0   'False
               Tag             =   "MTH_BMin®©F"
               Top             =   240
               Width           =   1000
            End
            Begin VB.TextBox txt_MTH_AMin 
               Height          =   375
               Left            =   720
               TabIndex        =   540
               TabStop         =   0   'False
               Tag             =   "MTH_AMin®©F"
               Top             =   240
               Width           =   1000
            End
            Begin VB.TextBox txt_MTH_H 
               Height          =   375
               Left            =   9480
               TabIndex        =   545
               TabStop         =   0   'False
               Tag             =   "MTH_H®©F"
               Top             =   240
               Width           =   1000
            End
            Begin VB.TextBox txt_MTH_Thick 
               Height          =   375
               Left            =   7800
               TabIndex        =   544
               TabStop         =   0   'False
               Tag             =   "MTH_Thick®©F"
               Top             =   240
               Width           =   1000
            End
            Begin VB.TextBox txt_MTH_BMax 
               Height          =   375
               Left            =   6000
               TabIndex        =   543
               TabStop         =   0   'False
               Tag             =   "MTH_BMax®©F"
               Top             =   240
               Width           =   1000
            End
            Begin VB.TextBox txt_MTH_AMax 
               Height          =   375
               Left            =   2520
               TabIndex        =   541
               TabStop         =   0   'False
               Tag             =   "MTH_AMax®©F"
               Top             =   240
               Width           =   1000
            End
            Begin VB.Label lbl_label 
               Caption         =   "BMin"
               Height          =   255
               Index           =   149
               Left            =   3600
               TabIndex        =   547
               Tag             =   "lbl_MTH_BMin"
               Top             =   360
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "AMin"
               Height          =   255
               Index           =   148
               Left            =   120
               TabIndex        =   546
               Tag             =   "lbl_MTH_AMin"
               Top             =   360
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "H"
               Height          =   255
               Index           =   19
               Left            =   9000
               TabIndex        =   210
               Tag             =   "lbl_MTH_H"
               Top             =   360
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "Thick"
               Height          =   255
               Index           =   18
               Left            =   7080
               TabIndex        =   209
               Tag             =   "lbl_MTH_Thick"
               Top             =   360
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "BMax"
               Height          =   255
               Index           =   17
               Left            =   5400
               TabIndex        =   208
               Tag             =   "lbl_MTH_BMax"
               Top             =   360
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "AMax"
               Height          =   255
               Index           =   16
               Left            =   1800
               TabIndex        =   207
               Tag             =   "lbl_MTH_AMax"
               Top             =   360
               Width           =   735
            End
         End
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   2
            Left            =   2880
            TabIndex        =   205
            TabStop         =   0   'False
            Tag             =   "MTH_Id"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   3015
            Index           =   2
            Left            =   10800
            TabIndex        =   214
            Top             =   240
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   5318
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   2535
            Index           =   2
            Left            =   120
            TabIndex        =   213
            Tag             =   "grd_S_Mth"
            Top             =   1080
            Width           =   9255
            _ExtentX        =   16325
            _ExtentY        =   4471
         End
      End
      Begin Project1.ArmCombobox cbo_MTH_MAT_Id 
         Height          =   345
         Left            =   8520
         TabIndex        =   212
         Tag             =   "MAT_Id®©MAT_Name"
         Top             =   1320
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   5
         Left            =   9720
         TabIndex        =   194
         TabStop         =   0   'False
         Top             =   480
         Visible         =   0   'False
         Width           =   855
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   5
         Left            =   240
         TabIndex        =   179
         Top             =   480
         Width           =   8535
         _ExtentX        =   15055
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   5
         Left            =   10680
         TabIndex        =   198
         TabStop         =   0   'False
         Top             =   480
         Visible         =   0   'False
         Width           =   495
      End
      Begin Project1.ArmCombobox cbo_MTH_PRD_Id 
         Height          =   345
         Left            =   4800
         TabIndex        =   538
         Tag             =   "PRD_Id®©PRD_Name"
         Top             =   1320
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   609
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Product"
         Height          =   255
         Index           =   147
         Left            =   3840
         TabIndex        =   539
         Tag             =   "lbl_MTH_PRD_Name"
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Name"
         Height          =   255
         Index           =   1
         Left            =   7440
         TabIndex        =   201
         Tag             =   "lbl_MTH_MAT_Name"
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SYS Name"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   199
         Tag             =   "lbl_MTH_SYS_Name"
         Top             =   1440
         Width           =   1095
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "System Detail"
      Height          =   375
      Index           =   0
      Left            =   330
      TabIndex        =   2
      Tag             =   "DPC_System"
      Top             =   660
      Width           =   1455
      Begin VB.Frame fra_SubDetail 
         Height          =   2580
         Index           =   8
         Left            =   8775
         TabIndex        =   527
         Top             =   6390
         Width           =   2205
         Begin VB.Frame fra_SubDetailItem 
            Height          =   852
            Index           =   8
            Left            =   240
            TabIndex        =   529
            Top             =   240
            Width           =   12975
            Begin VB.TextBox txt_SYS_AddValueThickness 
               Height          =   375
               Left            =   5160
               TabIndex        =   531
               Tag             =   "SYD_Value®©F®©lbl_SYS_ADDV_Thickness"
               Top             =   330
               Width           =   855
            End
            Begin VB.TextBox txt_SYS_AddValueSX 
               Height          =   375
               Left            =   7365
               TabIndex        =   530
               Tag             =   "SYD_Value2®©F®©lbl_SYS_ADDV_AddV"
               Top             =   345
               Width           =   855
            End
            Begin Project1.ArmCombobox cbo_SysBendAddValue 
               Height          =   345
               Left            =   1170
               TabIndex        =   532
               Tag             =   "PRD_Id®©PRD_Name"
               Top             =   345
               Width           =   2670
               _ExtentX        =   4710
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Bending"
               Height          =   252
               Index           =   146
               Left            =   120
               TabIndex        =   535
               Tag             =   "lbl_SYS_ADDVL_Bend"
               Top             =   391
               Width           =   852
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Add. value"
               Height          =   255
               Index           =   145
               Left            =   6285
               TabIndex        =   534
               Tag             =   "lbl_SYS_ADDV_AddV"
               Top             =   405
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Thickness"
               Height          =   255
               Index           =   144
               Left            =   3900
               TabIndex        =   533
               Tag             =   "lbl_SYS_ADDV_Thickness"
               Top             =   390
               Width           =   1095
            End
         End
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   8
            Left            =   2760
            TabIndex        =   528
            TabStop         =   0   'False
            Tag             =   "SYD_Id"
            Text            =   "Text1"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2010
            Index           =   8
            Left            =   13200
            TabIndex        =   536
            Top             =   360
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   1217
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1572
            Index           =   8
            Left            =   120
            TabIndex        =   537
            Tag             =   "grd_S_AddValue"
            Top             =   1200
            Width           =   12972
            _ExtentX        =   22886
            _ExtentY        =   2778
         End
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   2415
         Index           =   0
         Left            =   1890
         TabIndex        =   3
         Top             =   6150
         Width           =   1125
         Begin VB.Frame fra_SubDetailItem 
            Height          =   735
            Index           =   0
            Left            =   240
            TabIndex        =   15
            Top             =   240
            Width           =   8535
            Begin Project1.ArmCombobox cbo_SysBending 
               Height          =   345
               Index           =   3
               Left            =   7080
               TabIndex        =   59
               Tag             =   "PRD4_Id®©PRD4_Desc"
               Top             =   240
               Width           =   1215
               _ExtentX        =   2143
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysBending 
               Height          =   345
               Index           =   2
               Left            =   5040
               TabIndex        =   58
               Tag             =   "PRD3_Id®©PRD3_Desc"
               Top             =   240
               Width           =   1215
               _ExtentX        =   2143
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysBending 
               Height          =   345
               Index           =   1
               Left            =   3000
               TabIndex        =   57
               Tag             =   "PRD2_Id®©PRD2_Desc"
               Top             =   240
               Width           =   1215
               _ExtentX        =   2143
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysBending 
               Height          =   345
               Index           =   0
               Left            =   960
               TabIndex        =   55
               Tag             =   "PRD1_Id®©PRD1_Desc"
               Top             =   240
               Width           =   1215
               _ExtentX        =   2143
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#BND4"
               Height          =   255
               Index           =   37
               Left            =   6360
               TabIndex        =   258
               Tag             =   "lbl_SYS_BND4"
               Top             =   360
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#BND3"
               Height          =   255
               Index           =   36
               Left            =   4320
               TabIndex        =   257
               Tag             =   "lbl_SYS_BND3"
               Top             =   360
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#BND2"
               Height          =   255
               Index           =   35
               Left            =   2280
               TabIndex        =   256
               Tag             =   "lbl_SYS_BND2"
               Top             =   360
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#BND1"
               Height          =   255
               Index           =   34
               Left            =   120
               TabIndex        =   255
               Tag             =   "lbl_SYS_BND1"
               Top             =   360
               Width           =   615
            End
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2010
            Index           =   0
            Left            =   8880
            TabIndex        =   63
            Top             =   360
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   1217
         End
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   0
            Left            =   2760
            TabIndex        =   9
            TabStop         =   0   'False
            Text            =   "Text1"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1215
            Index           =   0
            Left            =   120
            TabIndex        =   61
            Tag             =   "grd_S_Bnd"
            Top             =   1080
            Width           =   8655
            _ExtentX        =   10610
            _ExtentY        =   2143
         End
      End
      Begin VB.TextBox txt_SYS_LayCADFile 
         Height          =   285
         Left            =   4320
         MaxLength       =   50
         TabIndex        =   526
         Tag             =   "SYS_LayCADFile"
         Top             =   5160
         Width           =   3255
      End
      Begin VB.Frame fra_Sifyb_BI_Link 
         Caption         =   "#Sifyb Base Item link"
         Height          =   2385
         Index           =   1
         Left            =   12360
         TabIndex        =   510
         Top             =   3480
         Width           =   5772
         Begin Project1.ArmCombobox cbo_BI_ProductFamily 
            Height          =   345
            Left            =   1680
            TabIndex        =   511
            Tag             =   "PF_Code®©PF_Desc"
            Top             =   240
            Width           =   4020
            _ExtentX        =   7091
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BI_Edge 
            Height          =   345
            Left            =   1680
            TabIndex        =   513
            Tag             =   "PE_Code®©PE_Desc"
            Top             =   585
            Width           =   4020
            _ExtentX        =   7091
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BI_Shape 
            Height          =   345
            Left            =   1680
            TabIndex        =   515
            Tag             =   "SH_Code®©SH_Desc"
            Top             =   930
            Width           =   1785
            _ExtentX        =   3149
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BI_FireRating 
            Height          =   345
            Left            =   5010
            TabIndex        =   517
            Tag             =   "BI_PERF_IND®©BI_PERF_IND_Desc"
            Top             =   930
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BI_ProductSegm 
            Height          =   345
            Left            =   1695
            TabIndex        =   519
            Tag             =   "PS_Code®©PS_Desc"
            Top             =   1290
            Width           =   4020
            _ExtentX        =   7091
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BI_ArmstrongProduct 
            Height          =   345
            Left            =   1695
            TabIndex        =   521
            Tag             =   "Armstrong_product®©Armstrong_product_Desc"
            Top             =   1635
            Width           =   4020
            _ExtentX        =   7091
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BI_ProductOrigin 
            Height          =   345
            Left            =   1695
            TabIndex        =   523
            Tag             =   "origin_type®©origin_type_Desc"
            Top             =   1980
            Width           =   4020
            _ExtentX        =   7091
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Product origin"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   142
            Left            =   75
            TabIndex        =   524
            Tag             =   "lbl_ProductOrigin"
            Top             =   2025
            Width           =   1605
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Armstrong product"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   141
            Left            =   75
            TabIndex        =   522
            Tag             =   "lbl_ArmstrongProduct"
            Top             =   1665
            Width           =   1815
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Product range"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   140
            Left            =   75
            TabIndex        =   520
            Tag             =   "lbl_ProductRange"
            Top             =   1320
            Width           =   1605
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Fire rating"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   139
            Left            =   3630
            TabIndex        =   518
            Tag             =   "lbl_FireRating"
            Top             =   1005
            Width           =   1275
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Shape"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   138
            Left            =   60
            TabIndex        =   516
            Tag             =   "lbl_Shape"
            Top             =   945
            Width           =   1605
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Edge detail"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   137
            Left            =   60
            TabIndex        =   514
            Tag             =   "lbl_EdgeDetail"
            Top             =   600
            Width           =   1605
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Product family"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   136
            Left            =   45
            TabIndex        =   512
            Tag             =   "lbl_ProductFamily"
            Top             =   255
            Width           =   1605
         End
      End
      Begin VB.TextBox txt_SYS_CADFile 
         Height          =   285
         Left            =   9000
         MaxLength       =   50
         TabIndex        =   506
         Tag             =   "SYS_CADFile"
         Top             =   5160
         Width           =   3255
      End
      Begin VB.TextBox txt_SYS_BaeType 
         Height          =   285
         Left            =   1560
         TabIndex        =   504
         Tag             =   "SYS_BaeType®©N®©lbl_SYS_BaeType"
         Top             =   5160
         Width           =   1095
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   2580
         Index           =   7
         Left            =   6735
         TabIndex        =   487
         Top             =   6255
         Width           =   1770
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   7
            Left            =   2760
            TabIndex        =   495
            TabStop         =   0   'False
            Tag             =   "SYD_Id"
            Text            =   "Text1"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.Frame fra_SubDetailItem 
            Height          =   852
            Index           =   7
            Left            =   240
            TabIndex        =   488
            Top             =   240
            Width           =   12975
            Begin VB.TextBox txt_SYS_INL_InlayDec2 
               Height          =   375
               Left            =   8160
               TabIndex        =   490
               Tag             =   "SYD_Value2®©F®©lbl_SYS_INL_InlayDec2"
               Top             =   240
               Width           =   855
            End
            Begin VB.TextBox txt_SYS_INL_InlayDec1 
               Height          =   375
               Left            =   6000
               TabIndex        =   489
               Tag             =   "SYD_Value®©F®©lbl_SYS_INL_InlayDec1"
               Top             =   240
               Width           =   855
            End
            Begin Project1.ArmCombobox cbo_SysPerf 
               Height          =   345
               Left            =   1080
               TabIndex        =   491
               Tag             =   "PRD_Id®©PRD_Name"
               Top             =   240
               Width           =   3615
               _ExtentX        =   6376
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Inlay Dec1"
               Height          =   252
               Index           =   135
               Left            =   4920
               TabIndex        =   494
               Tag             =   "lbl_SYS_INL_InlayDec1"
               Top             =   360
               Width           =   1092
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Inlay Dec2"
               Height          =   252
               Index           =   134
               Left            =   7080
               TabIndex        =   493
               Tag             =   "lbl_SYS_INL_InlayDec2"
               Top             =   360
               Width           =   1092
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Perf."
               Height          =   252
               Index           =   128
               Left            =   120
               TabIndex        =   492
               Tag             =   "lbl_SYS_INL_Prf"
               Top             =   360
               Width           =   852
            End
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2010
            Index           =   7
            Left            =   13200
            TabIndex        =   496
            Top             =   360
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   1217
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1572
            Index           =   7
            Left            =   120
            TabIndex        =   497
            Tag             =   "grd_S_Inl"
            Top             =   1200
            Width           =   12972
            _ExtentX        =   22886
            _ExtentY        =   2778
         End
      End
      Begin VB.TextBox txt_SYS_InlayDec2 
         Height          =   300
         Left            =   11280
         TabIndex        =   486
         Tag             =   "SYS_InlayDec2®©F"
         Top             =   4800
         Width           =   972
      End
      Begin VB.TextBox txt_SYS_InlayDec1 
         Height          =   300
         Left            =   11280
         TabIndex        =   485
         Tag             =   "SYS_InlayDec1®©F"
         Top             =   4440
         Width           =   972
      End
      Begin VB.Frame Frame1 
         Caption         =   "#Suspension"
         Height          =   3225
         Left            =   12360
         TabIndex        =   402
         Top             =   165
         Width           =   5772
         Begin VB.CheckBox chk_SYS_UseCPro 
            Caption         =   "Check1"
            Height          =   255
            Left            =   5160
            TabIndex        =   482
            Tag             =   "SYS_UseCPro"
            Top             =   240
            Width           =   255
         End
         Begin VB.CheckBox chk_SYS_IsSub 
            Height          =   255
            Left            =   1200
            TabIndex        =   416
            Tag             =   "SYS_IsSub"
            Top             =   240
            Width           =   255
         End
         Begin VB.CheckBox chk_SYS_PaSec 
            Caption         =   "Check1"
            Height          =   255
            Left            =   3000
            TabIndex        =   414
            Tag             =   "SYS_PaSec"
            Top             =   240
            Width           =   255
         End
         Begin VB.PictureBox pic_ImgBox 
            AutoRedraw      =   -1  'True
            Height          =   1452
            Index           =   16
            Left            =   1200
            ScaleHeight     =   1395
            ScaleWidth      =   2115
            TabIndex        =   412
            Tag             =   "15"
            Top             =   1650
            Width           =   2175
         End
         Begin VB.CommandButton cmd_ImageInfo 
            Caption         =   "..."
            Height          =   255
            Index           =   15
            Left            =   3600
            TabIndex        =   411
            Tag             =   "15©16"
            Top             =   1650
            Width           =   615
         End
         Begin VB.TextBox txt_ImgId 
            Height          =   285
            Index           =   15
            Left            =   3600
            TabIndex        =   410
            TabStop         =   0   'False
            Tag             =   "IMG_IdSub®©N"
            Top             =   2010
            Visible         =   0   'False
            Width           =   255
         End
         Begin Project1.ArmCombobox cbo_SYS_RF_CodeA0 
            Height          =   345
            Left            =   1200
            TabIndex        =   404
            Tag             =   "RF_CodeA0®©RF_DescA0"
            Top             =   555
            Width           =   4455
            _ExtentX        =   7858
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SYS_RF_CodeA1 
            Height          =   345
            Left            =   1200
            TabIndex        =   405
            Tag             =   "RF_CodeA1®©RF_DescA1"
            Top             =   915
            Width           =   4455
            _ExtentX        =   7858
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_SYS_RF_CodeA2 
            Height          =   345
            Left            =   1200
            TabIndex        =   407
            Tag             =   "RF_CodeA2®©RF_DescA2"
            Top             =   1275
            Width           =   4455
            _ExtentX        =   7858
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Use C/D profile"
            Height          =   255
            Index           =   125
            Left            =   3600
            TabIndex        =   481
            Tag             =   "lbl_SYS_UseCPro"
            Top             =   240
            Width           =   1455
         End
         Begin VB.Label lbl_label 
            Caption         =   "#SYS IsSub"
            Height          =   255
            Index           =   25
            Left            =   120
            TabIndex        =   415
            Tag             =   "lbl_SYS_IsSub"
            Top             =   240
            Width           =   1095
         End
         Begin VB.Label lbl_label 
            Caption         =   "#PaSec"
            Height          =   255
            Index           =   206
            Left            =   1920
            TabIndex        =   413
            Tag             =   "lbl_SYS_PaSec"
            Top             =   240
            Width           =   975
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Img. Sub"
            Height          =   255
            Index           =   207
            Left            =   120
            TabIndex        =   409
            Tag             =   "lbl_SYS_ImgSub"
            Top             =   1650
            Width           =   855
         End
         Begin VB.Label lbl_label 
            Caption         =   "#RF_CodeA2"
            Height          =   255
            Index           =   205
            Left            =   120
            TabIndex        =   408
            Tag             =   "lbl_SYS_RF_CodeA2"
            Top             =   1275
            Width           =   1095
         End
         Begin VB.Label lbl_label 
            Caption         =   "#RF_CodeA1"
            Height          =   255
            Index           =   204
            Left            =   120
            TabIndex        =   406
            Tag             =   "lbl_SYS_RF_CodeA1"
            Top             =   915
            Width           =   1215
         End
         Begin VB.Label lbl_label 
            Caption         =   "#RF_CodeA0"
            Height          =   255
            Index           =   203
            Left            =   120
            TabIndex        =   403
            Tag             =   "lbl_SYS_RF_CodeA0"
            Top             =   555
            Width           =   1215
         End
      End
      Begin VB.TextBox txt_SYS_Code 
         Height          =   375
         Left            =   9480
         MaxLength       =   30
         TabIndex        =   401
         Tag             =   "SYS_Code"
         Top             =   2280
         Width           =   732
      End
      Begin Project1.ArmCombobox cbo_SYS_Allow 
         Height          =   345
         Index           =   0
         Left            =   10320
         TabIndex        =   66
         Tag             =   "SYS_AllowGC®©SYS_AllowGCName"
         Top             =   2280
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_FilId 
         Height          =   285
         Index           =   0
         Left            =   11400
         TabIndex        =   309
         Text            =   "2"
         Top             =   480
         Visible         =   0   'False
         Width           =   375
      End
      Begin VB.CommandButton cmd_FileInfo 
         Caption         =   "file ..."
         Height          =   255
         Left            =   11880
         TabIndex        =   307
         Tag             =   "0"
         Top             =   480
         Visible         =   0   'False
         Width           =   735
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   3855
         Index           =   5
         Left            =   -330
         TabIndex        =   293
         Top             =   8670
         Width           =   20292
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   5
            Left            =   2760
            TabIndex        =   303
            TabStop         =   0   'False
            Tag             =   "GPP_Id"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.Frame fra_SubDetailItem 
            Height          =   2415
            Index           =   5
            Left            =   4365
            TabIndex        =   294
            Top             =   3480
            Width           =   18012
            Begin VB.TextBox txt_GPP_Group 
               Height          =   375
               Left            =   1440
               TabIndex        =   498
               Tag             =   "GRP_Group"
               Top             =   1440
               Visible         =   0   'False
               Width           =   615
            End
            Begin Project1.ArmCombobox cbo_GPP_Group 
               Height          =   345
               Left            =   1440
               TabIndex        =   306
               Tag             =   "GRP_Id®©GRP_Name"
               Top             =   480
               Width           =   6735
               _ExtentX        =   11880
               _ExtentY        =   609
            End
            Begin VB.TextBox txt_GPP_Order 
               Height          =   375
               Left            =   1440
               TabIndex        =   308
               Tag             =   "GPP_Order®©F®©lbl_GPP_Order"
               Top             =   960
               Width           =   615
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   9
               Left            =   15840
               MaxLength       =   500
               TabIndex        =   339
               Tag             =   "GPP_Value9"
               Top             =   1920
               Width           =   2055
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   8
               Left            =   15840
               MaxLength       =   500
               TabIndex        =   336
               Tag             =   "GPP_Value8"
               Top             =   1560
               Width           =   2055
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   7
               Left            =   15840
               MaxLength       =   500
               TabIndex        =   333
               Tag             =   "GPP_Value7"
               Top             =   1200
               Width           =   2055
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   6
               Left            =   15840
               MaxLength       =   500
               TabIndex        =   330
               Tag             =   "GPP_Value6"
               Top             =   840
               Width           =   2055
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   5
               Left            =   15840
               MaxLength       =   500
               TabIndex        =   327
               Tag             =   "GPP_Value5"
               Top             =   480
               Width           =   2055
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   4
               Left            =   10800
               MaxLength       =   500
               TabIndex        =   324
               Tag             =   "GPP_Value4"
               Top             =   1920
               Width           =   2292
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   3
               Left            =   10800
               MaxLength       =   500
               TabIndex        =   321
               Tag             =   "GPP_Value3"
               Top             =   1560
               Width           =   2292
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   2
               Left            =   10800
               MaxLength       =   500
               TabIndex        =   318
               Tag             =   "GPP_Value2"
               Top             =   1200
               Width           =   2292
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   1
               Left            =   10800
               MaxLength       =   500
               TabIndex        =   315
               Tag             =   "GPP_Value1"
               Top             =   840
               Width           =   2292
            End
            Begin VB.TextBox txt_GPP_Value 
               Height          =   300
               Index           =   0
               Left            =   10800
               MaxLength       =   500
               TabIndex        =   312
               Tag             =   "GPP_Value0"
               Top             =   480
               Width           =   2292
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   1
               Left            =   9720
               TabIndex        =   314
               Tag             =   "GPP_Operator1®©GPP_Opr1Name"
               Top             =   840
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   1
               Left            =   8280
               TabIndex        =   313
               Tag             =   "GPP_Param1®©GPP_Param1Name"
               Top             =   840
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   0
               Left            =   9720
               TabIndex        =   311
               Tag             =   "GPP_Operator0®©GPP_Opr0Name"
               Top             =   480
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   0
               Left            =   8280
               TabIndex        =   310
               Tag             =   "GPP_Param0®©GPP_Param0Name"
               Top             =   480
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   2
               Left            =   8280
               TabIndex        =   316
               Tag             =   "GPP_Param2®©GPP_Param2Name"
               Top             =   1200
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   3
               Left            =   8280
               TabIndex        =   319
               Tag             =   "GPP_Param3®©GPP_Param3Name"
               Top             =   1560
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   4
               Left            =   8280
               TabIndex        =   322
               Tag             =   "GPP_Param4®©GPP_Param4Name"
               Top             =   1920
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   5
               Left            =   13320
               TabIndex        =   325
               Tag             =   "GPP_Param5®©GPP_Param5Name"
               Top             =   480
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   6
               Left            =   13320
               TabIndex        =   328
               Tag             =   "GPP_Param6®©GPP_Param6Name"
               Top             =   840
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   7
               Left            =   13320
               TabIndex        =   331
               Tag             =   "GPP_Param7®©GPP_Param7Name"
               Top             =   1200
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   8
               Left            =   13320
               TabIndex        =   334
               Tag             =   "GPP_Param8®©GPP_Param8Name"
               Top             =   1560
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Param 
               Height          =   345
               Index           =   9
               Left            =   13320
               TabIndex        =   337
               Tag             =   "GPP_Param9®©GPP_Param9Name"
               Top             =   1920
               Width           =   1335
               _ExtentX        =   2355
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   2
               Left            =   9720
               TabIndex        =   317
               Tag             =   "GPP_Operator2®©GPP_Opr2Name"
               Top             =   1200
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   3
               Left            =   9720
               TabIndex        =   320
               Tag             =   "GPP_Operator3®©GPP_Opr3Name"
               Top             =   1560
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   4
               Left            =   9720
               TabIndex        =   323
               Tag             =   "GPP_Operator4®©GPP_Opr4Name"
               Top             =   1920
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   5
               Left            =   14760
               TabIndex        =   326
               Tag             =   "GPP_Operator5®©GPP_Opr5Name"
               Top             =   480
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   6
               Left            =   14760
               TabIndex        =   329
               Tag             =   "GPP_Operator6®©GPP_Opr6Name"
               Top             =   840
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   7
               Left            =   14760
               TabIndex        =   332
               Tag             =   "GPP_Operator7®©GPP_Opr7Name"
               Top             =   1200
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   8
               Left            =   14760
               TabIndex        =   335
               Tag             =   "GPP_Operator8®©GPP_Opr8Name"
               Top             =   1560
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_GPP_Operator 
               Height          =   345
               Index           =   9
               Left            =   14760
               TabIndex        =   338
               Tag             =   "GPP_Operator9®©GPP_Opr9Name"
               Top             =   1920
               Width           =   975
               _ExtentX        =   1720
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Param"
               Height          =   252
               Index           =   74
               Left            =   8280
               TabIndex        =   302
               Tag             =   "lbl_GPP_Param"
               Top             =   240
               Width           =   1092
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Value"
               Height          =   252
               Index           =   73
               Left            =   10800
               TabIndex        =   301
               Tag             =   "lbl_GPP_Value"
               Top             =   240
               Width           =   852
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Operator"
               Height          =   252
               Index           =   72
               Left            =   14760
               TabIndex        =   300
               Tag             =   "lbl_GPP_Operator"
               Top             =   240
               Width           =   1092
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Order"
               Height          =   255
               Index           =   71
               Left            =   240
               TabIndex        =   299
               Tag             =   "lbl_GPP_Order"
               Top             =   1080
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Operator"
               Height          =   252
               Index           =   70
               Left            =   9720
               TabIndex        =   298
               Tag             =   "lbl_GPP_Operator"
               Top             =   240
               Width           =   732
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Param"
               Height          =   252
               Index           =   69
               Left            =   13320
               TabIndex        =   297
               Tag             =   "lbl_GPP_Param"
               Top             =   240
               Width           =   852
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Value"
               Height          =   252
               Index           =   64
               Left            =   15840
               TabIndex        =   296
               Tag             =   "lbl_GPP_Value"
               Top             =   240
               Width           =   852
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Group"
               Height          =   255
               Index           =   63
               Left            =   240
               TabIndex        =   295
               Tag             =   "lbl_GPP_Group"
               Top             =   600
               Width           =   855
            End
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2016
            Index           =   5
            Left            =   18240
            TabIndex        =   304
            Top             =   240
            Width           =   696
            _ExtentX        =   1217
            _ExtentY        =   1217
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   855
            Index           =   5
            Left            =   120
            TabIndex        =   305
            Tag             =   "grd_S_GrpPrm"
            Top             =   2880
            Width           =   12975
            _ExtentX        =   22886
            _ExtentY        =   1508
         End
         Begin Project1.ArmCombobox cbo_GRP_Type_Filter 
            Height          =   345
            Left            =   1800
            TabIndex        =   398
            Tag             =   "GRP_Id®©GRP_Name"
            Top             =   2520
            Width           =   3015
            _ExtentX        =   5318
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Group type filter"
            Height          =   255
            Index           =   88
            Left            =   240
            TabIndex        =   399
            Tag             =   "lbl_GPP_GroupTypeFilter"
            Top             =   2640
            Width           =   1455
         End
      End
      Begin MSComctlLib.ListView lv_SysVendor 
         Height          =   1332
         Left            =   7920
         TabIndex        =   65
         Top             =   3720
         Width           =   2292
         _ExtentX        =   4048
         _ExtentY        =   2355
         View            =   2
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         Checkboxes      =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   0
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   2295
         Index           =   4
         Left            =   3315
         TabIndex        =   234
         Top             =   6210
         Width           =   1590
         Begin VB.Frame fra_SubDetailItem 
            Height          =   1215
            Index           =   4
            Left            =   240
            TabIndex        =   236
            Top             =   240
            Width           =   12975
            Begin VB.TextBox txt_SYD1_Value_S 
               Height          =   375
               Left            =   2400
               TabIndex        =   240
               Tag             =   "SYD1_Value®©F®©lbl_SYS_Value1_S"
               Top             =   240
               Width           =   855
            End
            Begin VB.TextBox txt_SYD2_Value_S 
               Height          =   375
               Left            =   5640
               TabIndex        =   239
               Tag             =   "SYD2_Value®©F®©lbl_SYS_Value2_S"
               Top             =   240
               Width           =   855
            End
            Begin VB.TextBox txt_SYD3_Value_S 
               Height          =   375
               Left            =   8880
               TabIndex        =   238
               Tag             =   "SYD3_Value®©F®©lbl_SYS_Value3_S"
               Top             =   240
               Width           =   855
            End
            Begin VB.TextBox txt_SYD4_Value_S 
               Height          =   375
               Left            =   12000
               TabIndex        =   237
               Tag             =   "SYD4_Value®©F®©lbl_SYS_Value4_S"
               Top             =   240
               Width           =   855
            End
            Begin Project1.ArmCombobox cbo_SysSpacer 
               Height          =   345
               Index           =   3
               Left            =   10440
               TabIndex        =   241
               Tag             =   "PRD4_Id®©PRD4_Desc"
               Top             =   720
               Width           =   2415
               _ExtentX        =   4260
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysSpacer 
               Height          =   345
               Index           =   2
               Left            =   7320
               TabIndex        =   242
               Tag             =   "PRD3_Id®©PRD3_Desc"
               Top             =   720
               Width           =   2415
               _ExtentX        =   4260
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysSpacer 
               Height          =   345
               Index           =   1
               Left            =   4080
               TabIndex        =   243
               Tag             =   "PRD2_Id®©PRD2_Desc"
               Top             =   720
               Width           =   2415
               _ExtentX        =   4260
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysSpacer 
               Height          =   345
               Index           =   0
               Left            =   840
               TabIndex        =   244
               Tag             =   "PRD1_Id®©PRD1_Desc"
               Top             =   720
               Width           =   2415
               _ExtentX        =   4260
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Spc F"
               Height          =   255
               Index           =   59
               Left            =   9840
               TabIndex        =   267
               Tag             =   "lbl_SYS_SPC4"
               Top             =   840
               Width           =   855
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Spc E"
               Height          =   255
               Index           =   58
               Left            =   6600
               TabIndex        =   266
               Tag             =   "lbl_SYS_SPC3"
               Top             =   840
               Width           =   855
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Spc D"
               Height          =   255
               Index           =   57
               Left            =   3360
               TabIndex        =   265
               Tag             =   "lbl_SYS_SPC2"
               Top             =   840
               Width           =   855
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Spc C"
               Height          =   255
               Index           =   56
               Left            =   120
               TabIndex        =   264
               Tag             =   "lbl_SYS_SPC1"
               Top             =   840
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap F"
               Height          =   255
               Index           =   33
               Left            =   9840
               TabIndex        =   254
               Tag             =   "lbl_SYS_Value4_S"
               Top             =   360
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap E"
               Height          =   255
               Index           =   32
               Left            =   6600
               TabIndex        =   253
               Tag             =   "lbl_SYS_Value3_S"
               Top             =   360
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap D"
               Height          =   255
               Index           =   31
               Left            =   3360
               TabIndex        =   252
               Tag             =   "lbl_SYS_Value2_S"
               Top             =   360
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap C"
               Height          =   255
               Index           =   30
               Left            =   120
               TabIndex        =   251
               Tag             =   "lbl_SYS_Value1_S"
               Top             =   360
               Width           =   1095
            End
         End
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   4
            Left            =   2760
            TabIndex        =   235
            TabStop         =   0   'False
            Text            =   "Text1"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2010
            Index           =   4
            Left            =   13200
            TabIndex        =   245
            Top             =   360
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   1217
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1215
            Index           =   4
            Left            =   120
            TabIndex        =   246
            Tag             =   "grd_S_Spc"
            Top             =   1560
            Width           =   12975
            _ExtentX        =   22886
            _ExtentY        =   2143
         End
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   3735
         Index           =   3
         Left            =   5280
         TabIndex        =   221
         Top             =   6180
         Width           =   1092
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   3
            Left            =   2760
            TabIndex        =   228
            TabStop         =   0   'False
            Text            =   "Text1"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.Frame fra_SubDetailItem 
            Height          =   1215
            Index           =   3
            Left            =   120
            TabIndex        =   222
            Top             =   240
            Width           =   13215
            Begin VB.TextBox txt_SYD4_Value_G 
               Height          =   375
               Left            =   12240
               TabIndex        =   233
               Tag             =   "SYD4_Value®©F®©lbl_SYS_Value4_G"
               Top             =   240
               Width           =   855
            End
            Begin VB.TextBox txt_SYD3_Value_G 
               Height          =   375
               Left            =   9000
               TabIndex        =   232
               Tag             =   "SYD3_Value®©F®©lbl_SYS_Value3_G"
               Top             =   240
               Width           =   855
            End
            Begin VB.TextBox txt_SYD2_Value_G 
               Height          =   375
               Left            =   5640
               TabIndex        =   231
               Tag             =   "SYD2_Value®©F®©lbl_SYS_Value2_G"
               Top             =   240
               Width           =   855
            End
            Begin VB.TextBox txt_SYD1_Value_G 
               Height          =   375
               Left            =   2400
               TabIndex        =   230
               Tag             =   "SYD1_Value®©F®©lbl_SYS_Value1_G"
               Top             =   240
               Width           =   855
            End
            Begin Project1.ArmCombobox cbo_SysGasket 
               Height          =   345
               Index           =   3
               Left            =   10560
               TabIndex        =   223
               Tag             =   "PRD4_Id®©PRD4_Desc"
               Top             =   720
               Width           =   2535
               _ExtentX        =   4471
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysGasket 
               Height          =   345
               Index           =   2
               Left            =   7200
               TabIndex        =   224
               Tag             =   "PRD3_Id®©PRD3_Desc"
               Top             =   720
               Width           =   2655
               _ExtentX        =   4683
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysGasket 
               Height          =   345
               Index           =   1
               Left            =   3960
               TabIndex        =   225
               Tag             =   "PRD2_Id®©PRD2_Desc"
               Top             =   720
               Width           =   2535
               _ExtentX        =   4471
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_SysGasket 
               Height          =   345
               Index           =   0
               Left            =   720
               TabIndex        =   226
               Tag             =   "PRD1_Id®©PRD1_Desc"
               Top             =   720
               Width           =   2535
               _ExtentX        =   4471
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gsk F"
               Height          =   255
               Index           =   55
               Left            =   9960
               TabIndex        =   263
               Tag             =   "lbl_SYS_GSK4"
               Top             =   840
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gsk E"
               Height          =   255
               Index           =   54
               Left            =   6600
               TabIndex        =   262
               Tag             =   "lbl_SYS_GSK3"
               Top             =   840
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gsk D"
               Height          =   255
               Index           =   40
               Left            =   3360
               TabIndex        =   261
               Tag             =   "lbl_SYS_GSK2"
               Top             =   840
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gsk C"
               Height          =   255
               Index           =   39
               Left            =   120
               TabIndex        =   260
               Tag             =   "lbl_SYS_GSK1"
               Top             =   840
               Width           =   855
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap F"
               Height          =   255
               Index           =   29
               Left            =   9960
               TabIndex        =   250
               Tag             =   "lbl_SYS_Value4_G"
               Top             =   360
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap E"
               Height          =   255
               Index           =   28
               Left            =   6600
               TabIndex        =   249
               Tag             =   "lbl_SYS_Value3_G"
               Top             =   360
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap D"
               Height          =   255
               Index           =   27
               Left            =   3360
               TabIndex        =   248
               Tag             =   "lbl_SYS_Value2_G"
               Top             =   360
               Width           =   1095
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Gap C"
               Height          =   255
               Index           =   26
               Left            =   120
               TabIndex        =   247
               Tag             =   "lbl_SYS_Value1_G"
               Top             =   360
               Width           =   855
            End
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2010
            Index           =   3
            Left            =   13440
            TabIndex        =   227
            Top             =   240
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   1217
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1215
            Index           =   3
            Left            =   120
            TabIndex        =   229
            Tag             =   "grd_S_Gsk"
            Top             =   1440
            Width           =   12015
            _ExtentX        =   21193
            _ExtentY        =   2143
         End
      End
      Begin VB.CheckBox chk_SYS_IsPan 
         Height          =   255
         Left            =   11400
         TabIndex        =   46
         Tag             =   "SYS_IsPan"
         Top             =   1560
         Width           =   255
      End
      Begin VB.CheckBox chk_SYS_Fix 
         Height          =   255
         Left            =   11400
         TabIndex        =   45
         Tag             =   "SYS_Fix"
         Top             =   1200
         Width           =   255
      End
      Begin VB.CommandButton cmd_Convert 
         Caption         =   "Convert"
         Height          =   255
         Left            =   11415
         TabIndex        =   148
         Top             =   840
         Visible         =   0   'False
         Width           =   735
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   2505
         Index           =   1
         Left            =   105
         TabIndex        =   144
         Top             =   6090
         Width           =   1470
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   1
            Left            =   2880
            TabIndex        =   146
            TabStop         =   0   'False
            Tag             =   "SYD_Id"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.Frame fra_SubDetailItem 
            Height          =   735
            Index           =   1
            Left            =   120
            TabIndex        =   145
            Top             =   240
            Width           =   5055
            Begin VB.TextBox txt_SYD_Order 
               Height          =   285
               Left            =   4560
               TabIndex        =   147
               TabStop         =   0   'False
               Tag             =   "SYD_Order"
               Top             =   240
               Visible         =   0   'False
               Width           =   375
            End
            Begin Project1.ArmCombobox cbo_SysPacking 
               Height          =   345
               Left            =   1560
               TabIndex        =   48
               Tag             =   "PRD_Id®©PRD_Name"
               Top             =   240
               Width           =   2895
               _ExtentX        =   6165
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Packing"
               Height          =   255
               Index           =   38
               Left            =   120
               TabIndex        =   259
               Tag             =   "lbl_SYS_PCK1"
               Top             =   360
               Width           =   1095
            End
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2055
            Index           =   1
            Left            =   5280
            TabIndex        =   53
            Top             =   360
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   3201
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1455
            Index           =   1
            Left            =   120
            TabIndex        =   51
            Tag             =   "grd_S_Pck"
            Top             =   1080
            Width           =   5055
            _ExtentX        =   8916
            _ExtentY        =   2566
         End
      End
      Begin VB.TextBox txt_SYS_Exec 
         Height          =   735
         Left            =   6720
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   47
         Tag             =   "SYS_Exec"
         Top             =   1440
         Width           =   3495
      End
      Begin Project1.ArmCombobox cbo_SYS_Frame 
         Height          =   345
         Left            =   6720
         TabIndex        =   44
         Tag             =   "SYS_Frame"
         Top             =   1080
         Width           =   3495
         _ExtentX        =   6165
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_SYS_UnperfBorderF 
         Height          =   300
         Left            =   9480
         TabIndex        =   56
         Tag             =   "SYS_UBorF®©F®©lbl_SYS_UnperfBorderF"
         Top             =   3120
         Width           =   732
      End
      Begin VB.TextBox txt_SYS_UnperfBorderE 
         Height          =   300
         Left            =   9480
         TabIndex        =   52
         Tag             =   "SYS_UBorE®©F®©lbl_SYS_UnperfBorderE"
         Top             =   2760
         Width           =   732
      End
      Begin VB.TextBox txt_SYS_UnperfBorderD 
         Height          =   300
         Left            =   6960
         TabIndex        =   54
         Tag             =   "SYS_UBorD®©F®©lbl_SYS_UnperfBorderD"
         Top             =   3120
         Width           =   852
      End
      Begin VB.TextBox txt_SYS_UnperfBorderC 
         Height          =   300
         Left            =   6960
         TabIndex        =   50
         Tag             =   "SYS_UBorC®©F®©lbl_SYS_UnperfBorderC"
         Top             =   2760
         Width           =   852
      End
      Begin VB.TextBox txt_SYS_GapFMax 
         Height          =   300
         Left            =   4320
         TabIndex        =   43
         Tag             =   "SYS_GFMax®©F®©lbl_SYS_GapFMax"
         Top             =   4680
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_GapFMin 
         Height          =   300
         Left            =   1560
         TabIndex        =   42
         Tag             =   "SYS_GFMin®©F®©lbl_SYS_GapFMin"
         Top             =   4680
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_GapEMax 
         Height          =   300
         Left            =   4320
         TabIndex        =   41
         Tag             =   "SYS_GEMax®©F®©lbl_SYS_GapEMax"
         Top             =   4320
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_GapEMin 
         Height          =   300
         Left            =   1560
         TabIndex        =   40
         Tag             =   "SYS_GEMin®©F®©lbl_SYS_GapEMin"
         Top             =   4320
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_GapDMax 
         Height          =   300
         Left            =   4320
         TabIndex        =   39
         Tag             =   "SYS_GDMax®©F®©lbl_SYS_GapDMax"
         Top             =   3960
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_GapDMin 
         Height          =   300
         Left            =   1560
         TabIndex        =   38
         Tag             =   "SYS_GDMin®©F®©lbl_SYS_GapDMin"
         Top             =   3960
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_GapCMax 
         Height          =   300
         Left            =   4320
         TabIndex        =   37
         Tag             =   "SYS_GCMax®©F®©lbl_SYS_GapCMax"
         Top             =   3600
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_GapCMin 
         Height          =   300
         Left            =   1560
         TabIndex        =   36
         Tag             =   "SYS_GCMin®©F®©lbl_SYS_GapCMin"
         Top             =   3600
         Width           =   1095
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   0
         Left            =   6960
         TabIndex        =   64
         Tag             =   "0©0"
         Top             =   3480
         Width           =   615
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   0
         Left            =   6120
         TabIndex        =   83
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   3360
         Visible         =   0   'False
         Width           =   255
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1092
         Index           =   0
         Left            =   5520
         ScaleHeight     =   1035
         ScaleWidth      =   1995
         TabIndex        =   82
         Tag             =   "0"
         Top             =   3840
         Width           =   2052
      End
      Begin VB.TextBox txt_SYS_PanelBMax 
         Height          =   300
         Left            =   4320
         TabIndex        =   35
         Tag             =   "SYS_BMax®©F"
         Top             =   3120
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_PanelBMin 
         Height          =   300
         Left            =   1560
         TabIndex        =   33
         Tag             =   "SYS_BMin®©F"
         Top             =   3120
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_PanelAMax 
         Height          =   300
         Left            =   4320
         TabIndex        =   34
         Tag             =   "SYS_AMax®©F"
         Top             =   2760
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_PanelAMin 
         Height          =   300
         Left            =   1560
         TabIndex        =   32
         Tag             =   "SYS_AMin®©F"
         Top             =   2760
         Width           =   1095
      End
      Begin VB.TextBox txt_SYS_Order 
         Height          =   375
         Left            =   6960
         TabIndex        =   49
         Tag             =   "SYS_Order®©N"
         Top             =   2280
         Width           =   375
      End
      Begin Project1.ArmCombobox cbo_SysCategory 
         Height          =   345
         Left            =   1560
         TabIndex        =   31
         Tag             =   "SCT_Id®©SCT_Desc"
         Top             =   2280
         Width           =   3855
         _ExtentX        =   5318
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_SYS_Desc 
         Height          =   780
         Left            =   1560
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   30
         Tag             =   "SYS_Desc"
         Top             =   1440
         Width           =   3855
      End
      Begin VB.TextBox txt_SYS_Name 
         Height          =   300
         Left            =   1560
         MaxLength       =   50
         TabIndex        =   29
         Tag             =   "SYS_Name"
         Top             =   1080
         Width           =   3855
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   0
         Left            =   240
         TabIndex        =   10
         Top             =   240
         Width           =   8415
         _ExtentX        =   14843
         _ExtentY        =   1217
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   0
         Left            =   9120
         TabIndex        =   7
         TabStop         =   0   'False
         Tag             =   "SYS_Id"
         Top             =   360
         Visible         =   0   'False
         Width           =   975
      End
      Begin MSComctlLib.TabStrip tbs_SubDetail 
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   220
         Tag             =   "tbs_sys_dtl"
         Top             =   5760
         Width           =   18015
         _ExtentX        =   31776
         _ExtentY        =   661
         _Version        =   393216
         BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
            NumTabs         =   7
            BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Bending Config"
               Key             =   "bnd"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Packing Config"
               Key             =   "pck"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Gasket Config"
               Key             =   "gsk"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Spacer Config"
               Key             =   "spc"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#GroupParam"
               Key             =   "grp"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab6 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#InlayConfig"
               Key             =   "inl"
               ImageVarType    =   2
            EndProperty
            BeginProperty Tab7 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
               Caption         =   "#Additional value S"
               Key             =   "addvalues"
               ImageVarType    =   2
            EndProperty
         EndProperty
      End
      Begin Project1.ArmCombobox cbo_SYS_Allow 
         Height          =   345
         Index           =   1
         Left            =   10320
         TabIndex        =   67
         Tag             =   "SYS_AllowGD®©SYS_AllowGDName"
         Top             =   2880
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_SYS_Allow 
         Height          =   345
         Index           =   2
         Left            =   10320
         TabIndex        =   68
         Tag             =   "SYS_AllowGE®©SYS_AllowGEName"
         Top             =   3480
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_SYS_Allow 
         Height          =   345
         Index           =   3
         Left            =   10320
         TabIndex        =   69
         Tag             =   "SYS_AllowGF®©SYS_AllowGFName"
         Top             =   4080
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   255
         Index           =   0
         Left            =   10200
         TabIndex        =   16
         TabStop         =   0   'False
         Top             =   480
         Visible         =   0   'False
         Width           =   735
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD Layout File"
         Height          =   255
         Index           =   143
         Left            =   2760
         TabIndex        =   525
         Tag             =   "lbl_SYS_LayCADFile"
         Top             =   5160
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD File"
         Height          =   255
         Index           =   132
         Left            =   7920
         TabIndex        =   505
         Tag             =   "lbl_SYS_CADFile"
         Top             =   5160
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#B7 Type attribute"
         Height          =   255
         Index           =   131
         Left            =   120
         TabIndex        =   503
         Tag             =   "lbl_SYS_BaeType"
         Top             =   5160
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#InlayDec2"
         Height          =   252
         Index           =   127
         Left            =   10320
         TabIndex        =   484
         Tag             =   "lbl_SYS_InlayDec2"
         Top             =   4800
         Width           =   852
      End
      Begin VB.Label lbl_label 
         Caption         =   "#InlayDec1"
         Height          =   252
         Index           =   126
         Left            =   10320
         TabIndex        =   483
         Tag             =   "lbl_SYS_InlayDec1"
         Top             =   4440
         Width           =   852
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Sys Code"
         Height          =   252
         Index           =   100
         Left            =   8040
         TabIndex        =   400
         Tag             =   "lbl_SYS_Code"
         Top             =   2280
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Allow GF"
         Height          =   252
         Index           =   83
         Left            =   10320
         TabIndex        =   343
         Tag             =   "lbl_SYS_AllowGF"
         Top             =   3840
         Width           =   852
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Allow GE"
         Height          =   252
         Index           =   79
         Left            =   10320
         TabIndex        =   342
         Tag             =   "lbl_SYS_AllowGE"
         Top             =   3240
         Width           =   852
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Allow GD"
         Height          =   252
         Index           =   77
         Left            =   10320
         TabIndex        =   341
         Tag             =   "lbl_SYS_AllowGD"
         Top             =   2640
         Width           =   852
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Allow GC"
         Height          =   252
         Index           =   75
         Left            =   10320
         TabIndex        =   340
         Tag             =   "lbl_SYS_AllowGC"
         Top             =   2040
         Width           =   852
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Vendors"
         Height          =   252
         Index           =   60
         Left            =   7920
         TabIndex        =   268
         Tag             =   "lbl_SYS_Vendors"
         Top             =   3480
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SYS IsPan"
         Height          =   252
         Index           =   24
         Left            =   10320
         TabIndex        =   219
         Tag             =   "lbl_SYS_IsPan"
         Top             =   1560
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SYS Fix"
         Height          =   252
         Index           =   13
         Left            =   10320
         TabIndex        =   203
         Tag             =   "lbl_SYS_Fix"
         Top             =   1200
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image"
         Height          =   252
         Index           =   199
         Left            =   5520
         TabIndex        =   142
         Tag             =   "lbl_SYS_Img"
         Top             =   3480
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Exec"
         Height          =   255
         Index           =   90
         Left            =   5520
         TabIndex        =   100
         Tag             =   "lbl_SYS_Exec"
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Frame"
         Height          =   255
         Index           =   53
         Left            =   5520
         TabIndex        =   97
         Tag             =   "lbl_SYS_Frame"
         Top             =   1200
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UnperfBorderF"
         Height          =   252
         Index           =   52
         Left            =   7920
         TabIndex        =   96
         Tag             =   "lbl_SYS_UnperfBorderF"
         Top             =   3120
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UnperfBorderE"
         Height          =   252
         Index           =   51
         Left            =   7920
         TabIndex        =   95
         Tag             =   "lbl_SYS_UnperfBorderE"
         Top             =   2760
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UnperfBorderD"
         Height          =   255
         Index           =   50
         Left            =   5520
         TabIndex        =   94
         Tag             =   "lbl_SYS_UnperfBorderD"
         Top             =   3120
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UnperfBorderC"
         DataField       =   "lbl_SYS_UnperfBorderC"
         Height          =   255
         Index           =   49
         Left            =   5520
         TabIndex        =   93
         Tag             =   "lbl_SYS_UnperfBorderC"
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapFMax"
         Height          =   255
         Index           =   48
         Left            =   2760
         TabIndex        =   92
         Tag             =   "lbl_SYS_GapFMax"
         Top             =   4680
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapFMin"
         Height          =   255
         Index           =   47
         Left            =   120
         TabIndex        =   91
         Tag             =   "lbl_SYS_GapFMin"
         Top             =   4680
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapEMax"
         Height          =   255
         Index           =   46
         Left            =   2760
         TabIndex        =   90
         Tag             =   "lbl_SYS_GapEMax"
         Top             =   4320
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapEMin"
         Height          =   255
         Index           =   45
         Left            =   120
         TabIndex        =   89
         Tag             =   "lbl_SYS_GapEMin"
         Top             =   4320
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapDMax"
         Height          =   255
         Index           =   44
         Left            =   2760
         TabIndex        =   88
         Tag             =   "lbl_SYS_GapDMax"
         Top             =   3960
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapDMin"
         Height          =   255
         Index           =   43
         Left            =   120
         TabIndex        =   87
         Tag             =   "lbl_SYS_GapDMin"
         Top             =   3960
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapCMax"
         Height          =   255
         Index           =   42
         Left            =   2760
         TabIndex        =   86
         Tag             =   "lbl_SYS_GapCMax"
         Top             =   3600
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GapCMin"
         Height          =   255
         Index           =   41
         Left            =   120
         TabIndex        =   85
         Tag             =   "lbl_SYS_GapCMin"
         Top             =   3600
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PanelBMax"
         Height          =   255
         Index           =   9
         Left            =   2760
         TabIndex        =   74
         Tag             =   "lbl_SYS_PanelBMax"
         Top             =   3120
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PanelBMin"
         Height          =   255
         Index           =   8
         Left            =   120
         TabIndex        =   73
         Tag             =   "lbl_SYS_PanelBMin"
         Top             =   3120
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PanelAMax"
         Height          =   255
         Index           =   7
         Left            =   2760
         TabIndex        =   72
         Tag             =   "lbl_SYS_PanelAMax"
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PanelAMin"
         Height          =   255
         Index           =   6
         Left            =   120
         TabIndex        =   71
         Tag             =   "lbl_SYS_PanelAMin"
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Sys Order"
         Height          =   255
         Index           =   5
         Left            =   5520
         TabIndex        =   70
         Tag             =   "lbl_SYS_Order"
         Top             =   2280
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Sys Cat"
         Height          =   255
         Index           =   4
         Left            =   120
         TabIndex        =   62
         Tag             =   "lbl_SYS_Category"
         Top             =   2400
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Sys. Desc"
         Height          =   255
         Index           =   3
         Left            =   120
         TabIndex        =   60
         Tag             =   "lbl_SYS_Desc"
         Top             =   1560
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Sys. Name"
         Height          =   255
         Index           =   2
         Left            =   120
         TabIndex        =   28
         Tag             =   "lbl_SYS_Name"
         Top             =   1200
         Width           =   1335
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Legal Entity Detail"
      Height          =   255
      Index           =   9
      Left            =   15480
      TabIndex        =   424
      Tag             =   "GEN_LegalEntity"
      Top             =   3600
      Width           =   1935
      Begin VB.TextBox txt_LEN_BaeKontoDesc 
         Height          =   852
         Left            =   2040
         MaxLength       =   80
         MultiLine       =   -1  'True
         TabIndex        =   476
         Tag             =   "LEN_BaeKontoDesc"
         Top             =   4440
         Width           =   6252
      End
      Begin VB.TextBox txt_LEN_BaeKonto 
         Height          =   372
         Left            =   2040
         MaxLength       =   30
         TabIndex        =   435
         Tag             =   "LEN_BaeKonto"
         Top             =   3960
         Width           =   6252
      End
      Begin VB.CheckBox chk_AsItem 
         Height          =   252
         Left            =   9960
         TabIndex        =   473
         Tag             =   "LEN_AsItem"
         Top             =   4200
         Width           =   492
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   3735
         Index           =   6
         Left            =   120
         TabIndex        =   456
         Top             =   5280
         Width           =   12972
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   285
            Index           =   6
            Left            =   2760
            TabIndex        =   466
            TabStop         =   0   'False
            Tag             =   "OGT_Id"
            Text            =   "Text1"
            Top             =   120
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.Frame fra_SubDetailItem 
            Height          =   1452
            Index           =   6
            Left            =   240
            TabIndex        =   457
            Top             =   240
            Width           =   11772
            Begin VB.CommandButton cmd_Memo 
               Caption         =   "..."
               Height          =   252
               Left            =   5760
               TabIndex        =   472
               Top             =   960
               Width           =   612
            End
            Begin VB.TextBox txt_ImgId 
               Height          =   285
               Index           =   1
               Left            =   6000
               TabIndex        =   470
               TabStop         =   0   'False
               Tag             =   "IMG_Id®©N"
               Top             =   480
               Visible         =   0   'False
               Width           =   255
            End
            Begin VB.CommandButton cmd_ImageInfo 
               Caption         =   "..."
               Height          =   255
               Index           =   1
               Left            =   10920
               TabIndex        =   463
               Tag             =   "1©1"
               Top             =   240
               Width           =   615
            End
            Begin VB.PictureBox pic_ImgBox 
               AutoRedraw      =   -1  'True
               Height          =   1092
               Index           =   1
               Left            =   6840
               ScaleHeight     =   1035
               ScaleWidth      =   3915
               TabIndex        =   469
               Tag             =   "0"
               Top             =   240
               Width           =   3972
            End
            Begin Project1.ArmCombobox cbo_OGT_MEM_Id 
               Height          =   345
               Left            =   1320
               TabIndex        =   462
               Tag             =   "MEM_Id®©MEM_Name"
               Top             =   960
               Width           =   4335
               _ExtentX        =   7646
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_OGT_CT_Code 
               Height          =   345
               Left            =   1320
               TabIndex        =   458
               Tag             =   "CT_Code®©CT_Desc"
               Top             =   240
               Visible         =   0   'False
               Width           =   1935
               _ExtentX        =   3413
               _ExtentY        =   609
            End
            Begin Project1.ArmCombobox cbo_OGT_Language_Code 
               Height          =   345
               Left            =   1320
               TabIndex        =   460
               Tag             =   "Language_Code®©Language_Desc"
               Top             =   600
               Width           =   1215
               _ExtentX        =   2143
               _ExtentY        =   609
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Language"
               Height          =   252
               Index           =   118
               Left            =   120
               TabIndex        =   468
               Tag             =   "lbl_OGT_Lang"
               Top             =   720
               Width           =   1212
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Country"
               Height          =   252
               Index           =   119
               Left            =   120
               TabIndex        =   464
               Tag             =   "lbl_OGT_CT_Code"
               Top             =   360
               Visible         =   0   'False
               Width           =   1092
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Terms"
               Height          =   252
               Index           =   117
               Left            =   120
               TabIndex        =   461
               Tag             =   "lbl_OGT_Terms"
               Top             =   1080
               Width           =   852
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Logo"
               Height          =   252
               Index           =   116
               Left            =   6000
               TabIndex        =   459
               Tag             =   "lbl_OGT_Logo"
               Top             =   240
               Width           =   612
            End
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   2016
            Index           =   6
            Left            =   12120
            TabIndex        =   465
            Top             =   360
            Width           =   696
            _ExtentX        =   1217
            _ExtentY        =   1217
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1692
            Index           =   6
            Left            =   240
            TabIndex        =   467
            Tag             =   "grd_S_LEN"
            Top             =   1800
            Width           =   11052
            _ExtentX        =   19500
            _ExtentY        =   2990
         End
      End
      Begin VB.TextBox txt_LEN_SlsChan 
         Height          =   405
         Left            =   9960
         MaxLength       =   2
         TabIndex        =   441
         Tag             =   "LEN_SlsChan"
         Top             =   3600
         Width           =   732
      End
      Begin VB.TextBox txt_LEN_SlsOrg 
         Height          =   405
         Left            =   9960
         MaxLength       =   4
         TabIndex        =   440
         Tag             =   "LEN_SlsOrg"
         Top             =   3120
         Width           =   1212
      End
      Begin VB.TextBox Text1 
         Height          =   405
         Left            =   9960
         MaxLength       =   50
         TabIndex        =   439
         Tag             =   "LEN_WWW"
         Top             =   2640
         Width           =   2532
      End
      Begin VB.TextBox txt_LEN_Email 
         Height          =   405
         Left            =   9960
         MaxLength       =   50
         TabIndex        =   438
         Tag             =   "LEN_Email"
         Top             =   2160
         Width           =   2532
      End
      Begin VB.TextBox txt_LEN_Fax 
         Height          =   405
         Left            =   9960
         MaxLength       =   50
         TabIndex        =   437
         Tag             =   "LEN_Fax"
         Top             =   1680
         Width           =   2532
      End
      Begin VB.TextBox txt_LEN_Tel 
         Height          =   405
         Left            =   9960
         MaxLength       =   50
         TabIndex        =   436
         Tag             =   "LEN_Tel"
         Top             =   1200
         Width           =   2532
      End
      Begin VB.TextBox txt_LEN_City 
         Height          =   372
         Left            =   5280
         MaxLength       =   50
         TabIndex        =   433
         Tag             =   "LEN_City"
         Top             =   3120
         Width           =   3015
      End
      Begin VB.TextBox txt_LEN_Zip 
         Height          =   375
         Left            =   2040
         MaxLength       =   10
         TabIndex        =   432
         Tag             =   "LEN_ZIP"
         Top             =   3120
         Width           =   1692
      End
      Begin VB.TextBox txt_LEN_Address2 
         Height          =   375
         Left            =   2040
         MaxLength       =   150
         TabIndex        =   431
         Tag             =   "LEN_Address2"
         Top             =   2640
         Width           =   6255
      End
      Begin VB.TextBox txt_LEN_ShortName 
         Height          =   372
         Left            =   2040
         MaxLength       =   50
         TabIndex        =   426
         Tag             =   "LEN_ShortName"
         Top             =   1200
         Width           =   3015
      End
      Begin VB.TextBox txt_LEN_Name 
         Height          =   375
         Left            =   2040
         MaxLength       =   150
         TabIndex        =   428
         Tag             =   "LEN_Name"
         Top             =   1680
         Width           =   6252
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   9
         Left            =   13080
         TabIndex        =   425
         TabStop         =   0   'False
         Tag             =   "LEN_Id"
         Top             =   1080
         Visible         =   0   'False
         Width           =   1095
      End
      Begin VB.TextBox txt_LEN_Address1 
         Height          =   375
         Left            =   2040
         MaxLength       =   150
         TabIndex        =   430
         Tag             =   "LEN_Address1"
         Top             =   2160
         Width           =   6255
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   9
         Left            =   120
         TabIndex        =   427
         Top             =   240
         Width           =   5175
         _ExtentX        =   9128
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_LEN_CT_Code 
         Height          =   345
         Left            =   2040
         TabIndex        =   434
         Tag             =   "LEN_CT_Code®©CT_Desc"
         Top             =   3600
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   372
         Index           =   9
         Left            =   13080
         TabIndex        =   429
         TabStop         =   0   'False
         Top             =   1440
         Visible         =   0   'False
         Width           =   372
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BaeKonto Desc."
         Height          =   252
         Index           =   122
         Left            =   120
         TabIndex        =   475
         Tag             =   "lbl_LEN_BaeKontoDesc"
         Top             =   4560
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BaeKonto"
         Height          =   252
         Index           =   121
         Left            =   120
         TabIndex        =   474
         Tag             =   "lbl_LEN_BaeKonto"
         Top             =   4080
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Country"
         Height          =   252
         Index           =   120
         Left            =   120
         TabIndex        =   471
         Tag             =   "lbl_LEN_Country"
         Top             =   3720
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#AsItem"
         Height          =   252
         Index           =   115
         Left            =   8640
         TabIndex        =   454
         Tag             =   "lbl_LEN_AsItem"
         Top             =   4200
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SlsChan"
         Height          =   252
         Index           =   114
         Left            =   8640
         TabIndex        =   453
         Tag             =   "lbl_LEN_SlsChan"
         Top             =   3720
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SlsOrg"
         Height          =   252
         Index           =   113
         Left            =   8640
         TabIndex        =   452
         Tag             =   "lbl_LEN_SlsOrg"
         Top             =   3240
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#WWW"
         Height          =   252
         Index           =   112
         Left            =   8640
         TabIndex        =   451
         Tag             =   "lbl_LEN_WWW"
         Top             =   2760
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Email"
         Height          =   252
         Index           =   111
         Left            =   8640
         TabIndex        =   450
         Tag             =   "lbl_LEN_Email"
         Top             =   2280
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Fax"
         Height          =   252
         Index           =   110
         Left            =   8640
         TabIndex        =   449
         Tag             =   "lbl_LEN_Fax"
         Top             =   1800
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Tel"
         Height          =   252
         Index           =   109
         Left            =   8640
         TabIndex        =   448
         Tag             =   "lbl_LEN_Tel"
         Top             =   1320
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#City"
         Height          =   252
         Index           =   108
         Left            =   3960
         TabIndex        =   447
         Tag             =   "lbl_LEN_City"
         Top             =   3240
         Width           =   1212
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ZIP"
         Height          =   252
         Index           =   107
         Left            =   120
         TabIndex        =   446
         Tag             =   "lbl_LEN_Zip"
         Top             =   3240
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Address 2"
         Height          =   252
         Index           =   106
         Left            =   120
         TabIndex        =   445
         Tag             =   "lbl_LEN_Address2"
         Top             =   2760
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Short Name"
         Height          =   252
         Index           =   105
         Left            =   120
         TabIndex        =   444
         Tag             =   "lbl_LEN_ShortName"
         Top             =   1320
         Width           =   1692
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Address 1"
         Height          =   255
         Index           =   104
         Left            =   120
         TabIndex        =   443
         Tag             =   "lbl_LEN_Address1"
         Top             =   2280
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Name"
         Height          =   255
         Index           =   103
         Left            =   120
         TabIndex        =   442
         Tag             =   "lbl_LEN_Name"
         Top             =   1800
         Width           =   1815
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Legal Entity"
      Height          =   252
      Index           =   9
      Left            =   240
      TabIndex        =   417
      Top             =   4440
      Width           =   1212
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   9
         Left            =   240
         TabIndex        =   419
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   9
         Left            =   0
         TabIndex        =   418
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   9
         Left            =   120
         TabIndex        =   420
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   9
         Left            =   120
         TabIndex        =   421
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   9
         Left            =   2040
         TabIndex        =   422
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   9
         Left            =   2040
         TabIndex        =   423
         Tag             =   "grd_M_LegEnt"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "AConfig Detail"
      Height          =   375
      Index           =   8
      Left            =   15720
      TabIndex        =   387
      Tag             =   "DPC_AConfig"
      Top             =   4320
      Width           =   1335
      Begin VB.TextBox txt_CFG_Info 
         Height          =   375
         Left            =   1680
         MaxLength       =   1024
         TabIndex        =   397
         Tag             =   "CFG_Info"
         Top             =   2160
         Width           =   10092
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   8
         Left            =   11880
         TabIndex        =   391
         TabStop         =   0   'False
         Tag             =   "CFG_Key"
         Top             =   1200
         Visible         =   0   'False
         Width           =   1095
      End
      Begin VB.TextBox txt_CFG_Value 
         Height          =   375
         Left            =   1680
         MaxLength       =   250
         TabIndex        =   389
         Tag             =   "CFG_Value"
         Top             =   1680
         Width           =   10092
      End
      Begin VB.TextBox txt_CFG_Key 
         Height          =   405
         Left            =   1680
         MaxLength       =   50
         TabIndex        =   388
         Tag             =   "CFG_Key"
         Top             =   1200
         Width           =   10092
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   8
         Left            =   120
         TabIndex        =   390
         Top             =   240
         Width           =   5175
         _ExtentX        =   9128
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   372
         Index           =   8
         Left            =   11880
         TabIndex        =   395
         TabStop         =   0   'False
         Top             =   1560
         Visible         =   0   'False
         Width           =   372
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CFG Value"
         Height          =   255
         Index           =   99
         Left            =   120
         TabIndex        =   394
         Tag             =   "lbl_DPC_CFG_Value"
         Top             =   1800
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CFG Info"
         Height          =   255
         Index           =   98
         Left            =   120
         TabIndex        =   393
         Tag             =   "lbl_DPC_CFG_Info"
         Top             =   2280
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CFG_Key"
         Height          =   255
         Index           =   94
         Left            =   120
         TabIndex        =   392
         Tag             =   "lbl_DPC_CFG_Key"
         Top             =   1320
         Width           =   975
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "AConfig Main"
      Height          =   252
      Index           =   8
      Left            =   120
      TabIndex        =   380
      Top             =   4080
      Width           =   1332
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   8
         Left            =   0
         TabIndex        =   382
         Top             =   840
         Width           =   1575
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   8
         Left            =   240
         TabIndex        =   381
         Top             =   1920
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   8
         Left            =   120
         TabIndex        =   383
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   8
         Left            =   120
         TabIndex        =   384
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   8
         Left            =   2040
         TabIndex        =   385
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   8
         Left            =   2040
         TabIndex        =   386
         Tag             =   "grd_M_ACfg"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Offer Detail"
      Height          =   252
      Index           =   7
      Left            =   15600
      TabIndex        =   352
      Tag             =   "DPC_Offer"
      Top             =   3120
      Width           =   1212
      Begin VB.TextBox txt_DOF_DTemp 
         Height          =   1092
         Left            =   2040
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   365
         Tag             =   "DOF_DTemp"
         Top             =   5280
         Width           =   6975
      End
      Begin VB.TextBox txt_DOF_NTemp 
         Height          =   1092
         Left            =   2040
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   364
         Tag             =   "DOF_NTemp"
         Top             =   4080
         Width           =   6975
      End
      Begin VB.CheckBox chk_DOF_IsVal0 
         Height          =   255
         Left            =   4320
         TabIndex        =   363
         Tag             =   "DOF_IsVal0"
         Top             =   3720
         Width           =   255
      End
      Begin VB.CheckBox chk_DOF_IsVal 
         Height          =   255
         Left            =   4320
         TabIndex        =   361
         Tag             =   "DOF_IsVal"
         Top             =   3240
         Width           =   375
      End
      Begin VB.CheckBox chk_DOF_IsTxt 
         Height          =   255
         Left            =   4320
         TabIndex        =   359
         Tag             =   "DOF_IsTxt"
         Top             =   2760
         Width           =   255
      End
      Begin VB.CheckBox chk_DOF_CanInv 
         Height          =   255
         Left            =   2040
         TabIndex        =   362
         Tag             =   "DOF_CanInv"
         Top             =   3720
         Width           =   255
      End
      Begin VB.CheckBox chk_DOF_IsStp 
         Height          =   255
         Left            =   2040
         TabIndex        =   360
         Tag             =   "DOF_IsStp"
         Top             =   3240
         Width           =   375
      End
      Begin VB.CheckBox chk_DOF_IsSchg 
         Height          =   255
         Left            =   2040
         TabIndex        =   358
         Tag             =   "DOF_IsSchg"
         Top             =   2760
         Width           =   375
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   7
         Left            =   8160
         TabIndex        =   356
         TabStop         =   0   'False
         Tag             =   "DOF_Id"
         Top             =   360
         Visible         =   0   'False
         Width           =   1095
      End
      Begin VB.TextBox txt_DOF_Name 
         Height          =   375
         Left            =   2040
         MaxLength       =   250
         TabIndex        =   353
         Tag             =   "DOF_Name"
         Top             =   1200
         Width           =   4815
      End
      Begin VB.TextBox txt_DOF_Desc 
         Height          =   855
         Left            =   2040
         MaxLength       =   250
         TabIndex        =   357
         Tag             =   "DOF_Desc"
         Top             =   1680
         Width           =   7095
      End
      Begin VB.TextBox txt_DOF_Order 
         Height          =   405
         Left            =   8400
         TabIndex        =   355
         Tag             =   "DOF_Order®©N"
         Top             =   1200
         Width           =   735
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   7
         Left            =   120
         TabIndex        =   354
         Top             =   240
         Width           =   5175
         _ExtentX        =   9128
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   7
         Left            =   9360
         TabIndex        =   369
         TabStop         =   0   'False
         Top             =   360
         Visible         =   0   'False
         Width           =   375
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF DTemp"
         Height          =   252
         Index           =   102
         Left            =   120
         TabIndex        =   377
         Tag             =   "lbl_DOF_DTemp"
         Top             =   5400
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF NTemp"
         Height          =   255
         Index           =   101
         Left            =   120
         TabIndex        =   376
         Tag             =   "lbl_DOF_NTemp"
         Top             =   4200
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF IsVal0"
         Height          =   255
         Index           =   97
         Left            =   2640
         TabIndex        =   375
         Tag             =   "lbl_DOF_IsVal0"
         Top             =   3720
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF IsVal"
         Height          =   255
         Index           =   96
         Left            =   2640
         TabIndex        =   374
         Tag             =   "lbl_DOF_IsVal"
         Top             =   3240
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF IsTxt"
         Height          =   255
         Index           =   95
         Left            =   2640
         TabIndex        =   373
         Tag             =   "lbl_DOF_IsTxt"
         Top             =   2760
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF CanInv"
         Height          =   255
         Index           =   92
         Left            =   120
         TabIndex        =   372
         Tag             =   "lbl_DOF_CanInv"
         Top             =   3720
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF IsStp"
         Height          =   255
         Index           =   91
         Left            =   120
         TabIndex        =   371
         Tag             =   "lbl_DOF_IsStp"
         Top             =   3240
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF IsSchg"
         Height          =   255
         Index           =   89
         Left            =   120
         TabIndex        =   370
         Tag             =   "lbl_DOF_IsSchg"
         Top             =   2760
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF Name:"
         Height          =   255
         Index           =   87
         Left            =   120
         TabIndex        =   368
         Tag             =   "lbl_DOF_Name"
         Top             =   1320
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF Desc"
         Height          =   255
         Index           =   86
         Left            =   120
         TabIndex        =   367
         Tag             =   "lbl_DOF_Desc"
         Top             =   1800
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF Order"
         Height          =   255
         Index           =   85
         Left            =   7320
         TabIndex        =   366
         Tag             =   "lbl_DOF_Order"
         Top             =   1320
         Width           =   975
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Offer Main"
      Height          =   252
      Index           =   7
      Left            =   120
      TabIndex        =   344
      Top             =   3720
      Width           =   1212
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   1335
         Index           =   7
         Left            =   0
         TabIndex        =   346
         Top             =   360
         Width           =   2055
         Begin Project1.ArmCombobox cbo_DOF_SourceFilter 
            Height          =   345
            Left            =   120
            TabIndex        =   379
            Tag             =   "DOF_Source®©DOF_SourceName"
            Top             =   720
            Width           =   1815
            _ExtentX        =   3201
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#DOF Source"
            Height          =   255
            Index           =   93
            Left            =   120
            TabIndex        =   378
            Tag             =   "lbl_DOF_Source"
            Top             =   360
            Width           =   1695
         End
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   7
         Left            =   240
         TabIndex        =   345
         Top             =   2400
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   7
         Left            =   120
         TabIndex        =   347
         Top             =   1800
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   7
         Left            =   120
         TabIndex        =   348
         Top             =   2280
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   7
         Left            =   2400
         TabIndex        =   349
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   7
         Left            =   2400
         TabIndex        =   350
         Tag             =   "grd_M_Ofr"
         Top             =   1200
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Group Detail"
      Height          =   252
      Index           =   6
      Left            =   15720
      TabIndex        =   277
      Top             =   2760
      Width           =   1092
      Begin VB.TextBox txt_GRP_Desc 
         Height          =   375
         Left            =   1440
         MaxLength       =   250
         TabIndex        =   286
         Tag             =   "GRP_Desc"
         Top             =   1800
         Width           =   6015
      End
      Begin VB.TextBox txt_GRP_Name 
         Height          =   375
         Left            =   1440
         MaxLength       =   80
         TabIndex        =   285
         Tag             =   "GRP_Name"
         Top             =   1320
         Width           =   3615
      End
      Begin VB.TextBox txt_GRP_Order 
         Height          =   375
         Left            =   1440
         TabIndex        =   292
         Tag             =   "GRP_Order®©N"
         Top             =   3720
         Width           =   735
      End
      Begin Project1.ArmCombobox cbo_GRP_Priority 
         Height          =   345
         Left            =   1440
         TabIndex        =   291
         Tag             =   "GRP_Priority®©GRP_Priority"
         Top             =   3240
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_GRP_Group 
         Height          =   375
         Left            =   1440
         MaxLength       =   10
         TabIndex        =   290
         Tag             =   "GRP_Group"
         Top             =   2760
         Width           =   2415
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   6
         Left            =   8880
         TabIndex        =   278
         TabStop         =   0   'False
         Tag             =   "GRP_Id"
         Top             =   1320
         Visible         =   0   'False
         Width           =   1695
      End
      Begin Project1.ArmCombobox cbo_GRP_Type 
         Height          =   345
         Left            =   1440
         TabIndex        =   288
         Tag             =   "GRP_Type®©GRP_TypeName"
         Top             =   2280
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   609
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   6
         Left            =   240
         TabIndex        =   279
         Top             =   480
         Width           =   8535
         _ExtentX        =   15055
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   6
         Left            =   10680
         TabIndex        =   282
         TabStop         =   0   'False
         Top             =   1200
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GRP Desc"
         Height          =   255
         Index           =   62
         Left            =   240
         TabIndex        =   289
         Tag             =   "lbl_GRP_Desc"
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GRP Name"
         Height          =   255
         Index           =   61
         Left            =   240
         TabIndex        =   287
         Tag             =   "lbl_GRP_Name"
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GRP Order"
         Height          =   255
         Index           =   68
         Left            =   240
         TabIndex        =   284
         Tag             =   "lbl_GRP_Priority"
         Top             =   3840
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GRP Priority"
         Height          =   255
         Index           =   67
         Left            =   240
         TabIndex        =   283
         Tag             =   "lbl_GRP_Priority"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GRP Group"
         Height          =   255
         Index           =   66
         Left            =   240
         TabIndex        =   281
         Tag             =   "lbl_GRP_Group"
         Top             =   2880
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#GRP Type"
         Height          =   255
         Index           =   65
         Left            =   240
         TabIndex        =   280
         Tag             =   "lbl_GRP_Type"
         Top             =   2400
         Width           =   1095
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Group Main"
      Height          =   252
      Index           =   6
      Left            =   120
      TabIndex        =   269
      Top             =   3360
      Width           =   1212
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   6
         Left            =   240
         TabIndex        =   271
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   6
         Left            =   0
         TabIndex        =   270
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   6
         Left            =   120
         TabIndex        =   272
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   6
         Left            =   120
         TabIndex        =   273
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   6
         Left            =   2040
         TabIndex        =   274
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   6
         Left            =   2040
         TabIndex        =   275
         Tag             =   "grd_M_Grp"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_EditValue 
      Caption         =   "#Edit Value"
      Height          =   255
      Left            =   15720
      TabIndex        =   202
      Top             =   240
      Visible         =   0   'False
      Width           =   1095
      Begin VB.TextBox txt_Value 
         Height          =   375
         Left            =   600
         TabIndex        =   195
         Top             =   480
         Width           =   975
      End
      Begin VB.CommandButton btn_Validate 
         Height          =   615
         Left            =   2280
         Style           =   1  'Graphical
         TabIndex        =   196
         Top             =   360
         Width           =   735
      End
      Begin VB.CommandButton btn_Quit 
         Height          =   615
         Left            =   3120
         Style           =   1  'Graphical
         TabIndex        =   197
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "MatThick Main"
      Height          =   375
      Index           =   5
      Left            =   240
      TabIndex        =   186
      Top             =   4920
      Width           =   1455
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   5
         Left            =   0
         TabIndex        =   188
         Top             =   840
         Width           =   1575
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   5
         Left            =   240
         TabIndex        =   187
         Top             =   1920
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   5
         Left            =   120
         TabIndex        =   189
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   5
         Left            =   120
         TabIndex        =   190
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   5
         Left            =   2040
         TabIndex        =   191
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   5
         Left            =   2040
         TabIndex        =   192
         Tag             =   "grd_M_Mth"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "DPC_PU Detail"
      Height          =   252
      Index           =   4
      Left            =   15720
      TabIndex        =   170
      Top             =   2040
      Width           =   1332
      Begin VB.TextBox txt_PUN_HMax 
         Height          =   375
         Left            =   8280
         TabIndex        =   160
         Tag             =   "PUN_HMax®©F"
         Top             =   4320
         Width           =   1215
      End
      Begin VB.TextBox txt_PUN_HMin 
         Height          =   375
         Left            =   8280
         TabIndex        =   159
         Tag             =   "PUN_HMin®©F"
         Top             =   3840
         Width           =   1215
      End
      Begin Project1.ArmCombobox cbo_PU_BND 
         Height          =   345
         Index           =   3
         Left            =   1800
         TabIndex        =   154
         Tag             =   "BND_IdF®©BND_NameF"
         Top             =   3360
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_PU_BND 
         Height          =   345
         Index           =   2
         Left            =   1800
         TabIndex        =   153
         Tag             =   "BND_IdE®©BND_NameE"
         Top             =   2880
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_PU_BND 
         Height          =   345
         Index           =   1
         Left            =   1800
         TabIndex        =   152
         Tag             =   "BND_IdD®©BND_NameD"
         Top             =   2400
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_PU_BND 
         Height          =   345
         Index           =   0
         Left            =   1800
         TabIndex        =   151
         Tag             =   "BND_IdC®©BND_NameC"
         Top             =   1920
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   4
         Left            =   8640
         TabIndex        =   171
         TabStop         =   0   'False
         Tag             =   "PUN_Id"
         Top             =   1440
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.TextBox txt_PUN_BMax 
         Height          =   375
         Left            =   5160
         TabIndex        =   158
         Tag             =   "PUN_BMax®©F"
         Top             =   4320
         Width           =   1215
      End
      Begin VB.TextBox txt_PUN_PU 
         Height          =   405
         Left            =   1800
         TabIndex        =   161
         Tag             =   "PUN_PU®©N"
         Top             =   4800
         Width           =   495
      End
      Begin VB.TextBox txt_PUN_AMin 
         Height          =   375
         Left            =   1800
         TabIndex        =   155
         Tag             =   "PUN_AMin®©F"
         Top             =   3840
         Width           =   1215
      End
      Begin VB.TextBox txt_PUN_AMax 
         Height          =   375
         Left            =   1800
         TabIndex        =   156
         Tag             =   "PUN_AMax®©F"
         Top             =   4320
         Width           =   1215
      End
      Begin VB.TextBox txt_PUN_BMin 
         Height          =   375
         Left            =   5160
         TabIndex        =   157
         Tag             =   "PUN_BMin®©F"
         Top             =   3840
         Width           =   1215
      End
      Begin Project1.ArmCombobox cbo_PU_SYS 
         Height          =   345
         Left            =   1800
         TabIndex        =   150
         Tag             =   "SYS_Id®©SYS_Name"
         Top             =   1440
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   609
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   4
         Left            =   240
         TabIndex        =   149
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   4
         Left            =   8640
         TabIndex        =   178
         TabStop         =   0   'False
         Top             =   1920
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HMax"
         Height          =   255
         Index           =   229
         Left            =   6960
         TabIndex        =   185
         Tag             =   "lbl_PUN_HMax"
         Top             =   4440
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HMin"
         Height          =   255
         Index           =   228
         Left            =   6960
         TabIndex        =   184
         Tag             =   "lbl_PUN_HMin"
         Top             =   3960
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BND IdF"
         Height          =   255
         Index           =   227
         Left            =   360
         TabIndex        =   183
         Tag             =   "lbl_PUN_BND_IdF"
         Top             =   3480
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BND IdE"
         Height          =   255
         Index           =   226
         Left            =   360
         TabIndex        =   182
         Tag             =   "lbl_PUN_BND_IdE"
         Top             =   3000
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BND IdD"
         Height          =   255
         Index           =   225
         Left            =   360
         TabIndex        =   181
         Tag             =   "lbl_PUN_BND_IdD"
         Top             =   2520
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BND IdC"
         Height          =   375
         Index           =   224
         Left            =   360
         TabIndex        =   180
         Tag             =   "lbl_PUN_BND_IdC"
         Top             =   2040
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BMax"
         Height          =   255
         Index           =   223
         Left            =   3720
         TabIndex        =   177
         Tag             =   "lbl_PUN_BMax"
         Top             =   4440
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PUN_PU"
         Height          =   255
         Index           =   222
         Left            =   360
         TabIndex        =   176
         Tag             =   "lbl_PUN_PU"
         Top             =   4920
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#AMin"
         Height          =   255
         Index           =   221
         Left            =   360
         TabIndex        =   175
         Tag             =   "lbl_PUN_AMin"
         Top             =   3960
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#AMax"
         Height          =   255
         Index           =   220
         Left            =   360
         TabIndex        =   174
         Tag             =   "lbl_PUN_AMax"
         Top             =   4440
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SYS Id"
         Height          =   255
         Index           =   219
         Left            =   360
         TabIndex        =   173
         Tag             =   "lbl_PU_SYS_Id"
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BMin"
         Height          =   255
         Index           =   218
         Left            =   3720
         TabIndex        =   172
         Tag             =   "lbl_PUN_BMin"
         Top             =   3960
         Width           =   1335
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "DPC_PU Main"
      Height          =   252
      Index           =   4
      Left            =   120
      TabIndex        =   163
      Top             =   2640
      Width           =   1212
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   4
         Left            =   240
         TabIndex        =   165
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   4
         Left            =   0
         TabIndex        =   164
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   4
         Left            =   120
         TabIndex        =   166
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   4
         Left            =   120
         TabIndex        =   167
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   4
         Left            =   2040
         TabIndex        =   168
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   4
         Left            =   2040
         TabIndex        =   169
         Tag             =   "grd_M_PU"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Coil Detail"
      Height          =   252
      Index           =   3
      Left            =   15720
      TabIndex        =   132
      Top             =   1680
      Width           =   972
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   3
         Left            =   6360
         TabIndex        =   140
         TabStop         =   0   'False
         Tag             =   "COI_Id"
         Top             =   1320
         Visible         =   0   'False
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_Material 
         Height          =   345
         Left            =   1800
         TabIndex        =   134
         Tag             =   "MAT_Id®©MAT_Name"
         Top             =   1320
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_COI_Width 
         Height          =   375
         Left            =   1800
         TabIndex        =   136
         Tag             =   "COI_Width®©F"
         Top             =   2280
         Width           =   1215
      End
      Begin VB.TextBox txt_COI_Thick 
         Height          =   375
         Left            =   1800
         TabIndex        =   135
         Tag             =   "COI_Thick®©F"
         Top             =   1800
         Width           =   1215
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   3
         Left            =   360
         TabIndex        =   133
         Top             =   480
         Width           =   3015
         _ExtentX        =   5318
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   3
         Left            =   6360
         TabIndex        =   141
         TabStop         =   0   'False
         Top             =   1800
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#COI Width"
         Height          =   255
         Index           =   76
         Left            =   360
         TabIndex        =   139
         Tag             =   "lbl_COI_Width"
         Top             =   2400
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#COI Thick"
         Height          =   255
         Index           =   78
         Left            =   360
         TabIndex        =   138
         Tag             =   "lbl_COI_Thick"
         Top             =   1920
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Name"
         Height          =   375
         Index           =   80
         Left            =   360
         TabIndex        =   137
         Tag             =   "lbl_COI_MAT_Name"
         Top             =   1440
         Width           =   1095
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Coil Main"
      Height          =   252
      Index           =   3
      Left            =   120
      TabIndex        =   125
      Top             =   2280
      Width           =   1092
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   3
         Left            =   0
         TabIndex        =   127
         Top             =   840
         Width           =   1575
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   3
         Left            =   240
         TabIndex        =   126
         Top             =   1920
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   3
         Left            =   120
         TabIndex        =   128
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   3
         Left            =   120
         TabIndex        =   129
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   3
         Left            =   2040
         TabIndex        =   130
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   3
         Left            =   2040
         TabIndex        =   131
         Tag             =   "grd_M_Coi"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Material Detail"
      Height          =   255
      Index           =   2
      Left            =   15870
      TabIndex        =   109
      Top             =   4935
      Width           =   1785
      Begin VB.Frame fra_Sifyb_BI_Link 
         Caption         =   "#Sifyb Base Item link"
         Height          =   1920
         Index           =   0
         Left            =   5805
         TabIndex        =   507
         Top             =   4140
         Width           =   6780
         Begin Project1.ArmCombobox cbo_BI_BaseMaterial 
            Height          =   345
            Left            =   1965
            TabIndex        =   509
            Tag             =   "BML_Code®©BML_Desc"
            Top             =   270
            Width           =   4560
            _ExtentX        =   8043
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Base Material"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   133
            Left            =   75
            TabIndex        =   508
            Tag             =   "lbl_BaseMaterial"
            Top             =   345
            Width           =   1455
         End
      End
      Begin VB.TextBox txt_MAT_CustTariff 
         Height          =   405
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   501
         Tag             =   "MAT_CustTariff"
         Top             =   5640
         Width           =   3255
      End
      Begin VB.TextBox txt_MAT_BaeType 
         Height          =   375
         Left            =   2400
         TabIndex        =   499
         Tag             =   "MAT_BaeType®©N"
         Top             =   5160
         Width           =   1215
      End
      Begin VB.TextBox txt_MAT_SAPCommodity 
         Height          =   405
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   480
         Tag             =   "MAT_SAPCommodity"
         Top             =   4200
         Width           =   3252
      End
      Begin VB.TextBox txt_MAT_CE 
         Height          =   405
         Left            =   2400
         TabIndex        =   478
         Tag             =   "MAT_CE®©N"
         Top             =   4680
         Width           =   1212
      End
      Begin VB.TextBox txt_MAT_MaxCut 
         Height          =   405
         Left            =   7560
         TabIndex        =   121
         Tag             =   "MAT_MaxCut®©N"
         Top             =   2880
         Width           =   1095
      End
      Begin VB.TextBox txt_MAT_WiStep 
         Height          =   405
         Left            =   7560
         TabIndex        =   120
         Tag             =   "MAT_WiStep®©N"
         Top             =   2400
         Width           =   1095
      End
      Begin VB.TextBox txt_MAT_OrdQty 
         Height          =   405
         Left            =   7560
         TabIndex        =   119
         Tag             =   "MAT_OrdQty®©N"
         Top             =   1920
         Width           =   1095
      End
      Begin VB.TextBox txt_MAT_Werk 
         Height          =   375
         Left            =   2400
         MaxLength       =   10
         TabIndex        =   115
         Tag             =   "MAT_Werk"
         Top             =   3360
         Width           =   2655
      End
      Begin VB.CheckBox chk_MAT_IsCus 
         Height          =   255
         Left            =   2400
         TabIndex        =   116
         Tag             =   "MAT_IsCus"
         Top             =   3840
         Width           =   615
      End
      Begin VB.TextBox txt_MAT_Prefx 
         Height          =   375
         Left            =   2400
         MaxLength       =   10
         TabIndex        =   114
         Tag             =   "MAT_Prefx"
         Top             =   2880
         Width           =   2655
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   2
         Left            =   10200
         TabIndex        =   112
         TabStop         =   0   'False
         Tag             =   "MAT_Id"
         Top             =   1440
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.TextBox txt_MAT_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   50
         TabIndex        =   111
         Tag             =   "MAT_Name"
         Top             =   1440
         Width           =   3255
      End
      Begin VB.TextBox txt_MAT_Order 
         Height          =   405
         Left            =   7560
         TabIndex        =   118
         Tag             =   "MAT_Order®©N"
         Top             =   1440
         Width           =   495
      End
      Begin VB.TextBox txt_MAT_Desc 
         Height          =   735
         Left            =   2400
         MaxLength       =   250
         TabIndex        =   113
         Tag             =   "MAT_Desc"
         Top             =   1920
         Width           =   3255
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   2
         Left            =   240
         TabIndex        =   110
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   2
         Left            =   10200
         TabIndex        =   124
         TabStop         =   0   'False
         Top             =   1920
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Cust Tariff"
         Height          =   255
         Index           =   130
         Left            =   360
         TabIndex        =   502
         Tag             =   "lbl_MAT_CustTariff"
         Top             =   5760
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#B7 Type Attribute"
         Height          =   255
         Index           =   129
         Left            =   360
         TabIndex        =   500
         Tag             =   "lbl_MAT_BaeType"
         Top             =   5280
         Width           =   2055
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT SAP Commodity"
         Height          =   252
         Index           =   124
         Left            =   360
         TabIndex        =   479
         Tag             =   "lbl_MAT_SAP"
         Top             =   4320
         Width           =   1932
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT CE"
         Height          =   252
         Index           =   123
         Left            =   360
         TabIndex        =   477
         Tag             =   "lbl_MAT_CE"
         Top             =   4800
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT MaxCut"
         Height          =   255
         Index           =   23
         Left            =   5880
         TabIndex        =   218
         Tag             =   "lbl_MAT_MaxCut"
         Top             =   3000
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT WiStep"
         Height          =   255
         Index           =   22
         Left            =   5880
         TabIndex        =   217
         Tag             =   "lbl_MAT_WiStep"
         Top             =   2520
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT OrdQty"
         Height          =   255
         Index           =   21
         Left            =   5880
         TabIndex        =   216
         Tag             =   "lbl_MAT_OrdQty"
         Top             =   2040
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Werk"
         Height          =   255
         Index           =   20
         Left            =   360
         TabIndex        =   215
         Tag             =   "lbl_MAT_Werk"
         Top             =   3480
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is Cus"
         Height          =   255
         Index           =   14
         Left            =   360
         TabIndex        =   162
         Tag             =   "lbl_MAT_IsCus"
         Top             =   3840
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Prefx"
         Height          =   255
         Index           =   208
         Left            =   360
         TabIndex        =   143
         Tag             =   "lbl_MAT_Prefx"
         Top             =   3000
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Name"
         Height          =   255
         Index           =   81
         Left            =   360
         TabIndex        =   123
         Tag             =   "lbl_MAT_Name"
         Top             =   1560
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Order"
         Height          =   255
         Index           =   84
         Left            =   5880
         TabIndex        =   122
         Tag             =   "lbl_MAT_Order"
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MAT Desc"
         Height          =   255
         Index           =   82
         Left            =   360
         TabIndex        =   117
         Tag             =   "lbl_MAT_Desc"
         Top             =   2040
         Width           =   1815
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Material Main"
      Height          =   252
      Index           =   2
      Left            =   120
      TabIndex        =   102
      Top             =   1920
      Width           =   1092
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   2
         Left            =   240
         TabIndex        =   104
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   2
         Left            =   0
         TabIndex        =   103
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   2
         Left            =   120
         TabIndex        =   105
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   2
         Left            =   120
         TabIndex        =   106
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   2
         Left            =   2040
         TabIndex        =   107
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   2
         Left            =   2040
         TabIndex        =   108
         Tag             =   "grd_M_Mat"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   4
      Left            =   9840
      TabIndex        =   99
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   3
      Left            =   9120
      TabIndex        =   98
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   2
      Left            =   8400
      TabIndex        =   84
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   1
      Left            =   7680
      TabIndex        =   27
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "SysCat Main"
      Height          =   252
      Index           =   1
      Left            =   120
      TabIndex        =   20
      Top             =   1560
      Width           =   1092
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   1
         Left            =   3120
         TabIndex        =   26
         Top             =   480
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1695
         Index           =   1
         Left            =   3120
         TabIndex        =   25
         Tag             =   "grd_M_Cat"
         Top             =   1440
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   2990
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   855
         Index           =   1
         Left            =   240
         TabIndex        =   24
         Top             =   2280
         Width           =   1215
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1215
         Index           =   1
         Left            =   120
         TabIndex        =   23
         Top             =   2160
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   2143
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   1
         Left            =   120
         TabIndex        =   22
         Top             =   1680
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   609
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   495
         Index           =   1
         Left            =   0
         TabIndex        =   21
         Top             =   960
         Width           =   2895
      End
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   0
      Left            =   6960
      TabIndex        =   13
      Tag             =   "lbl_MainTab_System"
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "SysCat Detail"
      Height          =   252
      Index           =   1
      Left            =   15750
      TabIndex        =   4
      Tag             =   "DPC_SysCategory"
      Top             =   1275
      Width           =   1092
      Begin VB.TextBox txt_SCT_Order 
         Height          =   405
         Left            =   5880
         TabIndex        =   79
         Tag             =   "SCT_Order®©N"
         Top             =   1200
         Width           =   975
      End
      Begin VB.TextBox txt_SCT_Desc 
         Height          =   375
         Left            =   2040
         MaxLength       =   250
         TabIndex        =   78
         Tag             =   "SCT_Desc"
         Top             =   1680
         Width           =   4815
      End
      Begin VB.TextBox txt_SCT_Name 
         Height          =   375
         Left            =   2040
         MaxLength       =   50
         TabIndex        =   77
         Tag             =   "SCT_Name"
         Top             =   1200
         Width           =   2415
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   1
         Left            =   120
         TabIndex        =   11
         Top             =   240
         Width           =   5175
         _ExtentX        =   9128
         _ExtentY        =   1217
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   1
         Left            =   7200
         TabIndex        =   8
         TabStop         =   0   'False
         Tag             =   "SCT_Id"
         Top             =   1200
         Visible         =   0   'False
         Width           =   1095
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   1
         Left            =   7200
         TabIndex        =   17
         TabStop         =   0   'False
         Top             =   1680
         Visible         =   0   'False
         Width           =   375
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SCT Order"
         Height          =   255
         Index           =   15
         Left            =   4800
         TabIndex        =   81
         Tag             =   "lbl_SCAT_Order"
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SCT_Desc"
         Height          =   255
         Index           =   12
         Left            =   120
         TabIndex        =   80
         Tag             =   "lbl_SCAT_Desc"
         Top             =   1800
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SCT_Name:"
         Height          =   255
         Index           =   11
         Left            =   120
         TabIndex        =   76
         Tag             =   "lbl_SCAT_Name"
         Top             =   1320
         Width           =   1815
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "System Main"
      Height          =   285
      Index           =   0
      Left            =   120
      TabIndex        =   1
      Top             =   1200
      Width           =   1260
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   855
         Index           =   0
         Left            =   360
         TabIndex        =   19
         Top             =   2880
         Width           =   975
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1935
         Index           =   0
         Left            =   120
         TabIndex        =   18
         Top             =   2760
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   3413
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Filter"
         Height          =   1335
         Index           =   0
         Left            =   0
         TabIndex        =   14
         Top             =   720
         Width           =   2895
         Begin Project1.ArmCombobox cbo_SysCategory_Filter 
            Height          =   345
            Left            =   240
            TabIndex        =   101
            Tag             =   "SCT_Id®©SCT_Desc"
            Top             =   840
            Width           =   2415
            _ExtentX        =   4260
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Sys Category:"
            Height          =   255
            Index           =   10
            Left            =   240
            TabIndex        =   75
            Tag             =   "lbl_SysCategory_Filter"
            Top             =   480
            Width           =   1695
         End
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   0
         Left            =   120
         TabIndex        =   12
         Top             =   2280
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   609
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   3375
         Index           =   0
         Left            =   3000
         TabIndex        =   6
         Tag             =   "grd_M_Sys"
         Top             =   1320
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   5953
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   0
         Left            =   3000
         TabIndex        =   5
         Top             =   480
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   1217
      End
   End
   Begin MSComDlg.CommonDialog dlg_Common 
      Left            =   6240
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin MSComctlLib.TabStrip tbs_Main 
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   0
      Width           =   5655
      _ExtentX        =   9975
      _ExtentY        =   661
      MultiRow        =   -1  'True
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   10
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab6 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab7 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab8 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab9 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab10 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   5
      Left            =   10560
      TabIndex        =   200
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   6
      Left            =   11280
      TabIndex        =   276
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   7
      Left            =   12000
      TabIndex        =   351
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   8
      Left            =   12720
      TabIndex        =   396
      Top             =   120
      Width           =   735
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   372
      Index           =   9
      Left            =   13440
      TabIndex        =   455
      Top             =   120
      Width           =   732
      _ExtentX        =   1296
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Menu mnu_EAS 
      Caption         =   ""
   End
End
Attribute VB_Name = "DPC_Ref_Sys"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Option Compare Text
'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK API FUNCTION DECLARES
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (lpPictDesc As PictDesc, riid As Guid, ByVal fPictureOwnsHandle As Long, ipic As IPicture) As Long
Private Declare Function LoadLibrary Lib "Kernel32" Alias "LoadLibraryA" _
   (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "Kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadIconFromDLL Lib "user32" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Long) As Long
Private Declare Function GetLocaleInfo Lib "Kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Declare Function GetSystemDefaultLCID Lib "Kernel32" () As Long

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK VARIABLES
'**********************************************************************************************************************************
'**********************************************************************************************************************************

#If ENV = LIVE Then
    Dim mo_Db As Object
#Else
    Dim mo_Db As ARMSYSCOMLib.ArmDb
#End If

#If ENV = LIVE Then
    Dim mo_FSO As Object
#Else
    Dim mo_FSO As Scripting.FileSystemObject
#End If

#If ENV = LIVE Then
    Dim mo_Sys As Object
#Else
    Dim mo_Sys As ARMSYSCOMLib.ArmSYS
#End If

Private mo_Tools                        As DPC_Tools
Private mo_WshNetwork                   As Object
Private ms_Language_Code                As String       'current user interface language
Private ml_U_Code                       As Long         'U_Code (GEN_Systems_Users) of logged user
Private ms_LoginName                    As String       'contain loginname
Private ms_UserName                     As String       'contain name of logged user as defined in GEN_People
Private mb_InternalInit                 As Boolean      'framework is doing some own control manipulation, all events should handle
Private mb_CurrentTextBoxChanged        As Boolean
Private mc_Item                         As Long         'cursor which will contain currently loaded detail data
Private mc_Toolbars                     As Long         'cursor which will contain all toolbars for current usercontrol
Private ms_ToolbarRequest               As String       'request which load all toolbars for current usercontrol
Private mo_DocumentType                 As Collection
Private ml_MaxZipRecordCount            As Long
Private ms_DocumentServerDir            As String
Private ms_NetworkBoardID               As String
Private ms_ComputerName                 As String

Private mb_Initialized                  As Boolean      'framework is initialised or not
Private m_ConnectString                 As String       'connection string to connect SQL database
Private use_framework_connection        As Integer      'if framework should use outside connected armdb or its own connection
Private ms_DecimalSeparator             As String       'locale decimal separator
Private ms_ThousandSeparator            As String       'locale thousand separator
Private mc_ScreenLabels                 As Long         'cursor containing screen constants for current component

Private ms_PicPath                      As String       'used to save images from database

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK CONSTANTS
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Private Const SEP = "®©"
Private Const C_SEP As String = "@@"
Private Const SEP1 As String = "®"
Private Const SEP2 As String = "©"

Private Const MODULE_NAME As String = "DPC_Ref"
Private Const SCREEN_NAME As String = "DPC_Ref_Sys"
Private Const LOCALE_USER_DEFAULT = &H400
Private Const STATUS_COLUMN = "RowStatus"
Private Const ICON_RELOAD = 115

Private Const SW_SHOWNORMAL = 1

Private Const LOCALE_SDECIMAL = &HE ' Decimal separator
Private Const LOCALE_STHOUSAND = &HF ' Thousand separator
Private Const CL_COLOR_ENABLED As Long = &H80000005
Private Const CL_COLOR_DISABLED As Long = &H8000000F
Private Const CL_COLOR_LOCKED As Long = &H80000018
Private Const C_ERRORRAISE As Long = 2500
Private Const C_MSG_ID_BASE As Long = 9800

Private Const FRM_SPACE_VER = 120
Private Const FRM_SPACE_HOR = 100

Private Const C_SERVICE_USER As String = "NXT"
Private Const C_SERVICE_PASSW As String = "ous42pri"
Private Const C_DOCUMENT_TYPE_GR_CODE As Long = 70
Private Const C_ERROR_FILES_DIR As String = "Bad_Files"

Private Const IMAGE_CLICK_MSG = "Image clicked"

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK CUSTOM TYPES
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Private Type PictDesc
    cbSizeofStruct As Long
    picType As Long
    hImage As Long
    xExt As Long
    yExt As Long
End Type

Private Type Guid
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(0 To 7) As Byte
End Type

Private Type TTreeViewInfo
    Levels As Long
    NodeRequest() As String
    GridRequest() As String
    ExcelRequest() As String
    CountRequest() As String
    FindRequest() As String
    Images() As Integer
    SelectedImages() As Integer
    TreeViewCode As String
    Loaded As Boolean
End Type

Private Type TSubdetailConfig
    NameFrame                       As String
    FrameIndex                      As Long
    TabStribIndex                   As Long     'new
    TabIndex                        As Long     'new
    ShowInTabs                      As Boolean  'new
    DetailConfigIndex               As Long
    Initialized                     As Boolean
    ToolbarID                       As Long
    ToolbarIndex                    As Long
    ToolbarFaces                    As Variant
    RequestView                     As String
    RequestAdd                      As String
    RequestUpd                      As String
    RequestDel                      As String
    RequestCheckDelete              As String
    RequestCheckAdd                 As String
    RequestCheckUpdate              As String
    TableName                       As String
    TableOrder                      As String
    GridDelayMethod                 As eGridLoadMethod
    GridColumns                     As Variant
    DeletedRows                     As Variant
    ListFieldsMandatory             As Variant
    ListFieldsDefaultValue          As Variant
    ListFieldsToDisable             As Variant
    DeleteMsg(0, 1)                 As String
    UpdateMsg(0, 1)                 As String
    CheckAddUpdMsg(0, 1)            As String
    CheckDelMsg(0, 1)               As String
End Type

Private Type TDetailConfig
    NameFrame                       As String
    DetailKey                       As String
    FrameIndex                      As Long
    MainConfigIndex                 As Long
    IsMultiDetailFrame              As Boolean
    Initialized                     As Boolean
    ToolbarID                       As Long
    ToolbarIndex                    As Long
    ToolbarFaces                    As Variant
    RequestView                     As String
    RequestAdd                      As Variant
    RequestUpd                      As Variant
    RequestDel                      As Variant
    AffectedCount                   As Variant
    RequestCheckDelete              As String
    RequestCheckAdd                 As String
    RequestCheckUpdate              As String
    UseTransaction                  As Boolean
    TableName                       As String
    MainGridColumns                 As Variant
    InitControls                    As Variant
    ListFieldsMandatory             As Variant
    ListFieldsDefaultValue          As Variant
    ListFieldsToDisable             As Variant
    DeleteMsg(0, 1)                 As String
    UpdateMsg(0, 1)                 As String
    CheckAddUpdMsg(0, 1)            As String
    CheckDelMsg(0, 1)               As String
    PreviousDetailIndex             As Long         'new
    ClearControlsBeforeInit         As Boolean      'new
End Type

Private Type TMainConfig
    NameFrame                       As String
    ViewCode                        As String
    FrameIndex                      As Long
    IsMultiDetailView               As Boolean
    CurrentDetailIndex              As Long
    Initialized                     As Boolean
    ToolbarFace                     As String
    ToolbarIndex                    As Long
    ToolbarID                       As Long
    CurrentTvwSelMethod             As eTvwSelMethod
    GridDelayMethod                 As eGridLoadMethod
    GridDelayed                     As Boolean
    TreeDelayed                     As Boolean
    mTreeViewInfos()                As TTreeViewInfo
    RequestGrid                     As String
End Type

Private mt_SubdetailConfig() As TSubdetailConfig
Private mt_DetailConfig() As TDetailConfig
Private mt_MainConfig() As TMainConfig

Private Type TRect
    Top As Long
    Left As Long
    Width As Long
    Height As Long
End Type

Private Enum eMode
    emNone
    emList
    emView
    emAdd
    emUpdate
    emDelete
End Enum

Private Enum eControlPropertyIndex
    cpiControl
    cpiTag
    cpiVisible
    cpiRequest
End Enum

Private Enum eControlAction
    caDoubleClick
    caClick
    caSelect
    caLoad
End Enum

Private me_DetailMode                     As eMode
Private me_OldDetailMode                  As eMode
Private me_SubDetailMode                  As eMode

Private Enum eGridLoadMethod
    egmDelayedAlways = 0
    egmDelayedExceptLastLevel = 1
    egmLoadAlways = 2
End Enum

' The different way to select data in the treeview
Private Enum eTvwSelMethod
    etmNone = 0
    etmNode = 1         ' User click on the last node of a branch
    etmBranch = 2       ' User click on a branch and use the load button
    etmCheckBoxes = 3   ' User click on the load button when checkboxes mode is set
End Enum

Private Enum ArmErr
    DBCnxFailed = C_ERRORRAISE + 1             ' Unable to connect to the database
    CPTAlreadyInitialized = C_ERRORRAISE + 2   ' We try to initialize a component that is already initialized
    CPTNotInitialized = C_ERRORRAISE + 3       ' We try to use or free that is not initialized yet
    InvalidArgument = C_ERRORRAISE + 4
    PropertyNotSet = C_ERRORRAISE + 5
    SQLFailure = C_ERRORRAISE + 6               ' A SQL runtime error has occured : syntax wrong....
    SQLBadRowAffectedCount = C_ERRORRAISE + 7   ' A SQL request has not affected the expected rowcount (ex: one Update do nothing)
    SQLBadRowExpectedCount = C_ERRORRAISE + 8   ' A SQL request does not return the expected rowcount : select an item return nothing...
    DrivingError = C_ERRORRAISE + 9
    CompFncFailed = C_ERRORRAISE + 10           ' when component function fail
    GridLoadFailed = C_ERRORRAISE + 11          ' load function failed ... bad sql
    InvalidValue = C_ERRORRAISE + 12          ' load function failed ... bad sql
End Enum

Private Enum ArmCusErr
    DuplicityDetected = C_ERRORRAISE + 2301                ' detected row with same unique id
End Enum

Private Enum eTableType
    ttNone = 0
    ttDPC_System = 1
    ttDPC_SysCat = 2
    ttDPC_Material = 3
    ttDPC_Coil = 4
    ttDPC_PU = 5
    ttDPC_MatThick = 6
    ttDPC_Group = 7
    ttDPC_Offer = 8
    ttDPC_AConfig = 9
    ttGEN_LegalEntity = 10
End Enum

Private Type tExcelImported
    Count As Long
    InsertedCount As Long
    UpdatedCount As Long
    FileName As String
End Type

Private Type tFlexGridData
    MTH_Id As Long
    MTH_AMin As Double
    MTH_AMax As Double
    MTH_BMin As Double
    MTH_BMax As Double
    MTH_Thick As Double
    MTH_H As Double
    iConcurrency As Long
End Type

Private mt_FlexGridData() As tFlexGridData
Private ml_EditedRow As Long
Private ml_EditedCol As Long

Private Enum eEditedFlexGridType
    etMTH_Thick = 1
    etMTH_H = 2
End Enum

Private me_EditedFlexGrid As eEditedFlexGridType

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK EVENTS
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Public Event quit()

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' COMPONENT CONSTANTS AND VARIABLES
'**********************************************************************************************************************************

Private Const CONST_CUT_TYPE_VENT = 1
Private Const CONST_CUT_TYPE_LOUD = 2
Private Const CONST_CUT_TYPE_CUTOUT = 3

'**********************************************************************************************************************************
'**********************************************************************************************************************************
'**********************************************************************************************************************************
' COMPONENT METHODS
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Private Function LoadUserInfo(ByRef ao_Armdb As Object, ByVal al_U_Code As Long) As String
On Error GoTo ErrHandler
Const C_REQ As String = _
    "SELECT GPL.P_First_Name + ' '+ GPL.P_Name as User_Name " & _
    "FROM GEN_Systems_Users GSU " & _
    "INNER JOIN GEN_People GPL ON (GSU.P_Code=GPL.P_Code) " & _
    "WHERE GSU.U_Code=$U_Code$"

Dim ls_req As String
Dim ll_Cursor As Long
    
    ls_req = ReplacePlaceHolder(C_REQ, "$U_Code$", al_U_Code)
    ll_Cursor = mo_Tools.OpenSQLSafe(ao_Armdb, ls_req, 1)
    LoadUserInfo = ao_Armdb.GetFields(ll_Cursor, "User_Name")
    Call ao_Armdb.Close(ll_Cursor)
    Exit Function
    
ErrHandler:
    If ll_Cursor <> 0 Then Call ao_Armdb.Close(ll_Cursor)
    Call ErrorHandler("LoadUserInfo()")
End Function

Private Sub DrawSelImage(ByVal ao_Image As StdPicture, ByVal ao_Canvas As PictureBox, Optional ByVal as_Message As String = IMAGE_CLICK_MSG)
Dim lf_AspectRatioX As Double
Dim lf_AspectRatioY As Double
Dim lf_Width As Double
Dim lf_Height As Double

  Set ao_Canvas.Picture = Nothing
  If ao_Image Is Nothing Then
    If as_Message <> "" Then
      'Call PrintMessage(ao_Canvas, as_Message)
    End If
    Exit Sub
  End If
  
  lf_Width = ao_Canvas.ScaleX(ao_Image.Width, vbHimetric, vbTwips)
  lf_Height = ao_Canvas.ScaleY(ao_Image.Height, vbHimetric, vbTwips)
  
  If (lf_Height > ao_Canvas.ScaleHeight) Or (lf_Width > ao_Canvas.ScaleWidth) Then
    lf_AspectRatioX = ao_Canvas.ScaleWidth / lf_Width
    lf_AspectRatioY = ao_Canvas.ScaleHeight / lf_Height
    If lf_AspectRatioX < lf_AspectRatioY Then
      lf_Width = lf_Width * lf_AspectRatioX
      lf_Height = lf_Height * lf_AspectRatioX
    Else
      lf_Width = lf_Width * lf_AspectRatioY
      lf_Height = lf_Height * lf_AspectRatioY
    End If
  End If
  Call ao_Canvas.PaintPicture(ao_Image, (ao_Canvas.ScaleWidth - lf_Width) / 2, (ao_Canvas.ScaleHeight - lf_Height) / 2, lf_Width, lf_Height)
  'Call ao_Canvas.PaintPicture(ao_Image, 0, 0)
  'ao_Canvas.Picture = ao_Canvas.Image
  
End Sub

Private Function DeleteImage(ByVal al_IMG_Id As Long) As Boolean
Dim ls_PicName As String

  DeleteImage = False
  If al_IMG_Id = 0 Then Exit Function
  ls_PicName = ms_PicPath & "IMG" & al_IMG_Id & ".jpg"
  If mo_FSO.FileExists(ls_PicName) Then
        Call mo_Tools.DeleteFile(mo_FSO, ls_PicName)
  End If
  DeleteImage = True
End Function

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK CUSTOM METHODS
' Change content of methods as you need, but do not add any new method or property here !
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Private Function Load_A_COM_Custom() As Boolean
On Error GoTo ErrHandler

    Dim ll_Idx As Long
    
    Dim ls_DPC_RefRight As String
'ls_DPC_RefRight = Trim(GetAConfigData(mo_Db, "DPC_RefRight"))
   ' If InStr(1, SEP & ls_DPC_RefRight & SEP, SEP & ml_U_code & SEP) <= 0 Then
   '     Load_A_COM_Custom = False
   '     Exit Function
   ' End If
   
   ms_PicPath = prg.AppCache_Dir & DPC_IMAGE_CACHE
   
'    btn_Validate.Picture = LoadResPicture(RES_OK, 1)
'    btn_Quit.Picture = LoadResPicture(RES_QUIT, 1)
       
    Load_A_COM_Custom = True
    Exit Function
ErrHandler:
    Call ErrorHandler("Load_A_COM_Custom")
End Function

Private Sub UnLoad_A_COM_Custom()
On Error GoTo ErrHandler

    Exit Sub
ErrHandler:
    Call ErrorHandler("UnLoad_A_COM_Custom")
End Sub

Private Sub Init_Custom()
On Error GoTo ErrHandler
    Dim lo_Tab As MSComctlLib.Tab
    Dim lc_Cursor As Long
    Dim ll_Index As Integer
    Dim lv_Priority As Variant
            
    ms_ToolbarRequest = "exec Toolbar_sel $Module$"
    Set lo_Tab = tbs_Main.Tabs(1)
    lo_Tab.Caption = "#DPC_System"
    lo_Tab.Key = "DPC_System"
    lo_Tab.Tag = "lbl_TAB_DPC_System"
    
    Set lo_Tab = tbs_Main.Tabs(2)
    lo_Tab.Caption = "#DPC_SysCat"
    lo_Tab.Key = "DPC_SysCat"
    lo_Tab.Tag = "lbl_TAB_DPC_SysCat"
                      
    Set lo_Tab = tbs_Main.Tabs(3)
    lo_Tab.Caption = "#DPC_Material"
    lo_Tab.Key = "DPC_Material"
    lo_Tab.Tag = "lbl_TAB_DPC_Material"
                                            
    Set lo_Tab = tbs_Main.Tabs(4)
    lo_Tab.Caption = "#DPC_Coil"
    lo_Tab.Key = "DPC_Coil"
    lo_Tab.Tag = "lbl_TAB_DPC_Coil"
                       
    Set lo_Tab = tbs_Main.Tabs(5)
    lo_Tab.Caption = "#DPC_PU"
    lo_Tab.Key = "DPC_PU"
    lo_Tab.Tag = "lbl_TAB_DPC_PU"
                       
    Set lo_Tab = tbs_Main.Tabs(6)
    lo_Tab.Caption = "#DPC_MatThick"
    lo_Tab.Key = "DPC_MatThick"
    lo_Tab.Tag = "lbl_TAB_DPC_MatThick"
                       
    Set lo_Tab = tbs_Main.Tabs(7)
    lo_Tab.Caption = "#DPC_Group"
    lo_Tab.Key = "DPC_Group"
    lo_Tab.Tag = "lbl_TAB_DPC_Group"
                       
    Set lo_Tab = tbs_Main.Tabs(8)
    lo_Tab.Caption = "#DPC_Offer"
    lo_Tab.Key = "DPC_Offer"
    lo_Tab.Tag = "lbl_TAB_DPC_Offer"
                       
    Set lo_Tab = tbs_Main.Tabs(9)
    lo_Tab.Caption = "#A Config"
    lo_Tab.Key = "A_Config"
    lo_Tab.Tag = "lbl_TAB_A_Config"
                       
    Set lo_Tab = tbs_Main.Tabs(10)
    lo_Tab.Caption = "#Legal Entity"
    lo_Tab.Key = "GEN_LegalEntity"
    lo_Tab.Tag = "lbl_TAB_LegalEntity"
                       
    cbo_SysCategory.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_SysCategories_lst $toolbar_language_code$")
    cbo_SysCategory_Filter.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_SysCategories_lst $toolbar_language_code$")
    cbo_SysCategory_Filter.FirstBlankItem = True
        
    For ll_Index = 0 To 1
        cbo_SysBending(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Bending_lst $toolbar_language_code$, NULL, 'X', NULL")
    Next
                    
    For ll_Index = 2 To 3
        cbo_SysBending(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Bending_lst $toolbar_language_code$, 'X', NULL, NULL")
    Next
                    
    For ll_Index = 0 To 3
        cbo_SysGasket(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Gasket_lst2 " & eDPCGasketType.gtGasket & ",NULL, $toolbar_language_code$")
        cbo_SysGasket(ll_Index).FirstBlankItem = True
    Next
                    
    For ll_Index = 0 To 3
        cbo_SysSpacer(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Gasket_lst2 " & eDPCGasketType.gtSpacer & ",NULL, $toolbar_language_code$")
        cbo_SysSpacer(ll_Index).FirstBlankItem = True
    Next
                    
    cbo_Material.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Material_lst2 $toolbar_language_code$")
        
    cbo_SYS_RF_CodeA0.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfSubA0Name & ",$toolbar_language_code$")
    cbo_SYS_RF_CodeA1.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfSubA1Name & ",$toolbar_language_code$")
    cbo_SYS_RF_CodeA2.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfSubA2Name & ",$toolbar_language_code$")
        
    cbo_SysPacking.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Packing_lst2 $toolbar_language_code$")
    
    For ll_Index = 0 To 1
        cbo_PU_BND(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Bending_lst $toolbar_language_code$, NULL, 'X', NULL")
    Next
    
    For ll_Index = 2 To 3
        cbo_PU_BND(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Bending_lst $toolbar_language_code$, 'X', NULL, NULL")
    Next
    
    cbo_PU_SYS.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_System_lst2 $toolbar_language_code$," & eDPCCategory.cgBending)
        
    cbo_MTH_MAT_Id.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Material_lst2 $toolbar_language_code$")
    cbo_MTH_PRD_Id.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_PrdCommon_lst2 $toolbar_language_code$, " + mo_Tools.SqlInt(eDPCCategory.cgMetalCustomPanelTemplate) + ", NULL")
    cbo_MTH_PRD_Id.FirstBlankItem = True
    cbo_MTH_System.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_System_lst2 $toolbar_language_code$,NULL")
    cbo_MTH_System.FirstBlankItem = True
    
    lv_Priority = Array(1, 1)
    Call cbo_GRP_Priority.AddItem(lv_Priority)
    lv_Priority = Array(2, 2)
    Call cbo_GRP_Priority.AddItem(lv_Priority)
    lv_Priority = Array(3, 3)
    Call cbo_GRP_Priority.AddItem(lv_Priority)
    
    cbo_GRP_Type.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfPanelGroupType & ",$toolbar_language_code$")
    cbo_GRP_Type_Filter.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfPanelGroupType & ",$toolbar_language_code$")
    cbo_GRP_Type_Filter.Load
    
    cbo_GPP_Group.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Group_lst2 $toolbar_language_code$")
    cbo_GPP_Group.Load
    
    For ll_Index = 0 To 9
        cbo_GPP_Param(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Param_lst $toolbar_language_code$")
        cbo_GPP_Param(ll_Index).FirstBlankItem = True
    Next
    
    For ll_Index = 0 To 9
        cbo_GPP_Operator(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfPanelGroupParamOperator & ",$toolbar_language_code$")
        cbo_GPP_Operator(ll_Index).FirstBlankItem = True
    Next
    
    For ll_Index = 0 To 3
        cbo_SYS_Allow(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfSystemAllowGasket & ",$toolbar_language_code$")
        cbo_SYS_Allow(ll_Index).FirstBlankItem = False
    Next
    
    cbo_DOF_SourceFilter.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfOfferSource & ",$toolbar_language_code$")
    cbo_DOF_SourceFilter.FirstBlankItem = True
    cbo_DOF_SourceFilter.Load
    
    If cbo_DOF_SourceFilter.SelectedItem Is Nothing Then
        Call cbo_DOF_SourceFilter.SearchItem(cbo_DOF_SourceFilter.ComboItems(2).Key)
    End If
    
    'toolbar position fix
    For ll_Index = 0 To tlb_SubDetail.Count - 1
        tlb_SubDetail(ll_Index).Width = 672
    Next
    
    cbo_LEN_CT_Code.Request = ReplaceLanguagePlaceholderFromToolbar("exec countries_cbo $toolbar_language_code$")
    
    cbo_OGT_CT_Code.Request = ReplaceLanguagePlaceholderFromToolbar("exec countries_cbo $toolbar_language_code$")
    cbo_OGT_Language_Code.Request = ReplaceLanguagePlaceholderFromToolbar("exec language_cbo")
    cbo_OGT_MEM_Id.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Memo_cbo $toolbar_language_code$," & eDPCMemoType.mtDisclaimer)
    
    For ll_Index = 0 To 9
        grd_Main(ll_Index).AllowExcelExport = True
    Next
    
    cbo_SysPerf.Request = ReplaceLanguagePlaceholderFromToolbar("exec dpc_perforation_lst2 $toolbar_language_code$")
    cbo_SysBendAddValue.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Bending_lst $toolbar_language_code$, NULL, NULL, NULL")
    cbo_BI_BaseMaterial.Request = ReplaceLanguagePlaceholderFromToolbar("exec Base_Material_Link_cbo 'C001', $toolbar_language_code$")
    cbo_BI_ArmstrongProduct.Request = ReplaceLanguagePlaceholderFromToolbar("exec Dictionnary_t_lst2 'Armstrong_product', $toolbar_language_code$")
    cbo_BI_Edge.Request = ReplaceLanguagePlaceholderFromToolbar("exec Products_Edges_cbo 'C001', $toolbar_language_code$")
    cbo_BI_FireRating.Request = ReplaceLanguagePlaceholderFromToolbar("exec Dictionnary_t_lst2 'perf_ind', $toolbar_language_code$")
    cbo_BI_ProductFamily.Request = ReplaceLanguagePlaceholderFromToolbar("exec products_families_cbo 'C001', $toolbar_language_code$")
    cbo_BI_ProductOrigin.Request = ReplaceLanguagePlaceholderFromToolbar("exec Dictionnary_t_lst2 'origin_type', $toolbar_language_code$")
    cbo_BI_ProductSegm.Request = ReplaceLanguagePlaceholderFromToolbar("exec products_segmentation_cbo 'C001', $toolbar_language_code$")
    cbo_BI_Shape.Request = ReplaceLanguagePlaceholderFromToolbar("exec Shapes_cbo 'C001', $toolbar_language_code$")
    Exit Sub
ErrHandler:
    Call ErrorHandler("Init_Custom")
End Sub

Private Sub Load_ConfigInfo()
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim ll_frameIndex As Long
    
    ReDim mt_MainConfig(9)
    ReDim mt_DetailConfig(9)
        
    With mt_MainConfig(0)
        .FrameIndex = 0
        .IsMultiDetailView = True
        .CurrentDetailIndex = 0
        .Initialized = False
        .NameFrame = "DPC_System"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 0
        .ToolbarID = 2817
        .RequestGrid = "exec DPC_System_lst $toolbar_language_code$,$SCT_Id$"
    End With
    
    With mt_MainConfig(1)
        .FrameIndex = 1
        .IsMultiDetailView = False
        .Initialized = False
        .NameFrame = "DPC_SysCat"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 1
        .ToolbarID = 2819
        .RequestGrid = "exec DPC_SysCategory_lst $toolbar_language_code$"
    End With
    
    With mt_MainConfig(2)
        .FrameIndex = 2
        .IsMultiDetailView = True
        .CurrentDetailIndex = 2
        .Initialized = False
        .NameFrame = "DPC_Material"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 2
        .ToolbarID = 2963
        .RequestGrid = "exec DPC_Material_lst $toolbar_language_code$"
    End With
    
    With mt_MainConfig(3)
        .FrameIndex = 3
        .IsMultiDetailView = True
        .CurrentDetailIndex = 3
        .Initialized = False
        .NameFrame = "DPC_Coil"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 3
        .ToolbarID = 2860
        .RequestGrid = "exec DPC_Coil_lst $Language_code$"
    End With
    
    With mt_MainConfig(4)
        .FrameIndex = 4
        .IsMultiDetailView = True
        .CurrentDetailIndex = 4
        .Initialized = False
        .NameFrame = "DPC_PU"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 4
        .ToolbarID = 2896
        .RequestGrid = "exec DPC_PU_lst $Language_code$"
    End With
    
    With mt_MainConfig(5)
        .FrameIndex = 5
        .IsMultiDetailView = True
        .CurrentDetailIndex = 5
        .Initialized = False
        .NameFrame = "DPC_MatThick"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 5
        .ToolbarID = 2936
        .RequestGrid = "exec DPC_MatThick_lst $Language_code$"
    End With
    
    With mt_MainConfig(6)
        .FrameIndex = 6
        .IsMultiDetailView = True
        .CurrentDetailIndex = 6
        .Initialized = False
        .NameFrame = "DPC_Group"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 6
        .ToolbarID = 2949
        .RequestGrid = "exec DPC_Group_lst $Language_code$"
    End With
    
    With mt_MainConfig(7)
        .FrameIndex = 7
        .IsMultiDetailView = True
        .CurrentDetailIndex = 7
        .Initialized = False
        .NameFrame = "DPC_Offer"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 7
        .ToolbarID = 2954
        .RequestGrid = "exec DPC_Offer_lst $DOF_Source$, $toolbar_language_code$"
    End With
    
    With mt_MainConfig(8)
        .FrameIndex = 8
        .IsMultiDetailView = True
        .CurrentDetailIndex = 8
        .Initialized = False
        .NameFrame = "A_Config"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 8
        .ToolbarID = 2956
        .RequestGrid = "exec A_Config_lst 'DPC%'"
    End With
    
    With mt_MainConfig(9)
        .FrameIndex = 9
        .IsMultiDetailView = True
        .CurrentDetailIndex = 9
        .Initialized = False
        .NameFrame = "GEN_LegalEntity"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 9
        .ToolbarID = 2968
        .RequestGrid = "exec GEN_LegalEntity_lst $toolbar_language_code$"
    End With
    
    With mt_DetailConfig(0)
        .FrameIndex = 0
        .NameFrame = "DPC_System"
        .MainConfigIndex = 0
        .DetailKey = 0
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_System_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_System_ins $SYS_Id$,$SCT_Id$,$SYS_Code$,$SYS_Order$,$IMG_Id$,$IMG_IdSub$,$SYS_AMin$,$SYS_AMax$," & _
                            "$SYS_BMin$,$SYS_BMax$,$SYS_GCMin$,$SYS_GCMax$,$SYS_GDMin$,$SYS_GDMax$," & _
                            "$SYS_GEMin$,$SYS_GEMax$,$SYS_GFMin$,$SYS_GFMax$,$SYS_UBorC$,$SYS_UBorD$,$SYS_UBorE$,$SYS_UBorF$," & _
                            "$SYS_Fix$,$SYS_Frame$,$SYS_AllowGC$,$SYS_AllowGD$,$SYS_AllowGE$,$SYS_AllowGF$," & _
                            "$SYS_IsPan$,$SYS_IsSub$,$RF_CodeA0$,$RF_CodeA1$,$RF_CodeA2$,$SYS_PaSec$,$SYS_UseCPro$,$SYS_InlayDec1$,$SYS_InlayDec2$,$SYS_BaeType$,$SYS_CADFile$,$SYS_LayCADFile$," & _
                            "$PF_Code$,$PE_Code$,$SH_Code$,$BI_PERF_IND$,$PS_Code$,$Armstrong_product$,$origin_type$,$Z_creator$", _
                            "exec DPC_SystemDesc_ins $SYS_Id$,$toolbar_language_code$,$SYS_Name$,$SYS_Desc$,$SYS_Exec$,$Z_creator$")
        .RequestUpd = Array("exec DPC_System_upd $SYS_Id$,$SCT_Id$,$SYS_Code$,$SYS_Order$,$IMG_Id$,$IMG_IdSub$,$SYS_AMin$,$SYS_AMax$," & _
                            "$SYS_BMin$,$SYS_BMax$,$SYS_GCMin$,$SYS_GCMax$,$SYS_GDMin$,$SYS_GDMax$," & _
                            "$SYS_GEMin$,$SYS_GEMax$,$SYS_GFMin$,$SYS_GFMax$,$SYS_UBorC$,$SYS_UBorD$,$SYS_UBorE$,$SYS_UBorF$," & _
                            "$SYS_Fix$,$SYS_Frame$,$SYS_AllowGC$,$SYS_AllowGD$,$SYS_AllowGE$,$SYS_AllowGF$," & _
                            "$SYS_IsPan$,$SYS_IsSub$,$RF_CodeA0$,$RF_CodeA1$,$RF_CodeA2$,$SYS_PaSec$,$SYS_UseCPro$,$SYS_InlayDec1$,$SYS_InlayDec2$,$SYS_BaeType$,$SYS_CADFile$,$SYS_LayCADFile$," & _
                            "$PF_Code$,$PE_Code$,$SH_Code$,$BI_PERF_IND$,$PS_Code$,$Armstrong_product$,$origin_type$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_SystemDesc_upd $SYS_Id$,$toolbar_language_code$,$SYS_Name$,$SYS_Desc$,$SYS_Exec$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_System_del $SYS_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_SysVendor_del $SYS_Id$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .RequestCheckAdd = "SELECT SYS_Id FROM DPC_SystemDesc WHERE SYS_Name=$SYS_Name$"
        .RequestCheckUpdate = "SELECT SYS_Id FROM DPC_SystemDesc WHERE SYS_Name=$SYS_Name$ AND SYS_Id<>$SYS_Id$"
        
        .UseTransaction = True
        .TableName = "DPC_System"
        .ToolbarIndex = 0
        .ToolbarID = 2824
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(17)
        .ListFieldsDefaultValue(0) = Array(txt_SYS_PanelAMin, 0)
        .ListFieldsDefaultValue(1) = Array(txt_SYS_PanelAMax, 0)
        .ListFieldsDefaultValue(2) = Array(txt_SYS_PanelBMin, 0)
        .ListFieldsDefaultValue(3) = Array(txt_SYS_PanelBMax, 0)
        .ListFieldsDefaultValue(4) = Array(txt_SYS_GapCMin, 0)
        .ListFieldsDefaultValue(5) = Array(txt_SYS_GapCMax, 0)
        .ListFieldsDefaultValue(6) = Array(txt_SYS_GapDMin, 0)
        .ListFieldsDefaultValue(7) = Array(txt_SYS_GapDMax, 0)
        .ListFieldsDefaultValue(8) = Array(txt_SYS_GapEMin, 0)
        .ListFieldsDefaultValue(9) = Array(txt_SYS_GapEMax, 0)
        .ListFieldsDefaultValue(10) = Array(txt_SYS_GapFMin, 0)
        .ListFieldsDefaultValue(11) = Array(txt_SYS_GapFMax, 0)
        .ListFieldsDefaultValue(12) = Array(txt_SYS_UnperfBorderC, 0)
        .ListFieldsDefaultValue(13) = Array(txt_SYS_UnperfBorderD, 0)
        .ListFieldsDefaultValue(14) = Array(txt_SYS_UnperfBorderE, 0)
        .ListFieldsDefaultValue(15) = Array(txt_SYS_UnperfBorderF, 0)
        .ListFieldsDefaultValue(16) = Array(cbo_BI_ArmstrongProduct, "yes")
        .ListFieldsDefaultValue(17) = Array(cbo_BI_ProductOrigin, "Manufactured")
        
        ReDim .ListFieldsMandatory(18)
        .ListFieldsMandatory(0) = Array(txt_SYS_Name, 2)
        .ListFieldsMandatory(1) = Array(txt_SYS_Desc, 3)
        .ListFieldsMandatory(2) = Array(cbo_SysCategory, 4)
        .ListFieldsMandatory(3) = Array(txt_SYS_Order, 5)
        .ListFieldsMandatory(4) = Array(txt_SYS_PanelAMin, 6)
        .ListFieldsMandatory(5) = Array(txt_SYS_PanelAMax, 7)
        .ListFieldsMandatory(6) = Array(txt_SYS_PanelBMin, 8)
        .ListFieldsMandatory(7) = Array(txt_SYS_PanelBMax, 9)
        .ListFieldsMandatory(8) = Array(txt_SYS_Code, 100)
        .ListFieldsMandatory(9) = Array(txt_SYS_InlayDec1, 126)
        .ListFieldsMandatory(10) = Array(txt_SYS_InlayDec2, 127)
        .ListFieldsMandatory(11) = Array(cbo_BI_Edge, 137)
        .ListFieldsMandatory(12) = Array(cbo_BI_FireRating, 139)
        .ListFieldsMandatory(13) = Array(cbo_BI_ProductFamily, 136)
        .ListFieldsMandatory(14) = Array(cbo_BI_ProductOrigin, 142)
        .ListFieldsMandatory(15) = Array(cbo_BI_ProductSegm, 140)
        .ListFieldsMandatory(16) = Array(cbo_BI_Shape, 138)
        .ListFieldsMandatory(17) = Array(cbo_BI_ArmstrongProduct, 141)
        .ListFieldsMandatory(18) = Array(txt_SYS_BaeType, 131)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(0)
        
        .MainGridColumns = Array( _
            "SYS_ID®©0®©1®©SYS_Id®©#SYS_Id", _
            "Language_Code®©0®©1®©Language_Code®©#Language_Code", _
            "SYS_Code®©1000®©0®©SYS_Code®©#SYS_Code", _
            "SYS_Name®©1600®©0®©SYS_Name®©#SYS_Name", _
            "SYS_Desc®©4200®©0®©SYS_Desc®©#SYS_Desc", _
            "SCT_Id®©0®©0®©SCT_Id®©#SCT_Id", _
            "SCT_Name®©1400®©0®©SCT_Name®©#SCT_Name", _
            "SYS_Order®©0®©0®©SYS_Order®©SYS_Order", _
            "IMG_Id®©0®©0®©IMG_Id®©#IMG_Id", _
            "SYS_AMin®©1000®©0®©SYS_AMin®©#SYS_AMin", _
            "SYS_AMax®©1000®©0®©SYS_AMax®©#SYS_AMax", _
            "SYS_BMin®©1000®©0®©SYS_BMin®©#SYS_BMin", _
            "SYS_BMax®©1000®©0®©SYS_BMax®©#SYS_BMax", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")
        
        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
        
    With mt_DetailConfig(1)
        .FrameIndex = 1
        .NameFrame = "DPC_SysCat"
        .MainConfigIndex = 1
        .DetailKey = 1
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_SysCategory_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_SysCategory_ins $SCT_Id$,$SCT_Order$,$Z_creator$", _
                            "exec DPC_SysCatDesc_ins $SCT_Id$,$toolbar_language_code$,$SCT_Name$,$SCT_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_SysCategory_upd $SCT_Id$,$SCT_Order$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_SysCatDesc_upd $SCT_Id$,$toolbar_language_code$,$SCT_Name$,$SCT_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_SysCategory_del $SCT_Id$,$Z_last_upd_user$,$iConcurrency$")
        
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_SysCat"
        .ToolbarIndex = 1
        .ToolbarID = 2827
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(2)
        .ListFieldsMandatory(0) = Array(txt_SCT_Name, 11)
        .ListFieldsMandatory(1) = Array(txt_SCT_Desc, 12)
        .ListFieldsMandatory(2) = Array(txt_SCT_Order, 15)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(1)
        
        .MainGridColumns = Array( _
            "SCT_Id®©0®©1®©SCT_Id®©#SCT_Id", _
            "SCT_Name®©1100®©0®©SCT_Name®©#SCT_Name", _
            "SCT_Desc®©3600®©0®©SCT_Desc®©#SCT_Desc", _
            "SCT_Order®©1000®©0®©SCT_Order®©#SCT_Order", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    With mt_DetailConfig(2)
        .FrameIndex = 2
        .NameFrame = "DPC_Material"
        .MainConfigIndex = 2
        .DetailKey = 2
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Material_sel $Key1$, $toolbar_language_code$"

        .RequestAdd = Array("exec DPC_Material_ins2 $MAT_Id$,$MAT_Prefx$,$MAT_Werk$,$MAT_IsCus$,$MAT_Order$,$MAT_OrdQty$,$MAT_WiStep$,$MAT_MaxCut$,$MAT_SAPCommodity$,$MAT_CE$,$MAT_BaeType$,$MAT_CustTariff$,$BML_Code$,$Z_creator$", _
                            "exec DPC_MaterialDesc_ins $MAT_Id$,$toolbar_language_code$,$MAT_Name$,$MAT_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_Material_upd2 $MAT_Id$,$MAT_Prefx$,$MAT_Werk$,$MAT_IsCus$,$MAT_Order$,$MAT_OrdQty$,$MAT_WiStep$,$MAT_MaxCut$,$MAT_SAPCommodity$,$MAT_CE$,$MAT_BaeType$,$MAT_CustTariff$,$BML_Code$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_MaterialDesc_upd $MAT_Id$,$toolbar_language_code$,$MAT_Name$,$MAT_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_Material_del $MAT_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_MaterialDesc_del $MAT_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Material"
        .ToolbarIndex = 2
        .ToolbarID = 2859
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(8)
        .ListFieldsMandatory(0) = Array(txt_MAT_Name, 81)
        .ListFieldsMandatory(1) = Array(txt_MAT_Prefx, 208)
        .ListFieldsMandatory(2) = Array(txt_MAT_Werk, 20)
        .ListFieldsMandatory(3) = Array(txt_MAT_Order, 84)
        .ListFieldsMandatory(4) = Array(txt_MAT_OrdQty, 21)
        .ListFieldsMandatory(5) = Array(txt_MAT_WiStep, 22)
        .ListFieldsMandatory(6) = Array(txt_MAT_MaxCut, 23)
        .ListFieldsMandatory(7) = Array(txt_MAT_CE, 123)
        .ListFieldsMandatory(8) = Array(cbo_BI_BaseMaterial, 133)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(2)
        
        .MainGridColumns = Array( _
            "MAT_Id®©0®©1®©MAT_Id®©#MAT_Id", _
            "MAT_Name®©1600®©0®©MAT_Name®©#MAT_Name", _
            "MAT_Desc®©3000®©0®©MAT_Desc®©#MAT_Desc", _
            "MAT_Order®©900®©0®©MAT_Order®©#MAT_Order", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    With mt_DetailConfig(3)
        .FrameIndex = 3
        .NameFrame = "DPC_Coil"
        .MainConfigIndex = 3
        .DetailKey = 3
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Coil_sel $Key1$, $Language_code$"

        .RequestAdd = Array("exec DPC_Coil_ins $COI_Id$,$MAT_Id$,$COI_Thick$,$COI_Width$,$Z_creator$")
        .RequestUpd = Array("exec DPC_Coil_upd $COI_Id$,$MAT_Id$,$COI_Thick$,$COI_Width$,$Z_last_upd_user$,$iConcurrency$")
        .RequestDel = Array("exec DPC_Coil_del $COI_Id$,$Z_last_upd_user$,$iConcurrency$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Coil"
        .ToolbarIndex = 3
        .ToolbarID = 2861
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(1)
        .ListFieldsMandatory(0) = Array(txt_COI_Thick, 78)
        .ListFieldsMandatory(1) = Array(txt_COI_Width, 76)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(3)
        
        .MainGridColumns = Array( _
            "COI_Id®©0®©1®©COI_Id®©#COI_Id", _
            "MAT_Id®©0®©0®©MAT_Id®©#MAT_Id", _
            "MAT_Name®©1500®©0®©MAT_Name®©#MAT_Name", _
            "COI_Thick®©900®©0®©COI_Thick®©#COI_Thick", _
            "COI_Width®©900®©0®©COI_Width®©#COI_Width", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
        
    With mt_DetailConfig(4)
        .FrameIndex = 4
        .NameFrame = "DPC_PU"
        .MainConfigIndex = 4
        .DetailKey = 4
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_PU_sel $Key1$, $Language_code$"

        .RequestAdd = "exec DPC_PU_ins $PUN_Id$,$SYS_Id$,$BND_IdC$,$BND_IdD$,$BND_IdE$,$BND_IdF$,$PUN_AMin$,$PUN_AMax$,$PUN_BMin$,$PUN_BMax$,$PUN_HMin$,$PUN_HMax$,$PUN_PU$,$Z_creator$"
        .RequestUpd = "exec DPC_PU_upd $PUN_Id$,$SYS_Id$,$BND_IdC$,$BND_IdD$,$BND_IdE$,$BND_IdF$,$PUN_AMin$,$PUN_AMax$,$PUN_BMin$,$PUN_BMax$,$PUN_HMin$,$PUN_HMax$,$PUN_PU$,$Z_last_upd_user$,$iConcurrency$"
        .RequestDel = "exec DPC_PU_del $PUN_Id$,$Z_last_upd_user$,$iConcurrency$"
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_PU"
        .ToolbarIndex = 4
        .ToolbarID = 2897
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(6)
        .ListFieldsMandatory(0) = Array(txt_PUN_AMin, 221)
        .ListFieldsMandatory(1) = Array(txt_PUN_AMax, 220)
        .ListFieldsMandatory(2) = Array(txt_PUN_BMin, 218)
        .ListFieldsMandatory(3) = Array(txt_PUN_BMax, 223)
        .ListFieldsMandatory(4) = Array(txt_PUN_HMin, 228)
        .ListFieldsMandatory(5) = Array(txt_PUN_HMax, 229)
        .ListFieldsMandatory(6) = Array(txt_PUN_PU, 222)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(4)
        
        .MainGridColumns = Array( _
            "PUN_Id®©0®©1®©PUN_Id®©#PUN_Id", _
            "SYS_Id®©0®©0®©SYS_Id®©#SYS_Id", _
            "SYS_Name®©2500®©0®©SYS_Name®©#SYS_Name", _
            "BND_IdC®©0®©0®©BND_IdC®©#BND_IdC", _
            "BND_NameC®©1500®©0®©BND_NameC®©#BND_NameC", _
            "BND_IdD®©0®©0®©BND_IdD®©#BND_IdD", _
            "BND_NameD®©1500®©0®©BND_NameD®©#BND_NameD", _
            "BND_IdE®©0®©0®©BND_IdE®©#BND_IdE", _
            "BND_NameE®©1500®©0®©BND_NameE®©#BND_NameE", _
            "BND_IdF®©0®©0®©BND_IdF®©#BND_IdF", _
            "BND_NameF®©1500®©0®©BND_NameF®©#BND_NameF", _
            "PUN_AMin®©1000®©0®©PUN_AMin®©#PUN_AMin", _
            "PUN_AMax®©1000®©0®©PUN_AMax®©#PUN_AMax", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    With mt_DetailConfig(5)
        .FrameIndex = 5
        .NameFrame = "DPC_MatThick"
        .MainConfigIndex = 5
        .DetailKey = 5
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_MatThick_sel $Key1$, $Key2$, $Key3$, $Language_code$"

        .RequestAdd = ""
        .RequestUpd = ""
        .RequestDel = "exec DPC_MatThick_del2 $SYS_Id$,$PRD_Id$,$MAT_Id$,$U_Code$,$iConcurrency$"
        
        .RequestCheckAdd = "select MTH_Id from DPC_MatThick where (SYS_Id=$SYS_Id$ OR (ISNULL($SYS_Id$,0) = 0 AND SYS_Id IS NULL)) AND (PRD_Id=$PRD_Id$ OR (ISNULL($PRD_Id$,'') = '' AND PRD_Id IS NULL)) AND MAT_Id=$MAT_Id$ and drop_flag<>'X'"
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_MatThick"
        .ToolbarIndex = 5
        .ToolbarID = 2937
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(cbo_MTH_MAT_Id, 1)
        '.ListFieldsMandatory(0) = Array(cbo_MTH_System, 0)
        '.ListFieldsMandatory(1) = Array(cbo_MTH_MAT_Id, 1)
        
        ReDim .ListFieldsToDisable(3)
        Set .ListFieldsToDisable(0) = txt_DetailKey(5)
        Set .ListFieldsToDisable(1) = cbo_MTH_System
        Set .ListFieldsToDisable(2) = cbo_MTH_MAT_Id
        Set .ListFieldsToDisable(3) = cbo_MTH_PRD_Id
        
        .MainGridColumns = Array( _
            "SYS_Id®©0®©1®©SYS_Id®©#SYS_Id", _
            "SYS_Name®©2500®©0®©SYS_Name®©#SYS_Name", _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Name®©2500®©0®©PRD_Name®©#Product Name", _
            "MAT_Id®©0®©1®©MAT_Id®©#MAT_Id", _
            "MAT_Name®©2500®©0®©MAT_Name®©#MAT_Name", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    With mt_DetailConfig(6)
        .FrameIndex = 6
        .NameFrame = "DPC_Group"
        .MainConfigIndex = 6
        .DetailKey = 6
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Group_sel $Key1$,$Language_code$"

        .RequestAdd = ""
        .RequestUpd = ""
        .RequestDel = ""
        
        .RequestCheckAdd = ""
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Group"
        .ToolbarIndex = 6
        .ToolbarID = 2950
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(4)
        .ListFieldsMandatory(0) = Array(cbo_GRP_Type, 65)
        .ListFieldsMandatory(1) = Array(txt_GRP_Name, 61)
        .ListFieldsMandatory(2) = Array(txt_GRP_Group, 66)
        .ListFieldsMandatory(3) = Array(cbo_GRP_Priority, 67)
        .ListFieldsMandatory(4) = Array(txt_GRP_Order, 68)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(6)
        
        .MainGridColumns = Array( _
            "GRP_Id®©0®©1®©GRP_Id®©#GRP_Id", _
            "GRP_Name®©2500®©0®©GRP_Name®©#GRP_Name", _
            "GRP_Type®©0®©0®©GRP_Type®©#GRP_Type", _
            "GRP_TypeName®©1500®©0®©GRP_TypeName®©#GRP_TypeName", _
            "GRP_Group®©1500®©0®©GRP_Group®©#GRP_Group", _
            "GRP_Priority®©1000®©0®©GRP_Priority®©#GRP_Priority", _
            "GRP_Order®©1000®©0®©GRP_Order®©#GRP_Order", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    With mt_DetailConfig(7)
        .FrameIndex = 7
        .NameFrame = "DPC_Offer"
        .MainConfigIndex = 7
        .DetailKey = 7
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Offer_sel $Key1$,$toolbar_language_code$"

        .RequestAdd = ""
        .RequestUpd = Array("exec DPC_Offer_upd $DOF_Id$,$DOF_Order$,$DOF_IsSchg$,$DOF_IsStp$,$DOF_CanInv$,$DOF_IsTxt$,$DOF_IsVal$,$DOF_IsVal0$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_OfferDesc_upd $DOF_Id$,$toolbar_language_code$,$DOF_Name$,$DOF_Desc$,$DOF_NTemp$,$DOF_DTemp$,$Z_last_upd_user$")
        .RequestDel = ""
        
        .RequestCheckAdd = ""
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Offer"
        .ToolbarIndex = 7
        .ToolbarID = 2955
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(txt_DOF_Order, 85)
        
        ReDim .ListFieldsToDisable(6)
        Set .ListFieldsToDisable(0) = txt_DetailKey(7)
        Set .ListFieldsToDisable(1) = chk_DOF_IsSchg
        Set .ListFieldsToDisable(2) = chk_DOF_IsStp
        Set .ListFieldsToDisable(3) = chk_DOF_CanInv
        Set .ListFieldsToDisable(4) = chk_DOF_IsTxt
        Set .ListFieldsToDisable(5) = chk_DOF_IsVal
        Set .ListFieldsToDisable(6) = chk_DOF_IsVal0
        
        .MainGridColumns = Array( _
            "DOF_Id®©0®©1®©DOF_Id®©#DOF_Id", _
            "DOF_SourceName®©1500®©0®©DOF_SourceName®©#DOF_SourceName", _
            "DOF_Name®©1500®©0®©DOF_Name®©#DOF_Name", _
            "DOF_Desc®©1500®©0®©DOF_Desc®©#DOF_Desc", _
            "DOF_NTemp®©1500®©0®©DOF_NTemp®©#DOF_NTemp", _
            "DOF_DTemp®©1500®©0®©DOF_DTemp®©#DOF_DTemp", _
            "DOF_Tag®©1500®©0®©DOF_Tag®©#DOF_Tag", _
            "DOF_Order®©0®©0®©DOF_Order®©#DOF_Order", _
            "DOF_IsSchg®©800®©0®©DOF_IsSchg®©#DOF_IsSchg", _
            "DOF_IsStp®©800®©0®©DOF_IsStp®©#DOF_IsStp", _
            "DOF_CanInv®©800®©0®©DOF_CanInv®©#DOF_CanInv", _
            "DOF_IsTxt®©800®©0®©DOF_IsTxt®©#DOF_IsTxt", _
            "DOF_IsVal®©800®©0®©DOF_IsVal®©#DOF_IsVal", _
            "Z_Creator®©0®©0®©Z_Creator®©#Z_Creator", _
            "Z_Creation®©1000®©0®©Z_Creation®©#Creation date")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    With mt_DetailConfig(8)
        .FrameIndex = 8
        .NameFrame = "A_Config"
        .MainConfigIndex = 8
        .DetailKey = 8
        .ClearControlsBeforeInit = True

        .RequestView = "exec A_Config_sel2 $Key1$"

        .RequestAdd = ""
        .RequestUpd = "exec A_config_upd $CFG_Key$,$CFG_Value$,$CFG_Info$"
        .RequestDel = ""
        
        .RequestCheckAdd = ""
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = ""
        .ToolbarIndex = 8
        .ToolbarID = 2957
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(txt_CFG_Value, 99)
        
        ReDim .ListFieldsToDisable(2)
        Set .ListFieldsToDisable(0) = txt_DetailKey(8)
        Set .ListFieldsToDisable(1) = txt_CFG_Key
        Set .ListFieldsToDisable(2) = txt_CFG_Info
        
        .MainGridColumns = Array( _
            "CFG_Key®©4000®©1®©CFG_Key®©#CFG_Key", _
            "CFG_Value®©2000®©0®©CFG_Value®©#CFG_Value", _
            "CFG_Info®©7000®©0®©CFG_Info®©#CFG_Info")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    With mt_DetailConfig(9)
        .FrameIndex = 9
        .NameFrame = "GEN_LegalEntity"
        .MainConfigIndex = 9
        .DetailKey = 9
        .ClearControlsBeforeInit = True

        .RequestView = "exec GEN_LegalEntity_sel $Key1$, $toolbar_language_code$"

        .RequestAdd = "exec GEN_LegalEntity_ins3 $LEN_Id$,$LEN_ShortName$,$LEN_Name$,$LEN_Address1$,$LEN_Address2$,$LEN_Zip$,$LEN_City$,$LEN_CT_Code$,$LEN_Tel$,$LEN_Fax$,$LEN_Email$,$LEN_WWW$,$LEN_SlsOrg$,$LEN_SlsChan$,$LEN_AsItem$,$LEN_BaeKonto$,$LEN_BaeKontoDesc$,$Z_creator$"
        .RequestUpd = "exec GEN_LegalEntity_upd3 $LEN_Id$,$LEN_ShortName$,$LEN_Name$,$LEN_Address1$,$LEN_Address2$,$LEN_Zip$,$LEN_City$,$LEN_CT_Code$,$LEN_Tel$,$LEN_Fax$,$LEN_Email$,$LEN_WWW$,$LEN_SlsOrg$,$LEN_SlsChan$,$LEN_AsItem$,$LEN_BaeKonto$,$LEN_BaeKontoDesc$,$Z_last_upd_user$,$iConcurrency$"
        .RequestDel = "exec GEN_LegalEntity_del $LEN_Id$,$Z_last_upd_user$,$iConcurrency$"
        
        .RequestCheckAdd = ""
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "GEN_LegalEntity"
        .ToolbarIndex = 9
        .ToolbarID = 2969
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(txt_LEN_ShortName, 105)
        
        ReDim .ListFieldsToDisable(1)
        Set .ListFieldsToDisable(0) = txt_DetailKey(9)
        Set .ListFieldsToDisable(1) = txt_LEN_BaeKontoDesc
        
        .MainGridColumns = Array( _
            "LEN_Id®©0®©1®©LEN_Id®©#LEN_Id", _
            "LEN_ShortName®©2500®©0®©LEN_ShortName®©#LEN_ShortName", _
            "LEN_ZIP®©1000®©0®©LEN_ZIP®©#LEN_ZIP", _
            "LEN_City®©2000®©0®©LEN_City®©#LEN_City", _
            "LEN_TEL®©2000®©0®©LEN_TEL®©#LEN_TEL", _
            "LEN_SlsOrg®©1000®©0®©LEN_SlsOrg®©#LEN_SlsOrg", _
            "LEN_SlsChan®©1000®©0®©LEN_SlsChan®©#LEN_SlsChan", _
            "LEN_AsItem®©1000®©0®©LEN_AsItem®©#LEN_AsItem")

        ReDim .InitControls(-1 To -1)
        'control, tag, visible, request, maxlength
    End With
    
    
    For ll_Index = 0 To UBound(mt_MainConfig)
        mt_MainConfig(ll_Index).CurrentTvwSelMethod = eTvwSelMethod.etmNone
        ll_frameIndex = mt_MainConfig(ll_Index).FrameIndex
        cmd_TVReLoad(ll_frameIndex).Picture = mo_Tools.LoadIconFromA_Icons(ICON_RELOAD)
        Call SetTreeDelayedMode(ll_frameIndex, False)
    Next
        
    For ll_Index = 0 To UBound(mt_DetailConfig)
        
        mt_DetailConfig(ll_Index).DeleteMsg(0, 0) = "7200"
        mt_DetailConfig(ll_Index).DeleteMsg(0, 1) = "#Do you really want to delete this record?"
        mt_DetailConfig(ll_Index).UpdateMsg(0, 0) = "2133"
        mt_DetailConfig(ll_Index).UpdateMsg(0, 1) = "#You can not update this record."
        mt_DetailConfig(ll_Index).CheckAddUpdMsg(0, 0) = "2102"
        mt_DetailConfig(ll_Index).CheckAddUpdMsg(0, 1) = "#You cannot add this item because this record is already in the database."
        mt_DetailConfig(ll_Index).CheckDelMsg(0, 0) = "2103"
        mt_DetailConfig(ll_Index).CheckDelMsg(0, 1) = "#You cannot delete this record because there is some data link to it." & vbCrLf & "You must delete all the records attached to it before being able to delete this record."
        
        'mt_DetailConfig(ll_Index).AffectedCount = Array(1, 1, 1)
        If Not mt_DetailConfig(ll_Index).IsMultiDetailFrame Then
            Call InitFrameControls(mt_DetailConfig(ll_Index).InitControls)
        End If
    Next
    
    ReDim mt_SubdetailConfig(8)
    
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        mt_SubdetailConfig(ll_Index).DeleteMsg(0, 0) = "7200"
        mt_SubdetailConfig(ll_Index).DeleteMsg(0, 1) = "#Do you really want to delete this record?"
        mt_SubdetailConfig(ll_Index).UpdateMsg(0, 0) = "2133"
        mt_SubdetailConfig(ll_Index).UpdateMsg(0, 1) = "#You can not update this record."
        mt_SubdetailConfig(ll_Index).CheckAddUpdMsg(0, 0) = "2102"
        mt_SubdetailConfig(ll_Index).CheckAddUpdMsg(0, 1) = "#You cannot add this item because this record is already in the database."
        mt_SubdetailConfig(ll_Index).CheckDelMsg(0, 0) = "2103"
        mt_SubdetailConfig(ll_Index).CheckDelMsg(0, 1) = "#You cannot delete this record because there is some data link to it." & vbCrLf & "You must delete all the records attached to it before being able to delete this record."
        
        mt_SubdetailConfig(ll_Index).GridDelayMethod = egmLoadAlways
        ReDim mt_SubdetailConfig(ll_Index).DeletedRows(-1 To -1)
    Next
            
    With mt_SubdetailConfig(0)
        .FrameIndex = 0
        .NameFrame = "DPC_BendingConfig"
        .DetailConfigIndex = 0
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 1
        .ShowInTabs = True
        
        .RequestView = ""
        .RequestAdd = ""
        .RequestUpd = ""
        .RequestDel = ""
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = ""
        .TableOrder = ""
        
        .ToolbarID = 2818
        .ToolbarIndex = 0
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "SYD_Order®©0®©0®©SYD_Order®©#SYD_Order", _
            "SYD1_Id®©0®©1®©SYD1_Id®©#SYD1_Id", _
            "PRD1_Id®©0®©0®©PRD1_Id®©#PRD1_Id", _
            "SYD1_Value®©0®©0®©SYD1_Value®©#SYD1_Value", _
            "PRD1_Desc®©1200®©0®©PRD1_Desc®©#PRD1_Desc", _
            "Conc1®©0®©0®©Conc1®©#Conc1", _
            "SYD2_Id®©0®©1®©SYD2_Id®©#SYD2_Id", _
            "PRD2_Id®©0®©0®©PRD2_Id®©#PRD2_Id", _
            "SYD2_Value®©0®©0®©SYD2_Value®©#SYD2_Value", _
            "PRD2_Desc®©1200®©0®©PRD2_Desc®©#PRD2_Desc", _
            "Conc2®©0®©0®©Conc2®©#Conc2", _
            "SYD3_Id®©0®©1®©SYD3_Id®©#SYD3_Id", _
            "PRD3_Id®©0®©0®©PRD3_Id®©#PRD3_Id", _
            "SYD3_Value®©0®©0®©SYD3_Value®©#SYD3_Value", _
            "PRD3_Desc®©1200®©0®©PRD3_Desc®©#PRD3_Desc", _
            "Conc3®©0®©0®©Conc3®©#Conc3", _
            "SYD4_Id®©0®©1®©SYD4_Id®©#SYD4_Id", _
            "PRD4_Id®©0®©0®©PRD4_Id®©#PRD4_Id", _
            "SYD4_Value®©0®©0®©SYD4_Value®©#SYD4_Value", _
            "PRD4_Desc®©1200®©0®©PRD4_Desc®©#PRD4_Desc", _
            "Conc4®©0®©0®©Conc4®©#Conc4", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(3)
        .ListFieldsMandatory(0) = Array(cbo_SysBending(0), 34)
        .ListFieldsMandatory(1) = Array(cbo_SysBending(1), 35)
        .ListFieldsMandatory(2) = Array(cbo_SysBending(2), 36)
        .ListFieldsMandatory(3) = Array(cbo_SysBending(3), 37)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(1)
        .FrameIndex = 1
        .NameFrame = "DPC_PackingConfig"
        .DetailConfigIndex = 0 'DPC_System
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 2
        .ShowInTabs = True
        
        .RequestView = "exec DPC_SysDefault_lst $Key1$, " & eDPCSystemDefaultType.sdPacking & ", $toolbar_language_code$"
        .RequestAdd = "exec DPC_SysDefault_ins2 $SYD_Id$,$SYS_Id$,$PRD_Id$," & eDPCSystemDefaultType.sdPacking & ",0,$SYD_Order$,0,0,0,$U_Code$"
        .RequestUpd = ""
        .RequestDel = "exec DPC_SysDefault_del $SYD_Id$,$U_Code$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_SysDefault"
        .TableOrder = ""
        
        .ToolbarID = 2883
        .ToolbarIndex = 1
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "SYD_Id®©0®©1®©SYD_Id®©SYD_Id", _
            "PRD_Id®©0®©0®©PRD_Id®©#PRD_Id", _
            "PRD_Name®©2500®©0®©PRD_Name®©#PRD_Name", _
            "SYD_Order®©500®©0®©SYD_Order®©#SYD_Order", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(cbo_SysPacking, 38)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(2)
        .FrameIndex = 2
        .NameFrame = "DPC_MatThick"
        .DetailConfigIndex = 5
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 1
        .ShowInTabs = False
        
        .RequestView = "exec DPC_MatThick_lst2 $Key1$, $Key2$, $MAT_Id$, $Language_code$"
        
        'defined in custom db before
        .RequestAdd = ""
        .RequestUpd = ""
        .RequestDel = "exec DPC_MatThick_del $MTH_Id$,$U_Code$,$iConcurrency$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_MatThick"
        .TableOrder = ""
        
        .ToolbarID = 2943
        .ToolbarIndex = 1
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "MTH_Id®©0®©1®©MTH_Id®©MTH_Id", _
            "MTH_AMin®©1500®©0®©MTH_AMin®©#MTH_AMin®©FLOAT", _
            "MTH_AMax®©1500®©0®©MTH_AMax®©#MTH_AMax®©FLOAT", _
            "MTH_BMin®©1500®©0®©MTH_BMin®©#MTH_BMin®©FLOAT", _
            "MTH_BMax®©1500®©0®©MTH_BMax®©#MTH_BMax®©FLOAT", _
            "MTH_Thick®©1500®©0®©MTH_Thick®©#MTH_Thick®©FLOAT", _
            "MTH_H®©1500®©0®©MTH_H®©#MTH_H®©FLOAT", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(5)
        .ListFieldsMandatory(0) = Array(txt_MTH_AMin, 148)
        .ListFieldsMandatory(1) = Array(txt_MTH_AMax, 16)
        .ListFieldsMandatory(2) = Array(txt_MTH_BMin, 149)
        .ListFieldsMandatory(3) = Array(txt_MTH_BMax, 17)
        .ListFieldsMandatory(4) = Array(txt_MTH_Thick, 18)
        .ListFieldsMandatory(5) = Array(txt_MTH_H, 19)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(3)
        .FrameIndex = 3
        .NameFrame = "DPC_GasketConfig"
        .DetailConfigIndex = 0
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 3
        .ShowInTabs = True
        
        .RequestView = ""
        .RequestAdd = ""
        .RequestUpd = ""
        .RequestDel = ""
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = ""
        .TableOrder = ""
        
        .ToolbarID = 2947
        .ToolbarIndex = 3
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "SYD_Order®©0®©0®©SYD_Order®©#SYD_Order", _
            "SYD1_Id®©0®©1®©SYD1_Id®©#SYD1_Id", _
            "PRD1_Id®©0®©0®©PRD1_Id®©#PRD1_Id", _
            "SYD1_Value®©600®©0®©SYD1_Value®©#SYD1_Value", _
            "PRD1_Desc®©2300®©0®©PRD1_Desc®©#PRD1_Desc", _
            "Conc1®©0®©0®©Conc1®©#Conc1", _
            "SYD2_Id®©0®©1®©SYD2_Id®©#SYD2_Id", _
            "PRD2_Id®©0®©0®©PRD2_Id®©#PRD2_Id", _
            "SYD2_Value®©600®©0®©SYD2_Value®©#SYD2_Value", _
            "PRD2_Desc®©2300®©0®©PRD2_Desc®©#PRD2_Desc", _
            "Conc2®©0®©0®©Conc2®©#Conc2", _
            "SYD3_Id®©0®©1®©SYD3_Id®©#SYD3_Id", _
            "PRD3_Id®©0®©0®©PRD3_Id®©#PRD3_Id", _
            "SYD3_Value®©600®©0®©SYD3_Value®©#SYD3_Value", _
            "PRD3_Desc®©2300®©0®©PRD3_Desc®©#PRD3_Desc", _
            "Conc3®©0®©0®©Conc3®©#Conc3", _
            "SYD4_Id®©0®©1®©SYD4_Id®©#SYD4_Id", _
            "PRD4_Id®©0®©0®©PRD4_Id®©#PRD4_Id", _
            "SYD4_Value®©600®©0®©SYD4_Value®©#SYD4_Value", _
            "PRD4_Desc®©2300®©0®©PRD4_Desc®©#PRD4_Desc", _
            "Conc4®©0®©0®©Conc4®©#Conc4", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(-1 To -1)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(4)
        .FrameIndex = 4
        .NameFrame = "DPC_SpacerConfig"
        .DetailConfigIndex = 0
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 4
        .ShowInTabs = True
        
        .RequestView = ""
        .RequestAdd = ""
        .RequestUpd = ""
        .RequestDel = ""
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = ""
        .TableOrder = ""
        
        .ToolbarID = 2948
        .ToolbarIndex = 4
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "SYD_Order®©0®©0®©SYD_Order®©#SYD_Order", _
            "SYD1_Id®©0®©1®©SYD1_Id®©#SYD1_Id", _
            "PRD1_Id®©0®©0®©PRD1_Id®©#PRD1_Id", _
            "SYD1_Value®©600®©0®©SYD1_Value®©#SYD1_Value", _
            "PRD1_Desc®©2300®©0®©PRD1_Desc®©#PRD1_Desc", _
            "Conc1®©0®©0®©Conc1®©#Conc1", _
            "SYD2_Id®©0®©1®©SYD2_Id®©#SYD2_Id", _
            "PRD2_Id®©0®©0®©PRD2_Id®©#PRD2_Id", _
            "SYD2_Value®©600®©0®©SYD2_Value®©#SYD2_Value", _
            "PRD2_Desc®©2300®©0®©PRD2_Desc®©#PRD2_Desc", _
            "Conc2®©0®©0®©Conc2®©#Conc2", _
            "SYD3_Id®©0®©1®©SYD3_Id®©#SYD3_Id", _
            "PRD3_Id®©0®©0®©PRD3_Id®©#PRD3_Id", _
            "SYD3_Value®©600®©0®©SYD3_Value®©#SYD3_Value", _
            "PRD3_Desc®©2300®©0®©PRD3_Desc®©#PRD3_Desc", _
            "Conc3®©0®©0®©Conc3®©#Conc3", _
            "SYD4_Id®©0®©1®©SYD4_Id®©#SYD4_Id", _
            "PRD4_Id®©0®©0®©PRD4_Id®©#PRD4_Id", _
            "SYD4_Value®©600®©0®©SYD4_Value®©#SYD4_Value", _
            "PRD4_Desc®©2300®©0®©PRD4_Desc®©#PRD4_Desc", _
            "Conc4®©0®©0®©Conc4®©#Conc4", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(-1 To -1)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(5)
        .FrameIndex = 5
        .NameFrame = "DPC_GroupParam"
        .DetailConfigIndex = 0
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 5
        .ShowInTabs = True
        
        .RequestView = "exec DPC_GroupParam_lst $Key1$, $toolbar_language_code$"
        .RequestAdd = "exec DPC_GroupParam_ins $GPP_Id$,$SYS_Id$,$GRP_Id$,$GPP_Order$,$GPP_Param0$,$GPP_Operator0$,$GPP_Value0$,$GPP_Param1$,$GPP_Operator1$,$GPP_Value1$," & _
                      "$GPP_Param2$,$GPP_Operator2$,$GPP_Value2$,$GPP_Param3$,$GPP_Operator3$,$GPP_Value3$,$GPP_Param4$,$GPP_Operator4$,$GPP_Value4$," & _
                      "$GPP_Param5$,$GPP_Operator5$,$GPP_Value5$,$GPP_Param6$,$GPP_Operator6$,$GPP_Value6$,$GPP_Param7$,$GPP_Operator7$,$GPP_Value7$," & _
                      "$GPP_Param8$,$GPP_Operator8$,$GPP_Value8$,$GPP_Param9$,$GPP_Operator9$,$GPP_Value9$,$U_Code$"
        .RequestUpd = "exec DPC_GroupParam_upd $GPP_Id$,$SYS_Id$,$GRP_Id$,$GPP_Order$,$GPP_Param0$,$GPP_Operator0$,$GPP_Value0$,$GPP_Param1$,$GPP_Operator1$,$GPP_Value1$," & _
                      "$GPP_Param2$,$GPP_Operator2$,$GPP_Value2$,$GPP_Param3$,$GPP_Operator3$,$GPP_Value3$,$GPP_Param4$,$GPP_Operator4$,$GPP_Value4$," & _
                      "$GPP_Param5$,$GPP_Operator5$,$GPP_Value5$,$GPP_Param6$,$GPP_Operator6$,$GPP_Value6$,$GPP_Param7$,$GPP_Operator7$,$GPP_Value7$," & _
                      "$GPP_Param8$,$GPP_Operator8$,$GPP_Value8$,$GPP_Param9$,$GPP_Operator9$,$GPP_Value9$,$U_Code$,$iConcurrency$"
        .RequestDel = "exec DPC_GroupParam_del $GPP_Id$,$U_Code$,$iConcurrency$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_GroupParam"
        .TableOrder = ""
        
        .ToolbarID = 2953
        .ToolbarIndex = 5
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "GPP_Id®©0®©1®©GPP_Id®©#GPP_Id", "GRP_Id®©0®©0®©GRP_Id®©#GRP_Id", "GRP_Group®©1000®©0®©GRP_Group®©#GRP_Group", "GRP_Name®©4500®©0®©GRP_Name®©#GRP_Name", _
            "GPP_Order®©0®©0®©GPP_Order®©#GPP_Order", "GRP_Type®©0®©0®©GRP_Type®©#GRP_Typ", _
            "GPP_Param0®©0®©0®©GPP_Param0®©#GPP_Param0", "GPP_Param0Name®©1000®©0®©GPP_Param0Name®©#GPP_Param0Name", _
            "GPP_Operator0®©0®©0®©GPP_Operator0®©#GPP_Operator0", "GPP_Opr0Name®©300®©0®©GPP_Opr0Name®©#GPP_Opr0Name", "GPP_Value0®©1000®©0®©GPP_Value0®©#GPP_Value0", _
            "GPP_Param1®©0®©0®©GPP_Param1®©#GPP_Param1", "GPP_Param1Name®©1000®©0®©GPP_Param1Name®©#GPP_Param1Name", _
            "GPP_Operator1®©0®©0®©GPP_Operator1®©#GPP_Operator1", "GPP_Opr1Name®©300®©0®©GPP_Opr1Name®©#GPP_Opr1Name", "GPP_Value1®©1000®©0®©GPP_Value1®©#GPP_Value1", _
            "GPP_Param2®©0®©0®©GPP_Param2®©#GPP_Param2", "GPP_Param2Name®©1000®©0®©GPP_Param2Name®©#GPP_Param2Name", _
            "GPP_Operator2®©0®©0®©GPP_Operator2®©#GPP_Operator2", "GPP_Opr2Name®©300®©0®©GPP_Opr2Name®©#GPP_Opr2Name", "GPP_Value2®©1000®©0®©GPP_Value2®©#GPP_Value2", _
            "GPP_Param3®©0®©0®©GPP_Param3®©#GPP_Param3", "GPP_Param3Name®©1000®©0®©GPP_Param3Name®©#GPP_Param3Name", _
            "GPP_Operator3®©0®©0®©GPP_Operator3®©#GPP_Operator3", "GPP_Opr3Name®©300®©0®©GPP_Opr3Name®©#GPP_Opr3Name", "GPP_Value3®©1000®©0®©GPP_Value3®©#GPP_Value3", _
            "GPP_Param4®©0®©0®©GPP_Param4®©#GPP_Param4", "GPP_Param4Name®©1000®©0®©GPP_Param4Name®©#GPP_Param4Name", _
            "GPP_Operator4®©0®©0®©GPP_Operator4®©#GPP_Operator4", "GPP_Opr4Name®©300®©0®©GPP_Opr4Name®©#GPP_Opr4Name", "GPP_Value4®©1000®©0®©GPP_Value4®©#GPP_Value4", _
            "GPP_Param5®©0®©0®©GPP_Param5®©#GPP_Param5", "GPP_Param5Name®©1000®©0®©GPP_Param5Name®©#GPP_Param5Name", _
            "GPP_Operator5®©0®©0®©GPP_Operator5®©#GPP_Operator5", "GPP_Opr5Name®©300®©0®©GPP_Opr5Name®©#GPP_Opr5Name", "GPP_Value5®©1000®©0®©GPP_Value5®©#GPP_Value5", _
            "GPP_Param6®©0®©0®©GPP_Param6®©#GPP_Param6", "GPP_Param6Name®©1000®©0®©GPP_Param6Name®©#GPP_Param6Name", _
            "GPP_Operator6®©0®©0®©GPP_Operator6®©#GPP_Operator6", "GPP_Opr6Name®©300®©0®©GPP_Opr6Name®©#GPP_Opr6Name", "GPP_Value6®©1000®©0®©GPP_Value6®©#GPP_Value6", _
            "GPP_Param7®©0®©0®©GPP_Param7®©#GPP_Param7", "GPP_Param7Name®©1000®©0®©GPP_Param7Name®©#GPP_Param7Name", _
            "GPP_Operator7®©0®©0®©GPP_Operator7®©#GPP_Operator7", "GPP_Opr7Name®©300®©0®©GPP_Opr7Name®©#GPP_Opr7Name", "GPP_Value7®©1000®©0®©GPP_Value7®©#GPP_Value7", _
            "GPP_Param8®©0®©0®©GPP_Param8®©#GPP_Param8", "GPP_Param8Name®©1000®©0®©GPP_Param8Name®©#GPP_Param8Name", _
            "GPP_Operator8®©0®©0®©GPP_Operator8®©#GPP_Operator8", "GPP_Opr8Name®©300®©0®©GPP_Opr8Name®©#GPP_Opr8Name", "GPP_Value8®©1000®©0®©GPP_Value8®©#GPP_Value8", _
            "GPP_Param9®©0®©0®©GPP_Param9®©#GPP_Param9", "GPP_Param9Name®©1000®©0®©GPP_Param9Name®©#GPP_Param9Name", _
            "GPP_Operator9®©0®©0®©GPP_Operator9®©#GPP_Operator9", "GPP_Opr9Name®©300®©0®©GPP_Opr9Name®©#GPP_Opr9Name", "GPP_Value9®©1000®©0®©GPP_Value9®©#GPP_Value9", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(1)
        .ListFieldsMandatory(0) = Array(cbo_GPP_Group, 63)
        .ListFieldsMandatory(1) = Array(txt_GPP_Order, 71)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(6)
        .FrameIndex = 6
        .NameFrame = "Cap_OfferGenTerm"
        .DetailConfigIndex = 9
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 5
        .ShowInTabs = False
        
        .RequestView = "exec CAP_OfferGenTerm_lst $Key1$, $toolbar_language_code$"
        .RequestAdd = "exec CAP_OfferGenTerm_ins $OGT_Id$,$LEN_Id$,NULL,$Language_Code$,$MEM_Id$,$IMG_Id$,$U_Code$"
        .RequestUpd = "exec CAP_OfferGenTerm_upd $OGT_Id$,$LEN_Id$,$CT_Code$,$Language_Code$,$MEM_Id$,$IMG_Id$,$U_Code$,$iConcurrency$"
        .RequestDel = "exec CAP_OfferGenTerm_del $OGT_Id$,$U_Code$,$iConcurrency$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "CAP_OfferGenTerm"
        .TableOrder = ""
        
        .ToolbarID = 2970
        .ToolbarIndex = 6
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "OGT_Id®©0®©1®©OGT_Id®©#OGT_Id", _
            "LEN_Id®©0®©0®©LEN_Id®©#LEN_Id", _
            "CT_Code®©0®©0®©CT_Code®©#CT_Code", _
            "CT_Desc®©0®©0®©CT_Desc®©#CT_Desc", _
            "Language_Code®©0®©0®©Language_Code®©#Language_Code", _
            "Language_Desc®©1500®©0®©Language_Desc®©#Language_Desc", _
            "MEM_Id®©0®©0®©MEM_Id®©#MEM_Id", _
            "MEM_Name®©4000®©0®©MEM_Name®©#MEM_Name", _
            "IMG_Id®©500®©0®©IMG_Id®©#IMG_Id", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(2)
        .ListFieldsMandatory(0) = Array(cbo_OGT_Language_Code, 118)
        .ListFieldsMandatory(1) = Array(cbo_OGT_MEM_Id, 117)
        .ListFieldsMandatory(2) = Array(txt_ImgId(1), 116)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(7)
        .FrameIndex = 7
        .NameFrame = "DPC_InlayConfig"
        .DetailConfigIndex = 0
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 6
        .ShowInTabs = True
        
        .RequestView = "exec DPC_SysDefault_lst $Key1$, " & eDPCSystemDefaultType.sdInlay & ", $toolbar_language_code$"
        .RequestAdd = "exec DPC_SysDefault_ins2 $SYD_Id$,$SYS_Id$,$PRD_Id$," & eDPCSystemDefaultType.sdInlay & ",0,$SYD_Order$,$SYD_Value$,$SYD_Value2$,0,$U_Code$"
        .RequestUpd = "exec DPC_SysDefault_upd2 $SYD_Id$,$SYS_Id$,$PRD_Id$," & eDPCSystemDefaultType.sdInlay & ",0,$SYD_Order$,$SYD_Value$,$SYD_Value2$,0,$U_Code$,$iConcurrency$"
        .RequestDel = "exec DPC_SysDefault_del $SYD_Id$,$U_Code$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_SysDefault"
        .TableOrder = ""
        
        .ToolbarID = 2982
        .ToolbarIndex = 7
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "SYD_Order®©0®©0®©SYD_Order®©#SYD_Order", _
            "SYD_Id®©0®©1®©SYD_Id®©#SYD_Id", _
            "PRD_Id®©0®©0®©PRD_Id®©#PRD_Id", _
            "PRD_Name®©3300®©0®©PRD_Name®©#PRD_Name", _
            "SYD_Value®©1600®©0®©SYD_Value®©#SYD_Value", _
            "SYD_Value2®©1600®©0®©SYD_Value2®©#SYD_Value2", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(1)
        .ListFieldsMandatory(0) = Array(txt_SYS_INL_InlayDec1, 135)
        .ListFieldsMandatory(1) = Array(txt_SYS_INL_InlayDec2, 134)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(8)
        .FrameIndex = 8
        .NameFrame = "DPC_AddValueConfig"
        .DetailConfigIndex = 0
        .Initialized = False
        
        .TabStribIndex = 0
        .TabIndex = 7
        .ShowInTabs = True
        
        .RequestView = "exec DPC_SysDefault_lst $Key1$, " & eDPCSystemDefaultType.sdAddValueSX & ", $toolbar_language_code$"
        .RequestAdd = "exec DPC_SysDefault_ins2 $SYD_Id$,$SYS_Id$,$PRD_Id$," & eDPCSystemDefaultType.sdAddValueSX & ",0,$SYD_Order$,$SYD_Value$,$SYD_Value2$,0,$U_Code$"
        .RequestUpd = "exec DPC_SysDefault_upd2 $SYD_Id$,$SYS_Id$,$PRD_Id$," & eDPCSystemDefaultType.sdAddValueSX & ",0,$SYD_Order$,$SYD_Value$,$SYD_Value2$,0,$U_Code$,$iConcurrency$"
        .RequestDel = "exec DPC_SysDefault_del $SYD_Id$,$U_Code$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_SysDefault"
        .TableOrder = ""
        
        .ToolbarID = 2982
        .ToolbarIndex = 7
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "SYD_Order®©0®©0®©SYD_Order®©#SYD_Order", _
            "SYD_Id®©0®©1®©SYD_Id®©#SYD_Id", _
            "PRD_Id®©0®©0®©PRD_Id®©#PRD_Id", _
            "PRD_Name®©3300®©0®©PRD_Name®©#Bending", _
            "SYD_Value®©1600®©0®©SYD_Value®©#Thickness", _
            "SYD_Value2®©1600®©0®©SYD_Value2®©#Add.value", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(2)
        .ListFieldsMandatory(0) = Array(cbo_SysBendAddValue, 146)
        .ListFieldsMandatory(1) = Array(txt_SYS_AddValueThickness, 144)
        .ListFieldsMandatory(2) = Array(txt_SYS_AddValueSX, 145)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With
    Exit Sub
ErrHandler:
    Call ErrorHandler("Load_ConfigInfo")
End Sub

Private Function tlb_Main_CustomAction(Index As Integer, ByVal as_Role As String, as_Language As String) As Boolean
On Error GoTo ErrHandler
    
    Dim ll_MainIndex As Long
    
    ll_MainIndex = FindMainConfigByFrameIndex(Index)
    
    tlb_Main_CustomAction = False
    Select Case as_Role
    Case "A"
    Case "B", "C"
    End Select
    Exit Function
ErrHandler:
    Call ErrorHandler("tlb_Main_CustomAction")
End Function

Private Function tlb_detail_CustomAction(Index As Integer, ByVal as_Role As String, as_Language As String) As Boolean
On Error GoTo ErrHandler
    
Dim ll_FDA_Code As Long
Dim ll_DetailIndex As Long

    tlb_detail_CustomAction = False
    ll_DetailIndex = FindDetailConfigByFrameIndex(Index)
    Select Case as_Role
    End Select
    Exit Function
ErrHandler:
    Call ErrorHandler("tlb_detail_CustomAction")
End Function

Private Function tlb_Subdetail_CustomAction(Index As Integer, ByVal as_Role As String, as_Language As String) As Boolean
On Error GoTo ErrHandler
    
    Dim ll_SubdetailIndex As Long
    
    tlb_Subdetail_CustomAction = False
    ll_SubdetailIndex = FindSubDetailConfigByFrameIndex(Index)
    If as_Role = "O" Or as_Role = "P" Or as_Role = "g" Then
        tlb_Subdetail_CustomAction = True
        If grd_SubDetail(Index).SelectedCount <> 1 Then Exit Function
        
        Select Case as_Role
        Case "P"
        Case "g"
        End Select
    End If
    Exit Function
ErrHandler:
    Call ErrorHandler("tlb_Subdetail_CustomAction")
End Function

Private Function FindDetailConfigByTableType(ByVal ae_TableType As eTableType) As Long
On Error GoTo ErrHandler

    Select Case ae_TableType
    Case eTableType.ttDPC_System
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_System")
    Case eTableType.ttDPC_SysCat
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_SysCat")
    Case eTableType.ttDPC_Material
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Material")
    Case eTableType.ttDPC_Coil
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Coil")
    Case eTableType.ttDPC_PU
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_PU")
    Case eTableType.ttDPC_MatThick
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_MatThick")
    Case eTableType.ttDPC_Group
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Group")
    Case eTableType.ttDPC_Offer
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Offer")
    Case eTableType.ttDPC_AConfig
        FindDetailConfigByTableType = FindDetailConfigByName("A_Config")
    Case eTableType.ttGEN_LegalEntity
        FindDetailConfigByTableType = FindDetailConfigByName("GEN_LegalEntity")
    Case Else
        Err.Raise ArmErr.CompFncFailed, "ae_TableType", "Unknown table type : " & ae_TableType
    End Select
    Exit Function
ErrHandler:
    Call ErrorHandler("FindDetailConfigByTableType")
End Function

Private Function grd_Main_CustomAction(Index As Integer, ByVal ae_Action As eControlAction) As Boolean
On Error GoTo ErrHandler

Dim ll_MainIndex As Long
Dim ll_FDA_Code As Long

    grd_Main_CustomAction = False
    ll_MainIndex = FindMainConfigByFrameIndex(Index)
    If StrComp(mt_MainConfig(ll_MainIndex).NameFrame, "DPC_Ref", vbTextCompare) = 0 Then
        If grd_Main(Index).SelectedCount = 1 Then
            mt_MainConfig(ll_MainIndex).CurrentDetailIndex = FindDetailConfigByTableType(Val(grd_Main(Index).SelectedLine(0, "DocType")))
        End If
    End If
    grd_Main_CustomAction = False
    Exit Function
ErrHandler:
    Call ErrorHandler("grd_Main_CustomAction")
End Function

Private Function Resize_Custom() As Boolean
On Error GoTo ErrHandler

    Resize_Custom = False
    Exit Function
ErrHandler:
    Call ErrorHandler("Resize_Custom")
End Function

Private Sub Item_CustomInit(ByVal al_DetailIndex As Long, ByVal av_Key As Variant, ByVal ae_Mode As eMode)
On Error GoTo ErrHandler

Const LIST_REQUEST_VEN = "exec DPC_Vendor_lst"
Const LIST2_REQUEST_VEN = "exec DPC_SysVendor_lst $SYS_Id$"

    Dim ll_DetailFrameIndex As Long
    Dim ls_Request As String
    Dim ll_Key As Integer
    Dim ll_Index As Integer
    
    ll_DetailFrameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
        
    If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_System" Then
        
        If IsEmpty(av_Key) Then
            ll_Key = -1
        Else
            ll_Key = av_Key(0)
        End If
        
        ls_Request = ReplacePlaceHolder(LIST2_REQUEST_VEN, "$SYS_Id$", mo_Tools.SqlInt(ll_Key))
        Call LoadDetailListView(lv_SysVendor, LIST_REQUEST_VEN, ls_Request, "VEN_Id", "VEN_Name")
        
        For ll_Index = 0 To 3
            If cbo_SYS_Allow(ll_Index).Text = "" Then
                cbo_SYS_Allow(ll_Index).Load
                If cbo_SYS_Allow(ll_Index).SelectedItem Is Nothing Then
                    Call cbo_SYS_Allow(ll_Index).SearchItem(cbo_SYS_Allow(ll_Index).ComboItems(1).Key)
                End If
            End If
        Next
    ElseIf mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Offer" Then
                
        If cbo_DOF_SourceFilter.SelectedItem Is Nothing Then
            Call cbo_DOF_SourceFilter.SearchItem(cbo_DOF_SourceFilter.ComboItems(1).Key)
        End If
    End If

    If ae_Mode <> emAdd Then
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_System" Then
            Call ShowImage(0, txt_ImgId(0), "")
            Call ShowImage(16, txt_ImgId(15), "")
            
            pic_ImgBox(0).Enabled = True
            pic_ImgBox(16).Enabled = True
            cmd_ImageInfo(0).Enabled = True
            cmd_ImageInfo(15).Enabled = True
            
            cmd_FileInfo.Enabled = True
        End If
        
    End If
    
    If ae_Mode = emUpdate Then
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_MatThick" Then
            'cbo_MTH_MAT_Id_Filter.Enabled = False
        End If
    End If
    
    If ae_Mode = emAdd Then
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_System" Then
            pic_ImgBox(0).Picture = Nothing
            pic_ImgBox(16).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_MatThick" Then
            cbo_MTH_MAT_Id.Enabled = True
            cbo_MTH_PRD_Id.Enabled = True
            cbo_MTH_System.Enabled = True
        End If
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_CustomInit")
End Sub

Private Sub Item_CustomLoad(ByVal al_DetailIndex As Long, ByVal av_Key As Variant)
On Error GoTo ErrHandler

Dim ls_Request As String
Dim lo_Tree As ArmTreeView
Dim ll_MainConfigIndex As Long
Dim lsa_path() As String

    ll_MainConfigIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    
    If StrComp(mt_DetailConfig(al_DetailIndex).NameFrame, "DPC_MatThick", vbTextCompare) = 0 Then
        'txt_DetailKey(mt_DetailConfig(al_DetailIndex).DetailKey).Text = av_Key(0)
        'txt_MTH_SYS_Name.Text = av_Key(1)
        
        'select first available material
        'Call cbo_MTH_MAT_Id_Filter.Load
        'Call cbo_MTH_MAT_Id_Filter.SearchItem(cbo_MTH_MAT_Id_Filter.ComboItems(1).Key)

    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_CustomLoad")
End Sub

Private Function Item_CustomCheck(ByVal al_DetailIndex As Long, ByVal ae_Mode As eMode) As Boolean
On Error GoTo ErrHandler
    Dim ll_MainConfigIndex As Long
    Dim ll_MainFrameIndex As Long
    Dim ll_RowIdx, ll_ColIdx
    
    Item_CustomCheck = False
    ll_MainConfigIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    If ll_MainConfigIndex <> -1 Then
        ll_MainFrameIndex = mt_MainConfig(ll_MainConfigIndex).FrameIndex
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_System", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(0).Text) = 0 Then
                    txt_ImgId(0).Text = ""
                End If
                If Val(txt_ImgId(15).Text) = 0 Then
                    txt_ImgId(15).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_MatThick", vbTextCompare) = 0 Then
        
            If ae_Mode = emAdd Then
              If (mo_Tools.GetComboKey(cbo_MTH_PRD_Id) = "" And mo_Tools.GetComboKey(cbo_MTH_System) = "") Then
                Call mo_Tools.MsgText(mo_Db, ms_Language_Code, 666, "#Select one system or one product")
                Item_CustomCheck = False
                Exit Function
              ElseIf (mo_Tools.GetComboKey(cbo_MTH_PRD_Id) <> "" And mo_Tools.GetComboKey(cbo_MTH_System) <> "") Then
                Call mo_Tools.MsgText(mo_Db, ms_Language_Code, 666, "#Both system and product cannot be selected.")
                Item_CustomCheck = False
                Exit Function
              End If
            End If
        End If
        
    Else
        Select Case al_DetailIndex
        Case Else
        End Select
    End If
    Item_CustomCheck = True
    Exit Function
ErrHandler:
    Call ErrorHandler("Item_CustomCheck")
End Function

Private Sub Item_CustomLoadDefaultValue(ByVal al_DetailIndex As Long, ByRef av_ListFieldsDefaultValue As Variant)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long, ll_MainConfigIndex As Long
Dim lo_Tree As ArmTreeView
Dim ls_Code As String, ls_Desc As String

Dim ll_SubdetailConfig As Long
Dim ll_SubdetailFrame As Long
Dim ll_Idx As Long

    ll_MainConfigIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    
    If StrComp(mt_DetailConfig(al_DetailIndex).NameFrame, "", vbTextCompare) = 0 Then
    End If
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_CustomLoadDefaultValue")
End Sub

Private Function Item_CustomAddDB(ByVal al_DetailIndex As Long, ByVal ab_InTransaction As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim ls_Filename As String

    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
                    
    If StrComp(mt_DetailConfig(al_DetailIndex).NameFrame, "DPC_System", vbTextCompare) = 0 And ab_InTransaction = True Then
        Call SaveDetailListCommon(al_DetailIndex)
    End If
    
    Item_CustomAddDB = True
    Exit Function
ErrHandler:
    Item_CustomAddDB = False
    Call ErrorHandler("Item_CustomAddDB")
End Function

Private Function Item_CustomUpdateDB(ByVal al_DetailIndex As Long, ByVal ab_InTransaction As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim ls_Request As String
Dim ll_RowIdx, ll_ColIdx As Long

    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
        
    If StrComp(mt_DetailConfig(al_DetailIndex).NameFrame, "DPC_System", vbTextCompare) = 0 And ab_InTransaction = True Then
        Call SaveDetailListCommon(al_DetailIndex)
    End If
        
    Item_CustomUpdateDB = True
    Exit Function
ErrHandler:
    Item_CustomUpdateDB = False
    Call ErrorHandler("Item_CustomUpdateDB")
End Function

Private Function Item_CustomDeleteDB(ByVal al_DetailIndex As Long, ByVal ab_InTransaction As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Long

    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    If Not ab_InTransaction Then
    
    End If
    Item_CustomDeleteDB = True
    Exit Function
ErrHandler:
    Item_CustomDeleteDB = False
    Call ErrorHandler("Item_CustomDeleteDB")
End Function

Private Sub Item_CustomLocal(ByVal al_DetailIndex As Long, ByVal ae_Mode As eMode)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim ll_MainIndex As Long
Dim ll_MainFrame As Long
Dim ll_PrevDetailIndex As Long
Dim ls_ImgId As String
Dim ls_Array() As String
Dim ll_Index As Long

    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    ll_MainIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    
    If ll_MainIndex <> -1 Then
       ll_MainFrame = mt_MainConfig(ll_MainIndex).FrameIndex
       
       If ae_Mode = emAdd Then
           grd_Main(ll_MainFrame).SelectedLine(0, "Z_Creation") = Now
           grd_Main(ll_MainFrame).SelectedLine(0, "Z_Creator") = ml_U_Code
           grd_Main(ll_MainFrame).SelectedLine(0, "Z_Creator_Name") = ms_UserName
       End If
           
       If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
           grd_Main(ll_MainFrame).SelectedLine(0, "Id") = txt_DetailKey(ll_frameIndex).Text
           Select Case al_DetailIndex + 1
           End Select
       End If
    Else
    End If
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_CustomLocal")
End Sub

Private Sub SubItem_CustomInit(ByVal al_SubDetailIndex As Long, ByVal av_Key As Variant, ByVal ae_Mode As eMode)
On Error GoTo ErrHandler
    Dim ll_frameIndex As Long
    Dim ll_DetailIndex As Long
    Dim ll_Count As Long
    
    ll_DetailIndex = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
        
    If ae_Mode <> emAdd Then
        If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "CAP_OfferGenTerm" Then
            If txt_ImgId(1).Text <> "" Then
                Call ShowImage(1, txt_ImgId(1).Text, "")
            End If
            
            pic_ImgBox(1).Enabled = True
            cmd_ImageInfo(1).Enabled = True
            
            cmd_Memo.Enabled = True
        End If
    End If
    
    If ae_Mode = emAdd Then
        If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "CAP_OfferGenTerm" Then
            pic_ImgBox(1).Picture = Nothing
            cmd_Memo.Enabled = False
        End If
    End If
    
    If (ae_Mode = eMode.emAdd) Or (ae_Mode = eMode.emUpdate) Then
    
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("SubItem_CustomInit")
End Sub

Private Sub SubItem_CustomLoad(ByVal al_SubDetailIndex As Long)
On Error GoTo ErrHandler

Dim ll_Row As Long
Dim ls_Request As String
Dim ll_Cursor As Long
Dim lb_DelayedLoad As Boolean
Dim ll_DetailConfig As Long
Dim ll_DetailFrame As Long
Dim ll_GrdIdx As Integer

    ll_DetailConfig = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    ll_DetailFrame = mt_DetailConfig(ll_DetailConfig).FrameIndex

    If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_BendingConfig" Or _
        mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_GasketConfig" Or _
        mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_SpacerConfig" Then
        
        If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_BendingConfig" Then
            ls_Request = "exec DPC_SysDefault_lst $SYS_Id$," & eDPCSystemDefaultType.sdBending & ", $Language_code$"
            ll_GrdIdx = 0
        ElseIf mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_GasketConfig" Then
            ls_Request = "exec DPC_SysDefault_lst $SYS_Id$," & eDPCSystemDefaultType.sdGasket & ", $Language_code$"
            ll_GrdIdx = 3
        ElseIf mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_SpacerConfig" Then
            ls_Request = "exec DPC_SysDefault_lst $SYS_Id$," & eDPCSystemDefaultType.sdSpacer & ", $Language_code$"
            ll_GrdIdx = 4
        End If
        
        ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrame))
        ls_Request = ReplaceCommonPlaceholders(ls_Request)

        ll_Cursor = mo_Db.OpenSQL(ls_Request)
        ll_Row = 0
        
        While Not mo_Db.EOF(ll_Cursor)
            ReDim lv_Data(3)
            lv_Data(0) = ""         ' this is new
            If grd_SubDetail(ll_GrdIdx).AddLine(lv_Data) Then
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD_Order") = mo_Db.GetFields(ll_Cursor, "SYD_Order")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD1_Id") = mo_Db.GetFields(ll_Cursor, "SYD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD1_Id") = mo_Db.GetFields(ll_Cursor, "PRD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD1_Desc") = mo_Db.GetFields(ll_Cursor, "PRD_Name")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD1_Value") = mo_Db.GetFields(ll_Cursor, "SYD_Value")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "Conc1") = mo_Db.GetFields(ll_Cursor, "iConcurrency")
                    Call mo_Db.Next(ll_Cursor)
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD2_Id") = mo_Db.GetFields(ll_Cursor, "SYD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD2_Id") = mo_Db.GetFields(ll_Cursor, "PRD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD2_Desc") = mo_Db.GetFields(ll_Cursor, "PRD_Name")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD2_Value") = mo_Db.GetFields(ll_Cursor, "SYD_Value")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "Conc2") = mo_Db.GetFields(ll_Cursor, "iConcurrency")
                    Call mo_Db.Next(ll_Cursor)
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD3_Id") = mo_Db.GetFields(ll_Cursor, "SYD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD3_Id") = mo_Db.GetFields(ll_Cursor, "PRD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD3_Desc") = mo_Db.GetFields(ll_Cursor, "PRD_Name")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD3_Value") = mo_Db.GetFields(ll_Cursor, "SYD_Value")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "Conc3") = mo_Db.GetFields(ll_Cursor, "iConcurrency")
                    Call mo_Db.Next(ll_Cursor)
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD4_Id") = mo_Db.GetFields(ll_Cursor, "SYD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD4_Id") = mo_Db.GetFields(ll_Cursor, "PRD_Id")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "PRD4_Desc") = mo_Db.GetFields(ll_Cursor, "PRD_Name")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "SYD4_Value") = mo_Db.GetFields(ll_Cursor, "SYD_Value")
                    grd_SubDetail(ll_GrdIdx).SelectedLine(0, "Conc4") = mo_Db.GetFields(ll_Cursor, "iConcurrency")
                    Call grd_Subdetail_RowLoaded(ll_GrdIdx, ll_Row)
                    ll_Row = ll_Row + 1
            End If
            Call mo_Db.Next(ll_Cursor)
        Wend
        Call mo_Db.Close(ll_Cursor)
        
    ElseIf mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_MatThick" Then
        mt_SubdetailConfig(al_SubDetailIndex).RequestView = mo_Tools.ReplacePlaceholderByControlValue("exec DPC_MatThick_lst2 $Key1$, $Key2$, $Key3$, $Language_Code$", cbo_MTH_MAT_Id)
    End If
                 
    Exit Sub
ErrHandler:

    If ll_Cursor > 0 Then
        Call mo_Db.Close(ll_Cursor)
    End If
    Call ErrorHandler("SubItem_CustomLoad")
End Sub

Private Sub SubItem_CustomLoadDefaultValue(ByVal al_SubDetailIndex As Long, ByRef av_ListFieldsDefaultValue As Variant)
On Error GoTo ErrHandler

    Exit Sub
ErrHandler:
    Call ErrorHandler("SubItem_CustomLoadDefaultValue")
End Sub

Private Function SubItem_CustomCheck(ByVal al_SubDetailIndex As Long, ByVal ae_Mode As eMode) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim ll_Index As Long
Dim ll_RowIdx As Long
Dim ls_Filename As String
Dim lv_MsgReplaceInfo(0, 1) As String
    
    SubItem_CustomCheck = True
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    
    If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_MatThick", vbTextCompare) = 0 Then
        For ll_RowIdx = 0 To grd_SubDetail(ll_frameIndex).Rows
            If txt_MTH_AMax.Text = grd_SubDetail(ll_frameIndex).Data(ll_RowIdx, "MTH_AMax") And _
                txt_MTH_BMax.Text = grd_SubDetail(ll_frameIndex).Data(ll_RowIdx, "MTH_BMax") And _
                txt_MTH_Thick.Text = grd_SubDetail(ll_frameIndex).Data(ll_RowIdx, "MTH_Thick") And _
                txt_MTH_H.Text = grd_SubDetail(ll_frameIndex).Data(ll_RowIdx, "MTH_H") Then
                
                If ae_Mode = eMode.emAdd Or (ae_Mode = eMode.emUpdate And grd_SubDetail(ll_frameIndex).Row <> ll_RowIdx) Then
                    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_SubdetailConfig(al_SubDetailIndex).CheckAddUpdMsg(0, 0), mt_SubdetailConfig(al_SubDetailIndex).CheckAddUpdMsg(0, 1), , vbInformation + vbOKOnly)
                    SubItem_CustomCheck = False
                End If
            End If
        Next
    ElseIf StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_GroupParam", vbTextCompare) = 0 Then
        For ll_Index = 0 To cbo_GPP_Param.UBound
            If cbo_GPP_Param(ll_Index).Text <> "" Then
                If cbo_GPP_Operator(ll_Index).Text = "" Or txt_GPP_Value(ll_Index).Text = "" Then
                    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, C_MSG_ID_BASE + 46, "#Param, Operation or Value missing", , vbInformation + vbOKOnly)
                    SubItem_CustomCheck = False
                End If
            End If
            If cbo_GPP_Param(ll_Index).Text = "" Then
                If cbo_GPP_Operator(ll_Index).Text <> "" Or txt_GPP_Value(ll_Index).Text <> "" Then
                    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, C_MSG_ID_BASE + 46, "#Param, Operation or Value missing", , vbInformation + vbOKOnly)
                    SubItem_CustomCheck = False
                End If
            End If
        Next
    ElseIf StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "CAP_OfferGenTerm", vbTextCompare) = 0 Then
        If txt_ImgId(1).Text = "" Then
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", lbl_Label(116)), vbInformation)
            SubItem_CustomCheck = False
        End If
    End If
    
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_CustomCheck")
End Function

Private Function SubItem_CustomCheckDB(ByVal al_SubDetailIndex As Long, ByVal ae_Mode As eMode)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long

    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "", vbTextCompare) = 0 Then
    End If
    SubItem_CustomCheckDB = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_CustomCheckDB")
End Function

Private Function SubItem_CustomAdd(ByVal al_SubDetailIndex As Long, ByRef ab_CustomSaved As Boolean) As Boolean
On Error GoTo ErrHandler

Dim lb_OldInternalInit As Boolean
Dim ll_frameIndex As Long
Dim ll_Count As Long
Dim ll_DetailIndex As Long

    ab_CustomSaved = False
    lb_OldInternalInit = mb_InternalInit
    mb_InternalInit = True
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailIndex = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    
    If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_BendingConfig", vbTextCompare) = 0 Then
        
        ReDim lv_Data(9)
        lv_Data(0) = ""         ' this is new
        If grd_SubDetail(ll_frameIndex).AddLine(lv_Data) Then
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD_Order") = grd_SubDetail(ll_frameIndex).Rows
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD1_Id") = cbo_SysBending(0).SelectedItem.Key
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD1_Desc") = cbo_SysBending(0).SelectedItem.DisplayText
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD2_Id") = cbo_SysBending(1).SelectedItem.Key
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD2_Desc") = cbo_SysBending(1).SelectedItem.DisplayText
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD3_Id") = cbo_SysBending(2).SelectedItem.Key
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD3_Desc") = cbo_SysBending(2).SelectedItem.DisplayText
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD4_Id") = cbo_SysBending(3).SelectedItem.Key
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD4_Desc") = cbo_SysBending(3).SelectedItem.DisplayText
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "RowStatus") = "A"
        
        End If
        
        ab_CustomSaved = True
    End If
    If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_GasketConfig", vbTextCompare) = 0 Then
        
        ReDim lv_Data(9)
        lv_Data(0) = ""         ' this is new
        If grd_SubDetail(ll_frameIndex).AddLine(lv_Data) Then
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD_Order") = grd_SubDetail(ll_frameIndex).Rows
            If Not cbo_SysGasket(0).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD1_Id") = cbo_SysGasket(0).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD1_Desc") = cbo_SysGasket(0).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD1_Value") = txt_SYD1_Value_G.Text
            If Not cbo_SysGasket(1).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD2_Id") = cbo_SysGasket(1).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD2_Desc") = cbo_SysGasket(1).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD2_Value") = txt_SYD2_Value_G.Text
            If Not cbo_SysGasket(2).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD3_Id") = cbo_SysGasket(2).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD3_Desc") = cbo_SysGasket(2).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD3_Value") = txt_SYD3_Value_G.Text
            If Not cbo_SysGasket(3).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD4_Id") = cbo_SysGasket(3).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD4_Desc") = cbo_SysGasket(3).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD4_Value") = txt_SYD4_Value_G.Text
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "RowStatus") = "A"
        
        End If
        
        ab_CustomSaved = True
    End If
    If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_SpacerConfig", vbTextCompare) = 0 Then
        
        ReDim lv_Data(9)
        lv_Data(0) = ""         ' this is new
        If grd_SubDetail(ll_frameIndex).AddLine(lv_Data) Then
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD_Order") = grd_SubDetail(ll_frameIndex).Rows
            If Not cbo_SysSpacer(0).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD1_Id") = cbo_SysSpacer(0).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD1_Desc") = cbo_SysSpacer(0).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD1_Value") = txt_SYD1_Value_S.Text
            If Not cbo_SysSpacer(1).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD2_Id") = cbo_SysSpacer(1).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD2_Desc") = cbo_SysSpacer(1).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD2_Value") = txt_SYD2_Value_S.Text
            If Not cbo_SysSpacer(2).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD3_Id") = cbo_SysSpacer(2).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD3_Desc") = cbo_SysSpacer(2).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD3_Value") = txt_SYD3_Value_S.Text
            If Not cbo_SysSpacer(3).SelectedItem Is Nothing Then
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD4_Id") = cbo_SysSpacer(3).SelectedItem.Key
                grd_SubDetail(ll_frameIndex).SelectedLine(0, "PRD4_Desc") = cbo_SysSpacer(3).SelectedItem.DisplayText
            End If
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "SYD4_Value") = txt_SYD4_Value_S.Text
            grd_SubDetail(ll_frameIndex).SelectedLine(0, "RowStatus") = "A"
        
        End If
        
        ab_CustomSaved = True
    End If
    If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_PackingConfig", vbTextCompare) = 0 Then
        If grd_SubDetail(ll_frameIndex).Rows = 0 Then
            txt_SYD_Order.Text = 0
        Else
            txt_SYD_Order.Text = grd_SubDetail(ll_frameIndex).Data(grd_SubDetail(ll_frameIndex).Rows, "SYD_Order") + 1
        End If
    End If
    
    mb_InternalInit = lb_OldInternalInit
    SubItem_CustomAdd = True
    Exit Function
ErrHandler:
    mb_InternalInit = lb_OldInternalInit
    Call ErrorHandler("SubItem_CustomAdd")
End Function

Private Function SubItem_CustomUpdate(ByVal al_SubDetailIndex As Long, ByRef ab_CustomSaved As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Long

    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ab_CustomSaved = False
    SubItem_CustomUpdate = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_CustomUpdate")
End Function

Private Function SubItem_CustomDelete(ByVal al_SubDetailIndex As Long, ByRef ab_CustomSaved As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ls_Request As String
Dim ll_frameIndex As Long
Dim ll_DetailConfig As Long
Dim ll_DetailFrame As Long
Dim ll_RowIdx As Long, ll_ColIdx As Long

    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailConfig = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    ll_DetailFrame = mt_DetailConfig(ll_DetailConfig).FrameIndex
        
    ab_CustomSaved = False
    SubItem_CustomDelete = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_CustomDelete")
End Function

Private Function SubItem_CustomDBBefore(ByVal al_SubDetailIndex As Long, ByVal ae_Mode As eMode, ByVal al_Index As Long, ByRef ab_CustomSaved As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ls_Request As String
Dim ll_frameIndex As Long
Dim ll_DetailConfig As Long
Dim ll_DetailFrame As Long
Dim ll_RowIdx As Long, ll_ColIdx As Long, ll_ConcIdx As Long

    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailConfig = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    ll_DetailFrame = mt_DetailConfig(ll_DetailConfig).FrameIndex
    
    If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_BendingConfig", vbTextCompare) = 0 Or _
        StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_GasketConfig", vbTextCompare) = 0 Or _
        StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_SpacerConfig", vbTextCompare) = 0 Then
        
        If ae_Mode = eMode.emAdd Or ae_Mode = eMode.emUpdate Then
                        
            For ll_RowIdx = 0 To 3
                If ae_Mode = eMode.emAdd Then
                    ls_Request = "exec DPC_SysDefault_ins2 '$SYD_Id$',$SYS_Id$,'$PRD_Id$',$SYD_Type$,$SYD_Idx$,$SYD_Order$,$SYD_Value$,0,0,$U_Code$"
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Id$", mo_Tools.GetNextID(mo_Db, "DPC_SysDefault"))
                Else
                    ls_Request = "exec DPC_SysDefault_upd2 '$SYD_Id$',$SYS_Id$,'$PRD_Id$',$SYD_Type$,$SYD_Idx$,$SYD_Order$,$SYD_Value$,0,0,$U_Code$,$iConcurrency$"
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Id$", grd_SubDetail(al_SubDetailIndex).Data(al_Index, "SYD" & ll_RowIdx + 1 & "_Id"))
                End If
                
                ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrame))
                If grd_SubDetail(al_SubDetailIndex).Data(al_Index, "PRD" & ll_RowIdx + 1 & "_Id") = "" Then
                    ls_Request = Replace(ls_Request, "'$PRD_Id$'", "NULL", , , vbTextCompare)
                Else
                    ls_Request = ReplacePlaceHolder(ls_Request, "$PRD_Id$", grd_SubDetail(al_SubDetailIndex).Data(al_Index, "PRD" & ll_RowIdx + 1 & "_Id"))
                End If
                If grd_SubDetail(al_SubDetailIndex).Data(al_Index, "SYD" & ll_RowIdx + 1 & "_Value") = "" Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Value$", "0")
                Else
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Value$", grd_SubDetail(al_SubDetailIndex).Data(al_Index, "SYD" & ll_RowIdx + 1 & "_Value"))
                End If
                
                If StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_BendingConfig", vbTextCompare) = 0 Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Type$", eDPCSystemDefaultType.sdBending)  ' bending
                ElseIf StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_GasketConfig", vbTextCompare) = 0 Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Type$", eDPCSystemDefaultType.sdGasket)   ' bending
                ElseIf StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_SpacerConfig", vbTextCompare) = 0 Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Type$", eDPCSystemDefaultType.sdSpacer)   ' bending
                End If
                                
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Idx$", ll_RowIdx)
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Order$", al_Index)
                ls_Request = ReplacePlaceHolder(ls_Request, "$iConcurrency$", grd_SubDetail(al_SubDetailIndex).Data(al_Index, "Conc" & ll_RowIdx + 1))
                ls_Request = ReplaceCommonPlaceholders(ls_Request)
                
                Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)
            Next
            grd_SubDetail(ll_frameIndex).Data(ll_RowIdx, "iConcurrency") = 1
            grd_SubDetail(ll_frameIndex).Data(ll_RowIdx, STATUS_COLUMN) = ""    ' reset status flag

        End If
        If ae_Mode = eMode.emDelete Then
            For ll_RowIdx = 0 To 3
                ll_ColIdx = grd_SubDetail(ll_frameIndex).Columns("SYD" & ll_RowIdx + 1 & "_Id").ColumnIndex
                ll_ConcIdx = grd_SubDetail(ll_frameIndex).Columns("Conc" & ll_RowIdx + 1).ColumnIndex
                ls_Request = "exec DPC_SysDefault_del $SYD_Id$,$U_Code$"
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Id$", mt_SubdetailConfig(al_SubDetailIndex).DeletedRows(al_Index)(ll_ColIdx))
                ls_Request = ReplaceCommonPlaceholders(ls_Request)
                Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)
            Next
        End If

    ElseIf StrComp(mt_SubdetailConfig(al_SubDetailIndex).NameFrame, "DPC_MatThick", vbTextCompare) = 0 Then
        If ae_Mode = eMode.emAdd Then
            ls_Request = "exec DPC_MatThick_ins $MTH_Id$,$SYS_Id$,$PRD_Id$,$MAT_Id$,$MTH_AMin$,$MTH_AMax$,$MTH_BMin$,$MTH_BMax$,$MTH_Thick$,$MTH_H$,$U_Code$"
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, cbo_MTH_System)
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, cbo_MTH_PRD_Id)
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, cbo_MTH_MAT_Id)
            mt_SubdetailConfig(al_SubDetailIndex).RequestAdd = ls_Request
        ElseIf ae_Mode = eMode.emUpdate Then
            ls_Request = "exec DPC_MatThick_upd $MTH_Id$,$SYS_Id$,$PRD_Id$,$MAT_Id$,$MTH_AMin$,$MTH_AMax$,$MTH_BMin$,$MTH_BMax$,$MTH_Thick$,$MTH_H$,$U_Code$,$iConcurrency$"
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, cbo_MTH_System)
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, cbo_MTH_PRD_Id)
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, cbo_MTH_MAT_Id)
            mt_SubdetailConfig(al_SubDetailIndex).RequestUpd = ls_Request
        End If
    End If
        
    SubItem_CustomDBBefore = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_CustomDBBefore")
End Function

Private Function SubItem_CustomDBAfter(ByVal al_SubDetailIndex As Long, ByVal ae_Mode As eMode, ByVal al_Index As Long, ByRef ab_CustomSaved As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim ll_DetailConfig As Long
Dim ll_DetailFrame As Long
Dim ll_PageId As Long, ll_ZipTableIndex As Long
Dim ls_Filename As String

    SubItem_CustomDBAfter = False
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailConfig = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    ll_DetailFrame = mt_DetailConfig(ll_DetailConfig).FrameIndex
        
    SubItem_CustomDBAfter = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_CustomDBAfter")
End Function

Private Function IsItemInFilterCustom(ByVal al_DetailIndex As Long, ByRef ab_CheckDone As Boolean) As Boolean
On Error GoTo ErrHandler

    IsItemInFilterCustom = False
    ab_CheckDone = False
    Exit Function
ErrHandler:
    Call ErrorHandler("IsItemInFilterCustom")
End Function

Private Function IsItemSelectedInTreeCustom(ByVal al_DetailIndex As Long, ByRef ao_Tree As ArmTreeView, ByVal av_PathData As Variant, ByRef ab_CheckDone As Boolean) As Boolean
Dim ll_MainIndex As Long
Dim ll_MainFrameIndex As Long

    ab_CheckDone = False
    IsItemSelectedInTreeCustom = False
    
    ll_MainIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    ll_MainFrameIndex = mt_MainConfig(ll_MainIndex).FrameIndex
    
    If FindDetailConfigByName("") = al_DetailIndex Then
    End If
    Exit Function
ErrHandler:
    Call ErrorHandler("IsItemSelectedInTreeCustom")
End Function

Private Sub SetDisabledDetailControls()
On Error GoTo ErrHandler

Dim ll_MainIndex As Long
Dim ll_DetailIndex As Long

    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    
    Select Case UCase(mt_MainConfig(ll_MainIndex).NameFrame)
    End Select
    Exit Sub
ErrHandler:
    Call ErrorHandler("SetDisabledDetailControls")
End Sub

' parameter is nothing if all driven combo request should be set,
'it is control reference, if just driven controls request for specific control should be set
Private Sub SetDrivenDetailControls(ByRef ao_Control As Object)
On Error GoTo ErrHandler

Dim ll_MainIndex As Long
Dim ll_DetailIndex As Long
Dim ls_Request As String

    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    
    Select Case UCase(mt_MainConfig(ll_MainIndex).NameFrame)
    End Select
    Call SetDisabledDetailControls
    Exit Sub
ErrHandler:
    Call ErrorHandler("SetDrivenDetailControls")
End Sub

Private Sub UpdateMainToolbarCustom(ByVal al_MainIndex As Long)
On Error GoTo ErrHandler
Dim ll_frameIndex As Long
    
    ll_frameIndex = mt_MainConfig(al_MainIndex).FrameIndex
    
    If StrComp(mt_MainConfig(al_MainIndex).NameFrame, "DPC_System", vbTextCompare) = 0 Or _
        StrComp(mt_MainConfig(al_MainIndex).NameFrame, "DPC_SysCat", vbTextCompare) = 0 Or _
        StrComp(mt_MainConfig(al_MainIndex).NameFrame, "DPC_Material", vbTextCompare) = 0 Then
       
        If tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).Language = "E" Then
            tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("B") = True
        Else
            tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("A") = False
            tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("B") = True
            tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("C") = True
        End If
    Else
        tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("A") = True
        tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("B") = True
        tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("C") = True
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("UpdateMainToolbarCustom")
End Sub

Private Sub UpdateDetailToolbarCustom(ByVal al_Detailndex As Long)
On Error GoTo ErrHandler
Dim ll_DetailFrameIndex As Long
Dim ll_MainFrameIndex As Long
Dim ll_MainIndex As Long

    ll_DetailFrameIndex = mt_DetailConfig(al_Detailndex).FrameIndex
    ll_MainIndex = mt_DetailConfig(al_Detailndex).MainConfigIndex
    If ll_MainIndex >= 0 Then
        ll_MainFrameIndex = mt_MainConfig(ll_MainIndex).FrameIndex
    
        If StrComp(mt_MainConfig(ll_MainIndex).NameFrame, "DPC_System", vbTextCompare) = 0 Or _
            StrComp(mt_MainConfig(ll_MainIndex).NameFrame, "DPC_SysCat", vbTextCompare) = 0 Or _
            StrComp(mt_MainConfig(ll_MainIndex).NameFrame, "DPC_Material", vbTextCompare) = 0 Then
            
            If tlb_Main(mt_MainConfig(ll_MainIndex).ToolbarIndex).Language = "E" Then
                tlb_Detail(mt_DetailConfig(al_Detailndex).ToolbarIndex).ButtonEnabled("B") = True
            Else
                tlb_Detail(mt_DetailConfig(al_Detailndex).ToolbarIndex).ButtonEnabled("A") = False
                tlb_Detail(mt_DetailConfig(al_Detailndex).ToolbarIndex).ButtonEnabled("B") = True
                tlb_Detail(mt_DetailConfig(al_Detailndex).ToolbarIndex).ButtonEnabled("C") = True
            End If
        Else
            tlb_Detail(mt_DetailConfig(al_Detailndex).ToolbarIndex).ButtonEnabled("A") = True
            tlb_Detail(mt_DetailConfig(al_Detailndex).ToolbarIndex).ButtonEnabled("B") = True
            tlb_Detail(mt_DetailConfig(al_Detailndex).ToolbarIndex).ButtonEnabled("C") = True
        End If
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("UpdateDetailToolbarCustom")
End Sub

Private Sub UpdateSubdetailToolbarCustom(ByVal al_Subdetailndex As Long)
    Exit Sub
ErrHandler:
    Call ErrorHandler("UpdateSubdetailToolbarCustom")
End Sub

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK 1.0
' please DO NOT change anything in this part of code
'**********************************************************************************************************************************
'**********************************************************************************************************************************

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK PROPERTIES
' please DO NOT change anything in this part of code
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Public Property Let Visible(ByVal aVisible As Boolean)
    UserControl.Extender.Visible = aVisible
End Property

Public Property Get Visible() As Boolean
    Visible = UserControl.Extender.Visible
End Property

Public Property Let Top(ByVal aTop As Single)
    UserControl.Extender.Top = aTop
End Property
Public Property Get Top() As Single
    Top = UserControl.Extender.Top
End Property

Public Property Let Height(ByVal aHeight As Single)
    UserControl.Extender.Height = aHeight
End Property
Public Property Get Height() As Single
    Height = UserControl.Extender.Height
End Property

Public Property Let Left(ByVal aLeft As Single)
    UserControl.Extender.Left = aLeft
End Property
Public Property Get Left() As Single
    Left = UserControl.Extender.Left
End Property

Public Property Let Width(ByVal aWidth As Single)
    UserControl.Extender.Width = aWidth
End Property
Public Property Get Width() As Single
    Width = UserControl.Extender.Width
End Property

Public Sub Move(ByVal aLeft As Single, ByVal aTop As Single, ByVal aWidth As Single, ByVal aHeight As Single)
    Call UserControl.Extender.Move(aLeft, aTop, aWidth, aHeight)
End Sub
Public Property Let Enabled(ByVal ab_Value As Boolean)
On Error GoTo ErrHandler

  UserControl.Enabled = ab_Value
  Exit Property
ErrHandler:
  Call ErrorHandler("Enabled.Let")
End Property

Public Property Get Enabled() As Boolean
 On Error GoTo ErrHandler

  Enabled = UserControl.Enabled
  Exit Property
ErrHandler:
  Call ErrorHandler("Enabled.Get")
End Property

Public Sub Zorder()
On Error GoTo ErrHandler

  Call UserControl.Extender.Zorder
  Exit Sub
ErrHandler:
  Call ErrorHandler("Zorder")
End Sub

Public Sub Refresh()
On Error GoTo ErrHandler

  Call UserControl.Refresh
  Exit Sub
ErrHandler:
  Call ErrorHandler("Refresh")
End Sub

Public Property Get hwnd() As Long
On Error GoTo ErrHandler
  
  hwnd = UserControl.hwnd
  Exit Property
ErrHandler:
  Call ErrorHandler("hwnd.Get")
End Property

Public Property Get Initialized() As Boolean
    Initialized = mb_Initialized
End Property

Property Get ConnectString() As String
    ConnectString = m_ConnectString
End Property

Property Let LoginName(as_Login As String)
ms_LoginName = as_Login
End Property

Property Let U_Code(al_Code As Long)
ml_U_Code = al_Code
End Property

Property Let Language_Code(AString As String)
ms_Language_Code = AString
End Property

Public Property Set ArmDb(ByRef local_connection As Object)
    If Not (local_connection Is Nothing) Then
        Set mo_Db = local_connection
    End If
End Property

Public Property Set Tools(ByRef ao_Tools As Object)
On Error GoTo ErrorHandler

  Set mo_Tools = ao_Tools
  Exit Property
ErrorHandler:
  Call ErrorHandler("Tools.Set")
End Property

Private Sub cmd_Convert_Click2()
On Error GoTo ErrHandler

Dim ll_Row, ll_SysIdx As Long
Dim ls_Request As String
Dim ll_Cursor, ll_Index, ll_Index2 As Long
Dim lb_DelayedLoad As Boolean
Dim ll_DetailConfig As Long
Dim ls_Array() As String
Dim ls_Array2() As String
        
    ls_Request = "SELECT SYS_Id, SYS_Bend, SYS_Pack From DPC_System WHERE Drop_Flag <> 'X'"
    ll_Cursor = mo_Db.OpenSQL(ls_Request)
    ll_Row = 0
    
    While Not mo_Db.EOF(ll_Cursor)
    
        ls_Array = Split(mo_Db.GetFields(ll_Cursor, "SYS_Bend"), SEP2)
        
        ll_Row = 0
        ll_SysIdx = 0
        
        For ll_Index = 0 To UBound(ls_Array)
                
                ls_Array2 = Split(ls_Array(ll_Index), SEP1)
                
                For ll_Index2 = 0 To UBound(ls_Array2)
                
                    ls_Request = "exec DPC_SysDefault_ins2 $SYD_Id$,$SYS_Id$,'$PRD_Id$'," & eDPCSystemDefaultType.sdBending & ",$SYD_Idx$,$SYD_Order$,0,0,0,$U_Code$"
                
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Id$", mo_Tools.GetNextID(mo_Db, "DPC_SysDefault"))
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYS_Id$", mo_Db.GetFields(ll_Cursor, "SYS_Id"))
                    ls_Request = ReplacePlaceHolder(ls_Request, "$PRD_Id$", ls_Array2(ll_Index2))
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Idx$", ll_Index2)
                    ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Order$", ll_Row)
                    ls_Request = ReplaceCommonPlaceholders(ls_Request)
                    
                    Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)
                Next
                
                If UBound(ls_Array2) > 0 Then
                    ll_Row = ll_Row + 1
                End If
        Next
        
        ls_Array = Split(mo_Db.GetFields(ll_Cursor, "SYS_Pack"), SEP1)
        
        ll_Row = 0
        
        For ll_Index = 0 To UBound(ls_Array)
                
                ls_Request = "exec DPC_SysDefault_ins2 $SYD_Id$,$SYS_Id$,'$PRD_Id$'," & eDPCSystemDefaultType.sdPacking & ",0,$SYD_Order$,0,0,0,$U_Code$"
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Id$", mo_Tools.GetNextID(mo_Db, "DPC_SysDefault"))
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYS_Id$", mo_Db.GetFields(ll_Cursor, "SYS_Id"))
                ls_Request = ReplacePlaceHolder(ls_Request, "$PRD_Id$", ls_Array(ll_Index))
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Order$", ll_Row)
                ls_Request = ReplaceCommonPlaceholders(ls_Request)
                
                Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)
                
                ll_Row = ll_Row + 1
        Next
        
        Call mo_Db.Next(ll_Cursor)
    Wend
    
    Call mo_Db.Close(ll_Cursor)
                     
    Exit Sub
ErrHandler:

    If ll_Cursor > 0 Then
        Call mo_Db.Close(ll_Cursor)
    End If
    Call ErrorHandler("Convert")

End Sub

Private Sub cbo_GPP_Group_ComboItemSelected()
On Error GoTo ErrHandler
Dim ls_Group As String

    If mb_InternalInit Then Exit Sub

    If cbo_GPP_Group.SelectedItem.Key = "" Then
        txt_GPP_Group.Text = ""
    Else
        ls_Group = Left(cbo_GPP_Group.SelectedItem.DisplayText, InStr(1, cbo_GPP_Group.SelectedItem.DisplayText, " ") - 1)
        txt_GPP_Group.Text = ls_Group
    End If
    
    Exit Sub

ErrHandler:
    Call LogMessage("cbo_GPP_Group_ComboItemSelected")
End Sub

Private Sub cbo_GPP_Param_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler
        
    If mb_InternalInit Then Exit Sub

    If cbo_GPP_Param(Index).Text = "" Then
        Set cbo_GPP_Operator(Index).SelectedItem = Nothing
        txt_GPP_Value(Index).Text = ""
    End If
    
    Exit Sub

ErrHandler:
    Call LogMessage("cbo_GPP_Param_ComboItemSelected")
End Sub

Private Sub cbo_GRP_Type_Filter_ComboItemSelected()
On Error GoTo ErrHandler
        
Dim ll_Idx As Long

    If mb_InternalInit Then Exit Sub

    For ll_Idx = 0 To grd_SubDetail(5).Rows
    
        If cbo_GRP_Type_Filter.SelectedItem Is Nothing Then
            grd_SubDetail(5).RowHeight(ll_Idx) = 200
            
        Else
        
            If grd_SubDetail(5).Data(ll_Idx + 1, "GRP_Type") = cbo_GRP_Type_Filter.SelectedItem.Key Then
                grd_SubDetail(5).RowHeight(ll_Idx) = 200
                
            Else
                grd_SubDetail(5).RowHeight(ll_Idx) = 0
            End If
            
        End If
        
    Next

    Exit Sub

ErrHandler:
    Call LogMessage("cbo_GRP_Type_Filter_ComboItemSelected")
End Sub


Private Sub cbo_OGT_Language_Code_ComboItemSelected()
On Error GoTo ErrHandler
    
    cmd_Memo.Enabled = True
    
ErrHandler:
    Call LogMessage("cbo_OGT_Language_Code_ComboItemSelected")
End Sub

Private Sub lv_SysVendor_ItemCheck(ByVal Item As MSComctlLib.ListItem)
On Error GoTo ErrHandler
        
    If mb_InternalInit Then Exit Sub

    If me_DetailMode = emView Then
        Item.Checked = Not Item.Checked
    End If
    
    Exit Sub

ErrHandler:
    Call LogMessage("lv_SysVendor_ItemCheck")
End Sub

Private Sub pic_ImgBox_DblClick(Index As Integer)
On Error GoTo ErrHandler
Dim ll_IMG_Id As Long
Dim ls_PicName As String
        
    ll_IMG_Id = Val(txt_ImgId(pic_ImgBox(Index).Tag).Text)
                    
    If ll_IMG_Id >= 0 Then
        Call mo_Tools.LoadDPCImage(mo_Db, mo_FSO, ms_PicPath, ll_IMG_Id)
        ls_PicName = ms_PicPath & "IMG" & ll_IMG_Id & ".jpg"
        Call ShellExecute(Me.hwnd, "open", ls_PicName, "", "", 1)
    End If
     
    Exit Sub
ErrHandler:
    Call mo_Tools.UpdateError(True)
    Call LogMessage("pic_ImgBox_DblClick")
    Call mo_Tools.UpdateError(False)
    Call MsgBox("Error occured, please contact IT. Application will now shutdown." & vbCrLf & Err.Source & vbCrLf & "Description: " & Err.Description, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
    End
End Sub

Private Sub cbo_MTH_MAT_Id_Filter_ComboItemSelected()
On Error GoTo ErrHandler

'    Call RefreshValueMatrix

    Exit Sub
ErrHandler:
    Call ErrorMessage("cbo_MTH_MAT_Id_Filter_ComboItemSelected")

End Sub

Private Sub cmd_Convert_Click()
On Error GoTo ErrHandler

Dim ll_Row, ll_SysIdx As Long
Dim ls_Request As String
Dim ll_Cursor, ll_Cursor2, ll_Order, ll_Count As Long
Dim lb_DelayedLoad As Boolean
Dim ll_DetailConfig As Long
Dim ls_SYS_Id As String
Dim ls_PRD_Id As String
        
    ls_Request = "select distinct rpl.sys_id,rpl.pkg_id from dpc_rectpanel rpl inner join dpc_prdcommon prc on (rpl.rpl_id=prc.prd_id) where prc.prd_std='x' and prc.prd_sku=''"
    ll_Cursor = mo_Db.OpenSQL(ls_Request)
    
    While Not mo_Db.EOF(ll_Cursor)
    
        ls_SYS_Id = mo_Db.GetFields(ll_Cursor, "SYS_Id")
        ls_PRD_Id = mo_Db.GetFields(ll_Cursor, "PKG_Id")
        
        ls_Request = "select SYD_Id from dpc_sysdefault where SYS_Id=" & ls_SYS_Id & " AND PRD_Id='" & ls_PRD_Id & "'"
        ll_Cursor2 = mo_Db.OpenSQL(ls_Request)
        
        ll_Count = mo_Db.RowCount(ll_Cursor2)
        Call mo_Db.Close(ll_Cursor2)
        
        If ll_Count = 0 Then
                
                ls_Request = "select MAX(SYD_Order) as max_order from dpc_sysdefault where SYD_Type=2 and SYS_Id=" & ls_SYS_Id
                ll_Cursor2 = mo_Db.OpenSQL(ls_Request)
                
                ll_Order = mo_Db.GetFields(ll_Cursor2, "max_order")
                Call mo_Db.Close(ll_Cursor2)
                
                ls_Request = "exec DPC_SysDefault_ins2 $SYD_Id$,$SYS_Id$,'$PRD_Id$'," & eDPCSystemDefaultType.sdPacking & ",0,$SYD_Order$,0,0,0,$U_Code$"
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Id$", mo_Tools.GetNextID(mo_Db, "DPC_SysDefault"))
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYS_Id$", ls_SYS_Id)
                ls_Request = ReplacePlaceHolder(ls_Request, "$PRD_Id$", ls_PRD_Id)
                ls_Request = ReplacePlaceHolder(ls_Request, "$SYD_Order$", ll_Order + 1)
                ls_Request = ReplaceCommonPlaceholders(ls_Request)
                
                Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)
        End If
                        
        Call mo_Db.Next(ll_Cursor)
    Wend
                         
    Exit Sub
ErrHandler:

    If ll_Cursor > 0 Then
        Call mo_Db.Close(ll_Cursor)
    End If
    Call ErrorHandler("Convert")

End Sub

Private Sub cmd_FileInfo_Click()
On Error GoTo ErrHandler
Dim ll_FIL_Id As Long
Dim ls_Array() As String
Dim lo_Frm As frmDPC_File
Dim ls_req As String
Dim lb_Result As Boolean
    
    Call mo_Tools.LockScreen(Me, True)
    
    ls_Array = Split(cmd_FileInfo.Tag, SEP2)
    
    ll_FIL_Id = Val(txt_FilId(ls_Array(0)).Text)
              
    
    Set lo_Frm = New frmDPC_File
    Load lo_Frm
    
    If me_DetailMode = eMode.emAdd Or me_DetailMode = eMode.emUpdate Then
        If ll_FIL_Id > 0 Then
            lo_Frm.Mode = eDPCScreenMode.smUpdate
        Else
            lo_Frm.Mode = eDPCScreenMode.smAdd
        End If
    Else
        lo_Frm.Mode = eDPCScreenMode.smNone
    End If
          
    lo_Frm.FIL_Id = ll_FIL_Id
  
  
    Set lo_Frm.ArmDb = mo_Db
    Set lo_Frm.Tools = mo_Tools
    lo_Frm.Language_Code = ms_Language_Code
    Call lo_Frm.Load_A_COM
  
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_Frm)
    Call mo_Tools.LockScreen(Me, True)
  
    lb_Result = lo_Frm.Result
    ll_FIL_Id = lo_Frm.FIL_Id
    
    lo_Frm.Unload_A_COM
    Unload lo_Frm

    If lb_Result = True Then
        If ll_FIL_Id = 0 Then
            txt_FilId(ls_Array(0)).Text = "0"
        Else
            txt_FilId(ls_Array(0)).Text = ll_FIL_Id
        End If
    End If
    
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call ErrorMessage("cmd_FileInfo_Click")
End Sub

Private Sub cmd_ImageInfo_Click(Index As Integer)
On Error GoTo ErrHandler
Dim ll_IMG_Id As Long
Dim ls_Array() As String
Dim lo_Frm As frmDPC_Image
Dim ls_req As String
Dim lb_Result As Boolean
Dim ll_MainIndex As Long
Dim ll_DetailIndex As Long

    Call mo_Tools.LockScreen(Me, True)
    
    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)

    ls_Array = Split(cmd_ImageInfo(Index).Tag, SEP2)
    
    ll_IMG_Id = Val(txt_ImgId(ls_Array(0)).Text)
              
    
    Set lo_Frm = New frmDPC_Image
    Load lo_Frm
  
    If me_DetailMode = eMode.emAdd Or me_DetailMode = eMode.emUpdate Then
        If ll_IMG_Id > 0 Then
            lo_Frm.Mode = eDPCScreenMode.smUpdate
        Else
            lo_Frm.Mode = eDPCScreenMode.smAdd
        End If
    Else
        lo_Frm.Mode = eDPCScreenMode.smNone
    End If
      
    lo_Frm.IMG_Id = ll_IMG_Id
  
  
    Set lo_Frm.ArmDb = mo_Db
    Set lo_Frm.Tools = mo_Tools
    lo_Frm.Language_Code = ms_Language_Code
    
    If StrComp(mt_DetailConfig(ll_DetailIndex).NameFrame, "GEN_LegalEntity", vbTextCompare) = 0 Then
        lo_Frm.ImageType = eDPCImageType.itLogo
        lo_Frm.ShowSelectExisting = True
    End If
    
    Call lo_Frm.Load_A_COM
        
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_Frm)
    Call mo_Tools.LockScreen(Me, True)
  
    lb_Result = lo_Frm.Result
    ll_IMG_Id = lo_Frm.IMG_Id
    
    lo_Frm.Unload_A_COM
    Unload lo_Frm

    If lb_Result = True Then
        If ll_IMG_Id = 0 Then
            txt_ImgId(ls_Array(0)).Text = "0"
        Else
            txt_ImgId(ls_Array(0)).Text = ll_IMG_Id
        End If
        Call ShowImage(ls_Array(1), txt_ImgId(ls_Array(0)).Text, "")
    End If
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call ErrorMessage("cmd_ImageInfo_Click Index=" & Index)
End Sub

Private Sub cmd_Memo_Click()
On Error GoTo ErrHandler
Dim ll_MEM_Id As Long
Dim lo_Frm As frmDPC_Memo
Dim ls_req As String
Dim lb_Result As Boolean
Dim ll_MainIndex As Long
Dim ll_DetailIndex As Long
Dim ls_LangCode As String

    Call mo_Tools.LockScreen(Me, True)
    
    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    
    If Not cbo_OGT_MEM_Id.SelectedItem Is Nothing Then
        ll_MEM_Id = Val(cbo_OGT_MEM_Id.SelectedItem.Key)
    Else
        ll_MEM_Id = 0
    End If
              
    
    Set lo_Frm = New frmDPC_Memo
    Load lo_Frm
  
    If me_SubDetailMode = eMode.emAdd Or me_DetailMode = eMode.emUpdate Then
        If ll_MEM_Id > 0 Then
            lo_Frm.Mode = eDPCScreenMode.smUpdate
        Else
            lo_Frm.Mode = eDPCScreenMode.smAdd
        End If
    Else
        lo_Frm.Mode = eDPCScreenMode.smNone
    End If
      
    lo_Frm.MEM_Id = ll_MEM_Id
  
  
    Set lo_Frm.ArmDb = mo_Db
    Set lo_Frm.Tools = mo_Tools
    lo_Frm.Language_Code = cbo_OGT_Language_Code.SelectedItem.Key
    
    If StrComp(mt_DetailConfig(ll_DetailIndex).NameFrame, "GEN_LegalEntity", vbTextCompare) = 0 Then
        lo_Frm.MemoType = eDPCMemoType.mtDisclaimer
    End If
    
    Call lo_Frm.Load_A_COM
        
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_Frm)
    Call mo_Tools.LockScreen(Me, True)
  
    lb_Result = lo_Frm.Result
    ll_MEM_Id = lo_Frm.MEM_Id
    
    lo_Frm.Unload_A_COM
    Unload lo_Frm

    If lb_Result = True Then
    
        Call cbo_OGT_MEM_Id.Load
        Call cbo_OGT_MEM_Id.SearchItem(ll_MEM_Id)
        
    End If
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call ErrorMessage("cmd_Memo_Click")
End Sub

Private Sub cmd_CustomerSeek_Click(Index As Integer)
On Error GoTo ErrHandler
    
Dim ls_CCUCapKey As String
Dim lo_SeekForm As SeekForm
Dim lv_Code As Variant
Dim lv_Desc As String
    
    Call mo_Tools.LockScreen(Me, True)
    gs_CaptureCountry = "GB"
    Set lo_SeekForm = New SeekForm
    Load lo_SeekForm
    lo_SeekForm.Language = ms_Language_Code
    Set lo_SeekForm.ArmDb = mo_Db
    lo_SeekForm.ComponentType = "CUSTOMER"
    lo_SeekForm.TreeViewFiltersDesc = ""
    lo_SeekForm.TreeViewFilters = "" & SEP & "" & SEP & "" & SEP & "NULL"
    lo_SeekForm.TreeView_DateType = "0"
    lo_SeekForm.Load_A_COM
    lo_SeekForm.SYS_code = 1
    
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_SeekForm)
    Call mo_Tools.LockScreen(Me, True)
    
    If lo_SeekForm.SelectedData = True Then
    '    txt_CCU_Desc(Index).Text = lo_SeekForm.SelectedItemDesc
    '    txt_Cust_Code(Index).Text = GetSeparatedStringElement(lo_SeekForm.SelectedItemFull, "CUST_Code")
    '    txt_CCU_Capkey(Index).Text = GetSeparatedStringElement(lo_SeekForm.SelectedItemFull, "CCU_Capkey")
    '    If Not lo_SeekForm.cbo_country.SelectedItem Is Nothing Then
    '        txt_CT_Code(Index).Text = lo_SeekForm.cbo_country.SelectedItem.Key
    '        txt_CT_Desc(Index).Text = lo_SeekForm.cbo_country.Text
    '    End If
    End If
    
    Call lo_SeekForm.Unload_A_COM
    Unload lo_SeekForm
    Set lo_SeekForm = Nothing
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call ErrorMessage("cmd_CustomerSeek_Click Index=" & Index)
End Sub

Private Function GetSeparatedStringElement(ByVal as_SeparatedString As String, ByVal as_Name As String) As String
On Error GoTo ErrHandler
    
    Dim lsa_Array() As String
    Dim ll_Idx As Long
    
    GetSeparatedStringElement = ""
    lsa_Array = Split(as_SeparatedString, SEP)
    ll_Idx = 0
    While ll_Idx < UBound(lsa_Array)
        If StrComp(as_Name, lsa_Array(ll_Idx), vbTextCompare) = 0 Then
            GetSeparatedStringElement = lsa_Array(ll_Idx + 1)
            Exit Function
        End If
        ll_Idx = ll_Idx + 3
    Wend
    Exit Function
ErrHandler:
    Call ErrorHandler("GetSeparatedStringElement")
End Function

Private Sub tbs_SubDetail_BeforeClick(Index As Integer, Cancel As Integer)
On Error GoTo ErrHandler
    
    If me_SubDetailMode <> eMode.emList And me_SubDetailMode <> eMode.emView Then Cancel = True
    Exit Sub
ErrHandler:
    Call LogMessage("tbs_SubDetail_BeforeClick")
End Sub

Private Sub tbs_SubDetail_Click(Index As Integer)
On Error GoTo ErrHandler

Dim ll_Index As Long

    If tbs_SubDetail(Index).SelectedItem Is Nothing Then Exit Sub
        
    Call mo_Tools.LockScreen(Me, True)
    
    ll_Index = FindSubDetailConfigByTabIndex(tbs_SubDetail(Index).SelectedItem.Index)
    Call ShowSubDetail(ll_Index)
    
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call mo_Tools.LockScreen(Me, False)
    Call ErrorMessage("tbs_SubDetail_Click")
End Sub



'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK CONTROL EVENTS
' please DO NOT change anything in this part of code
'**********************************************************************************************************************************
'**********************************************************************************************************************************



Private Sub tlb_Main_action(Index As Integer, ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler
    
    Dim ll_MainConfigIndex As Long, ll_frameIndex As Long, ll_DetailConfigIndex As Long, ll_MainFrameIndex As Long
    
    If Not tlb_Main(Index).Enabled Then Exit Sub
    
    Call mo_Tools.LockScreen(Me, True)
    
    If Not tlb_Main_CustomAction(Index, as_Role, as_Language) Then
        ll_MainConfigIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
        ll_frameIndex = mt_MainConfig(ll_MainConfigIndex).FrameIndex
        ll_DetailConfigIndex = FindDetailConfigByMainConfig(ll_MainConfigIndex)
        ll_MainFrameIndex = mt_MainConfig(ll_MainConfigIndex).FrameIndex
        Select Case as_Role
            Case "A"
                ' Want to Add
                Call Item_AddInit(ll_DetailConfigIndex)
                
            Case "B"
            ' Want to Update
                If grd_Main(ll_MainFrameIndex).SelectedCount = 1 Then
                    Call Item_UpdateInit(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex).CurrentKey)
                End If
            Case "C"
            ' Want to delete
                If grd_Main(ll_MainFrameIndex).SelectedCount = 1 Then
                    Call Item_DeleteInit(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex).CurrentKey)
                End If
            Case "L"
            ' Want to reload treeview and refresh the grid
                Call ReloadMainGrid
            Case "F"
                ' Want to reload grid according to treeview selection
                Call ReloadMainTreeview
            Case "Q"
                Call mo_Tools.ChangeCharset(UserControl.Controls, gl_CodePage, mo_Tools.GetCodePageFromLanguage(mo_Db, tlb_Main(ll_frameIndex).Language))
                Call ReloadMainGrid
                Call Init_Custom
                Call cbo_View_ComboItemSelected(Index)
            Case "G"
                Call ImportExcelData(ll_MainConfigIndex)
            Case "T"
                Call mo_Tools.LockScreen(Me, False)
                RaiseEvent quit
                Exit Sub
            Case Else
                Err.Raise ArmErr.InvalidArgument, "tlb_Main_action(" & Index & ")", "Unknown main toolbar role as_Role=" & as_Role
        End Select
    End If
    
    Call mo_Tools.LockScreen(Me, False)
    
    Exit Sub
ErrHandler:
    Call mo_Tools.UpdateError(True)
    Call mo_Tools.LockScreen(Me, False)

    Select Case Err.Number
    Case 202
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 202, "#The item you have added/updated couldn't be displayed with the current criteria set.", , vbInformation + vbOKOnly)
    Case ArmErr.SQLBadRowExpectedCount
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2138, "#The record you try to open has been deleted by an other user. Please refresh the grid.", , vbInformation)
    Case ArmErr.SQLBadRowAffectedCount
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2144, "#This record has been, modified by an other.Please exit from this screen and refresh the grid.", , vbInformation)
    Case Else
        Call LogMessage("tlb_list_action")
        ' user interface can be inconsistent, better to close application
        Call mo_Tools.UpdateError(False)
        Call MsgBox("Error occured, please contact IT. Application will now shutdown." & vbCrLf & Err.Source & vbCrLf & "Description: " & Err.Description, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
        End
    End Select
End Sub

Private Sub tlb_detail_action(Index As Integer, ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler
    
    Dim ll_MainConfigIndex As Long, ll_MainFrameIndex As Long, ll_DetailConfigIndex As Long
    
    If Not tlb_Detail(Index).Enabled Then Exit Sub
    
    Call mo_Tools.LockScreen(Me, True)
    
    ll_MainConfigIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_MainFrameIndex = mt_MainConfig(ll_MainConfigIndex).FrameIndex
    ll_DetailConfigIndex = FindDetailConfigByMainConfig(ll_MainConfigIndex)
    
    If Not tlb_detail_CustomAction(Index, as_Role, as_Language) Then
        Select Case as_Role
            Case "A"
                ' Want to Add
                Call Item_AddInit(ll_DetailConfigIndex)
            Case "B"
                ' Want to Update
                Call Item_UpdateInit(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex).CurrentKey)
            Case "C"
                ' Want to delete
                Call Item_DeleteInit(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex).CurrentKey)
            Case "Y"
                Call GotoNextItem(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex))
            Case "Z"
                Call GotoPreviousItem(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex))
            Case "H"
                Select Case me_DetailMode
                Case emAdd
                    Call Item_Add(ll_DetailConfigIndex)
                Case emUpdate
                    Call Item_Update(ll_DetailConfigIndex)
                Case emDelete
                    If mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_DetailConfig(ll_DetailConfigIndex).DeleteMsg(0, 0), mt_DetailConfig(ll_DetailConfigIndex).DeleteMsg(0, 1), , vbExclamation + vbDefaultButton2 + vbYesNo) = vbYes Then
                        Call Item_Delete(ll_DetailConfigIndex)
                    End If
                End Select
            Case "I"
                Call Item_ReInit(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex).CurrentKey)
            Case "F"
                Call Item_ViewInit(ll_DetailConfigIndex, grd_Main(ll_MainFrameIndex).CurrentKey)
            Case "T"
                If mt_DetailConfig(ll_DetailConfigIndex).MainConfigIndex <> -1 Then
                    Call SetMode(emList)
                Else
                    ll_MainConfigIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
                    mt_MainConfig(ll_MainConfigIndex).CurrentDetailIndex = mt_DetailConfig(ll_DetailConfigIndex).PreviousDetailIndex
                    Call SetMode(me_DetailMode)
                End If
                
                If mc_Item <> 0 Then
                    Call mo_Db.Close(mc_Item)
                    mc_Item = 0
                End If
                
            Case Else
                Err.Raise ArmErr.InvalidArgument, "tlb_detail_action(" & Index & ")", "Unknown detail toolbar role as_Role=" & as_Role
        End Select
    End If
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call mo_Tools.UpdateError(True)
    Call mo_Tools.LockScreen(Me, False)

    Select Case Err.Number
    Case 202
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 202, "#The item you have added/updated couldn't be displayed with the current criteria set.", , vbInformation + vbOKOnly)
    Case ArmErr.SQLBadRowExpectedCount
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2138, "#The record you try to open has been deleted by an other user. Please refresh the grid.", , vbInformation)
    Case ArmErr.SQLBadRowAffectedCount
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2144, "#This record has been, modified by an other.Please exit from this screen and refresh the grid.", , vbInformation)
    Case Else
        Call LogMessage("tlb_Detail_action")
        Call mo_Tools.UpdateError(False)
        Call MsgBox("Error occured, please contact IT. Application will now shutdown." & vbCrLf & Err.Source & vbCrLf & "Description: " & Err.Description, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
        End
    End Select
End Sub

Private Sub tlb_Subdetail_action(Index As Integer, ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler
    
    Dim ll_SubdetailIndex As Long
    
    If Not tlb_SubDetail(Index).Enabled Then Exit Sub
    
    Call mo_Tools.LockScreen(Me, True)
    
    ll_SubdetailIndex = FindSubDetailConfigByFrameIndex(Index)
    
    If Not tlb_Subdetail_CustomAction(Index, as_Role, as_Language) Then
        Select Case as_Role
            Case "A"
            ' Want to Add
                Call SubItem_AddInit(ll_SubdetailIndex)
            Case "B"
            ' Want to Update
                Call SubItem_UpdateInit(ll_SubdetailIndex)
            Case "C"
            ' Want to delete
                Call SubItem_DeleteInit(ll_SubdetailIndex)
            Case "Y"
                Call SwapRows(Index, True)
            Case "Z"
                Call SwapRows(Index, False)
            Case "H"
                Select Case me_SubDetailMode
                Case emAdd
                    If SubItem_Add(ll_SubdetailIndex) Then
                        Call SubItem_AddInit(ll_SubdetailIndex)
                    End If
                Case emUpdate
                    If SubItem_Update(ll_SubdetailIndex) Then
                        'go back to the detail screen
                        Call SetModeSubDetail(ll_SubdetailIndex, emList)
                    End If
                Case emDelete
                    If SubItem_Delete(ll_SubdetailIndex) Then
                        'go back to the detail screen
                        Call SetModeSubDetail(ll_SubdetailIndex, emList)
                    End If
                End Select
            Case "F"
                Call grd_SubDetail(Index).Refresh
            Case "T"
                Call SetModeSubDetail(Index, emList)
            Case "I"
                Select Case me_SubDetailMode
                Case emAdd
                    Call SubItem_AddInit(ll_SubdetailIndex)
                Case emUpdate
                    Call SubItem_UpdateInit(ll_SubdetailIndex)
                End Select
            Case Else
                Err.Raise ArmErr.InvalidArgument, "tlb_Subdetail_action(" & Index & ")", "Unknown subdetail toolbar role as_Role=" & as_Role
        End Select
    End If
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call mo_Tools.UpdateError(True)
    Call mo_Tools.LockScreen(Me, False)

    Select Case Err.Number
    Case 202
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 202, "#The item you have added/updated couldn't be displayed with the current criteria set.", , vbInformation + vbOKOnly)
    Case ArmErr.SQLBadRowExpectedCount
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2138, "#The record you try to open has been deleted by an other user. Please refresh the grid.", , vbInformation)
    Case ArmErr.SQLBadRowAffectedCount
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2144, "#This record has been, modified by an other.Please exit from this screen and refresh the grid.", , vbInformation)
    Case Else
        Call LogMessage("tlb_Detail_action")
        Call mo_Tools.UpdateError(False)
        Call MsgBox("Error occured, please contact IT. Application will now shutdown." & vbCrLf & Err.Source & vbCrLf & "Description: " & Err.Description, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
        End
    End Select
End Sub

Private Sub tbs_Main_Click()
On Error GoTo ErrHandler

Dim ll_Index As Long

    If tbs_Main.SelectedItem Is Nothing Then Exit Sub
    
    Call mo_Tools.LockScreen(Me, True)
    
    ll_Index = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    Call InitMainFrame(ll_Index)
    Call SetMode(emList)
    
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
ErrHandler:
    Call mo_Tools.LockScreen(Me, False)
    Call ErrorMessage("tbs_Main_Click")
End Sub

Private Sub cbo_View_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

Dim ll_Index As Long

    Call mo_Tools.LockScreen(Me, True)
    
     If Not cbo_View(Index).SelectedItem Is Nothing Then
        ll_Index = FindMainConfigByFrameIndex(Index)
        Call LoadTreeView(ll_Index, tvw_Main(Index), GetTreeViewInfo(mt_MainConfig(ll_Index).mTreeViewInfos, mt_MainConfig(ll_Index).ViewCode, cbo_View(Index).SelectedItem.Key))
        If tvw_Main(Index).Count > 0 Then
            Set tvw_Main(Index).SelectedItem = tvw_Main(Index).Nodes(1)
            Call tvw_Main_NodeClick(Index, tvw_Main(Index).SelectedItem)
        Else
            Call tvw_Main_NodeClick(Index, Nothing)
        End If
        Call SetTreeDelayedMode(Index, False)
    End If
    
CleanUp:
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
    
ErrHandler:
    Call LogMessage("cbo_Views_ComboItemSelected")
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2116, "#Unable to load the combo " & " type of view.", , vbInformation + vbOKOnly)
End Sub

Private Sub cmd_TVReLoad_Click(Index As Integer)
On Error GoTo ErrHandler
    
    Call cbo_View_ComboItemSelected(Index)
    Exit Sub
ErrHandler:
    Call ErrorMessage("cmd_TVReLoad_Click")
End Sub

Private Sub tvw_Main_NodeClick(Index As Integer, ByVal Node As MSComctlLib.Node)
On Error GoTo ErrHandler
    
    Dim ll_DetailIndex As Long, ll_MainIndex As Long
    
    If mb_InternalInit Then Exit Sub
    
    'Call mo_Tools.LockScreen(Me,True)
    Screen.MousePointer = vbHourglass
    
    Dim lv_Requests As Variant, lb_DelayedLoad As Boolean
    
    Call grd_Main(Index).ClearGrid
    ll_MainIndex = FindMainConfigByFrameIndex(Index)
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    
    lv_Requests = ApplyTVFilters(ll_MainIndex, tvw_Main(Index).SelectedNodeRequest)
    
    If (Node Is Nothing) Then
        mt_MainConfig(ll_MainIndex).CurrentTvwSelMethod = etmNone
    Else
        If (tvw_Main(Index).NodeInfo(Node).ml_Level = tvw_Main(Index).Levels - 1) Then
            mt_MainConfig(ll_MainIndex).CurrentTvwSelMethod = eTvwSelMethod.etmNode
        Else
            mt_MainConfig(ll_MainIndex).CurrentTvwSelMethod = eTvwSelMethod.etmBranch
        End If
    End If
    
    Select Case mt_MainConfig(ll_MainIndex).GridDelayMethod
    Case egmDelayedAlways
        lb_DelayedLoad = True
    Case egmDelayedExceptLastLevel
        If Node Is Nothing Then
            lb_DelayedLoad = True
        Else
            lb_DelayedLoad = (tvw_Main(Index).NodeInfo(Node).ml_Level < tvw_Main(Index).Levels - 1)
        End If
    Case egmLoadAlways
        lb_DelayedLoad = False
    Case Else
        lb_DelayedLoad = True
    End Select
    
    If grd_Main(Index).Cols = 0 Then
        If Not grd_Main(Index).SetColumns(mt_DetailConfig(ll_DetailIndex).MainGridColumns) Then
            Err.Raise ArmErr.CompFncFailed, "grd_Main", "Method SetColumns failed."
        End If
        Call mo_Tools.LoadLabelsCursor(mo_Db, mc_ScreenLabels, UserControl.Controls, fra_MainItem(Index), SCREEN_NAME, ms_Language_Code)
    ElseIf mt_MainConfig(ll_MainIndex).IsMultiDetailView Then
        If Not grd_Main(Index).SetColumns(mt_DetailConfig(ll_DetailIndex).MainGridColumns) Then
            Err.Raise ArmErr.CompFncFailed, "grd_Main", "Method SetColumns failed."
        End If
        Call mo_Tools.LoadLabelsCursor(mo_Db, mc_ScreenLabels, UserControl.Controls, fra_MainItem(Index), SCREEN_NAME, ms_Language_Code)
    End If
    
    mt_MainConfig(ll_MainIndex).GridDelayed = lb_DelayedLoad
    
    If Not grd_Main(Index).Load(lv_Requests, False, , , lb_DelayedLoad) Then
        Err.Raise ArmErr.CompFncFailed, "grd_Main", "Method Load failed: " & lv_Requests(0)
    End If
    Call UpdateMainToolbarCustom(ll_MainIndex)
    'Call mo_Tools.LockScreen(Me,False)
    Screen.MousePointer = vbDefault
    Exit Sub

ErrHandler:
    Call LogMessage("tvw_Main_NodeClick")
    'Call mo_Tools.LockScreen(Me,False)
    Screen.MousePointer = vbDefault
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2142, "#There is a problem while loading data.", , vbInformation + vbOKOnly)
End Sub

Private Sub tbs_MainTabFilter_Click(Index As Integer)
On Error GoTo ErrHandler
    
    Call SetTreeDelayedMode(Index, True)
    Exit Sub
ErrHandler:
    Call ErrorMessage("tbs_MainTabFilter_Click")
End Sub


Private Sub grd_Main_ItemSelected(Index As Integer)
On Error GoTo ErrHandler
    
    Dim ll_MainIndex As Long
    Dim ll_DetailIndex As Long
    Dim lb_Locked As Boolean
    
    If grd_Main(Index).SelectedCount <> 1 Then Exit Sub
    
    Call mo_Tools.LockScreen(Me, True)
    lb_Locked = True
    
    If grd_Main_CustomAction(Index, eControlAction.caDoubleClick) Then
        Call mo_Tools.LockScreen(Me, False)
        lb_Locked = False
        Exit Sub
    End If
    
    ll_MainIndex = FindMainConfigByFrameIndex(Index)
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    Call Item_ViewInit(ll_DetailIndex, grd_Main(Index).CurrentKey)
    Call mo_Tools.LockScreen(Me, False)
    lb_Locked = False
    Exit Sub
ErrHandler:
    If lb_Locked Then
        Call mo_Tools.LockScreen(Me, False)
    End If
    Select Case Err.Number
        Case ArmErr.SQLBadRowExpectedCount
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2138, "#The record you try to open has been deleted by an other user. Please refresh the grid.", , vbInformation)
        Case Else
            Call LogMessage("grd_Main_ItemSelected")
            'MsgBox mo_Tools.MsgText(mo_Db,ms_Language_Code,2143, "#There is a problem while doing this action. Please double check your entry."), vbInformation, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision
            Call MsgBox("Error occured, please contact IT. Application will now shutdown." & vbCrLf & Err.Source & vbCrLf & "Description: " & Err.Description, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
            End
    End Select
End Sub

Private Sub grd_Main_RowColChange(Index As Integer)
On Error GoTo ErrHandler
Dim ll_MainIndex As Long

    ll_MainIndex = FindMainConfigByFrameIndex(Index)
    mt_MainConfig(ll_MainIndex).GridDelayed = False
    Call UpdateMainToolbarCustom(ll_MainIndex)
    Exit Sub
ErrHandler:
    Call ErrorMessage("grd_Main_RowColChange")
End Sub

Private Sub grd_Subdetail_ItemSelected(Index As Integer)
On Error GoTo ErrHandler
        
    If (me_SubDetailMode = emList) And tlb_SubDetail(Index).Visible And tlb_SubDetail(Index).Enabled Then
        Call tlb_Subdetail_action(Index, "B", ms_Language_Code)
    End If
    Exit Sub
ErrHandler:
    Call ErrorMessage("grd_Subdetail_ItemSelected")
End Sub

Private Sub grd_Subdetail_RowColChange(Index As Integer)
On Error GoTo ErrHandler
Dim ll_SubdetailIndex As Long

    ll_SubdetailIndex = FindSubDetailConfigByFrameIndex(Index)
    Call UpdateSubdetailToolbarCustom(ll_SubdetailIndex)
    Exit Sub
ErrHandler:
    Call ErrorMessage("grd_Main_RowColChange")
End Sub

Private Sub grd_Subdetail_RowLoaded(Index As Integer, ByVal al_Row As Long)
On Error GoTo ErrHandler
Dim lv_Row As Variant
Dim ll_Idx As Long, ll_Count As Long
Dim ll_SubdetailIndex As Long

    ll_Count = grd_SubDetail(Index).Cols - 1
    ReDim lv_Row(ll_Count)
    For ll_Idx = 0 To ll_Count
        lv_Row(ll_Idx) = grd_SubDetail(Index).Data(al_Row, ll_Idx)
    Next
    ll_SubdetailIndex = FindSubDetailConfigByFrameIndex(Index)
    
    'MW REDIM >>
    Call SafeRedimPreserve(mt_SubdetailConfig(ll_SubdetailIndex).DeletedRows, al_Row)
    
    'If UBound(mt_SubdetailConfig(ll_SubdetailIndex).DeletedRows) = -1 Then
    '    ReDim mt_SubdetailConfig(ll_SubdetailIndex).DeletedRows(al_Row)
    'Else
    '    ReDim Preserve mt_SubdetailConfig(ll_SubdetailIndex).DeletedRows(al_Row)
    'End If
    'MW <<
    
    mt_SubdetailConfig(ll_SubdetailIndex).DeletedRows(al_Row) = lv_Row
    
    Dim lo_Column As ArmColumn
    Set lo_Column = grd_SubDetail(Index).Columns("Status")
    If Not lo_Column Is Nothing Then
        If lo_Column.GetData(al_Row) = 1 Then
            grd_SubDetail(Index).LineColor(al_Row) = &H1111FF
        ElseIf lo_Column.GetData(al_Row) = 2 Then
            grd_SubDetail(Index).LineColor(al_Row) = &H11FFC0
        End If
    End If
    Exit Sub
ErrHandler:
    Call ErrorMessage("grd_Subdetail_RowLoaded")
End Sub

Private Sub ImportExcelData(ByVal la_MainConfigIndex As Integer)
On Error GoTo ErrHandler

Dim ls_filePath As String

    dlg_Common.Filter = "XLS files (*.xls)|*.xls"
    dlg_Common.CancelError = False
    Call dlg_Common.ShowOpen
    
    If dlg_Common.FileName <> "" Then
        
        ls_filePath = dlg_Common.FileName
        Screen.MousePointer = vbHourglass

        Call Process_File(ls_filePath, la_MainConfigIndex)
        Screen.MousePointer = vbDefault
    End If

    Exit Sub
ErrHandler:
    Call ErrorMessage("ImportExcelData")
End Sub

Private Sub Process_File(ByRef as_filePath As String, ByVal la_MainConfigIndex As Integer)
On Error GoTo ErrHandler
    
    Exit Sub
ErrHandler:
    Call ErrorMessage("Process_File")
End Sub

Private Function ConvertDate(ByVal ae_TableType As eTableType, ByVal as_Date As String) As Date
On Error GoTo ErrHandler

Dim ls_Date() As String

    ConvertDate = 0
    If Trim(as_Date) <> "" Then
        Select Case ae_TableType
        Case Else
            Err.Raise ArmErr.InvalidValue, "ae_TableType", "Invalid table type value: " & ae_TableType
        End Select
    End If
    Exit Function
ErrHandler:
    Call ErrorHandler("ConvertDate")
End Function

Private Function ShowImage(ByVal al_Index As Long, ByVal al_ImgId As Long, ByVal as_FileName As String) As Boolean
On Error GoTo ErrHandler

    If al_ImgId >= 0 Then
        Call DrawSelImage(mo_Tools.LoadDPCImage(mo_Db, mo_FSO, ms_PicPath, al_ImgId), pic_ImgBox(al_Index))
    ElseIf as_FileName <> "" Then
        Call DrawSelImage(LoadPicture(as_FileName), pic_ImgBox(al_Index))
    End If
    
    ShowImage = True
    
    Exit Function
ErrHandler:
    ShowImage = False
    Call ErrorHandler("ShowImage")
End Function

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' FRAMEWORK METHODS
' please DO NOT change anything in this part of code
'**********************************************************************************************************************************
'**********************************************************************************************************************************

Public Function Load_A_COM() As Boolean

Dim ll_Index As Long
Dim lo_Control As Object

On Error GoTo ErrHandler
    
    Load_A_COM = False
    
    If mb_Initialized Then
        Call Err.Raise(ArmErr.CPTAlreadyInitialized)
    End If
    
    If mo_Db Is Nothing Then
        Call Err.Raise(ArmErr.PropertyNotSet)
    End If
    If mo_Tools Is Nothing Then
        Call Err.Raise(ArmErr.PropertyNotSet)
    End If
    
    If Not mo_Tools.HasSecurityAlias(ms_LoginName, "DPC_REF_SYS") Then
        Exit Function
    End If
    
    mb_InternalInit = False
    ms_DecimalSeparator = Format(0, ".")
    mc_ScreenLabels = 0
    mc_Toolbars = 0
    mc_Item = 0
    
    Call mo_Tools.Load_A_ComControls(UserControl.Controls, mo_Db, ms_Language_Code)
    
    ReDim mt_MainConfig(-1 To -1)
    ReDim mt_DetailConfig(-1 To -1)
    ReDim mt_SubdetailConfig(-1 To -1)
    
    Dim sBuffer As String
    Dim nBufferLen As Long
    nBufferLen = 255
    sBuffer = String$(nBufferLen, vbNullChar)
    nBufferLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, sBuffer, nBufferLen)
    If nBufferLen > 0 Then
        ms_ThousandSeparator = Left$(sBuffer, nBufferLen - 1)
    End If
        
    Set mo_FSO = CreateObject("Scripting.FileSystemObject")
    
#If ENV = LIVE Then
    Set mo_Sys = CreateObject("ArmSYSCOM.ArmSys")
#Else
    Set mo_Sys = New ARMSYSCOMLib.ArmSYS
#End If
    
    Set mo_WshNetwork = CreateObject("WScript.Network")
    ms_ComputerName = mo_WshNetwork.ComputerName
    ms_NetworkBoardID = mo_Tools.GetMACAddress()
    
    mb_Initialized = Load_A_COM_Custom
    Load_A_COM = mb_Initialized
    Exit Function
ErrHandler:
    Load_A_COM = False
    Call ErrorMessage("Load_A_COM")
End Function

Public Function Unload_A_COM() As Boolean
    
On Error GoTo ErrHandler
    
    Dim ll_Index As Long
    
    Call UnLoad_A_COM_Custom
    
    If mc_ScreenLabels <> 0 Then
        Call mo_Db.Close(mc_ScreenLabels)
        mc_ScreenLabels = 0
    End If
    
    If mc_Toolbars <> 0 Then
        mo_Db.Close (mc_Toolbars)
        mc_Toolbars = 0
    End If
    
    If (Not mt_SubdetailConfig) <> -1 Then 'test if array exists
        For ll_Index = 0 To UBound(mt_SubdetailConfig)
            ReDim mt_SubdetailConfig(ll_Index).DeletedRows(-1 To -1)
        Next
    End If
    
    Call mo_Tools.Unload_A_ComControls(UserControl.Controls)
    
    ReDim mt_MainConfig(-1 To -1)
    ReDim mt_DetailConfig(-1 To -1)
    ReDim mt_SubdetailConfig(-1 To -1)
    
    Set mo_Db = Nothing
    Set mo_Tools = Nothing
    Set mo_FSO = Nothing
    Set mo_Sys = Nothing
    Set mo_WshNetwork = Nothing
    
    mb_Initialized = False
    Unload_A_COM = True
    Exit Function
ErrHandler:
    Unload_A_COM = False
    Call ErrorMessage("Unload_A_Com")
End Function

Public Sub Resize()
On Error GoTo ErrHandler

Dim ll_Index As Long

    If Not Resize_Custom Then
        For ll_Index = 0 To UBound(mt_MainConfig)
            Call ResizeMain(ll_Index)
        Next
        For ll_Index = 0 To UBound(mt_DetailConfig)
            Call ResizeDetail(ll_Index)
        Next
        For ll_Index = 0 To UBound(mt_SubdetailConfig)
            Call ResizeSubdetail(ll_Index)
        Next
    End If
    Exit Sub
ErrHandler:
    Call ErrorMessage("Resize")
End Sub

Private Sub ResizeMain(ByVal al_MainIndex As Long)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long

    If Width < 0 Or Height < 0 Then Exit Sub
    
    ll_frameIndex = mt_MainConfig(al_MainIndex).FrameIndex
    Call tbs_Main.Move(0, 0, Width)
    
    Call fra_MainItem(ll_frameIndex).Move(0, tbs_Main.Height, Width, Height)
    Call tlb_Main(ll_frameIndex).Move(tvw_Main(ll_frameIndex).Left + tvw_Main(ll_frameIndex).Width + FRM_SPACE_HOR, 2 * FRM_SPACE_VER)
    Call grd_Main(ll_frameIndex).Move(tvw_Main(ll_frameIndex).Left + tvw_Main(ll_frameIndex).Width + FRM_SPACE_HOR, tlb_Main(ll_frameIndex).Top + tlb_Main(ll_frameIndex).Height + FRM_SPACE_VER)
    Call fra_MainFilter(ll_frameIndex).Move(0, 0, fra_MainFilter(ll_frameIndex).Width, fra_MainItem(ll_frameIndex).Height - 3 * FRM_SPACE_VER)
    
    If fra_MainItem(ll_frameIndex).Height - tvw_Main(ll_frameIndex).Top - 3 * FRM_SPACE_VER > 0 Then
        tvw_Main(ll_frameIndex).Height = fra_MainItem(ll_frameIndex).Height - tvw_Main(ll_frameIndex).Top - 3 * FRM_SPACE_VER
    End If
    
    If tbs_MainTabFilter(ll_frameIndex).Tabs.Count > 1 Then
        If Height - tbs_MainTabFilter(ll_frameIndex).Height - 2 * FRM_SPACE_VER > 0 Then
            tvw_Main(ll_frameIndex).Height = Height - tbs_MainTabFilter(ll_frameIndex).Height - 2 * FRM_SPACE_VER
        End If
        Call tbs_MainTabFilter(ll_frameIndex).Move(0, fra_MainFilter(ll_frameIndex).Height - tbs_MainTabFilter(ll_frameIndex).Height, fra_MainFilter(ll_frameIndex).Width)
    Else
        tbs_MainTabFilter(ll_frameIndex).Visible = False
    End If
    If fra_MainItem(ll_frameIndex).Height - grd_Main(ll_frameIndex).Top - 3 * FRM_SPACE_VER > 0 Then
        grd_Main(ll_frameIndex).Height = fra_MainItem(ll_frameIndex).Height - grd_Main(ll_frameIndex).Top - 3 * FRM_SPACE_VER
    End If
    If fra_MainItem(ll_frameIndex).Width - grd_Main(ll_frameIndex).Left - FRM_SPACE_HOR > 0 Then
        grd_Main(ll_frameIndex).Width = fra_MainItem(ll_frameIndex).Width - grd_Main(ll_frameIndex).Left - FRM_SPACE_HOR
    End If
    Call cmd_TVReLoad(ll_frameIndex).Move(tvw_Main(ll_frameIndex).Left, tvw_Main(ll_frameIndex).Top)
    Exit Sub
ErrHandler:
    Call ErrorHandler("ResizeMain")
End Sub

Private Sub ResizeDetail(ByVal al_DetailIndex As Long)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long

    If Width < 0 Or Height < 0 Then Exit Sub
    
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    Call fra_DetailItem(ll_frameIndex).Move(0, tbs_Main.Top + tbs_Main.Height + FRM_SPACE_VER, UserControl.Width, UserControl.Height - tbs_Main.Top - tbs_Main.Height - FRM_SPACE_VER)
    Exit Sub
ErrHandler:
    Call ErrorHandler("ResizeDetail")
End Sub

Private Sub ResizeSubdetail(ByVal al_SubDetailIndex As Long)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim ll_tbsIndex As Long
Dim ll_SubDetailFilter As Integer

    If Width < 0 Or Height < 0 Then Exit Sub
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
        
    If mt_SubdetailConfig(al_SubDetailIndex).ShowInTabs = True Then
        ll_tbsIndex = mt_SubdetailConfig(al_SubDetailIndex).TabStribIndex
        Call tbs_SubDetail(ll_tbsIndex).Move(tbs_SubDetail(ll_tbsIndex).Left, tbs_SubDetail(ll_tbsIndex).Top, UserControl.Width - tbs_SubDetail(ll_tbsIndex).Left - 100)
        Call fra_SubDetail(ll_frameIndex).Move(tbs_SubDetail(ll_tbsIndex).Left, tbs_SubDetail(ll_tbsIndex).Top + tbs_SubDetail(ll_tbsIndex).Height, tbs_SubDetail(ll_tbsIndex).Width, UserControl.Height - fra_SubDetail(ll_frameIndex).Top - 5 * FRM_SPACE_VER)
    End If
    
    Call tlb_SubDetail(ll_frameIndex).Move(fra_SubDetail(ll_frameIndex).Width - tlb_SubDetail(ll_frameIndex).Width - FRM_SPACE_HOR, 2 * FRM_SPACE_VER)
    Call fra_SubDetailItem(ll_frameIndex).Move(FRM_SPACE_HOR, FRM_SPACE_VER, tlb_SubDetail(ll_frameIndex).Left - 2 * FRM_SPACE_HOR)
    
    ll_SubDetailFilter = 0
    'If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_GroupParam" Then
    '    ll_SubDetailFilter = cbo_GRP_Type_Filter.Height + 2 * FRM_SPACE_VER
    '    Call cbo_GRP_Type_Filter.Move(5 * FRM_SPACE_HOR, 2 * FRM_SPACE_VER)
    'End If
    Call grd_SubDetail(ll_frameIndex).Move(FRM_SPACE_HOR, 2 * FRM_SPACE_VER + ll_SubDetailFilter, tlb_SubDetail(ll_frameIndex).Left - 2 * FRM_SPACE_HOR, fra_SubDetail(ll_frameIndex).Height - tlb_SubDetail(ll_frameIndex).Height - 3 * FRM_SPACE_VER - ll_SubDetailFilter)
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("ResizeSubdetail")
End Sub

Public Function Init_control() As Boolean
Dim ll_Index As Long

On Error GoTo ErrHandler

    If mb_Initialized Then
        Call Load_ConfigInfo
        Call Init_Custom
        
        Call mo_Tools.ChangeCharset(UserControl.Controls, mo_Tools.GetCodePageFromLanguage(mo_Db, ms_Language_Code))
        mc_ScreenLabels = mo_Tools.LoadLabels(mo_Db, UserControl.Controls, Me, SCREEN_NAME, ms_Language_Code)
        ms_UserName = LoadUserInfo(mo_Db, ml_U_Code)
        
        If tbs_Main.Tabs.Count > 1 Then
            Call tbs_Main.Move(0, 0, Width)
            tbs_Main.Visible = True
        End If
        Set tbs_Main.SelectedItem = tbs_Main.Tabs(1)
            
        Init_control = True
    End If
    
    Exit Function
ErrHandler:
    Init_control = False
    Call ErrorMessage("Init_control")
End Function

Private Sub InitMainFrame(ByVal al_ConfigIndex As Long)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim ls_ToolbarInfo As String

    If al_ConfigIndex < 0 Then Exit Sub
    If mt_MainConfig(al_ConfigIndex).Initialized Then Exit Sub
    
    ll_frameIndex = mt_MainConfig(al_ConfigIndex).FrameIndex
    
    Call ResizeMain(al_ConfigIndex)
    
    Call LoadToolbar(tlb_Main(ll_frameIndex), mt_MainConfig(al_ConfigIndex).ToolbarID)
    
    tlb_Main(ll_frameIndex).Language = ms_Language_Code
    
    Call tlb_Main(ll_frameIndex).DisplayFace(mt_MainConfig(al_ConfigIndex).ToolbarFace)
        
    Call InitTreeView(al_ConfigIndex)
    mt_MainConfig(al_ConfigIndex).Initialized = True
    Exit Sub
ErrHandler:
    Call ErrorMessage("InitMainFrame")
End Sub

Private Sub InitTreeView(ByVal al_ConfigIndex As Long)
On Error GoTo ErrHandler

Const VIEW_REQUEST = "exec TreeView_View_t_lst $ViewCode$,$Language_Code$"
    
    Dim ls_Request As String
    Dim ll_frameIndex As Long
    
    If al_ConfigIndex < 0 Then Exit Sub
    ll_frameIndex = mt_MainConfig(al_ConfigIndex).FrameIndex
    
    ls_Request = ReplacePlaceHolder(VIEW_REQUEST, "$ViewCode$", mo_Tools.SQLStr(mt_MainConfig(al_ConfigIndex).ViewCode))
    ls_Request = ReplacePlaceHolder(ls_Request, "$Language_Code$", mo_Tools.SQLStr(ms_Language_Code))
    
    cbo_View(ll_frameIndex).Request = ls_Request
    Call cbo_View(ll_frameIndex).Load
    
    If cbo_View(ll_frameIndex).Count = 0 Then
        cbo_View(ll_frameIndex).Visible = False
        If mt_MainConfig(ll_frameIndex).GridDelayMethod = egmDelayedAlways Then
            grd_Main(ll_frameIndex).Visible = False
        Else
            Call ReloadMainGrid
        End If
    Else
        Dim ll_Idx As Long, ll_Count As Long
        ll_Count = cbo_View(ll_frameIndex).Count - 1
        ReDim mt_MainConfig(al_ConfigIndex).mTreeViewInfos(ll_Count)
        For ll_Idx = 0 To ll_Count
            mt_MainConfig(al_ConfigIndex).mTreeViewInfos(ll_Idx).Loaded = False
            mt_MainConfig(al_ConfigIndex).mTreeViewInfos(ll_Idx).TreeViewCode = cbo_View(ll_frameIndex).ComboItems(ll_Idx + 1).Key
        Next
        
        Call cbo_View(ll_frameIndex).SearchItem("X", "TV_Default", 0)
    End If
    Exit Sub
ErrHandler:
    Call ErrorMessage("InitMainFrame")
End Sub

Private Sub InitDetailFrame(ByVal al_DetailConfigIndex As Long)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long, ll_Index As Long, ll_TlbIndex As Long

    If mt_DetailConfig(al_DetailConfigIndex).IsMultiDetailFrame Then
        Call InitMultiDetailFrame(al_DetailConfigIndex)
    End If
    
    If mt_DetailConfig(al_DetailConfigIndex).Initialized Then Exit Sub
    
    Call ResizeDetail(al_DetailConfigIndex)
    ll_frameIndex = mt_DetailConfig(al_DetailConfigIndex).FrameIndex
    ll_TlbIndex = mt_DetailConfig(al_DetailConfigIndex).ToolbarIndex
        
    Call InitMandatoryLabels(mt_DetailConfig(al_DetailConfigIndex).ListFieldsMandatory)
    
    If tlb_Detail(ll_TlbIndex).ButtonsString = "" Then
        Call LoadToolbar(tlb_Detail(ll_TlbIndex), mt_DetailConfig(al_DetailConfigIndex).ToolbarID)
    End If
    
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If mt_SubdetailConfig(ll_Index).ShowInTabs = True And mt_SubdetailConfig(ll_Index).TabIndex = 1 Then
            Call ShowSubDetail(ll_Index)
        End If
        If mt_SubdetailConfig(ll_Index).DetailConfigIndex = al_DetailConfigIndex Then
            Call InitSubdetailFrame(ll_Index)
            If mt_SubdetailConfig(ll_Index).ShowInTabs = True Then
                If tbs_SubDetail(mt_SubdetailConfig(ll_Index).TabStribIndex).Tabs(mt_SubdetailConfig(ll_Index).TabIndex).Caption = "" Then
                    tbs_SubDetail(mt_SubdetailConfig(ll_Index).TabStribIndex).Tabs(mt_SubdetailConfig(ll_Index).TabIndex).Caption = fra_SubDetail(mt_SubdetailConfig(ll_Index).FrameIndex).Caption
                    fra_SubDetail(mt_SubdetailConfig(ll_Index).FrameIndex).Caption = ""
                End If
            End If
        End If
    Next
    If Not IsArray(mt_DetailConfig(al_DetailConfigIndex).RequestAdd) Then mt_DetailConfig(al_DetailConfigIndex).RequestAdd = Array(mt_DetailConfig(al_DetailConfigIndex).RequestAdd)
    If Not IsArray(mt_DetailConfig(al_DetailConfigIndex).RequestUpd) Then mt_DetailConfig(al_DetailConfigIndex).RequestUpd = Array(mt_DetailConfig(al_DetailConfigIndex).RequestUpd)
    If Not IsArray(mt_DetailConfig(al_DetailConfigIndex).RequestDel) Then mt_DetailConfig(al_DetailConfigIndex).RequestDel = Array(mt_DetailConfig(al_DetailConfigIndex).RequestDel)
    mt_DetailConfig(al_DetailConfigIndex).Initialized = True
    Exit Sub
ErrHandler:
    Call ErrorHandler("InitDetailFrame")
End Sub

Private Sub InitSubdetailFrame(ByVal al_SubDetailIndex As Long)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long, ll_Index As Long
Dim lo_Label As Label

    If mt_SubdetailConfig(al_SubDetailIndex).Initialized Then Exit Sub
    
    Call ResizeSubdetail(al_SubDetailIndex)
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
        
    Call ResizeSubdetail(al_SubDetailIndex)
    
    fra_SubDetailItem(ll_frameIndex).Visible = False
    
    Call InitMandatoryLabels(mt_SubdetailConfig(al_SubDetailIndex).ListFieldsMandatory)
    
    Call LoadToolbar(tlb_SubDetail(ll_frameIndex), mt_SubdetailConfig(al_SubDetailIndex).ToolbarID)
    
    If Not IsEmpty(mt_SubdetailConfig(al_SubDetailIndex).GridColumns) Then
        If Not grd_SubDetail(ll_frameIndex).SetColumns(mt_SubdetailConfig(al_SubDetailIndex).GridColumns) Then
            Err.Raise ArmErr.InvalidValue, "SetColumns failed for main grid in " & mt_SubdetailConfig(al_SubDetailIndex).NameFrame
        End If
        Call mo_Tools.LoadLabelsCursor(mo_Db, mc_ScreenLabels, UserControl.Controls, fra_SubDetail(ll_frameIndex), SCREEN_NAME, ms_Language_Code)
    End If
    mt_SubdetailConfig(al_SubDetailIndex).Initialized = True
    Exit Sub
ErrHandler:
    Call ErrorHandler("InitSubdetailFrame")
End Sub

Private Sub LoadDetailListView(al_List As ListView, ByVal ls_Req_List As String, ByVal as_Req_Fill As String, ByVal as_ID_Column As String, ByVal as_Name_Column As String)
On Error GoTo ErrHandler
    
    Dim ls_Request As String
    Dim ll_Cursor As Long
        
    ls_Request = ReplacePlaceHolder(ls_Req_List, "$Language_Code$", mo_Tools.SQLStr(ms_Language_Code))
    ll_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
    Debug.Assert (ll_Cursor <> 0)
    
    al_List.ListItems.Clear
    
    Dim ll_Index As Long
    ll_Index = 1
    While Not mo_Db.EOF(ll_Cursor)
        Call al_List.ListItems.Add(ll_Index, "ID" & mo_Db.GetFields(ll_Cursor, as_ID_Column), mo_Db.GetFields(ll_Cursor, as_Name_Column))
        ll_Index = ll_Index + 1
        Call mo_Db.Next(ll_Cursor)
    Wend
        
    mo_Db.Close (ll_Cursor)
    
    If as_Req_Fill <> "" Then
        
        ls_Request = ReplacePlaceHolder(as_Req_Fill, "$Language_Code$", mo_Tools.SQLStr(ms_Language_Code))
        ll_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
        
        Dim ll_Key
        While Not mo_Db.EOF(ll_Cursor)
            ll_Key = mo_Db.GetFields(ll_Cursor, as_ID_Column)
            
            For ll_Index = 1 To al_List.ListItems.Count
                If al_List.ListItems.Item(ll_Index).Key = "ID" & ll_Key Then
                    al_List.ListItems.Item(ll_Index).Checked = True
                End If
            Next
            Call mo_Db.Next(ll_Cursor)
        Wend
        mo_Db.Close (ll_Cursor)
    End If
    
    Exit Sub
ErrHandler:
    Call ErrorMessage("LoadDetailListView")
End Sub

Private Sub SaveDetailListCommon(ByVal al_DetailIndex As Long)
On Error GoTo ErrHandler

Const DELETE_REQUEST_SYS = "exec DPC_SysVendor_del $SYS_Id$"
Const INSERT_REQUEST_SYS = "exec DPC_SysVendor_ins $SYS_Id$,$VEN_Id$,$Z_Creator$"

Dim ls_Request As String
Dim ls_Request2 As String
Dim ll_frameIndex As Long

    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex

    If (StrComp(mt_DetailConfig(al_DetailIndex).NameFrame, "DPC_System", vbTextCompare) = 0) Then
        
        Call SaveDetailListView(lv_SysVendor, DELETE_REQUEST_SYS, INSERT_REQUEST_SYS, txt_DetailKey(ll_frameIndex).Text, "VEN_Id")
    
    End If

    Exit Sub
ErrHandler:
    Call ErrorMessage("SaveDetailListCommon")
End Sub

Private Sub SaveDetailListView(al_List As ListView, ByVal as_Req_Del As String, ByVal as_Req_Ins As String, ByVal ai_SYS_Id As Integer, ByVal as_ID_Column As String)
On Error GoTo ErrHandler
    
    Dim ls_Request As String
    Dim ll_Cursor As Long
        
    ls_Request = ReplacePlaceHolder(as_Req_Del, "$SYS_Id$", mo_Tools.SqlInt(ai_SYS_Id))
    Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)

    Dim ll_Index As Long
    Dim ls_ID As String
    For ll_Index = 1 To al_List.ListItems.Count
        If al_List.ListItems(ll_Index).Checked = True Then
            ls_ID = Replace(al_List.ListItems(ll_Index).Key, "ID", "")
            ls_Request = ReplacePlaceHolder(as_Req_Ins, "$SYS_Id$", mo_Tools.SqlInt(ai_SYS_Id))
            ls_Request = ReplacePlaceHolder(ls_Request, "$" & as_ID_Column & "$", ls_ID)
            ls_Request = ReplacePlaceHolder(ls_Request, "$Z_Creator$", mo_Tools.SqlInt(ml_U_Code))
            Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)
        End If
    Next
                    
    Exit Sub
ErrHandler:
    Call ErrorMessage("SaveDetailListView")
End Sub

Private Function GenerateNameListView(al_List As ListView) As String
On Error GoTo ErrHandler

Dim ll_Idx As Long
Dim ll_Name As String

    ll_Name = ""
    GenerateNameListView = ""
    
    For ll_Idx = 1 To al_List.ListItems.Count
        If al_List.ListItems(ll_Idx).Checked = True Then
            ll_Name = ll_Name + al_List.ListItems(ll_Idx).Text
            ll_Name = ll_Name & ","
        End If
    Next
    
    GenerateNameListView = ll_Name
    
    Exit Function
ErrHandler:
    Call ErrorHandler("GenerateNameListView")
End Function

Private Function GetInitControlProperty(ByVal al_DetailIndex As Long, ByRef ao_Control As Object, ByVal ae_ControlIndex As eControlPropertyIndex) As Variant
On Error GoTo ErrHandler

Dim lv_InitControls As Variant
Dim ll_Idx As Long

    lv_InitControls = mt_DetailConfig(al_DetailIndex).InitControls
    For ll_Idx = 0 To UBound(lv_InitControls)
        If lv_InitControls(ll_Idx)(0) Is ao_Control Then
            GetInitControlProperty = lv_InitControls(ll_Idx)(ae_ControlIndex)
        End If
    Next
    Exit Function
ErrHandler:
    Call ErrorHandler("GetInitControlProperty")
End Function

Private Sub InitFrameControls(ByRef av_InitControls As Variant)
On Error GoTo ErrHandler

Dim lo_Control As Control
Dim ll_Index As Long
Dim ls_Request As String

    If Not IsArray(av_InitControls) Then Exit Sub
    mb_InternalInit = True
    For ll_Index = 0 To UBound(av_InitControls)
        Set lo_Control = av_InitControls(ll_Index)(0)
        
        lo_Control.Tag = av_InitControls(ll_Index)(1)
        lo_Control.Visible = av_InitControls(ll_Index)(2)
        Select Case UCase(TypeName(lo_Control))
            Case "ARMCOMBOBOX"
                If UBound(av_InitControls(ll_Index)) >= 3 Then
                    ls_Request = av_InitControls(ll_Index)(3)
                    ls_Request = ReplaceCommonPlaceholders(ls_Request)
                    lo_Control.Request = ls_Request
                End If
            Case "TEXTBOX", "ARMPICKER"
                If UBound(av_InitControls(ll_Index)) >= 4 Then
                    lo_Control.MaxLength = av_InitControls(ll_Index)(4)
                End If
            Case "A_CALOCX"
            Case "LABEL", "CHECKBOX"
                lo_Control.Caption = "#" & lo_Control.Tag
        End Select
    Next
    mb_InternalInit = False
    Exit Sub
ErrHandler:
    mb_InternalInit = False
    Call ErrorHandler("InitFrameControls")
End Sub

Private Sub InitMultiDetailFrame(ByVal al_DetailConfigIndex As Long)
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
    
    ll_frameIndex = mt_DetailConfig(al_DetailConfigIndex).FrameIndex
    
    Call ResetFrameControls(fra_DetailItem(ll_frameIndex))
    Call InitFrameControls(mt_DetailConfig(al_DetailConfigIndex).InitControls)
    Call mo_Tools.LoadLabelsCursor(mo_Db, mc_ScreenLabels, UserControl.Controls, fra_DetailItem(ll_frameIndex), SCREEN_NAME, ms_Language_Code)
    Call InitMandatoryLabels(mt_DetailConfig(al_DetailConfigIndex).ListFieldsMandatory)
    Exit Sub
ErrHandler:
    Call ErrorHandler("InitMultiDetailFrame")
End Sub

Private Sub InitMandatoryLabels(ByRef av_ListFieldsMandatory As Variant)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim lo_Label As Label

    For ll_Index = 0 To UBound(av_ListFieldsMandatory)
        If av_ListFieldsMandatory(ll_Index)(1) >= 0 Then
            Set lo_Label = lbl_Label(av_ListFieldsMandatory(ll_Index)(1))
            lo_Label.FontBold = True
        End If
    Next
    Exit Sub
ErrHandler:
    Call ErrorHandler("InitMandatoryLabels")
End Sub

Private Function GetSelectedRootNode(ByRef ao_Tree As ArmTreeView) As MSComctlLib.Node
On Error GoTo ErrHandler

Dim lo_Node  As Object

    Set GetSelectedRootNode = Nothing
    Set lo_Node = ao_Tree.SelectedItem
    If Not (lo_Node Is Nothing) Then
        While Not (lo_Node.Parent Is Nothing)
            Set lo_Node = lo_Node.Parent
        Wend
    End If
    Set GetSelectedRootNode = lo_Node
    Exit Function
ErrHandler:
    Call ErrorHandler("GetSelectedRootNode")
End Function

Private Sub SetMode(ByVal ae_Mode As eMode, Optional al_DetailConfigIndex As Long = -1)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim ll_MainFrameIndex As Long
Dim ll_DetailFrameIndex As Long
Dim ll_DetailConfigIndex As Long
Dim ll_MainConfigIndex As Long
Dim ll_TlbIndex As Long
Dim le_SubdetailMode As eMode
Dim ls_ToolbarFace As String

    If al_DetailConfigIndex = -1 Then
        ll_MainConfigIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
        ll_MainFrameIndex = mt_MainConfig(ll_MainConfigIndex).FrameIndex
        ll_DetailConfigIndex = FindDetailConfigByMainConfig(ll_MainConfigIndex)
    Else
        ll_DetailConfigIndex = al_DetailConfigIndex
    End If
    
    ll_DetailFrameIndex = mt_DetailConfig(ll_DetailConfigIndex).FrameIndex
    ll_TlbIndex = mt_DetailConfig(ll_DetailConfigIndex).ToolbarIndex
    
    Select Case ae_Mode
    Case emView
        ls_ToolbarFace = mt_DetailConfig(ll_DetailConfigIndex).ToolbarFaces(0)
        le_SubdetailMode = emView
    Case emAdd
        ls_ToolbarFace = mt_DetailConfig(ll_DetailConfigIndex).ToolbarFaces(1)
        le_SubdetailMode = emList
    Case emUpdate
        ls_ToolbarFace = mt_DetailConfig(ll_DetailConfigIndex).ToolbarFaces(2)
        le_SubdetailMode = emList
    Case emDelete
        ls_ToolbarFace = mt_DetailConfig(ll_DetailConfigIndex).ToolbarFaces(3)
        le_SubdetailMode = emView
    Case Else
        le_SubdetailMode = emNone
        ls_ToolbarFace = ""
        ll_TlbIndex = -1
    End Select
    
    If ls_ToolbarFace <> "" Then
        If Not tlb_Detail(ll_TlbIndex).DisplayFace(ls_ToolbarFace) Then
            Err.Raise ArmErr.CompFncFailed, "tlb_Detail", "DisplayFace method failed for face: '" & ls_ToolbarFace & "'"
        End If
    End If
    
    For ll_Index = 0 To tlb_Detail.Count - 1
        tlb_Detail(ll_Index).Visible = (ll_Index = ll_TlbIndex)
        tlb_Detail(ll_Index).Enabled = (ll_Index = ll_TlbIndex)
    Next
    
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If mt_SubdetailConfig(ll_Index).DetailConfigIndex = ll_DetailConfigIndex Then
            Call SetModeSubDetail(mt_SubdetailConfig(ll_Index).FrameIndex, le_SubdetailMode)
        End If
    Next
    
    Select Case ae_Mode
    Case emList
        tbs_Main.Enabled = True
        For ll_Index = 0 To fra_DetailItem.Count - 1
            fra_DetailItem(ll_Index).Visible = False
        Next
        For ll_Index = 0 To fra_MainItem.Count - 1
            If ll_Index = ll_MainFrameIndex Then
                fra_MainItem(ll_Index).Zorder
                fra_MainItem(ll_Index).Visible = True
            Else
                fra_MainItem(ll_Index).Visible = False
            End If
        Next
    Case Else
        tbs_Main.Enabled = False
        For ll_Index = 0 To fra_MainItem.Count - 1
            fra_MainItem(ll_Index).Visible = False
        Next
        For ll_Index = 0 To fra_DetailItem.Count - 1
            If ll_Index = ll_DetailFrameIndex Then
                fra_DetailItem(ll_Index).Zorder
                fra_DetailItem(ll_Index).Visible = True
            Else
                fra_DetailItem(ll_Index).Visible = False
            End If
        Next
    End Select
    me_OldDetailMode = me_DetailMode
    me_DetailMode = ae_Mode
    Exit Sub
ErrHandler:
    Call ErrorHandler("SetMode")
End Sub

Private Sub ShowSubDetail(ByVal al_SubDetailConfigIndex As Long)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim ll_DetailFrameIndex As Long
Dim ll_DetailConfigIndex As Long
    
    ll_DetailConfigIndex = mt_SubdetailConfig(al_SubDetailConfigIndex).DetailConfigIndex
    ll_DetailFrameIndex = mt_DetailConfig(ll_DetailConfigIndex).FrameIndex
    
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If ll_Index = al_SubDetailConfigIndex Then
            fra_SubDetail(mt_SubdetailConfig(ll_Index).FrameIndex).Zorder
            fra_SubDetail(mt_SubdetailConfig(ll_Index).FrameIndex).Visible = True
        ElseIf mt_SubdetailConfig(ll_Index).DetailConfigIndex = ll_DetailConfigIndex Then
            fra_SubDetail(mt_SubdetailConfig(ll_Index).FrameIndex).Visible = False
        End If
    Next
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("SetMode")
End Sub

Private Sub SetModeSubDetail(ByVal al_SubDetailIndex As Long, ByVal ae_Mode As eMode)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim ll_frameIndex As Long
Dim ll_DetailIndex As Long
Dim ls_ToolbarFace As String
Dim ll_SubDetailFilter As Integer

    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailIndex = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    
    ll_SubDetailFilter = 0
    If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_GroupParam" Then
        If (ae_Mode = emList) Or (ae_Mode = emView) Then
            cbo_GRP_Type_Filter.Visible = True
            cbo_GRP_Type_Filter.Enabled = True
            
            If cbo_GRP_Type_Filter.SelectedItem Is Nothing Then
                Call cbo_GRP_Type_Filter.SearchItem(cbo_GRP_Type_Filter.ComboItems(1).Key)
            End If
    
            lbl_Label(88).Visible = True
            ll_SubDetailFilter = cbo_GRP_Type_Filter.Height
            Call cbo_GRP_Type_Filter.Move(lbl_Label(88).Width + FRM_SPACE_HOR, 2 * FRM_SPACE_VER)
            Call lbl_Label(88).Move(FRM_SPACE_HOR, 2 * FRM_SPACE_VER)
        Else
            cbo_GRP_Type_Filter.Visible = False
            lbl_Label(88).Visible = False
        End If
    End If
        
    If (ae_Mode = emList) Or (ae_Mode = emView) Then
        fra_SubDetailItem(ll_frameIndex).Visible = False
        grd_SubDetail(ll_frameIndex).Top = 2 * FRM_SPACE_VER + ll_SubDetailFilter
        grd_SubDetail(ll_frameIndex).Height = fra_SubDetail(ll_frameIndex).Height - 3 * FRM_SPACE_VER - ll_SubDetailFilter
    Else
        grd_SubDetail(ll_frameIndex).Top = fra_SubDetailItem(ll_frameIndex).Top + fra_SubDetailItem(ll_frameIndex).Height + FRM_SPACE_VER
        grd_SubDetail(ll_frameIndex).Height = fra_SubDetail(ll_frameIndex).Height - fra_SubDetailItem(ll_frameIndex).Height - 4 * FRM_SPACE_VER
        fra_SubDetailItem(ll_frameIndex).Visible = True
    End If
    
    ls_ToolbarFace = ""
    If UBound(mt_SubdetailConfig(al_SubDetailIndex).ToolbarFaces) = 4 Then
        Select Case ae_Mode
        Case emView
            ls_ToolbarFace = mt_SubdetailConfig(al_SubDetailIndex).ToolbarFaces(0)
        Case emList
            ls_ToolbarFace = mt_SubdetailConfig(al_SubDetailIndex).ToolbarFaces(1)
        Case emAdd
            ls_ToolbarFace = mt_SubdetailConfig(al_SubDetailIndex).ToolbarFaces(2)
        Case emUpdate
            ls_ToolbarFace = mt_SubdetailConfig(al_SubDetailIndex).ToolbarFaces(3)
        Case emDelete
            ls_ToolbarFace = mt_SubdetailConfig(al_SubDetailIndex).ToolbarFaces(4)
        End Select
    End If
    
    If ls_ToolbarFace = "" Then
        tlb_SubDetail(ll_frameIndex).Visible = False
    Else
        Call tlb_SubDetail(ll_frameIndex).DisplayFace(ls_ToolbarFace)
        tlb_SubDetail(ll_frameIndex).Visible = True
    End If
    
    grd_SubDetail(ll_frameIndex).Enabled = (ae_Mode = emAdd) Or (ae_Mode = emView) Or (ae_Mode = emList)
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If mt_SubdetailConfig(ll_Index).DetailConfigIndex = ll_DetailIndex Then
            tlb_SubDetail(ll_Index).Enabled = (ll_Index = ll_frameIndex) Or ((ae_Mode = emView) Or (ae_Mode = emList))
        End If
    Next
    tlb_Detail(mt_DetailConfig(ll_DetailIndex).ToolbarIndex).Enabled = (ae_Mode = emView) Or (ae_Mode = emList)
    Call fra_SubDetail(ll_frameIndex).Refresh
    me_SubDetailMode = ae_Mode
    Exit Sub
ErrHandler:
    Call ErrorHandler("SetModeSubDetail")
End Sub

Private Sub ResetFrameControls(ByRef ao_Frame As Frame)
On Error GoTo ErrHandler

Dim lo_Control As Control

    mb_InternalInit = True
    For Each lo_Control In UserControl.Controls
    
        If mo_Tools.HasContainer(lo_Control, ao_Frame) Then
            If StrComp(lo_Control.Name, "chk_Repositioning", vbTextCompare) <> 0 Then
                Select Case UCase(TypeName(lo_Control))
                    Case "ARMCOMBOBOX"
                        Call lo_Control.Clear
                        lo_Control.Tag = ""
                        lo_Control.Request = ""
                        lo_Control.Visible = False
                    Case "ARMPICKER"
                        Call lo_Control.Clear
                        lo_Control.Tag = ""
                        lo_Control.Visible = False
                    Case "CHECKBOX"
                        lo_Control.Value = Unchecked
                        lo_Control.Tag = ""
                        lo_Control.Caption = ""
                        lo_Control.Visible = False
                    Case "TEXTBOX"
                        lo_Control.Tag = ""
                        lo_Control.Text = ""
                        lo_Control.Visible = False
                    Case "A_CALOCX"
                        Call lo_Control.reinit_cal
                        lo_Control.Tag = ""
                        lo_Control.Visible = False
                    Case "LABEL"
                        lo_Control.Tag = ""
                        lo_Control.Caption = ""
                        lo_Control.FontBold = False
                        lo_Control.Visible = False
                End Select
            End If
        End If
    Next
    mb_InternalInit = False
    Exit Sub
ErrHandler:
    mb_InternalInit = False
    Call ErrorHandler("ResetFrameControls")
End Sub

Private Sub UpdateDrivenComboRequest(ByRef ao_Combo As Object, ByVal al_DetailIndex As Long, ByVal ab_ForceClear As Boolean)
On Error GoTo ErrHandler

Dim ls_Request As String

    If ab_ForceClear Then Call ao_Combo.Clear
    
    ls_Request = GetInitControlProperty(al_DetailIndex, ao_Combo, eControlPropertyIndex.cpiRequest)
    ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_DetailItem(mt_DetailConfig(al_DetailIndex).FrameIndex))
    ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
    ls_Request = ReplaceCommonPlaceholders(ls_Request)
    ao_Combo.Request = ls_Request
    Exit Sub
ErrHandler:
    Call ErrorHandler("UpdateDrivenComboRequest")
End Sub

Private Sub LoadToolbar(ByRef ao_Toolbar As Object, ByVal al_Id As Long)
On Error GoTo ErrHandler

Dim ls_Request As String
Dim ls_ToolbarInfo As String

    ' no toolbar definition ID, do not load anything
    If (al_Id = 0) Or (ms_ToolbarRequest = "") Then Exit Sub
    'load all definition strings only once and keep it in cursor
    If mc_Toolbars = 0 Then
        ls_Request = ReplacePlaceHolder(ms_ToolbarRequest, "$Module$", mo_Tools.SQLStr(MODULE_NAME))
        mc_Toolbars = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
    End If
    
    If mo_Db.Find(mc_Toolbars, "Id", al_Id) < 0 Then
        Err.Raise ArmErr.InvalidValue, ao_Toolbar.Name, "Toolbar not found in toolbars_definitions ID:" & al_Id
    End If
    
    ls_ToolbarInfo = mo_Db.GetFields(mc_Toolbars, "info")
    If Not ao_Toolbar.SetToolbarInfoStringParameters(ls_ToolbarInfo, Left(ls_ToolbarInfo, 3)) Then
        Err.Raise ArmErr.InvalidValue, ao_Toolbar.Name, "SetToolbarInfoStringParameters failed for toolbar ID:" & al_Id
    End If
    Call ao_Toolbar.DisplayFace("0")
    Exit Sub
ErrHandler:
    Call ErrorHandler("LoadToolbar")
End Sub

Private Function FindSubDetailConfigByName(ByVal as_SubdetailName As String) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long

    FindSubDetailConfigByName = -1
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If StrComp(mt_SubdetailConfig(ll_Index).NameFrame, as_SubdetailName, vbTextCompare) = 0 Then
            FindSubDetailConfigByName = ll_Index
            Exit Function
        End If
    Next
    Exit Function
ErrHandler:
    Call ErrorHandler("FindSubDetailConfigByName")
End Function

Private Function FindSubDetailConfigByFrameIndex(ByVal al_FrameIndex As Long) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long

    FindSubDetailConfigByFrameIndex = -1
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If mt_SubdetailConfig(ll_Index).FrameIndex = al_FrameIndex Then
            FindSubDetailConfigByFrameIndex = ll_Index
            Exit Function
        End If
    Next
    Exit Function
ErrHandler:
    Call ErrorHandler("FindSubDetailConfigByFrameIndex")
End Function


Private Function FindMainConfigByFrameIndex(ByVal al_FrameIndex As Long) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long

    FindMainConfigByFrameIndex = -1
    For ll_Index = 0 To UBound(mt_MainConfig)
        If mt_MainConfig(ll_Index).FrameIndex = al_FrameIndex Then
            FindMainConfigByFrameIndex = ll_Index
            Exit Function
        End If
    Next
    Exit Function
ErrHandler:
    Call ErrorHandler("FindMainConfigByFrameIndex")
End Function

Private Function FindMainConfigByName(ByVal as_Name As String) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long

    FindMainConfigByName = -1
    For ll_Index = 0 To UBound(mt_MainConfig)
        If StrComp(mt_MainConfig(ll_Index).NameFrame, as_Name, vbTextCompare) = 0 Then
            FindMainConfigByName = ll_Index
            Exit Function
        End If
    Next
    Exit Function
ErrHandler:
    Call ErrorHandler("FindMainConfigByName")
End Function

Private Function FindDetailConfigByFrameIndex(ByVal al_FrameIndex As Long) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long

    FindDetailConfigByFrameIndex = -1
    For ll_Index = 0 To UBound(mt_DetailConfig)
        If mt_DetailConfig(ll_Index).FrameIndex = al_FrameIndex Then
            FindDetailConfigByFrameIndex = ll_Index
            Exit Function
        End If
    Next
    Err.Raise ArmErr.InvalidValue, "al_FrameIndex=" & al_FrameIndex, "Detail config index not found."
    Exit Function
ErrHandler:
    Call ErrorHandler("FindDetailConfigByFrameIndex")
End Function

Private Function FindSubDetailConfigByTabIndex(ByVal al_TabIndex As Long) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long

    FindSubDetailConfigByTabIndex = -1
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If mt_SubdetailConfig(ll_Index).TabIndex = al_TabIndex Then
            FindSubDetailConfigByTabIndex = ll_Index
            Exit Function
        End If
    Next
    Exit Function
ErrHandler:
    Call ErrorHandler("FindSubDetailConfigByTabIndex")
End Function

Private Function FindDetailConfigByName(ByVal as_Name As String) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long

    FindDetailConfigByName = -1
    For ll_Index = 0 To UBound(mt_DetailConfig)
        If StrComp(mt_DetailConfig(ll_Index).NameFrame, as_Name, vbTextCompare) = 0 Then
            FindDetailConfigByName = ll_Index
            Exit Function
        End If
    Next
    Err.Raise ArmErr.InvalidValue, "as_Name=" & as_Name, "Detail config index not found."
    Exit Function
ErrHandler:
    Call ErrorHandler("FindDetailConfigByName")
End Function

Private Function FindDetailConfigByMainConfig(ByVal al_MainIndex As Long) As Long
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim lo_ComboItem As Object
Dim ll_frameIndex As Long
'Dim le_DocumentType  As eDocumentType

    FindDetailConfigByMainConfig = -1
    ll_frameIndex = mt_MainConfig(al_MainIndex).FrameIndex
    If mt_MainConfig(al_MainIndex).IsMultiDetailView Then
        FindDetailConfigByMainConfig = mt_MainConfig(al_MainIndex).CurrentDetailIndex
        Exit Function
    Else
        For ll_Index = 0 To UBound(mt_DetailConfig)
            If mt_DetailConfig(ll_Index).MainConfigIndex = al_MainIndex Then
                FindDetailConfigByMainConfig = ll_Index
                Exit Function
            End If
        Next
    End If
    Err.Raise ArmErr.InvalidValue, "al_MainIndex=" & al_MainIndex, "Detail config index not found."
    Exit Function
ErrHandler:
    Call ErrorHandler("FindDetailConfigByMainConfig")
End Function

'to check if our current position in treeview will allow us to display added/updated item in grid
Private Function IsItemSelectedInTree(ByVal al_DetailIndex As Long, ByRef ao_Tree As ArmTreeView, ByVal av_PathData As Variant) As Boolean
On Error GoTo ErrHandler
    
Dim ll_SelLevel As Long, ll_IdxLvl As Long
Dim lo_Node As Object
Dim lb_CheckDone As Boolean


    IsItemSelectedInTree = IsItemSelectedInTreeCustom(al_DetailIndex, ao_Tree, av_PathData, lb_CheckDone)
    If lb_CheckDone Then Exit Function
    
    IsItemSelectedInTree = False
    
    Set lo_Node = ao_Tree.SelectedItem
    If lo_Node Is Nothing Then Exit Function
    If Not IsArray(av_PathData) Then Exit Function
    
    ll_SelLevel = lo_Node.Tag.ml_Level
    
    If ll_SelLevel > UBound(av_PathData) Then
        IsItemSelectedInTree = False
        Exit Function
    End If
    
    For ll_IdxLvl = ll_SelLevel To 0 Step -1
        If lo_Node Is Nothing Then Exit Function
        If Not IsArray(av_PathData(ll_IdxLvl)) Then
            Err.Raise ArmErr.InvalidValue, "av_PathData(ll_IdxLvl)", "Path data element is not an array: " & ll_IdxLvl
        End If
        If StrComp(lo_Node.Tag.IDValue, av_PathData(ll_IdxLvl)(0), vbTextCompare) <> 0 Then
            Exit Function
        End If
        Set lo_Node = lo_Node.Parent
    Next
    IsItemSelectedInTree = True
    Exit Function
ErrHandler:
    Call ErrorHandler("IsItemSelectedInTree")
End Function

' Return true if have created the node
' TODO : Manage the third parameter...
Private Function FindInTreeView(ByRef ao_Tree As ArmTreeView, ByVal av_PathData As Variant, ByVal ab_AutoCreate As Boolean, ByVal ab_Expand As Boolean) As Node
On Error GoTo ErrHandler

Dim lb_Internal As Boolean
Dim lo_Node As Object
Dim ll_LvlIdx As Long, ll_DataIdx As Long
Dim ls_Key As String, ls_Desc As String
    
    Set FindInTreeView = Nothing
    lb_Internal = mb_InternalInit
    mb_InternalInit = True
    Set lo_Node = Nothing
    For ll_LvlIdx = 0 To UBound(av_PathData)
        If Not IsArray(av_PathData(ll_LvlIdx)) Then
            Err.Raise ArmErr.InvalidValue, "av_PathData(ll_LvlIdx)", "Path data element is not an array"
        End If
        
        If UBound(av_PathData(ll_LvlIdx)) = 1 Then
            ls_Key = av_PathData(ll_LvlIdx)(0)
            ls_Desc = av_PathData(ll_LvlIdx)(1)
        ElseIf UBound(av_PathData(ll_LvlIdx)) > 1 Then
            ls_Key = av_PathData(ll_LvlIdx)(0)
            ls_Desc = av_PathData(ll_LvlIdx)(2)
        Else
            Err.Raise ArmErr.InvalidValue, "av_PathData(ll_LvlIdx)", "Invalid count of path data elements"
        End If
        
        If ao_Tree.Find(ls_Key, 0, lo_Node, ll_LvlIdx) Then
            Set lo_Node = ao_Tree.SelectedItem
        Else
            If ab_AutoCreate Then
                'TODO add additional data from detail tree into main tree data
                Set lo_Node = ao_Tree.AddNode(lo_Node, ls_Key, ls_Desc, 1, 2, LoadTypeChildsDemand)
                If lo_Node Is Nothing Then
                    Err.Raise ArmErr.CompFncFailed, "ao_Tree.AddNode", "Function failed to create node"
                End If
                For ll_DataIdx = 1 To UBound(av_PathData(ll_LvlIdx))
                    Call lo_Node.Tag.SetData(ll_DataIdx, av_PathData(ll_LvlIdx)(ll_DataIdx))
                Next
                lo_Node.Selected = True
            Else
                GoTo CleanUp
            End If
        End If
        If (Not lo_Node.Expanded) And (ll_LvlIdx <> UBound(av_PathData)) Then
            If Not ab_Expand Then GoTo CleanUp
            Call ao_Tree.ExpandNode(lo_Node)
        End If
    Next
    
    Set FindInTreeView = lo_Node
        
CleanUp:
    Set lo_Node = Nothing
    mb_InternalInit = lb_Internal
    Exit Function
ErrHandler:
    Set lo_Node = Nothing
    mb_InternalInit = lb_Internal
    Call ErrorHandler("FindInTreeView")
End Function

Private Function GetCurrentPathData(ByRef ao_Controls As Variant, ByVal as_Path As String) As Variant
On Error GoTo ErrHandler

    Dim ls_Pattern As String, las_Tag() As String, las_Paths() As String, lv_pathData As Variant, lv_CheckData As Variant
    Dim ll_IdxPath As Long, ll_CountPath As Long, ll_Idx As Long, ll_ItemIdx As Long
    Dim lo_Control As Control
    Dim ll_Pos As Long, ls_PatternIndex As String, ls_ControlIndex As String
    
        las_Paths = Split(as_Path, SEP)
        ll_CountPath = UBound(las_Paths) + 1
        ReDim lv_pathData(ll_CountPath - 1)
        
        For Each lo_Control In ao_Controls
            For ll_IdxPath = 0 To ll_CountPath - 1
                ls_Pattern = las_Paths(ll_IdxPath)
                ' hardcoded first node of tree contain node all
                If StrComp(ls_Pattern, "ALL", vbTextCompare) = 0 Then
                    lv_pathData(ll_IdxPath) = Array(-1, "#All")
                End If
                ' hardcoded key value for tree search (maybe when data loaded from A_Reference)
                If IsNumeric(ls_Pattern) Then
                    lv_pathData(ll_IdxPath) = Array(ls_Pattern, "#Unknown")
                End If
                
                ls_PatternIndex = ""
                ll_Pos = InStr(1, ls_Pattern, "(")
                If ll_Pos > 0 Then
                    ls_PatternIndex = Mid(ls_Pattern, ll_Pos + 1, Len(ls_Pattern) - ll_Pos - 1)
                    ls_Pattern = Left(ls_Pattern, ll_Pos - 1)
                End If
                ls_ControlIndex = ""
On Error Resume Next    ' is there other way how correctly retrieve index of control if it is in control array ?
                ls_ControlIndex = CStr(lo_Control.Index)
On Error GoTo ErrHandler
                If (StrComp(ls_Pattern, lo_Control.Name, vbTextCompare) = 0) And _
                   (StrComp(ls_PatternIndex, ls_ControlIndex, vbTextCompare) = 0) Then
                    Select Case UCase(TypeName(lo_Control))
                        Case "ARMCOMBOBOX"
                            lv_pathData(ll_IdxPath) = Array(mo_Tools.GetComboKey(lo_Control), lo_Control.Text)
                            Exit For
                        Case "ARMPICKER"
                            lv_pathData(ll_IdxPath) = Array(lo_Control.ItemCode, lo_Control.ItemDescription)
                            Exit For
                        Case "TEXTBOX"
                            lv_pathData(ll_IdxPath) = Array(lo_Control.Text, lo_Control.Text)
                            Exit For
                        Case "ARMTREEVIEW"
                            Dim ll_LevelCount As Long
                            Dim ll_LevelIndex As Long
                            Dim ll_DataIndex As Long
                            Dim lv_LevelData As Variant
                            Dim lv_NodeData As Variant
                            Dim lo_Node As Object
                            
                            If Not (lo_Control.SelectedItem Is Nothing) Then
                                ll_LevelCount = lo_Control.SelectedItem.Tag.ml_Level + 1
                                ReDim lv_LevelData(ll_LevelCount - 1)
                                Set lo_Node = lo_Control.SelectedItem
                                ll_LevelIndex = ll_LevelCount - 1
                                While (Not (lo_Node Is Nothing)) And (ll_LevelIndex >= 0)
                                    If lo_Node.Tag.length >= 0 Then
                                        ReDim lv_NodeData(lo_Node.Tag.length)
                                        For ll_DataIndex = 0 To UBound(lv_NodeData)
                                            lv_NodeData(ll_DataIndex) = lo_Node.Tag.GetData(ll_DataIndex)
                                        Next
                                        lv_LevelData(ll_LevelIndex) = lv_NodeData
                                    Else
                                        lv_LevelData(ll_LevelIndex) = Array(lo_Node.Tag.IDValue, "", lo_Node.Tag.TextValue)
                                    End If
                                    Set lo_Node = lo_Node.Parent
                                    ll_LevelIndex = ll_LevelIndex - 1
                                Wend
                                If SafeUbound(lv_pathData) = -1 Then    'MW REDIM
                                    ReDim lv_pathData(UBound(lv_pathData) + ll_LevelCount - 1)
                                Else
                                    ReDim Preserve lv_pathData(UBound(lv_pathData) + ll_LevelCount - 1)
                                End If
                                For ll_LevelIndex = 0 To UBound(lv_LevelData)
                                    lv_pathData(ll_IdxPath + ll_LevelIndex) = lv_LevelData(ll_LevelIndex)
                                Next
                                ll_IdxPath = ll_IdxPath + ll_LevelCount - 1
                            End If
                        Case "ARMCHECKVIEW"
                            lv_CheckData = Array("", "")
                            If lo_Control.RoleList("EDIT").CheckedCount > 0 Then
                                ReDim lv_CheckData(lo_Control.RoleList("EDIT").CheckedCount * 2 - 1)
                                ll_ItemIdx = 0
                                For ll_Idx = 1 To lo_Control.RoleList("EDIT").Count
                                    If lo_Control.RoleList("EDIT").Items(ll_Idx).CurrentChecked Then
                                        lv_CheckData(ll_ItemIdx * 2) = lo_Control.RoleList("EDIT").Items(ll_Idx).GetData(0)
                                        lv_CheckData(ll_ItemIdx * 2 + 1) = lo_Control.RoleList("EDIT").Items(ll_Idx).GetData(1)
                                        ll_ItemIdx = ll_ItemIdx + 1
                                    End If
                                Next
                            End If
                            lv_pathData(ll_IdxPath) = lv_CheckData
                            Exit For
                    End Select
                End If
            Next ll_IdxPath
        Next lo_Control
        Set lo_Control = Nothing
        GetCurrentPathData = lv_pathData
    Exit Function

ErrHandler:
    Set lo_Control = Nothing
    Call ErrorHandler("GetCurrentPathData")

End Function

Private Sub InitItemDetailKey(ByVal al_DetailIndex As Long)
On Error GoTo ErrHandler

    Dim ll_frameIndex As Long
    
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    'replace the holders (from the frame record)
    If mt_DetailConfig(al_DetailIndex).TableName <> "" Then
        txt_DetailKey(ll_frameIndex).Text = mo_Tools.GetNextID(mo_Db, mt_DetailConfig(al_DetailIndex).TableName)
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("InitItemDetailKey")
End Sub

Private Function Item_CheckMandatory(ByVal av_ListFieldsMandatory As Variant) As Boolean
On Error GoTo ErrHandler
    
    Dim lIdx As Long, lCount As Long
    Dim lv_MsgReplaceInfo(0, 1) As String
    Dim lo_Control As Object
    Dim ls_LabelCaption As String
    Dim ll_CtrlIndex As Long
    Dim lb_Found As Boolean
    Dim ls_Tags() As String
    
    If Not IsArray(av_ListFieldsMandatory) Then
        Item_CheckMandatory = True
        Exit Function
    End If
    
    lCount = UBound(av_ListFieldsMandatory, 1)
    
    For lIdx = 0 To lCount
            Set lo_Control = av_ListFieldsMandatory(lIdx)(0)
            If av_ListFieldsMandatory(lIdx)(1) >= 0 Then
                ls_LabelCaption = lbl_Label(av_ListFieldsMandatory(lIdx)(1)).Caption
            Else
                ls_LabelCaption = ""
            End If
            Select Case UCase(TypeName(lo_Control))
                Case "FRAME", "LABEL", "MSFLEXGRID", "TOOLBARCONTROL"
                    ' Do nothing !
                
                Case "TEXTBOX"
                    If lo_Control.Visible And (lo_Control.Text = "") Then
                        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                        Exit Function
                    End If
                    ls_Tags = Split(lo_Control.Tag, SEP)
                    If lo_Control.Visible And UBound(ls_Tags) > 0 And (lo_Control.Text <> "") Then
                        If ls_Tags(1) = "F" And IsNumeric(lo_Control.Text) = False Then
                            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2131, "The field $LabelCaption$ must be numeric.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                            Exit Function
                        End If
                        If ls_Tags(1) = "N" And mo_Tools.IsIntValue(lo_Control.Text) = False Then
                            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2121, "The field $LabelCaption$ must be numeric with not decimal.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                            Exit Function
                        End If
                    End If
                Case "ARMCHECKVIEW"
                     If lo_Control.Visible And (lo_Control.RoleList("EDIT").CheckedCount = 0) Then
                        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                        Call lo_Control.SetFocus
                        Exit Function
                      End If
                Case "A_CALOCX"
                    If lo_Control.Visible And (lo_Control.date_courte = "") Then
                        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                        Exit Function
                    End If
                Case "ARMGRID", "ARMCHECKVIEW", "COMMANDBUTTON", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "TABSTRIP"
                Case "OPTIONBUTTON", "CHECKBOX"
                    'probably array of controls
                Case "OBJECT"
                    lb_Found = False
                    For ll_CtrlIndex = 0 To lo_Control.Count - 1
                        If UCase(TypeName(lo_Control(ll_CtrlIndex))) = "CHECKBOX" Then
                            If lo_Control(ll_CtrlIndex).Value = vbChecked Then
                                lb_Found = True
                                Exit For
                            End If
                        ElseIf UCase(TypeName(lo_Control(ll_CtrlIndex))) = "OPTIONBUTTON" Then
                            If lo_Control(ll_CtrlIndex).Value Then
                                lb_Found = True
                                Exit For
                            End If
                        Else
                            ' unknown array ???
                            lb_Found = True
                            Exit For
                        End If
                    Next
                    If Not lb_Found Then
                        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                        Exit Function
                    End If
                Case "ARMCOMBOBOX"
                    If lo_Control.Visible And (lo_Control.SelectedItem Is Nothing) Then
                        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                        Exit Function
                    End If
                Case "ARMPICKER"
                    If lo_Control.Visible And (CStr(lo_Control.ItemCode) = "") Then
                        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                        Exit Function
                    End If
                Case "LISTVIEW"
                     If lo_Control.Visible And (GetCheckedCount(lo_Control) = 0) Then
                        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2120, "The field $LabelCaption$ is mandatory.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                        Exit Function
                      End If
                Case Else
                    Debug.Print "Item_CheckMandatory " & UCase(TypeName(lo_Control))
            End Select
    Next

    Item_CheckMandatory = True

    Exit Function
ErrHandler:
    Call ErrorHandler("Item_CheckMandatory")
    
End Function

Private Function Item_CheckValues(ByRef ao_Frame As Frame)
On Error GoTo ErrHandler

Dim lo_Control As Control
Dim lsa_Columns() As String
Dim lv_MsgReplaceInfo(0, 1) As String
Dim ls_LabelCaption As String

    Item_CheckValues = False
    
    For Each lo_Control In UserControl.Controls
    
        If mo_Tools.HasContainer(lo_Control, ao_Frame) Then
            Select Case UCase(TypeName(lo_Control))
                Case "TEXTBOX"
                    If Trim(lo_Control.Tag) <> "" And Trim(lo_Control.Text) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        If UBound(lsa_Columns) >= 2 Then
                            
                            ls_LabelCaption = mo_Tools.GetLabelCaption(UserControl.Controls, ao_Frame, lsa_Columns(2))
                            
                            If lsa_Columns(1) = "F" And IsNumeric(lo_Control.Text) = False Then
                                Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2131, "The field $LabelCaption$ must be numeric.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                                Exit Function
                            End If
                            
                            If lsa_Columns(1) = "N" And mo_Tools.IsIntValue(lo_Control.Text) = False Then
                                Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 2121, "The field $LabelCaption$ must be numeric with not decimal.", Array("$LabelCaption$", ls_LabelCaption), vbInformation)
                                Exit Function
                            End If
                        End If
                    End If
            End Select
        End If
    Next
    Item_CheckValues = True
    Exit Function
ErrHandler:
    Item_CheckValues = False
    Call ErrorHandler("Item_CheckValues")
End Function

Private Sub Item_Clear(ByVal al_DetailIndex As Long)
On Error GoTo ErrHandler

Dim ll_Index As Long

    Call mo_Tools.ClearFrame(UserControl.Controls, fra_DetailItem(mt_DetailConfig(al_DetailIndex).FrameIndex))
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If (mt_SubdetailConfig(ll_Index).DetailConfigIndex = al_DetailIndex) And (mt_SubdetailConfig(ll_Index).RequestView <> "") Then
            ReDim mt_SubdetailConfig(ll_Index).DeletedRows(-1 To -1)
        End If
    Next
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_Clear")
End Sub

Private Sub Item_Load(ByVal al_DetailIndex As Long, ByVal av_Key As Variant)
On Error GoTo ErrHandler

Dim ls_req As String
Dim ll_frameIndex As Long

    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    
    ls_req = mt_DetailConfig(al_DetailIndex).RequestView
    ls_req = ReplaceKeyPlaceholders(ls_req, av_Key)
    ls_req = ReplaceLanguagePlaceholderFromToolbar(ls_req)
    ls_req = ReplaceCommonPlaceholders(ls_req)
    'load data
    If mc_Item > 0 Then
        Call mo_Db.Close(mc_Item)
        mc_Item = 0
    End If
    
    If ls_req <> "" Then
        mc_Item = mo_Tools.OpenSQLSafe(mo_Db, ls_req, 1)
    End If
   
    Call LoadFrameDataFromCursor(mo_Db, mc_Item, fra_DetailItem(ll_frameIndex))
    
    Call Item_CustomLoad(al_DetailIndex, av_Key)
    Exit Sub
ErrHandler:
    If mc_Item <> 0 Then Call mo_Db.Close(mc_Item)
    mc_Item = 0
    Call ErrorHandler("Item_Load")
End Sub

Private Sub Item_ViewInit(ByVal al_DetailIndex As Long, ByVal av_Key As Variant)
On Error GoTo ErrHandler
    
    Dim ll_frameIndex As Long
    Dim ls_req As String
    
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    
    Call InitDetailFrame(al_DetailIndex)
        
    If mt_DetailConfig(al_DetailIndex).ClearControlsBeforeInit = True Then

        'clear the frame record and disable frames
        Call mo_Tools.ClearFrame(UserControl.Controls, fra_DetailItem(ll_frameIndex))
    End If
    
    
    Call Item_Load(al_DetailIndex, av_Key)
    Call SubItem_Load(al_DetailIndex, av_Key)
    
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_DetailItem(ll_frameIndex), False)
    
    'change screen mode
    Call SetMode(emView, al_DetailIndex)
    
    Call UpdateDetailToolbarCustom(al_DetailIndex)
    
    Call Item_CustomInit(al_DetailIndex, av_Key, emView)
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_ViewInit")
End Sub

Private Sub Item_ReInit(ByVal al_DetailConfigIndex As Long, ByVal av_Key As Variant)
On Error GoTo ErrHandler

    Dim ll_frameIndex As Integer
    
    ll_frameIndex = mt_DetailConfig(al_DetailConfigIndex).FrameIndex
    Select Case me_DetailMode
    Case emAdd
        Call Item_AddInit(al_DetailConfigIndex)
    Case emUpdate
        Call Item_UpdateInit(al_DetailConfigIndex, av_Key)
    Case Else
        Err.Raise ArmErr.InvalidArgument, "me_DetailMode", "Invalid mode: " & me_DetailMode
    End Select
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_ReInit")
End Sub

Private Sub Item_AddInit(ByVal al_DetailConfigIndex As Long)
On Error GoTo ErrHandler

    Dim ll_frameIndex As Integer
    
    ll_frameIndex = mt_DetailConfig(al_DetailConfigIndex).FrameIndex
    
    Call InitDetailFrame(al_DetailConfigIndex)
    
    'clear the frame record
    Call Item_Clear(al_DetailConfigIndex)
    
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_DetailItem(ll_frameIndex), True)
    
    Call DisableFrameParts(mt_DetailConfig(al_DetailConfigIndex).ListFieldsToDisable)
    
    'load default values
    Call Item_LoadDefaultValue(al_DetailConfigIndex, mt_DetailConfig(al_DetailConfigIndex).ListFieldsDefaultValue)
    
    Call SetDrivenDetailControls(Nothing)

    'Change screen mode
    Call SetMode(emAdd, al_DetailConfigIndex)
    
    Call Item_CustomInit(al_DetailConfigIndex, Empty, emAdd)
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_AddInit")
End Sub

Private Function Item_Add(ByVal al_DetailIndex As Long) As Boolean
On Error GoTo ErrHandler
    
    Dim ll_frameIndex As Long
    Dim ll_MainIndex As Long
    Dim ll_MainFrameIndex As Long
    
    Item_Add = False
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    ll_MainIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    If ll_MainIndex <> -1 Then
        ll_MainFrameIndex = mt_MainConfig(ll_MainIndex).FrameIndex
    End If
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(mt_DetailConfig(al_DetailIndex).ListFieldsMandatory) Then Exit Function
    
    If Not Item_CheckValues(fra_DetailItem(ll_frameIndex)) Then Exit Function
    
    'check the custom data validity -> Item_CheckCustom
    If Not Item_CustomCheck(al_DetailIndex, eMode.emAdd) Then Exit Function
    
    'update data on the db ->
    If Not Item_AddDB(al_DetailIndex) Then Exit Function
    
    If ll_MainIndex <> -1 Then
        Call Item_AddLocal(UserControl.Controls, fra_DetailItem(ll_frameIndex), tvw_Main(ll_MainFrameIndex), grd_Main(ll_MainFrameIndex), chk_Repositioning(ll_frameIndex).Value = vbChecked)
    End If
    
    Call Item_CustomLocal(al_DetailIndex, eMode.emAdd)
    
    If ll_MainIndex <> -1 Then
        'go back to the detail screen
        Call Item_ExitToGrid(ll_MainIndex, al_DetailIndex)
        Call SetMode(emList)
    Else
        ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
        mt_MainConfig(ll_MainIndex).CurrentDetailIndex = mt_DetailConfig(al_DetailIndex).PreviousDetailIndex
        Call SetMode(me_OldDetailMode)
        'Call SetMode(emAdd)
    End If
    Item_Add = True
    
    Exit Function
ErrHandler:
    Call ErrorHandler("Item_Add")
End Function

Private Function Item_CheckAddDB(ByVal al_DetailIndex As Long) As Boolean
On Error GoTo ErrHandler
    
    Dim lc_Cursor As Long
    Dim ls_Request As String
    Dim ll_Index As Long, ll_Count As Long, ll_frameIndex As Long
    
    Item_CheckAddDB = False
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    ls_Request = mt_DetailConfig(al_DetailIndex).RequestCheckAdd
    If ls_Request <> "" Then
        ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_DetailItem(ll_frameIndex))
        ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
        ls_Request = ReplaceCommonPlaceholders(ls_Request)
        ' HERE WE CHECK THE DATA INTEGRITY (UNICITY)
        ' ll_Count indicates if the data already  exists
        lc_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
        ll_Count = mo_Db.RowCount(lc_Cursor)
        Call mo_Db.Close(lc_Cursor)
        
        If ll_Count > 0 Then
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_DetailConfig(al_DetailIndex).CheckAddUpdMsg(0, 0), mt_DetailConfig(al_DetailIndex).CheckAddUpdMsg(0, 1), , vbInformation + vbOKOnly)
            Exit Function
        End If
    End If
    Item_CheckAddDB = True
    Exit Function
ErrHandler:
    If lc_Cursor <> 0 Then Call mo_Db.Close(lc_Cursor)
    Call ErrorHandler("Item_CheckAddDB")
End Function

Private Function Item_AddDB(ByVal al_DetailIndex As Long) As Boolean
On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_Index As Long, ll_frameIndex As Long, ll_Count As Long
    Dim lb_inTransaction As Boolean
    
    Item_AddDB = False
    lb_inTransaction = False
    
    If Not Item_CheckAddDB(al_DetailIndex) Then Exit Function
    
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    
    'replace the holders (from the frame record)
    Call InitItemDetailKey(al_DetailIndex)
    
    'handle transaction
    If mt_DetailConfig(al_DetailIndex).UseTransaction Then
        Call mo_Tools.BeginTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_AddDB")
        lb_inTransaction = True
    End If
    
    ll_Count = UBound(mt_DetailConfig(al_DetailIndex).RequestAdd)
    For ll_Index = 0 To ll_Count
        'get the request from the ClassInfo
        ls_Request = mt_DetailConfig(al_DetailIndex).RequestAdd(ll_Index)
        If ls_Request <> "" Then
            ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_DetailItem(ll_frameIndex))
            ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
            ls_Request = ReplaceCommonPlaceholders(ls_Request)
            Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request, IIf(ll_Index = ll_Count, mt_DetailConfig(al_DetailIndex).AffectedCount(0), -1))
        End If
    Next
    
    If lb_inTransaction Then Call Item_CustomAddDB(al_DetailIndex, lb_inTransaction)
    
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If mt_SubdetailConfig(ll_Index).DetailConfigIndex = al_DetailIndex Then
            Call SaveSubDetailGrid(ll_Index)
        End If
    Next
    
    If lb_inTransaction Then
        Call mo_Tools.CommitTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_AddDB")
        lb_inTransaction = False
    End If
    
    Call Item_CustomAddDB(al_DetailIndex, lb_inTransaction)
    
    Item_AddDB = True
    Exit Function
    
ErrHandler:
    If lb_inTransaction Then
        Call mo_Tools.RollbackTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_AddDB")
    End If
    Call ErrorHandler("Item_AddDB")
End Function

Private Function Item_AddLocal(ByRef aControls As Variant, ByRef aContainer As Object, ByRef ao_Tree As ArmTreeView, ByRef ao_grid As ArmGrid, ByVal ab_Repositioning As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_MainIndex As Long, ll_DetailIndex As Long
Dim ll_MainFrame As Long, ll_DetailFrame As Long
Dim av_PathData As Variant
Dim ls_path As String
Dim lo_Node As Object

    Item_AddLocal = False
    'change the data locally
    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_MainFrame = mt_MainConfig(ll_MainIndex).FrameIndex
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    ll_DetailFrame = mt_DetailConfig(ll_DetailIndex).FrameIndex
    

    If mt_MainConfig(ll_MainIndex).CurrentTvwSelMethod = eTvwSelMethod.etmNone Then
        Call UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emAdd, False, "", False)
        Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emAdd)
        Item_AddLocal = True
        Exit Function
    End If
    ls_path = Trim(cbo_View(ll_MainFrame).SelectedItem.GetData(2))
    If ls_path = "" Then
        Call UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emAdd, False, "", False)
        Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emAdd)
        Item_AddLocal = True
        Exit Function
    End If
    av_PathData = GetCurrentPathData(UserControl.Controls, ls_path)
    If Not IsItemInFilter(ll_DetailIndex) Then
        Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emAdd)
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 7204, "#Updated item cannot be displayed with current filter")
        'Err.Raise 202, "Item_AddLocal", "Updated item cannot be displayed with current filter"
        Item_AddLocal = False
        Exit Function
    End If
    If IsItemSelectedInTree(ll_DetailIndex, tvw_Main(ll_MainFrame), av_PathData) Then
        ' item is in current filter do not need to reposition just update grid
        If UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emAdd, False, "", False) Then
            Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emAdd)
            Item_AddLocal = True
            Exit Function
        End If
    End If
    If ab_Repositioning And IsArray(av_PathData) Then
        Set lo_Node = FindInTreeView(ao_Tree, av_PathData, True, True)
        If Not (lo_Node Is Nothing) Then
            Call tvw_Main_NodeClick(CInt(ll_MainFrame), lo_Node)
            If mt_MainConfig(ll_MainIndex).GridDelayed Then
                If Not ao_grid.Execute Then
                    Err.Raise ArmErr.CompFncFailed, "grd_Main(" & ll_MainFrame & ").Execute", "Method Execute failed: " & ao_grid.Requests(0)
                End If
                 mt_MainConfig(ll_MainIndex).GridDelayed = False
            End If
            Call ao_grid.SearchKey(True, txt_DetailKey(ll_DetailFrame).Text)
        End If
    Else
        Set lo_Node = ao_Tree.SelectedItem
        Call FindInTreeView(ao_Tree, av_PathData, True, False)
        Set ao_Tree.SelectedItem = lo_Node
        'don't do anything, item is not added localy to tree because tree do not filter it
    End If
    Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emAdd)
    Item_AddLocal = True
    Exit Function
ErrHandler:
    Call ErrorHandler("Item_AddLocal")
End Function

Private Sub Item_UpdateInit(ByVal al_DetailIndex As Long, ByVal av_Key As Variant)
On Error GoTo ErrHandler

    Dim ll_frameIndex As Long
    
    If IsEmpty(av_Key) Then Exit Sub
    
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    
    If me_DetailMode <> emView Then
        Call InitDetailFrame(al_DetailIndex)
    End If
    
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_DetailItem(ll_frameIndex), True)
    
    Call DisableFrameParts(mt_DetailConfig(al_DetailIndex).ListFieldsToDisable)
        
    If me_DetailMode = emView Then
        ' do nothing, data are already in controls we are going from view to update
    ElseIf me_DetailMode = emUpdate Then
        ' ml_Cursor contain already loaded data, this means reinit, from update to update
        Call LoadFrameDataFromCursor(mo_Db, mc_Item, fra_DetailItem(ll_frameIndex))
        Call Item_CustomLoad(al_DetailIndex, av_Key)
        ' reload subgrid, this cannot be redo locally
        Call SubItem_Load(al_DetailIndex, av_Key)
    Else
        'clear the frame record and disable frames
        Call mo_Tools.ClearFrame(UserControl.Controls, fra_DetailItem(ll_frameIndex))
        Call Item_Load(al_DetailIndex, av_Key)
        Call SubItem_Load(al_DetailIndex, av_Key)
    End If
    
    Call SetDrivenDetailControls(Nothing)
    
    'Change screen mode
    Call SetMode(emUpdate, al_DetailIndex)
    
    Call Item_CustomInit(al_DetailIndex, av_Key, emUpdate)
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_UpdateInit")
End Sub

Private Function Item_Update(ByVal al_DetailIndex As Long) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Integer, ll_MainFrameIndex As Long
Dim ll_MainIndex As Long
    
    Item_Update = False
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    ll_MainIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    If ll_MainIndex <> -1 Then
        ll_MainFrameIndex = mt_MainConfig(ll_MainIndex).FrameIndex
    End If
    
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(mt_DetailConfig(al_DetailIndex).ListFieldsMandatory) Then Exit Function
    
    If Not Item_CheckValues(fra_DetailItem(ll_frameIndex)) Then Exit Function
        
    'check the custom data validity -> Item_CheckCustom
    If Not Item_CustomCheck(al_DetailIndex, eMode.emUpdate) Then Exit Function
    
    'update data on the db ->
    If Not Item_UpdateDB(al_DetailIndex) Then Exit Function
    'if success then update the data locally ->
    If ll_MainIndex <> -1 Then
        Call Item_UpdateLocal(UserControl.Controls, fra_DetailItem(ll_frameIndex), tvw_Main(ll_MainFrameIndex), grd_Main(ll_MainFrameIndex), chk_Repositioning(ll_frameIndex).Value = vbChecked)
    End If
    
    Call Item_CustomLocal(al_DetailIndex, eMode.emUpdate)
        
    If ll_MainIndex <> -1 Then
        'go back to the detail screen
        Call Item_ExitToGrid(ll_MainIndex, al_DetailIndex)
        Call SetMode(emList)
    Else
        ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
        mt_MainConfig(ll_MainIndex).CurrentDetailIndex = mt_DetailConfig(al_DetailIndex).PreviousDetailIndex
        Call SetMode(me_OldDetailMode)
    End If

    Item_Update = True
    Exit Function
ErrHandler:
    Call ErrorHandler("Item_Update")
End Function

Private Function Item_CheckUpdateDB(ByVal al_DetailIndex As Long) As Boolean
On Error GoTo ErrHandler

    'START Check unicity ************
    Dim ls_Request As String
    Dim lc_Cursor As Long
    Dim ll_Count As Long
    Dim ll_frameIndex As Long
    
    Item_CheckUpdateDB = False
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    ls_Request = mt_DetailConfig(al_DetailIndex).RequestCheckUpdate
    If ls_Request <> "" Then
        ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_DetailItem(ll_frameIndex))
        ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
        ls_Request = ReplaceCommonPlaceholders(ls_Request)
        lc_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
        
        ll_Count = mo_Db.RowCount(lc_Cursor)
        Call mo_Db.Close(lc_Cursor)
        
        If ll_Count > 0 Then
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_DetailConfig(al_DetailIndex).CheckAddUpdMsg(0, 0), mt_DetailConfig(al_DetailIndex).CheckAddUpdMsg(0, 1), , vbInformation + vbOKOnly)
            Exit Function
        End If
    End If
    'END Check unicity ************
    Item_CheckUpdateDB = True
    Exit Function
ErrHandler:
    Item_CheckUpdateDB = False
    If lc_Cursor <> 0 Then Call mo_Db.Close(lc_Cursor)
    Call ErrorHandler("Item_CheckUpdateDB")
End Function

Private Function Item_UpdateDB(ByVal al_DetailIndex As Long) As Boolean
On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_frameIndex As Long
    Dim ll_Index As Long, ll_Count As Long
    Dim lb_inTransaction As Boolean
    
    Item_UpdateDB = False
    
    lb_inTransaction = False
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    
    If Not Item_CheckUpdateDB(al_DetailIndex) Then Exit Function
    
    'handle transaction
    If mt_DetailConfig(al_DetailIndex).UseTransaction Then
        Call mo_Tools.BeginTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_UpdateDB")
        lb_inTransaction = True
    End If
    
    ll_Count = UBound(mt_DetailConfig(al_DetailIndex).RequestUpd)
    For ll_Index = 0 To ll_Count
        'get the request from the ClassInfo
        ls_Request = mt_DetailConfig(al_DetailIndex).RequestUpd(ll_Index)
        If ls_Request <> "" Then
        'replace the holders (from the frame record)
            ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_DetailItem(ll_frameIndex))
            ls_Request = ReplacePlaceHolder(ls_Request, "$iConcurrency$", mo_Db.GetFields(mc_Item, "iConcurrency"))
            ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
            ls_Request = ReplaceCommonPlaceholders(ls_Request)
            ' first sql request should affect just 1 row from main table, other may update linked tables - 0..N records
            Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request, IIf(ll_Index = 0, mt_DetailConfig(al_DetailIndex).AffectedCount(1), -1))
        End If
    Next
    
    If lb_inTransaction Then Call Item_CustomUpdateDB(al_DetailIndex, lb_inTransaction)
    
    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If mt_SubdetailConfig(ll_Index).DetailConfigIndex = al_DetailIndex Then
            Call SaveSubDetailGrid(ll_Index)
        End If
    Next
    
    If lb_inTransaction Then
        Call mo_Tools.CommitTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_UpdateDB")
        lb_inTransaction = False
    End If
    
    Call Item_CustomUpdateDB(al_DetailIndex, lb_inTransaction)
    
    Item_UpdateDB = True
    
    Exit Function
ErrHandler:
    Item_UpdateDB = False
    If lb_inTransaction Then
        Call mo_Tools.RollbackTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_UpdateDB")
    End If
    Call ErrorHandler("Item_UpdateDB")
End Function

Private Function Item_UpdateLocal(ByRef aControls As Variant, ByRef aContainer As Object, ByRef ao_Tree As ArmTreeView, ByRef ao_grid As ArmGrid, ByVal ab_Repositioning As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_MainIndex As Long, ll_DetailIndex As Long
Dim ll_MainFrame As Long, ll_DetailFrame As Long
Dim av_PathData As Variant
Dim ls_path As String
Dim lo_Node As Object

    Item_UpdateLocal = False
    'change the data locally
    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_MainFrame = mt_MainConfig(ll_MainIndex).FrameIndex
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    ll_DetailFrame = mt_DetailConfig(ll_DetailIndex).FrameIndex
    

    If mt_MainConfig(ll_MainIndex).CurrentTvwSelMethod = eTvwSelMethod.etmNone Then
        Call UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emUpdate, False, "", False)
        Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emUpdate)
        Item_UpdateLocal = True
        Exit Function
    End If
    
    ls_path = Trim(cbo_View(ll_MainFrame).SelectedItem.GetData(2))
    If ls_path = "" Then
        Call UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emUpdate, False, "", False)
        Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emUpdate)
        Item_UpdateLocal = True
        Exit Function
    End If
    av_PathData = GetCurrentPathData(UserControl.Controls, ls_path)
    If Not IsItemInFilter(ll_DetailIndex) Then
        Call UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emDelete, False, "", False)
        Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emUpdate)
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 7204, "Updated item cannot be displayed with current filter")
        Item_UpdateLocal = False
        Exit Function
    End If
    If IsItemSelectedInTree(ll_DetailIndex, tvw_Main(ll_MainFrame), av_PathData) Then
        ' item is in current filter do not need to reposition just update grid
        If UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emUpdate, False, "", False) Then
            Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emUpdate)
            Item_UpdateLocal = True
            Exit Function
        End If
    End If
    If ab_Repositioning And IsArray(av_PathData) Then
        Set lo_Node = FindInTreeView(ao_Tree, av_PathData, True, True)
        Call tvw_Main_NodeClick(CInt(ll_MainFrame), lo_Node)
        If mt_MainConfig(ll_MainIndex).GridDelayed Then
            If Not ao_grid.Execute Then
                Err.Raise ArmErr.CompFncFailed, "grd_Main(" & ll_MainFrame & ").Execute", "Method Execute failed: " & ao_grid.Requests(0)
            End If
             mt_MainConfig(ll_MainIndex).GridDelayed = False
        End If
        Call ao_grid.SearchKey(True, txt_DetailKey(ll_DetailFrame).Text)
    Else
        Set lo_Node = ao_Tree.SelectedItem
        Call FindInTreeView(ao_Tree, av_PathData, True, False)
        Set ao_Tree.SelectedItem = lo_Node
        ' do not reposition tree, just delete item from grid
        Call UpdateGridByFrame(ao_grid, fra_DetailItem(ll_DetailFrame), emDelete, False, "", False)
    End If
    Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), txt_DetailKey(ll_DetailFrame).Text, emUpdate)
    Item_UpdateLocal = True
    Exit Function
ErrHandler:
    Call ErrorHandler("Item_UpdateLocal")
End Function


Private Sub Item_DeleteInit(ByVal al_DetailIndex As Long, ByVal av_Key As Variant)
On Error GoTo ErrHandler

    If IsEmpty(av_Key) Then Exit Sub
    
    Dim ll_frameIndex As Integer
    
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    
    If me_DetailMode <> emView Then
        Call InitDetailFrame(al_DetailIndex)
    End If
    
    
    If me_DetailMode <> emView Then
        'clear the frame record and disable frames
        Call mo_Tools.ClearFrame(UserControl.Controls, fra_DetailItem(ll_frameIndex))
        Call Item_Load(al_DetailIndex, av_Key)
        Call SubItem_Load(al_DetailIndex, av_Key)
    End If
    
    If Not Item_CheckDeleteDB(al_DetailIndex) Then Exit Sub
    
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_DetailItem(ll_frameIndex), False)
        
    'change screen mode
    Call SetMode(emDelete)
    
    Call Item_CustomInit(al_DetailIndex, av_Key, emDelete)
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_DeleteInit")
End Sub

Private Function Item_Delete(ByVal al_DetailIndex As Long) As Boolean

On Error GoTo ErrHandler

    Dim ll_frameIndex As Long
    Dim ll_MainFrameIndex As Long
    Dim ll_MainIndex As Long
    
    Item_Delete = False
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    ll_MainIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    ll_MainFrameIndex = mt_MainConfig(ll_MainIndex).FrameIndex
    
    'check the custom data validity -> Item_CheckCustom
    If Not Item_CustomCheck(al_DetailIndex, eMode.emDelete) Then Exit Function
    
    'delete data on the db
    If Not Item_DeleteDB(al_DetailIndex) Then Exit Function
    
    'if success then delete the data locally ->
    Call Item_DeleteLocal(UserControl.Controls, fra_DetailItem(ll_frameIndex), tvw_Main(ll_MainFrameIndex), grd_Main(ll_MainFrameIndex), chk_Repositioning(ll_frameIndex).Value = vbChecked)
    Call Item_CustomLocal(al_DetailIndex, eMode.emDelete)
    
    If ll_MainIndex <> -1 Then
        'go back to the detail screen
        Call Item_ExitToGrid(ll_MainIndex, al_DetailIndex)
        Call SetMode(emList)
    Else
        ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
        mt_MainConfig(ll_MainIndex).CurrentDetailIndex = mt_DetailConfig(al_DetailIndex).PreviousDetailIndex
        Call SetMode(me_OldDetailMode)
    End If

    Item_Delete = True
    Exit Function
ErrHandler:
    Call ErrorHandler("Item_Delete")
End Function

Private Function Item_CheckDeleteDB(ByVal al_DetailConfigIndex As Long) As Boolean
On Error GoTo ErrHandler
    
    Dim ls_Request As String
    Dim lc_Cursor As Long
    Dim ll_Count As Long
    Dim ll_frameIndex As Long
    
    Item_CheckDeleteDB = False
    
    ll_frameIndex = mt_DetailConfig(al_DetailConfigIndex).FrameIndex
    ls_Request = mt_DetailConfig(al_DetailConfigIndex).RequestCheckDelete
    
    If ls_Request <> "" Then
        ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_DetailItem(ll_frameIndex))
        ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
        ls_Request = ReplaceCommonPlaceholders(ls_Request)
        ' THIS IS NOT AN ERROR
        ' WE CHECK IS USER IS ALLOWED TO DELETE THIS DATA
        ' A DATA CAN'T BE DELETE IF IT HAVE SOME DEPENDANCIES, LIKE ATTACHMENT
        ' Li_Count is the count of dependancies
        lc_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
        ll_Count = mo_Db.RowCount(lc_Cursor)
        Call mo_Db.Close(lc_Cursor)
        If ll_Count > 0 Then
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_DetailConfig(al_DetailConfigIndex).CheckDelMsg(0, 0), mt_DetailConfig(al_DetailConfigIndex).CheckDelMsg(0, 1), , vbInformation + vbOKOnly)
            Exit Function
        End If
    End If
    Item_CheckDeleteDB = True
    Exit Function
ErrHandler:
    If lc_Cursor <> 0 Then Call mo_Db.Close(lc_Cursor)
    Call ErrorHandler("Item_CheckDelete")
End Function

Private Function Item_DeleteDB(ByVal al_DetailIndex As Long) As Boolean

On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_frameIndex As Long, ll_Count As Long
    Dim ll_Index As Long
    Dim lb_inTransaction As Boolean
    
    Item_DeleteDB = False
    
    lb_inTransaction = False
    
    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex

    Call Item_CustomDeleteDB(al_DetailIndex, lb_inTransaction)
    
    'handle transaction
    If mt_DetailConfig(al_DetailIndex).UseTransaction Then
        Call mo_Tools.BeginTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_DeleteDB")
        lb_inTransaction = True
    End If

    If lb_inTransaction Then Call Item_CustomDeleteDB(al_DetailIndex, lb_inTransaction)
    
    ll_Count = UBound(mt_DetailConfig(al_DetailIndex).RequestDel)
    For ll_Index = 0 To ll_Count
    
        'get the request from the al_DetailIndex
        ls_Request = mt_DetailConfig(al_DetailIndex).RequestDel(ll_Index)
        'replace the holders (from the frame record)
        ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_DetailItem(ll_frameIndex))
        ls_Request = ReplacePlaceHolder(ls_Request, "$iConcurrency$", mo_Db.GetFields(mc_Item, "iConcurrency"))
        ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
        ls_Request = ReplaceCommonPlaceholders(ls_Request)
        ' last delete commant should delete (mark deleted) 1 row from main table, other sql request delete 0..N links
        Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request, IIf(ll_Index = ll_Count, mt_DetailConfig(al_DetailIndex).AffectedCount(2), -1))
    Next
    
    If lb_inTransaction Then
        Call mo_Tools.CommitTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_DeleteDB")
        lb_inTransaction = False
    End If
    
    Item_DeleteDB = True
    Exit Function
    
ErrHandler:
    Item_DeleteDB = False
    If lb_inTransaction Then
        Call mo_Tools.RollbackTran(mo_Db, ml_U_Code, SCREEN_NAME, "Item_DeleteDB")
    End If
    Call ErrorHandler("Item_DeleteDB")
End Function

Private Function Item_DeleteLocal(ByRef aControls As Variant, ByRef aContainer As Object, ByRef ao_Tree As ArmTreeView, ByVal ao_grid As ArmGrid, ByVal ab_Repositioning As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_MainIndex As Long, ll_DetailIndex As Long
Dim ll_MainFrame As Long, ll_DetailFrame As Long
Dim ls_Key As String

    'change the data locally
    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_MainFrame = mt_MainConfig(ll_MainIndex).FrameIndex
    ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainIndex)
    ll_DetailFrame = mt_DetailConfig(ll_DetailIndex).FrameIndex
    ls_Key = txt_DetailKey(ll_DetailFrame).Text
    
    Call UpdateLocalComboboxes(GetDetailKeyFieldName(ll_DetailIndex), ls_Key, emDelete)
    
    If Not ao_grid.DeleteSelectedLines Then
        Err.Raise ArmErr.CompFncFailed, "ao_grid", "DeleteSelectedLines failed"
    End If
    
    If Not ab_Repositioning Then
        Item_DeleteLocal = True
        Exit Function
    End If
    
    Item_DeleteLocal = True
    Exit Function
    
ErrHandler:
    Call ErrorHandler("Item_DeleteLocal")
End Function

Private Sub SubItem_Load(ByVal al_DetailIndex As Long, ByVal av_Key As Variant)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim lb_DelayedLoad As Boolean
Dim ls_req As String

    For ll_Index = 0 To UBound(mt_SubdetailConfig)
        If (mt_SubdetailConfig(ll_Index).DetailConfigIndex = al_DetailIndex) Then
        
            ReDim mt_SubdetailConfig(ll_Index).DeletedRows(-1 To -1)
            Call grd_SubDetail(ll_Index).ClearGrid
            lb_DelayedLoad = (mt_SubdetailConfig(ll_Index).GridDelayMethod = egmDelayedAlways)
            
            Call SubItem_CustomLoad(ll_Index)
            
            If (mt_SubdetailConfig(ll_Index).RequestView <> "") Then
                ls_req = mt_SubdetailConfig(ll_Index).RequestView
                ls_req = ReplaceKeyPlaceholders(ls_req, av_Key)
                ls_req = ReplaceLanguagePlaceholderFromToolbar(ls_req)
                ls_req = ReplaceCommonPlaceholders(ls_req)
                If Not grd_SubDetail(ll_Index).Load(ls_req, True, , , lb_DelayedLoad) Then
                    Err.Raise ArmErr.CompFncFailed, "grd_SubDetail(" & ll_Index & ").Load", "Grid load failed: " & ls_req
                End If
            End If
        End If
    Next
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("SubItem_Load")
End Sub

Private Sub SubItem_AddInit(ByVal al_SubDetaiIndex As Long)
On Error GoTo ErrHandler

    Dim ll_frameIndex As Integer
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetaiIndex).FrameIndex
   
    Call InitSubdetailFrame(al_SubDetaiIndex)
    
    'clear the frame record
    Call mo_Tools.ClearFrame(UserControl.Controls, fra_SubDetailItem(ll_frameIndex))
    
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_SubDetailItem(ll_frameIndex), True)
    
    Call DisableFrameParts(mt_SubdetailConfig(al_SubDetaiIndex).ListFieldsToDisable)
    'load default values
    Call SubItem_LoadDefaultValue(al_SubDetaiIndex, mt_SubdetailConfig(al_SubDetaiIndex).ListFieldsDefaultValue)
    
    'Change screen mode
    Call SetModeSubDetail(al_SubDetaiIndex, emAdd)
    
    Call SubItem_CustomInit(al_SubDetaiIndex, "", emAdd)
    Exit Sub
ErrHandler:
    Call ErrorHandler("SubItem_AddInit")
End Sub

Private Function SubItem_Add(ByVal al_SubDetailIndex As Long) As Boolean
On Error GoTo ErrHandler

Dim ll_frameIndex As Long
Dim lb_CustomSaved As Boolean
        
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
        'check the data validity -> Item_Check
    If Not Item_CheckMandatory(mt_SubdetailConfig(al_SubDetailIndex).ListFieldsMandatory) Then Exit Function
    
    If Not Item_CheckValues(fra_SubDetailItem(ll_frameIndex)) Then Exit Function
    
    If Not SubItem_CustomCheck(al_SubDetailIndex, eMode.emAdd) Then Exit Function
    
    If Not SubItem_CheckAddDB(al_SubDetailIndex) Then Exit Function
    
    If Not SubItem_CustomAdd(al_SubDetailIndex, lb_CustomSaved) Then Exit Function
    
   ' first check if some custom code for database update executed, if yes, then framework do not need to do action
    If Not lb_CustomSaved Then
        'update data on the db ->
        'If me_DetailMode = emUpdate Then
        '    If Not SubItem_AddDB(al_SubdetailIndex) Then Exit Function
        'End If
            
        If Not UpdateGridByFrame(grd_SubDetail(ll_frameIndex), fra_SubDetailItem(ll_frameIndex), emAdd, True, mt_SubdetailConfig(al_SubDetailIndex).TableOrder, True) Then Exit Function
    End If
    
    SubItem_Add = True
    
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_Add")
End Function

Private Function SubItem_CheckAddDB(ByVal al_SubDetailIndex As Long) As Boolean
On Error GoTo ErrHandler
    Dim ls_Request As String
    Dim lc_Cursor As Long, ll_frameIndex As Long, ll_DetailFrameIndex As Long
    Dim ll_Count As Integer
    
    SubItem_CheckAddDB = False
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailFrameIndex = mt_DetailConfig(mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex).FrameIndex
    ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestCheckAdd
    If ls_Request <> "" Then
        ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrameIndex))
        ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_SubDetailItem(ll_frameIndex))
        ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
        ls_Request = ReplaceCommonPlaceholders(ls_Request)
        
        ' HERE WE CHECK THE DATA INTEGRITY (UNICITY)
        ' li_Count indicates if the data already  exists
        lc_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
        ll_Count = mo_Db.RowCount(lc_Cursor)
        Call mo_Db.Close(lc_Cursor)
        
        If ll_Count > 0 Then
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_SubdetailConfig(al_SubDetailIndex).CheckAddUpdMsg(0, 0), mt_SubdetailConfig(al_SubDetailIndex).CheckAddUpdMsg(0, 1), , vbInformation + vbOKOnly)
            Exit Function
        End If
    End If
    SubItem_CheckAddDB = SubItem_CustomCheckDB(al_SubDetailIndex, emAdd)
    Exit Function
ErrHandler:
    If lc_Cursor <> 0 Then Call mo_Db.Close(lc_Cursor)
    Call ErrorHandler("SubItem_CheckAddDB")
End Function

Private Function SubItem_AddDB(ByVal al_SubDetailIndex As Long, ByVal al_RowIndex As Long) As Boolean
On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_frameIndex As Long, ll_DetailFrameIndex As Long
    Dim lb_CustomSaved As Boolean
    
    SubItem_AddDB = False
        
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailFrameIndex = mt_DetailConfig(mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex).FrameIndex
    
    If mt_SubdetailConfig(al_SubDetailIndex).TableName <> "" Then
        txt_SubDetailKey(ll_frameIndex).Text = mo_Tools.GetNextID(mo_Db, mt_SubdetailConfig(al_SubDetailIndex).TableName)
    Else
        txt_SubDetailKey(ll_frameIndex).Text = ""
    End If
    
    
    lb_CustomSaved = False
    If Not SubItem_CustomDBBefore(al_SubDetailIndex, emAdd, al_RowIndex, lb_CustomSaved) Then Exit Function
    
    If Not lb_CustomSaved Then
        'get the request from the ClassInfo
        ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestAdd
        
        If ls_Request <> "" Then
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrameIndex))
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_SubDetailKey(ll_frameIndex))
            If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_GroupParam" Then
                ls_Request = ReplaceRequestByGridData2(grd_SubDetail(ll_frameIndex), ls_Request, al_RowIndex, mt_SubdetailConfig(al_SubDetailIndex).TableName)
            Else
                ls_Request = ReplaceRequestByGridData(grd_SubDetail(ll_frameIndex), ls_Request, al_RowIndex, mt_SubdetailConfig(al_SubDetailIndex).TableName)
            End If
            ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
            ls_Request = ReplaceCommonPlaceholders(ls_Request)
            Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request)
            grd_SubDetail(ll_frameIndex).Data(al_RowIndex, "iConcurrency") = 1
            grd_SubDetail(ll_frameIndex).Data(al_RowIndex, STATUS_COLUMN) = ""    ' reset status flag
        End If
        If Not SubItem_CustomDBAfter(al_SubDetailIndex, emAdd, al_RowIndex, lb_CustomSaved) Then Exit Function
    End If
    
    SubItem_AddDB = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_AddDB")
End Function

Private Sub SubItem_UpdateInit(ByVal al_SubDetailIndex As Long)
On Error GoTo ErrHandler
    
    Dim ll_frameIndex As Long
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex

    If grd_SubDetail(ll_frameIndex).SelectedCount <> 1 Then Exit Sub
    
    Call InitSubdetailFrame(al_SubDetailIndex)
        
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_SubDetailItem(ll_frameIndex), True)
    
    Call DisableFrameParts(mt_SubdetailConfig(al_SubDetailIndex).ListFieldsToDisable)
        
    'clear the frame record and disable frames
    Call mo_Tools.ClearFrame(UserControl.Controls, fra_SubDetailItem(ll_frameIndex))
    
    Call LoadFrameDataFromGrid(grd_SubDetail(ll_frameIndex), fra_SubDetailItem(ll_frameIndex))
    
    'Change screen mode
    Call SetModeSubDetail(al_SubDetailIndex, emUpdate)
    
    Call SubItem_CustomInit(al_SubDetailIndex, "", emUpdate)
    Exit Sub
ErrHandler:
    Call ErrorHandler("Subitem_UpdateInit")
End Sub

Private Function SubItem_Update(ByVal al_SubDetailIndex As Long) As Boolean
On Error GoTo ErrHandler
    
    Dim ll_frameIndex As Long
    Dim lb_CustomSaved As Boolean
    
    SubItem_Update = False
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    
    'check the data validity -> Item_Check
    If Not Item_CheckMandatory(mt_SubdetailConfig(al_SubDetailIndex).ListFieldsMandatory) Then Exit Function
    
    If Not Item_CheckValues(fra_SubDetailItem(ll_frameIndex)) Then Exit Function
    
    If Not SubItem_CustomCheck(al_SubDetailIndex, eMode.emUpdate) Then Exit Function
    
    If Not SubItem_CheckUpdateDB(al_SubDetailIndex) Then Exit Function
    
    If Not SubItem_CustomUpdate(al_SubDetailIndex, lb_CustomSaved) Then Exit Function
    
    If Not lb_CustomSaved Then
        'If me_DetailMode = emUpdate Then
            'update data on the db ->
        '    If Not SubItem_UpdateDB(al_SubdetailIndex) Then Exit Function
        'End If
        
        'if success then Add the data locally ->
        If Not UpdateGridByFrame(grd_SubDetail(ll_frameIndex), fra_SubDetailItem(ll_frameIndex), emUpdate, True, mt_SubdetailConfig(al_SubDetailIndex).TableOrder, True) Then Exit Function
    End If
   
    SubItem_Update = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_Update")
End Function

Private Function SubItem_CheckUpdateDB(ByVal al_SubDetailIndex As Long) As Boolean
On Error GoTo ErrHandler
    Dim ls_Request As String
    Dim lc_Cursor As Long, ll_frameIndex As Long, ll_DetailFrameIndex As Long
    Dim ll_Count As Long
    
    SubItem_CheckUpdateDB = False
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailFrameIndex = mt_DetailConfig(mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex).FrameIndex
    ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestCheckUpdate
    If ls_Request <> "" Then
        ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrameIndex))
        ls_Request = mo_Tools.ReplaceRequestByFrameData(ls_Request, UserControl.Controls, fra_SubDetailItem(ll_frameIndex))
        ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
        ls_Request = ReplaceCommonPlaceholders(ls_Request)
        lc_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
        
        ll_Count = mo_Db.RowCount(lc_Cursor)
        Call mo_Db.Close(lc_Cursor)
        
        If (ll_Count > 0) Then
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_SubdetailConfig(al_SubDetailIndex).CheckAddUpdMsg(0, 0), mt_SubdetailConfig(al_SubDetailIndex).CheckAddUpdMsg(0, 1), , vbInformation + vbOKOnly)
            Exit Function
        End If
    End If
    SubItem_CheckUpdateDB = SubItem_CustomCheckDB(al_SubDetailIndex, emUpdate)
    Exit Function
ErrHandler:
    If lc_Cursor <> 0 Then Call mo_Db.Close(lc_Cursor)
    Call ErrorHandler("SubItem_CheckUpdateDB")
End Function

Private Function SubItem_UpdateDB(ByVal al_SubDetailIndex As Long, ByVal al_RowIndex As Long) As Boolean
On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_frameIndex As Long, ll_DetailFrameIndex As Long
    Dim lb_CustomSaved As Boolean
    
    SubItem_UpdateDB = False
            
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailFrameIndex = mt_DetailConfig(mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex).FrameIndex
    
    lb_CustomSaved = False
    If Not SubItem_CustomDBBefore(al_SubDetailIndex, emUpdate, al_RowIndex, lb_CustomSaved) Then Exit Function
    If Not lb_CustomSaved Then
        'get the request from the ClassInfo
        ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestUpd
        If ls_Request <> "" Then
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrameIndex))
            If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_GroupParam" Or _
                mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "Cap_OfferGenTerm" Then
                ls_Request = ReplaceRequestByGridData2(grd_SubDetail(ll_frameIndex), ls_Request, al_RowIndex, mt_SubdetailConfig(al_SubDetailIndex).TableName)
            Else
                ls_Request = ReplaceRequestByGridData(grd_SubDetail(ll_frameIndex), ls_Request, al_RowIndex, mt_SubdetailConfig(al_SubDetailIndex).TableName)
            End If
            ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
            ls_Request = ReplaceCommonPlaceholders(ls_Request)
            Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request, 1)
            grd_SubDetail(ll_frameIndex).Data(al_RowIndex, "iConcurrency") = Val(grd_SubDetail(ll_frameIndex).Data(al_RowIndex, "iConcurrency")) + 1
            grd_SubDetail(ll_frameIndex).Data(al_RowIndex, STATUS_COLUMN) = ""    ' reset status flag
        End If
        If Not SubItem_CustomDBAfter(al_SubDetailIndex, emUpdate, al_RowIndex, lb_CustomSaved) Then Exit Function
    End If
    
    SubItem_UpdateDB = True
    Exit Function
ErrHandler:
    SubItem_UpdateDB = False
    Call ErrorHandler("SubItem_UpdateDB")
End Function

Private Sub SubItem_DeleteInit(ByVal al_SubDetailIndex As Long)
On Error GoTo ErrHandler

    Dim ll_frameIndex As Long
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex

    If grd_SubDetail(ll_frameIndex).SelectedCount <> 1 Then Exit Sub
    
    If Not SubItem_CheckDeleteDB(al_SubDetailIndex) Then Exit Sub
    
    'clear the frame record and disable frames
    Call mo_Tools.ClearFrame(UserControl.Controls, fra_SubDetailItem(ll_frameIndex))
    
            
    Call InitSubdetailFrame(al_SubDetailIndex)
        
    Call LoadFrameDataFromGrid(grd_SubDetail(ll_frameIndex), fra_SubDetailItem(ll_frameIndex))
    
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_SubDetailItem(ll_frameIndex), False)
    
    'change screen mode
    Call SetModeSubDetail(al_SubDetailIndex, emDelete)
    
    Call SubItem_CustomInit(al_SubDetailIndex, "", emDelete)
    Exit Sub
ErrHandler:
    Call ErrorHandler("SubItem_DeleteInit")
End Sub

Private Function SubItem_Delete(ByVal al_SubDetailIndex As Long) As Boolean

On Error GoTo ErrHandler

    Dim ll_frameIndex As Long
    Dim lb_CustomSaved As Boolean
    
    SubItem_Delete = False
    'TODO: disable subdetail grid when in add,update,delete mode
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    If grd_SubDetail(ll_frameIndex).SelectedCount = 0 Then Exit Function
    
    If Not SubItem_CustomCheck(al_SubDetailIndex, eMode.emDelete) Then Exit Function
    
    If Not SubItem_CustomDelete(al_SubDetailIndex, lb_CustomSaved) Then Exit Function
    
    If Not lb_CustomSaved Then
        'delete data on the db
        'If me_DetailMode = emUpdate Then
        '    If Not SubItem_DeleteDB(al_SubdetailIndex) Then Exit Function
        'End If
        
        'if success then delete the data locally ->
        If Not UpdateGridByFrame(grd_SubDetail(ll_frameIndex), fra_SubDetailItem(ll_frameIndex), emDelete, False, mt_SubdetailConfig(al_SubDetailIndex).TableOrder, True) Then Exit Function
        
    End If
    
    SubItem_Delete = True
    Exit Function
ErrHandler:
    Call ErrorHandler("SubItem_Delete")
End Function

Private Function SubItem_CheckDeleteDB(ByVal al_SubDetailIndex As Long) As Boolean
On Error GoTo ErrHandler
    
    Dim ls_Request As String
    Dim lc_Cursor As Long
    Dim ll_Count As Long, ll_frameIndex As Long
    
    SubItem_CheckDeleteDB = False
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestCheckDelete
    If ls_Request <> "" Then
        ls_Request = ReplaceRequestByGridData(grd_SubDetail(ll_frameIndex), ls_Request, grd_SubDetail(ll_frameIndex).Row, mt_SubdetailConfig(al_SubDetailIndex).TableName)
        ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
        ls_Request = ReplaceCommonPlaceholders(ls_Request)
        ' THIS IS NOT AN ERROR
        ' WE CHECK IS USER IS ALLOWED TO DELETE THIS DATA
        ' A DATA CAN'T BE DELETE IF IT HAVE SOME DEPENDANCIES
        ' ll_Count is the count of dependancies
        lc_Cursor = mo_Tools.OpenSQLSafe(mo_Db, ls_Request)
        ll_Count = mo_Db.RowCount(lc_Cursor)
        Call mo_Db.Close(lc_Cursor)
        If ll_Count > 0 Then
            Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, mt_SubdetailConfig(al_SubDetailIndex).CheckDelMsg(0, 0), mt_SubdetailConfig(al_SubDetailIndex).CheckDelMsg(0, 1), , vbInformation + vbOKOnly)
            Exit Function
        End If
    End If
    SubItem_CheckDeleteDB = SubItem_CustomCheckDB(al_SubDetailIndex, emDelete)
    Exit Function
ErrHandler:
    If lc_Cursor <> 0 Then Call mo_Db.Close(lc_Cursor)
    Call ErrorHandler("SubItem_CheckDeleteDB")
End Function

Private Function SubItem_DeleteDB(ByVal al_SubDetailIndex As Long, ByVal al_RowIndex As Long) As Boolean

On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_frameIndex As Long, ll_DetailFrameIndex As Long
    Dim lb_CustomSaved As Boolean
    Dim ll_KeyIdx As Long
       
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailFrameIndex = mt_DetailConfig(mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex).FrameIndex
    
    lb_CustomSaved = False
    If Not SubItem_CustomDBBefore(al_SubDetailIndex, emDelete, al_RowIndex, lb_CustomSaved) Then Exit Function
    If Not lb_CustomSaved Then
        'get the request from the ClassInfo
        ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestDel
        If ls_Request <> "" Then
            'replace the holders (from the frame record)
            ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrameIndex))
            ls_Request = ReplaceRequestByGridStoredData(grd_SubDetail(ll_frameIndex), mt_SubdetailConfig(al_SubDetailIndex).DeletedRows, ls_Request, al_RowIndex, mt_SubdetailConfig(al_SubDetailIndex).TableName)
            ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
            ls_Request = ReplaceCommonPlaceholders(ls_Request)
            Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request, 1)
        End If
        If Not SubItem_CustomDBAfter(al_SubDetailIndex, emDelete, al_RowIndex, lb_CustomSaved) Then Exit Function
    End If
    SubItem_DeleteDB = True
    
    Exit Function
ErrHandler:
    SubItem_DeleteDB = False
    Call ErrorHandler("SubItem_DeleteDB")
End Function

Private Function GetDetailKeyFieldName(ByVal al_DetailIndex As Long) As String
On Error GoTo ErrHandler

Dim ll_MainIndex As Long
Dim ll_MainFrameIndex As Long
Dim ll_Idx As Long

    GetDetailKeyFieldName = ""
    ll_MainIndex = mt_DetailConfig(al_DetailIndex).MainConfigIndex
    ll_MainFrameIndex = mt_MainConfig(ll_MainIndex).FrameIndex
    For ll_Idx = 0 To grd_Main(ll_MainFrameIndex).Cols - 1
        If grd_Main(ll_MainFrameIndex).Columns(ll_Idx).Key Then
            GetDetailKeyFieldName = grd_Main(ll_MainFrameIndex).Columns(ll_Idx).FieldName
            Exit Function
        End If
    Next
    Exit Function
ErrHandler:
    Call ErrorHandler("GetDetailKeyFieldName")
End Function

Private Function DeleteNode(ByRef ao_TreeView As ArmTreeView, ByRef ao_Node As Node) As Node
On Error GoTo ErrHandler

    Dim lo_Node As Node, lo_parentNode As Node, lo_PreviousNode As Node

    Set lo_Node = ao_Node
    
    While Not lo_Node Is Nothing
        Call lo_Node.Tag.SetData(3, Val(lo_Node.Tag.GetData(3)) - 1)
        Set lo_Node = lo_Node.Parent
    Wend
    
    Set lo_Node = ao_Node
    Do While (lo_Node.Tag.GetData(3) = 0)
        Set lo_parentNode = lo_Node.Parent
        Set lo_PreviousNode = lo_Node.Previous
        Call ao_TreeView.RemoveNode(lo_Node)
        Set lo_Node = lo_parentNode
        If lo_Node Is Nothing Then Exit Do
    Loop
    Set ao_Node = Nothing

    Set DeleteNode = IIf(lo_parentNode Is Nothing, lo_PreviousNode, lo_parentNode)
    Exit Function
    
ErrHandler:
    If (Not lo_Node Is Nothing) Then Set lo_Node = Nothing
    If (Not lo_parentNode Is Nothing) Then Set lo_parentNode = Nothing
    If (Not lo_PreviousNode Is Nothing) Then Set lo_PreviousNode = Nothing
    Call ErrorHandler("DeleteNode")

End Function

'to check if updated or added item conform filter
'(there is no filter at this time but it is prepared)
Private Function IsItemInFilter(ByVal al_DetailIndex As Long) As Boolean
On Error GoTo ErrHandler

Dim lb_CheckDone As Boolean

    IsItemInFilter = IsItemInFilterCustom(al_DetailIndex, lb_CheckDone)
    If lb_CheckDone Then Exit Function
    
    IsItemInFilter = True
    Exit Function
ErrHandler:
    Call ErrorHandler("IsItemInFilter")
End Function

Private Sub Item_ExitToGrid(ByVal al_MainIndex As Long, ByVal al_DetailIndex As Long)
On Error GoTo ErrHandler
    
    If mc_Item > 0 Then
        Call mo_Db.Close(mc_Item)
        mc_Item = 0
    End If
    Call UpdateMainToolbarCustom(al_MainIndex)
    Exit Sub

ErrHandler:
    Call ErrorHandler("Item_ExitToGrid")
   
End Sub

Private Sub GotoPreviousItem(ByVal al_DetailIndex As Long, ByRef ao_grid As ArmGrid)
On Error GoTo ErrHandler
    
    If ao_grid.PreviousItem Then
        Call UpdateDetailToolbarCustom(al_DetailIndex)
    Else
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 927, "#No more previous item", , vbInformation)
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("GotoPreviousItem")
End Sub

Private Sub GotoNextItem(ByVal al_DetailIndex As Long, ByRef ao_grid As ArmGrid)
On Error GoTo ErrHandler

    If ao_grid.NextItem Then
        Call UpdateDetailToolbarCustom(al_DetailIndex)
    Else
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 928, "#No more next item", , vbInformation)
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("GotoNextItem")
End Sub

Private Sub Controls_LoadDefaultValue(ByRef av_ListFieldsDefaultValue As Variant)
On Error GoTo ErrHandler

    Dim ll_Idx As Long, ll_Count As Long
    Dim lv_Params As Variant
    Dim lo_Control As Object
    Dim ls_Value As String

    ll_Count = UBound(av_ListFieldsDefaultValue)

    For ll_Idx = 0 To ll_Count
            Set lo_Control = av_ListFieldsDefaultValue(ll_Idx)(0)
            Select Case UCase(TypeName(lo_Control))
                Case "FRAME", "LABEL", "MSFLEXGRID", "TOOLBARCONTROL"
                    ' Do nothing !
                Case "TEXTBOX"
                    lo_Control.Text = av_ListFieldsDefaultValue(ll_Idx)(1)
                Case "A_CALOCX"
                    ls_Value = av_ListFieldsDefaultValue(ll_Idx)(1)
                    If StrComp(ls_Value, "Date") = 0 Then
                        lo_Control.date_courte = Format(Date, "dd\/mm\/yyyy")
                    ElseIf StrComp(Left(ls_Value, 5), "Date+") = 0 Then
                        lo_Control.date_courte = Format(Date + CLng(Mid(ls_Value, 6)), "dd\/mm\/yyyy")
                    ElseIf StrComp(Left(ls_Value, 5), "Date-") = 0 Then
                        lo_Control.date_courte = Format(Date - CLng(Mid(ls_Value, 6)), "dd\/mm\/yyyy")
                    Else
                        lo_Control.date_courte = ls_Value
                    End If
                Case "ARMGRID", "ARMCHECKVIEW", "COMMANDBUTTON", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "TABSTRIP"
                
                Case "OPTIONBUTTON", "CHECKBOX"
                    lo_Control.Value = av_ListFieldsDefaultValue(ll_Idx)(1)
                Case "ARMCOMBOBOX"
                    lv_Params = Split(av_ListFieldsDefaultValue(ll_Idx)(1), SEP)
                    If Not lo_Control.SearchItem(lv_Params(0)) Then
                        If UBound(lv_Params) >= 1 Then
                            Call lo_Control.AddItem(Array(lv_Params(0), lv_Params(1)))
                        Else
                            Call lo_Control.Load ' load only once and remember found default value. Do not use any hardcoded default value
                            If lo_Control.SearchItem(lv_Params(0)) Then
                                av_ListFieldsDefaultValue(ll_Idx)(1) = lv_Params(0) & SEP & lo_Control.Text
                            End If
                        End If
                    End If
                Case "ARMPICKER"
                    lv_Params = Split(av_ListFieldsDefaultValue(ll_Idx)(1), SEP)
                    lo_Control.ItemCode = lv_Params(0)
                    If UBound(lv_Params) >= 1 Then
                        lo_Control.ItemDescription = lv_Params(1)
                    End If
                                    
                Case Else
                    Debug.Print "Controls_LoadDefaultValue " & UCase(TypeName(lo_Control))
            End Select
    Next
    Set lo_Control = Nothing
    Exit Sub
ErrHandler:
    Call ErrorHandler("Controls_LoadDefaultValue")
End Sub

Private Sub Item_LoadDefaultValue(ByVal al_DetailIndex As Long, ByRef av_ListFieldsDefaultValue As Variant)
On Error GoTo ErrHandler

    Call Controls_LoadDefaultValue(av_ListFieldsDefaultValue)
    Call Item_CustomLoadDefaultValue(al_DetailIndex, av_ListFieldsDefaultValue)
    Exit Sub
ErrHandler:
    Call ErrorHandler("Item_LoadDefaultValue")
End Sub

Private Sub SubItem_LoadDefaultValue(ByVal al_SubDetailIndex As Long, ByRef av_ListFieldsDefaultValue As Variant)
On Error GoTo ErrHandler

    Call Controls_LoadDefaultValue(av_ListFieldsDefaultValue)
    Call SubItem_CustomLoadDefaultValue(al_SubDetailIndex, av_ListFieldsDefaultValue)
    Exit Sub
ErrHandler:
    Call ErrorHandler("SubItem_LoadDefaultValue")
End Sub

Private Function GetTreeViewInfo(ByRef aTVInfos() As TTreeViewInfo, ByVal AScreenName As String, ByVal aTVCode As String) As TTreeViewInfo
On Error GoTo ErrHandler
    Dim lIdx As Long, lCount As Long
    Dim lTreeView As TTreeViewInfo, lFound As Boolean
    
    ' Search in the array
    lCount = UBound(aTVInfos)
    lFound = False
    For lIdx = 0 To lCount
        If aTVInfos(lIdx).TreeViewCode = aTVCode Then
            If Not aTVInfos(lIdx).Loaded Then
                aTVInfos(lIdx) = GetTreeViewInfoFromDB(AScreenName, aTVCode)
            End If
            lTreeView = aTVInfos(lIdx)
            lFound = True
            Exit For
        End If
    Next
    
    If Not lFound Then
        Call Err.Raise(ArmErr.InvalidArgument, "TreeviewInfo", "TreeViewInfo not found. AScreenName=" & AScreenName & " aTVCode=" & aTVCode)
    End If
    
    GetTreeViewInfo = lTreeView
    Exit Function
ErrHandler:
    Call ErrorHandler("GetTreeViewInfo")

End Function

Private Function ApplyTVFilters(ByVal al_MainIndex As Long, ByVal av_Request As Variant) As Variant
On Error GoTo ErrHandler
    Dim lv_Requests As Variant
    
    If IsArray(av_Request) Then
        ReDim lv_Requests(UBound(av_Request))
        Dim ll_Idx As Long, ll_Count As Long
        ll_Count = UBound(lv_Requests)
        For ll_Idx = 0 To ll_Count
            lv_Requests(ll_Idx) = ReplaceFiltersHolders(al_MainIndex, av_Request(ll_Idx))
            lv_Requests(ll_Idx) = ReplaceTreeviewHolders(al_MainIndex, lv_Requests(ll_Idx))
            lv_Requests(ll_Idx) = ReplaceLanguagePlaceholderFromToolbar(lv_Requests(ll_Idx))
            lv_Requests(ll_Idx) = ReplaceCommonPlaceholders(lv_Requests(ll_Idx))
        Next
    Else
        ReDim lv_Requests(0)
        lv_Requests(0) = ReplaceFiltersHolders(al_MainIndex, av_Request)
        lv_Requests(0) = ReplaceTreeviewHolders(al_MainIndex, lv_Requests(0))
        lv_Requests(0) = ReplaceLanguagePlaceholderFromToolbar(lv_Requests(0))
        lv_Requests(0) = ReplaceCommonPlaceholders(lv_Requests(0))
    End If

    ApplyTVFilters = lv_Requests
    Exit Function
ErrHandler:
    Call ErrorHandler("ApplyTVFilters")
End Function

Private Function ApplyFilters(ByVal al_MainIndex As Long, ByVal as_Request As String) As Variant
On Error GoTo ErrHandler
    Dim lv_Requests As Variant
    
    ReDim lv_Requests(0)
    lv_Requests(0) = ReplaceFiltersHolders(al_MainIndex, as_Request)
    lv_Requests(0) = ReplaceLanguagePlaceholderFromToolbar(lv_Requests(0))
    lv_Requests(0) = ReplaceCommonPlaceholders(lv_Requests(0))
    ApplyFilters = lv_Requests
    Exit Function
ErrHandler:
    Call ErrorHandler("ApplyFilters")
End Function

Private Function ReplaceFiltersHolders(ByVal al_MainIndex As Long, ByVal as_Request As String) As String
On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_frameIndex As Long

    ll_frameIndex = mt_MainConfig(al_MainIndex).FrameIndex
    ls_Request = mo_Tools.ReplaceRequestByFrameData(as_Request, UserControl.Controls, fra_MainFilter(ll_frameIndex))
    ReplaceFiltersHolders = ls_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceFiltersHolders")
End Function

Private Function ReplaceTreeviewHolders(ByVal al_MainIndex As Long, ByVal as_Request As String) As String
On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim ll_frameIndex As Long

    ll_frameIndex = mt_MainConfig(al_MainIndex).FrameIndex
    ls_Request = mo_Tools.ReplacePlaceholderByControlValue(as_Request, tbs_MainTabFilter(ll_frameIndex))
    ReplaceTreeviewHolders = ls_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceTreeviewHolders")
End Function

Private Sub ReloadMainGrid()
On Error GoTo ErrHandler

Dim ll_frameIndex As Long, ll_MainConfigIndex As Long

    ll_MainConfigIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_frameIndex = mt_MainConfig(ll_MainConfigIndex).FrameIndex
    
    
    If mt_MainConfig(ll_MainConfigIndex).CurrentTvwSelMethod = eTvwSelMethod.etmNone Then
        grd_Main(ll_frameIndex).Requests = ApplyFilters(ll_MainConfigIndex, mt_MainConfig(ll_MainConfigIndex).RequestGrid)
    Else
        If tvw_Main(ll_frameIndex).Checkboxes = True Then
            grd_Main(ll_frameIndex).Requests = ApplyTVFilters(ll_MainConfigIndex, tvw_Main(ll_frameIndex).CheckedNodesRequests)
        Else
            grd_Main(ll_frameIndex).Requests = ApplyTVFilters(ll_MainConfigIndex, tvw_Main(ll_frameIndex).SelectedNodeRequest)
        End If
        
        mt_MainConfig(ll_frameIndex).CurrentTvwSelMethod = IIf(tvw_Main(ll_frameIndex).Checkboxes, eTvwSelMethod.etmCheckBoxes, eTvwSelMethod.etmBranch)
    End If
    
    If grd_Main(ll_frameIndex).Cols = 0 Then
        Dim ll_DetailIndex As Long
        ll_DetailIndex = FindDetailConfigByMainConfig(ll_MainConfigIndex)
        If Not grd_Main(ll_frameIndex).SetColumns(mt_DetailConfig(ll_DetailIndex).MainGridColumns) Then
            Err.Raise ArmErr.CompFncFailed, "grd_Main", "Method SetColumns failed."
        End If
        Call mo_Tools.LoadLabelsCursor(mo_Db, mc_ScreenLabels, UserControl.Controls, fra_MainItem(ll_frameIndex), SCREEN_NAME, ms_Language_Code)
    End If
    
    If grd_Main(ll_frameIndex).Execute = False Then
        Err.Raise ArmErr.CompFncFailed, "grd_Main(" & ll_frameIndex & ").Execute", "Load grid failed"
    End If
    grd_Main(ll_frameIndex).Visible = True
    Call UpdateMainToolbarCustom(ll_MainConfigIndex)
    Exit Sub
ErrHandler:
    Call ErrorHandler("ReloadMainGrid")
    
End Sub

Private Sub ReloadMainTreeview()
On Error GoTo ErrHandler
    
    mb_InternalInit = True
    Dim lb_Grid As Boolean
    Dim ll_frameIndex As Long, ll_MainConfigIndex As Long

    ll_MainConfigIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_frameIndex = mt_MainConfig(ll_MainConfigIndex).FrameIndex
   
    If mt_MainConfig(ll_MainConfigIndex).CurrentTvwSelMethod <> eTvwSelMethod.etmNone Then
        tvw_Main(ll_frameIndex).Refresh
    End If
    Call ReloadMainGrid
    
    mb_InternalInit = False
    
    Exit Sub
ErrHandler:
    mb_InternalInit = False
    Call ErrorHandler("ReloadMainTreeview")
End Sub

Public Sub AddDroppedCheckItems(ByRef ao_chkview As ArmCheckView)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim ll_Count As Long
Dim lo_ItemInfo As ArmItemInfo

    ll_Count = ao_chkview.RoleList("VIEW").Count
    For ll_Index = 1 To ll_Count
        If ao_chkview.RoleList("EDIT").GetItem(ao_chkview.RoleList("VIEW").GetKey(ll_Index)) Is Nothing Then
            Set lo_ItemInfo = ao_chkview.RoleList("VIEW").Items(ll_Index)
            Call ao_chkview.RoleList("EDIT").AddItemInfo(Array(lo_ItemInfo.GetData(0), lo_ItemInfo.GetData(1), 1), True, True)
        End If
    Next
    Call ao_chkview.RoleList("EDIT").DisplayList
    Exit Sub
ErrHandler:
    Call ErrorHandler("AddDroppedCheckItems")
End Sub

Public Sub RemoveDroppedCheckItems(ByRef ao_chkview As ArmCheckView)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim ll_Count As Long
Dim lo_ItemInfo As ArmItemInfo

    ll_Count = ao_chkview.RoleList("EDIT").Count
    For ll_Index = ll_Count To 1 Step -1
        Set lo_ItemInfo = ao_chkview.RoleList("EDIT").Items(ll_Index)
        If UBound(lo_ItemInfo.Data) > 1 Then
            Call ao_chkview.RoleList("EDIT").Items.Remove(ll_Index)
        End If
        Set lo_ItemInfo = Nothing
    Next
    Call ao_chkview.RoleList("EDIT").DisplayList
    Exit Sub
ErrHandler:
    Call ErrorHandler("RemoveDroppedCheckItems")
End Sub

Private Sub LoadListView(ByVal ao_Listview As MSComctlLib.ListView, ByVal as_Request As String)
On Error GoTo ErrHandler

Dim ll_Cursor As Long
Dim lo_item As MSComctlLib.ListItem
Dim lo_SubItem As MSComctlLib.ListSubItem
Dim ll_Index As Long

    Call ao_Listview.ListItems.Clear
    ll_Cursor = mo_Db.OpenSQL(as_Request)
    If ll_Cursor > 0 Then
        While Not mo_Db.EOF(ll_Cursor)
            Set lo_item = ao_Listview.ListItems.Add(, "KEY" & mo_Db.GetFields(ll_Cursor, 0), mo_Db.GetFields(ll_Cursor, 1))
            If mo_Db.FieldCount(ll_Cursor) > 2 Then
                For ll_Index = 2 To mo_Db.FieldCount(ll_Cursor) - 1
                    Set lo_SubItem = lo_item.ListSubItems.Add(, , mo_Db.GetFields(ll_Cursor, ll_Index))
                Next
            End If
            Call mo_Db.Next(ll_Cursor)
        Wend
        Call mo_Db.Close(ll_Cursor)
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("LoadListView")
End Sub

Private Sub CheckListView(ByVal ao_Listview As MSComctlLib.ListView, ByVal as_Request As String)
On Error GoTo ErrHandler

Dim ll_Cursor As Long
Dim lo_item As MSComctlLib.ListItem
Dim lo_NewItem As MSComctlLib.ListItem
Dim ls_ItemKey As String, ls_ItemText As String

    For Each lo_item In ao_Listview.ListItems
        lo_item.Checked = False
        lo_item.Tag = ""
    Next lo_item
    ll_Cursor = mo_Db.OpenSQL(as_Request)
    If ll_Cursor > 0 Then
        While Not mo_Db.EOF(ll_Cursor)
            For Each lo_item In ao_Listview.ListItems
                If StrComp(lo_item.Key, "KEY" & mo_Db.GetFields(ll_Cursor, 0), vbTextCompare) = 0 Then
                    ls_ItemText = lo_item.Text
                    ls_ItemKey = lo_item.Key
                    Call ao_Listview.ListItems.Remove(lo_item.Index)
                    Set lo_NewItem = ao_Listview.ListItems.Add(1, ls_ItemKey, ls_ItemText)
                    lo_NewItem.Checked = True
                    lo_NewItem.Tag = "X"
                    Exit For
                End If
            Next lo_item
            Call mo_Db.Next(ll_Cursor)
        Wend
        Call mo_Db.Close(ll_Cursor)
    End If
    Call ao_Listview.Refresh
    Exit Sub
ErrHandler:
    Call ErrorHandler("CheckListView")
End Sub

Private Sub SaveListView(ByVal al_DetailIndex As Long, ByVal ao_Listview As MSComctlLib.ListView, ByVal as_CheckRequest As String, ByVal as_UnCheckRequest As String, ByVal as_KeyHolder As String)
On Error GoTo ErrHandler

Dim lo_item As MSComctlLib.ListItem
Dim ls_req As String


    as_CheckRequest = mo_Tools.ReplaceRequestByFrameData(as_CheckRequest, UserControl.Controls, fra_DetailItem(mt_DetailConfig(al_DetailIndex).FrameIndex))
    as_CheckRequest = ReplaceLanguagePlaceholderFromToolbar(as_CheckRequest)
    as_CheckRequest = ReplaceCommonPlaceholders(as_CheckRequest)
    
    as_UnCheckRequest = mo_Tools.ReplaceRequestByFrameData(as_UnCheckRequest, UserControl.Controls, fra_DetailItem(mt_DetailConfig(al_DetailIndex).FrameIndex))
    as_UnCheckRequest = ReplaceLanguagePlaceholderFromToolbar(as_UnCheckRequest)
    as_UnCheckRequest = ReplaceCommonPlaceholders(as_UnCheckRequest)
    
    For Each lo_item In ao_Listview.ListItems
        If IIf(lo_item.Checked, "X", "") <> lo_item.Tag Then
            If lo_item.Checked Then
                ls_req = as_CheckRequest
            Else
                ls_req = as_UnCheckRequest
            End If
            ls_req = ReplacePlaceHolder(ls_req, as_KeyHolder, mo_Tools.SqlInt(Mid(lo_item.Key, 4)))
            Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_req)
        End If
    Next
    Exit Sub
ErrHandler:
    Call ErrorHandler("SaveListView")
End Sub

Private Function GetCheckedCount(ByRef ao_Listview As MSComctlLib.ListView) As Long
On Error GoTo ErrHandler

Dim lo_item As MSComctlLib.ListItem
Dim ll_Count As Long

    ll_Count = 0
    For Each lo_item In ao_Listview.ListItems
        If lo_item.Checked Then ll_Count = ll_Count + 1
    Next
    GetCheckedCount = ll_Count
    Exit Function
ErrHandler:
    Call ErrorHandler("GetCheckedCount")
End Function

Private Function CustomReplacePlaceholder(ByRef as_Request As String, ByVal as_PlaceHolder As String, ByVal as_DefaultValue As String) As Boolean
On Error GoTo ErrHandler

    CustomReplacePlaceholder = False
    Exit Function
ErrHandler:
    Call ErrorHandler("CustomReplacePlaceholder")
End Function

Private Function ReplacePlaceHolder(ByVal as_Request As String, ByVal as_PlaceHolder As String, ByVal as_DefaultValue As String) As String
On Error GoTo ErrHandler
    
    If Not CustomReplacePlaceholder(as_Request, as_PlaceHolder, as_DefaultValue) Then
        as_Request = Replace(as_Request, as_PlaceHolder, as_DefaultValue, , , vbTextCompare)
    End If
    ReplacePlaceHolder = as_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplacePlaceholder")
End Function

Private Function ReplaceKeyPlaceholders(ByVal as_Request As String, ByVal av_Key As Variant) As String
On Error GoTo ErrHandler

Dim ll_Index As Long

    If Not IsArray(av_Key) Then av_Key = Array(av_Key)
    
    For ll_Index = 0 To UBound(av_Key)
        as_Request = ReplacePlaceHolder(as_Request, "$Key" & (ll_Index + 1) & "$", mo_Tools.SQLStr(av_Key(ll_Index)))
    Next
    ReplaceKeyPlaceholders = as_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceKeyPlaceholders")
End Function

Private Function ReplaceLanguagePlaceholderFromToolbar(ByVal as_Request As String) As String
On Error GoTo ErrHandler
Dim ll_frameIndex As Long, ll_MainIndex As Long

    ll_MainIndex = FindMainConfigByName(tbs_Main.SelectedItem.Key)
    ll_frameIndex = mt_MainConfig(ll_MainIndex).FrameIndex
    ReplaceLanguagePlaceholderFromToolbar = ReplacePlaceHolder(as_Request, "$toolbar_language_code$", mo_Tools.SQLStr(tlb_Main(ll_frameIndex).Language))
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceLanguagePlaceholderFromToolbar")
End Function

Private Function ReplaceCommonPlaceholders(ByVal as_Request As String) As String
On Error GoTo ErrHandler

    as_Request = ReplacePlaceHolder(as_Request, "$language_code$", mo_Tools.SQLStr(ms_Language_Code))
    as_Request = ReplacePlaceHolder(as_Request, "$Z_Creator$", mo_Tools.SqlInt(ml_U_Code))
    as_Request = ReplacePlaceHolder(as_Request, "$U_Code$", mo_Tools.SqlInt(ml_U_Code))
    as_Request = ReplacePlaceHolder(as_Request, "$Z_Last_Upd_User$", mo_Tools.SqlInt(ml_U_Code))
    as_Request = ReplacePlaceHolder(as_Request, "$LoginName$", mo_Tools.SQLStr(ms_LoginName))
    as_Request = ReplacePlaceHolder(as_Request, "$UserName$", mo_Tools.SQLStr(ms_UserName))
    as_Request = ReplacePlaceHolder(as_Request, "$ComputerName$", mo_Tools.SQLStr(ms_ComputerName))
    as_Request = ReplacePlaceHolder(as_Request, "$NetworkBoardID$", mo_Tools.SQLStr(ms_NetworkBoardID))
    ReplaceCommonPlaceholders = as_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceCommonPlaceholders")
End Function

Private Function UpdateGridByFrame(ByVal ao_grid As Object, ByVal ao_Frame As Frame, ae_Mode As eMode, ByVal ab_UpdateStatus As Boolean, ByVal as_OrderField As String, ByVal ab_AddToEnd As Boolean) As Boolean
On Error GoTo ErrHandler

Dim lo_Control As Control
Dim lsa_Columns() As String
Dim lsa_Value() As String
    
    UpdateGridByFrame = False
    
    If ae_Mode = emAdd Then
        If (ao_grid.Rows = 0) Or ab_AddToEnd Then
            If Not ao_grid.AddLine("") Then
                Err.Raise ArmErr.CompFncFailed, ao_grid.Name, "Method AddLine failed"
            End If
            ao_grid.Row = ao_grid.Rows - 1
        Else
            If Not ao_grid.InsertLine(0) Then
                Err.Raise ArmErr.CompFncFailed, ao_grid.Name, "Method InsertLine failed"
            End If
            ao_grid.Row = 0
        End If
        If as_OrderField <> "" Then
            For Each lo_Control In UserControl.Controls
                If mo_Tools.HasContainer(lo_Control, ao_Frame) And (lo_Control.Tag <> "") Then
                    lsa_Value = Split(lo_Control.Tag, SEP)
                    If (StrComp(TypeName(lo_Control), "TEXTBOX", vbTextCompare) = 0) And _
                       (StrComp(lsa_Value(0), as_OrderField, vbTextCompare) = 0) Then
                        If ao_grid.Row > 0 Then
                            lo_Control.Text = ao_grid.Data(ao_grid.Rows - 2, as_OrderField) + 1
                        Else
                            lo_Control.Text = 1
                        End If
                        Exit For
                    End If
                End If
            Next
        End If
        ao_grid.CurrentLine("iConcurrency") = 1
    End If
    
    ' one row must be selected !
    If ao_grid.SelectedCount <> 1 Then
        Exit Function
    End If
    
    'update iConcurrency automatically
    'If ae_Mode = emUpdate Then
    '    ao_Grid.SelectedLine(0, "iConcurrency") = Val(ao_Grid.SelectedLine(0, "iConcurrency")) + 1
    'End If
    
    If ab_UpdateStatus Then
        If ae_Mode = emAdd Then
            ao_grid.SelectedLine(0, STATUS_COLUMN) = "A"
        ElseIf ae_Mode = emUpdate Then
            If ao_grid.SelectedLine(0, STATUS_COLUMN) <> "A" Then
                ao_grid.SelectedLine(0, STATUS_COLUMN) = "U"
            End If
        ElseIf ae_Mode = emDelete Then
            Call ao_grid.DeleteSelectedLines
        Else
            Exit Function
        End If
    Else
        If ae_Mode = emDelete Then
            Call ao_grid.DeleteSelectedLines
            UpdateGridByFrame = True
            Exit Function
        End If
    End If
    
    For Each lo_Control In UserControl.Controls
    
        If mo_Tools.HasContainer(lo_Control, ao_Frame) And (lo_Control.Tag <> "") Then
            lsa_Value = Split(lo_Control.Tag, SEP)
            Select Case UCase(TypeName(lo_Control))
                Case "ARMCOMBOBOX"
                    If UBound(lsa_Value) >= 0 Then ao_grid.SelectedLine(0, lsa_Value(0)) = mo_Tools.GetComboKey(lo_Control)
                    If UBound(lsa_Value) >= 1 Then ao_grid.SelectedLine(0, lsa_Value(1)) = lo_Control.Text
                Case "ARMPICKER"
                    If UBound(lsa_Value) >= 0 Then ao_grid.SelectedLine(0, lsa_Value(0)) = lo_Control.ItemCode
                    If UBound(lsa_Value) >= 1 Then ao_grid.SelectedLine(0, lsa_Value(1)) = lo_Control.ItemDescription
                Case "CHECKBOX"
                    Dim lo_Column As ArmColumn
                    Set lo_Column = ao_grid.Columns(lsa_Value(0))
                    If Not (lo_Column Is Nothing) Then
                        If lo_Column.FieldType = DBTYPE_BMP Then
                            If lo_Control.Value = vbChecked Then
                                ao_grid.SelectedLine(0, lsa_Value(0)) = "CHECK"
                            Else
                                ao_grid.SelectedLine(0, lsa_Value(0)) = "UNCHECK"
                            End If
                        Else
                            If lo_Control.Value = vbChecked Then
                                ao_grid.SelectedLine(0, lsa_Value(0)) = "X"
                            Else
                                ao_grid.SelectedLine(0, lsa_Value(0)) = ""
                            End If
                        End If
                    End If
                Case "TEXTBOX"
                    lsa_Columns = Split(lo_Control.Tag, SEP)
                    If UBound(lsa_Columns) > 0 Then
                      Select Case UCase(lsa_Columns(1))
                      Case "N", "F"
                        If IsNumeric(lo_Control.Text) Then
                            ao_grid.SelectedLine(0, lsa_Value(0)) = CDbl(lo_Control.Text)
                        End If
                      Case Else
                        ao_grid.SelectedLine(0, lsa_Value(0)) = lo_Control.Text
                      End Select
                    Else
                        ao_grid.SelectedLine(0, lsa_Value(0)) = lo_Control.Text
                    End If
                Case "A_CALOCX"
                    ao_grid.SelectedLine(0, lsa_Value(0)) = lo_Control.date_sql
            End Select
        End If
    Next
    UpdateGridByFrame = True
    Exit Function
ErrHandler:
    Call ErrorHandler("UpdateGridByFrame")
End Function

Private Function ReplaceRequestByGridData(ByVal ao_grid As ArmGrid, ByVal as_Request As String, ByVal al_Row As Long, ByVal as_Table As String) As String
On Error GoTo ErrHandler

Dim ll_ColIndex As Long
Dim ls_Data As String
    
    For ll_ColIndex = 0 To ao_grid.Cols - 1
'        If ao_Grid.Columns(ll_ColIndex).Key And (as_Table <> "") And (ao_Grid.Data(al_Row, STATUS_COLUMN) = "A") Then
'            ls_Data = mo_Tools.SqlInt(ao_Grid.Data(al_Row, ll_ColIndex))
'            If (ls_Data = "0") Or (ls_Data = "NULL") And (as_Table <> "") Then
'                ls_Data = mo_Db.SQLNextID(as_Table)
'                If ls_Data = "" Then
'                    Err.Raise ArmErr.CompFncFailed, "mo_Db.SQLNextID", "SQLNextID failed for: " & as_Table
'                End If
'            End If
'        Else
        Select Case ao_grid.Columns(ll_ColIndex).FieldType
        Case DBTYPE_I4
            ls_Data = mo_Tools.SqlInt(ao_grid.Data(al_Row, ll_ColIndex))
        Case DBTYPE_R4, DBTYPE_R8
            ls_Data = mo_Tools.SqlDbl(ao_grid.Data(al_Row, ll_ColIndex))
        Case DBTYPE_DATE
            ls_Data = mo_Tools.SqlDate(ao_grid.Data(al_Row, ll_ColIndex))
        Case DBTYPE_BMP
            Select Case UCase(ao_grid.Data(al_Row, ll_ColIndex))
            Case "CHECK"
                ls_Data = mo_Tools.SQLStr("X")
            Case "UNCHECK"
                ls_Data = mo_Tools.SQLStr("")
            End Select
        Case Else
            ls_Data = mo_Tools.SQLStr(ao_grid.Data(al_Row, ll_ColIndex))
        End Select
        as_Request = ReplacePlaceHolder(as_Request, "$" & ao_grid.Columns(ll_ColIndex).Name & "$", ls_Data)
    Next
    ReplaceRequestByGridData = as_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceRequestByGridData")
End Function

Private Function ReplaceRequestByGridData2(ByVal ao_grid As ArmGrid, ByVal as_Request As String, ByVal al_Row As Long, ByVal as_Table As String) As String
On Error GoTo ErrHandler

Dim ll_ColIndex As Long
Dim ls_Data As String
    
    For ll_ColIndex = 0 To ao_grid.Cols - 1
        Select Case ao_grid.Columns(ll_ColIndex).FieldType
        Case DBTYPE_I4
            ls_Data = mo_Tools.SqlInt(ao_grid.Data(al_Row, ll_ColIndex))
        Case DBTYPE_R4, DBTYPE_R8
            ls_Data = mo_Tools.SqlDbl(ao_grid.Data(al_Row, ll_ColIndex))
        Case DBTYPE_DATE
            ls_Data = mo_Tools.SqlDate(ao_grid.Data(al_Row, ll_ColIndex))
        Case DBTYPE_BMP
            Select Case UCase(ao_grid.Data(al_Row, ll_ColIndex))
            Case "CHECK"
                ls_Data = mo_Tools.SQLStr("X")
            Case "UNCHECK"
                ls_Data = mo_Tools.SQLStr("")
            End Select
        Case Else
            ls_Data = mo_Tools.SQLStr(ao_grid.Data(al_Row, ll_ColIndex))
            If InStr(1, ao_grid.Columns(ll_ColIndex).Name, "GPP_Param", vbTextCompare) > 0 And ls_Data = "''" Then
                ls_Data = "Null"
            End If
            If InStr(1, ao_grid.Columns(ll_ColIndex).Name, "CT_Code", vbTextCompare) > 0 And ls_Data = "''" Then
                ls_Data = "Null"
            End If
        End Select
        as_Request = ReplacePlaceHolder(as_Request, "$" & ao_grid.Columns(ll_ColIndex).Name & "$", ls_Data)
    Next
    ReplaceRequestByGridData2 = as_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceRequestByGridData2")
End Function

Private Function ReplaceRequestByGridStoredData(ByVal ao_grid As ArmGrid, ByVal ao_data As Variant, ByVal as_Request As String, ByVal al_Row As Long, ByVal as_Table As String) As String
On Error GoTo ErrHandler

Dim ll_ColIndex As Long
Dim ls_Data As String
    
    For ll_ColIndex = 0 To ao_grid.Cols - 1
        Select Case ao_grid.Columns(ll_ColIndex).FieldType
        Case DBTYPE_I4
            ls_Data = mo_Tools.SqlInt(ao_data(al_Row)(ll_ColIndex))
        Case DBTYPE_R4, DBTYPE_R8
            ls_Data = mo_Tools.SqlDbl(ao_data(al_Row)(ll_ColIndex))
        Case DBTYPE_DATE
            ls_Data = mo_Tools.SqlDate(ao_data(al_Row)(ll_ColIndex))
        Case DBTYPE_BMP
            Select Case UCase(ao_data(al_Row)(ll_ColIndex))
            Case "CHECK"
                ls_Data = mo_Tools.SQLStr("X")
            Case "UNCHECK"
                ls_Data = mo_Tools.SQLStr("")
            End Select
        Case Else
            ls_Data = mo_Tools.SQLStr(ao_data(al_Row)(ll_ColIndex))
        End Select
        as_Request = ReplacePlaceHolder(as_Request, "$" & ao_grid.Columns(ll_ColIndex).Name & "$", ls_Data)
    Next
    ReplaceRequestByGridStoredData = as_Request
    Exit Function
ErrHandler:
    Call ErrorHandler("ReplaceRequestByGridStoredData")
End Function

Private Sub LoadFrameDataFromCursor(ByVal ao_Db As ArmDb, ByVal al_Cursor As Long, ByVal ao_Frame As Frame)
On Error GoTo ErrHandler

Dim lo_Control As Control
Dim lsa_Columns() As String
Dim lv_ComboData As Variant
Dim ll_Index As Long


   mb_InternalInit = True
    For Each lo_Control In UserControl.Controls
    
        If mo_Tools.HasContainer(lo_Control, ao_Frame) Then
            Select Case UCase(TypeName(lo_Control))
                Case "ARMCOMBOBOX"
                    If Trim(lo_Control.Tag) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        If (StrComp(mo_Db.GetFields(al_Cursor, lsa_Columns(0)), "", vbTextCompare) <> 0) And _
                            (StrComp(mo_Db.GetFields(al_Cursor, lsa_Columns(0)), "0", vbTextCompare) <> 0) Then
                            If UBound(lsa_Columns) >= 1 Then
                                If Not lo_Control.SearchItem(mo_Db.GetFields(al_Cursor, lsa_Columns(0))) Then
                                    ReDim lv_ComboData(UBound(lsa_Columns))
                                    For ll_Index = 0 To UBound(lsa_Columns)
                                        lv_ComboData(ll_Index) = mo_Db.GetFields(al_Cursor, lsa_Columns(ll_Index))
                                    Next
                                    If lo_Control.AddItem(lv_ComboData, True) Is Nothing Then
                                        Err.Raise ArmErr.CompFncFailed, lo_Control.Name, "Function AddItem failed"
                                    End If
                                End If
                            Else
                                Call lo_Control.SearchItem(mo_Db.GetFields(al_Cursor, lsa_Columns(0)))
                            End If
                        End If
                    End If
                Case "ARMPICKER"
                    If Trim(lo_Control.Tag) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        If (StrComp(mo_Db.GetFields(al_Cursor, lsa_Columns(0)), "", vbTextCompare) <> 0) And _
                            (StrComp(mo_Db.GetFields(al_Cursor, lsa_Columns(0)), "0", vbTextCompare) <> 0) Then
                            If UBound(lsa_Columns) >= 1 Then
                                lo_Control.ItemCode = mo_Db.GetFields(al_Cursor, lsa_Columns(0))
                                lo_Control.ItemDescription = mo_Db.GetFields(al_Cursor, lsa_Columns(1))
                            End If
                        End If
                    End If
                Case "CHECKBOX"
                    If Trim(lo_Control.Tag) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        If UCase(mo_Db.GetFields(al_Cursor, lsa_Columns(0))) = "X" Then
                            lo_Control.Value = vbChecked
                        Else
                            lo_Control.Value = vbUnchecked
                        End If
                    End If
                Case "TEXTBOX"
                    If Trim(lo_Control.Tag) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        lo_Control.Text = mo_Db.GetFields(al_Cursor, lsa_Columns(0))
                    End If
                Case "A_CALOCX"
                    If Trim(lo_Control.Tag) <> "" Then
                        If CDbl(mo_Db.GetFields(al_Cursor, lo_Control.Tag)) = 0 Then
                            Call lo_Control.reinit_cal
                        Else
                            lo_Control.date_courte = Format(mo_Db.GetFields(al_Cursor, lo_Control.Tag), "dd\/mm\/yyyy")
                        End If
                    End If
            End Select
        End If
    Next
    mb_InternalInit = False
    Exit Sub
ErrHandler:
    mb_InternalInit = False
    Call ErrorHandler("LoadFrameDataFromCursor")
End Sub

Private Sub SaveSubDetailGrid(ByVal al_SubDetailIndex As Long)
On Error GoTo ErrHandler

Dim ll_Index As Long, ll_KeyIdx As Long
Dim ls_Request As String
Dim ll_SubDetailFrameIndex As Long, ll_DetailFrameIndex As Long, ll_KeyCount As Long
Dim le_Mode As eMode
Dim lv_Key As Variant, lv_Data As Variant

    ll_SubDetailFrameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailFrameIndex = mt_DetailConfig(mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex).FrameIndex
    
    If Not grd_SubDetail(ll_SubDetailFrameIndex) Is Nothing Then
        For ll_Index = 0 To grd_SubDetail(ll_SubDetailFrameIndex).Rows - 1
            ls_Request = ""
            Select Case grd_SubDetail(ll_SubDetailFrameIndex).Data(ll_Index, STATUS_COLUMN)
            Case "A"
                ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestAdd
                le_Mode = emAdd
                Call SubItem_AddDB(al_SubDetailIndex, ll_Index)
            Case "U"
                ls_Request = mt_SubdetailConfig(al_SubDetailIndex).RequestUpd
                le_Mode = emUpdate
                Call SubItem_UpdateDB(al_SubDetailIndex, ll_Index)
            'Case "D"
            '    ls_Request = mt_SubdetailConfig(al_SubdetailIndex).RequestDel
            '    le_Mode = emDelete
            Case Else
                le_Mode = emNone
            End Select
            'If le_Mode <> emNone Then Call SubItem_CustomBeforeSave(al_SubdetailIndex, le_Mode, ll_Index)
            'If ls_Request <> "" Then
            '    ls_Request = mo_Tools.ReplacePlaceholderByControlValue(ls_Request, txt_DetailKey(ll_DetailFrameIndex))
            '    ls_Request = ReplaceRequestByGridData(grd_Subdetail(ll_SubDetailFrameIndex), ls_Request, ll_Index, mt_SubdetailConfig(al_SubdetailIndex).TableName)
            '    ls_Request = ReplaceLanguagePlaceholderFromToolbar(ls_Request)
            '    ls_Request = ReplaceCommonPlaceholders(ls_Request)
            '    Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_Request, 1)
            '    grd_Subdetail(ll_SubDetailFrameIndex).Data(ll_Index, "iConcurrency") = Val(grd_Subdetail(ll_SubDetailFrameIndex).Data(ll_Index, "iConcurrency")) + 1
            '    'grd_Subdetail(ll_SubDetailFrameIndex).Data(ll_Index, STATUS_COLUMN) = ""    ' reset status flag
            'End If
            'If le_Mode <> emNone Then Call SubItem_CustomAfterSave(al_SubdetailIndex, le_Mode, ll_Index)
        Next
        ' find all records which have been deleted acording key. Compare original stored rows key with key of rows in grid
        If UBound(mt_SubdetailConfig(al_SubDetailIndex).DeletedRows) >= 0 Then
            ' calculate number of key columns
            ll_KeyCount = GetGridKeyCount(grd_SubDetail(ll_SubDetailFrameIndex))
            ' if there is no key, we cannot delete row
            If ll_KeyCount > 0 Then
                lv_Key = GetGridKeyIndexArray(grd_SubDetail(ll_SubDetailFrameIndex))
                ReDim lv_Data(ll_KeyCount - 1)
                ' compare stored rows to grid
                For ll_Index = 0 To UBound(mt_SubdetailConfig(al_SubDetailIndex).DeletedRows)
                    ' fill array of key values for each row in stored rows collection
                    For ll_KeyIdx = 0 To UBound(lv_Key)
                        lv_Data(ll_KeyIdx) = mt_SubdetailConfig(al_SubDetailIndex).DeletedRows(ll_Index)(lv_Key(ll_KeyIdx))
                    Next
                    ' search key in grid, if not found delete record from database
                    If Not SearchGrid(grd_SubDetail(ll_SubDetailFrameIndex), lv_Key, lv_Data, False) Then
                        Call SubItem_DeleteDB(al_SubDetailIndex, ll_Index)
                    End If
                Next
            End If
        End If
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("SaveSubDetailGrid")
End Sub


Private Function GetGridKeyIndexArray(ByVal ao_grid As ArmGrid) As Variant
On Error GoTo ErrHandler

Dim lv_KeyIndex As Variant
Dim ll_Count As Long
Dim ll_Index As Long
Dim ll_KeyIdx As Long

    ll_Count = GetGridKeyCount(ao_grid)
    ReDim lv_KeyIndex(ll_Count - 1)
    ll_KeyIdx = 0
    ' create array of key indexes
    For ll_Index = 0 To ao_grid.Cols - 1
        If ao_grid.Columns(ll_Index).Key Then
            lv_KeyIndex(ll_KeyIdx) = ll_Index
            ll_KeyIdx = ll_KeyIdx + 1
        End If
    Next
    GetGridKeyIndexArray = lv_KeyIndex
    Exit Function
ErrHandler:
    Call ErrorHandler("GetGridKeyIndexArray")
End Function

Private Function GetGridKeyCount(ByVal ao_grid As ArmGrid) As Long
On Error GoTo ErrHandler

Dim ll_KeyCount As Long
Dim ll_Index As Long

    ll_KeyCount = 0
    For ll_Index = 0 To ao_grid.Cols - 1
        If ao_grid.Columns(ll_Index).Key Then
            ll_KeyCount = ll_KeyCount + 1
        End If
    Next
    GetGridKeyCount = ll_KeyCount
    Exit Function
ErrHandler:
    Call ErrorHandler("GetGridKeyCount")
End Function

Private Sub LoadFrameDataFromGrid(ByVal ao_grid As ArmGrid, ByVal ao_Frame As Frame)
On Error GoTo ErrHandler

Dim lo_Control As Control
Dim lsa_Columns() As String
Dim lv_ComboData As Variant
Dim ll_Index As Long
   
   mb_InternalInit = True
    If ao_grid.SelectedCount <> 1 Then
        Debug.Assert True
        mb_InternalInit = False
        Exit Sub
    End If
    
    For Each lo_Control In UserControl.Controls
    
        If mo_Tools.HasContainer(lo_Control, ao_Frame) Then
            Select Case UCase(TypeName(lo_Control))
                Case "ARMCOMBOBOX"
                    If Trim(lo_Control.Tag) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        If UBound(lsa_Columns) >= 1 Then
                            If Not lo_Control.SearchItem(ao_grid.CurrentLine(lsa_Columns(0))) Then
                                ReDim lv_ComboData(UBound(lsa_Columns))
                                For ll_Index = 0 To UBound(lsa_Columns)
                                    lv_ComboData(ll_Index) = ao_grid.CurrentLine(lsa_Columns(ll_Index))
                                Next
                                If lo_Control.AddItem(lv_ComboData, True) Is Nothing Then
                                    Err.Raise ArmErr.CompFncFailed, lo_Control.Name, "Function AddItem failed"
                                End If
                            End If
                        Else
                            Call lo_Control.SearchItem(ao_grid.CurrentLine(lsa_Columns(0)))
                        End If
                    End If
                Case "ARMPICKER"
                    If Trim(lo_Control.Tag) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        If UBound(lsa_Columns) >= 1 Then
                            lo_Control.ItemCode = ao_grid.CurrentLine(lsa_Columns(0))
                            lo_Control.ItemDescription = ao_grid.CurrentLine(lsa_Columns(1))
                        End If
                    End If
                Case "CHECKBOX"
                    If Trim(lo_Control.Tag) <> "" Then
                        If (StrComp(ao_grid.CurrentLine(lo_Control.Tag), "X", vbTextCompare) = 0) Or _
                           (StrComp(ao_grid.CurrentLine(lo_Control.Tag), "CHECK", vbTextCompare) = 0) Then
                            lo_Control.Value = vbChecked
                        Else
                            lo_Control.Value = vbUnchecked
                        End If
                    End If
                Case "TEXTBOX"
                    If Trim(lo_Control.Tag) <> "" Then
                        lsa_Columns = Split(lo_Control.Tag, SEP)
                        If UBound(lsa_Columns) >= 1 Then
                            lo_Control.Text = ao_grid.CurrentLine(lsa_Columns(0))
                        Else
                            lo_Control.Text = ao_grid.CurrentLine(lo_Control.Tag)
                        End If
                    End If
                Case "A_CALOCX"
                    If Trim(lo_Control.Tag) <> "" Then
                        If CDbl(ao_grid.CurrentLine(lo_Control.Tag)) = 0 Then
                            Call lo_Control.reinit_cal
                        Else
                            lo_Control.date_courte = Format(ao_grid.CurrentLine(lo_Control.Tag), "dd\/mm\/yyyy")
                        End If
                    End If
            End Select
        End If
    Next
    mb_InternalInit = False
    Exit Sub
ErrHandler:
    mb_InternalInit = False
    Call ErrorHandler("LoadFrameDataFromGrid")
End Sub

Private Sub SwapRows(ByVal al_FrameIndex As Long, ByVal ab_Down As Boolean)
On Error GoTo ErrHandler

Dim ll_Row1 As Long, ll_Row2 As Long
Dim ls_OrderValue As String, ls_OrderField As String
Dim ll_SubdetailIndex As Long, ll_frameIndex As Long
Dim lo_Grid As ArmGrid

    ll_SubdetailIndex = FindSubDetailConfigByFrameIndex(al_FrameIndex)
    Set lo_Grid = grd_SubDetail(al_FrameIndex)
    ls_OrderField = mt_SubdetailConfig(ll_SubdetailIndex).TableOrder
    
    If lo_Grid.SelectedCount <> 1 Then Exit Sub
    ll_Row1 = lo_Grid.Row
    If ab_Down Then
        If ll_Row1 = lo_Grid.Rows - 1 Then Exit Sub
        ll_Row2 = ll_Row1 + 1
    Else
        If ll_Row1 = 0 Then Exit Sub
        ll_Row2 = ll_Row1 - 1
    End If
    lo_Grid.Row = ll_Row2
    ls_OrderValue = lo_Grid.Data(ll_Row1, ls_OrderField)
    lo_Grid.Data(ll_Row1, ls_OrderField) = lo_Grid.Data(ll_Row2, ls_OrderField)
    lo_Grid.Data(ll_Row2, ls_OrderField) = ls_OrderValue
    Call lo_Grid.SwapLines(ll_Row1, ll_Row2)
    
    If lo_Grid.Data(ll_Row1, STATUS_COLUMN) <> "A" Then lo_Grid.Data(ll_Row1, STATUS_COLUMN) = "U"
    If lo_Grid.Data(ll_Row2, STATUS_COLUMN) <> "A" Then lo_Grid.Data(ll_Row2, STATUS_COLUMN) = "U"
    'if detail is in view mode, save changes immediatelly to database
    If me_DetailMode = emView Then
        Call SaveSubDetailGrid(ll_SubdetailIndex)
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("SwapRows")
End Sub


Private Function SelectValue(ByVal as_Request As String) As Variant
On Error GoTo ErrHandler
Dim ll_Cursor As Long

  ll_Cursor = mo_Tools.OpenSQLSafe(mo_Db, as_Request)
  If ll_Cursor > 0 Then
    If mo_Db.RowCount(ll_Cursor) = 1 Then
      SelectValue = mo_Db.GetFields(ll_Cursor, 0)
    End If
    Call mo_Db.Close(ll_Cursor)
  End If
  Exit Function
ErrHandler:
  Call mo_Db.Close(ll_Cursor)
  Call ErrorHandler("SelectValue as_Request=" & as_Request)
End Function

Private Sub UpdateLocalComboboxes(ByVal as_Key As String, ByVal av_Value As Variant, ByVal ae_Mode As eMode)
On Error GoTo ErrHandler

Dim lo_Control As Object
Dim lsa_Fields() As String

    If as_Key = "" Then Exit Sub
    For Each lo_Control In UserControl.Controls
    
        If StrComp(TypeName(lo_Control), "ArmCombobox", vbTextCompare) = 0 Then
            If lo_Control.Tag <> "" Then
                lsa_Fields = Split(lo_Control.Tag, SEP)
                If StrComp(lsa_Fields(0), as_Key, vbTextCompare) = 0 Then
                    Call lo_Control.Clear
                End If
            End If
        End If
    Next
    Exit Sub
ErrHandler:
    Call ErrorHandler("UpdateLocalComboboxes")
End Sub

Private Function SearchGrid(ByRef ao_grid As ArmGrid, ByVal av_columns As Variant, ByVal av_Data As Variant, ByVal ab_Select As Boolean) As Boolean
On Error GoTo ErrHandler

Dim ll_RowIdx As Long, ll_ColIdx As Long
Dim lb_Found As Boolean

    lb_Found = False
    For ll_RowIdx = 0 To ao_grid.Rows - 1
        lb_Found = True
        For ll_ColIdx = 0 To UBound(av_columns)
            If StrComp(av_Data(ll_ColIdx), ao_grid.Data(ll_RowIdx, av_columns(ll_ColIdx)), vbTextCompare) <> 0 Then
                lb_Found = False
                Exit For
            End If
        Next
        If lb_Found Then Exit For
    Next
    If lb_Found And ab_Select Then
        ao_grid.Row = ll_RowIdx
    End If
    SearchGrid = lb_Found
    Exit Function
ErrHandler:
    Call ErrorHandler("SearchGrid")
End Function

Private Function GetColIndex(ByRef ao_grid As ArmGrid, ByVal as_ColumnName As String) As Long
On Error GoTo ErrHandler

Dim ll_ColIdx As Long

    For ll_ColIdx = 0 To ao_grid.Cols - 1
        If StrComp(as_ColumnName, ao_grid.Columns(ll_ColIdx).FieldName, vbTextCompare) = 0 Then
            GetColIndex = ll_ColIdx
            Exit Function
        End If
    Next
    GetColIndex = -1
    Exit Function
ErrHandler:
    Call ErrorHandler("GetColIndex")
End Function

Private Function GetTreeViewPath(ByVal ao_Tree As ArmTreeView, ByVal al_DataIndex As Long, ByVal as_Separator As String) As String
On Error GoTo ErrHandler

Dim as_Path As String
Dim lo_Node As MSComctlLib.Node
    
    as_Path = ""
    Set lo_Node = ao_Tree.SelectedItem
    While Not (lo_Node Is Nothing)
    
        If as_Path <> "" Then as_Path = as_Separator & as_Path
        as_Path = lo_Node.Tag.GetData(al_DataIndex) & as_Path
        Set lo_Node = lo_Node.Parent
    Wend
    GetTreeViewPath = as_Path
    Exit Function
ErrHandler:
    Call ErrorHandler("GetTreeViewPath")
End Function

Private Sub DisableFrameParts(ByVal av_ListFieldsToDisable As Variant)
On Error GoTo ErrHandler
    
    Dim lIdx As Long, lCount As Long
    Dim lParams As Variant
    
    If Not IsArray(av_ListFieldsToDisable) Then Exit Sub
    lCount = UBound(av_ListFieldsToDisable)
    
    For lIdx = 0 To lCount
            Select Case UCase(TypeName(av_ListFieldsToDisable(lIdx)))
                Case "FRAME", "LABEL", "MSFLEXGRID", "TOOLBARCONTROL"
                    ' Do nothing !
                
                Case "TEXTBOX"
                        av_ListFieldsToDisable(lIdx).Locked = True
                        av_ListFieldsToDisable(lIdx).BackColor = CL_COLOR_DISABLED
                        
                Case "ARMGRID", "ARMCHECKVIEW"
                                    
                Case "OPTIONBUTTON", "COMMANDBUTTON", "ARMCOMBOBOX", "ARMPICKER", "A_CALOCX", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX", "TABSTRIP", "CHECKBOX"
                    av_ListFieldsToDisable(lIdx).Enabled = False
                    
                Case Else
                    Debug.Print "DisableFrameParts " & UCase(TypeName(av_ListFieldsToDisable(lIdx)))
            End Select
    Next
    Exit Sub
ErrHandler:
    Call ErrorHandler("DisableFrameParts")
End Sub

Private Sub SetTreeDelayedMode(ByVal al_FrameIndex As Long, ByVal ab_Delayed As Boolean)
On Error GoTo ErrHandler
Dim ll_MainConfigIndex As Long
    
    ll_MainConfigIndex = FindMainConfigByFrameIndex(al_FrameIndex)
    If mt_MainConfig(ll_MainConfigIndex).CurrentTvwSelMethod = eTvwSelMethod.etmNone Then
        tvw_Main(al_FrameIndex).Visible = False
        cmd_TVReLoad(al_FrameIndex).Visible = False
        grd_Main(al_FrameIndex).Visible = Not ab_Delayed
    Else
        tvw_Main(al_FrameIndex).Visible = Not ab_Delayed
        cmd_TVReLoad(al_FrameIndex).Visible = ab_Delayed
        mt_MainConfig(ll_MainConfigIndex).TreeDelayed = ab_Delayed
        grd_Main(al_FrameIndex).Visible = Not ab_Delayed
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("SetTreeDelayedMode")
End Sub

Private Function GetModeFromRole(ByVal as_Role As String) As eMode
On Error GoTo ErrHandler

    GetModeFromRole = emView
    
    Select Case as_Role
    Case "A"
        GetModeFromRole = emAdd
    Case "B"
        GetModeFromRole = emUpdate
    Case "C"
        GetModeFromRole = emDelete
    End Select
    Exit Function
ErrHandler:
    Call ErrorHandler("GetModeFromRole")
End Function

Private Function LoadTreeView(ByVal al_MainIndex As Long, ByRef aTV As ArmTreeView, ByRef aTreeViewInfo As TTreeViewInfo) As Boolean
On Error GoTo ErrorHandler
    
    Call aTV.Clear
    
    If aTreeViewInfo.Levels > 0 Then
      aTV.Levels = aTreeViewInfo.Levels
      aTV.StartDemandLevel = 1
      aTV.SelectedImages = aTreeViewInfo.SelectedImages
      aTV.Images = aTreeViewInfo.Images
      aTV.NodeRequests = ApplyTVFilters(al_MainIndex, aTreeViewInfo.NodeRequest)
      aTV.GridRequests = aTreeViewInfo.GridRequest
      
      If Not aTV.LoadTree(LoadTypeChildsDemand) Then
          Call Err.Raise(ArmErr.CompFncFailed, "aTV.LoadTree", "")
      End If
    End If
    Exit Function
ErrorHandler:
    Call ErrorHandler("LoadTreeView")
End Function

Private Function GetTreeViewInfoFromDB(ByVal AScreenName As String, ByVal aTVCode As String) As TTreeViewInfo
On Error GoTo ErrHandler

    Dim lTreeView As TTreeViewInfo
    Dim lRequest As String
    Dim lCurs As Long, lIdx As Long, lCount As Long
    
    ' Get the data from the DB
    lRequest = "EXEC Treeview_Parameters_lst '" & AScreenName & "', '" & aTVCode & "'"
    lCurs = mo_Tools.OpenSQLSafe(mo_Db, lRequest)
    
    lCount = mo_Db.RowCount(lCurs) - 1
    
    If lCount < 0 Then
        Call Err.Raise(ArmErr.InvalidValue, lRequest, "AScreenName=" & AScreenName & " lCount=" & lCount)
    End If
    
    ReDim lTreeView.NodeRequest(lCount)
    ReDim lTreeView.GridRequest(lCount)
    ReDim lTreeView.ExcelRequest(lCount)
    ReDim lTreeView.FindRequest(lCount)
    ReDim lTreeView.CountRequest(lCount)
    ReDim lTreeView.Images(lCount)
    ReDim lTreeView.SelectedImages(lCount)
    
    Dim lLevel As Long
    For lIdx = 0 To lCount
        lLevel = mo_Db.GetFields(lCurs, "TV_Level")
        lTreeView.NodeRequest(lLevel) = ReplaceCommonPlaceholders(mo_Db.GetFields(lCurs, "TV_NodeRequest"))
        lTreeView.GridRequest(lLevel) = mo_Db.GetFields(lCurs, "TV_GridRequest")
        lTreeView.Images(lLevel) = mo_Db.GetFields(lCurs, "TV_Images")
        lTreeView.SelectedImages(lLevel) = mo_Db.GetFields(lCurs, "TV_SelectedImages")
        mo_Db.Next (lCurs)
    Next
    
    lTreeView.TreeViewCode = aTVCode
    lTreeView.Levels = lCount + 1
    lTreeView.Loaded = True
    GetTreeViewInfoFromDB = lTreeView
    
    Call mo_Db.Close(lCurs)
    Exit Function
ErrHandler:
    Call mo_Db.Close(lCurs)
    Call ErrorHandler("GetTreeViewInfoFromDB")
End Function

' ************************************************************************************
' FRAMEWORK DB-ACCESS FUNCTIONS
' please do not change this code
' ************************************************************************************

' Standard error handler
Private Sub ErrorHandler(ByVal as_Fct As String)
  
    Call Err.Raise(Err.Number, as_Fct & SEP1 & Err.Source, Err.Description)
End Sub

' display standard error message
Private Sub ErrorMessage(ByVal as_Fct As String)
    Dim ls_ErrSource As String
    Dim ls_errDescription As String
    ls_ErrSource = as_Fct & SEP1 & Err.Source
    ls_errDescription = Err.Description
    
    Call LogMessage(SCREEN_NAME & " exception raised. Err.Number:" & Err.Number & ", Err.Source:" & ls_ErrSource & ", Err.Description " & ls_errDescription & ".", "E", False)
    Call MsgBox("Error occured, please contact IT. Application will now shutdown." & vbCrLf & ls_ErrSource & vbCrLf & "Description: " & ls_errDescription, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
    End
End Sub

' logs message to database
Private Sub LogMessage(ByVal as_LogMsg As String, Optional ByVal as_LogType As String = "E", Optional ab_ExitOnException As Boolean = False)
    Dim ll_errNumber As Long
    Dim ls_errDescription As String, ls_ErrSource As String
    
    ll_errNumber = Err.Number
    ls_errDescription = Err.Description
    ls_ErrSource = Err.Source

On Error GoTo ErrHandler

Const LOG_REQUEST As String = "EXEC A_log_ins $UCODE$,$LOGTYPE$,$MSG$,$APP$"
    Dim ls_req As String
    Dim ll_Cursor As Long
    Dim ls_Source As String, ls_Msg As String
    
    ls_Source = SCREEN_NAME & " " & App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision
    ls_Msg = as_LogMsg & SEP1 & ll_errNumber & " : " & ls_errDescription & " - " & ls_ErrSource
    
    ls_req = ReplacePlaceHolder(LOG_REQUEST, "$UCODE$", CStr(ml_U_Code))
    ls_req = ReplacePlaceHolder(ls_req, "$LOGTYPE$", mo_Tools.SQLStr(as_LogType))
    ls_req = ReplacePlaceHolder(ls_req, "$MSG$", Left(Trim(mo_Tools.SQLStr(ls_Msg)), 4000))
    ls_req = ReplacePlaceHolder(ls_req, "$APP$", Left(Trim(mo_Tools.SQLStr(ls_Source)), 50))
    
    Call mo_Tools.ExecuteSQLSafe(mo_Db, ls_req)
    
    Err.Number = ll_errNumber
    Err.Description = ls_errDescription
    Err.Source = ls_ErrSource
    Exit Sub
    
ErrHandler:
    If ab_ExitOnException Then
        Call MsgBox("A fatal error occured. Unable to log error into database, the application will be close. Please report the following message to your IT support: " & vbCrLf & _
            "Number:" & Err.Number & vbCrLf & "Description:" & Err.Description, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
        End
    End If
    Err.Number = ll_errNumber
    Err.Description = ls_errDescription
    Err.Source = ls_ErrSource
End Sub

' ************************************************************************************
' *************************** INTERNATIONAL FUNCTIONS ********************************
' ************************************************************************************

Private Function HasRightInA_Config(ByVal as_CFG_Key As String)
On Error GoTo ErrHandler

Dim ls_CFG_Value As String
Dim lsa_Login() As String
Dim ll_Idx As Long

    HasRightInA_Config = False
    ls_CFG_Value = CStr(SelectValue("SELECT CFG_Value FROM A_Config WHERE CFG_Key=" & mo_Tools.SQLStr(as_CFG_Key)))
    If ls_CFG_Value <> "" Then
        lsa_Login = Split(ls_CFG_Value, SEP)
        For ll_Idx = 0 To UBound(lsa_Login)
            If StrComp(ms_LoginName, lsa_Login(ll_Idx), vbTextCompare) = 0 Then
                HasRightInA_Config = True
                Exit Function
            End If
        Next
    End If
  Exit Function
ErrHandler:
  Call ErrorHandler("HasRightInA_Config as_CFG_Key=" & as_CFG_Key)
End Function

Private Function MapNetworkDrive(ByRef ao_WshNetwork As Object, ByVal as_drive As String, ByVal as_remotePath As String, ByVal as_User As String, ByVal as_pass As String) As Boolean
On Error GoTo ErrorHandler
    If Trim(as_User) = "" Then
        Call mo_WshNetwork.MapNetworkDrive(as_drive, as_remotePath, False)
    Else
        Call mo_WshNetwork.MapNetworkDrive(as_drive, as_remotePath, False, as_User, as_pass)
    End If
    MapNetworkDrive = True
    Exit Function
ErrorHandler:
    ' mapping failed
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9855, "#Application cannot map drive $DRIVE$ to $PATH$." & vbCrLf & "$ERROR$" & vbCrLf & "Try it manually or call application support please.", Array("$DRIVE$", as_drive, "$PATH$", as_remotePath, "$ERROR$", Err.Number & " - " & Err.Description))
End Function

Private Function NetworkDriveExists(ByRef ao_WshNetwork As Object, ByVal as_drive As String) As Boolean
On Error GoTo ErrorHandler

    Dim lo_Drives As Object
    Dim ll_Index As Long
    NetworkDriveExists = False
    
    Set lo_Drives = ao_WshNetwork.EnumNetworkDrives
    For ll_Index = 0 To lo_Drives.Count - 1 Step 2
        If lo_Drives.Item(ll_Index) = as_drive Then
            ' drive exists
            NetworkDriveExists = True
            Exit Function
        End If
    Next

    Exit Function
ErrorHandler:
    Call ErrorHandler("NetworkDriveExists")
End Function

Private Function LoadBaeurerReferenceText(ByVal ae_Reference As eDPCBaeurerReference, ByVal as_Code As String, Optional ByVal av_Param As Variant = Empty) As String
On Error GoTo ErrHandler

Dim lo_Baeurer As New DPC_Interface
Dim ls_Text As String

  LoadBaeurerReferenceText = ""
  Set lo_Baeurer.Tools = mo_Tools
  Set lo_Baeurer.ArmDb = mo_Db
  lo_Baeurer.U_Code = ml_U_Code
  Call lo_Baeurer.Load_A_COM
  If lo_Baeurer.Bae_LoadBaeurerReferenceText(ae_Reference, as_Code, av_Param, ls_Text) Then
    LoadBaeurerReferenceText = ls_Text
  Else
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9849, "#Record not found")
  End If
  Call lo_Baeurer.Unload_A_COM
  Set lo_Baeurer = Nothing
  Exit Function
ErrHandler:
  Call ErrorHandler("LoadBaeurerReferenceText")
End Function


Private Sub txt_LEN_BaeKonto_Change()
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  mb_CurrentTextBoxChanged = True
  Exit Sub
ErrHandler:
  Call ErrorMessage("txt_LEN_BaeKonto_Change")
End Sub

Private Sub txt_LEN_BaeKonto_Validate(Cancel As Boolean)
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  If Not mb_CurrentTextBoxChanged Then Exit Sub
  
  Call mo_Tools.LockScreen(Me, True)
  mb_InternalInit = True
  
  
  txt_LEN_BaeKontoDesc.Text = LoadBaeurerReferenceText(eDPCBaeurerReference.brKonto, Val(txt_LEN_BaeKonto.Text))
  
  mb_InternalInit = False
  mb_CurrentTextBoxChanged = False
  Call mo_Tools.LockScreen(Me, False)
  Exit Sub
ErrHandler:
  Call ErrorMessage("txt_LEN_BaeKonto_Validate")
End Sub
