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 
   ClientHeight    =   11820
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   17250
   ScaleHeight     =   11820
   ScaleWidth      =   17250
   Begin VB.Frame fra_MainItem 
      Caption         =   "Labeling Main"
      Height          =   372
      Index           =   11
      Left            =   120
      TabIndex        =   586
      Top             =   5160
      Width           =   1332
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   11
         Left            =   240
         TabIndex        =   588
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   11
         Left            =   0
         TabIndex        =   587
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   11
         Left            =   120
         TabIndex        =   589
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   11
         Left            =   120
         TabIndex        =   590
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   11
         Left            =   2040
         TabIndex        =   591
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   11
         Left            =   2040
         TabIndex        =   592
         Tag             =   "grd_M_Lab"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Labeling Detail"
      Height          =   372
      Index           =   11
      Left            =   13800
      TabIndex        =   577
      Top             =   5040
      Width           =   1452
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   11
         Left            =   6120
         MaxLength       =   30
         TabIndex        =   376
         Tag             =   "PRD_CodeAMC"
         Top             =   3240
         Width           =   2412
      End
      Begin VB.TextBox txt_LAB_PRD_Code 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   374
         Tag             =   "PRD_Code"
         Top             =   2760
         Width           =   1935
      End
      Begin VB.TextBox txt_LAB_PRD_Desc 
         Height          =   735
         Left            =   2400
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   373
         Tag             =   "PRD_Desc"
         Top             =   1920
         Width           =   8175
      End
      Begin VB.TextBox txt_LAB_Order 
         Height          =   405
         Left            =   10080
         TabIndex        =   372
         Tag             =   "LAB_Order®©N"
         Top             =   1440
         Width           =   495
      End
      Begin VB.TextBox txt_LAB_PRD_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   80
         TabIndex        =   371
         Tag             =   "PRD_Name"
         Top             =   1440
         Width           =   6255
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   11
         Left            =   10800
         TabIndex        =   578
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   480
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.TextBox txt_LAB_PRD_CodeC 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   375
         Tag             =   "PRD_CodeC"
         Top             =   3240
         Width           =   1935
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   11
         Left            =   240
         TabIndex        =   370
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   11
         Left            =   2400
         TabIndex        =   377
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   3720
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   11
         Left            =   10800
         TabIndex        =   581
         TabStop         =   0   'False
         Top             =   840
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   90
         Left            =   4680
         TabIndex        =   633
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   3360
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   7
         Left            =   360
         TabIndex        =   585
         Tag             =   "lbl_OPT_PRD_Code"
         Top             =   2880
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#LAB Desc"
         Height          =   255
         Index           =   6
         Left            =   360
         TabIndex        =   584
         Tag             =   "lbl_OPT_Desc"
         Top             =   2040
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#LAB Order"
         Height          =   255
         Index           =   5
         Left            =   8880
         TabIndex        =   583
         Tag             =   "lbl_OPT_Order"
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#LAB Name"
         Height          =   255
         Index           =   4
         Left            =   360
         TabIndex        =   582
         Tag             =   "lbl_OPT_Name"
         Top             =   1560
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   3
         Left            =   360
         TabIndex        =   580
         Tag             =   "lbl_OPT_PRD_CodeC"
         Top             =   3360
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   2
         Left            =   360
         TabIndex        =   579
         Tag             =   "lbl_OPT_ERR_Type"
         Top             =   3840
         Width           =   1095
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Surcharge Main"
      Height          =   252
      Index           =   10
      Left            =   120
      TabIndex        =   519
      Top             =   4800
      Width           =   1332
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   10
         Left            =   0
         TabIndex        =   521
         Top             =   840
         Width           =   1575
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   10
         Left            =   240
         TabIndex        =   520
         Top             =   1920
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   10
         Left            =   120
         TabIndex        =   522
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   10
         Left            =   120
         TabIndex        =   523
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   10
         Left            =   2040
         TabIndex        =   524
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   10
         Left            =   2040
         TabIndex        =   525
         Tag             =   "grd_M_Sch"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Surcharge Detail"
      Height          =   255
      Index           =   2
      Left            =   13680
      TabIndex        =   512
      Top             =   1800
      Width           =   1455
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   2
         Left            =   5880
         MaxLength       =   30
         TabIndex        =   119
         Tag             =   "PRD_CodeAMC"
         Top             =   3720
         Width           =   2412
      End
      Begin VB.CheckBox chk_SCH_Setup 
         Height          =   255
         Left            =   2400
         TabIndex        =   120
         Tag             =   "SCH_Setup"
         Top             =   4320
         Width           =   255
      End
      Begin VB.TextBox txt_SCH_PRD_CodeC 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   118
         Tag             =   "PRD_CodeC"
         Top             =   3720
         Width           =   1695
      End
      Begin Project1.ArmCombobox cbo_Offer 
         Height          =   345
         Left            =   2400
         TabIndex        =   116
         Tag             =   "DOF_Id®©DOF_Name"
         Top             =   2760
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_SCH_PRD_Code 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   117
         Tag             =   "PRD_Code"
         Top             =   3240
         Width           =   1695
      End
      Begin VB.TextBox txt_SCH_PRD_Desc 
         Height          =   735
         Left            =   2400
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   115
         Tag             =   "PRD_Desc"
         Top             =   1920
         Width           =   8055
      End
      Begin VB.TextBox txt_SCH_Order 
         Height          =   405
         Left            =   9960
         TabIndex        =   114
         Tag             =   "SCH_Order®©N"
         Top             =   1440
         Width           =   495
      End
      Begin VB.TextBox txt_SCH_PRD_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   80
         TabIndex        =   113
         Tag             =   "PRD_Name"
         Top             =   1440
         Width           =   6255
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   2
         Left            =   9960
         TabIndex        =   513
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   240
         Visible         =   0   'False
         Width           =   975
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   2
         Left            =   240
         TabIndex        =   112
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   10
         Left            =   2400
         TabIndex        =   121
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   4680
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   2
         Left            =   9960
         TabIndex        =   514
         TabStop         =   0   'False
         Top             =   600
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   51
         Left            =   4440
         TabIndex        =   624
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   3840
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SCH Setup"
         Height          =   255
         Index           =   8
         Left            =   360
         TabIndex        =   593
         Tag             =   "lbl_SCH_Setup"
         Top             =   4320
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   240
         Left            =   360
         TabIndex        =   575
         Tag             =   "lbl_SCH_ERR_Type"
         Top             =   4800
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   217
         Left            =   360
         TabIndex        =   563
         Tag             =   "lbl_SCH_PRD_CodeC"
         Top             =   3840
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DOF Id"
         Height          =   255
         Index           =   89
         Left            =   360
         TabIndex        =   526
         Tag             =   "lbl_SCH_DOF_Id"
         Top             =   2760
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   87
         Left            =   360
         TabIndex        =   518
         Tag             =   "lbl_SCH_PRD_Code"
         Top             =   3360
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SCH Desc"
         Height          =   255
         Index           =   86
         Left            =   360
         TabIndex        =   517
         Tag             =   "lbl_SCH_Desc"
         Top             =   2040
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SCH Order"
         Height          =   255
         Index           =   88
         Left            =   8760
         TabIndex        =   516
         Tag             =   "lbl_SCH_Order"
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SCH Name"
         Height          =   255
         Index           =   85
         Left            =   360
         TabIndex        =   515
         Tag             =   "lbl_SCH_Name"
         Top             =   1560
         Width           =   1935
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Option Detail"
      Height          =   252
      Index           =   10
      Left            =   13800
      TabIndex        =   505
      Top             =   4680
      Width           =   1092
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   10
         Left            =   6000
         MaxLength       =   30
         TabIndex        =   355
         Tag             =   "PRD_CodeAMC"
         Top             =   3240
         Width           =   2412
      End
      Begin VB.TextBox txt_OPT_PRD_CodeC 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   354
         Tag             =   "PRD_CodeC"
         Top             =   3240
         Width           =   1935
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   10
         Left            =   10320
         TabIndex        =   506
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   480
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.TextBox txt_OPT_PRD_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   80
         TabIndex        =   350
         Tag             =   "PRD_Name"
         Top             =   1440
         Width           =   5895
      End
      Begin VB.TextBox txt_OPT_Order 
         Height          =   405
         Left            =   9720
         TabIndex        =   351
         Tag             =   "OPT_Order®©N"
         Top             =   1440
         Width           =   495
      End
      Begin VB.TextBox txt_OPT_Desc 
         Height          =   735
         HelpContextID   =   250
         Left            =   2400
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   352
         Tag             =   "PRD_Desc"
         Top             =   1920
         Width           =   7815
      End
      Begin VB.TextBox txt_OPT_PRD_Code 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   353
         Tag             =   "PRD_Code"
         Top             =   2760
         Width           =   1935
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   10
         Left            =   240
         TabIndex        =   349
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   9
         Left            =   2400
         TabIndex        =   356
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   3720
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   10
         Left            =   10320
         TabIndex        =   511
         TabStop         =   0   'False
         Top             =   840
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   84
         Left            =   4680
         TabIndex        =   632
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   3360
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   239
         Left            =   360
         TabIndex        =   574
         Tag             =   "lbl_OPT_ERR_Type"
         Top             =   3840
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   216
         Left            =   360
         TabIndex        =   562
         Tag             =   "lbl_OPT_PRD_CodeC"
         Top             =   3360
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#OPT Name"
         Height          =   255
         Index           =   91
         Left            =   360
         TabIndex        =   510
         Tag             =   "lbl_OPT_Name"
         Top             =   1560
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#OPT Order"
         Height          =   255
         Index           =   93
         Left            =   8400
         TabIndex        =   509
         Tag             =   "lbl_OPT_Order"
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#OPT Desc"
         Height          =   255
         Index           =   92
         Left            =   360
         TabIndex        =   508
         Tag             =   "lbl_OPT_Desc"
         Top             =   2040
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   83
         Left            =   360
         TabIndex        =   507
         Tag             =   "lbl_OPT_PRD_Code"
         Top             =   2880
         Width           =   1335
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Option Main"
      Height          =   252
      Index           =   9
      Left            =   120
      TabIndex        =   498
      Top             =   4440
      Width           =   1212
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   9
         Left            =   240
         TabIndex        =   500
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   9
         Left            =   0
         TabIndex        =   499
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   9
         Left            =   120
         TabIndex        =   501
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   9
         Left            =   120
         TabIndex        =   502
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   9
         Left            =   2040
         TabIndex        =   503
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   9
         Left            =   2040
         TabIndex        =   504
         Tag             =   "grd_M_Opt"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Packing Main"
      Height          =   252
      Index           =   8
      Left            =   120
      TabIndex        =   491
      Top             =   4080
      Width           =   1332
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   8
         Left            =   0
         TabIndex        =   493
         Top             =   840
         Width           =   1575
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   8
         Left            =   240
         TabIndex        =   492
         Top             =   1920
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   8
         Left            =   120
         TabIndex        =   494
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   8
         Left            =   120
         TabIndex        =   495
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   8
         Left            =   2040
         TabIndex        =   496
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   8
         Left            =   2040
         TabIndex        =   497
         Tag             =   "grd_M_Pck"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "VentType Detail"
      Height          =   255
      Index           =   4
      Left            =   13800
      TabIndex        =   462
      Top             =   2520
      Width           =   1575
      Begin VB.TextBox txt_CUT_VET_CADFile 
         Height          =   375
         Left            =   6000
         MaxLength       =   50
         TabIndex        =   651
         Tag             =   "CUT_CADFile"
         Top             =   4680
         Width           =   4935
      End
      Begin VB.TextBox txt_CUT_VET_BaeType 
         Height          =   375
         Left            =   2400
         TabIndex        =   649
         Tag             =   "CUT_BaeType®©N®©lbl_CUT_BaeType"
         Top             =   4680
         Width           =   1695
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   4
         Left            =   6000
         MaxLength       =   30
         TabIndex        =   183
         Tag             =   "PRD_CodeAMC"
         Top             =   2760
         Width           =   2412
      End
      Begin VB.TextBox txt_PRD_VET_CodeC 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   180
         Tag             =   "PRD_CodeC"
         Top             =   3240
         Width           =   1695
      End
      Begin VB.TextBox txt_CUT_VET_MaxK 
         Height          =   375
         Left            =   10080
         TabIndex        =   188
         Tag             =   "CUT_MaxK®©F®©lbl_CUT_VET_MaxK"
         Top             =   3720
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_VET_MaxJ 
         Height          =   375
         Left            =   10080
         TabIndex        =   186
         Tag             =   "CUT_MaxJ®©F®©lbl_CUT_VET_MaxJ"
         Top             =   3240
         Width           =   855
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   4
         Left            =   10800
         TabIndex        =   479
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   360
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.TextBox txt_CUT_VET_Order 
         Height          =   375
         Left            =   10320
         TabIndex        =   177
         Tag             =   "CUT_Order®©N"
         Top             =   1320
         Width           =   495
      End
      Begin VB.TextBox txt_CUT_VET_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   80
         TabIndex        =   176
         Tag             =   "PRD_Name"
         Top             =   1320
         Width           =   6495
      End
      Begin VB.TextBox txt_CUT_VET_Desc 
         Height          =   885
         Left            =   2400
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   178
         Tag             =   "PRD_Desc"
         Top             =   1800
         Width           =   8415
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   9
         Left            =   1320
         TabIndex        =   478
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   5280
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   9
         Left            =   2160
         TabIndex        =   191
         Tag             =   "9©10"
         Top             =   5280
         Width           =   735
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1455
         Index           =   10
         Left            =   240
         ScaleHeight     =   1395
         ScaleWidth      =   2595
         TabIndex        =   477
         Tag             =   "9"
         Top             =   5640
         Width           =   2655
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1575
         Index           =   9
         Left            =   240
         ScaleHeight     =   1515
         ScaleWidth      =   2595
         TabIndex        =   476
         Tag             =   "8"
         Top             =   7680
         Width           =   2655
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   8
         Left            =   1200
         TabIndex        =   475
         TabStop         =   0   'False
         Tag             =   "IMG_IdShp®©N"
         Top             =   7320
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   8
         Left            =   2160
         TabIndex        =   192
         Tag             =   "8©9"
         Top             =   7320
         Width           =   735
      End
      Begin VB.TextBox txt_CUT_VET_MinJ 
         Height          =   375
         Left            =   7560
         TabIndex        =   185
         Tag             =   "CUT_MinJ®©F®©lbl_CUT_VET_MinJ"
         Top             =   3240
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_VET_MinK 
         Height          =   375
         Left            =   7560
         TabIndex        =   187
         Tag             =   "CUT_MinK®©F®©lbl_CUT_VET_MinK"
         Top             =   3720
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_VET_MinL 
         Height          =   375
         Left            =   7560
         TabIndex        =   189
         Tag             =   "CUT_MinL®©F®©lbl_CUT_VET_MinL"
         Top             =   4200
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_VET_MinM 
         Height          =   375
         Left            =   10080
         TabIndex        =   190
         Tag             =   "CUT_MinM®©F®©lbl_CUT_VET_MinM"
         Top             =   4200
         Width           =   855
      End
      Begin VB.TextBox txt_PRD_VET_Code 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   179
         Tag             =   "PRD_Code"
         Top             =   2760
         Width           =   1695
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   4095
         Index           =   1
         Left            =   3120
         TabIndex        =   463
         Top             =   5280
         Width           =   8655
         Begin VB.Frame fra_SubDetailItem 
            Height          =   1815
            Index           =   1
            Left            =   120
            TabIndex        =   465
            Top             =   360
            Width           =   7575
            Begin VB.TextBox txt_CUT_VET_S_Order 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   5760
               TabIndex        =   196
               Tag             =   "CUA_Order®©N"
               Top             =   360
               Width           =   615
            End
            Begin VB.TextBox txt_CUT_VET_J 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   720
               TabIndex        =   193
               Tag             =   "CUA_J®©F®©lbl_CUA_J"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_K 
               Alignment       =   1  'Right Justify
               Height          =   405
               Left            =   720
               TabIndex        =   197
               Tag             =   "CUA_K®©F®©lbl_CUA_K"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_D 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   720
               TabIndex        =   200
               Tag             =   "CUA_D®©F®©lbl_CUA_D"
               Top             =   1320
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_S_MinJ 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   2280
               TabIndex        =   194
               Tag             =   "CUA_JMin®©F®©lbl_CUA_MinJ"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_S_MaxJ 
               Alignment       =   1  'Right Justify
               Height          =   405
               Left            =   3960
               TabIndex        =   195
               Tag             =   "CUA_JMax®©F®©lbl_CUA_MaxJ"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_S_MinK 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   2280
               TabIndex        =   198
               Tag             =   "CUA_KMin®©F®©lbl_CUA_MinK"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_S_MaxK 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   3960
               TabIndex        =   199
               Tag             =   "CUA_KMax®©F®©lbl_CUA_MaxK"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_S_MinD 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   2280
               TabIndex        =   201
               Tag             =   "CUA_DMin®©F®©lbl_CUA_MinD"
               Top             =   1320
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_VET_S_MaxD 
               Alignment       =   1  'Right Justify
               Height          =   405
               Left            =   3960
               TabIndex        =   202
               Tag             =   "CUA_DMax®©F®©lbl_CUA_MaxD"
               Top             =   1320
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Order"
               Height          =   255
               Index           =   186
               Left            =   4920
               TabIndex        =   536
               Tag             =   "lbl_CUA_Order"
               Top             =   480
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#J"
               Height          =   255
               Index           =   169
               Left            =   240
               TabIndex        =   474
               Tag             =   "lbl_CUA_J"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#K"
               Height          =   255
               Index           =   168
               Left            =   240
               TabIndex        =   473
               Tag             =   "lbl_CUA_K"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#D"
               Height          =   255
               Index           =   167
               Left            =   240
               TabIndex        =   472
               Tag             =   "lbl_CUA_D"
               Top             =   1440
               Width           =   255
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinJ"
               Height          =   255
               Index           =   166
               Left            =   1560
               TabIndex        =   471
               Tag             =   "lbl_CUA_MinJ"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxJ"
               Height          =   255
               Index           =   63
               Left            =   3240
               TabIndex        =   470
               Tag             =   "lbl_CUA_MaxJ"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinK"
               Height          =   255
               Index           =   62
               Left            =   1560
               TabIndex        =   469
               Tag             =   "lbl_CUA_MinK"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxK"
               Height          =   255
               Index           =   61
               Left            =   3240
               TabIndex        =   468
               Tag             =   "lbl_CUA_MaxK"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinD"
               Height          =   255
               Index           =   60
               Left            =   1560
               TabIndex        =   467
               Tag             =   "lbl_CUA_MinD"
               Top             =   1440
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxD"
               Height          =   255
               Index           =   59
               Left            =   3240
               TabIndex        =   466
               Tag             =   "lbl_CUA_MaxD"
               Top             =   1440
               Width           =   615
            End
         End
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   375
            Index           =   1
            Left            =   960
            TabIndex        =   464
            TabStop         =   0   'False
            Text            =   "Text1"
            Top             =   240
            Visible         =   0   'False
            Width           =   1575
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   3450
            Index           =   1
            Left            =   7800
            TabIndex        =   204
            Top             =   480
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   4180
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1695
            Index           =   1
            Left            =   120
            TabIndex        =   203
            Tag             =   "grd_SubCua"
            Top             =   2280
            Width           =   7575
            _ExtentX        =   13361
            _ExtentY        =   2990
         End
      End
      Begin Project1.ArmCombobox cbo_Shape 
         Height          =   345
         Index           =   1
         Left            =   2400
         TabIndex        =   182
         Tag             =   "CUT_Shape®©RF_Desc"
         Top             =   4200
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_Perforation 
         Height          =   345
         Index           =   1
         Left            =   2400
         TabIndex        =   181
         Tag             =   "PRF_Id®©PRF_Name"
         Top             =   3720
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   609
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   4
         Left            =   240
         TabIndex        =   175
         Top             =   360
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   3
         Left            =   10080
         TabIndex        =   184
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   2880
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   4
         Left            =   10800
         TabIndex        =   490
         TabStop         =   0   'False
         Top             =   840
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD File"
         Height          =   255
         Index           =   220
         Left            =   4560
         TabIndex        =   650
         Tag             =   "lbl_CUT_CADFile"
         Top             =   4800
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#B7 Type Attribute"
         Height          =   255
         Index           =   219
         Left            =   240
         TabIndex        =   648
         Tag             =   "lbl_CUT_BaeType"
         Top             =   4800
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   53
         Left            =   4560
         TabIndex        =   626
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   2880
         Width           =   1332
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   252
         Index           =   233
         Left            =   8760
         TabIndex        =   568
         Tag             =   "lbl_CUT_VET_ERR_Type"
         Top             =   2880
         Width           =   1212
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   210
         Left            =   240
         TabIndex        =   556
         Tag             =   "lbl_CUT_VET_PRD_CodeC"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 2"
         Height          =   255
         Index           =   189
         Left            =   240
         TabIndex        =   539
         Tag             =   "lbl_CUT_VET_Img2"
         Top             =   7320
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 1"
         Height          =   255
         Index           =   188
         Left            =   240
         TabIndex        =   538
         Tag             =   "lbl_CUT_VET_Img1"
         Top             =   5280
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MaxK"
         Height          =   255
         Index           =   182
         Left            =   8760
         TabIndex        =   532
         Tag             =   "lbl_CUT_VET_MaxK"
         Top             =   3840
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MaxJ"
         Height          =   255
         Index           =   181
         Left            =   8760
         TabIndex        =   531
         Tag             =   "lbl_CUT_VET_MaxJ"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Vent Name"
         Height          =   255
         Index           =   179
         Left            =   240
         TabIndex        =   489
         Tag             =   "lbl_CUT_VET_Name"
         Top             =   1320
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Vent Desc"
         Height          =   255
         Index           =   178
         Left            =   240
         TabIndex        =   488
         Tag             =   "lbl_CUT_VET_Desc"
         Top             =   1800
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Perforation"
         Height          =   255
         Index           =   177
         Left            =   240
         TabIndex        =   487
         Tag             =   "lbl_CUT_VET_Perf"
         Top             =   3840
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT Shape"
         Height          =   255
         Index           =   176
         Left            =   240
         TabIndex        =   486
         Tag             =   "lbl_CUT_VET_Shape"
         Top             =   4320
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Vent Order"
         Height          =   255
         Index           =   175
         Left            =   9000
         TabIndex        =   485
         Tag             =   "lbl_CUT_VET_Order"
         Top             =   1440
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinJ"
         Height          =   255
         Index           =   174
         Left            =   6360
         TabIndex        =   484
         Tag             =   "lbl_CUT_VET_MinJ"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinK"
         Height          =   255
         Index           =   173
         Left            =   6360
         TabIndex        =   483
         Tag             =   "lbl_CUT_VET_MinK"
         Top             =   3840
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinL"
         Height          =   255
         Index           =   172
         Left            =   6360
         TabIndex        =   482
         Tag             =   "lbl_CUT_VET_MinL"
         Top             =   4320
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinM"
         Height          =   255
         Index           =   171
         Left            =   8760
         TabIndex        =   481
         Tag             =   "lbl_CUT_VET_MinM"
         Top             =   4320
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   170
         Left            =   240
         TabIndex        =   480
         Tag             =   "lbl_CUT_VET_PRD_Code"
         Top             =   2880
         Width           =   975
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "CutoutType Detail"
      Height          =   315
      Index           =   5
      Left            =   13845
      TabIndex        =   433
      Top             =   2850
      Width           =   1320
      Begin VB.TextBox txt_CUT_CUT_CADFile 
         Height          =   375
         Left            =   6000
         MaxLength       =   50
         TabIndex        =   655
         Tag             =   "CUT_CADFile"
         Top             =   4680
         Width           =   4815
      End
      Begin VB.TextBox txt_CUT_CUT_BaeType 
         Height          =   375
         Left            =   2400
         TabIndex        =   653
         Tag             =   "CUT_BaeType®©N®©lbl_CUT_BaeType"
         Top             =   4680
         Width           =   1695
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   5
         Left            =   6000
         MaxLength       =   30
         TabIndex        =   214
         Tag             =   "PRD_CodeAMC"
         Top             =   2760
         Width           =   2412
      End
      Begin VB.TextBox txt_CUT_CUT_PRD_CodeC 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   211
         Tag             =   "PRD_CodeC"
         Top             =   3240
         Width           =   1695
      End
      Begin VB.TextBox txt_CUT_CUT_MaxK 
         Height          =   375
         Left            =   9960
         TabIndex        =   219
         Tag             =   "CUT_MaxK®©F®©lbl_CUT_MaxK"
         Top             =   3720
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_CUT_MaxJ 
         Height          =   375
         Left            =   9960
         TabIndex        =   217
         Tag             =   "CUT_MaxJ®©F®©lbl_CUT_MaxJ"
         Top             =   3240
         Width           =   855
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   5
         Left            =   10800
         TabIndex        =   450
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   360
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.TextBox txt_CUT_CUT_Order 
         Height          =   375
         Left            =   10320
         TabIndex        =   208
         Tag             =   "CUT_Order®©N"
         Top             =   1320
         Width           =   495
      End
      Begin VB.TextBox txt_CUT_CUT_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   80
         TabIndex        =   207
         Tag             =   "PRD_Name"
         Top             =   1320
         Width           =   6495
      End
      Begin VB.TextBox txt_CUT_CUT_Desc 
         Height          =   885
         Left            =   2400
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   209
         Tag             =   "PRD_Desc"
         Top             =   1800
         Width           =   8415
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   14
         Left            =   1320
         TabIndex        =   449
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   5400
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   14
         Left            =   2160
         TabIndex        =   222
         Tag             =   "14©15"
         Top             =   5400
         Width           =   735
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1455
         Index           =   15
         Left            =   240
         ScaleHeight     =   1395
         ScaleWidth      =   2595
         TabIndex        =   448
         Tag             =   "14"
         Top             =   5760
         Width           =   2655
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1575
         Index           =   12
         Left            =   240
         ScaleHeight     =   1515
         ScaleWidth      =   2595
         TabIndex        =   447
         Tag             =   "11"
         Top             =   7800
         Width           =   2655
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   11
         Left            =   1200
         TabIndex        =   446
         TabStop         =   0   'False
         Tag             =   "IMG_IdShp®©N"
         Top             =   7440
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   11
         Left            =   2160
         TabIndex        =   223
         Tag             =   "11©12"
         Top             =   7440
         Width           =   735
      End
      Begin VB.TextBox txt_CUT_CUT_MinJ 
         Height          =   375
         Left            =   7560
         TabIndex        =   216
         Tag             =   "CUT_MinJ®©F®©lbl_CUT_MinJ"
         Top             =   3240
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_CUT_MinK 
         Height          =   375
         Left            =   7560
         TabIndex        =   218
         Tag             =   "CUT_MinK®©F®©lbl_CUT_MinK"
         Top             =   3720
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_CUT_MinL 
         Height          =   375
         Left            =   7560
         TabIndex        =   220
         Tag             =   "CUT_MinL®©F®©lbl_CUT_MinL"
         Top             =   4200
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_CUT_MinM 
         Height          =   375
         Left            =   9960
         TabIndex        =   221
         Tag             =   "CUT_MinM®©F®©lbl_CUT_MinM"
         Top             =   4200
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_CUT_PRD_Code 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   210
         Tag             =   "PRD_Code"
         Top             =   2760
         Width           =   1695
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   4095
         Index           =   2
         Left            =   3240
         TabIndex        =   434
         Top             =   5280
         Width           =   8655
         Begin VB.Frame fra_SubDetailItem 
            Height          =   1815
            Index           =   2
            Left            =   120
            TabIndex        =   436
            Top             =   360
            Width           =   7575
            Begin VB.TextBox txt_CUT_CUT_S_Order 
               Height          =   375
               Left            =   6000
               TabIndex        =   239
               Tag             =   "CUA_Order®©N"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_J 
               Height          =   375
               Left            =   720
               TabIndex        =   224
               Tag             =   "CUA_J®©F®©lbl_CUA_J"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_K 
               Height          =   405
               Left            =   720
               TabIndex        =   225
               Tag             =   "CUA_K®©F®©lbl_CUA_K"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_D 
               Height          =   375
               Left            =   720
               TabIndex        =   226
               Tag             =   "CUA_D®©F®©lbl_CUA_D"
               Top             =   1320
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_S_MinJ 
               Height          =   375
               Left            =   2280
               TabIndex        =   227
               Tag             =   "CUA_JMin®©F®©lbl_CUA_MinJ"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_S_MaxJ 
               Height          =   405
               Left            =   3960
               TabIndex        =   233
               Tag             =   "CUA_JMax®©F®©lbL_CUA_MaxJ"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_S_MinK 
               Height          =   375
               Left            =   2280
               TabIndex        =   229
               Tag             =   "CUA_KMin®©F®©lbl_CUA_MinK"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_S_MaxK 
               Height          =   375
               Left            =   3960
               TabIndex        =   235
               Tag             =   "CUA_KMax®©F®©lbl_CUA_MaxK"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_S_MinD 
               Height          =   375
               Left            =   2280
               TabIndex        =   231
               Tag             =   "CUA_DMin®©F®©lbl_CUA_MinD"
               Top             =   1320
               Width           =   735
            End
            Begin VB.TextBox txt_CUT_CUT_S_MaxD 
               Height          =   405
               Left            =   3960
               TabIndex        =   237
               Tag             =   "CUA_DMax®©F®©lbl_CUA_MaxD"
               Top             =   1320
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Order"
               Height          =   255
               Index           =   187
               Left            =   5040
               TabIndex        =   537
               Tag             =   "lbl_CUA_Order"
               Top             =   480
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#J"
               Height          =   255
               Index           =   155
               Left            =   240
               TabIndex        =   445
               Tag             =   "lbl_CUA_J"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#K"
               Height          =   255
               Index           =   154
               Left            =   240
               TabIndex        =   444
               Tag             =   "lbl_CUA_K"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#D"
               Height          =   255
               Index           =   153
               Left            =   240
               TabIndex        =   443
               Tag             =   "lbl_CUA_D"
               Top             =   1440
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinJ"
               Height          =   255
               Index           =   152
               Left            =   1560
               TabIndex        =   442
               Tag             =   "lbl_CUA_MinJ"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxJ"
               Height          =   255
               Index           =   151
               Left            =   3240
               TabIndex        =   441
               Tag             =   "lbL_CUA_MaxJ"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinK"
               Height          =   255
               Index           =   150
               Left            =   1560
               TabIndex        =   440
               Tag             =   "lbl_CUA_MinK"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxK"
               Height          =   255
               Index           =   149
               Left            =   3240
               TabIndex        =   439
               Tag             =   "lbl_CUA_MaxK"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinD"
               Height          =   255
               Index           =   148
               Left            =   1560
               TabIndex        =   438
               Tag             =   "lbl_CUA_MinD"
               Top             =   1440
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxD"
               Height          =   255
               Index           =   147
               Left            =   3240
               TabIndex        =   437
               Tag             =   "lbl_CUA_MaxD"
               Top             =   1440
               Width           =   495
            End
         End
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   375
            Index           =   2
            Left            =   960
            TabIndex        =   435
            TabStop         =   0   'False
            Text            =   "Text1"
            Top             =   240
            Visible         =   0   'False
            Width           =   1575
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   3450
            Index           =   2
            Left            =   7800
            TabIndex        =   230
            Top             =   480
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   4180
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1695
            Index           =   2
            Left            =   120
            TabIndex        =   228
            Tag             =   "grd_SubCua"
            Top             =   2280
            Width           =   7575
            _ExtentX        =   13361
            _ExtentY        =   2990
         End
      End
      Begin Project1.ArmCombobox cbo_Shape 
         Height          =   345
         Index           =   2
         Left            =   2400
         TabIndex        =   213
         Tag             =   "CUT_Shape®©RF_Desc"
         Top             =   4200
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_Perforation 
         Height          =   345
         Index           =   2
         Left            =   2400
         TabIndex        =   212
         Tag             =   "PRF_Id®©PRF_Name"
         Top             =   3720
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   609
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   5
         Left            =   240
         TabIndex        =   206
         Top             =   360
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   4
         Left            =   9960
         TabIndex        =   215
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   2880
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   5
         Left            =   10800
         TabIndex        =   461
         TabStop         =   0   'False
         Top             =   840
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD File"
         Height          =   255
         Index           =   222
         Left            =   4560
         TabIndex        =   654
         Tag             =   "lbl_CUT_CADFile"
         Top             =   4800
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#B7 Type attribute"
         Height          =   255
         Index           =   221
         Left            =   240
         TabIndex        =   652
         Tag             =   "lbl_CUT_BaeType"
         Top             =   4800
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   76
         Left            =   4560
         TabIndex        =   627
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   2880
         Width           =   1332
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   252
         Index           =   234
         Left            =   8760
         TabIndex        =   569
         Tag             =   "lbl_CUT_ERR_Type"
         Top             =   2880
         Width           =   1212
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   211
         Left            =   240
         TabIndex        =   557
         Tag             =   "lbl_CUT_PRD_CodeC"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 2"
         Height          =   255
         Index           =   193
         Left            =   240
         TabIndex        =   543
         Tag             =   "lbl_CUT_Img2"
         Top             =   7440
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 1"
         Height          =   255
         Index           =   192
         Left            =   240
         TabIndex        =   542
         Tag             =   "lbl_CUT_Img1"
         Top             =   5400
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MaxK"
         Height          =   255
         Index           =   184
         Left            =   8760
         TabIndex        =   534
         Tag             =   "lbl_CUT_MaxK"
         Top             =   3840
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MaxJ"
         Height          =   255
         Index           =   183
         Left            =   8760
         TabIndex        =   533
         Tag             =   "lbl_CUT_MaxJ"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT Name"
         Height          =   255
         Index           =   165
         Left            =   240
         TabIndex        =   460
         Tag             =   "lbl_CUT_Name"
         Top             =   1440
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT Desc"
         Height          =   255
         Index           =   164
         Left            =   240
         TabIndex        =   459
         Tag             =   "lbl_CUT_Desc"
         Top             =   1800
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Perforation"
         Height          =   255
         Index           =   163
         Left            =   240
         TabIndex        =   458
         Tag             =   "lbl_CUT_Perf"
         Top             =   3840
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT Shape"
         Height          =   255
         Index           =   162
         Left            =   240
         TabIndex        =   457
         Tag             =   "lbl_CUT_Shape"
         Top             =   4320
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT Order"
         Height          =   255
         Index           =   161
         Left            =   9000
         TabIndex        =   456
         Tag             =   "lbl_CUT_Order"
         Top             =   1440
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinJ"
         Height          =   255
         Index           =   160
         Left            =   6240
         TabIndex        =   455
         Tag             =   "lbl_CUT_MinJ"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinK"
         Height          =   255
         Index           =   159
         Left            =   6240
         TabIndex        =   454
         Tag             =   "lbl_CUT_MinK"
         Top             =   3840
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinL"
         Height          =   255
         Index           =   158
         Left            =   6240
         TabIndex        =   453
         Tag             =   "lbl_CUT_MinL"
         Top             =   4320
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinM"
         Height          =   255
         Index           =   157
         Left            =   8760
         TabIndex        =   452
         Tag             =   "lbl_CUT_MinM"
         Top             =   4320
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   156
         Left            =   240
         TabIndex        =   451
         Tag             =   "lbl_CUT_PRD_Code"
         Top             =   2880
         Width           =   975
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Inlay Detail"
      Height          =   255
      Index           =   8
      Left            =   13920
      TabIndex        =   386
      Top             =   3960
      Width           =   1095
      Begin VB.TextBox txt_INL_CE 
         Height          =   375
         Left            =   1560
         MaxLength       =   30
         TabIndex        =   306
         Tag             =   "INL_CE®©N"
         Top             =   6600
         Width           =   972
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   8
         Left            =   5160
         MaxLength       =   30
         TabIndex        =   302
         Tag             =   "PRD_CodeAMC"
         Top             =   4680
         Width           =   2292
      End
      Begin Project1.ArmCombobox cbo_INL_Purch 
         Height          =   345
         Left            =   1560
         TabIndex        =   305
         Tag             =   "INL_Purch®©INL_PurchDesc"
         Top             =   6120
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_INL_PRD_CodeC 
         Height          =   405
         Left            =   1560
         MaxLength       =   30
         TabIndex        =   301
         Tag             =   "PRD_CodeC"
         Top             =   4680
         Width           =   2295
      End
      Begin Project1.ArmCombobox cbo_INL_Type 
         Height          =   345
         Left            =   1560
         TabIndex        =   297
         Tag             =   "INL_Type®©INL_TypeDesc"
         Top             =   2880
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_INL_Cust 
         Height          =   255
         Left            =   1560
         TabIndex        =   299
         Tag             =   "INL_IsCus"
         Top             =   3840
         Width           =   495
      End
      Begin VB.TextBox txt_INL_PRD_Code 
         Height          =   375
         Left            =   1560
         MaxLength       =   30
         TabIndex        =   300
         Tag             =   "PRD_Code"
         Top             =   4200
         Width           =   2295
      End
      Begin VB.TextBox txt_INL_Vend 
         Height          =   405
         Left            =   1560
         MaxLength       =   50
         TabIndex        =   298
         Tag             =   "INL_Vend"
         Top             =   3360
         Width           =   4575
      End
      Begin VB.TextBox txt_INL_Order 
         Height          =   375
         Left            =   10320
         TabIndex        =   295
         Tag             =   "INL_Order®©N"
         Top             =   1320
         Width           =   495
      End
      Begin VB.TextBox txt_INL_Desc 
         Height          =   795
         Left            =   1560
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   296
         Tag             =   "PRD_Desc"
         Top             =   1800
         Width           =   9255
      End
      Begin VB.TextBox txt_INL_Name 
         Height          =   375
         Left            =   1560
         MaxLength       =   80
         TabIndex        =   294
         Tag             =   "PRD_Name"
         Top             =   1320
         Width           =   7335
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   2295
         Index           =   14
         Left            =   7560
         ScaleHeight     =   2235
         ScaleWidth      =   3195
         TabIndex        =   308
         Tag             =   "13"
         Top             =   3240
         Width           =   3255
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   13
         Left            =   10080
         TabIndex        =   307
         Tag             =   "13©14"
         Top             =   2880
         Width           =   735
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   13
         Left            =   9120
         TabIndex        =   390
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   2880
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   8
         Left            =   10320
         TabIndex        =   388
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   240
         Visible         =   0   'False
         Width           =   975
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   8
         Left            =   240
         TabIndex        =   293
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   7
         Left            =   1560
         TabIndex        =   303
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   5160
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_INL_Deliv 
         Height          =   345
         Left            =   1560
         TabIndex        =   304
         Tag             =   "INL_Deliv®©INL_DelivDesc"
         Top             =   5640
         Width           =   4575
         _ExtentX        =   8070
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   8
         Left            =   10320
         TabIndex        =   389
         TabStop         =   0   'False
         Top             =   600
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#INL CE"
         Height          =   252
         Index           =   203
         Left            =   240
         TabIndex        =   635
         Tag             =   "lbl_INL_CE"
         Top             =   6720
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   81
         Left            =   3960
         TabIndex        =   630
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   4800
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#INL Purch"
         Height          =   252
         Index           =   48
         Left            =   240
         TabIndex        =   6
         Tag             =   "lbl_INL_Purch"
         Top             =   6240
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#INL Deliv"
         Height          =   255
         Index           =   47
         Left            =   240
         TabIndex        =   38
         Tag             =   "lbl_INL_Deliv"
         Top             =   5760
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   237
         Left            =   240
         TabIndex        =   572
         Tag             =   "lbl_INL_ERR_Type"
         Top             =   5280
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   214
         Left            =   240
         TabIndex        =   560
         Tag             =   "lbl_INL_PRD_CodeC"
         Top             =   4800
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image"
         Height          =   255
         Index           =   201
         Left            =   7560
         TabIndex        =   550
         Tag             =   "lbl_INL_Img"
         Top             =   2880
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   111
         Left            =   240
         TabIndex        =   414
         Tag             =   "lbl_INL_PRD_Code"
         Top             =   4320
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Inlay Custom"
         Height          =   255
         Index           =   119
         Left            =   240
         TabIndex        =   396
         Tag             =   "lbl_INL_Cust"
         Top             =   3840
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Inlay Vendor"
         Height          =   255
         Index           =   118
         Left            =   240
         TabIndex        =   395
         Tag             =   "lbl_INL_Vend"
         Top             =   3480
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Inlay Type"
         Height          =   255
         Index           =   117
         Left            =   240
         TabIndex        =   394
         Tag             =   "lbl_INL_Type"
         Top             =   3000
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Inlay Order"
         Height          =   255
         Index           =   116
         Left            =   9000
         TabIndex        =   393
         Tag             =   "lbl_INL_Order"
         Top             =   1440
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Inlay Desc"
         Height          =   255
         Index           =   115
         Left            =   240
         TabIndex        =   392
         Tag             =   "lbl_INL_Desc"
         Top             =   1920
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Inlay Name"
         Height          =   255
         Index           =   114
         Left            =   240
         TabIndex        =   391
         Tag             =   "lbl_INL_Name"
         Top             =   1440
         Width           =   1215
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Inlay Main"
      Height          =   252
      Index           =   7
      Left            =   120
      TabIndex        =   379
      Top             =   3720
      Width           =   1212
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   7
         Left            =   240
         TabIndex        =   385
         Top             =   2040
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   735
         Index           =   7
         Left            =   120
         TabIndex        =   382
         Top             =   600
         Width           =   2655
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   7
         Left            =   3120
         TabIndex        =   380
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1335
         Index           =   7
         Left            =   3120
         TabIndex        =   381
         Tag             =   "grd_M_Inl"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   3625
         _ExtentY        =   2566
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   7
         Left            =   120
         TabIndex        =   383
         Top             =   1440
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   7
         Left            =   120
         TabIndex        =   384
         Top             =   1920
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Gasket Detail"
      Height          =   255
      Index           =   7
      Left            =   13920
      TabIndex        =   357
      Top             =   3600
      Width           =   1455
      Begin VB.TextBox txt_GSK_ShortDescRankweil 
         Height          =   375
         Left            =   2760
         MaxLength       =   50
         TabIndex        =   665
         Tag             =   "PRD_ShortDescRankweil"
         Top             =   7080
         Width           =   4935
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   7
         Left            =   4920
         MaxLength       =   30
         TabIndex        =   282
         Tag             =   "PRD_CodeAMC"
         Top             =   5160
         Width           =   2052
      End
      Begin VB.CheckBox chk_GSK_IsCus 
         Height          =   255
         Left            =   1800
         TabIndex        =   285
         Tag             =   "GSK_IsCus"
         Top             =   6600
         Width           =   615
      End
      Begin VB.TextBox txt_GSK_PRD_CodeC 
         Height          =   375
         Left            =   1800
         MaxLength       =   30
         TabIndex        =   281
         Tag             =   "PRD_CodeC"
         Top             =   5160
         Width           =   1815
      End
      Begin VB.TextBox txt_GSK_PRD_Code 
         Height          =   375
         Left            =   1800
         MaxLength       =   30
         TabIndex        =   280
         Tag             =   "PRD_Code"
         Top             =   4680
         Width           =   1815
      End
      Begin VB.TextBox txt_GSK_LEV_Id 
         Height          =   375
         Left            =   1800
         TabIndex        =   284
         Tag             =   "LEV_Id®©N"
         Top             =   6120
         Width           =   975
      End
      Begin VB.TextBox txt_GSK_PU 
         Height          =   375
         Left            =   1800
         TabIndex        =   279
         Tag             =   "GSK_PU®©N"
         Top             =   4200
         Width           =   975
      End
      Begin VB.TextBox txt_GSK_Wght 
         Height          =   375
         Left            =   1800
         TabIndex        =   278
         Tag             =   "GSK_Wght®©F"
         Top             =   3720
         Width           =   975
      End
      Begin VB.TextBox txt_GSK_Gap 
         Height          =   375
         Left            =   1800
         TabIndex        =   277
         Tag             =   "GSK_Gap®©F"
         Top             =   3240
         Width           =   975
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   2295
         Index           =   13
         Left            =   7080
         ScaleHeight     =   2235
         ScaleWidth      =   3195
         TabIndex        =   365
         Tag             =   "12"
         Top             =   3600
         Width           =   3255
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   12
         Left            =   9480
         TabIndex        =   286
         Tag             =   "12©13"
         Top             =   3240
         Width           =   855
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   12
         Left            =   8400
         TabIndex        =   364
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   3240
         Visible         =   0   'False
         Width           =   615
      End
      Begin VB.TextBox txt_GSK_Order 
         Height          =   405
         Left            =   9720
         TabIndex        =   274
         Tag             =   "GSK_Order®©N"
         Top             =   1320
         Width           =   615
      End
      Begin VB.TextBox txt_GSK_Desc 
         Height          =   885
         Left            =   1800
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   275
         Tag             =   "PRD_Desc"
         Top             =   1800
         Width           =   8535
      End
      Begin VB.TextBox txt_GSK_Name 
         Height          =   405
         Left            =   1800
         MaxLength       =   80
         TabIndex        =   273
         Tag             =   "PRD_Name"
         Top             =   1320
         Width           =   6015
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   7
         Left            =   10440
         TabIndex        =   358
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   240
         Visible         =   0   'False
         Width           =   975
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   7
         Left            =   240
         TabIndex        =   272
         Top             =   360
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_GasketType 
         Height          =   345
         Index           =   0
         Left            =   1800
         TabIndex        =   276
         Tag             =   "GSK_Type®©RF_Desc"
         Top             =   2760
         Width           =   2775
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   6
         Left            =   1800
         TabIndex        =   283
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   5640
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   7
         Left            =   10440
         TabIndex        =   359
         TabStop         =   0   'False
         Top             =   720
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket Short Desc Rankweil"
         Height          =   255
         Index           =   225
         Left            =   240
         TabIndex        =   664
         Tag             =   "lbl_GTD_ShortDescRankweil"
         Top             =   7200
         Width           =   2415
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   80
         Left            =   3720
         TabIndex        =   629
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   5280
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   236
         Left            =   240
         TabIndex        =   571
         Tag             =   "lbl_GTD_ERR_Type"
         Top             =   5760
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is Cus"
         Height          =   255
         Index           =   13
         Left            =   240
         TabIndex        =   564
         Tag             =   "lbl_GTD_IsCus"
         Top             =   6720
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   213
         Left            =   240
         TabIndex        =   559
         Tag             =   "lbl_GTD_PRD_CodeC"
         Top             =   5280
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image"
         Height          =   255
         Index           =   200
         Left            =   7080
         TabIndex        =   549
         Tag             =   "lbl_GTD_Img"
         Top             =   3240
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   113
         Left            =   240
         TabIndex        =   378
         Tag             =   "lbl_GTD_PRD_Code"
         Top             =   4800
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#LEV ID"
         Height          =   255
         Index           =   112
         Left            =   240
         TabIndex        =   369
         Tag             =   "lbl_LEV_Id"
         Top             =   6240
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket PU"
         Height          =   255
         Index           =   110
         Left            =   240
         TabIndex        =   368
         Tag             =   "lbl_GTD_PU"
         Top             =   4320
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket Weight"
         Height          =   255
         Index           =   109
         Left            =   240
         TabIndex        =   367
         Tag             =   "lbl_GTD_Weight"
         Top             =   3840
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket Gap"
         Height          =   255
         Index           =   108
         Left            =   240
         TabIndex        =   366
         Tag             =   "lbl_GTD_Gap"
         Top             =   3360
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket Type"
         Height          =   255
         Index           =   107
         Left            =   240
         TabIndex        =   363
         Tag             =   "lbl_GTD_GTT_Desc"
         Top             =   2880
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket Order"
         Height          =   255
         Index           =   106
         Left            =   8400
         TabIndex        =   362
         Tag             =   "lbl_GTD_Order"
         Top             =   1440
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket Desc"
         Height          =   255
         Index           =   105
         Left            =   240
         TabIndex        =   361
         Tag             =   "lbl_GTD_Desc"
         Top             =   1920
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Gasket Name"
         Height          =   255
         Index           =   104
         Left            =   240
         TabIndex        =   360
         Tag             =   "lbl_GTD_Name"
         Top             =   1440
         Width           =   1215
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Gasket Main"
      Height          =   252
      Index           =   6
      Left            =   120
      TabIndex        =   339
      Top             =   3360
      Width           =   1212
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   6
         Left            =   360
         TabIndex        =   345
         Top             =   2760
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   1455
         Index           =   6
         Left            =   0
         TabIndex        =   340
         Top             =   600
         Width           =   2775
         Begin Project1.ArmCombobox cbo_GasketType_Filter 
            Height          =   345
            Left            =   120
            TabIndex        =   341
            Tag             =   "RF_Code®©RF_Desc"
            Top             =   840
            Width           =   2535
            _ExtentX        =   4471
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#GasketType"
            Height          =   255
            Index           =   103
            Left            =   120
            TabIndex        =   342
            Tag             =   "lbl_GasketType_Filter"
            Top             =   480
            Width           =   1335
         End
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   6
         Left            =   240
         TabIndex        =   343
         Top             =   2160
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   6
         Left            =   240
         TabIndex        =   344
         Top             =   2640
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   6
         Left            =   3120
         TabIndex        =   346
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1335
         Index           =   6
         Left            =   3120
         TabIndex        =   347
         Tag             =   "grd_M_Gsk"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   3625
         _ExtentY        =   2566
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Coating Detail"
      Height          =   315
      Index           =   6
      Left            =   14025
      TabIndex        =   309
      Top             =   3180
      Width           =   1260
      Begin VB.Frame fra_Sifyb_BI_Link 
         Caption         =   "#Sifyb Base Item link"
         Height          =   1680
         Index           =   0
         Left            =   8460
         TabIndex        =   656
         Top             =   3015
         Width           =   6780
         Begin Project1.ArmCombobox cbo_BI_Colour 
            Height          =   345
            Left            =   1965
            TabIndex        =   657
            Tag             =   "Colour_Code®©Colour_Desc"
            Top             =   270
            Width           =   4560
            _ExtentX        =   8043
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_BI_Surface 
            Height          =   345
            Left            =   1965
            TabIndex        =   659
            Tag             =   "SF_Code®©SF_Desc"
            Top             =   615
            Width           =   4560
            _ExtentX        =   8043
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Surface"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   224
            Left            =   75
            TabIndex        =   660
            Tag             =   "lbl_BI_Surface"
            Top             =   690
            Width           =   1455
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Colour"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   223
            Left            =   75
            TabIndex        =   658
            Tag             =   "lbl_BI_Colour"
            Top             =   345
            Width           =   1455
         End
      End
      Begin VB.TextBox txt_COA_CE 
         Height          =   375
         Left            =   1560
         TabIndex        =   637
         Tag             =   "COA_CE®©N"
         Top             =   5880
         Width           =   1212
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   6
         Left            =   5880
         MaxLength       =   30
         TabIndex        =   264
         Tag             =   "PRD_CodeAMC"
         Top             =   3105
         Width           =   2412
      End
      Begin VB.TextBox txt_COA_PRD_CodeC 
         Height          =   375
         Left            =   1560
         MaxLength       =   30
         TabIndex        =   263
         Tag             =   "PRD_CodeC"
         Top             =   3120
         Width           =   2175
      End
      Begin Project1.ArmCombobox cbo_CoatingMat 
         Height          =   345
         Left            =   1560
         TabIndex        =   259
         Tag             =   "COA_MAT®©COA_MAT_Desc"
         Top             =   4320
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Coating_IsCus 
         Height          =   255
         Left            =   1560
         TabIndex        =   267
         Tag             =   "COA_IsCus"
         Top             =   5520
         Width           =   1095
      End
      Begin Project1.ArmCombobox cbo_CoatingOther 
         Height          =   345
         Left            =   5880
         TabIndex        =   265
         Tag             =   "COA_Other®©COA_Other_Desc"
         Top             =   3825
         Width           =   2415
         _ExtentX        =   3836
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_CoatingApp 
         Height          =   345
         Left            =   5880
         TabIndex        =   266
         Tag             =   "COA_App®©COA_App_Desc"
         Top             =   4305
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_COA_PRD_Code 
         Height          =   375
         Left            =   1560
         MaxLength       =   30
         TabIndex        =   262
         Tag             =   "PRD_Code"
         Top             =   2640
         Width           =   2175
      End
      Begin VB.TextBox txt_COA_Order 
         Height          =   375
         Left            =   9720
         TabIndex        =   261
         Tag             =   "COA_Order®©N"
         Top             =   1200
         Width           =   495
      End
      Begin VB.TextBox txt_COA_Desc 
         Height          =   855
         Left            =   1560
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   257
         Tag             =   "PRD_Desc"
         Top             =   1680
         Width           =   8655
      End
      Begin VB.TextBox txt_COA_Name 
         Height          =   405
         Left            =   1560
         MaxLength       =   80
         TabIndex        =   256
         Tag             =   "PRD_Name"
         Top             =   1200
         Width           =   6735
      End
      Begin Project1.ArmCombobox cbo_CoatingType 
         Height          =   345
         Left            =   1560
         TabIndex        =   258
         Tag             =   "COA_Type®©COA_Type_Desc"
         Top             =   3840
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   6
         Left            =   10200
         TabIndex        =   310
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   240
         Visible         =   0   'False
         Width           =   975
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   6
         Left            =   240
         TabIndex        =   255
         Top             =   360
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   5
         Left            =   1560
         TabIndex        =   260
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   4920
         Width           =   1575
         _ExtentX        =   1931
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   6
         Left            =   10200
         TabIndex        =   311
         TabStop         =   0   'False
         Top             =   600
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#COA CE"
         Height          =   252
         Index           =   204
         Left            =   240
         TabIndex        =   636
         Tag             =   "lbl_COA_CE"
         Top             =   6000
         Width           =   1212
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   255
         Index           =   78
         Left            =   4080
         TabIndex        =   628
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   3225
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   235
         Left            =   240
         TabIndex        =   570
         Tag             =   "lbl_COA_ERR_Type"
         Top             =   5040
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   212
         Left            =   240
         TabIndex        =   558
         Tag             =   "lbl_COA_PRD_CodeC"
         Top             =   3240
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   136
         Left            =   240
         TabIndex        =   413
         Tag             =   "lbl_COA_PRD_Code"
         Top             =   2760
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Custom"
         Height          =   255
         Index           =   102
         Left            =   240
         TabIndex        =   338
         Tag             =   "lbl_COA_IsCus"
         Top             =   5520
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Color norm"
         Height          =   255
         Index           =   101
         Left            =   4080
         TabIndex        =   336
         Tag             =   "lbl_COA_Other"
         Top             =   3945
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Application"
         Height          =   255
         Index           =   100
         Left            =   4080
         TabIndex        =   334
         Tag             =   "lbl_COA_App"
         Top             =   4425
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#COA Type"
         Height          =   255
         Index           =   99
         Left            =   240
         TabIndex        =   332
         Tag             =   "lbl_COA_Type"
         Top             =   3960
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Coating Order"
         Height          =   255
         Index           =   98
         Left            =   8400
         TabIndex        =   316
         Tag             =   "lbl_COA_Order"
         Top             =   1320
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Coating Desc"
         Height          =   255
         Index           =   97
         Left            =   240
         TabIndex        =   314
         Tag             =   "lbl_COA_Desc"
         Top             =   1800
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Coating Name"
         Height          =   255
         Index           =   96
         Left            =   240
         TabIndex        =   313
         Tag             =   "lbl_COA_Name"
         Top             =   1320
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Material"
         Height          =   255
         Index           =   94
         Left            =   240
         TabIndex        =   312
         Tag             =   "lbl_COA_MAT"
         Top             =   4440
         Width           =   1215
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Coating Main"
      Height          =   252
      Index           =   5
      Left            =   120
      TabIndex        =   287
      Top             =   3000
      Width           =   1332
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   5
         Left            =   360
         TabIndex        =   322
         Top             =   2760
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   1455
         Index           =   5
         Left            =   0
         TabIndex        =   288
         Top             =   600
         Width           =   2775
         Begin Project1.ArmCombobox cbo_CoatingType_Filter 
            Height          =   345
            Left            =   120
            TabIndex        =   289
            Tag             =   "COA_Type®©COA_Type_Desc"
            Top             =   840
            Width           =   2535
            _ExtentX        =   4471
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#CoatingType"
            Height          =   255
            Index           =   95
            Left            =   120
            TabIndex        =   290
            Tag             =   "lbl_CoatingType_Filter"
            Top             =   480
            Width           =   1335
         End
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   5
         Left            =   3240
         TabIndex        =   291
         Top             =   360
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1335
         Index           =   5
         Left            =   3240
         TabIndex        =   292
         Tag             =   "grd_M_Coa"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   3625
         _ExtentY        =   2566
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   5
         Left            =   240
         TabIndex        =   317
         Top             =   2160
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   5
         Left            =   240
         TabIndex        =   319
         Top             =   2640
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "Packing Detail"
      Height          =   375
      Index           =   9
      Left            =   13920
      TabIndex        =   249
      Top             =   4200
      Width           =   1695
      Begin VB.TextBox txt_PKG_SmallQty 
         Height          =   375
         Left            =   2400
         TabIndex        =   331
         Tag             =   "PKG_SmallQty®©N"
         Top             =   5640
         Width           =   1095
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   9
         Left            =   5880
         MaxLength       =   30
         TabIndex        =   326
         Tag             =   "PRD_CodeAMC"
         Top             =   3240
         Width           =   2172
      End
      Begin VB.TextBox txt_PKG_PalOpt 
         Height          =   375
         Left            =   2400
         TabIndex        =   330
         Tag             =   "PKG_PalOpt®©N"
         Top             =   5160
         Width           =   1095
      End
      Begin VB.TextBox txt_PKG_PakAdd 
         Height          =   375
         Left            =   2400
         TabIndex        =   329
         Tag             =   "PKG_PakAdd®©F"
         Top             =   4680
         Width           =   1095
      End
      Begin VB.TextBox txt_PKG_PalFre 
         Height          =   375
         Left            =   2400
         TabIndex        =   328
         Tag             =   "PKG_PalFre®©F"
         Top             =   4200
         Width           =   1095
      End
      Begin VB.TextBox txt_PKG_MaxWgh 
         Height          =   375
         Left            =   2400
         TabIndex        =   327
         Tag             =   "PKG_MaxWgh®©F"
         Top             =   3720
         Width           =   1095
      End
      Begin VB.TextBox txt_PKG_PRD_CodeC 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   325
         Tag             =   "PRD_CodeC"
         Top             =   3240
         Width           =   2175
      End
      Begin VB.TextBox txt_PKG_PRD_Code 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   324
         Tag             =   "PRD_Code"
         Top             =   2760
         Width           =   2175
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   2295
         Index           =   11
         Left            =   8160
         ScaleHeight     =   2235
         ScaleWidth      =   3195
         TabIndex        =   337
         Top             =   3240
         Width           =   3255
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   10
         Left            =   10680
         TabIndex        =   335
         Tag             =   "10©11"
         Top             =   2880
         Width           =   735
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   10
         Left            =   9960
         TabIndex        =   269
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   2880
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.TextBox txt_PKG_Desc 
         Height          =   735
         Left            =   2400
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   323
         Tag             =   "PRD_Desc"
         Top             =   1920
         Width           =   8055
      End
      Begin VB.TextBox txt_PKG_Order 
         Height          =   405
         Left            =   9960
         TabIndex        =   321
         Tag             =   "PKG_Order®©N"
         Top             =   1440
         Width           =   495
      End
      Begin VB.TextBox txt_PKG_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   80
         TabIndex        =   320
         Tag             =   "PRD_Name"
         Top             =   1440
         Width           =   6135
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   9
         Left            =   10440
         TabIndex        =   251
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   360
         Visible         =   0   'False
         Width           =   975
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   9
         Left            =   240
         TabIndex        =   318
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   8
         Left            =   2400
         TabIndex        =   333
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   6120
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   9
         Left            =   10440
         TabIndex        =   252
         TabStop         =   0   'False
         Top             =   720
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG SmallQty"
         Height          =   252
         Index           =   199
         Left            =   360
         TabIndex        =   634
         Tag             =   "lbl_PKG_SmallQty"
         Top             =   5760
         Width           =   1572
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   82
         Left            =   4680
         TabIndex        =   631
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   3360
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG PalOpt"
         Height          =   255
         Index           =   15
         Left            =   360
         TabIndex        =   599
         Tag             =   "lbl_PKG_PalOpt"
         Top             =   5280
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG PakAdd"
         Height          =   255
         Index           =   14
         Left            =   360
         TabIndex        =   598
         Tag             =   "lbl_PKG_PakAdd"
         Top             =   4800
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG PalFre"
         Height          =   255
         Index           =   12
         Left            =   360
         TabIndex        =   597
         Tag             =   "lbl_PKG_PalFre"
         Top             =   4320
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG MaxWgh"
         Height          =   255
         Index           =   11
         Left            =   360
         TabIndex        =   596
         Tag             =   "lbl_PKG_MaxWgh"
         Top             =   3840
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   252
         Index           =   238
         Left            =   360
         TabIndex        =   573
         Tag             =   "lbl_PKG_ERR_Type"
         Top             =   6240
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   215
         Left            =   360
         TabIndex        =   561
         Tag             =   "lbl_PKG_PRD_CodeC"
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image"
         Height          =   252
         Index           =   202
         Left            =   8160
         TabIndex        =   551
         Tag             =   "lbl_PKG_Img"
         Top             =   2880
         Width           =   972
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   70
         Left            =   360
         TabIndex        =   415
         Tag             =   "lbl_PKG_PRD_Code"
         Top             =   2880
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG Desc"
         Height          =   255
         Index           =   69
         Left            =   360
         TabIndex        =   268
         Tag             =   "lbl_PKG_Desc"
         Top             =   2040
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG Order"
         Height          =   255
         Index           =   68
         Left            =   8760
         TabIndex        =   254
         Tag             =   "lbl_PKG_Order"
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PKG Name"
         Height          =   255
         Index           =   67
         Left            =   360
         TabIndex        =   253
         Tag             =   "lbl_PKG_Name"
         Top             =   1560
         Width           =   1935
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "CutoutType Main"
      Height          =   252
      Index           =   4
      Left            =   120
      TabIndex        =   242
      Top             =   2640
      Width           =   1332
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   4
         Left            =   240
         TabIndex        =   246
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   4
         Left            =   0
         TabIndex        =   243
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   4
         Left            =   120
         TabIndex        =   244
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   4
         Left            =   120
         TabIndex        =   245
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   4
         Left            =   2040
         TabIndex        =   247
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   4
         Left            =   2040
         TabIndex        =   248
         Tag             =   "grd_M_Cut"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "VentType Main"
      Height          =   252
      Index           =   3
      Left            =   120
      TabIndex        =   172
      Top             =   2280
      Width           =   1332
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   3
         Left            =   240
         TabIndex        =   232
         Top             =   1920
         Width           =   1095
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   3
         Left            =   120
         TabIndex        =   173
         Top             =   840
         Width           =   1575
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   3
         Left            =   120
         TabIndex        =   174
         Top             =   1320
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   3
         Left            =   120
         TabIndex        =   205
         Top             =   1800
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   3
         Left            =   2040
         TabIndex        =   234
         Top             =   480
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   3
         Left            =   2040
         TabIndex        =   236
         Tag             =   "grd_M_Vet"
         Top             =   1320
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
   End
   Begin VB.Frame fra_DetailItem 
      Caption         =   "LoudType Detail"
      Height          =   255
      Index           =   3
      Left            =   13800
      TabIndex        =   130
      Top             =   2160
      Width           =   1455
      Begin VB.TextBox txt_CUT_CADFile 
         Height          =   375
         Left            =   6000
         MaxLength       =   50
         TabIndex        =   647
         Tag             =   "CUT_CADFile"
         Top             =   4800
         Width           =   4815
      End
      Begin VB.TextBox txt_CUT_BaeType 
         Height          =   375
         Left            =   2400
         TabIndex        =   645
         Tag             =   "CUT_BaeType®©N®©lbl_CUT_BaeType"
         Top             =   4800
         Width           =   2055
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   3
         Left            =   6000
         MaxLength       =   30
         TabIndex        =   141
         Tag             =   "PRD_CodeAMC"
         Top             =   2880
         Width           =   2412
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   2
         Left            =   9960
         TabIndex        =   143
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   2880
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_CUT_PRD_CodeC 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   138
         Tag             =   "PRD_CodeC"
         Top             =   3360
         Width           =   1695
      End
      Begin VB.TextBox txt_CUT_MaxK 
         Height          =   375
         Left            =   9960
         TabIndex        =   148
         Tag             =   "CUT_MaxK®©F®©lbl_CUT_LSP_MaxK"
         Top             =   3840
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_MaxJ 
         Height          =   375
         Left            =   9960
         TabIndex        =   147
         Tag             =   "CUT_MaxJ®©F®©lbl_CUT_LSP_MaxJ"
         Top             =   3360
         Width           =   855
      End
      Begin VB.Frame fra_SubDetail 
         Height          =   4095
         Index           =   0
         Left            =   3240
         TabIndex        =   421
         Top             =   5400
         Width           =   8655
         Begin VB.TextBox txt_SubDetailKey 
            Height          =   375
            Index           =   0
            Left            =   960
            TabIndex        =   423
            TabStop         =   0   'False
            Text            =   "Text1"
            Top             =   240
            Visible         =   0   'False
            Width           =   1575
         End
         Begin VB.Frame fra_SubDetailItem 
            Height          =   1815
            Index           =   0
            Left            =   120
            TabIndex        =   422
            Top             =   360
            Width           =   7575
            Begin VB.TextBox txt_CUA_Order 
               Alignment       =   1  'Right Justify
               Height          =   405
               Left            =   6120
               TabIndex        =   155
               Tag             =   "CUA_Order®©N"
               Top             =   360
               Width           =   615
            End
            Begin VB.TextBox txt_CUA_MaxD 
               Alignment       =   1  'Right Justify
               Height          =   405
               Left            =   3960
               TabIndex        =   161
               Tag             =   "CUA_DMax®©F®©lbl_CUA_MaxD"
               Top             =   1320
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_MinD 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   2280
               TabIndex        =   160
               Tag             =   "CUA_DMin®©F®©lbl_CUA_MinD"
               Top             =   1320
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_MaxK 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   3960
               TabIndex        =   158
               Tag             =   "CUA_KMax®©F®©lbl_CUA_MaxK"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_MinK 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   2280
               TabIndex        =   157
               Tag             =   "CUA_KMin®©F®©lbl_CUA_MinK"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_MaxJ 
               Alignment       =   1  'Right Justify
               Height          =   405
               Left            =   3960
               TabIndex        =   154
               Tag             =   "CUA_JMax®©F®©lbl_CUA_MaxJ"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_MinJ 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   2280
               TabIndex        =   153
               Tag             =   "CUA_JMin®©F®©lbl_CUA_MinJ"
               Top             =   360
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_D 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   720
               TabIndex        =   159
               Tag             =   "CUA_D®©F®©lbl_CUA_D"
               Top             =   1320
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_K 
               Alignment       =   1  'Right Justify
               Height          =   405
               Left            =   720
               TabIndex        =   156
               Tag             =   "CUA_K®©F®©lbl_CUA_K"
               Top             =   840
               Width           =   735
            End
            Begin VB.TextBox txt_CUA_J 
               Alignment       =   1  'Right Justify
               Height          =   375
               Left            =   720
               TabIndex        =   152
               Tag             =   "CUA_J®©F®©lbl_CUA_J"
               Top             =   360
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#Order"
               Height          =   255
               Index           =   185
               Left            =   5160
               TabIndex        =   535
               Tag             =   "lbl_CUA_Order"
               Top             =   480
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxD"
               Height          =   255
               Index           =   146
               Left            =   3240
               TabIndex        =   432
               Tag             =   "lbl_CUA_MaxD"
               Top             =   1440
               Width           =   735
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinD"
               Height          =   255
               Index           =   145
               Left            =   1560
               TabIndex        =   431
               Tag             =   "lbl_CUA_MinD"
               Top             =   1440
               Width           =   615
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxK"
               Height          =   255
               Index           =   144
               Left            =   3240
               TabIndex        =   430
               Tag             =   "lbl_CUA_MaxK"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinK"
               Height          =   255
               Index           =   143
               Left            =   1560
               TabIndex        =   429
               Tag             =   "lbl_CUA_MinK"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MaxJ"
               Height          =   255
               Index           =   142
               Left            =   3240
               TabIndex        =   428
               Tag             =   "lbl_CUA_MaxJ"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#MinJ"
               Height          =   255
               Index           =   141
               Left            =   1560
               TabIndex        =   427
               Tag             =   "lbl_CUA_MinJ"
               Top             =   480
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#D"
               Height          =   255
               Index           =   140
               Left            =   240
               TabIndex        =   426
               Tag             =   "lbl_CUA_D"
               Top             =   1440
               Width           =   375
            End
            Begin VB.Label lbl_label 
               Caption         =   "#K"
               Height          =   255
               Index           =   139
               Left            =   240
               TabIndex        =   425
               Tag             =   "lbl_CUA_K"
               Top             =   960
               Width           =   495
            End
            Begin VB.Label lbl_label 
               Caption         =   "#J"
               Height          =   255
               Index           =   138
               Left            =   240
               TabIndex        =   424
               Tag             =   "lbl_CUA_J"
               Top             =   480
               Width           =   495
            End
         End
         Begin Project1.ToolbarControl tlb_SubDetail 
            Height          =   3450
            Index           =   0
            Left            =   7800
            TabIndex        =   163
            Top             =   480
            Width           =   690
            _ExtentX        =   1217
            _ExtentY        =   4180
         End
         Begin Project1.ArmGrid grd_SubDetail 
            Height          =   1695
            Index           =   0
            Left            =   120
            TabIndex        =   162
            Tag             =   "grd_SubCua"
            Top             =   2280
            Width           =   7575
            _ExtentX        =   13361
            _ExtentY        =   2990
         End
      End
      Begin VB.TextBox txt_CUT_PRD_Code 
         Height          =   375
         Left            =   2400
         MaxLength       =   30
         TabIndex        =   137
         Tag             =   "PRD_Code"
         Top             =   2880
         Width           =   1695
      End
      Begin VB.TextBox txt_CUT_MinM 
         Height          =   375
         Left            =   9960
         TabIndex        =   149
         Tag             =   "CUT_MinM®©F®©lbl_CUT_LSP_MinM"
         Top             =   4320
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_MinL 
         Height          =   375
         Left            =   7560
         TabIndex        =   146
         Tag             =   "CUT_MinL®©F®©lbl_CUT_LSP_MinL"
         Top             =   4320
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_MinK 
         Height          =   375
         Left            =   7560
         TabIndex        =   145
         Tag             =   "CUT_MinK®©F®©lbl_CUT_LSP_MinK"
         Top             =   3840
         Width           =   855
      End
      Begin VB.TextBox txt_CUT_MinJ 
         Height          =   375
         Left            =   7560
         TabIndex        =   144
         Tag             =   "CUT_MinJ®©F®©lbl_CUT_LSP_MinJ"
         Top             =   3360
         Width           =   855
      End
      Begin Project1.ArmCombobox cbo_Shape 
         Height          =   345
         Index           =   0
         Left            =   2400
         TabIndex        =   140
         Tag             =   "CUT_Shape®©RF_Desc"
         Top             =   4320
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   609
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   7
         Left            =   2160
         TabIndex        =   151
         Tag             =   "7©8"
         Top             =   7560
         Width           =   735
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   7
         Left            =   1200
         TabIndex        =   169
         TabStop         =   0   'False
         Tag             =   "IMG_IdShp®©N"
         Top             =   7560
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1575
         Index           =   8
         Left            =   240
         ScaleHeight     =   1515
         ScaleWidth      =   2595
         TabIndex        =   168
         Tag             =   "7"
         Top             =   7920
         Width           =   2655
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1455
         Index           =   7
         Left            =   240
         ScaleHeight     =   1395
         ScaleWidth      =   2595
         TabIndex        =   167
         Tag             =   "6"
         Top             =   5880
         Width           =   2655
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   6
         Left            =   2160
         TabIndex        =   150
         Tag             =   "6©7"
         Top             =   5520
         Width           =   735
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   6
         Left            =   1200
         TabIndex        =   166
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   5520
         Visible         =   0   'False
         Width           =   495
      End
      Begin Project1.ArmCombobox cbo_Perforation 
         Height          =   345
         Index           =   0
         Left            =   2400
         TabIndex        =   139
         Tag             =   "PRF_Id®©PRF_Name"
         Top             =   3840
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_CUT_Desc 
         Height          =   885
         Left            =   2400
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   136
         Tag             =   "PRD_Desc"
         Top             =   1800
         Width           =   8415
      End
      Begin VB.TextBox txt_CUT_Name 
         Height          =   375
         Left            =   2400
         MaxLength       =   80
         TabIndex        =   134
         Tag             =   "PRD_Name"
         Top             =   1320
         Width           =   6375
      End
      Begin VB.TextBox txt_CUT_Order 
         Height          =   375
         Left            =   10320
         TabIndex        =   135
         Tag             =   "CUT_Order®©N"
         Top             =   1320
         Width           =   495
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   3
         Left            =   10800
         TabIndex        =   131
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   360
         Visible         =   0   'False
         Width           =   975
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   3
         Left            =   240
         TabIndex        =   133
         Top             =   360
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   3
         Left            =   10800
         TabIndex        =   132
         TabStop         =   0   'False
         Top             =   840
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD File"
         Height          =   255
         Index           =   218
         Left            =   4680
         TabIndex        =   646
         Tag             =   "lbl_CUT_CADFile"
         Top             =   4920
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#B7 Type Attribute"
         Height          =   255
         Index           =   208
         Left            =   240
         TabIndex        =   644
         Tag             =   "lbl_CUT_BaeType"
         Top             =   4920
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   52
         Left            =   4560
         TabIndex        =   625
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   3000
         Width           =   1332
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   252
         Index           =   232
         Left            =   8760
         TabIndex        =   567
         Tag             =   "lbl_CUT_LSP_ERR_Type"
         Top             =   3000
         Width           =   1212
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   209
         Left            =   240
         TabIndex        =   555
         Tag             =   "lbl_CUT_LSP_PRD_CodeC"
         Top             =   3480
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 2"
         Height          =   255
         Index           =   191
         Left            =   240
         TabIndex        =   541
         Tag             =   "lbl_CUT_LSP_Img2"
         Top             =   7560
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 1"
         Height          =   255
         Index           =   190
         Left            =   240
         TabIndex        =   540
         Tag             =   "lbl_CUT_LSP_Img1"
         Top             =   5520
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MaxK"
         Height          =   255
         Index           =   180
         Left            =   8760
         TabIndex        =   530
         Tag             =   "lbl_CUT_LSP_MaxK"
         Top             =   3960
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MaxJ"
         Height          =   255
         Index           =   135
         Left            =   8760
         TabIndex        =   529
         Tag             =   "lbl_CUT_LSP_MaxJ"
         Top             =   3480
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   137
         Left            =   240
         TabIndex        =   420
         Tag             =   "lbl_CUT_LSP_PRD_Code"
         Top             =   3000
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinM"
         Height          =   255
         Index           =   74
         Left            =   8760
         TabIndex        =   419
         Tag             =   "lbl_CUT_LSP_MinM"
         Top             =   4440
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinL"
         Height          =   255
         Index           =   73
         Left            =   6240
         TabIndex        =   418
         Tag             =   "lbl_CUT_LSP_MinL"
         Top             =   4440
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinK"
         Height          =   255
         Index           =   72
         Left            =   6240
         TabIndex        =   417
         Tag             =   "lbl_CUT_LSP_MinK"
         Top             =   3960
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT MinJ"
         Height          =   255
         Index           =   71
         Left            =   6240
         TabIndex        =   416
         Tag             =   "lbl_CUT_LSP_MinJ"
         Top             =   3480
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Loud Order"
         Height          =   255
         Index           =   64
         Left            =   9000
         TabIndex        =   238
         Tag             =   "lbl_CUT_LSP_Order"
         Top             =   1440
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CUT Shape"
         Height          =   255
         Index           =   58
         Left            =   240
         TabIndex        =   170
         Tag             =   "lbl_CUT_LSP_Shape"
         Top             =   4320
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Perforation"
         Height          =   255
         Index           =   57
         Left            =   240
         TabIndex        =   165
         Tag             =   "lbl_CUT_Perf"
         Top             =   3960
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Loud Desc"
         Height          =   255
         Index           =   56
         Left            =   240
         TabIndex        =   164
         Tag             =   "lbl_CUT_LSP_Desc"
         Top             =   1920
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Loud Name"
         Height          =   255
         Index           =   55
         Left            =   240
         TabIndex        =   142
         Tag             =   "lbl_CUT_LSP_Name"
         Top             =   1440
         Width           =   1935
      End
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   4
      Left            =   11520
      TabIndex        =   129
      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         =   "LoudType Main"
      Height          =   252
      Index           =   2
      Left            =   120
      TabIndex        =   122
      Top             =   1920
      Width           =   1332
      Begin Project1.ArmGrid grd_Main 
         Height          =   1095
         Index           =   2
         Left            =   2040
         TabIndex        =   128
         Tag             =   "grd_M_LSP"
         Top             =   1560
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1931
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   2
         Left            =   2040
         TabIndex        =   127
         Top             =   720
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   495
         Index           =   2
         Left            =   360
         TabIndex        =   126
         Top             =   1680
         Width           =   1095
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   1095
         Index           =   2
         Left            =   240
         TabIndex        =   125
         Top             =   1560
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   1931
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   2
         Left            =   240
         TabIndex        =   124
         Top             =   1080
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   609
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   375
         Index           =   2
         Left            =   240
         TabIndex        =   123
         Top             =   600
         Width           =   1575
      End
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   3
      Left            =   10800
      TabIndex        =   108
      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         =   "Bending Detail"
      Height          =   375
      Index           =   1
      Left            =   13680
      TabIndex        =   67
      Top             =   1320
      Width           =   1335
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   1
         Left            =   5640
         MaxLength       =   30
         TabIndex        =   623
         Tag             =   "PRD_CodeAMC"
         Top             =   2640
         Width           =   2412
      End
      Begin VB.CheckBox chk_BND_Is 
         Height          =   255
         Index           =   3
         Left            =   10560
         TabIndex        =   613
         Tag             =   "BND_IsF"
         Top             =   2880
         Width           =   255
      End
      Begin VB.CheckBox chk_BND_Is 
         Height          =   255
         Index           =   2
         Left            =   10560
         TabIndex        =   612
         Tag             =   "BND_IsE"
         Top             =   2520
         Width           =   255
      End
      Begin VB.CheckBox chk_BND_Is 
         Height          =   255
         Index           =   1
         Left            =   10560
         TabIndex        =   611
         Tag             =   "BND_IsD"
         Top             =   2160
         Width           =   255
      End
      Begin VB.CheckBox chk_BND_Is 
         Height          =   255
         Index           =   0
         Left            =   10560
         TabIndex        =   610
         Tag             =   "BND_IsC"
         Top             =   1800
         Width           =   255
      End
      Begin VB.TextBox txt_BND_H 
         Height          =   375
         Left            =   10560
         TabIndex        =   609
         Tag             =   "BND_H®©F®©lbl_BND_H"
         Top             =   5040
         Width           =   1215
      End
      Begin VB.TextBox txt_MatFct 
         Height          =   375
         Left            =   8040
         TabIndex        =   606
         Tag             =   "BND_MatFct®©F®©lbl_BND_MatFct"
         Top             =   9120
         Width           =   1095
      End
      Begin VB.CheckBox chk_HasH 
         Height          =   255
         Left            =   10920
         TabIndex        =   602
         Tag             =   "BND_HasH"
         Top             =   5520
         Width           =   255
      End
      Begin VB.CheckBox chk_HasS 
         Height          =   255
         Left            =   9360
         TabIndex        =   601
         Tag             =   "BND_HasS"
         Top             =   5520
         Width           =   255
      End
      Begin VB.CheckBox chk_HasU 
         Height          =   255
         Left            =   7560
         TabIndex        =   600
         Tag             =   "BND_HasU"
         Top             =   5520
         Width           =   255
      End
      Begin VB.CheckBox chk_IsCus 
         Height          =   255
         Left            =   10560
         TabIndex        =   78
         Tag             =   "BND_IsCus"
         Top             =   3720
         Width           =   375
      End
      Begin VB.CheckBox chk_IsLng 
         Height          =   255
         Left            =   10560
         TabIndex        =   77
         Tag             =   "BND_IsLng"
         Top             =   3360
         Width           =   375
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   1
         Left            =   1800
         TabIndex        =   89
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   3600
         Width           =   1695
         _ExtentX        =   2990
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_BND_PRD_CodeC 
         Height          =   375
         Left            =   1800
         MaxLength       =   30
         TabIndex        =   80
         Tag             =   "PRD_CodeC"
         Top             =   3120
         Width           =   1695
      End
      Begin VB.TextBox txt_PRD_Code 
         Height          =   375
         Left            =   1800
         MaxLength       =   30
         TabIndex        =   79
         Tag             =   "PRD_Code"
         Top             =   2640
         Width           =   1695
      End
      Begin VB.TextBox txt_BND_SMax2 
         Height          =   375
         Left            =   10560
         TabIndex        =   104
         Tag             =   "BND_SMax2®©F®©lbl_BND_SMax2"
         Top             =   8520
         Width           =   1215
      End
      Begin VB.TextBox txt_BND_SMin2 
         Height          =   375
         Left            =   8040
         TabIndex        =   103
         Tag             =   "BND_SMin2®©F®©lbl_BND_SMin2"
         Top             =   8520
         Width           =   1095
      End
      Begin VB.TextBox txt_BND_UMax2 
         Height          =   375
         Left            =   10560
         TabIndex        =   102
         Tag             =   "BND_UMax2®©F®©lbl_BND_UMax2"
         Top             =   8040
         Width           =   1215
      End
      Begin VB.TextBox txt_BND_UMin2 
         Height          =   405
         Left            =   8040
         TabIndex        =   101
         Tag             =   "BND_UMin2®©F®©lbl_BND_UMin2"
         Top             =   8040
         Width           =   1095
      End
      Begin VB.TextBox txt_BND_HMax2 
         Height          =   375
         Left            =   10560
         TabIndex        =   100
         Tag             =   "BND_HMax2®©F®©lbl_BND_HMax2"
         Top             =   7560
         Width           =   1215
      End
      Begin VB.TextBox txt_BND_HMin2 
         Height          =   375
         Left            =   8040
         TabIndex        =   99
         Tag             =   "BND_HMin2®©F®©lbl_BND_HMin2"
         Top             =   7560
         Width           =   1095
      End
      Begin VB.TextBox txt_BND_SMax1 
         Height          =   375
         Left            =   10560
         TabIndex        =   98
         Tag             =   "BND_SMax1®©F®©lbl_BND_SMax1"
         Top             =   6840
         Width           =   1215
      End
      Begin VB.TextBox txt_BND_SMin1 
         Height          =   405
         Left            =   8040
         TabIndex        =   97
         Tag             =   "BND_SMin1®©F®©lbl_BND_SMin1"
         Top             =   6840
         Width           =   1095
      End
      Begin VB.TextBox txt_BND_UMax1 
         Height          =   375
         Left            =   10560
         TabIndex        =   96
         Tag             =   "BND_UMax1®©F®©lbl_BND_UMax1"
         Top             =   6360
         Width           =   1215
      End
      Begin VB.TextBox txt_BND_UMin1 
         Height          =   375
         Left            =   8040
         TabIndex        =   95
         Tag             =   "BND_UMin1®©F®©lbl_BND_UMin1"
         Top             =   6360
         Width           =   1095
      End
      Begin VB.TextBox txt_BND_HMax1 
         Height          =   375
         Left            =   10560
         TabIndex        =   94
         Tag             =   "BND_HMax1®©F®©lbl_BND_HMax1"
         Top             =   5880
         Width           =   1215
      End
      Begin VB.TextBox txt_BND_HMin1 
         Height          =   375
         Left            =   8040
         TabIndex        =   93
         Tag             =   "BND_HMin1®©F®©lbl_BND_HMin1"
         Top             =   5880
         Width           =   1095
      End
      Begin VB.TextBox txt_BND_S 
         Height          =   375
         Left            =   8040
         TabIndex        =   92
         Tag             =   "BND_S®©F®©lbl_BND_S"
         Top             =   5040
         Width           =   1095
      End
      Begin VB.TextBox txt_BND_UMax 
         Height          =   375
         Left            =   10560
         TabIndex        =   91
         Tag             =   "BND_UMax®©F®©lbl_BND_UMax"
         Top             =   4560
         Width           =   1215
      End
      Begin VB.TextBox txt_BND_UMin 
         Height          =   375
         Left            =   8040
         TabIndex        =   90
         Tag             =   "BND_UMin®©F®©lbl_BND_UMin"
         Top             =   4560
         Width           =   1095
      End
      Begin VB.TextBox txt_LEV_Id 
         Height          =   375
         Left            =   5640
         TabIndex        =   73
         Tag             =   "LEV_Id®©N®©lbl_LEV_Id"
         Top             =   3120
         Width           =   495
      End
      Begin VB.TextBox txt_BND_Order 
         Height          =   375
         Left            =   8640
         TabIndex        =   72
         Tag             =   "BND_Order®©F"
         Top             =   1200
         Width           =   495
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   5
         Left            =   2520
         TabIndex        =   87
         Tag             =   "5©6"
         Top             =   6600
         Width           =   735
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   4
         Left            =   5640
         TabIndex        =   85
         Tag             =   "4©5"
         Top             =   6600
         Width           =   735
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   5
         Left            =   1800
         TabIndex        =   111
         TabStop         =   0   'False
         Tag             =   "IMG_IdV2®©N"
         Top             =   6600
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   4
         Left            =   4920
         TabIndex        =   110
         TabStop         =   0   'False
         Tag             =   "IMG_IdV®©N"
         Top             =   6600
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1695
         Index           =   6
         Left            =   360
         ScaleHeight     =   1635
         ScaleWidth      =   2835
         TabIndex        =   88
         Tag             =   "5"
         Top             =   6960
         Width           =   2895
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1695
         Index           =   5
         Left            =   3480
         ScaleHeight     =   1635
         ScaleWidth      =   2835
         TabIndex        =   86
         Tag             =   "4"
         Top             =   6960
         Width           =   2895
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   3
         Left            =   2520
         TabIndex        =   83
         Tag             =   "3©4"
         Top             =   4320
         Width           =   735
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   3
         Left            =   1800
         TabIndex        =   109
         TabStop         =   0   'False
         Tag             =   "IMG_Id2®©N"
         Top             =   4320
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1695
         Index           =   4
         Left            =   360
         ScaleHeight     =   1635
         ScaleWidth      =   2835
         TabIndex        =   84
         Tag             =   "3"
         Top             =   4680
         Width           =   2895
      End
      Begin VB.CheckBox chk_CanVisible 
         Height          =   255
         Left            =   8040
         TabIndex        =   76
         Tag             =   "BND_CanVi"
         Top             =   3720
         Width           =   375
      End
      Begin VB.CheckBox chk_IsShortSide 
         Height          =   255
         Left            =   5640
         TabIndex        =   75
         Tag             =   "BND_IsShr"
         Top             =   3720
         Width           =   375
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   2
         Left            =   5640
         TabIndex        =   81
         Tag             =   "2©3"
         Top             =   4320
         Width           =   735
      End
      Begin VB.TextBox txt_ImgId 
         CausesValidation=   0   'False
         Height          =   285
         Index           =   2
         Left            =   5040
         TabIndex        =   107
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   4320
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1695
         Index           =   3
         Left            =   3480
         ScaleHeight     =   1635
         ScaleWidth      =   2835
         TabIndex        =   82
         Tag             =   "2"
         Top             =   4680
         Width           =   2895
      End
      Begin VB.TextBox txt_PRD_Desc 
         Height          =   855
         Left            =   1800
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   74
         Tag             =   "PRD_Desc"
         Top             =   1680
         Width           =   7335
      End
      Begin VB.TextBox txt_PRD_Name 
         Height          =   375
         Left            =   1800
         MaxLength       =   80
         TabIndex        =   71
         Tag             =   "PRD_Name"
         Top             =   1200
         Width           =   5175
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   1
         Left            =   240
         TabIndex        =   70
         Top             =   360
         Width           =   4095
         _ExtentX        =   7223
         _ExtentY        =   1217
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   1
         Left            =   10200
         TabIndex        =   68
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   600
         Visible         =   0   'False
         Width           =   1095
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   1
         Left            =   11400
         TabIndex        =   69
         TabStop         =   0   'False
         Top             =   600
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   50
         Left            =   3720
         TabIndex        =   622
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   2760
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is F"
         Height          =   255
         Index           =   46
         Left            =   9360
         TabIndex        =   617
         Tag             =   "lbl_BND_IsF"
         Top             =   2880
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is E"
         Height          =   255
         Index           =   45
         Left            =   9360
         TabIndex        =   616
         Tag             =   "lbl_BND_IsE"
         Top             =   2520
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is D"
         Height          =   255
         Index           =   44
         Left            =   9360
         TabIndex        =   615
         Tag             =   "lbl_BND_IsD"
         Top             =   2160
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is C"
         Height          =   255
         Index           =   43
         Left            =   9360
         TabIndex        =   614
         Tag             =   "lbl_BND_IsC"
         Top             =   1800
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BND_H"
         Height          =   255
         Index           =   42
         Left            =   9360
         TabIndex        =   608
         Tag             =   "lbl_BND_H"
         Top             =   5160
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MatFct"
         Height          =   255
         Index           =   41
         Left            =   6600
         TabIndex        =   607
         Tag             =   "lbl_BND_MatFct"
         Top             =   9240
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HasH"
         Height          =   255
         Index           =   18
         Left            =   9960
         TabIndex        =   605
         Tag             =   "lbl_BND_HasH"
         Top             =   5520
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HasS"
         Height          =   255
         Index           =   17
         Left            =   8280
         TabIndex        =   604
         Tag             =   "lbl_BND_HasS"
         Top             =   5520
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HasU"
         Height          =   255
         Index           =   16
         Left            =   6600
         TabIndex        =   603
         Tag             =   "lbl_BND_HasU"
         Top             =   5520
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is Cus"
         Height          =   255
         Index           =   10
         Left            =   9360
         TabIndex        =   595
         Tag             =   "lbl_BND_IsCus"
         Top             =   3720
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is Lng"
         Height          =   255
         Index           =   9
         Left            =   9360
         TabIndex        =   594
         Tag             =   "lbl_BND_IsLng"
         Top             =   3360
         Width           =   1215
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   231
         Left            =   360
         TabIndex        =   566
         Tag             =   "lbl_BND_ERR_Type"
         Top             =   3720
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   26
         Left            =   360
         TabIndex        =   554
         Tag             =   "lbl_BND_PRD_CodeC"
         Top             =   3240
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 4"
         Height          =   255
         Index           =   197
         Left            =   360
         TabIndex        =   547
         Tag             =   "lbl_BND_Img4"
         Top             =   6600
         Width           =   2055
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 3"
         Height          =   255
         Index           =   196
         Left            =   3480
         TabIndex        =   546
         Tag             =   "lbl_BND_Img3"
         Top             =   6600
         Width           =   2055
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 2"
         Height          =   255
         Index           =   195
         Left            =   360
         TabIndex        =   545
         Tag             =   "lbl_BND_Img2"
         Top             =   4320
         Width           =   2055
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image 1"
         Height          =   255
         Index           =   194
         Left            =   3480
         TabIndex        =   544
         Tag             =   "lbl_BND_Img1"
         Top             =   4320
         Width           =   2055
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Close notching allowed"
         Height          =   252
         Index           =   134
         Left            =   6120
         TabIndex        =   528
         Tag             =   "lbl_BND_CanVisible"
         Top             =   3720
         Width           =   2052
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Is Short Side"
         Height          =   252
         Index           =   0
         Left            =   3720
         TabIndex        =   527
         Tag             =   "lbl_BND_IsShortSide"
         Top             =   3720
         Width           =   2292
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD_Code"
         Height          =   255
         Index           =   133
         Left            =   360
         TabIndex        =   412
         Tag             =   "lbl_BND_PRD_Code"
         Top             =   2760
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SMax2"
         Height          =   255
         Index           =   132
         Left            =   9360
         TabIndex        =   411
         Tag             =   "lbl_BND_SMax2"
         Top             =   8640
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SMin2"
         Height          =   255
         Index           =   131
         Left            =   6600
         TabIndex        =   410
         Tag             =   "lbl_BND_SMin2"
         Top             =   8640
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UMax2"
         Height          =   255
         Index           =   130
         Left            =   9360
         TabIndex        =   409
         Tag             =   "lbl_BND_UMax2"
         Top             =   8160
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UMin2"
         Height          =   255
         Index           =   129
         Left            =   6600
         TabIndex        =   408
         Tag             =   "lbl_BND_UMin2"
         Top             =   8160
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HMax2"
         Height          =   255
         Index           =   128
         Left            =   9360
         TabIndex        =   407
         Tag             =   "lbl_BND_HMax2"
         Top             =   7680
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HMin2"
         Height          =   255
         Index           =   127
         Left            =   6600
         TabIndex        =   406
         Tag             =   "lbl_BND_HMin2"
         Top             =   7680
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SMax1"
         Height          =   255
         Index           =   126
         Left            =   9360
         TabIndex        =   405
         Tag             =   "lbl_BND_SMax1"
         Top             =   6960
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#SMin1"
         Height          =   255
         Index           =   125
         Left            =   6600
         TabIndex        =   404
         Tag             =   "lbl_BND_SMin1"
         Top             =   6960
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UMax1"
         Height          =   255
         Index           =   124
         Left            =   9360
         TabIndex        =   403
         Tag             =   "lbl_BND_UMax1"
         Top             =   6480
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UMin1"
         Height          =   255
         Index           =   123
         Left            =   6600
         TabIndex        =   402
         Tag             =   "lbl_BND_UMin1"
         Top             =   6480
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HMax1"
         Height          =   255
         Index           =   122
         Left            =   9360
         TabIndex        =   401
         Tag             =   "lbl_BND_HMax1"
         Top             =   6000
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HMin1"
         Height          =   255
         Index           =   121
         Left            =   6600
         TabIndex        =   400
         Tag             =   "lbl_BND_HMin1"
         Top             =   6000
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BND_S"
         Height          =   255
         Index           =   120
         Left            =   6600
         TabIndex        =   399
         Tag             =   "lbl_BND_S"
         Top             =   5160
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UMax"
         Height          =   255
         Index           =   79
         Left            =   9360
         TabIndex        =   398
         Tag             =   "lbl_BND_UMax"
         Top             =   4680
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#UMin"
         Height          =   255
         Index           =   77
         Left            =   6600
         TabIndex        =   397
         Tag             =   "lbl_BND_UMin"
         Top             =   4680
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#LEV Id"
         Height          =   252
         Index           =   66
         Left            =   3720
         TabIndex        =   241
         Tag             =   "lbl_LEV_Id"
         Top             =   3240
         Width           =   1212
      End
      Begin VB.Label lbl_label 
         Caption         =   "#BND Order"
         Height          =   255
         Index           =   65
         Left            =   7080
         TabIndex        =   240
         Tag             =   "lbl_BND_Order"
         Top             =   1320
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Bend. Desc"
         Height          =   255
         Index           =   54
         Left            =   360
         TabIndex        =   106
         Tag             =   "lbl_BND_Desc"
         Top             =   1680
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Bend. Name"
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   105
         Tag             =   "lbl_BND_Name"
         Top             =   1320
         Width           =   1335
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Bending Main"
      Height          =   372
      Index           =   1
      Left            =   120
      TabIndex        =   60
      Top             =   1560
      Width           =   1212
      Begin Project1.ArmGrid grd_Main 
         Height          =   975
         Index           =   1
         Left            =   2400
         TabIndex        =   66
         Tag             =   "grd_M_Bnd"
         Top             =   1560
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1720
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   690
         Index           =   1
         Left            =   2400
         TabIndex        =   65
         Top             =   600
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   615
         Index           =   1
         Left            =   240
         TabIndex        =   64
         Top             =   2280
         Width           =   855
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   855
         Index           =   1
         Left            =   120
         TabIndex        =   63
         Top             =   2040
         Width           =   2055
         _ExtentX        =   3625
         _ExtentY        =   1508
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   1
         Left            =   120
         TabIndex        =   62
         Top             =   1560
         Width           =   2055
         _ExtentX        =   3625
         _ExtentY        =   609
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   615
         Index           =   1
         Left            =   120
         TabIndex        =   61
         Top             =   840
         Width           =   2055
      End
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   2
      Left            =   10080
      TabIndex        =   39
      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         =   "Perforation Detail"
      Height          =   4335
      Index           =   0
      Left            =   7560
      TabIndex        =   5
      Top             =   5640
      Width           =   7365
      Begin VB.TextBox txt_CADFileOtherPerf 
         Height          =   405
         Left            =   8040
         MaxLength       =   50
         TabIndex        =   667
         Tag             =   "PRF_CADFileOtherPerf"
         Top             =   8400
         Width           =   4095
      End
      Begin VB.TextBox txt_CADFileOverPerf 
         Height          =   405
         Left            =   8040
         MaxLength       =   50
         TabIndex        =   666
         Tag             =   "PRF_CADFileOverPerf"
         Top             =   7920
         Width           =   4095
      End
      Begin VB.Frame fra_Sifyb_BI_Link 
         Caption         =   "#Sifyb Base Item link"
         Height          =   1680
         Index           =   1
         Left            =   9045
         TabIndex        =   661
         Top             =   5010
         Width           =   6780
         Begin Project1.ArmCombobox cbo_BI_Pattern 
            Height          =   345
            Left            =   1965
            TabIndex        =   662
            Tag             =   "PP_Code®©PP_Desc"
            Top             =   270
            Width           =   4560
            _ExtentX        =   8043
            _ExtentY        =   609
         End
         Begin VB.Label lbl_label 
            Caption         =   "#Pattern"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   238
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   226
            Left            =   75
            TabIndex        =   663
            Tag             =   "lbl_BI_Pattern"
            Top             =   345
            Width           =   1455
         End
      End
      Begin VB.TextBox txt_PRF_CADFileStdPerf 
         Height          =   405
         Left            =   8040
         MaxLength       =   50
         TabIndex        =   643
         Tag             =   "PRF_CADFileStdPerf"
         Top             =   7440
         Width           =   4095
      End
      Begin VB.CheckBox chk_PRF_AllowLoud 
         Height          =   255
         Left            =   5040
         TabIndex        =   639
         Tag             =   "PRF_AllowLoud"
         Top             =   7560
         Width           =   495
      End
      Begin VB.CheckBox chk_PRF_AllowVent 
         Height          =   255
         Left            =   2160
         TabIndex        =   638
         Tag             =   "PRF_AllowVent"
         Top             =   7560
         Width           =   495
      End
      Begin VB.TextBox txt_PRD_CodeAMC 
         Height          =   372
         Index           =   0
         Left            =   4440
         MaxLength       =   30
         TabIndex        =   15
         Tag             =   "PRD_CodeAMC"
         Top             =   2880
         Width           =   2412
      End
      Begin VB.TextBox txt_PRF_Class 
         Height          =   375
         Left            =   4440
         MaxLength       =   1
         TabIndex        =   16
         Tag             =   "PRF_Class"
         Top             =   2400
         Width           =   495
      End
      Begin Project1.ArmCombobox cbo_ERR_Type 
         Height          =   345
         Index           =   0
         Left            =   1800
         TabIndex        =   19
         Tag             =   "ERR_Type®©ERR_TypeDesc"
         Top             =   4440
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_PRD_CodeC 
         Height          =   375
         Left            =   1800
         MaxLength       =   30
         TabIndex        =   14
         Tag             =   "PRD_CodeC"
         Top             =   2880
         Width           =   1335
      End
      Begin VB.TextBox txt_PRF_PRD_Code 
         Height          =   375
         Left            =   1800
         MaxLength       =   30
         TabIndex        =   13
         Tag             =   "PRD_Code"
         Top             =   2400
         Width           =   1335
      End
      Begin VB.TextBox txt_PRF_Order 
         Height          =   375
         Left            =   9960
         TabIndex        =   11
         Tag             =   "PRF_Order®©N"
         Top             =   1080
         Width           =   495
      End
      Begin VB.TextBox txt_PRF_StampBMin 
         Height          =   375
         Left            =   8040
         TabIndex        =   35
         Tag             =   "PRF_SBMin®©F®©lbl_PRF_StampBMin"
         Top             =   6960
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_StampAMax 
         Height          =   375
         Left            =   8040
         TabIndex        =   34
         Tag             =   "PRF_SAMax®©F®©lbl_PRF_StampAMax"
         Top             =   6480
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_StampAMin 
         Height          =   375
         Left            =   8040
         TabIndex        =   33
         Tag             =   "PRF_SAMin®©F®©lbl_PRF_StampAMin"
         Top             =   6000
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_StepLimit 
         Height          =   375
         Left            =   8040
         TabIndex        =   32
         Tag             =   "PRF_StLim®©F®©lbl_PRF_StepLimit"
         Top             =   5520
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_Step 
         Height          =   375
         Left            =   8040
         TabIndex        =   31
         Tag             =   "PRF_Step®©F®©lbl_PRF_Step"
         Top             =   5040
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_DivB 
         Height          =   405
         Left            =   5040
         TabIndex        =   30
         Tag             =   "PRF_DivB®©F®©lbl_PRF_DivB"
         Top             =   6480
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_DivA 
         Height          =   375
         Left            =   5040
         TabIndex        =   29
         Tag             =   "PRF_DivA®©F®©lbl_PRF_DivA"
         Top             =   6000
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_HoleB 
         Height          =   405
         Left            =   5040
         TabIndex        =   28
         Tag             =   "PRF_HoleB®©F"
         Top             =   5520
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_HoleA 
         Height          =   375
         Left            =   5040
         TabIndex        =   27
         Tag             =   "PRF_HoleA®©F"
         Top             =   5040
         Width           =   855
      End
      Begin VB.TextBox txt_PRF_MaxAluThick 
         Height          =   405
         Left            =   2160
         TabIndex        =   25
         Tag             =   "PRF_MaxAT®©F®©lbl_PRF_MaxAluThick"
         Top             =   6480
         Width           =   975
      End
      Begin VB.TextBox txt_PRF_MaxSteelThick 
         Height          =   375
         Left            =   2160
         TabIndex        =   24
         Tag             =   "PRF_MaxST®©F"
         Top             =   6000
         Width           =   975
      End
      Begin VB.TextBox txt_PRF_MaxToolWidth 
         Height          =   375
         Left            =   2160
         TabIndex        =   23
         Tag             =   "PRF_MaxTW®©F"
         Top             =   5520
         Width           =   975
      End
      Begin VB.TextBox txt_PRF_MaxPerfWidth 
         Height          =   375
         Left            =   2160
         TabIndex        =   22
         Tag             =   "PRF_MaxPW®©F"
         Top             =   5040
         Width           =   975
      End
      Begin VB.TextBox txt_PRF_FreeCrossSection 
         Height          =   375
         Left            =   2160
         TabIndex        =   26
         Tag             =   "PRF_FSC®©F®©lbl_PRF_FreeCrossSection"
         Top             =   6960
         Width           =   975
      End
      Begin VB.CommandButton cmd_ImageInfo 
         Caption         =   "..."
         Height          =   255
         Index           =   1
         Left            =   9840
         TabIndex        =   20
         Tag             =   "1©2"
         Top             =   2520
         Width           =   615
      End
      Begin VB.TextBox txt_ImgId 
         Height          =   285
         Index           =   1
         Left            =   9120
         TabIndex        =   45
         TabStop         =   0   'False
         Tag             =   "IMG_Id®©N"
         Top             =   2520
         Visible         =   0   'False
         Width           =   495
      End
      Begin VB.PictureBox pic_ImgBox 
         AutoRedraw      =   -1  'True
         Height          =   1935
         Index           =   2
         Left            =   7680
         ScaleHeight     =   1875
         ScaleWidth      =   2715
         TabIndex        =   21
         Tag             =   "1"
         Top             =   2880
         Width           =   2775
      End
      Begin Project1.ArmCombobox cbo_RF_CodeArrang 
         Height          =   345
         Left            =   1800
         TabIndex        =   18
         Tag             =   "RF_CodeAR®©RF_CodeArrang_Desc"
         Top             =   3960
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_RF_CodeShape 
         Height          =   345
         Left            =   1800
         TabIndex        =   17
         Tag             =   "RF_CodeSH®©RF_CodeShape_Desc"
         Top             =   3480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   609
      End
      Begin VB.TextBox txt_PRF_Desc 
         Height          =   735
         Left            =   1800
         MaxLength       =   250
         MultiLine       =   -1  'True
         TabIndex        =   12
         Tag             =   "PRD_Desc"
         Top             =   1560
         Width           =   8655
      End
      Begin VB.TextBox txt_PRF_Name 
         Height          =   375
         Left            =   1800
         MaxLength       =   80
         TabIndex        =   10
         Tag             =   "PRD_Name"
         Top             =   1080
         Width           =   6615
      End
      Begin VB.TextBox txt_DetailKey 
         Height          =   375
         Index           =   0
         Left            =   10200
         TabIndex        =   7
         TabStop         =   0   'False
         Tag             =   "PRD_Id"
         Top             =   240
         Visible         =   0   'False
         Width           =   1095
      End
      Begin Project1.ToolbarControl tlb_Detail 
         Height          =   690
         Index           =   0
         Left            =   240
         TabIndex        =   9
         Top             =   240
         Width           =   4335
         _ExtentX        =   7646
         _ExtentY        =   1217
      End
      Begin VB.CheckBox chk_Repositioning 
         Height          =   375
         Index           =   0
         Left            =   10200
         TabIndex        =   40
         TabStop         =   0   'False
         Top             =   600
         Visible         =   0   'False
         Width           =   615
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD File Other Perf."
         Height          =   255
         Index           =   228
         Left            =   6360
         TabIndex        =   669
         Tag             =   "lbl_PRF_CADFileOtherPerf"
         Top             =   8520
         Width           =   1695
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD File Over Perf."
         Height          =   255
         Index           =   227
         Left            =   6360
         TabIndex        =   668
         Tag             =   "lbl_PRF_CADFileOverPerf"
         Top             =   8040
         Width           =   1695
      End
      Begin VB.Label lbl_label 
         Caption         =   "#CAD File Std. Perf."
         Height          =   255
         Index           =   207
         Left            =   6360
         TabIndex        =   642
         Tag             =   "lbl_PRF_CADFileStdPerf."
         Top             =   7560
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Allow Loud"
         Height          =   255
         Index           =   206
         Left            =   3480
         TabIndex        =   641
         Tag             =   "lbl_PRF_AllowLoud"
         Top             =   7560
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Allow Vent"
         Height          =   255
         Index           =   205
         Left            =   240
         TabIndex        =   640
         Tag             =   "lbl_PRF_AllowVent"
         Top             =   7560
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Baeurer code"
         Height          =   252
         Index           =   49
         Left            =   3240
         TabIndex        =   621
         Tag             =   "lbl_PRD_CodeAMC"
         Top             =   3000
         Width           =   1092
      End
      Begin VB.Label lbl_label 
         Caption         =   "#ERR Type"
         Height          =   255
         Index           =   230
         Left            =   240
         TabIndex        =   565
         Tag             =   "lbl_PRF_ERR_Type"
         Top             =   4560
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD CodeC"
         Height          =   255
         Index           =   25
         Left            =   240
         TabIndex        =   553
         Tag             =   "lbl_PRF_PRD_CodeC"
         Top             =   3000
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#PRD Code"
         Height          =   255
         Index           =   24
         Left            =   240
         TabIndex        =   552
         Tag             =   "lbl_PRF_PRD_Code"
         Top             =   2520
         Width           =   975
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Image"
         Height          =   255
         Index           =   198
         Left            =   7680
         TabIndex        =   548
         Tag             =   "lbl_PRF_Img"
         Top             =   2520
         Width           =   855
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Prf. Order"
         Height          =   255
         Index           =   75
         Left            =   8520
         TabIndex        =   270
         Tag             =   "lbl_PRF_Order"
         Top             =   1200
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#StampBMin"
         Height          =   255
         Index           =   40
         Left            =   6360
         TabIndex        =   59
         Tag             =   "lbl_PRF_StampBMin"
         Top             =   7080
         Width           =   1695
      End
      Begin VB.Label lbl_label 
         Caption         =   "#StampAMax"
         Height          =   255
         Index           =   39
         Left            =   6360
         TabIndex        =   58
         Tag             =   "lbl_PRF_StampAMax"
         Top             =   6600
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#StampAMin"
         Height          =   255
         Index           =   38
         Left            =   6360
         TabIndex        =   57
         Tag             =   "lbl_PRF_StampAMin"
         Top             =   6120
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#StepLimit"
         Height          =   255
         Index           =   37
         Left            =   6360
         TabIndex        =   56
         Tag             =   "lbl_PRF_StepLimit"
         Top             =   5640
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Step"
         Height          =   255
         Index           =   36
         Left            =   6360
         TabIndex        =   55
         Tag             =   "lbl_PRF_Step"
         Top             =   5160
         Width           =   1575
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DivB"
         Height          =   255
         Index           =   35
         Left            =   3480
         TabIndex        =   54
         Tag             =   "lbl_PRF_DivB"
         Top             =   6600
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#DivA"
         Height          =   255
         Index           =   34
         Left            =   3480
         TabIndex        =   53
         Tag             =   "lbl_PRF_DivA"
         Top             =   6120
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HoleB"
         Height          =   255
         Index           =   33
         Left            =   3480
         TabIndex        =   52
         Tag             =   "lbl_PRF_HoleB"
         Top             =   5640
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#HoleA"
         Height          =   255
         Index           =   32
         Left            =   3480
         TabIndex        =   51
         Tag             =   "lbl_PRF_HoleA"
         Top             =   5160
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MaxAluThick"
         Height          =   255
         Index           =   31
         Left            =   240
         TabIndex        =   50
         Tag             =   "lbl_PRF_MaxAluThick"
         Top             =   6600
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MaxSteelThick"
         Height          =   255
         Index           =   30
         Left            =   240
         TabIndex        =   49
         Tag             =   "lbl_PRF_MaxSteelThick"
         Top             =   6120
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MaxToolWidth"
         Height          =   255
         Index           =   29
         Left            =   240
         TabIndex        =   48
         Tag             =   "lbl_PRF_MaxToolWidth"
         Top             =   5640
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#MaxPerfWidth"
         Height          =   255
         Index           =   28
         Left            =   240
         TabIndex        =   47
         Tag             =   "lbl_PRF_MaxPerfWidth"
         Top             =   5160
         Width           =   1935
      End
      Begin VB.Label lbl_label 
         Caption         =   "#FreeCrossSection"
         Height          =   255
         Index           =   27
         Left            =   240
         TabIndex        =   46
         Tag             =   "lbl_PRF_FreeCrossSection"
         Top             =   7080
         Width           =   1815
      End
      Begin VB.Label lbl_label 
         Caption         =   "#RF CodeArrang"
         Height          =   255
         Index           =   23
         Left            =   240
         TabIndex        =   44
         Tag             =   "lbl_PRF_CodeArrang"
         Top             =   4080
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#RF CodeShape"
         Height          =   255
         Index           =   22
         Left            =   240
         TabIndex        =   43
         Tag             =   "lbl_PRF_CodeShape"
         Top             =   3600
         Width           =   1455
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Prf. Class"
         Height          =   255
         Index           =   21
         Left            =   3240
         TabIndex        =   42
         Tag             =   "lbl_PRF_Class"
         Top             =   2520
         Width           =   1095
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Prf. Desc"
         Height          =   255
         Index           =   20
         Left            =   240
         TabIndex        =   41
         Tag             =   "lbl_PRF_Desc"
         Top             =   1680
         Width           =   1335
      End
      Begin VB.Label lbl_label 
         Caption         =   "#Prf.Name"
         Height          =   255
         Index           =   19
         Left            =   240
         TabIndex        =   8
         Tag             =   "lbl_PRF_Name"
         Top             =   1200
         Width           =   1335
      End
   End
   Begin VB.Frame fra_MainItem 
      Caption         =   "Perforation Main"
      Height          =   372
      Index           =   0
      Left            =   120
      TabIndex        =   3
      Top             =   1200
      Width           =   1452
      Begin VB.CommandButton cmd_TVReLoad 
         Caption         =   "Command1"
         Height          =   735
         Index           =   0
         Left            =   240
         TabIndex        =   37
         Top             =   2280
         Width           =   975
      End
      Begin Project1.ArmTreeView tvw_Main 
         Height          =   855
         Index           =   0
         Left            =   120
         TabIndex        =   36
         Top             =   2160
         Width           =   2655
         _ExtentX        =   4683
         _ExtentY        =   1508
      End
      Begin VB.Frame fra_MainFilter 
         Caption         =   "Frame1"
         Height          =   615
         Index           =   0
         Left            =   0
         TabIndex        =   4
         Top             =   840
         Width           =   2775
      End
      Begin Project1.ArmGrid grd_Main 
         Height          =   972
         Index           =   0
         Left            =   3240
         TabIndex        =   618
         Tag             =   "grd_M_Prf"
         Top             =   2040
         Width           =   1452
         _ExtentX        =   2566
         _ExtentY        =   1720
      End
      Begin Project1.ToolbarControl tlb_Main 
         Height          =   696
         Index           =   0
         Left            =   3360
         TabIndex        =   619
         Top             =   840
         Width           =   1452
         _ExtentX        =   2566
         _ExtentY        =   1217
      End
      Begin Project1.ArmCombobox cbo_View 
         Height          =   345
         Index           =   0
         Left            =   120
         TabIndex        =   620
         Top             =   1560
         Width           =   2055
         _ExtentX        =   3625
         _ExtentY        =   609
      End
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   1
      Left            =   9360
      TabIndex        =   2
      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           =   0
      Left            =   8640
      TabIndex        =   1
      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 MSComDlg.CommonDialog dlg_Common 
      Left            =   4440
      Top             =   120
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin MSComctlLib.TabStrip tbs_Main 
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   0
      Width           =   3855
      _ExtentX        =   6800
      _ExtentY        =   661
      MultiRow        =   -1  'True
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   12
         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
         BeginProperty Tab11 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab12 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TabStrip tbs_MainTabFilter 
      Height          =   375
      Index           =   5
      Left            =   12240
      TabIndex        =   171
      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            =   12960
      TabIndex        =   250
      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            =   13680
      TabIndex        =   271
      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            =   14400
      TabIndex        =   315
      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           =   9
      Left            =   8640
      TabIndex        =   348
      Top             =   480
      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           =   10
      Left            =   9360
      TabIndex        =   387
      Top             =   480
      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           =   11
      Left            =   10080
      TabIndex        =   576
      Top             =   480
      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.Menu mnu_EAS 
      Caption         =   ""
   End
End
Attribute VB_Name = "DPC_Ref"
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 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 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"
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
    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_Perforation = 1
    ttDPC_Bending = 2
    ttDPC_LoudType = 3
    ttDPC_VentType = 4
    ttDPC_CutoutType = 5
    ttDPC_Coating = 6
    ttDPC_Gasket = 7
    ttDPC_Inlay = 8
    ttDPC_Packing = 9
    ttDPC_Option = 10
    ttDPC_Surcharge = 11
    ttDPC_Labeling = 12
End Enum

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

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' 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

Private Enum eDPCSystemDefaultType
    sdBending = 1
    sdPacking = 2
End Enum

'**********************************************************************************************************************************
'**********************************************************************************************************************************
'**********************************************************************************************************************************
' 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
    
    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
               
    ms_ToolbarRequest = "exec Toolbar_sel $Module$"

    Set lo_Tab = tbs_Main.Tabs(1)
    lo_Tab.Caption = "#DPC_Perforation"
    lo_Tab.Key = "DPC_Perforation"
    lo_Tab.Tag = "lbl_TAB_DPC_Perforation"
           
    Set lo_Tab = tbs_Main.Tabs(2)
    lo_Tab.Caption = "#DPC_Bending"
    lo_Tab.Key = "DPC_Bending"
    lo_Tab.Tag = "lbl_TAB_DPC_Bending"
           
    Set lo_Tab = tbs_Main.Tabs(3)
    lo_Tab.Caption = "#DPC_LoudType"
    lo_Tab.Key = "DPC_LoudType"
    lo_Tab.Tag = "lbl_TAB_DPC_LoudType"
           
    Set lo_Tab = tbs_Main.Tabs(4)
    lo_Tab.Caption = "#DPC_VentType"
    lo_Tab.Key = "DPC_VentType"
    lo_Tab.Tag = "lbl_TAB_DPC_VentType"
           
    Set lo_Tab = tbs_Main.Tabs(5)
    lo_Tab.Caption = "#DPC_CutoutType"
    lo_Tab.Key = "DPC_CutoutType"
    lo_Tab.Tag = "lbl_TAB_DPC_CutoutType"
                                            
    Set lo_Tab = tbs_Main.Tabs(6)
    lo_Tab.Caption = "#DPC_Coating"
    lo_Tab.Key = "DPC_Coating"
    lo_Tab.Tag = "lbl_TAB_DPC_Coating"
           
    Set lo_Tab = tbs_Main.Tabs(7)
    lo_Tab.Caption = "#DPC_Gasket"
    lo_Tab.Key = "DPC_Gasket"
    lo_Tab.Tag = "lbl_TAB_DPC_Gasket"
           
    Set lo_Tab = tbs_Main.Tabs(8)
    lo_Tab.Caption = "#DPC_Inlay"
    lo_Tab.Key = "DPC_Inlay"
    lo_Tab.Tag = "lbl_TAB_DPC_Inlay"
           
    Set lo_Tab = tbs_Main.Tabs(9)
    lo_Tab.Caption = "#DPC_Packing"
    lo_Tab.Key = "DPC_Packing"
    lo_Tab.Tag = "lbl_TAB_DPC_Packing"
                      
    Set lo_Tab = tbs_Main.Tabs(10)
    lo_Tab.Caption = "#DPC_Option"
    lo_Tab.Key = "DPC_Option"
    lo_Tab.Tag = "lbl_TAB_DPC_Option"
           
    Set lo_Tab = tbs_Main.Tabs(11)
    lo_Tab.Caption = "#DPC_Surcharge"
    lo_Tab.Key = "DPC_Surcharge"
    lo_Tab.Tag = "lbl_TAB_DPC_Surcharge"
                                                  
    Set lo_Tab = tbs_Main.Tabs(12)
    lo_Tab.Caption = "#DPC_Labeling"
    lo_Tab.Key = "DPC_Labeling"
    lo_Tab.Tag = "lbl_TAB_DPC_Labeling"
                                                  
    'cbo_PRF_Class.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst 3105,$toolbar_language_code$")
    cbo_RF_CodeShape.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfPerforationHoleShape & ",$toolbar_language_code$")
    cbo_RF_CodeArrang.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfPerforationHoleArrangement & ",$toolbar_language_code$")
            
    For ll_Index = 0 To 2
        cbo_Perforation(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Perforation_lst2 $toolbar_language_code$")
    Next
    
    For ll_Index = 0 To 2
        cbo_Shape(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfCutShapeType & ",$toolbar_language_code$")
    Next
    
    cbo_CoatingType_Filter.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfCoatingType & ",$toolbar_language_code$")
    cbo_CoatingType_Filter.FirstBlankItem = True
    cbo_CoatingType.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfCoatingType & ",$toolbar_language_code$")
    cbo_CoatingType.FirstBlankItem = True
    cbo_CoatingMat.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfCoatingMaterial & ",$toolbar_language_code$")
    cbo_CoatingMat.FirstBlankItem = True
    cbo_CoatingOther.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst" & eDPCReferenceML.rfCoatingColorNorm & ",$toolbar_language_code$")
    cbo_CoatingOther.FirstBlankItem = True
    cbo_CoatingApp.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfCoatingApplication & ",$toolbar_language_code$")
    cbo_CoatingApp.FirstBlankItem = True
        
    cbo_GasketType_Filter.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfGasketSpacerType & ",$toolbar_language_code$")
    cbo_GasketType_Filter.FirstBlankItem = True
    For ll_Index = 0 To 0
        cbo_GasketType(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfGasketSpacerType & ",$toolbar_language_code$")
    Next
                    
    cbo_INL_Type.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfInlayType & ",$toolbar_language_code$")
    
    cbo_INL_Deliv.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfInlayDeliveryKind & ",$toolbar_language_code$")
    cbo_INL_Deliv.FirstBlankItem = True
    
    cbo_INL_Purch.Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfInlayPurchaseType & ",$toolbar_language_code$")
    
    cbo_Offer.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_Offer_lst2 $toolbar_language_code$")
    
    
    cbo_BI_Colour.Request = ReplaceLanguagePlaceholderFromToolbar("exec colours_cbo 'C001', $toolbar_language_code$")
    cbo_BI_Surface.Request = ReplaceLanguagePlaceholderFromToolbar("exec Surfaces_cbo 'C001', $toolbar_language_code$")
    cbo_BI_Pattern.Request = ReplaceLanguagePlaceholderFromToolbar("exec products_patterns_cbo 'C001', $toolbar_language_code$")
    
    'cbo_System.Request = ReplaceLanguagePlaceholderFromToolbar("exec DPC_System_lst2 $toolbar_language_code$,NULL")
    
    For ll_Index = 0 To 9
        cbo_ERR_Type(ll_Index).Request = ReplaceLanguagePlaceholderFromToolbar("exec A_References_ML_lst " & eDPCReferenceML.rfErrorType & ",$toolbar_language_code$")
    Next
    
    For ll_Index = 0 To 11
        grd_Main(ll_Index).AllowExcelExport = True
    Next
    
    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(11)
    ReDim mt_DetailConfig(11)
            
    With mt_MainConfig(0)
        .FrameIndex = 0
        .IsMultiDetailView = True
        .CurrentDetailIndex = 0
        .Initialized = False
        .NameFrame = "DPC_Perforation"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 0
        .ToolbarID = 2822
        .RequestGrid = "exec DPC_Perforation_lst $toolbar_language_code$"
    End With
    
    With mt_MainConfig(1)
        .FrameIndex = 1
        .IsMultiDetailView = True
        .CurrentDetailIndex = 1
        .Initialized = False
        .NameFrame = "DPC_Bending"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 1
        .ToolbarID = 2825
        .RequestGrid = "exec DPC_Bending_lst2 $toolbar_language_code$"
    End With
    
    With mt_MainConfig(2)
        .FrameIndex = 2
        .IsMultiDetailView = True
        .CurrentDetailIndex = 3
        .Initialized = False
        .NameFrame = "DPC_LoudType"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 2
        .ToolbarID = 2829
        .RequestGrid = "exec DPC_CutType_lst $toolbar_language_code$,2"
    End With
    
    With mt_MainConfig(3)
        .FrameIndex = 3
        .IsMultiDetailView = True
        .CurrentDetailIndex = 4
        .Initialized = False
        .NameFrame = "DPC_VentType"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 3
        .ToolbarID = 2831
        .RequestGrid = "exec DPC_CutType_lst $toolbar_language_code$,1"
    End With
    
    With mt_MainConfig(4)
        .FrameIndex = 4
        .IsMultiDetailView = True
        .CurrentDetailIndex = 5
        .Initialized = False
        .NameFrame = "DPC_CutoutType"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 4
        .ToolbarID = 2833
        .RequestGrid = "exec DPC_CutType_lst $toolbar_language_code$,3"
    End With
        
    With mt_MainConfig(5)
        .FrameIndex = 5
        .IsMultiDetailView = True
        .CurrentDetailIndex = 6
        .Initialized = False
        .NameFrame = "DPC_Coating"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 5
        .ToolbarID = 2837
        .RequestGrid = "exec DPC_Coating_lst $toolbar_language_code$,$COA_Type$"
    End With
    
    With mt_MainConfig(6)
        .FrameIndex = 6
        .IsMultiDetailView = True
        .CurrentDetailIndex = 7
        .Initialized = False
        .NameFrame = "DPC_Gasket"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 6
        .ToolbarID = 2839
        .RequestGrid = "exec DPC_Gasket_lst $toolbar_language_code$,$RF_Code$"
    End With
    
    With mt_MainConfig(7)
        .FrameIndex = 7
        .IsMultiDetailView = True
        .CurrentDetailIndex = 8
        .Initialized = False
        .NameFrame = "DPC_Inlay"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 7
        .ToolbarID = 2841
        .RequestGrid = "exec DPC_Inlay_lst2 $toolbar_language_code$"
    End With
    
    With mt_MainConfig(8)
        .FrameIndex = 8
        .IsMultiDetailView = True
        .CurrentDetailIndex = 9
        .Initialized = False
        .NameFrame = "DPC_Packing"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 8
        .ToolbarID = 2846
        .RequestGrid = "exec DPC_Packing_lst $toolbar_language_code$"
    End With
        
    With mt_MainConfig(9)
        .FrameIndex = 9
        .IsMultiDetailView = True
        .CurrentDetailIndex = 10
        .Initialized = False
        .NameFrame = "DPC_Option"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 9
        .ToolbarID = 2852
        .RequestGrid = "exec DPC_Option_lst $toolbar_language_code$"
    End With
    
    With mt_MainConfig(10)
        .FrameIndex = 10
        .IsMultiDetailView = True
        .CurrentDetailIndex = 2
        .Initialized = False
        .NameFrame = "DPC_Surcharge"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 10
        .ToolbarID = 2854
        .RequestGrid = "exec DPC_Surcharge_lst $toolbar_language_code$"
    End With
    
    With mt_MainConfig(11)
        .FrameIndex = 11
        .IsMultiDetailView = True
        .CurrentDetailIndex = 11
        .Initialized = False
        .NameFrame = "DPC_Labeling"
        .ViewCode = ""
        .GridDelayMethod = eGridLoadMethod.egmDelayedExceptLastLevel
        .CurrentTvwSelMethod = etmNone
        .ToolbarFace = "0"
        .ToolbarIndex = 11
        .ToolbarID = 2930
        .RequestGrid = "exec DPC_Labeling_lst $toolbar_language_code$"
    End With
    
    With mt_DetailConfig(0)
        .FrameIndex = 0
        .NameFrame = "DPC_Perforation"
        .MainConfigIndex = 0
        .DetailKey = 0
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Perforation_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgPerforation & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_Perforation_ins2 $PRD_Id$,$PRF_Order$,$PRF_Class$,$RF_CodeSH$,$RF_CodeAR$,$PRF_FSC$,$PRF_MaxPW$,$PRF_MaxTW$,$PRF_MaxST$,$PRF_MaxAT$,$PRF_HoleA$,$PRF_HoleB$,$PRF_DivA$,$PRF_DivB$,$PRF_Step$,$PRF_StLim$,$PRF_SAMin$,$PRF_SAMax$,$PRF_SBMin$,$PRF_AllowVent$,$PRF_AllowLoud$,$PRF_CADFileStdPerf$,$PRF_CADFileOverPerf$,$PRF_CADFileOtherPerf$,$PP_Code$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgPerforation & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Perforation_upd2 $PRD_Id$,$PRF_Order$,$PRF_Class$,$RF_CodeSH$,$RF_CodeAR$,$PRF_FSC$,$PRF_MaxPW$,$PRF_MaxTW$,$PRF_MaxST$,$PRF_MaxAT$,$PRF_HoleA$,$PRF_HoleB$,$PRF_DivA$,$PRF_DivB$,$PRF_Step$,$PRF_StLim$,$PRF_SAMin$,$PRF_SAMax$,$PRF_SBMin$,$PRF_AllowVent$,$PRF_AllowLoud$,$PRF_CADFileStdPerf$,$PRF_CADFileOverPerf$,$PRF_CADFileOtherPerf$,$PP_Code$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Perforation_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Perforation"
        .ToolbarIndex = 0
        .ToolbarID = 2828
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(13)
        .ListFieldsDefaultValue(0) = Array(txt_PRF_FreeCrossSection, 0)
        .ListFieldsDefaultValue(1) = Array(txt_PRF_MaxPerfWidth, 0)
        .ListFieldsDefaultValue(2) = Array(txt_PRF_MaxToolWidth, 0)
        .ListFieldsDefaultValue(3) = Array(txt_PRF_MaxSteelThick, 0)
        .ListFieldsDefaultValue(4) = Array(txt_PRF_MaxAluThick, 0)
        .ListFieldsDefaultValue(5) = Array(txt_PRF_HoleA, 0)
        .ListFieldsDefaultValue(6) = Array(txt_PRF_HoleB, 0)
        .ListFieldsDefaultValue(7) = Array(txt_PRF_DivA, 0)
        .ListFieldsDefaultValue(8) = Array(txt_PRF_DivB, 0)
        .ListFieldsDefaultValue(9) = Array(txt_PRF_Step, 0)
        .ListFieldsDefaultValue(10) = Array(txt_PRF_StepLimit, 0)
        .ListFieldsDefaultValue(11) = Array(txt_PRF_StampAMin, 0)
        .ListFieldsDefaultValue(12) = Array(txt_PRF_StampAMax, 0)
        .ListFieldsDefaultValue(13) = Array(txt_PRF_StampBMin, 0)
        
        ReDim .ListFieldsMandatory(6)
        .ListFieldsMandatory(0) = Array(txt_PRF_Name, 19)
        .ListFieldsMandatory(1) = Array(txt_PRF_Desc, 20)
        .ListFieldsMandatory(2) = Array(txt_PRF_MaxPerfWidth, 28)
        .ListFieldsMandatory(3) = Array(txt_PRF_MaxToolWidth, 29)
        .ListFieldsMandatory(4) = Array(txt_PRF_MaxSteelThick, 30)
        .ListFieldsMandatory(5) = Array(txt_ImgId(1), 198)
        .ListFieldsMandatory(6) = Array(cbo_BI_Pattern, 226)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(0)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©1000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©3400®©0®©PRD_Desc®©#PRD_Desc", _
            "PRF_Order®©1000®©0®©PRF_Order®©#PRF_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(1)
        .FrameIndex = 1
        .NameFrame = "DPC_Bending"
        .MainConfigIndex = 1
        .DetailKey = 1
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Bending_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgBending & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,$LEV_Id$,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_Bending_ins $PRD_Id$,$BND_Order$,$BND_IsShr$,$BND_IsLng$,$BND_IsC$,$BND_IsD$,$BND_IsE$,$BND_IsF$,$BND_IsCus$,$BND_CanVi$,$IMG_Id$,$IMG_Id2$,$IMG_IdV$,$IMG_IdV2$," & _
                                                 "$BND_HasU$,$BND_UMin$,$BND_UMax$,$BND_HasS$,$BND_S$,$BND_HasH$,$BND_H$,$BND_HMin1$,$$BND_HMax1$,$BND_UMin1$,$BND_UMax1$,$BND_SMin1$,$BND_SMax1$," & _
                                                 "$BND_HMin2$,$BND_HMax2$,$BND_UMin2$,$BND_UMax2$,$BND_SMin2$,$BND_SMax2$,$BND_MatFct$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgBending & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,$LEV_Id$,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Bending_upd $PRD_Id$,$BND_Order$,$BND_IsShr$,$BND_IsLng$,$BND_IsC$,$BND_IsD$,$BND_IsE$,$BND_IsF$,$BND_IsCus$,$BND_CanVi$,$IMG_Id$,$IMG_Id2$,$IMG_IdV$,$IMG_IdV2$," & _
                                                 "$BND_HasU$,$BND_UMin$,$BND_UMax$,$BND_HasS$,$BND_S$,$BND_HasH$,$BND_H$,$BND_HMin1$,$$BND_HMax1$,$BND_UMin1$,$BND_UMax1$,$BND_SMin1$,$BND_SMax1$," & _
                                                 "$BND_HMin2$,$BND_HMax2$,$BND_UMin2$,$BND_UMax2$,$BND_SMin2$,$BND_SMax2$,$BND_MatFct$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Bending_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Bending"
        .ToolbarIndex = 1
        .ToolbarID = 2826
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(16)
        .ListFieldsDefaultValue(0) = Array(txt_BND_UMin, 0)
        .ListFieldsDefaultValue(1) = Array(txt_BND_UMax, 0)
        .ListFieldsDefaultValue(2) = Array(txt_BND_S, 0)
        .ListFieldsDefaultValue(3) = Array(txt_BND_HMin1, 0)
        .ListFieldsDefaultValue(4) = Array(txt_BND_HMax1, 0)
        .ListFieldsDefaultValue(5) = Array(txt_BND_UMin1, 0)
        .ListFieldsDefaultValue(6) = Array(txt_BND_UMax1, 0)
        .ListFieldsDefaultValue(7) = Array(txt_BND_SMin1, 0)
        .ListFieldsDefaultValue(8) = Array(txt_BND_SMax1, 0)
        .ListFieldsDefaultValue(9) = Array(txt_BND_HMin2, 0)
        .ListFieldsDefaultValue(10) = Array(txt_BND_HMax2, 0)
        .ListFieldsDefaultValue(11) = Array(txt_BND_UMin2, 0)
        .ListFieldsDefaultValue(12) = Array(txt_BND_UMax2, 0)
        .ListFieldsDefaultValue(13) = Array(txt_BND_SMin2, 0)
        .ListFieldsDefaultValue(14) = Array(txt_BND_SMax2, 0)
        .ListFieldsDefaultValue(15) = Array(txt_BND_H, 0)
        .ListFieldsDefaultValue(16) = Array(txt_MatFct, 0)
        
        ReDim .ListFieldsMandatory(8)
        .ListFieldsMandatory(0) = Array(txt_PRD_Name, 1)
        .ListFieldsMandatory(1) = Array(txt_PRD_Desc, 54)
        .ListFieldsMandatory(2) = Array(txt_BND_Order, 65)
        .ListFieldsMandatory(3) = Array(txt_ImgId(2), 194)
        .ListFieldsMandatory(4) = Array(txt_ImgId(3), 195)
        .ListFieldsMandatory(5) = Array(txt_ImgId(4), 196)
        .ListFieldsMandatory(6) = Array(txt_ImgId(5), 197)
        .ListFieldsMandatory(7) = Array(txt_BND_H, 42)
        .ListFieldsMandatory(8) = Array(txt_MatFct, 41)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(1)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©1000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©3400®©0®©PRD_Desc®©#PRD_Desc", _
            "BND_IsCus®©900®©0®©BND_IsCus®©#BND_IsCus", _
            "BND_Order®©1000®©0®©BND_Order®©#BND_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_Surcharge"
        .MainConfigIndex = 10
        .DetailKey = 2
        .ClearControlsBeforeInit = True

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

        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgSurcharge & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_creator$", _
                            "exec DPC_Surcharge_ins $PRD_Id$,$DOF_Id$,$SCH_Order$,$SCH_Setup$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgSurcharge & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Surcharge_upd $PRD_Id$,$DOF_Id$,$SCH_Order$,$SCH_Setup$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Surcharge_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Surcharge"
        .ToolbarIndex = 2
        .ToolbarID = 2855
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(2)
        .ListFieldsMandatory(0) = Array(txt_SCH_PRD_Name, 85)
        .ListFieldsMandatory(1) = Array(txt_SCH_PRD_Code, 87)
        .ListFieldsMandatory(2) = Array(txt_SCH_Order, 88)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(2)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©3000®©0®©PRD_Name®©#PRD_Name", _
            "DOF_Id®©0®©0®©DOF_Id®©#DOF_Id", _
            "DOF_Name®©5500®©0®©DOF_Name®©#DOF_Name", _
            "SCH_Order®©900®©0®©SCH_Order®©#SCH_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_LoudType"
        .MainConfigIndex = 2
        .DetailKey = 3
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_CutType_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgPerforation & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_CutType_ins $PRD_Id$," & CONST_CUT_TYPE_LOUD & ",$CUT_Order$,$PRF_Id$,$CUT_Shape$,$CUT_MinJ$,$CUT_MaxJ$,$CUT_MinK$,$CUT_MaxK$,$CUT_MinL$,$CUT_MinM$,$IMG_IdShp$,$CUT_BaeType$,$CUT_CADFile$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgPerforation & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_CutType_upd $PRD_Id$," & CONST_CUT_TYPE_LOUD & ",$CUT_Order$,$PRF_Id$,$CUT_Shape$,$CUT_MinJ$,$CUT_MaxJ$,$CUT_MinK$,$CUT_MaxK$,$CUT_MinL$,$CUT_MinM$,$IMG_IdShp$,$CUT_BaeType$,$CUT_CADFile$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$Language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_CutType_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_LoudType"
        .ToolbarIndex = 3
        .ToolbarID = 2830
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(4)
        .ListFieldsMandatory(0) = Array(txt_CUT_Name, 55)
        .ListFieldsMandatory(1) = Array(txt_CUT_Desc, 56)
        .ListFieldsMandatory(2) = Array(txt_CUT_Order, 64)
        .ListFieldsMandatory(3) = Array(txt_ImgId(6), 190)
        .ListFieldsMandatory(4) = Array(txt_ImgId(7), 191)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(3)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©1000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©6000®©0®©PRD_Desc®©#PRD_Desc", _
            "PRF_Name®©1000®©0®©PRF_Name®©#PRF_Name", _
            "RF_Desc®©1000®©0®©RF_Desc®©#RF_Desc", _
            "CUT_Order®©1000®©0®©CUT_Order®©#CUT_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(4)
        .FrameIndex = 4
        .NameFrame = "DPC_VentType"
        .MainConfigIndex = 3
        .DetailKey = 4
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_CutType_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgVentilation & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_CutType_ins $PRD_Id$," & CONST_CUT_TYPE_VENT & ",$CUT_Order$,$PRF_Id$,$CUT_Shape$,$CUT_MinJ$,$CUT_MaxJ$,$CUT_MinK$,$CUT_MaxK$,$CUT_MinL$,$CUT_MinM$,$IMG_IdShp$,$CUT_BaeType$,$CUT_CADFile$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgVentilation & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_CutType_upd $PRD_Id$," & CONST_CUT_TYPE_VENT & ",$CUT_Order$,$PRF_Id$,$CUT_Shape$,$CUT_MinJ$,$CUT_MaxJ$,$CUT_MinK$,$CUT_MaxK$,$CUT_MinL$,$CUT_MinM$,$IMG_IdShp$,$CUT_BaeType$,$CUT_CADFile$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_CutType_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_VentType"
        .ToolbarIndex = 4
        .ToolbarID = 2832
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(3)
        .ListFieldsMandatory(0) = Array(txt_CUT_VET_Name, 179)
        .ListFieldsMandatory(1) = Array(txt_CUT_VET_Order, 175)
        .ListFieldsMandatory(2) = Array(txt_ImgId(8), 189)
        .ListFieldsMandatory(3) = Array(txt_ImgId(9), 188)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(4)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©1000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©4000®©0®©PRD_Desc®©#PRD_Desc", _
            "PRF_Name®©1000®©0®©PRF_Name®©#PRF_Name", _
            "RF_Desc®©1000®©0®©RF_Desc®©#RF_Desc", _
            "CUT_Order®©1000®©0®©CUT_Order®©#CUT_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(5)
        .FrameIndex = 5
        .NameFrame = "DPC_CutoutType"
        .MainConfigIndex = 4
        .DetailKey = 5
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_CutType_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgCutout & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_CutType_ins $PRD_Id$," & CONST_CUT_TYPE_CUTOUT & ",$CUT_Order$,$PRF_Id$,$CUT_Shape$,$CUT_MinJ$,$CUT_MaxJ$,$CUT_MinK$,$CUT_MaxK$,$CUT_MinL$,$CUT_MinM$,$IMG_IdShp$,$CUT_BaeType$,$CUT_CADFile$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgCutout & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_CutType_upd $PRD_Id$," & CONST_CUT_TYPE_CUTOUT & ",$CUT_Order$,$PRF_Id$,$CUT_Shape$,$CUT_MinJ$,$CUT_MaxJ$,$CUT_MinK$,$CUT_MaxK$,$CUT_MinL$,$CUT_MinM$,$IMG_IdShp$,$CUT_BaeType$,$CUT_CADFile$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_CutType_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_CutoutType"
        .ToolbarIndex = 5
        .ToolbarID = 2830
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(4)
        .ListFieldsMandatory(0) = Array(txt_CUT_CUT_Name, 165)
        .ListFieldsMandatory(1) = Array(txt_CUT_CUT_Desc, 164)
        .ListFieldsMandatory(2) = Array(txt_CUT_CUT_Order, 161)
        .ListFieldsMandatory(3) = Array(txt_ImgId(14), 192)
        .ListFieldsMandatory(4) = Array(txt_ImgId(11), 193)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(5)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©1000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©6000®©0®©PRD_Desc®©#PRD_Desc", _
            "PRF_Name®©1000®©0®©PRF_Name®©#PRF_Name", _
            "RF_Desc®©1000®©0®©RF_Desc®©#RF_Desc", _
            "CUT_Order®©1000®©0®©CUT_Order®©#CUT_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(6)
        .FrameIndex = 6
        .NameFrame = "DPC_Coating"
        .MainConfigIndex = 5
        .DetailKey = 6
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Coating_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgCoating & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_creator$", _
                            "exec DPC_Coating_ins2 $PRD_Id$,$COA_Order$,$COA_Mat$,$COA_App$,$COA_Other$,$COA_Type$,$COA_IsCus$,$COA_CE$,$Colour_Code$,$SF_Code$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgCoating & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Coating_upd2 $PRD_Id$,$COA_Order$,$COA_Mat$,$COA_App$,$COA_Other$,$COA_Type$,$COA_IsCus$,$COA_CE$,$Colour_Code$,$SF_Code$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Coating_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Coating"
        .ToolbarIndex = 6
        .ToolbarID = 2838
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(4)
        .ListFieldsMandatory(0) = Array(txt_COA_Name, 96)
        .ListFieldsMandatory(1) = Array(txt_COA_Desc, 97)
        .ListFieldsMandatory(2) = Array(txt_COA_Order, 98)
        .ListFieldsMandatory(3) = Array(cbo_BI_Colour, 223)
        .ListFieldsMandatory(4) = Array(cbo_BI_Surface, 224)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(6)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©2000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©3400®©0®©PRD_Desc®©#PRD_Desc", _
            "COA_Order®©1000®©0®©COA_Order®©#COA_Order", _
            "COA_Mat®©0®©0®©COA_Mat®©#COA_Mat", _
            "COA_Mat_Desc®©1500®©0®©COA_Mat_Desc®©#COA_Mat_Desc", _
            "COA_App®©0®©0®©COA_App®©#COA_App", _
            "COA_App_Desc®©1500®©0®©COA_App_Desc®©#COA_App_Desc", _
            "COA_Other®©0®©0®©COA_Other®©#COA_Other", _
            "COA_Other_Desc®©1200®©0®©COA_Other_Desc®©#COA_Other_Desc", _
            "COA_Type®©0®©0®©COA_Type®©#COA_Type", _
            "COA_Type_Desc®©1500®©0®©COA_Type_Desc®©#COA_Type_Desc", _
            "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_Gasket"
        .MainConfigIndex = 6
        .DetailKey = 7
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Gasket_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgGasket & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,$LEV_Id$,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_Gasket_ins $PRD_Id$,$GSK_Order$,$GSK_Gap$,$GSK_Wght$,$GSK_PU$,$GSK_Type$,$GSK_IsCus$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins2 $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_ShortDescRankweil$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgGasket & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,$LEV_Id$,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Gasket_upd $PRD_Id$,$GSK_Order$,$GSK_Gap$,$GSK_Wght$,$GSK_PU$,$GSK_Type$,$GSK_IsCus$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd2 $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_ShortDescRankweil$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Gasket_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Gasket"
        .ToolbarIndex = 7
        .ToolbarID = 2840
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(6)
        .ListFieldsMandatory(0) = Array(txt_GSK_Name, 104)
        .ListFieldsMandatory(1) = Array(txt_GSK_Desc, 105)
        .ListFieldsMandatory(2) = Array(txt_GSK_Order, 106)
        .ListFieldsMandatory(3) = Array(txt_ImgId(12), 200)
        .ListFieldsMandatory(4) = Array(txt_GSK_Gap, 108)
        .ListFieldsMandatory(5) = Array(txt_GSK_Wght, 109)
        .ListFieldsMandatory(6) = Array(txt_GSK_PU, 110)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(7)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©3000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©3400®©0®©PRD_Desc®©#PRD_Desc", _
            "GSK_Order®©1000®©0®©GSK_Order®©#GSK_Order", _
            "RF_CodeGT_Id®©0®©0®©RF_CodeGT®©#RF_CodeGT", _
            "RF_Desc®©1000®©0®©RF_Desc®©#RF_Desc", _
            "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 = "DPC_Inlay"
        .MainConfigIndex = 7
        .DetailKey = 8
        .ClearControlsBeforeInit = True

        .RequestView = "exec DPC_Inlay_sel $Key1$, $toolbar_language_code$"
        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgInlay & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_Inlay_ins2 $PRD_Id$,$INL_Order$,$INL_Type$,$INL_Vend$,$INL_IsCus$,$INL_Deliv$,$INL_Purch$,$INL_CE$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
                            
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgInlay & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,NULL,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Inlay_upd2 $PRD_Id$,$INL_Order$,$INL_Type$,$INL_Vend$,$INL_IsCus$,$INL_Deliv$,$INL_Purch$,$INL_CE$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
                            
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Inlay_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Inlay"
        .ToolbarIndex = 8
        .ToolbarID = 2842
        .ToolbarFaces = Array("0", "1", "2", "3")
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(6)
        .ListFieldsMandatory(0) = Array(txt_INL_Name, 114)
        .ListFieldsMandatory(1) = Array(txt_INL_Desc, 115)
        .ListFieldsMandatory(2) = Array(txt_INL_Order, 116)
        .ListFieldsMandatory(3) = Array(txt_ImgId(13), 201)
        .ListFieldsMandatory(4) = Array(cbo_INL_Deliv, 47)
        .ListFieldsMandatory(5) = Array(cbo_INL_Purch, 48)
        .ListFieldsMandatory(6) = Array(txt_INL_CE, 203)
        
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(8)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©1000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©6400®©0®©PRD_Desc®©#PRD_Desc", _
            "INL_Order®©1000®©0®©INL_Order®©#INL_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(9)
        .FrameIndex = 9
        .NameFrame = "DPC_Packing"
        .MainConfigIndex = 8
        .DetailKey = 9
        .ClearControlsBeforeInit = True

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

        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgPacking & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_creator$", _
                            "exec DPC_Packing_ins2 $PRD_Id$,$PKG_Order$,$PKG_MaxWgh$,$PKG_PalFre$,$PKG_PakAdd$,$PKG_PalOpt$,$PKG_SmallQty$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgPacking & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,$IMG_Id$,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Packing_upd2 $PRD_Id$,$PKG_Order$,$PKG_MaxWgh$,$PKG_PalFre$,$PKG_PakAdd$,$PKG_PalOpt$,$PKG_SmallQty$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Packing_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Packing"
        .ToolbarIndex = 9
        .ToolbarID = 2847
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        '.ListFieldsDefaultValue(0) = Array(txt_PKG_Name, 0)
        '.ListFieldsDefaultValue(1) = Array(txt_PKG_Dsec, 0)
        
        ReDim .ListFieldsMandatory(8)
        .ListFieldsMandatory(0) = Array(txt_PKG_Name, 67)
        .ListFieldsMandatory(1) = Array(txt_PKG_Desc, 69)
        .ListFieldsMandatory(2) = Array(txt_PKG_Order, 68)
        .ListFieldsMandatory(3) = Array(txt_ImgId(10), 202)
        .ListFieldsMandatory(4) = Array(txt_PKG_MaxWgh, 11)
        .ListFieldsMandatory(5) = Array(txt_PKG_PalFre, 12)
        .ListFieldsMandatory(6) = Array(txt_PKG_PakAdd, 14)
        .ListFieldsMandatory(7) = Array(txt_PKG_PalOpt, 15)
        .ListFieldsMandatory(8) = Array(txt_PKG_SmallQty, 199)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(9)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©3000®©0®©PRD_Name®©#PRD_Name", _
            "PRD_Desc®©4000®©0®©PRD_Desc®©#PRD_Desc", _
            "PKG_Order®©1000®©0®©PKG_Order®©#PKG_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(10)
        .FrameIndex = 10
        .NameFrame = "DPC_Option"
        .MainConfigIndex = 9
        .DetailKey = 10
        .ClearControlsBeforeInit = True

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

        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgOption & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_creator$", _
                            "exec DPC_Option_ins $PRD_Id$,$OPT_Order$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgOption & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Option_upd $PRD_Id$,$OPT_Order$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Option_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Option"
        .ToolbarIndex = 10
        .ToolbarID = 2853
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(2)
        .ListFieldsMandatory(0) = Array(txt_OPT_PRD_Name, 91)
        .ListFieldsMandatory(1) = Array(txt_OPT_PRD_Code, 83)
        .ListFieldsMandatory(2) = Array(txt_OPT_Order, 93)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(10)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©6000®©0®©PRD_Name®©#PRD_Name", _
            "OPT_Order®©900®©0®©OPT_Order®©#OPT_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(11)
        .FrameIndex = 11
        .NameFrame = "DPC_Labeling"
        .MainConfigIndex = 11
        .DetailKey = 11
        .ClearControlsBeforeInit = True

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

        .RequestAdd = Array("exec DPC_PrdCommon_ins2 $PRD_Id$," & eDPCCategory.cgLabeling & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_creator$", _
                            "exec DPC_Labeling_ins $PRD_Id$,$LAB_Order$,$Z_creator$", _
                            "exec DPC_PrdDesc_ins $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_creator$")
        .RequestUpd = Array("exec DPC_PrdCommon_upd2 $PRD_Id$," & eDPCCategory.cgLabeling & ",NULL,'',$PRD_Code$,$PRD_CodeC$,$PRD_CodeAMC$,NULL,0,$ERR_Type$,NULL,NULL,NULL,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Labeling_upd $PRD_Id$,$LAB_Order$,$Z_last_upd_user$", _
                            "exec DPC_PrdDesc_upd $PRD_Id$,$toolbar_language_code$,$PRD_Name$,$PRD_Desc$,$Z_last_upd_user$")
        .RequestDel = Array("exec DPC_PrdCommon_del $PRD_Id$,$Z_last_upd_user$,$iConcurrency$", _
                            "exec DPC_Labeling_del $PRD_Id$,$Z_last_upd_user$")
        
        .AffectedCount = Array(-1, -1, -1, -1)
        
        .UseTransaction = True
        .TableName = "DPC_Labeling"
        .ToolbarIndex = 11
        .ToolbarID = 2931
        .ToolbarFaces = Array("0", "1", "2", "3")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(2)
        .ListFieldsMandatory(0) = Array(txt_LAB_PRD_Name, 4)
        .ListFieldsMandatory(1) = Array(txt_LAB_PRD_Code, 7)
        .ListFieldsMandatory(2) = Array(txt_LAB_Order, 5)
        
        ReDim .ListFieldsToDisable(0)
        Set .ListFieldsToDisable(0) = txt_DetailKey(11)
        
        .MainGridColumns = Array( _
            "PRD_Id®©0®©1®©PRD_Id®©#PRD_Id", _
            "PRD_Code®©1000®©0®©PRD_Code®©#PRD_Code", _
            "PRD_Name®©6000®©0®©PRD_Name®©#PRD_Name", _
            "LAB_Order®©900®©0®©LAB_Order®©#LAB_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
    
        
    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(2)
    
    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_CutArea_Loud"
        .DetailConfigIndex = 3 'LoudType
        .Initialized = False
        
        .RequestView = "exec DPC_CutArea_lst $Key1$"
        .RequestAdd = "exec DPC_CutArea_ins $CUA_Id$,$PRD_Id$,$CUA_Order$,$CUA_J$,$CUA_K$,$CUA_D$,$CUA_JMin$,$CUA_JMax$,$CUA_DMin$,$CUA_DMax$,$CUA_DMin$,$CUA_DMax$,$U_Code$"
        .RequestUpd = "exec DPC_CutArea_upd $CUA_Id$,$PRD_Id$,$CUA_Order$,$CUA_J$,$CUA_K$,$CUA_D$,$CUA_JMin$,$CUA_JMax$,$CUA_DMin$,$CUA_DMax$,$CUA_DMin$,$CUA_DMax$,$U_Code$,$iConcurrency$"
        .RequestDel = "exec DPC_CutArea_del $CUA_Id$,$U_Code$,$iConcurrency$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_CutArea"
        .TableOrder = ""
        
        .ToolbarID = 2843
        .ToolbarIndex = 0
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "CUA_Id®©0®©1®©CUA_Id®©CUA_Id", _
            "CUA_Order®©600®©0®©CUA_Order®©#CUA_Order", _
            "CUA_J®©700®©0®©CUA_J®©#CUA_J", _
            "CUA_K®©700®©0®©CUA_K®©#CUA_K", _
            "CUA_D®©700®©0®©CUA_D®©#CUA_D", _
            "CUA_JMin®©800®©0®©CUA_JMin®©#CUA_JMin", _
            "CUA_JMax®©800®©0®©CUA_JMax®©#CUA_JMax", _
            "CUA_KMin®©800®©0®©CUA_KMin®©#CUA_KMin", _
            "CUA_KMax®©800®©0®©CUA_KMax®©#CUA_KMax", _
            "CUA_DMin®©800®©0®©CUA_DMin®©#CUA_DMin", _
            "CUA_DMax®©800®©0®©CUA_DMax®©#CUA_DMax", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(txt_CUA_Order, 185)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(1)
        .FrameIndex = 1
        .NameFrame = "DPC_CutArea_Vent"
        .DetailConfigIndex = 4 'VentType
        .Initialized = False
        
        .RequestView = "exec DPC_CutArea_lst $Key1$"
        .RequestAdd = "exec DPC_CutArea_ins $CUA_Id$,$PRD_Id$,$CUA_Order$,$CUA_J$,$CUA_K$,$CUA_D$,$CUA_JMin$,$CUA_JMax$,$CUA_DMin$,$CUA_DMax$,$CUA_DMin$,$CUA_DMax$,$U_Code$"
        .RequestUpd = "exec DPC_CutArea_upd $CUA_Id$,$PRD_Id$,$CUA_Order$,$CUA_J$,$CUA_K$,$CUA_D$,$CUA_JMin$,$CUA_JMax$,$CUA_DMin$,$CUA_DMax$,$CUA_DMin$,$CUA_DMax$,$U_Code$,$iConcurrency$"
        .RequestDel = "exec DPC_CutArea_del $CUA_Id$,$U_Code$,$iConcurrency$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_CutArea"
        .TableOrder = ""
        
        .ToolbarID = 2845
        .ToolbarIndex = 1
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "CUA_Id®©0®©1®©CUA_Id®©CUA_Id", _
            "CUA_Order®©600®©0®©CUA_Order®©#CUA_Order", _
            "CUA_J®©700®©0®©CUA_J®©#CUA_J", _
            "CUA_K®©700®©0®©CUA_K®©#CUA_K", _
            "CUA_D®©700®©0®©CUA_D®©#CUA_D", _
            "CUA_JMin®©800®©0®©CUA_JMin®©#CUA_JMin", _
            "CUA_JMax®©800®©0®©CUA_JMax®©#CUA_JMax", _
            "CUA_KMin®©800®©0®©CUA_KMin®©#CUA_KMin", _
            "CUA_KMax®©800®©0®©CUA_KMax®©#CUA_KMax", _
            "CUA_DMin®©800®©0®©CUA_DMin®©#CUA_DMin", _
            "CUA_DMax®©800®©0®©CUA_DMax®©#CUA_DMax", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(txt_CUT_VET_S_Order, 186)
        
        ReDim .ListFieldsToDisable(-1 To -1)
    End With

    With mt_SubdetailConfig(2)
        .FrameIndex = 2
        .NameFrame = "DPC_CutArea_Cutout"
        .DetailConfigIndex = 5 'CutoutType
        .Initialized = False
        
        .RequestView = "exec DPC_CutArea_lst $Key1$"
        .RequestAdd = "exec DPC_CutArea_ins $CUA_Id$,$PRD_Id$,$CUA_Order$,$CUA_J$,$CUA_K$,$CUA_D$,$CUA_JMin$,$CUA_JMax$,$CUA_DMin$,$CUA_DMax$,$CUA_DMin$,$CUA_DMax$,$U_Code$"
        .RequestUpd = "exec DPC_CutArea_upd $CUA_Id$,$PRD_Id$,$CUA_Order$,$CUA_J$,$CUA_K$,$CUA_D$,$CUA_JMin$,$CUA_JMax$,$CUA_DMin$,$CUA_DMax$,$CUA_DMin$,$CUA_DMax$,$U_Code$,$iConcurrency$"
        .RequestDel = "exec DPC_CutArea_del $CUA_Id$,$U_Code$,$iConcurrency$"
        
        .RequestCheckAdd = ""
        .RequestCheckUpdate = ""
        
        .TableName = "DPC_CutArea"
        .TableOrder = ""
        
        .ToolbarID = 2844
        .ToolbarIndex = 2
        .ToolbarFaces = Array("0", "1", "2", "3", "4")
        
        .GridColumns = Array( _
            "CUA_Id®©0®©1®©CUA_Id®©CUA_Id", _
            "CUA_Order®©600®©0®©CUA_Order®©#CUA_Order", _
            "CUA_J®©700®©0®©CUA_J®©#CUA_J", _
            "CUA_K®©700®©0®©CUA_K®©#CUA_K", _
            "CUA_D®©700®©0®©CUA_D®©#CUA_D", _
            "CUA_JMin®©800®©0®©CUA_JMin®©#CUA_JMin", _
            "CUA_JMax®©800®©0®©CUA_JMax®©#CUA_JMax", _
            "CUA_KMin®©800®©0®©CUA_KMin®©#CUA_KMin", _
            "CUA_KMax®©800®©0®©CUA_KMax®©#CUA_KMax", _
            "CUA_DMin®©800®©0®©CUA_DMin®©#CUA_DMin", _
            "CUA_DMax®©800®©0®©CUA_DMax®©#CUA_DMax", _
            "RowStatus®©0®©0®©RowStatus®©#RowStatus", _
            "iConcurrency®©0®©0®©iConcurrency®©iConcurrency")
        
        ReDim .ListFieldsDefaultValue(-1 To -1)
        
        ReDim .ListFieldsMandatory(0)
        .ListFieldsMandatory(0) = Array(txt_CUT_CUT_S_Order, 187)
        
        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_Perforation
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Perforation")
    Case eTableType.ttDPC_Bending
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Bending")
    Case eTableType.ttDPC_LoudType
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_LoudType")
    Case eTableType.ttDPC_VentType
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_VentType")
    Case eTableType.ttDPC_Packing
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Packing")
    Case eTableType.ttDPC_Coating
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Color")
    Case eTableType.ttDPC_Gasket
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Gasket")
    Case eTableType.ttDPC_Inlay
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Inlay")
    Case eTableType.ttDPC_Packing
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Packing")
    Case eTableType.ttDPC_Option
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Option")
    Case eTableType.ttDPC_Surcharge
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Surcharge")
    Case eTableType.ttDPC_Labeling
        FindDetailConfigByTableType = FindDetailConfigByName("DPC_Labeling")
    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

    Dim ll_DetailFrameIndex As Long
    Dim ls_Request As String
    
    ll_DetailFrameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
    
    If ae_Mode <> emAdd Then
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Perforation" Then
            Call ShowImage(2, txt_ImgId(1), "")
            pic_ImgBox(2).Enabled = True
            cmd_ImageInfo(1).Enabled = True
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Bending" Then
            Call ShowImage(3, txt_ImgId(2), "")
            Call ShowImage(4, txt_ImgId(3), "")
            Call ShowImage(5, txt_ImgId(4), "")
            Call ShowImage(6, txt_ImgId(5), "")
            
            pic_ImgBox(3).Enabled = True
            pic_ImgBox(4).Enabled = True
            pic_ImgBox(5).Enabled = True
            pic_ImgBox(6).Enabled = True
            
            cmd_ImageInfo(2).Enabled = True
            cmd_ImageInfo(3).Enabled = True
            cmd_ImageInfo(4).Enabled = True
            cmd_ImageInfo(5).Enabled = True
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_LoudType" Then
            Call ShowImage(7, txt_ImgId(6), "")
            Call ShowImage(8, txt_ImgId(7), "")
            
            pic_ImgBox(7).Enabled = True
            pic_ImgBox(8).Enabled = True
            cmd_ImageInfo(6).Enabled = True
            cmd_ImageInfo(7).Enabled = True
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_VentType" Then
            Call ShowImage(9, txt_ImgId(8), "")
            Call ShowImage(10, txt_ImgId(9), "")
        
            pic_ImgBox(9).Enabled = True
            pic_ImgBox(10).Enabled = True
            cmd_ImageInfo(8).Enabled = True
            cmd_ImageInfo(9).Enabled = True
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_CutoutType" Then
            Call ShowImage(15, txt_ImgId(14), "")
            Call ShowImage(12, txt_ImgId(11), "")
        
            pic_ImgBox(15).Enabled = True
            pic_ImgBox(12).Enabled = True
            cmd_ImageInfo(11).Enabled = True
            cmd_ImageInfo(14).Enabled = True
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Gasket" Then
            Call ShowImage(13, txt_ImgId(12), "")
            
            pic_ImgBox(13).Enabled = True
            cmd_ImageInfo(12).Enabled = True
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Inlay" Then
            Call ShowImage(14, txt_ImgId(13), "")
        
            pic_ImgBox(14).Enabled = True
            cmd_ImageInfo(13).Enabled = True
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Packing" Then
            Call ShowImage(11, txt_ImgId(10), "")
        End If
    End If
    
    If ae_Mode = emAdd Then
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Perforation" Then
            pic_ImgBox(2).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Bending" Then
            pic_ImgBox(3).Picture = Nothing
            pic_ImgBox(4).Picture = Nothing
            pic_ImgBox(5).Picture = Nothing
            pic_ImgBox(6).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_LoudType" Then
            pic_ImgBox(7).Picture = Nothing
            pic_ImgBox(8).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_VentType" Then
            pic_ImgBox(9).Picture = Nothing
            pic_ImgBox(10).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_CutouType" Then
            pic_ImgBox(15).Picture = Nothing
            pic_ImgBox(12).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Gasket" Then
            pic_ImgBox(13).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Packing" Then
            pic_ImgBox(11).Picture = Nothing
        End If
        If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Inlay" Then
            pic_ImgBox(14).Picture = Nothing
        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, "", vbTextCompare) = 0 Then
    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
    
    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_Perforation", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(1).Text) = 0 Then
                    txt_ImgId(1).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_Bending", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(2).Text) = 0 Then
                    txt_ImgId(2).Text = ""
                End If
                If Val(txt_ImgId(3).Text) = 0 Then
                    txt_ImgId(3).Text = ""
                End If
                If Val(txt_ImgId(4).Text) = 0 Then
                    txt_ImgId(4).Text = ""
                End If
                If Val(txt_ImgId(5).Text) = 0 Then
                    txt_ImgId(5).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_LoudType", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(6).Text) = 0 Then
                    txt_ImgId(6).Text = ""
                End If
                If Val(txt_ImgId(7).Text) = 0 Then
                    txt_ImgId(7).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_VentType", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(8).Text) = 0 Then
                    txt_ImgId(8).Text = ""
                End If
                If Val(txt_ImgId(9).Text) = 0 Then
                    txt_ImgId(9).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_CutoutType", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(11).Text) = 0 Then
                    txt_ImgId(11).Text = ""
                End If
                If Val(txt_ImgId(14).Text) = 0 Then
                    txt_ImgId(14).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_Gasket", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(12).Text) = 0 Then
                    txt_ImgId(12).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_Inlay", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(13).Text) = 0 Then
                    txt_ImgId(13).Text = ""
                End If
            End If
        End If
        If StrComp(mt_MainConfig(ll_MainConfigIndex).NameFrame, "DPC_Packing", vbTextCompare) = 0 Then
            If (ae_Mode = emAdd) Or (ae_Mode = emUpdate) Then
                If Val(txt_ImgId(10).Text) = 0 Then
                    txt_ImgId(10).Text = ""
                End If
            End If
        End If
    Else
    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
                    
    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

    ll_frameIndex = mt_DetailConfig(al_DetailIndex).FrameIndex
        
    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
       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 = 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

    ll_DetailConfig = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    ll_DetailFrame = mt_DetailConfig(ll_DetailConfig).FrameIndex
                 
    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_PageNr 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 mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_CutArea_Loud" Then
        If (ae_Mode = eMode.emAdd) Then
        End If
    End If
    If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_CutArea_Vent" Then
        If (ae_Mode = eMode.emAdd) Then
        End If
    End If
    If mt_SubdetailConfig(al_SubDetailIndex).NameFrame = "DPC_CutArea_Cutout" Then
        If (ae_Mode = eMode.emAdd) Then
        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
    
    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
        
    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, "", 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("B") = True
            tlb_Main(mt_MainConfig(al_MainIndex).ToolbarIndex).ButtonEnabled("C") = True
        End If
    '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 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
    
        If StrComp(mt_MainConfig(ll_MainIndex).NameFrame, "", vbTextCompare) = 0 Then
        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 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)
        'Call LoadSelImage(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 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 lb_Result As Boolean
    
    ls_Array = Split(cmd_ImageInfo(Index).Tag, SEP2)
    
    ll_IMG_Id = Val(txt_ImgId(ls_Array(0)).Text)
              
    Call mo_Tools.LockScreen(Me, True)
    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
    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
    
    Call mo_Tools.LockScreen(Me, False)

    If lb_Result = True Then
        txt_ImgId(ls_Array(0)).Text = ll_IMG_Id
        Call ShowImage(ls_Array(1), txt_ImgId(ls_Array(0)).Text, "")
    End If
    Exit Sub
ErrHandler:
    Call ErrorMessage("cmd_ImageInfo_Click Index=" & Index)
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 UploadImage(ByVal as_FileName As String, ByVal as_IMG_Id As String)
On Error GoTo ErrHandler

Dim ll_Index As Long
Dim ls_RequestIns As String
Dim ls_Filename As String

    ls_RequestIns = "INSERT INTO DPC_Image (IMG_Id,IMG_File) VALUES ($IMG_Id$,?)"
    ls_RequestIns = ReplacePlaceHolder(ls_RequestIns, "$IMG_Id$", as_IMG_Id)
        
    If Not mo_Db.FileToBlobSQL(ls_RequestIns, as_FileName, 9) Then
        Err.Raise ArmErr.SQLFailure, "FileToBlobSQL", mo_Db.LastErrorMessage & " Error writing blob: " & ls_RequestIns & " File: " & ls_Filename
    End If
    Exit Sub
ErrHandler:
    Call ErrorHandler("UploadImage as_FileName=" & as_FileName & _
                               "")
End Sub

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))
    Else
        Call DrawSelImage(LoadPicture(as_FileName), pic_ImgBox(al_Index))
    End If
    
    ShowImage = True
    
    Exit Function
ErrHandler:
    ShowImage = False
    Call ErrorHandler("ShowImage")
End Function


'**********************************************************************************************************************************
'**********************************************************************************************************************************
' 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, Me.hwnd)
    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, Me.hwnd)
    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")
            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 REDIM <<
    
    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

'**********************************************************************************************************************************
'**********************************************************************************************************************************
' 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
    
    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, Me.hwnd)
    
    If Not mo_Tools.HasSecurityAlias(ms_LoginName, "DPC_REF") Then
        Exit Function
    End If
    
    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
        Call 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, Me.hwnd)
    
    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

    If Width < 0 Or Height < 0 Then Exit Sub
    
    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    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)
    Call grd_SubDetail(ll_frameIndex).Move(FRM_SPACE_HOR, 2 * FRM_SPACE_VER, tlb_SubDetail(ll_frameIndex).Left - 2 * FRM_SPACE_HOR, fra_SubDetail(ll_frameIndex).Height - 3 * FRM_SPACE_VER)
    
    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, Me.hwnd)
        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).DetailConfigIndex = al_DetailConfigIndex Then
            Call InitSubdetailFrame(ll_Index)
        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, Me.hwnd)
    End If
    mt_SubdetailConfig(al_SubDetailIndex).Initialized = True
    Exit Sub
ErrHandler:
    Call ErrorHandler("InitSubdetailFrame")
End Sub

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, Me.hwnd)
    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 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

    ll_frameIndex = mt_SubdetailConfig(al_SubDetailIndex).FrameIndex
    ll_DetailIndex = mt_SubdetailConfig(al_SubDetailIndex).DetailConfigIndex
    
    If (ae_Mode = emList) Or (ae_Mode = emView) Then
        fra_SubDetailItem(ll_frameIndex).Visible = False
        grd_SubDetail(ll_frameIndex).Top = 2 * FRM_SPACE_VER
        grd_SubDetail(ll_frameIndex).Height = fra_SubDetail(ll_frameIndex).Height - 3 * FRM_SPACE_VER
    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 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
            
            If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Inlay" Then
                If cbo_INL_Deliv.SelectedItem Is Nothing Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$INL_Deliv$", "0")
                ElseIf cbo_INL_Deliv.SelectedItem.Key = "" Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$INL_Deliv$", "0")
                End If
            End If
        
            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)
        
            If mt_DetailConfig(al_DetailIndex).NameFrame = "DPC_Inlay" Then
                If cbo_INL_Deliv.SelectedItem Is Nothing Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$INL_Deliv$", "0")
                ElseIf cbo_INL_Deliv.SelectedItem.Key = "" Then
                    ls_Request = ReplacePlaceHolder(ls_Request, "$INL_Deliv$", "0")
                End If
            End If
        
            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))
            ls_Request = ReplaceRequestByGridData(grd_SubDetail(ll_frameIndex), 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)
            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))
            ls_Request = ReplaceRequestByGridData(grd_SubDetail(ll_frameIndex), 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)
            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, Me.hwnd)
    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 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) >= 0 Then
                            lo_Control.Text = ao_grid.CurrentLine(lsa_Columns(0))
                        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

