VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.UserControl SOM_Navig 
   ClientHeight    =   10395
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   15090
   ScaleHeight     =   10395
   ScaleWidth      =   15090
   Begin VB.Frame fra_main 
      Height          =   3165
      Index           =   0
      Left            =   30
      TabIndex        =   2
      Top             =   1140
      Visible         =   0   'False
      Width           =   4455
      Begin VB.Frame fra_filters 
         Height          =   9015
         Index           =   0
         Left            =   90
         TabIndex        =   3
         Top             =   150
         Width           =   3975
         Begin VB.Frame Fra_FiltersGroup 
            Height          =   735
            Left            =   60
            TabIndex        =   131
            Top             =   570
            Width           =   3855
            Begin MSComctlLib.TabStrip tbs_FiltersGroupStatus 
               Height          =   375
               Left            =   150
               TabIndex        =   132
               Tag             =   "tbs_FiltersGroupStatus"
               Top             =   210
               Width           =   3555
               _ExtentX        =   6271
               _ExtentY        =   661
               TabWidthStyle   =   2
               Style           =   1
               ShowTips        =   0   'False
               TabFixedWidth   =   1990
               TabFixedHeight  =   617
               Placement       =   1
               TabMinWidth     =   882
               _Version        =   393216
               BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
                  NumTabs         =   3
                  BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
                     Caption         =   "#All"
                     Object.Tag             =   "1"
                     ImageVarType    =   2
                  EndProperty
                  BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
                     Caption         =   "#Current"
                     Object.Tag             =   "2"
                     ImageVarType    =   2
                  EndProperty
                  BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
                     Caption         =   "#Archive"
                     Object.Tag             =   "3"
                     ImageVarType    =   2
                  EndProperty
               EndProperty
            End
         End
         Begin Project1.ArmCombobox cbo_Selection 
            Height          =   345
            Index           =   0
            Left            =   60
            TabIndex        =   8
            Tag             =   "Sel_ID"
            Top             =   210
            Width           =   3405
            _extentx        =   6006
            _extenty        =   609
         End
         Begin VB.Frame fra_FiltersField 
            Caption         =   "#Filter"
            Height          =   5115
            Index           =   0
            Left            =   60
            TabIndex        =   15
            Tag             =   "fra_FiltersField"
            Top             =   3840
            Width           =   3855
            Begin VB.OptionButton opt_fieldP 
               Caption         =   "#Ceiling function"
               Height          =   285
               Index           =   6
               Left            =   330
               TabIndex        =   40
               Tag             =   "opt_fieldClgFunction®©False®©select"
               Top             =   2310
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldP 
               Caption         =   "#Sales representative"
               Height          =   285
               Index           =   5
               Left            =   330
               TabIndex        =   39
               Tag             =   "opt_fieldSalesRep®©False®©select"
               Top             =   1980
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldP 
               Caption         =   "#Size"
               Height          =   285
               Index           =   4
               Left            =   330
               TabIndex        =   38
               Tag             =   "opt_fieldSize®©False®©value"
               Top             =   1650
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldP 
               Caption         =   "#Status"
               Height          =   285
               Index           =   3
               Left            =   330
               TabIndex        =   37
               Tag             =   "opt_fieldStatus®©False®©select"
               Top             =   1320
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldP 
               Caption         =   "#Market segment"
               Height          =   285
               Index           =   2
               Left            =   330
               TabIndex        =   36
               Tag             =   "opt_fieldMKS®©False®©select"
               Top             =   990
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldP 
               Caption         =   "#Town"
               Height          =   285
               Index           =   1
               Left            =   330
               TabIndex        =   35
               Tag             =   "opt_fieldTown®©False®©Like"
               Top             =   660
               Value           =   -1  'True
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldP 
               Caption         =   "#Name"
               Height          =   285
               Index           =   0
               Left            =   330
               TabIndex        =   34
               Tag             =   "opt_fieldName®©True®©Like"
               Top             =   330
               Width           =   3045
            End
            Begin VB.Frame Fra_Select 
               Height          =   915
               Index           =   0
               Left            =   60
               TabIndex        =   32
               Top             =   4320
               Width           =   3705
               Begin Project1.ArmCombobox cbo_select 
                  Height          =   345
                  Index           =   0
                  Left            =   60
                  TabIndex        =   33
                  Tag             =   "CT_code"
                  Top             =   330
                  Width           =   3555
                  _extentx        =   6271
                  _extenty        =   609
               End
            End
            Begin VB.Frame fra_value 
               Height          =   915
               Index           =   0
               Left            =   60
               TabIndex        =   27
               Top             =   3660
               Width           =   3705
               Begin VB.OptionButton opt_operator 
                  Caption         =   ">="
                  Height          =   255
                  Index           =   2
                  Left            =   1590
                  TabIndex        =   31
                  Tag             =   "Like®©False®©??"
                  Top             =   360
                  Width           =   615
               End
               Begin VB.OptionButton opt_operator 
                  Caption         =   "<="
                  Height          =   255
                  Index           =   1
                  Left            =   840
                  TabIndex        =   30
                  Tag             =   "Like®©False®©??"
                  Top             =   360
                  Width           =   615
               End
               Begin VB.OptionButton opt_operator 
                  Caption         =   "="
                  Height          =   255
                  Index           =   0
                  Left            =   120
                  TabIndex        =   29
                  Tag             =   "Like®©True®©??"
                  Top             =   360
                  Value           =   -1  'True
                  Width           =   615
               End
               Begin VB.TextBox txt_value 
                  Alignment       =   1  'Right Justify
                  Height          =   345
                  Index           =   0
                  Left            =   2400
                  MaxLength       =   7
                  TabIndex        =   28
                  Text            =   "9999999"
                  Top             =   330
                  Width           =   1215
               End
            End
            Begin VB.Frame fra_Like 
               Height          =   915
               Index           =   0
               Left            =   60
               TabIndex        =   16
               Top             =   2730
               Width           =   3705
               Begin VB.TextBox txt_LikeStr 
                  Height          =   345
                  Index           =   0
                  Left            =   60
                  MaxLength       =   40
                  TabIndex        =   26
                  Text            =   "Text1"
                  Top             =   480
                  Width           =   3555
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   0
                  Left            =   120
                  TabIndex        =   19
                  Tag             =   "Like®©True®©??"
                  Top             =   180
                  Value           =   -1  'True
                  Width           =   195
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   1
                  Left            =   1200
                  TabIndex        =   18
                  Tag             =   "Like®©False®©??"
                  Top             =   180
                  Width           =   255
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   2
                  Left            =   2280
                  TabIndex        =   17
                  Tag             =   "Like®©False®©??"
                  Top             =   180
                  Width           =   255
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   5
                  Left            =   2970
                  TabIndex        =   25
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxxxxx"
                  Height          =   195
                  Index           =   4
                  Left            =   2520
                  TabIndex        =   24
                  Top             =   180
                  Width           =   450
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   1
                  Left            =   1680
                  TabIndex        =   22
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   3
                  Left            =   360
                  TabIndex        =   21
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxxxxx"
                  Height          =   195
                  Index           =   2
                  Left            =   600
                  TabIndex        =   20
                  Top             =   180
                  Width           =   450
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx      xxx"
                  Height          =   195
                  Index           =   0
                  Left            =   1440
                  TabIndex        =   23
                  Top             =   180
                  Width           =   720
               End
            End
         End
         Begin VB.Frame fra_FiltersCountry 
            Caption         =   "#Country"
            Height          =   825
            Index           =   0
            Left            =   60
            TabIndex        =   13
            Tag             =   "fra_FiltersCountry"
            Top             =   2940
            Width           =   3855
            Begin Project1.ArmCombobox cbo_FiltersCountry 
               Height          =   345
               Index           =   0
               Left            =   60
               TabIndex        =   14
               Tag             =   "CT_code"
               Top             =   330
               Width           =   3735
               _extentx        =   6588
               _extenty        =   609
            End
         End
         Begin VB.CommandButton btn_Selection 
            Caption         =   "..."
            Height          =   345
            Index           =   0
            Left            =   3450
            TabIndex        =   9
            Top             =   210
            Width           =   435
         End
         Begin VB.Frame fra_FiltersDate 
            Caption         =   "#Date"
            Height          =   1485
            Index           =   0
            Left            =   60
            TabIndex        =   5
            Tag             =   "fra_FiltersDate"
            Top             =   1380
            Width           =   3855
            Begin VB.OptionButton opt_FiltersDate 
               Caption         =   "#All"
               Height          =   255
               Index           =   0
               Left            =   120
               TabIndex        =   7
               Tag             =   "optFiltersDate_All"
               Top             =   240
               Value           =   -1  'True
               Width           =   1455
            End
            Begin VB.OptionButton opt_FiltersDate 
               Caption         =   "#Between"
               Height          =   255
               Index           =   1
               Left            =   1800
               TabIndex        =   6
               Tag             =   "optFiltersDate_Between"
               Top             =   240
               Width           =   1455
            End
            Begin Project1.A_calocx cal_filtersMax 
               Height          =   375
               Index           =   0
               Left            =   1980
               TabIndex        =   10
               Top             =   930
               Width           =   1815
               _extentx        =   3201
               _extenty        =   661
            End
            Begin Project1.A_calocx cal_FiltersMin 
               Height          =   375
               Index           =   0
               Left            =   60
               TabIndex        =   11
               Top             =   930
               Width           =   1815
               _extentx        =   3201
               _extenty        =   661
            End
            Begin Project1.ArmCombobox cbo_FiltersDate 
               Height          =   345
               Index           =   0
               Left            =   60
               TabIndex        =   12
               Top             =   540
               Width           =   3735
               _extentx        =   6588
               _extenty        =   609
            End
         End
      End
      Begin Project1.ArmGrid grd_main 
         Height          =   2925
         Index           =   0
         Left            =   4080
         TabIndex        =   4
         Tag             =   "grd_main0"
         Top             =   240
         Width           =   5535
         _extentx        =   19182
         _extenty        =   15690
      End
   End
   Begin Project1.SOM_Project SOM_Project 
      Height          =   2595
      Left            =   720
      TabIndex        =   130
      Top             =   6960
      Visible         =   0   'False
      Width           =   1905
      _extentx        =   3360
      _extenty        =   4577
   End
   Begin Project1.SOM_Customer SOM_Customer 
      Height          =   2565
      Left            =   5970
      TabIndex        =   129
      Top             =   6900
      Visible         =   0   'False
      Width           =   2025
      _extentx        =   3572
      _extenty        =   4524
   End
   Begin Project1.Saved_Select SOM_Selection 
      Height          =   2040
      Index           =   0
      Left            =   75
      TabIndex        =   128
      Top             =   4575
      Visible         =   0   'False
      Width           =   1665
      _extentx        =   2937
      _extenty        =   3598
   End
   Begin VB.Frame fra_main 
      Height          =   3255
      Index           =   2
      Left            =   9690
      TabIndex        =   76
      Top             =   1110
      Visible         =   0   'False
      Width           =   4755
      Begin VB.Frame fra_filters 
         Height          =   9015
         Index           =   2
         Left            =   90
         TabIndex        =   77
         Top             =   150
         Width           =   3975
         Begin VB.Frame fra_FiltersField 
            Caption         =   "#Filter"
            Height          =   5655
            Index           =   2
            Left            =   60
            TabIndex        =   87
            Tag             =   "fra_FiltersField"
            Top             =   3300
            Width           =   3855
            Begin Project1.ArmCombobox cbo_filtersType 
               Height          =   345
               Left            =   90
               TabIndex        =   121
               Top             =   2340
               Width           =   3675
               _extentx        =   6482
               _extenty        =   609
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Value CHF"
               Height          =   285
               Index           =   9
               Left            =   330
               TabIndex        =   120
               Tag             =   "opt_fieldValueCHF®©False®©Value"
               Top             =   3840
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#DB%"
               Height          =   285
               Index           =   8
               Left            =   330
               TabIndex        =   119
               Tag             =   "opt_fieldDB®©False®©Value"
               Top             =   3510
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Prime margin"
               Height          =   285
               Index           =   10
               Left            =   330
               TabIndex        =   118
               Tag             =   "opt_fieldPrimeMargin®©False®©Value"
               Top             =   4170
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#System"
               Height          =   285
               Index           =   6
               Left            =   330
               TabIndex        =   108
               Tag             =   "opt_fieldSystem®©False®©Select"
               Top             =   2850
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Won / Lost / Duplicates"
               Height          =   285
               Index           =   5
               Left            =   330
               TabIndex        =   107
               Tag             =   "opt_fieldStatus®©False®©Select"
               Top             =   1980
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Back office person"
               Height          =   285
               Index           =   4
               Left            =   330
               TabIndex        =   106
               Tag             =   "opt_fieldBOperson®©False®©Select"
               Top             =   1650
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Sales rep"
               Height          =   285
               Index           =   3
               Left            =   330
               TabIndex        =   105
               Tag             =   "opt_fieldQuoteSalesRep®©False®©Select"
               Top             =   1320
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Freight Cost"
               Height          =   285
               Index           =   2
               Left            =   330
               TabIndex        =   104
               Tag             =   "opt_fieldFreightCost®©False®©Value"
               Top             =   990
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Realisation"
               Height          =   285
               Index           =   1
               Left            =   330
               TabIndex        =   103
               Tag             =   "opt_fieldRealisation®©False®©Select"
               Top             =   660
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Reference number"
               Height          =   285
               Index           =   0
               Left            =   330
               TabIndex        =   102
               Tag             =   "opt_fieldRefNum®©True®©Like"
               Top             =   330
               Value           =   -1  'True
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldQ 
               Caption         =   "#Area"
               Height          =   285
               Index           =   7
               Left            =   330
               TabIndex        =   88
               Tag             =   "opt_fieldArea®©False®©Value"
               Top             =   3180
               Width           =   3045
            End
            Begin VB.Frame fra_value 
               Height          =   915
               Index           =   2
               Left            =   60
               TabIndex        =   113
               Top             =   4530
               Width           =   3705
               Begin VB.TextBox txt_value 
                  Alignment       =   1  'Right Justify
                  Height          =   345
                  Index           =   2
                  Left            =   2400
                  MaxLength       =   7
                  TabIndex        =   117
                  Text            =   "9999999"
                  Top             =   330
                  Width           =   1215
               End
               Begin VB.OptionButton opt_operator 
                  Caption         =   "="
                  Height          =   255
                  Index           =   5
                  Left            =   120
                  TabIndex        =   116
                  Tag             =   "Like®©True®©??"
                  Top             =   360
                  Value           =   -1  'True
                  Width           =   615
               End
               Begin VB.OptionButton opt_operator 
                  Caption         =   "<="
                  Height          =   255
                  Index           =   4
                  Left            =   840
                  TabIndex        =   115
                  Tag             =   "Like®©False®©??"
                  Top             =   360
                  Width           =   615
               End
               Begin VB.OptionButton opt_operator 
                  Caption         =   ">="
                  Height          =   255
                  Index           =   3
                  Left            =   1590
                  TabIndex        =   114
                  Tag             =   "Like®©False®©??"
                  Top             =   360
                  Width           =   615
               End
            End
            Begin VB.Frame Fra_Select 
               Height          =   915
               Index           =   2
               Left            =   30
               TabIndex        =   100
               Top             =   4470
               Width           =   3705
               Begin Project1.ArmCombobox cbo_select 
                  Height          =   345
                  Index           =   2
                  Left            =   60
                  TabIndex        =   101
                  Tag             =   "CT_code"
                  Top             =   330
                  Width           =   3555
                  _extentx        =   6271
                  _extenty        =   609
               End
            End
            Begin VB.Frame fra_Like 
               Height          =   915
               Index           =   2
               Left            =   120
               TabIndex        =   89
               Top             =   4620
               Width           =   3705
               Begin VB.TextBox txt_LikeStr 
                  Height          =   345
                  Index           =   2
                  Left            =   60
                  MaxLength       =   40
                  TabIndex        =   93
                  Text            =   "Text1"
                  Top             =   480
                  Width           =   3555
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   6
                  Left            =   120
                  TabIndex        =   92
                  Tag             =   "Like®©True®©??"
                  Top             =   180
                  Value           =   -1  'True
                  Width           =   195
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   7
                  Left            =   1200
                  TabIndex        =   91
                  Tag             =   "Like®©False®©??"
                  Top             =   180
                  Width           =   255
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   8
                  Left            =   2280
                  TabIndex        =   90
                  Tag             =   "Like®©False®©??"
                  Top             =   180
                  Width           =   255
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   16
                  Left            =   2970
                  TabIndex        =   98
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxxxxx"
                  Height          =   195
                  Index           =   15
                  Left            =   2520
                  TabIndex        =   97
                  Top             =   180
                  Width           =   450
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   14
                  Left            =   1680
                  TabIndex        =   96
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   13
                  Left            =   360
                  TabIndex        =   95
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxxxxx"
                  Height          =   195
                  Index           =   12
                  Left            =   600
                  TabIndex        =   94
                  Top             =   180
                  Width           =   450
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx      xxx"
                  Height          =   195
                  Index           =   17
                  Left            =   1440
                  TabIndex        =   99
                  Top             =   180
                  Width           =   720
               End
            End
         End
         Begin VB.Frame fra_FiltersCountry 
            Caption         =   "#Country"
            Height          =   1065
            Index           =   2
            Left            =   60
            TabIndex        =   85
            Tag             =   "fra_FiltersCountry"
            Top             =   2160
            Width           =   3855
            Begin VB.OptionButton opt_FiltersCountry 
               Caption         =   "#Customer"
               Height          =   255
               Index           =   1
               Left            =   1830
               TabIndex        =   112
               Tag             =   "opt_FiltersCountry"
               Top             =   270
               Width           =   1605
            End
            Begin VB.OptionButton opt_FiltersCountry 
               Caption         =   "#Project"
               Height          =   255
               Index           =   0
               Left            =   120
               TabIndex        =   111
               Tag             =   "opt_FiltersCountry"
               Top             =   270
               Width           =   1605
            End
            Begin Project1.ArmCombobox cbo_FiltersCountry 
               Height          =   345
               Index           =   2
               Left            =   60
               TabIndex        =   86
               Tag             =   "CT_code"
               Top             =   540
               Width           =   3735
               _extentx        =   6588
               _extenty        =   609
            End
         End
         Begin VB.CommandButton btn_Selection 
            Caption         =   "..."
            Height          =   345
            Index           =   2
            Left            =   3450
            TabIndex        =   84
            Top             =   210
            Width           =   435
         End
         Begin VB.Frame fra_FiltersDate 
            Caption         =   "#Date"
            Height          =   1485
            Index           =   2
            Left            =   60
            TabIndex        =   78
            Tag             =   "fra_FiltersDate"
            Top             =   600
            Width           =   3855
            Begin VB.OptionButton opt_FiltersDate 
               Caption         =   "#All"
               Height          =   255
               Index           =   5
               Left            =   120
               TabIndex        =   80
               Tag             =   "optFiltersDate_All"
               Top             =   240
               Value           =   -1  'True
               Width           =   1455
            End
            Begin VB.OptionButton opt_FiltersDate 
               Caption         =   "#Between"
               Height          =   255
               Index           =   4
               Left            =   1800
               TabIndex        =   79
               Tag             =   "optFiltersDate_Between"
               Top             =   240
               Width           =   1455
            End
            Begin Project1.A_calocx cal_filtersMax 
               Height          =   375
               Index           =   2
               Left            =   1980
               TabIndex        =   81
               Top             =   930
               Width           =   1815
               _extentx        =   3201
               _extenty        =   661
            End
            Begin Project1.A_calocx cal_FiltersMin 
               Height          =   375
               Index           =   2
               Left            =   60
               TabIndex        =   82
               Top             =   930
               Width           =   1815
               _extentx        =   3201
               _extenty        =   661
            End
            Begin Project1.ArmCombobox cbo_FiltersDate 
               Height          =   345
               Index           =   2
               Left            =   60
               TabIndex        =   83
               Top             =   540
               Width           =   3735
               _extentx        =   6588
               _extenty        =   609
            End
         End
         Begin Project1.ArmCombobox cbo_Selection 
            Height          =   345
            Index           =   2
            Left            =   60
            TabIndex        =   109
            Tag             =   "Sel_ID"
            Top             =   210
            Width           =   3405
            _extentx        =   6006
            _extenty        =   609
         End
      End
      Begin Project1.ArmGrid grd_main 
         Height          =   2925
         Index           =   2
         Left            =   4200
         TabIndex        =   110
         Tag             =   "grd_main2"
         Top             =   150
         Width           =   5535
         _extentx        =   19182
         _extenty        =   15690
      End
   End
   Begin VB.Frame fra_main 
      Height          =   3195
      Index           =   1
      Left            =   4650
      TabIndex        =   41
      Top             =   1140
      Visible         =   0   'False
      Width           =   4815
      Begin VB.Frame fra_filters 
         Height          =   9015
         Index           =   1
         Left            =   90
         TabIndex        =   43
         Top             =   150
         Width           =   3975
         Begin VB.Frame fra_FiltersDate 
            Caption         =   "#Date"
            Height          =   1485
            Index           =   1
            Left            =   60
            TabIndex        =   68
            Tag             =   "fra_FiltersDate"
            Top             =   600
            Width           =   3855
            Begin VB.OptionButton opt_FiltersDate 
               Caption         =   "#Between"
               Height          =   255
               Index           =   3
               Left            =   1800
               TabIndex        =   70
               Tag             =   "optFiltersDate_Between"
               Top             =   240
               Width           =   1455
            End
            Begin VB.OptionButton opt_FiltersDate 
               Caption         =   "#All"
               Height          =   255
               Index           =   2
               Left            =   120
               TabIndex        =   69
               Tag             =   "optFiltersDate_All"
               Top             =   240
               Value           =   -1  'True
               Width           =   1455
            End
            Begin Project1.A_calocx cal_filtersMax 
               Height          =   375
               Index           =   1
               Left            =   1980
               TabIndex        =   71
               Top             =   930
               Width           =   1815
               _extentx        =   3201
               _extenty        =   661
            End
            Begin Project1.A_calocx cal_FiltersMin 
               Height          =   375
               Index           =   1
               Left            =   60
               TabIndex        =   72
               Top             =   930
               Width           =   1815
               _extentx        =   3201
               _extenty        =   661
            End
            Begin Project1.ArmCombobox cbo_FiltersDate 
               Height          =   345
               Index           =   1
               Left            =   60
               TabIndex        =   73
               Top             =   540
               Width           =   3735
               _extentx        =   6588
               _extenty        =   609
            End
         End
         Begin VB.CommandButton btn_Selection 
            Caption         =   "..."
            Height          =   345
            Index           =   1
            Left            =   3450
            TabIndex        =   67
            Top             =   210
            Width           =   435
         End
         Begin VB.Frame fra_FiltersCountry 
            Caption         =   "#Country"
            Height          =   825
            Index           =   1
            Left            =   60
            TabIndex        =   65
            Tag             =   "fra_FiltersCountry"
            Top             =   2160
            Width           =   3855
            Begin Project1.ArmCombobox cbo_FiltersCountry 
               Height          =   345
               Index           =   1
               Left            =   60
               TabIndex        =   66
               Tag             =   "CT_code"
               Top             =   330
               Width           =   3735
               _extentx        =   6588
               _extenty        =   609
            End
         End
         Begin VB.Frame fra_FiltersField 
            Caption         =   "#Filter"
            Height          =   5895
            Index           =   1
            Left            =   60
            TabIndex        =   44
            Tag             =   "fra_FiltersField"
            Top             =   3060
            Width           =   3855
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Sales rep"
               Height          =   285
               Index           =   7
               Left            =   330
               TabIndex        =   75
               Tag             =   "opt_fieldCustSalesRep®©False®©Select"
               Top             =   2640
               Width           =   3045
            End
            Begin VB.Frame fra_Like 
               Height          =   915
               Index           =   1
               Left            =   60
               TabIndex        =   54
               Top             =   3030
               Width           =   3705
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   5
                  Left            =   2280
                  TabIndex        =   58
                  Tag             =   "Like®©False®©??"
                  Top             =   180
                  Width           =   255
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   4
                  Left            =   1200
                  TabIndex        =   57
                  Tag             =   "Like®©False®©??"
                  Top             =   180
                  Width           =   255
               End
               Begin VB.OptionButton opt_Like 
                  Height          =   255
                  Index           =   3
                  Left            =   120
                  TabIndex        =   56
                  Tag             =   "Like®©True®©??"
                  Top             =   180
                  Value           =   -1  'True
                  Width           =   195
               End
               Begin VB.TextBox txt_LikeStr 
                  Height          =   345
                  Index           =   1
                  Left            =   60
                  MaxLength       =   40
                  TabIndex        =   55
                  Text            =   "Text1"
                  Top             =   480
                  Width           =   3555
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxxxxx"
                  Height          =   195
                  Index           =   10
                  Left            =   600
                  TabIndex        =   63
                  Top             =   180
                  Width           =   450
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   9
                  Left            =   360
                  TabIndex        =   62
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   8
                  Left            =   1680
                  TabIndex        =   61
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxxxxx"
                  Height          =   195
                  Index           =   7
                  Left            =   2520
                  TabIndex        =   60
                  Top             =   180
                  Width           =   450
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx"
                  ForeColor       =   &H000000FF&
                  Height          =   195
                  Index           =   6
                  Left            =   2970
                  TabIndex        =   59
                  Top             =   180
                  Width           =   225
               End
               Begin VB.Label lbl_Like 
                  AutoSize        =   -1  'True
                  Caption         =   "xxx      xxx"
                  Height          =   195
                  Index           =   11
                  Left            =   1440
                  TabIndex        =   64
                  Top             =   180
                  Width           =   720
               End
            End
            Begin VB.Frame Fra_Select 
               Height          =   915
               Index           =   1
               Left            =   60
               TabIndex        =   52
               Top             =   3960
               Width           =   3705
               Begin Project1.ArmCombobox cbo_select 
                  Height          =   345
                  Index           =   1
                  Left            =   60
                  TabIndex        =   53
                  Tag             =   "CT_code"
                  Top             =   330
                  Width           =   3555
                  _extentx        =   6271
                  _extenty        =   609
               End
            End
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Name"
               Height          =   285
               Index           =   0
               Left            =   330
               TabIndex        =   51
               Tag             =   "opt_fieldCustName®©True®©Like"
               Top             =   330
               Value           =   -1  'True
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Address"
               Height          =   285
               Index           =   1
               Left            =   330
               TabIndex        =   50
               Tag             =   "opt_fieldCustAddr®©False®©Like"
               Top             =   660
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Town"
               Height          =   285
               Index           =   2
               Left            =   330
               TabIndex        =   49
               Tag             =   "opt_fieldCustTown®©False®©Like"
               Top             =   990
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Zip Code"
               Height          =   285
               Index           =   3
               Left            =   330
               TabIndex        =   48
               Tag             =   "opt_fieldCustZip®©False®©Like"
               Top             =   1320
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Telephone no."
               Height          =   285
               Index           =   4
               Left            =   330
               TabIndex        =   47
               Tag             =   "opt_fieldCustTel®©False®©Like"
               Top             =   1650
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Fax no."
               Height          =   285
               Index           =   5
               Left            =   330
               TabIndex        =   46
               Tag             =   "opt_fieldCustFax®©False®©Like"
               Top             =   1980
               Width           =   3045
            End
            Begin VB.OptionButton opt_fieldC 
               Caption         =   "#Type"
               Height          =   285
               Index           =   6
               Left            =   330
               TabIndex        =   45
               Tag             =   "opt_fieldType®©False®©Select"
               Top             =   2310
               Width           =   3045
            End
         End
         Begin Project1.ArmCombobox cbo_Selection 
            Height          =   345
            Index           =   1
            Left            =   60
            TabIndex        =   74
            Tag             =   "Sel_ID"
            Top             =   210
            Width           =   3405
            _extentx        =   6006
            _extenty        =   609
         End
      End
      Begin Project1.ArmGrid grd_main 
         Height          =   2925
         Index           =   1
         Left            =   4470
         TabIndex        =   42
         Tag             =   "grd_main1"
         Top             =   210
         Width           =   5535
         _extentx        =   19182
         _extenty        =   15690
      End
   End
   Begin Project1.SOM_ExcelExp SOM_ExcelExp 
      Height          =   2055
      Index           =   0
      Left            =   2010
      TabIndex        =   122
      Top             =   4620
      Visible         =   0   'False
      Width           =   1755
      _extentx        =   3096
      _extenty        =   3625
   End
   Begin MSComctlLib.TabStrip tbs_Navigator 
      Height          =   375
      Left            =   0
      TabIndex        =   1
      Tag             =   "tbs_Navigator"
      Top             =   0
      Visible         =   0   'False
      Width           =   6015
      _ExtentX        =   10610
      _ExtentY        =   661
      TabWidthStyle   =   2
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   3
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Project"
            Object.Tag             =   "0"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Customer"
            Object.Tag             =   "1"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Quotation"
            Object.Tag             =   "2"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin Project1.ToolbarControl tbl_main 
      Height          =   690
      Left            =   0
      TabIndex        =   0
      Top             =   420
      Visible         =   0   'False
      Width           =   6885
      _extentx        =   12144
      _extenty        =   1217
   End
   Begin Project1.SOM_ExcelExp SOM_ExcelExp 
      Height          =   2055
      Index           =   1
      Left            =   7050
      TabIndex        =   123
      Top             =   4650
      Visible         =   0   'False
      Width           =   1755
      _extentx        =   3096
      _extenty        =   3625
   End
   Begin Project1.SOM_Quote SOM_Quote 
      Height          =   2715
      Left            =   11010
      TabIndex        =   126
      Top             =   6900
      Visible         =   0   'False
      Width           =   2445
      _extentx        =   4313
      _extenty        =   4789
   End
   Begin Project1.SOM_ExcelExp SOM_ExcelExp 
      Height          =   2055
      Index           =   2
      Left            =   11970
      TabIndex        =   127
      Top             =   4590
      Visible         =   0   'False
      Width           =   1755
      _extentx        =   3096
      _extenty        =   3625
   End
   Begin Project1.Saved_Select SOM_Selection 
      Height          =   2190
      Index           =   2
      Left            =   10050
      TabIndex        =   124
      Top             =   4575
      Visible         =   0   'False
      Width           =   1665
      _extentx        =   2937
      _extenty        =   3863
   End
   Begin Project1.Saved_Select SOM_Selection 
      Height          =   2115
      Index           =   1
      Left            =   4950
      TabIndex        =   125
      Top             =   4575
      Visible         =   0   'False
      Width           =   1665
      _extentx        =   2937
      _extenty        =   3731
   End
End
Attribute VB_Name = "SOM_Navig"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public Event OnExit()

Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwnd As Long) As Long

Private Const SCREEN_NAME As String = "SOM_NAVIG"

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


Private Const COLOR_ADDLINE As Long = &HFFFFC0
Private Const COLOR_UPDLINE As Long = &HFFFFC0


Private Const LOCALE_USER_DEFAULT = &H400
Private ms_DecimalSeparator  As String
Private ms_ThousandSeparator As String
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

Private Const LOCALE_SDECIMAL = &HE ' Decimal separator
Private Const LOCALE_STHOUSAND = &HF ' Thousand separator

Const C_ERRORRAISE As Long = 3000

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
End Enum

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


#If LIVE Then
    Private mo_Db                   As Object
#Else
    Private mo_Db                   As ArmDb
#End If

Private mb_Initialized              As Boolean
Private ms_LoginName                As String
Private ms_FullUserName             As String
Private ms_Language_Code            As String
Private ml_UCode                    As Long

Private mb_IsFullAccess As Boolean

Private ml_LocalID As Long

Private mb_IsVisible As Boolean

Private mb_Internal As Boolean


Private Type TConfigTab
    RequestGrid As String
End Type

Private mt_ClassInfoLst() As TConfigTab

Private Declare Function GetComputerName Lib "kernel32" _
        Alias "GetComputerNameA" (ByVal lpBuffer As String, _
        nSize As Long) As Long

Private Function ComputerName() As String
  Dim lsBuffer As String
  Dim llReturn As Long
  Dim lsName As String
 
  lsName = ""
  lsBuffer = Space$(255)
  llReturn = GetComputerName(lsBuffer, 255)
  
  If llReturn Then
        lsName = Left$(lsBuffer, InStr(lsBuffer, Chr(0)) - 1)
  End If
  
  ComputerName = lsName
  
End Function



#If LIVE Then
Public Property Set DB(ByRef aDb As Object)
#Else
Public Property Set DB(ByRef aDb As ArmDb)
#End If
    Set mo_Db = aDb
End Property

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

Public Property Let LoginName(ByVal aLoginName As String)
    ms_LoginName = aLoginName
End Property

Public Property Let FullUserName(ByVal aFullUserName As String)
    ms_FullUserName = aFullUserName
End Property
Public Property Let Ucode(ByVal aUcode As Long)
    ml_UCode = aUcode
End Property

Public Property Let Language_Code(ByVal aLanguage_Code As String)
    ms_Language_Code = aLanguage_Code
End Property


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

Public Property Get IsVisible() As Boolean
    IsVisible = mb_IsVisible
End Property

Public Property Get A_Visible() As Boolean
    A_Visible = UserControl.Extender.Visible
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 Sub Notify(ByVal ae_CptType As eComponent, ByVal ae_Mode As eMode, ByVal al_Key As Long, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
    Debug.Assert (mb_Initialized = True)
    
    
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("Notify")
End Sub

Public Function Load_A_Com() As Boolean

On Error GoTo ErrHandler

    If mb_Initialized Then Exit Function
    
    Call LockScreen(True)
    
'to handle Decimal with the local settings
    Dim sBuffer As String
    Dim nBufferLen As Long
    Dim LCID As Long

    LCID = GetSystemDefaultLCID

    ms_DecimalSeparator = Format(0, ".")

    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
    
    
    
    
    mb_IsFullAccess = SOM_lib.IsFullAccess
    ml_LocalID = GetLCIDFromCodePage(Get_Code_Page)

    Call Components_Settings
    
    Call InitComponents_Size
    
    Call Load_ClassInfo
    
    Call InitComponents
    
    Call LoadAllLabels
    
    Call LockScreen(False)
    
    mb_Initialized = True
    
    Call LogMessage("ComputerName: '" & ComputerName & "' | LoginName: '" & ms_LoginName & "' | ThousandSeparator: '" & ms_ThousandSeparator & "' | DecimalSeparator: '" & ms_DecimalSeparator & "' | Date: '" & Now & "'", "I")
    
    Load_A_Com = True
    
    Exit Function

ErrHandler:
    Call LockScreen(False)
    Call ErrorHandler("Load_A_Com")
End Function
Private Function Get_Code_Page() As Long
On Error GoTo ErrHandler

    Const Request As String = "SELECT Code_Page FROM Language WHERE Language_code = '$Language_code$'"
    
    Static lb_HasRun As Boolean
    Static ls_code_page As Long

    
    
    Dim ls_Req As String
    Dim ll_curs As Long
    If Not lb_HasRun Then
        ls_Req = Replace(Request, "$Language_code$", ms_Language_Code, , , vbTextCompare)
        
        ll_curs = OpenSQLSafe(mo_Db, ls_Req)
        
        If mo_Db.RowCount(ll_curs) = 0 Then
             Err.Raise C_ERRORRAISE + 503, , "Enable to get the code page for the language " & ms_Language_Code & " - " & Join(mo_Db.SQLErrorMessages, vbCrLf)
        End If
        
        ls_code_page = mo_Db.GetFields(ll_curs, "Code_Page")
        
        mo_Db.Close (ll_curs)
    End If
    
    Get_Code_Page = ls_code_page
    
    
    Exit Function

ErrHandler:
    mo_Db.Close (ll_curs)
    Call ErrorHandler("Get_Code_Page")
End Function
Private Sub Components_Settings()
On Error GoTo ErrHandler



    Call Component_SetUp(tbs_Navigator, "tbs_Navigator", 1)
    Call Component_SetUp(SOM_Selection(1), "", 129)
    Call Component_SetUp(SOM_Selection(0), "", 128)
    Call Component_SetUp(SOM_Customer, "", 125)
    Call Component_SetUp(SOM_Project, "", 124)
    Call Component_SetUp(SOM_ExcelExp(0), "", 122)
    Call Component_SetUp(tbl_main, "")
    Call Component_SetUp(SOM_ExcelExp(1), "", 123)
    Call Component_SetUp(SOM_Quote, "", 126)
    Call Component_SetUp(SOM_ExcelExp(2), "", 127)
    Call Component_SetUp(SOM_Selection(2), "", 130)
    
    
'-- Quote
    Call Component_SetUp(fra_main(2), "")
    Call Component_SetUp(fra_filters(2), "")
    Call Component_SetUp(fra_FiltersField(2), "fra_FiltersField")
    Call Component_SetUp(cbo_filtersType, "cbo_filtersType" & SEP & "$SystemType$", 121)
    Call Component_SetUp(opt_fieldQ(9), "opt_fieldValueCHF" & SEP & "False" & SEP & "Value" & SEP & "$Value_CHF$" & SEP & "0" & SEP & "" & SEP & "", 120)
    Call Component_SetUp(opt_fieldQ(8), "opt_fieldDB" & SEP & "False" & SEP & "Value" & SEP & "$DB$" & SEP & "0" & SEP & "0" & SEP & "1000", 119)
    Call Component_SetUp(opt_fieldQ(10), "opt_fieldPrimeMargin" & SEP & "False" & SEP & "Value" & SEP & "$PrimeMargin$" & SEP & "2" & SEP & "" & SEP & "", 118)
    Call Component_SetUp(opt_fieldQ(7), "opt_fieldArea" & SEP & "False" & SEP & "Value" & SEP & "$Area$" & SEP & "0" & SEP & "" & SEP & "", 88)
    Call Component_SetUp(opt_fieldQ(6), "opt_fieldSystem" & SEP & "False" & SEP & "Select" & SEP & "$SS_code$", 108)
    Call Component_SetUp(opt_fieldQ(5), "opt_fieldWLD" & SEP & "False" & SEP & "Select" & SEP & "$Status$", 107)
    Call Component_SetUp(opt_fieldQ(4), "opt_fieldBOperson" & SEP & "False" & SEP & "Select" & SEP & "$BO_SSR_code$", 106)
    Call Component_SetUp(opt_fieldQ(3), "opt_fieldQuoteSalesRep" & SEP & "False" & SEP & "Select" & SEP & "$SSR_code$", 105)
    Call Component_SetUp(opt_fieldQ(2), "opt_fieldFreightCost" & SEP & "False" & SEP & "Value" & SEP & "$Quote_FRGHTCost_CHF$" & SEP & "0" & SEP & "0" & SEP & "99999999", 104)
    Call Component_SetUp(opt_fieldQ(1), "opt_fieldRealisation" & SEP & "False" & SEP & "Select" & SEP & "$RL_code$", 103)
    Call Component_SetUp(opt_fieldQ(0), "opt_fieldRefNum" & SEP & "False" & SEP & "Like" & SEP & "$Reference$", 102)
    
    Call Component_SetUp(fra_Like(2), "")
    Call Component_SetUp(txt_LikeStr(2), "txt_LikeStr", 93)
    Call Component_SetUp(opt_Like(6), "Like6" & SEP & "False", 92)
    Call Component_SetUp(opt_Like(7), "Like7" & SEP & "False", 91)
    Call Component_SetUp(opt_Like(8), "Like8" & SEP & "False", 90)
    
    
    Call Component_SetUp(fra_value(2), "")
    Call Component_SetUp(txt_value(2), "txt_value", 117)
    Call Component_SetUp(opt_operator(5), "operat5" & SEP & "False" & SEP & "$Op_Type$", 116)
    Call Component_SetUp(opt_operator(4), "operat4" & SEP & "False" & SEP & "$Op_Type$", 115)
    Call Component_SetUp(opt_operator(3), "operat3" & SEP & "False" & SEP & "$Op_Type$", 114)
    Call Component_SetUp(Fra_Select(2), "")
    Call Component_SetUp(cbo_select(2), "cbo_select", 101)
    Call Component_SetUp(fra_FiltersCountry(2), "fra_FiltersCountry")
    Call Component_SetUp(opt_FiltersCountry(1), "opt_FiltersCountryCus" & SEP & "False" & SEP & "$CT_ProjCust$", 112)
    Call Component_SetUp(opt_FiltersCountry(0), "opt_FiltersCountryPrj" & SEP & "False" & SEP & "$CT_ProjCust$", 111)
    Call Component_SetUp(cbo_FiltersCountry(2), "CT_code" & SEP & "$CT_code$", 86)
    Call Component_SetUp(btn_Selection(2), "", 84)
    
    Call Component_SetUp(fra_FiltersDate(2), "fra_FiltersDate")
    Call Component_SetUp(opt_FiltersDate(5), "optFiltersDate_All" & SEP & "False", 80)
    Call Component_SetUp(opt_FiltersDate(4), "optFiltersDate_Between" & SEP & "False", 79)
    
    Call Component_SetUp(cal_filtersMax(2), "cal_filtersMax" & SEP & "$DateMax$", 81)
    Call Component_SetUp(cal_FiltersMin(2), "cal_FiltersMin" & SEP & "$DateMin$", 82)
    Call Component_SetUp(cbo_FiltersDate(2), "cbo_FiltersDate" & SEP & "$DateType$", 83)
    
    Call Component_SetUp(cbo_Selection(2), "Sel_ID", 109)
    Call Component_SetUp(grd_main(2), "grd_main2")
    
'-- Customer
    Call Component_SetUp(fra_main(1), "")
    Call Component_SetUp(fra_filters(1), "")
    Call Component_SetUp(fra_FiltersDate(1), "fra_FiltersDate")
    Call Component_SetUp(opt_FiltersDate(3), "optFiltersDate_Between" & SEP & "False", 70)
    Call Component_SetUp(opt_FiltersDate(2), "optFiltersDate_All" & SEP & "False", 69)
    Call Component_SetUp(cal_filtersMax(1), "cal_filtersMax" & SEP & "$DateMax$", 71)
    Call Component_SetUp(cal_FiltersMin(1), "cal_FiltersMin" & SEP & "$DateMin$", 72)
    Call Component_SetUp(cbo_FiltersDate(1), "cbo_FiltersDate" & SEP & "$DateType$", 73)
    Call Component_SetUp(btn_Selection(1), "", 67)
    Call Component_SetUp(fra_FiltersCountry(1), "fra_FiltersCountry")
    Call Component_SetUp(cbo_FiltersCountry(1), "CT_code" & SEP & "$CT_code$", 66)
    Call Component_SetUp(fra_FiltersField(1), "fra_FiltersField")
    Call Component_SetUp(fra_Like(1), "")
    Call Component_SetUp(opt_Like(5), "Like5" & SEP & "False" & SEP & "??", 58)
    Call Component_SetUp(opt_Like(4), "Like4" & SEP & "False" & SEP & "??", 57)
    Call Component_SetUp(opt_Like(3), "Like3" & SEP & "False" & SEP & "??", 56)
    Call Component_SetUp(txt_LikeStr(1), "txt_LikeStr", 55)
    Call Component_SetUp(lbl_Like(10), "")
    Call Component_SetUp(lbl_Like(9), "")
    Call Component_SetUp(lbl_Like(8), "")
    Call Component_SetUp(lbl_Like(7), "")
    Call Component_SetUp(lbl_Like(6), "")
    Call Component_SetUp(lbl_Like(11), "")
    Call Component_SetUp(Fra_Select(1), "")
    Call Component_SetUp(cbo_select(1), "cbo_select", 53)
    Call Component_SetUp(opt_fieldC(0), "opt_fieldCustName" & SEP & "False" & SEP & "Like" & SEP & "$Name$", 51)
    Call Component_SetUp(opt_fieldC(1), "opt_fieldCustAddr" & SEP & "False" & SEP & "Like" & SEP & "$Address$", 50)
    Call Component_SetUp(opt_fieldC(2), "opt_fieldCustTown" & SEP & "False" & SEP & "Like" & SEP & "$Town$", 49)
    Call Component_SetUp(opt_fieldC(3), "opt_fieldCustZip" & SEP & "False" & SEP & "Like" & SEP & "$Zip_code$", 48)
    Call Component_SetUp(opt_fieldC(4), "opt_fieldCustTel" & SEP & "False" & SEP & "Like" & SEP & "$Cust_Tel$", 47)
    Call Component_SetUp(opt_fieldC(5), "opt_fieldCustFax" & SEP & "False" & SEP & "Like" & SEP & "$Cust_Fax$", 46)
    Call Component_SetUp(opt_fieldC(6), "opt_fieldType" & SEP & "False" & SEP & "Select" & SEP & "$SCT_code$", 45)
    Call Component_SetUp(opt_fieldC(7), "opt_fieldCustSalesRep" & SEP & "False" & SEP & "Select" & SEP & "$SSR_code$", 75)
    Call Component_SetUp(cbo_Selection(1), "Sel_ID", 74)
    Call Component_SetUp(grd_main(1), "grd_main1")
    
    
    
'--- Project

    Call Component_SetUp(fra_main(0), "")
    Call Component_SetUp(fra_filters(0), "")
    
    Call Component_SetUp(grd_main(0), "grd_main0")
    
    Call Component_SetUp(cbo_select(0), "cbo_select", 25)
    Call Component_SetUp(Fra_Select(0), "")
    
    Call Component_SetUp(txt_value(0), "txt_value", 24)
    Call Component_SetUp(fra_value(0), "")
    
    Call Component_SetUp(opt_operator(2), "operat2" & SEP & "False" & SEP & "$Op_Type$", 23)
    Call Component_SetUp(opt_operator(1), "operat1" & SEP & "False" & SEP & "$Op_Type$", 22)
    Call Component_SetUp(opt_operator(0), "operat0" & SEP & "False" & SEP & "$Op_Type$", 21)
    
    
    Call Component_SetUp(txt_LikeStr(0), "txt_LikeStr", 20)
    Call Component_SetUp(fra_Like(0), "")
    
    Call Component_SetUp(opt_Like(2), "Like2" & SEP & "False", 19)
    Call Component_SetUp(opt_Like(1), "Like1" & SEP & "False", 18)
    Call Component_SetUp(opt_Like(0), "Like0" & SEP & "False", 17)
    
    Call Component_SetUp(opt_fieldP(6), "opt_fieldClgFunction" & SEP & "False" & SEP & "select" & SEP & "$Cf_code$", 16)
    Call Component_SetUp(opt_fieldP(5), "opt_fieldSalesRep" & SEP & "False" & SEP & "select" & SEP & "$SSR_code$", 15)
    Call Component_SetUp(opt_fieldP(4), "opt_fieldSize" & SEP & "False" & SEP & "value" & SEP & "$Proj_Size$" & SEP & "0" & SEP & "" & SEP & "", 14)
    Call Component_SetUp(opt_fieldP(3), "opt_fieldStatus" & SEP & "False" & SEP & "select" & SEP & "$PS_code$", 13)
    Call Component_SetUp(opt_fieldP(2), "opt_fieldMKS" & SEP & "False" & SEP & "select" & SEP & "$Mkt$", 12)
    Call Component_SetUp(opt_fieldP(1), "opt_fieldTown" & SEP & "False" & SEP & "Like" & SEP & "$Town$", 11)
    Call Component_SetUp(opt_fieldP(0), "opt_fieldName" & SEP & "False" & SEP & "Like" & SEP & "$Name$", 10)
    Call Component_SetUp(fra_FiltersField(0), "fra_FiltersField")
    
    Call Component_SetUp(cbo_FiltersCountry(0), "CT_code" & SEP & "$CT_code$", 9)
    Call Component_SetUp(fra_FiltersCountry(0), "fra_FiltersCountry")
    
    
    Call Component_SetUp(cal_filtersMax(0), "cal_filtersMax" & SEP & "$DateMax$", 8)
    Call Component_SetUp(cal_FiltersMin(0), "cal_FiltersMin" & SEP & "$DateMin$", 7)
    Call Component_SetUp(cbo_FiltersDate(0), "cbo_FiltersDate" & SEP & "$DateType$", 6)
    
    Call Component_SetUp(fra_FiltersDate(0), "fra_FiltersDate")
    
    Call Component_SetUp(opt_FiltersDate(0), "optFiltersDate_All" & SEP & "False", 5)
    Call Component_SetUp(opt_FiltersDate(1), "optFiltersDate_Between" & SEP & "False", 4)
    
    Call Component_SetUp(tbs_FiltersGroupStatus, "tbs_FiltersGroupStatus" & SEP & "$GroupStatus$", 3)
    
    Call Component_SetUp(btn_Selection(0), "", 2)
    Call Component_SetUp(cbo_Selection(0), "Sel_ID", 1)
    
    
    Exit Sub
    
ErrHandler:
    Call ErrorHandler("Components_Settings")
End Sub
Private Sub ClearForm(ByRef aControls As Variant, ByRef aContainer As Object)
On Error GoTo ErrHandler
    
    mb_Internal = True

    Dim lIdx As Long, lCount As Long, lControl As Object
    lCount = aControls.Count - 1
    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        
        If HasContainer(lControl, aContainer) Then
            Select Case UCase(TypeName(lControl))
                Case "TEXTBOX"
                    lControl.Text = ""
                
                Case "ARMCOMBOBOX"
                    If Not UCase(lControl.Name) Like UCase("cbo_Selection") Then
                        lControl.Clear
                        DoEvents
                    End If
                
                Case "A_CALOCX"
                    lControl.reinit_cal
                
                Case "CHECKBOX"
                    lControl.value = vbUnchecked
                
                Case "ARMCHECKVIEW"
                    'lControl.Reset
                    
                Case "FRAME", "LABEL", "TOOLBARCONTROL", "PICTUREBOX", "COMMANDBUTTON"
                
                Case "ARMGRID"
                
                Case "LISTBOX"
                    lControl.ListIndex = -1
                
                Case "OPTIONBUTTON"
                    Dim lValues As Variant
                    lValues = Split(lControl.Tag, SEP)
                    lControl.value = lValues(1)
                
                Case "TABSTRIP", "DRIVELISTBOX", "DIRLISTBOX", "FILELISTBOX"
                
                Case Else
                    Debug.Print "ClearForm " & UCase(TypeName(lControl))
            End Select
        End If
        
        Set lControl = Nothing
    Next
    
    mb_Internal = False

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

Private Sub Load_ClassInfo()
On Error GoTo ErrHandler

    ReDim mt_ClassInfoLst(2)
    
        With mt_ClassInfoLst(0)
            .RequestGrid = "exec SOM_Project_Lst '$Name$',$DateType$,'$DateMin$','$DateMax$','$Town$','$CT_code$',$Mkt$,$PS_code$,$Op_Type$,$Proj_Size$,$SSR_code$,$Cf_code$,'$Language_code$',$GroupStatus$"
        End With
        
        With mt_ClassInfoLst(1)
            .RequestGrid = "exec SOM_Customer_Lst2 $DateType$,'$DateMin$','$DateMax$','$CT_code$','$Name$','$Address$','$Town$','$Zip_code$','$Cust_Tel$','$Cust_Fax$',$SCT_code$,$SSR_code$,'$Language_code$'"
        End With
        
        With mt_ClassInfoLst(2)
            .RequestGrid = "exec SOM_Quote_Lst3 $DateType$,'$DateMin$','$DateMax$',$CT_ProjCust$,'$CT_code$','$Reference$',$RL_code$,$Op_Type$,$Quote_FRGHTCost_CHF$,$SSR_code$,$BO_SSR_code$,$Status$,$SystemType$,$SS_code$,$Area$,$DB$,$Value_CHF$,$PrimeMargin$,'$Language_code$'"
        End With
    
    Exit Sub
    
ErrHandler:
    Call ErrorHandler("Load_ClassInfo")
    
End Sub
Private Sub LoadAllLabels()
    
On Error GoTo ErrHandler
    
    Call LoadLabels(UserControl.Controls, Me, SCREEN_NAME, ms_Language_Code)
    Exit Sub
    
ErrHandler:
    Call ErrorHandler("LoadAllLabels")
 
End Sub
Public Sub LoadLabels(ByRef aControls As Variant, ByRef av_Container As Object, ByVal as_ScreenName As String, ByVal as_Language As String)

On Error GoTo ErrHandler
    Dim lIdx As Long, lCount As Long, lLabels As Long, lb_Apply As Boolean, lv_Iter As Object, ls_Buffer As String
    Dim lControl As Control, ll_Idx2 As Long, ll_Count2 As Long, ll_IdxGrd As Long
    
    'lLabels = mo_Db.OpenSQL("exec Screen_Csts '" & as_ScreenName & "','" & as_Language & "'")
    lLabels = OpenSQLSafe(mo_Db, "exec Screen_Csts '" & as_ScreenName & "','" & as_Language & "'")
    lCount = aControls.Count - 1
    
    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        
        If Not av_Container Is Nothing Then
            lb_Apply = HasContainer(lControl, av_Container)
        Else
            lb_Apply = True
        End If
        If lb_Apply Then
            Select Case UCase(TypeName(lControl))
                Case "LABEL", "FRAME", "COMMANDBUTTON"
                    If lControl.Tag <> "" Then
                        If mo_Db.Find(lLabels, "FIELD_NAME", lControl.Tag, , 1) >= 0 Then
                            lControl.Caption = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                        End If
                    End If
                Case "CHECKBOX"
                    If lControl.Tag <> "" Then
                        ls_Buffer = Split(lControl.Tag, SEP, , vbTextCompare)(0)
                        If mo_Db.Find(lLabels, "FIELD_NAME", ls_Buffer, , 1) >= 0 Then
                            lControl.Caption = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                        End If
                    End If
                Case "TEXTBOX"
                    If lControl.Tag <> "" Then
                        If mo_Db.Find(lLabels, "FIELD_NAME", lControl.Tag, , 1) >= 0 Then
                            lControl.Text = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                        End If
                    End If
                Case "TABSTRIP"
                    If lControl.Tag <> "" Then
                        ls_Buffer = Split(lControl.Tag, SEP, , vbTextCompare)(0)
                        On Error Resume Next
                        ls_Buffer = ls_Buffer
                        On Error GoTo 0
                        For Each lv_Iter In lControl.Tabs
                            If mo_Db.Find(lLabels, "FIELD_NAME", ls_Buffer & "_" & lv_Iter.Tag, , 1) >= 0 Then
                                lv_Iter.Caption = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                            End If
                        Next
                    End If
                
                Case "OPTIONBUTTON"
                    If lControl.Tag <> "" Then
                        ls_Buffer = Split(lControl.Tag, SEP, , vbTextCompare)(0)
                        On Error Resume Next
                        ls_Buffer = ls_Buffer
                        On Error GoTo 0
                        If mo_Db.Find(lLabels, "FIELD_NAME", ls_Buffer, , 1) >= 0 Then
                            lControl.Caption = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                        End If
                    End If
                
                Case "ARMGRID"
                    If lControl.Tag <> "" Then
                        If mo_Db.Find(lLabels, "FIELD_NAME", lControl.Tag, , 1) >= 0 Then
                            Dim ls_Text As String
                            Dim ls_Title As String
                            ls_Text = mo_Db.GetFields(lLabels, "LOCAL_TEXT")
                            
                            If ls_Text <> "" And InStr(1, ls_Text, SEP) <> 0 Then
                                ls_Title = Mid(ls_Text, 1, InStr(1, ls_Text, SEP) - 1)
                                
                                lControl.Title = ls_Title
                                
                                ls_Text = Mid(ls_Text, InStr(1, ls_Text, SEP) + 2)
                                Call lControl.LoadConstants(ptStatic, ls_Text, ctColumns)
                            End If
                        End If
                    End If
                    
                    
                Case "FRAME", "MSFLEXGRID", "TOOLBARCONTROL", "COMMANDBUTTON", "ARMCHECKVIEW", "ARMCOMBOBOX", "A_CALOCX", "ARMTREEVIEW", "LISTBOX", "PICTUREBOX"
                   ' NOTHING
                
            End Select
        End If
        Set lControl = Nothing
    Next
    
CleanUp:
    mo_Db.Close (lLabels)
    Exit Sub
            
ErrHandler:
    mo_Db.Close (lLabels)
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("LoadLabels")
End Sub



Private Function CheckNumericField(ByVal ao_value As TextBox, ByVal ai_NbDecimal As Integer, ByVal av_Min As Variant, ByVal av_Max As Variant) As Long
On Error GoTo ErrHandler
    Dim ls_Value As Variant
    
    ls_Value = Replace(Trim(ao_value.Text), ".", ms_DecimalSeparator, , , vbTextCompare)
    
    On Error Resume Next
    Dim ld_Number As Double
    Dim ll_errnum As Long
    ld_Number = CDbl(ls_Value)
    ll_errnum = Err.Number
    Err.Clear
    On Error GoTo ErrHandler
    
    If ll_errnum <> 0 Then
        CheckNumericField = 2131
        GoTo BackToControl
    End If

    
    If ai_NbDecimal = 0 And InStr(1, ls_Value, ms_DecimalSeparator) Then
        CheckNumericField = 2134
        GoTo BackToControl
    End If
    
    If av_Min <> "" And Not av_Max <> "" Then
        If Not (ld_Number >= av_Min And ld_Number <= av_Max) Then
            CheckNumericField = 2132
            GoTo BackToControl
        End If
    End If
    
    'ao_value.Text = ls_Value
    CheckNumericField = 0
    
    Exit Function

BackToControl:
    ao_value.SelStart = 0
    ao_value.SelLength = Len(ao_value.Text)
    If ao_value.Visible Then ao_value.SetFocus
    
    Exit Function

ErrHandler:
    Call ErrorHandler("CheckNumericField")
   
End Function

Private Sub CheckNumericFieldFilter(ByVal ao_value As TextBox)
On Error GoTo ErrHandler
    
    
    Dim ls_Caption As String
    Dim ll_Decimal As Long
    Dim lv_Min As Variant
    Dim lv_Max As Variant
    
    Dim lo_Control As Variant
    Dim ll_Nb As Long
    Dim ll_Count As Long
    Dim lv_Values As Variant
    
    If mb_Internal Then Exit Sub
    
    Select Case tbs_Navigator.SelectedItem.Tag
        Case 0 'Project
            Set lo_Control = opt_fieldP
            ll_Nb = opt_fieldP.Count
        Case 1 'Customer
            Set lo_Control = opt_fieldC
            ll_Nb = opt_fieldC.Count
        Case 2 'Quote
            Set lo_Control = opt_fieldQ
            ll_Nb = opt_fieldQ.Count
    End Select
        
    
    For ll_Count = 0 To ll_Nb
        If lo_Control(ll_Count).value = True Then
            lv_Values = Split(lo_Control(ll_Count).Tag & SEP, SEP)
            ls_Caption = lo_Control(ll_Count).Caption
            ll_Decimal = lv_Values(4)
            lv_Min = lv_Values(5)
            lv_Max = lv_Values(6)
            Exit For
        End If
    Next ll_Count
    
    
    Dim ll_IsNum As Long
    
    ll_IsNum = CheckNumericField(ao_value, ll_Decimal, lv_Min, lv_Max)
    If ll_IsNum <> 0 Then
        
        ReDim lv_MsgReplaceInfo(2, 1)
        
        lv_MsgReplaceInfo(0, 0) = "$LabelCaption$"
        lv_MsgReplaceInfo(0, 1) = ls_Caption
        lv_MsgReplaceInfo(1, 0) = "$Min$"
        If lv_Min <> "" Then
            lv_MsgReplaceInfo(1, 1) = FormatNumber(lv_Min, ll_Decimal)
        End If
        
        lv_MsgReplaceInfo(2, 0) = "$Max$"
        If lv_Max <> "" Then
            lv_MsgReplaceInfo(2, 1) = FormatNumber(lv_Max, ll_Decimal)
        End If
        
        Select Case ll_IsNum
            Case 2131
                Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " must be numeric.", lv_MsgReplaceInfo), vbInformation)
            Case 2134
                Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " does not accept decimal number.", lv_MsgReplaceInfo), vbInformation)
            Case 2132
                Call MsgBox(MsgText(ll_IsNum, ms_Language_Code, "#The field " & lv_MsgReplaceInfo(0, 1) & " must be a number between " & lv_MsgReplaceInfo(1, 1) & " and " & lv_MsgReplaceInfo(2, 1) & ".", lv_MsgReplaceInfo), vbInformation)
        End Select
        
        ao_value.Text = "0"
        ao_value.SelStart = 0
        ao_value.SelLength = Len(ao_value.Text)
    
    End If



    Exit Sub

ErrHandler:
    Call ErrorHandler("CheckNumericFieldFilter")
   
End Sub

Private Function Get_SelectionSrzFields(ByRef aControls As Variant, ByRef aContainer As Object) As String
On Error GoTo ErrHandler
    Dim ls_SrzString As String
    Dim lo_Control As CheckBox
    Dim lIdx As Long, lCount As Long
    
    Dim lValues As Variant
    Dim ls_TempTag As String
    Dim ls_Str As String
    Dim lControl As Control
    
    Dim lo_opt As OptionButton
    Dim lv_ValueSub As Variant
    Dim ll_Index As Long
    Dim ll_Likebegin As Long
    Dim ll_Likecontain As Long
    Dim ll_Likeend As Long
    Dim ll_opequal As Long
    Dim ll_opless As Long
    Dim ll_opgreat As Long
   
    
        lCount = aControls.Count - 1
        ls_SrzString = ""
    
        For lIdx = 0 To lCount
            Set lControl = aControls.Item(lIdx)
            If HasContainer(lControl, aContainer) Then
                
                ls_TempTag = lControl.Tag & SEP
                lValues = Split(ls_TempTag, SEP)
                
                Select Case UCase(TypeName(lControl))
                
                    
                    Case "ARMCOMBOBOX"
                        If lControl.Visible = True And Not UCase(lControl.Name) Like UCase("cbo_Selection") And Not UCase(lControl.Name) Like UCase("cbo_Select") Then
                            If cbo_IsFilled(lControl) Then
                                ls_SrzString = ls_SrzString & lValues(0) & SEP1 & lControl.SelectedItem.Key & SEP1 & lControl.SelectedItem.GetData(1) & SEP
                            End If
                        End If
                        
                    Case "OPTIONBUTTON"
                    
                        If (UCase(lControl.Name) Like UCase("opt_fieldP") Or UCase(lControl.Name) Like UCase("opt_fieldC") Or UCase(lControl.Name) Like UCase("opt_fieldQ")) Then
                            Select Case UCase(lControl.Name)
                                Case "OPT_FIELDP"
                                    ll_Index = 0
                                    ll_Likebegin = 0
                                    ll_Likecontain = 1
                                    ll_Likeend = 2
                                    ll_opequal = 0
                                    ll_opless = 1
                                    ll_opgreat = 2
                                    
                                Case "OPT_FIELDC"
                                    ll_Index = 1
                                    ll_Likebegin = 3
                                    ll_Likecontain = 4
                                    ll_Likeend = 5
                                    ll_opequal = 0
                                    ll_opless = 0
                                    ll_opgreat = 0
                                    
                                Case "OPT_FIELDQ"
                                    ll_Index = 2
                                    ll_Likebegin = 6
                                    ll_Likecontain = 7
                                    ll_Likeend = 8
                                    ll_opequal = 5
                                    ll_opless = 4
                                    ll_opgreat = 3
                                                                
                            End Select
                            
                            lValues = Split(ls_TempTag, SEP)
                            
                            Select Case UCase(lValues(2))
                                Case "LIKE"
                                    If lControl.value = True Then
                                        
                                        ls_SrzString = ls_SrzString & lValues(0) & SEP
                                        
                                        If opt_Like(ll_Likebegin).value = True Then
                                            Set lo_opt = opt_Like(ll_Likebegin)
                                            ElseIf opt_Like(ll_Likecontain).value = True Then
                                                Set lo_opt = opt_Like(ll_Likecontain)
                                                ElseIf opt_Like(ll_Likeend).value = True Then
                                                    Set lo_opt = opt_Like(ll_Likeend)
                                        End If
                                        
                                        lv_ValueSub = Split(lo_opt.Tag, SEP)
                                        
                                        ls_SrzString = ls_SrzString & lv_ValueSub(0) & SEP
                                        
                                        Set lo_opt = Nothing
                                        
                                        lv_ValueSub = Split(txt_LikeStr(ll_Index).Tag, SEP)
                                        
                                        ls_SrzString = ls_SrzString & lv_ValueSub(0) & SEP1 & txt_LikeStr(ll_Index).Text & SEP
                                          
                                    End If
                                    
                                Case "SELECT"
                                    If lControl.value = True Then
                                        
                                        ls_SrzString = ls_SrzString & lValues(0) & SEP
                                        
                                        If cbo_IsFilled(cbo_select(ll_Index)) Then
                                            lv_ValueSub = Split(cbo_select(ll_Index).Tag, SEP)
                                            ls_SrzString = ls_SrzString & lv_ValueSub(0) & SEP1 & cbo_select(ll_Index).SelectedItem.Key & SEP1 & cbo_select(ll_Index).SelectedItem.GetData(1) & SEP
                                        End If
                                    
                                    End If
                                    
                                Case "VALUE"
                                    If lControl.value = True Then
                                        ls_SrzString = ls_SrzString & lValues(0) & SEP
                                        
                                        If opt_operator(ll_opequal).value = True Then
                                            Set lo_opt = opt_operator(ll_opequal)
                                            ElseIf opt_operator(ll_opless).value = True Then
                                                Set lo_opt = opt_operator(ll_opless)
                                                ElseIf opt_operator(ll_opgreat).value = True Then
                                                    Set lo_opt = opt_operator(ll_opgreat)
                                        End If
                                        
                                        lv_ValueSub = Split(lo_opt.Tag, SEP)
                                        
                                        ls_SrzString = ls_SrzString & lv_ValueSub(0) & SEP
                                        
                                        Set lo_opt = Nothing
                                        
                                        lv_ValueSub = Split(txt_value(ll_Index).Tag, SEP)
                                        
                                        ls_SrzString = ls_SrzString & lv_ValueSub(0) & SEP1 & txt_value(ll_Index).Text & SEP
                                    
                                    End If
                                
                            End Select
                        
                        End If
                        
                        If (UCase(lControl.Name) Like UCase("opt_FiltersCountry")) Then
                            If lControl.value = True Then
                                ls_SrzString = ls_SrzString & lValues(0) & SEP
                            End If
                        End If
                                                                    
                        If (UCase(lControl.Name) Like UCase("opt_FiltersDate")) Then
                            If lControl.value = True Then
                                ls_SrzString = ls_SrzString & lValues(0) & SEP
                            End If
                        End If
                                                                   
                                                                    
                    Case "A_CALOCX"
                        If lControl.Visible = True And lControl.date_courte <> "" Then
                            ls_SrzString = ls_SrzString & lValues(0) & SEP1 & lControl.date_courte & SEP
                        End If
                        
                    Case "TABSTRIP"
                            ls_SrzString = ls_SrzString & lValues(0) & SEP1 & tbs_FiltersGroupStatus.SelectedItem.Tag & SEP
                        
                        
                        
                    Case "LABEL", "FRAME", "DIRLISTBOX", "FILELISTBOX", "DRIVELISTBOX", "TOOLBARCONTROL"
                        'Do Nothing
                    
                    Case "ARMGRID"
                    
                    
                    Case Else
                        Debug.Print "Get_SelectionSrzFields  -> " & UCase(TypeName(lControl))
                End Select
            End If
            Set lControl = Nothing
        Next

    ls_SrzString = Trim(ls_SrzString)
    Get_SelectionSrzFields = ls_SrzString
    
    Exit Function
ErrHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("Get_SelectionSrzFields")

End Function

Private Sub Apply_SelectionSrzFields(ByRef aControls As Variant, ByRef aContainer As Object, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
    Dim ls_SrzString As String
    Dim lIdx As Long, lCount As Long
    
    mb_Internal = True
        
    Dim lValues As Variant
    Dim ls_TempTag As String
    Dim ls_Str As String
    Dim lControl As Control
    Dim lPos As Long
    
    Dim ls_TempSrz As String
    
    as_SrzFields = SEP & as_SrzFields & SEP
    
        lCount = aControls.Count - 1
        ls_SrzString = ""
    
        For lIdx = 0 To lCount
            Set lControl = aControls.Item(lIdx)
            If HasContainer(lControl, aContainer) Then
                
                ls_TempTag = lControl.Tag & SEP
                lValues = Split(ls_TempTag, SEP)
                lPos = InStr(1, as_SrzFields, SEP & lValues(0) & SEP1, vbTextCompare)
                
                Select Case UCase(TypeName(lControl))
                    Case "TEXTBOX"
                        
                        If lPos <> 0 Then
                            ls_SrzString = Mid(as_SrzFields, lPos + Len(SEP))
                            lValues = Split(ls_SrzString, SEP)
                            lValues = Split(lValues(0), SEP1)
                            lControl.Text = lValues(1)
                        Else
                            lControl.Text = ""
                        End If
                    
                    Case "ARMCOMBOBOX"
                        If lPos <> 0 Then
                            ls_SrzString = Mid(as_SrzFields, lPos + Len(SEP))
                            lValues = Split(ls_SrzString, SEP)
                            lValues = Split(lValues(0), SEP1)
                            If cbo_IsFilled(lControl) Then
                                If Not lControl.SearchItem(lValues(1), 0, True) Then
                                    Call lControl.AddItem(Array(lValues(1), lValues(2)), True)
                                End If
                            Else
                                Call lControl.AddItem(Array(lValues(1), lValues(2)), True)
                                If UCase(lControl.Name) Like UCase("cbo_filtersType") Then
                                    If lValues(1) = 4 Then
                                        opt_fieldQ(6).Visible = False
                                        cbo_select(2).Clear
                                    Else
                                        opt_fieldQ(6).Visible = True
                                    End If
                            End If
                            End If
                        Else
                            If Not UCase(lControl.Name) Like UCase("cbo_Selection") Then
                                lControl.Clear
                                DoEvents
                            End If
                        End If
                        

                    Case "OPTIONBUTTON"
                        If lPos <> 0 Then
                            lControl.value = True
                        Else
                            lControl.value = False
                        End If

                    Case "A_CALOCX"
                    
                        If lPos <> 0 Then
                            ls_SrzString = Mid(as_SrzFields, lPos + Len(SEP))
                            lValues = Split(ls_SrzString, SEP)
                            lValues = Split(lValues(0), SEP1)
                            lControl.date_courte = lValues(1)
                        Else
                            lControl.date_courte = ""
                        End If

                    
                    Case "TABSTRIP"
                        If lPos <> 0 Then
                            ls_SrzString = Mid(as_SrzFields, lPos + Len(SEP))
                            lValues = Split(ls_SrzString, SEP)
                            lValues = Split(lValues(0), SEP1)
                            lControl.Tabs(Val(lValues(1))).Selected = True
                        Else
                            lControl.Tabs(1).Selected = True
                        End If
                    Case Else
                        Debug.Print "Apply_SelectionSrzFields  -> " & UCase(TypeName(lControl))
                End Select
            End If
            Set lControl = Nothing
        Next
    
    mb_Internal = False
    
    Exit Sub
ErrHandler:
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("Apply_SelectionSrzFields")

End Sub

Private Function ReplaceHolders(ByRef aControls As Variant, ByRef aContainer As Object, ByVal as_Request) As String
On Error GoTo ErrHandler

    Dim ls_Request As String
    Dim lIdx As Long, lCount As Long

    Dim lValues As Variant
    Dim lValueSub As Variant
    Dim ls_TempTag As String
    Dim ls_Str As String
    Dim lControl As Control

    Dim ll_Index As Long
    Dim ll_Likebegin As Long
    Dim ll_Likecontain As Long
    Dim ll_Likeend As Long
    Dim ll_opequal As Long
    Dim ll_opless As Long
    Dim ll_opgreat As Long

    Dim lctl As OptionButton
    
    lCount = aControls.Count - 1
    
    
    ls_Request = as_Request

    For lIdx = 0 To lCount
        Set lControl = aControls.Item(lIdx)
        If HasContainer(lControl, aContainer) Then

            ls_TempTag = lControl.Tag & SEP
            lValues = Split(ls_TempTag, SEP)

            Select Case UCase(TypeName(lControl))

                Case "ARMCOMBOBOX"
                    If Not UCase(lControl.Name) Like UCase("cbo_Selection") And Not UCase(lControl.Name) Like UCase("cbo_Select") Then
                        lValues = Split(ls_TempTag, SEP)
                        
                        If cbo_IsFilled(lControl) Then
                            Select Case UCase(lControl.Name)
                            Case UCase("cbo_FiltersDate")
                                    
                                    For Each lctl In opt_FiltersDate
                                        If HasContainer(lctl, fra_FiltersDate(aContainer.Index)) Then
                                            If lctl.value = True Then Exit For
                                        End If
                                    Next
                                    
                                                                      
                                    If lctl.Tag Like "optFiltersDate_Between*" Then
                                        ls_Request = Replace(ls_Request, lValues(1), lControl.SelectedItem.Key)
                                    Else
                                        ls_Request = Replace(ls_Request, lValues(1), "NULL")
                                    End If
                                    
                                    Set lctl = Nothing
                                
                                Case UCase("cbo_filtersType"), UCase("cbo_FiltersCountry")
                                    ls_Request = Replace(ls_Request, lValues(1), lControl.SelectedItem.Key)
                            End Select
                        Else
                            ls_Request = Replace(ls_Request, lValues(1), "NULL")
                        End If
                    End If
                    
                Case "OPTIONBUTTON"
                
                    If (UCase(lControl.Name) Like UCase("opt_fieldP") Or UCase(lControl.Name) Like UCase("opt_fieldC") Or UCase(lControl.Name) Like UCase("opt_fieldQ")) Then
                        Select Case UCase(lControl.Name)
                            Case "OPT_FIELDP"
                                ll_Index = 0
                                ll_Likebegin = 0
                                ll_Likecontain = 1
                                ll_Likeend = 2
                                ll_opequal = 0
                                ll_opless = 1
                                ll_opgreat = 2
                                
                            Case "OPT_FIELDC"
                                ll_Index = 1
                                ll_Likebegin = 3
                                ll_Likecontain = 4
                                ll_Likeend = 5
                                ll_opequal = 0
                                ll_opless = 0
                                ll_opgreat = 0
                                
                            Case "OPT_FIELDQ"
                                ll_Index = 2
                                ll_Likebegin = 6
                                ll_Likecontain = 7
                                ll_Likeend = 8
                                ll_opequal = 5
                                ll_opless = 4
                                ll_opgreat = 3
                                                            
                        End Select
                        
                        lValues = Split(ls_TempTag, SEP)
                        
                        
                        
                        Select Case UCase(lValues(2))
                            Case "LIKE"
                                If lControl.value = True Then
                                    If opt_Like(ll_Likebegin).value = True Then
                                        ls_Request = Replace(ls_Request, lValues(3), SQLStr(txt_LikeStr(ll_Index).Text) & "%")
                                        ElseIf opt_Like(ll_Likecontain).value = True Then
                                            ls_Request = Replace(ls_Request, lValues(3), "%" & SQLStr(txt_LikeStr(ll_Index).Text) & "%")
                                            ElseIf opt_Like(ll_Likeend).value = True Then
                                                ls_Request = Replace(ls_Request, lValues(3), "%" & SQLStr(txt_LikeStr(ll_Index).Text))
                                            Else
                                                ls_Request = Replace(ls_Request, lValues(3), "")
                                    End If
                                Else
                                    ls_Request = Replace(ls_Request, lValues(3), "")
                                End If
                            Case "SELECT"
                                If lControl.value = True Then
                                    If cbo_IsFilled(cbo_select(ll_Index)) Then
                                        ls_Request = Replace(ls_Request, lValues(3), cbo_select(ll_Index).SelectedItem.Key)
                                    Else
                                        ls_Request = Replace(ls_Request, lValues(3), "NULL")
                                    End If
                                Else
                                    ls_Request = Replace(ls_Request, lValues(3), "NULL")
                                End If
                                
                            Case "VALUE"
                                If lControl.value = True Then
                                    Dim lv_opttag As Variant
                                    If opt_operator(ll_opequal).value = True Then
                                        ls_Request = Replace(ls_Request, "$Op_Type$", "1")
                                        ls_Request = Replace(ls_Request, lValues(3), txt_value(ll_Index).Text)
                                        ElseIf opt_operator(ll_opless).value = True Then
                                            ls_Request = Replace(ls_Request, "$Op_Type$", "2")
                                            ls_Request = Replace(ls_Request, lValues(3), txt_value(ll_Index).Text)
                                            ElseIf opt_operator(ll_opgreat).value = True Then
                                                ls_Request = Replace(ls_Request, "$Op_Type$", "3")
                                                ls_Request = Replace(ls_Request, lValues(3), txt_value(ll_Index).Text)
                                            Else
                                                ls_Request = Replace(ls_Request, "$Op_Type$", "NULL")
                                                ls_Request = Replace(ls_Request, lValues(3), "NULL")
                                    End If
                                Else
                                    ls_Request = Replace(ls_Request, lValues(3), "NULL")
                                End If
                            
                        End Select
                    
                    End If
                    
                    If (UCase(lControl.Name) Like UCase("OPT_FILTERSCOUNTRY")) Then
                        If lControl.value = True Then
                            ls_Request = Replace(ls_Request, lValues(2), lControl.Index)
                        End If
                    End If
                    

                    
                Case "A_CALOCX"
                    For Each lctl In opt_FiltersDate
                        If HasContainer(lctl, fra_FiltersDate(aContainer.Index)) Then
                            If lctl.value = True Then Exit For
                        End If
                    Next
                                                                      
                    If Not lctl Is Nothing Then
                        If lctl.Tag Like "optFiltersDate_Between*" Then
                            If lControl.date_sql <> "" Then
                                ls_Request = Replace(ls_Request, lValues(1), lControl.date_sql)
                            Else
                                ls_Request = Replace(ls_Request, lValues(1), "")
                            End If
                        Else
                            ls_Request = Replace(ls_Request, lValues(1), "")
                        End If
                        Set lctl = Nothing
                    End If

                Case "TABSTRIP"
                    ls_Request = Replace(ls_Request, lValues(1), lControl.SelectedItem.Tag)
                
                Case Else
                    Debug.Print "ReplaceHolders -> " & UCase(TypeName(lControl))
            End Select
            
            
        End If
        Set lControl = Nothing
    Next

    ls_Request = Replace(ls_Request, "$Op_Type$", "NULL")
    ls_Request = Replace(ls_Request, "$Language_code$", ms_Language_Code)
    ls_Request = Replace(ls_Request, "'NULL'", "''")

    ReplaceHolders = ls_Request

    Exit Function
ErrHandler:
    Set lControl = Nothing
    If Not lControl Is Nothing Then Set lControl = Nothing
    Call ErrorHandler("ReplaceHolders")

End Function


Private Function HasContainer(ByRef aControl As Control, ByRef aContainer As Object) As Boolean
    
    HasContainer = False
    Dim lControl As Control
    
    Set lControl = aControl
    While Not (lControl Is Nothing)
        On Error GoTo NotFound
        If lControl.Container Is aContainer Then
            Set lControl = Nothing
            HasContainer = True
            Exit Function
        End If
        Set lControl = lControl.Container
    Wend

NotFound:
    Set lControl = Nothing
    HasContainer = False
End Function
Private Function cbo_IsFilled(ByVal ao_Combo As ArmCombobox) As Boolean
On Error GoTo ErrHandler

    If ao_Combo.SelectedItem Is Nothing Then Exit Function
    
    If ao_Combo.SelectedItem.Key = "" Then Exit Function
    
    cbo_IsFilled = True
    Exit Function
ErrHandler:
    Call ErrorHandler("cbo_IsFilled")

End Function

Private Sub Component_SetUp(ByVal ao_cpt As Object, ByVal as_Tag As String, Optional ai_TabIndex As Integer)

On Error GoTo ErrHandler
    
    ao_cpt.Tag = as_Tag
    ao_cpt.TabIndex = ai_TabIndex
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("Component_SetUp")
End Sub

Private Sub HandleToolbar(ByVal atlb_Toolbar As Object, ByVal as_face As String, ByVal ab_ButtonsVisible As Boolean)
On Error GoTo ErrHandler

    atlb_Toolbar.Visible = False
    atlb_Toolbar.DisplayFace (as_face)
    If Not ab_ButtonsVisible Then
        atlb_Toolbar.Redraw = False
        atlb_Toolbar.ButtonVisible("C") = False 'delete button for project
        atlb_Toolbar.ButtonVisible("c") = False 'delete button for customer
        atlb_Toolbar.Redraw = True
    End If
    atlb_Toolbar.Visible = True
    
    Exit Sub
    
ErrHandler:
    Call ErrorHandler("HandleToolbar")
    
End Sub

Private Sub InitComponents_Size()

On Error GoTo ErrHandler
    Dim ll_top As Long
    Dim ll_Left As Long
    Dim ll_Width As Long
    Dim ll_height As Long
    
    ll_Left = 0
    ll_top = 0
    ll_Width = UserControl.Width
    Call tbs_Navigator.Move(ll_Left, ll_top, ll_Width)
    tbs_Navigator.TabFixedWidth = tbs_Navigator.Width / 3 - 50
    
    ll_Left = 0
    ll_top = tbs_Navigator.Height
    Call tbl_main.Move(ll_Left, ll_top)
    
    ll_top = tbl_main.Height + tbs_Navigator.Height
    ll_Width = UserControl.Width
    ll_height = UserControl.Height - ll_top
    Call fra_main(0).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call fra_main(1).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call fra_main(2).Move(ll_Left, ll_top, ll_Width, ll_height)
        
    ll_top = 240
    ll_Left = fra_filters(0).Width + fra_filters(0).Left + 50
    ll_Width = fra_main(0).Width - ll_Left - 50
    ll_height = fra_filters(0).Height
    Call grd_main(0).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call grd_main(1).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call grd_main(2).Move(ll_Left, ll_top, ll_Width, ll_height)
        
        
    ll_top = opt_fieldP(6).Top + opt_fieldP(6).Height + 50
    ll_Left = 60
    ll_Width = 3705
    ll_height = 915
    Call fra_Like(0).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call fra_value(0).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call Fra_Select(0).Move(ll_Left, ll_top, ll_Width, ll_height)
    
    ll_top = opt_fieldC(7).Top + opt_fieldC(7).Height + 50
    ll_Left = 60
    ll_Width = 3705
    ll_height = 915
    Call fra_Like(1).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call Fra_Select(1).Move(ll_Left, ll_top, ll_Width, ll_height)
    
    ll_top = opt_fieldQ(10).Top + opt_fieldQ(10).Height + 50
    ll_Left = 60
    ll_Width = 3705
    ll_height = 915
    Call fra_Like(2).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call fra_value(2).Move(ll_Left, ll_top, ll_Width, ll_height)
    Call Fra_Select(2).Move(ll_Left, ll_top, ll_Width, ll_height)
    
    
    
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("InitComponents_Size")
End Sub
Private Sub InitComponents()

On Error GoTo ErrHandler
    
    Const CL_REQUEST_TB As String = "SELECT Toolbar_Info FROM Toolbars_Users WHERE User_Code=$user_id$"

    Dim ls_Toolbar_Info As String
    Dim lCursTB As Long
    
    mb_Internal = True
    
    
    lCursTB = OpenSQLSafe(mo_Db, Replace(CL_REQUEST_TB, "$user_id$", 0))
    
    ls_Toolbar_Info = mo_Db.GetFields(lCursTB, "toolbar_info")
    Call mo_Db.Close(lCursTB)
    
    Call tbl_main.Load_A_Com
    tbl_main.Language = "E" ' ms_Language_Code
    
    Call tbl_main.SetToolbarInfoStringParameters(ls_Toolbar_Info, "047")
    Call HandleToolbar(tbl_main, "0", mb_IsFullAccess)
    
    Dim lo_Control As Control
    Dim ll_Charset As String
    ll_Charset = GetCharSetFromCodePage(Get_Code_Page)

    For Each lo_Control In UserControl.Controls
        Select Case UCase(TypeName(lo_Control))
            Case "ARMGRID"
                Set lo_Control.ArmDb = mo_Db
                lo_Control.Font.Name = "Arial"
                lo_Control.Font.Charset = ll_Charset
                lo_Control.LocalID = ml_LocalID
                lo_Control.Codepage = Get_Code_Page
                lo_Control.Load_A_Com
                lo_Control.AllowPrint = True
                lo_Control.AllowExcelExport = False
                lo_Control.MultiSelect = True
                lo_Control.Title = ""
                
            Case "ARMCOMBOBOX"
                Set lo_Control.ArmDb = mo_Db
                lo_Control.Font.Name = "Arial"
                lo_Control.Font.Charset = ll_Charset
                If UCase(lo_Control.Name) Like "CBO_FILTERSCOUNTRY" Or UCase(lo_Control.Name) Like UCase("cbo_select") Then
                    lo_Control.FirstBlankItem = True
                End If
                lo_Control.Load_A_Com
                
            Case "CHECKBOX", "LABEL", "COMMANDBUTTON", "FRAME", "TEXTBOX"
                lo_Control.Font.Name = "Arial"
                lo_Control.Font.Charset = ll_Charset
            
            Case "OPTIONBUTTON"
                lo_Control.Font.Name = "Arial"
                lo_Control.Font.Charset = ll_Charset
                lo_Control.value = False
            
            
        End Select
    Next
    
    tbs_Navigator.Visible = True
    
    SOM_Project.A_Visible = False
    SOM_Customer.A_Visible = False
    SOM_Quote.A_Visible = False
    SOM_Selection(0).A_Visible = False
    SOM_Selection(1).A_Visible = False
    SOM_Selection(2).A_Visible = False
    SOM_ExcelExp(0).A_Visible = False
    SOM_ExcelExp(1).A_Visible = False
    SOM_ExcelExp(2).A_Visible = False
    
    
'project
    cal_filtersMax(0).Limited_as_embedded = 1
    cal_filtersMax(0).Language = ms_Language_Code
    cal_filtersMax(0).ZOrder
    
    cal_FiltersMin(0).Limited_as_embedded = 1
    cal_FiltersMin(0).Language = ms_Language_Code
    cal_FiltersMin(0).ZOrder
    

    cbo_FiltersDate(0).Clear
    DoEvents
    cbo_FiltersDate(0).Request = "exec SOM_cbo_FiltersDate '" & ms_Language_Code & "',0"
    cbo_FiltersDate(0).Load
    
    cbo_Selection(0).Clear
    DoEvents
    cbo_Selection(0).Request = "exec SOM_cbo_SavedSelections " & ml_UCode & ",  1, '" & ms_Language_Code & "'"
    cbo_Selection(0).Load
        
    ReDim lColumns(11)
    lColumns(0) = Join(Array("Proj_ID", 0, 0, "Proj_ID", "#Proj_ID"), SEP)
    lColumns(1) = Join(Array("ProjectNumber", 1000, 0, "ProjectNumber", "#Project No"), SEP)
    lColumns(2) = Join(Array("Proj_name", 2000, 0, "Proj_name", "#Name"), SEP)
    lColumns(3) = Join(Array("Proj_town", 1500, 0, "Proj_town", "#Town"), SEP)
    lColumns(4) = Join(Array("CT_desc", 1500, 0, "CT_desc", "#Country"), SEP)
    lColumns(5) = Join(Array("MKS_desc", 2000, 0, "MKS_desc", "#Market segment"), SEP)
    lColumns(6) = Join(Array("Proj_size", 1500, 0, "Proj_size", "#Volume"), SEP)
    lColumns(7) = Join(Array("UM_code", 1000, 0, "UM_code", "#In"), SEP)
    lColumns(8) = Join(Array("Proj_Exporderdate", 1300, 0, "Proj_Exporderdate", "#Exp order date"), SEP)
    lColumns(9) = Join(Array("Proj_Followupdate", 1300, 0, "Proj_Followupdate", "#Follow up date"), SEP)
    lColumns(10) = Join(Array("SSR_Desc", 2000, 0, "SSR_Desc", "#Sales rep"), SEP)
    lColumns(11) = Join(Array("PS_desc", 2000, 0, "PS_desc", "#Status"), SEP)

    If Not grd_main(0).SetColumns(lColumns) Then
        Debug.Print "grd_main(0).SetColumns error"
        Call Unload_A_Com
        End
    End If
    
'customer
    cal_filtersMax(1).Limited_as_embedded = 1
    cal_filtersMax(1).Language = ms_Language_Code
    cal_filtersMax(1).ZOrder
    
    cal_FiltersMin(1).Limited_as_embedded = 1
    cal_FiltersMin(1).Language = ms_Language_Code
    cal_FiltersMin(1).ZOrder
        

    cbo_FiltersDate(1).Clear
    DoEvents
    cbo_FiltersDate(1).Request = "exec SOM_cbo_FiltersDate '" & ms_Language_Code & "',1"
    cbo_FiltersDate(1).Load
    
    cbo_Selection(1).Clear
    DoEvents
    cbo_Selection(1).Request = "exec SOM_cbo_SavedSelections " & ml_UCode & ", 2, '" & ms_Language_Code & "'"
    cbo_Selection(1).Load
    
    ReDim lColumns(8)
    lColumns(0) = Join(Array("Cust_ID", 0, 0, "Cust_ID", "#Cust_ID"), SEP)
    lColumns(1) = Join(Array("Cust_name", 2000, 0, "Cust_name", "#Name"), SEP)
    lColumns(2) = Join(Array("Cust_addr1", 2000, 0, "Cust_addr1", "#Address 1"), SEP)
    lColumns(3) = Join(Array("Cust_addr2", 2000, 0, "Cust_addr2", "#Address 2"), SEP)
    lColumns(4) = Join(Array("Cust_town", 2000, 0, "Cust_town", "#Town"), SEP)
    lColumns(5) = Join(Array("CT_desc", 2000, 0, "CT_desc", "#Country"), SEP)
    lColumns(6) = Join(Array("SCT_desc", 2000, 0, "SCT_desc", "#Type"), SEP)
    lColumns(7) = Join(Array("Cust_tel", 2000, 0, "Cust_tel", "#Tel No"), SEP)
    lColumns(8) = Join(Array("SSR_desc", 2000, 0, "SSR_desc", "#Representative"), SEP)

    If Not grd_main(1).SetColumns(lColumns) Then
        Debug.Print "grd_main(1).SetColumns error"
        Call Unload_A_Com
        End
    End If

    

'quote
    cal_filtersMax(2).Limited_as_embedded = 1
    cal_filtersMax(2).Language = ms_Language_Code
    cal_filtersMax(2).ZOrder
    
    cal_FiltersMin(2).Limited_as_embedded = 1
    cal_FiltersMin(2).Language = ms_Language_Code
    cal_FiltersMin(2).ZOrder
    
    
    grd_main(2).AutoColumns = True
    grd_main(2).Requests = mt_ClassInfoLst(2).RequestGrid
    grd_main(2).Execute
    
    cbo_FiltersDate(2).Clear
    DoEvents
    cbo_FiltersDate(2).Request = "exec SOM_cbo_FiltersDate '" & ms_Language_Code & "',2"
    cbo_FiltersDate(2).Load
    
    cbo_filtersType.Clear
    DoEvents
    cbo_filtersType.Request = "exec SOM_cbo_FilterSystemType '" & ms_Language_Code & "'"
    cbo_filtersType.Load
    cbo_filtersType.SearchItem 1, 0, , True
    
    cbo_Selection(2).Clear
    DoEvents
    cbo_Selection(2).Request = "exec SOM_cbo_SavedSelections " & ml_UCode & ", 3, '" & ms_Language_Code & "'"
    cbo_Selection(2).Load
    
    ReDim lColumns(17)
    lColumns(0) = Join(Array("Quote_ID", 0, 0, "Quote_ID", "#Quote_ID"), SEP)
    lColumns(1) = Join(Array("ProjCustLink_ID", 0, 0, "ProjCustLink_ID", "#ProjCustLink_ID"), SEP)
    lColumns(2) = Join(Array("Cust_ID", 0, 0, "Cust_ID", "#Cust_ID"), SEP)
    lColumns(3) = Join(Array("Proj_ID", 0, 0, "Proj_ID", "#Proj_ID"), SEP)
    lColumns(4) = Join(Array("Reference", 1500, 0, "Reference", "#Reference"), SEP)
    lColumns(5) = Join(Array("TOT_SS_desc", 2000, 0, "TOT_SS_desc", "#Clg_System"), SEP)
    lColumns(6) = Join(Array("TOT_Quote_Area", 1500, 0, "TOT_Quote_Area", "#Volume"), SEP)
    lColumns(7) = Join(Array("TOT_UM_System", 1000, 0, "TOT_UM_System", "#In"), SEP)
'task 484 Nov/07 add a total column and currency code
'    lColumns(8) = Join(Array("TOT_Quote_Value_CHF", 1500, 0, "TOT_Quote_Value_CHF", "#Value"), SEP)
    lColumns(8) = Join(Array("TOT_Quote_Value_LC", 1500, 0, "TOT_Quote_Value_LC", "#Total value"), SEP)
    lColumns(9) = Join(Array("Quote_CURR_code", 800, 0, "Quote_CURR_code", "#Quotation currency"), SEP)
    lColumns(10) = Join(Array("TOT_Quote_Value_CHF", 1500, 0, "TOT_Quote_Value_CHF", "#Value"), SEP)
    lColumns(11) = Join(Array("TOT_Quote_DB", 600, 0, "TOT_Quote_DB", "#DB%"), SEP)
    lColumns(12) = Join(Array("TOT_Quote_PrimeMargin", 1200, 0, "TOT_Quote_PrimeMargin", "#Prime Margin", "Float", "0.00"), SEP)
    lColumns(13) = Join(Array("Cust_name", 1500, 0, "Cust_name", "#Customer"), SEP)
    lColumns(14) = Join(Array("Proj_name", 1500, 0, "Proj_name", "#Project"), SEP)
    lColumns(15) = Join(Array("Include_desc", 800, 0, "Include_desc", "#Include"), SEP)
    lColumns(16) = Join(Array("Q_SSR_Desc", 2000, 0, "Q_SSR_Desc", "#Sales Rep"), SEP)
    lColumns(17) = Join(Array("BO_SSR_Desc", 2000, 0, "BO_SSR_Desc", "#Back Office Person"), SEP)

    If Not grd_main(2).SetColumns(lColumns) Then
        Debug.Print "grd_main(2).SetColumns error"
        Call Unload_A_Com
        End
    End If
        
    
    mb_Internal = False
    
    
    'Must stay after the mb_internal =false''''''''''
    cbo_Selection(0).SearchItem "0", 0, , True
    cbo_Selection(1).SearchItem "0", 0, , True
    cbo_Selection(2).SearchItem "0", 0, , True
    
    tbs_Navigator.Tabs(1).Selected = True
    Call OnFilterChange(False)
    
    tbs_Navigator.Tabs(2).Selected = True
    Call OnFilterChange(False)
    
    tbs_Navigator.Tabs(3).Selected = True
    Call OnFilterChange(False)
        
    tbs_Navigator.Tabs(1).Selected = True
    
    Exit Sub
    
ErrHandler:
    mo_Db.Close (lCursTB)
    Call ErrorHandler("InitComponents")
End Sub


Private Sub LockScreen(ByVal ab_lock As Boolean)

    Dim ll_errNumber As Long, ls_ErrSrc As String, ls_ErrDesc As String
    ll_errNumber = Err.Number
    ls_ErrSrc = Err.Source
    ls_ErrDesc = Err.Description

On Error GoTo ErrHandler
    Static ll_Count As Long
    Static ll_Mousepointer As Long
    Static lb_Locked As Boolean
      
      
    ll_Count = ll_Count + IIf(ab_lock, 1, -1)
    Debug.Assert (ll_Count >= 0)
    
    ' First lock
    If Not lb_Locked And ab_lock Then
        ll_Mousepointer = Screen.MousePointer
        Screen.MousePointer = vbHourglass
        LockWindowUpdate UserControl.hwnd
        lb_Locked = True
    End If
    
    ' Unlock
    If ll_Count = 0 Then
        DoEvents ' Flush events
        LockWindowUpdate 0
        UserControl.Refresh ' Repaint immediately
        Screen.MousePointer = ll_Mousepointer
        lb_Locked = False
    End If
    
    Err.Number = ll_errNumber
    Err.Source = ls_ErrSrc
    Err.Description = ls_ErrDesc
    
    Exit Sub
    
ErrHandler:
    Call ErrorHandler("LockScreen")
End Sub

Public Function Unload_A_Com() As Boolean

On Error GoTo ErrHandler

    If Not mb_Initialized Then Exit Function
    
    Dim lo_Control As Control
    
    For Each lo_Control In UserControl.Controls
        Select Case UCase(TypeName(lo_Control))
            Case "TOOLBARCONTROL", "ARMCOMBOBOX", "ARMGRID"
                lo_Control.Unload_A_Com
        End Select
    Next
    
           
    Set mo_Db = Nothing
    
    mb_Initialized = False
    
    Unload_A_Com = True
    
    Exit Function
    
ErrHandler:
    Call ErrorHandler("Unload_A_Com")
End Function

Private Function BeginTran(as_Tran As String) As Boolean

On Error GoTo ErrHandler
    BeginTran = False
    ExecuteSQLSafe mo_Db, "BEGIN TRANSACTION " & as_Tran

    BeginTran = True
    Exit Function
    
ErrHandler:
    mo_Db.Disconnect
    Set mo_Db = Nothing
    MsgBox "A Fatal error occured in " & SCREEN_NAME & ".BeginTran, your application will be close. Please contact your IT support"
    End
End Function
Private Function CommitTran(as_Tran As String) As Boolean

On Error GoTo ErrHandler
    CommitTran = False
    ExecuteSQLSafe mo_Db, "COMMIT TRANSACTION " & as_Tran

    CommitTran = True
    Exit Function
    
ErrHandler:
    mo_Db.Disconnect
    Set mo_Db = Nothing
    MsgBox "A Fatal error occured in " & SCREEN_NAME & ".CommitTran, your application will be close. Please contact your IT support"
    End

End Function

Private Function RollbackTran(as_Tran As String) As Boolean
    
    Dim ll_errNumber As Long, ls_ErrSrc As String, ls_ErrDesc As String
    ll_errNumber = Err.Number
    ls_ErrSrc = Err.Source
    ls_ErrDesc = Err.Description

On Error GoTo ErrHandler
    RollbackTran = False
    
    ExecuteSQLSafe mo_Db, "ROLLBACK TRANSACTION " & as_Tran


    Err.Number = ll_errNumber
    Err.Source = ls_ErrSrc
    Err.Description = ls_ErrDesc

    RollbackTran = True
    Exit Function
    
ErrHandler:
    mo_Db.Disconnect
    Set mo_Db = Nothing
    MsgBox "A Fatal error occured in " & SCREEN_NAME & ".RollbackTran, your application will be close. Please contact your IT support"
    End
End Function
'' Standard error handler
Private Sub ErrorHandler(ByVal as_Fct As String)
    Call LogMessage(Err.Number & SEP1 & UserControl.Name & "." & UserControl.Ambient.DisplayName & "::" & as_Fct & SEP1 & Err.Source & SEP1 & Err.Description, "E", False)
    Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
    End
End Sub

Function MsgText(ByVal aID As Long, ByVal aLang As String, ByVal aDefault As String, Optional ByVal aInfo As Variant) As String

On Error GoTo ErrHandler

Const DB_REQ As String = "SELECT message_text FROM error_message WHERE msgid = $id$ AND Language_code = '$lang$'"

    MsgText = ""
    
    Dim lRequest As String
    lRequest = Replace(DB_REQ, "$id$", aID)
    lRequest = Replace(lRequest, "$lang$", aLang)
    Dim lData As Long
    
    lData = OpenSQLSafe(mo_Db, lRequest)
    
    Dim lBuffer As String
    lBuffer = mo_Db.GetFields(lData, "message_text")
    mo_Db.Close (lData)
    If lBuffer = "" Then lBuffer = aDefault
    
    Dim li_Idx As Integer
    If Not IsMissing(aInfo) Then
        For li_Idx = 0 To UBound(aInfo)
            lBuffer = Replace(lBuffer, aInfo(li_Idx, 0), aInfo(li_Idx, 1), , , vbTextCompare)
        Next li_Idx
    End If
    
    
    MsgText = lBuffer
    Exit Function
ErrHandler:
    mo_Db.Close (lData)
    Call ErrorHandler("MsgText")
   
End Function
' Return the result of a SQL request
' Convert SQL runtime errors and process errors to VB Error
#If LIVE = 1 Then
Private Function OpenSQLSafe(ByVal ao_DB As Object, ByVal as_Request As String, Optional ByVal al_RowExpectedCount = -1) As Long
#Else
Private Function OpenSQLSafe(ByVal ao_DB As ARMSYSCOMLib.ArmDb, ByVal as_Request As String, Optional ByVal al_RowExpectedCount = -1) As Long
#End If

On Error GoTo ErrHandler

    Dim lc_Data As Long
    lc_Data = ao_DB.OpenSQL(as_Request)
    
    If lc_Data = 0 Then
        Err.Raise ArmErr.SQLFailure, "SQL : " & as_Request, Join(ao_DB.SQLErrorCodes, SEP2) & SEP1 & Join(ao_DB.SQLErrorMessages, SEP2)
    End If
'    Debug.Print 1 / 0
    If al_RowExpectedCount <> -1 Then
        ' Then check the rowcount
        If ao_DB.RowCount(lc_Data) <> al_RowExpectedCount Then
            Err.Raise ArmErr.SQLBadRowExpectedCount, "SQL : " & as_Request, al_RowExpectedCount & "<>" & ao_DB.RowCount(lc_Data)
        End If
    End If

    OpenSQLSafe = lc_Data

    Exit Function

ErrHandler:

    Call ErrorHandler("OpenSQLSafe")

End Function
' Execute a SQL request returning no data
' Convert SQL runtime errors and process errors to VB Error
' Params:
' ao_Db (Object)
' as_Request (String)
' al_RowAffectedCount (String)
#If LIVE = 1 Then
Private Sub ExecuteSQLSafe(ByVal ao_DB As Object, ByVal as_Request As String, Optional ByVal al_RowAffectedCount = -1, Optional ab_DuplicityCheck As Boolean = False)
#Else
Private Sub ExecuteSQLSafe(ByVal ao_DB As ARMSYSCOMLib.ArmDb, ByVal as_Request As String, Optional ByVal al_RowAffectedCount = -1, Optional ab_DuplicityCheck As Boolean = False)
#End If
On Error GoTo ErrHandler

    ' First execute the request
    If Not ao_DB.ExecuteSQL(as_Request) Then
        Err.Raise ArmErr.SQLFailure, "SQL : " & as_Request, Join(ao_DB.SQLErrorCodes, SEP2) & SEP1 & Join(ao_DB.SQLErrorMessages, SEP2)
    End If

    If al_RowAffectedCount <> -1 Then
        ' Then check the rowcount
        If ao_DB.SQLRowsAffected <> al_RowAffectedCount Then
            
            If ab_DuplicityCheck Then
                Err.Raise ArmCusErr.DuplicityDetected, "SQL : " & as_Request, al_RowAffectedCount & "<>" & ao_DB.SQLRowsAffected
            Else
                Err.Raise ArmErr.SQLBadRowAffectedCount, "SQL : " & as_Request, al_RowAffectedCount & "<>" & ao_DB.SQLRowsAffected
            End If
        End If
    End If

    Exit Sub

ErrHandler:
    Call ErrorHandler("ExecuteSQLSafe")
End Sub
' logs message to database
Private Sub LogMessage(ByVal as_logMsg As String, Optional ByVal as_logType As String = "I", Optional ab_throwException As Boolean = True)
On Error GoTo ErrHandler
Const InsertReq As String = "EXEC A_log_ins $UCODE$, '$LOGTYPE$', '$MSG$', '$APP$'"
    Dim ls_Req As String
    Dim ll_Cursor As Long
    
    ls_Req = Replace(InsertReq, "$UCODE$", CStr(ml_UCode))
    ls_Req = Replace(ls_Req, "$APP$", Left(Trim(SQLStr(SCREEN_NAME & " " & App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)), 50))
    ls_Req = Replace(ls_Req, "$MSG$", right(Trim(SQLStr(as_logMsg)), 4000))
    ls_Req = Replace(ls_Req, "$LOGTYPE$", SQLStr(as_logType), 1)
    
    Call ExecuteSQLSafe(mo_Db, ls_Req)
    
    Exit Sub
ErrHandler:
    If ab_throwException Then Call ErrorHandler(Extender.Name & ".LogMessage - " & Err.Number & ": " & Err.Description)

End Sub

Private Function SQLStr(ByVal as_str As String) As String
    SQLStr = Replace(as_str, "'", "''")
End Function

Public Function SqlDate(ByVal as_Date As String) As String
  SqlDate = "'" & Format$(as_Date, "YYYY-MM-DD") & "'"
End Function

Public Function SqlTime(ByVal ad_Seconds As Double) As String
Dim ll_Hours As Long
Dim ll_Minutes As Long
Dim ll_Seconds As Long
  
  ll_Seconds = ad_Seconds
  ll_Hours = ll_Seconds \ 3600
  ll_Minutes = (ll_Seconds - (ll_Hours * 3600)) \ 60
  ll_Seconds = ll_Seconds Mod 60
  SqlTime = "'" & Format(ll_Hours, "00") & ":" & Format(ll_Minutes, "00") & ":" & Format(ll_Seconds, "00") & "'"
End Function


Private Sub btn_Selection_Click(Index As Integer)
On Error GoTo ErrHandler
    Call Load_Control(SOM_Selection(Index))
    
    Dim ll_SelType As Long
    
    Select Case Index
        Case 0 'Project
            ll_SelType = 1
        Case 1 ' customer
            ll_SelType = 2
        Case 2 'quote
            ll_SelType = 3
    End Select
    
    Call SOM_Selection(Index).Run(ml_UCode, ll_SelType, Get_SelectionSrzFields(UserControl.Controls, fra_filters(Index)))

    SOM_Selection(Index).ZOrder
    SOM_Selection(Index).A_Visible = True
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("btn_Selection_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub Load_Control(ByVal ao_ctrl As Object)
On Error GoTo ErrHandler
    If ao_ctrl.Initialized Then Exit Sub
    Call ao_ctrl.Move(0, tbs_Navigator.Height, UserControl.Width + tbs_Navigator.Width, UserControl.Height + tbs_Navigator.Height)
    ao_ctrl.Language_Code = ms_Language_Code
    ao_ctrl.Ucode = ml_UCode
    ao_ctrl.LoginName = ms_LoginName
    ao_ctrl.FullUserName = ms_FullUserName
    Set ao_ctrl.DB = mo_Db
    ao_ctrl.Load_A_Com
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("Load_Control")
End Sub


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

    Call LockScreen(True)
    If cal_filtersMax(Index).date_courte <> "" And cal_FiltersMin(Index).date_courte <> "" Then
        If CDate(cal_filtersMax(Index).date_courte) < CDate(cal_FiltersMin(Index).date_courte) Then
            cal_filtersMax(Index).SetFocus
            cal_filtersMax(Index).reinit_cal
            Call MsgBox(MsgText(969, ms_Language_Code, "#End date cannot be less than Start date"), vbInformation)
        End If
    End If
    If Not mb_Internal Then Call OnFilterChange(True)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
ErrHandler:
    Call LockScreen(False)

    Select Case Err.Number
    Case Else
        Call LogMessage("cal_filtersMax_datechangee: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub
Private Sub OnFilterChange(ByVal ab_updtextcbo As Boolean)
On Error GoTo ErrHandler
    Dim ls_Req As String

    Dim ls_Text As String
    
    Dim ll_FraIndex As Long
    
    
    If mb_Internal Then Exit Sub
    
    ll_FraIndex = tbs_Navigator.SelectedItem.Tag
    
    
    If Not cbo_Selection(ll_FraIndex).SelectedItem Is Nothing And ab_updtextcbo Then
        ls_Text = cbo_Selection(ll_FraIndex).Text
        cbo_Selection(ll_FraIndex).Locked = False
        cbo_Selection(ll_FraIndex).Text = "(*) " & ls_Text
        cbo_Selection(ll_FraIndex).Locked = True
    End If

    
    ls_Req = ReplaceHolders(UserControl.Controls, fra_filters(ll_FraIndex), mt_ClassInfoLst(ll_FraIndex).RequestGrid)
    
    Call grd_main(ll_FraIndex).ClearGrid
    grd_main(ll_FraIndex).Requests = ""
    
    Call grd_main(ll_FraIndex).Load(ls_Req, False, , , True)

    Exit Sub
ErrHandler:

    Call ErrorHandler("OnFilterChange")
    
End Sub

Private Sub cal_filtersMax_inoutcontainer(Index As Integer, in_out As Byte)
On Error GoTo ErrHandler
    Call LockScreen(True)
    If in_out Then
        Set cal_filtersMax(Index).Container = fra_filters(Index)
        cal_filtersMax(Index).Top = fra_FiltersDate(Index).Top + cal_filtersMax(Index).Top
        cal_filtersMax(Index).Left = fra_FiltersDate(Index).Left + cal_filtersMax(Index).Left
    Else
        Set cal_filtersMax(Index).Container = fra_FiltersDate(Index)
        cal_filtersMax(Index).Top = cal_filtersMax(Index).Top - fra_FiltersDate(Index).Top
        cal_filtersMax(Index).Left = cal_filtersMax(Index).Left - fra_FiltersDate(Index).Left
    End If
    Call LockScreen(False)
    
    Exit Sub
    
ErrHandler:
    Call LockScreen(False)

    Select Case Err.Number
    Case Else
        Call LogMessage("cal_filtersMax_inoutcontainer: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub


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

    Call LockScreen(True)
    If cal_FiltersMin(Index).date_courte <> "" And cal_filtersMax(Index).date_courte <> "" Then
         If CDate(cal_FiltersMin(Index).date_courte) > CDate(cal_filtersMax(Index).date_courte) Then
             cal_FiltersMin(Index).SetFocus
             cal_FiltersMin(Index).reinit_cal
             Call MsgBox(MsgText(968, ms_Language_Code, "#Start date cannot be greater than End date"), vbInformation)
         End If
    End If
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
CleanUp:
    Call LockScreen(False)
    Exit Sub
    
ErrHandler:
    Call LockScreen(False)
    Select Case Err.Number
    Case Else
        Call LogMessage("cal_FiltersMin_datechangee: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub cal_FiltersMin_inoutcontainer(Index As Integer, in_out As Byte)
On Error GoTo ErrHandler
    
    Call LockScreen(True)
    If in_out Then
        Set cal_FiltersMin(Index).Container = fra_filters(Index)
        cal_FiltersMin(Index).Top = fra_FiltersDate(Index).Top + cal_FiltersMin(Index).Top
        cal_FiltersMin(Index).Left = fra_FiltersDate(Index).Left + cal_FiltersMin(Index).Left
    Else
        Set cal_FiltersMin(Index).Container = fra_FiltersDate(Index)
        cal_FiltersMin(Index).Top = cal_FiltersMin(Index).Top - fra_FiltersDate(Index).Top
        cal_FiltersMin(Index).Left = cal_FiltersMin(Index).Left - fra_FiltersDate(Index).Left
    End If
    
    Call LockScreen(False)

    Exit Sub
    
ErrHandler:
    Call LockScreen(False)

    Select Case Err.Number
    Case Else
        Call LogMessage("cal_FiltersMin_inoutcontainer: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub


Private Sub cbo_FiltersCountry_ComboDropDown(Index As Integer)
On Error GoTo ErrHandler
    
    Const REQUEST_PROJ As String = "exec SOM_CountriesFilterProject_cbo '$Language_code$'"
    Const REQUEST_CUST As String = "exec SOM_CountriesFilterCustomer_cbo '$Language_code$'"
    
    Dim ls_Req As String
    
    Select Case Index
        Case 0
            ls_Req = REQUEST_PROJ
        Case 1
            ls_Req = REQUEST_CUST
        Case 2
            If opt_FiltersCountry(0).value = True Then
                ls_Req = REQUEST_PROJ
            Else
                ls_Req = REQUEST_CUST
            End If
        
    End Select
    
    ls_Req = Replace(ls_Req, "$Language_code$", ms_Language_Code)
    
    cbo_FiltersCountry(Index).Request = ls_Req
    
    cbo_FiltersCountry(Index).Load
    DoEvents
    
    cbo_FiltersCountry(Index).AutoDroppedWidth
    
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_FiltersCountry_ComboDropDown: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub


Private Sub cbo_FiltersCountry_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler
    
    If mb_Internal Then Exit Sub
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_FiltersCountry_ComboItemSelected: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub cbo_FiltersDate_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_FiltersDate_ComboItemSelected: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub cbo_filtersType_ComboItemSelected()
On Error GoTo ErrHandler

    If Not cbo_IsFilled(cbo_filtersType) Then Exit Sub
    
    If cbo_filtersType.SelectedItem.Key = 4 Then
        opt_fieldQ(6).Visible = False
        cbo_select(2).Clear
        If opt_fieldQ(6).value = True Then
            opt_fieldQ(7).value = True
        End If
    Else
        opt_fieldQ(6).Visible = True
    End If
    

    If opt_fieldQ(6).value = True Then
        cbo_select(2).Clear

        If cbo_IsFilled(cbo_filtersType) Then
            cbo_select(2).Request = "exec SOM_SystemFilterQuote_cbo " & cbo_filtersType.SelectedItem.Key & ",'" & ms_Language_Code & "'"
        Else
            cbo_select(2).Request = ""
        End If
        
    End If
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_filtersType_ComboItemSelected: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub cbo_select_ComboDropDown(Index As Integer)
On Error GoTo ErrHandler
    
    LockScreen (True)
    
    Dim ls_Key As String
    
    If Not cbo_select(Index).SelectedItem Is Nothing Then
        ls_Key = cbo_select(Index).SelectedItem.Key
    End If
    cbo_select(Index).Clear
    cbo_select(Index).Load
    Call cbo_select(Index).SearchItem(ls_Key, , , True)
    DoEvents
    cbo_select(Index).AutoDroppedWidth
    
    LockScreen (False)
    
    Exit Sub
    
ErrHandler:
    LockScreen (False)
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_select_ComboDropDown: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub


Private Sub cbo_select_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_select_ComboItemSelected: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub cbo_Selection_ComboDropDown(Index As Integer)
On Error GoTo ErrHandler
    
    cbo_Selection(Index).AutoDroppedWidth
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_Selection_ComboDropDown: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select
End Sub

Private Sub cbo_Selection_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler
        
    If mb_Internal Then Exit Sub
    
    If Not cbo_IsFilled(cbo_Selection(Index)) Then Exit Sub
    
    Call ClearForm(UserControl.Controls, fra_filters(Index))

    Call Apply_SelectionSrzFields(UserControl.Controls, fra_filters(Index), cbo_Selection(Index).SelectedItem.GetData(2))
    
    Call OnFilterChange(False)
    
    Exit Sub
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("cbo_Selection_ComboItemSelected: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub grd_Main_ItemSelected(Index As Integer)
On Error GoTo ErrHandler
    
    tbs_Navigator.Enabled = False
    tbl_main.Enabled = False
    
    Select Case Index
        Case 0
            Call Load_Control(SOM_Project)
            Call SOM_Project.Run(eMode.emView, grd_main(Index).SelectedLine(0, "Proj_ID"))
            SOM_Project.ZOrder
            SOM_Project.A_Visible = True
            
        Case 1 'customer
            Call Load_Control(SOM_Customer)
            Call SOM_Customer.Run(eMode.emView, grd_main(Index).SelectedLine(0, "Cust_ID"))
            SOM_Customer.ZOrder
            SOM_Customer.A_Visible = True
        
        Case 2 'Quote
            Call Load_Control(SOM_Quote)
            SOM_Quote.DrivenBy = eQuote
            Call SOM_Quote.Run(eMode.emView, grd_main(Index).SelectedLine(0, "Quote_ID"), "")
            SOM_Quote.ZOrder
            SOM_Quote.A_Visible = True
    End Select
    
    tbs_Navigator.Enabled = True
    tbl_main.Enabled = True
    
    Exit Sub

ErrHandler:
    
    tbs_Navigator.Enabled = False
    tbl_main.Enabled = False

    Select Case Err.Number
    Case 3008
        MsgBox MsgText(2138, ms_Language_Code, "#The record you try to open has been deleted by an other user. Please refresh the grid."), vbInformation
        SOM_Project_OnExit
    Case Else
        Call ErrorHandler("grd_Main_ItemSelected")
    End Select
End Sub

Private Sub lbl_Like_Click(Index As Integer)
On Error GoTo ErrHandler
    
    Select Case Index
'Project
        Case 2, 3
            opt_Like(0).value = True
        Case 0, 1
            opt_Like(1).value = True
        Case 4, 5
            opt_Like(2).value = True
'Customer
        Case 9, 10
            opt_Like(3).value = True
        Case 8, 11
            opt_Like(4).value = True
        Case 6, 7
            opt_Like(5).value = True
'Quote
        Case 12, 13
            opt_Like(6).value = True
        Case 14, 17
            opt_Like(7).value = True
        Case 15, 16
            opt_Like(8).value = True
    End Select
    
    Exit Sub

ErrHandler:
    Select Case Err.Number
    Case Else
        Call LogMessage("lbl_Like_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select
    
End Sub


Private Sub opt_fieldC_Click(Index As Integer)
On Error GoTo ErrHandler
    Dim ls_Info As Variant
    
    Call LockScreen(True)
    
    ls_Info = Split(opt_fieldC(Index).Tag, SEP)
    
    Select Case UCase(ls_Info(2))
        Case "LIKE"
            
            If opt_Like(3).value = False And opt_Like(4).value = False And opt_Like(5).value = False Then
                opt_Like(3).value = True
            End If
            
            fra_Like(1).ZOrder
            fra_Like(1).Visible = True
  
            txt_LikeStr(1).SelStart = 0
            txt_LikeStr(1).SelLength = Len(txt_LikeStr(1).Text)
            
            If txt_LikeStr(1).Visible Then txt_LikeStr(1).SetFocus
        
        Case "SELECT"
            cbo_select(1).Clear
            DoEvents
            
            Select Case Index
                Case 6 'Type
                    cbo_select(1).Request = "exec SOM_CustomerTypeFilterCustomer_cbo '" & ms_Language_Code & "'"
                    
                Case 7 'sales rep
                    cbo_select(1).Request = "exec SOM_Sales_RepsFilterCustomer_cbo 1"
            End Select
        
            Fra_Select(1).ZOrder
            Fra_Select(1).Visible = True
    
    End Select
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Call LockScreen(False)
    
    Exit Sub
ErrHandler:
    Call LockScreen(False)
    
    Select Case Err.Number
    Case Else
        Call LogMessage("opt_fieldC_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select
    
End Sub

Private Sub opt_fieldP_Click(Index As Integer)
On Error GoTo ErrHandler
    Dim ls_Info As Variant
    
    Call LockScreen(True)
    
    ls_Info = Split(opt_fieldP(Index).Tag, SEP)
    
    Select Case UCase(ls_Info(2))
        Case "LIKE"
            
            If opt_Like(0).value = False And opt_Like(1).value = False And opt_Like(2).value = False Then
                opt_Like(0).value = True
            End If
            
            fra_Like(0).ZOrder
            fra_Like(0).Visible = True
            
            txt_LikeStr(0).SelStart = 0
            txt_LikeStr(0).SelLength = Len(txt_LikeStr(0).Text)
            If txt_LikeStr(0).Visible Then txt_LikeStr(0).SetFocus
            
        Case "SELECT"
            cbo_select(0).Clear
            DoEvents
            
            Select Case Index
                Case 2 'Market segmantation
                    cbo_select(0).Request = "exec SOM_MarketSegmentationFilterProject_cbo '" & ms_Language_Code & "'"
                    
                Case 3 'status
                    cbo_select(0).Request = "exec SOM_ProjectStatusFilterProject_cbo '" & ms_Language_Code & "'"
                
                Case 5 'Sales Rep
                    cbo_select(0).Request = "exec SOM_Sales_RepsFilterProject_cbo 1"
               
                Case 6 'Clg Function
                    cbo_select(0).Request = "exec SOM_ClgfunctionFilterProject_cbo '" & ms_Language_Code & "'"

            End Select
            
        
            Fra_Select(0).ZOrder
            Fra_Select(0).Visible = True
            
        Case "VALUE"
            
            If opt_operator(0).value = False And opt_operator(1).value = False And opt_operator(2).value = False Then
                opt_operator(0).value = True
            End If
            
            fra_value(0).ZOrder
            fra_value(0).Visible = True
            
            If txt_value(0).Text = "" Then txt_value(0).Text = "0"
            txt_value(0).SelStart = 0
            txt_value(0).SelLength = Len(txt_value(0).Text)
            If txt_value(0).Visible Then txt_value(0).SetFocus
    End Select
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Call LockScreen(False)
    
    Exit Sub
ErrHandler:
    Call LockScreen(False)
    
    Select Case Err.Number
    Case Else
        Call LogMessage("opt_fieldP_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub opt_fieldQ_Click(Index As Integer)
On Error GoTo ErrHandler
    Dim ls_Info As Variant

    Call LockScreen(True)
    
    ls_Info = Split(opt_fieldQ(Index).Tag, SEP)
    
    Select Case UCase(ls_Info(2))
        Case "LIKE"
            
            If opt_Like(6).value = False And opt_Like(7).value = False And opt_Like(8).value = False Then
                opt_Like(6).value = True
            End If
            
            fra_Like(2).ZOrder
            fra_Like(2).Visible = True
            
            txt_LikeStr(2).SelStart = 0
            txt_LikeStr(2).SelLength = Len(txt_LikeStr(2).Text)
            If txt_LikeStr(2).Visible Then txt_LikeStr(2).SetFocus

            
        Case "SELECT"
        
            cbo_select(2).Clear
            DoEvents
            
            Select Case Index
                Case 1 'realisation
                    cbo_select(2).Request = "exec SOM_RealisationFilterQuote_cbo '" & ms_Language_Code & "'"
                    
                Case 3 'sales rep
                    cbo_select(2).Request = "exec SOM_Sales_RepsFilterQuote_cbo"
                
                Case 4 'BO rep
                    cbo_select(2).Request = "exec SOM_BO_Sales_RepsFilterQuote_cbo"
               
                Case 5 'W L D
                    cbo_select(2).Request = "exec SOM_Quote_StatusFilterQuote_cbo '" & ms_Language_Code & "'"
                
                Case 6 'System
                    If cbo_IsFilled(cbo_filtersType) Then
                        cbo_select(2).Request = "exec SOM_SystemFilterQuote_cbo " & cbo_filtersType.SelectedItem.Key & ",'" & ms_Language_Code & "'"
                    Else
                        cbo_select(2).Request = ""
                    End If
            End Select
        
            Fra_Select(2).ZOrder
            Fra_Select(2).Visible = True
        
        Case "VALUE"
            
            If opt_operator(5).value = False And opt_operator(4).value = False And opt_operator(3).value = False Then
                opt_operator(5).value = True
            End If
            
            fra_value(2).ZOrder
            fra_value(2).Visible = True
            
            If txt_value(2).Text = "" Then txt_value(2).Text = "0"
                                    
            Call CheckNumericFieldFilter(txt_value(2))
                                    
            txt_value(2).SelStart = 0
            txt_value(2).SelLength = Len(txt_value(2).Text)
            If txt_value(2).Visible Then txt_value(2).SetFocus
    
    End Select
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Call LockScreen(False)
    
    Exit Sub
ErrHandler:
    Call LockScreen(False)
    
    Select Case Err.Number
    Case Else
        Call LogMessage("opt_fieldQ_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub opt_FiltersCountry_Click(Index As Integer)
On Error GoTo ErrHandler
    
    cbo_FiltersCountry(2).Clear
    DoEvents
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("opt_FiltersCountry_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub opt_FiltersDate_Click(Index As Integer)
On Error GoTo ErrHandler
    
    Dim ml_IndexFilters As Long
    Dim mb_IsVisible As Boolean
    
    Select Case Index
        Case 0, 1 'Project
            ml_IndexFilters = 0
        Case 2, 3 'Customer
            ml_IndexFilters = 1
        Case 5, 4 'Quote
            ml_IndexFilters = 2
    End Select
    
    'ml_IndexFilters = tbs_Navigator.SelectedItem.Tag
    
    If Index = 0 Or Index = 2 Or Index = 5 Then
        mb_IsVisible = False
    Else
        mb_IsVisible = True
    End If
    cal_filtersMax(ml_IndexFilters).Visible = mb_IsVisible
    cal_FiltersMin(ml_IndexFilters).Visible = mb_IsVisible
    cbo_FiltersDate(ml_IndexFilters).Visible = mb_IsVisible
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("opt_FiltersDate_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select
    
End Sub

Private Sub opt_Like_Click(Index As Integer)
On Error GoTo ErrHandler
        
    Dim ll_Index As Long
    Dim lControl As Object
    
    ll_Index = tbs_Navigator.SelectedItem.Tag
        
    txt_LikeStr(ll_Index).SelStart = 0
    txt_LikeStr(ll_Index).SelLength = Len(txt_LikeStr(ll_Index).Text)
    
    If txt_LikeStr(ll_Index).Visible Then txt_LikeStr(ll_Index).SetFocus
        
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("opt_Like_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub opt_operator_Click(Index As Integer)
On Error GoTo ErrHandler
        
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("opt_operator_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub SOM_Customer_OnExit()
On Error GoTo ErrHandler

    Call LockScreen(True)
    
    SOM_Customer.A_Visible = False
    fra_main(tbs_Navigator.SelectedItem.Tag).ZOrder
    fra_main(tbs_Navigator.SelectedItem.Tag).Visible = True
    tbl_main.ZOrder
    tbl_main.Visible = True
    
    Call LockScreen(False)

    Exit Sub

ErrHandler:
    Call LockScreen(False)
    Call ErrorHandler("SOM_Customer_OnExit")

End Sub

Private Sub SOM_Customer_OnItemAdd(ByVal ae_CptType As eComponent, ByVal al_Key As Long, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
   
    Select Case ae_CptType
        
        Case eLink
            Call SOM_Project.Notify(ae_CptType, eMode.emAdd, al_Key, as_SrzFields)
        
        Case eCustomer
            Call SOM_Project.Notify(ae_CptType, eMode.emAdd, al_Key, as_SrzFields)
            
            Call AddLineToGrid(grd_main(1), 1, "Cust_ID", as_SrzFields)
    
           If grd_main(1).SelectedCount > 0 Then
                Call SOM_Customer.Run(eMode.emView, grd_main(1).SelectedLine(0, "Cust_Id"))
            End If
        
        Case eQuote
            Call SOM_Project.Notify(ae_CptType, eMode.emAdd, al_Key, as_SrzFields)
            
            'todo check filters before adding
            Call AddLineToGrid(grd_main(2), 2, "Quote_ID", as_SrzFields)
        
    End Select
        
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Customer_OnItemAdd")
End Sub

Private Sub SOM_Customer_OnItemDelete(ByVal ae_CptType As eComponent, ByVal al_Key As Long)
On Error GoTo ErrHandler
    
    Select Case ae_CptType
        
        Case eLink
            Call SOM_Project.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call DeleteLineToGrid(grd_main(2), "Quote_ID", "ProjCustLink_ID", al_Key)
        
        Case eCustomer
            Call SOM_Project.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emDelete, al_Key, "")
        
            Call DeleteLineToGrid(grd_main(1), "Cust_ID", "Cust_ID", al_Key)
            
            Call DeleteLineToGrid(grd_main(2), "Quote_ID", "Cust_ID", al_Key)
    
        Case eQuote
            Call SOM_Project.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call DeleteLineToGrid(grd_main(2), "Quote_ID", "Quote_ID", al_Key)
        
    End Select
        
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Customer_OnItemDelete")
End Sub

Private Sub SOM_Customer_OnItemNext()

On Error GoTo ErrHandler

    If Not grd_main(1).NextItem Then
        Call MsgBox(MsgText(928, ms_Language_Code, "#No more next item"), vbInformation)
    End If
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Customer_OnItemNext")
End Sub

Private Sub SOM_Customer_OnItemPrevious()
On Error GoTo ErrHandler
    
    If Not grd_main(1).PreviousItem Then
        Call MsgBox(MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation)
    End If
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Customer_OnItemPrevious")
End Sub

Private Sub SOM_Customer_OnItemUpdate(ByVal ae_CptType As eComponent, ByVal al_Key As Long, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
    
    Select Case ae_CptType
        
        Case eLink
            Call SOM_Project.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call UpdateLineToGrid(grd_main(1), "Cust_ID", al_Key, as_SrzFields, True)
        
        Case eCustomer
            Call SOM_Project.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call UpdateLineToGrid(grd_main(1), "Cust_ID", al_Key, as_SrzFields, True)
            Call UpdateLineToGrid(grd_main(2), "Cust_ID", al_Key, as_SrzFields, False)
    
        Case eQuote
            
            Call SOM_Project.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            'todo check filters before adding
            Call UpdateLineToGrid(grd_main(2), "Quote_ID", al_Key, as_SrzFields, True)
        
    End Select
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Customer_OnItemUpdate")
End Sub

Private Sub SOM_ExcelExp_OnExit(Index As Integer)
On Error GoTo ErrHandler
        
    
    
    Call LockScreen(True)
    
    SOM_ExcelExp(Index).A_Visible = False
    
    fra_main(Index).ZOrder
    fra_main(Index).Visible = True
    tbl_main.ZOrder
    tbl_main.Visible = True
    
    Call LockScreen(False)
    
    Exit Sub

ErrHandler:
    Call LockScreen(False)
    Call ErrorHandler("SOM_ExcelExp_OnExit")
End Sub



Private Sub SOM_ExcelExp_QueryKeys(Index As Integer, as_Keys As String, ByVal ab_SelectOnly As Boolean, ab_Cancelled As Boolean)
On Error GoTo ErrHandler
    
    Dim ls_ColKey As String
    Dim i As Long
      
    
    If Not grd_main(Index).AllDataLoaded And Not ab_SelectOnly Then
        Select Case MsgBox(MsgText(C_ERRORRAISE + 51, ms_Language_Code, "#The grid is not fully loaded. Would you like to load all the data in the grid before the excel export?"), vbInformation + vbYesNoCancel, "")
            Case vbCancel
                ab_Cancelled = True
                Exit Sub
            Case vbYes
                While Not grd_main(Index).AllDataLoaded
                    grd_main(Index).LastLine
                Wend
        End Select
    End If
    
    Select Case Index
        Case 0
            ls_ColKey = "Proj_ID"
        
        Case 1
            ls_ColKey = "Cust_ID"
        
        Case 2
            ls_ColKey = "Quote_ID"
    End Select
    
    as_Keys = ""
    
    If ab_SelectOnly Then
        For i = 0 To grd_main(Index).SelectedCount - 1
            as_Keys = grd_main(Index).SelectedLine(i, ls_ColKey) & SEP & as_Keys
        Next i
    Else
        For i = 0 To grd_main(Index).Rows - 1
            as_Keys = grd_main(Index).Data(i, ls_ColKey) & SEP & as_Keys
        Next i
    End If
    
    ab_Cancelled = False
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_ExcelExp_QueryKeys")

End Sub


Private Sub SOM_Project_OnExit()
On Error GoTo ErrHandler

    Call LockScreen(True)
      
    SOM_Project.A_Visible = False
    fra_main(tbs_Navigator.SelectedItem.Tag).ZOrder
    fra_main(tbs_Navigator.SelectedItem.Tag).Visible = True
    tbl_main.ZOrder
    tbl_main.Visible = True
    
    Call LockScreen(False)
    
    Exit Sub

ErrHandler:
    Call LockScreen(False)
    Call ErrorHandler("SOM_Project_OnExit")
End Sub

Private Sub SOM_Project_OnItemAdd(ByVal ae_CptType As eComponent, ByVal al_Key As Long, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
   
    Select Case ae_CptType
        
        Case eLink
            Call SOM_Customer.Notify(ae_CptType, eMode.emAdd, al_Key, as_SrzFields)
        
        Case eProject
            Call SOM_Customer.Notify(ae_CptType, eMode.emAdd, al_Key, as_SrzFields)
            
            Call AddLineToGrid(grd_main(0), 0, "Proj_ID", as_SrzFields)
    
           If grd_main(0).SelectedCount > 0 Then
                Call SOM_Project.Run(eMode.emView, grd_main(0).SelectedLine(0, "Proj_Id"))
            End If
        
        Case eQuote
            Call SOM_Customer.Notify(ae_CptType, eMode.emAdd, al_Key, as_SrzFields)
            
            'todo check filters before adding
            Call AddLineToGrid(grd_main(2), 2, "Quote_ID", as_SrzFields)
        
    End Select
        
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Project_OnItemAdd")
End Sub

Private Sub DeleteLineToGrid(ByVal ao_grid As ArmGrid, ByVal as_keyField As String, ByVal as_KeyFieldToSearch As String, ByVal al_Key As Long)
On Error GoTo ErrHandler
    
    Dim ll_Selectedkey As Long
    
    'To keep the initial seleted line in memory
    If ao_grid.SelectedCount > 0 Then ll_Selectedkey = ao_grid.SelectedLine(0, as_keyField)
    
    ao_grid.Columns(as_KeyFieldToSearch).Key = True
    
    While ao_grid.SearchKey(True, Array(al_Key))
        ao_grid.DeleteLine
    Wend
    
    ao_grid.Columns(as_KeyFieldToSearch).Key = False
    
    'Select the initial selected line
    If ll_Selectedkey <> 0 Then
        ao_grid.Columns(as_keyField).Key = True
        ao_grid.SearchKey True, Array(ll_Selectedkey)
        ao_grid.Columns(as_keyField).Key = False
    Else
        ao_grid.DeselectRow
    End If
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("DeleteLineToGrid")
End Sub

Private Sub UpdateLineToGrid(ByVal ao_grid As ArmGrid, as_keyField As String, ByVal al_Key As Long, ByVal as_SrzFields As String, ByVal ab_OneRowToUpdate As Boolean)
On Error GoTo ErrHandler
    
    Dim lv_SrzFields As Variant
    Dim lv_Values
    Dim ll_Count As Long
    Dim ll_Nb As Long, ll_Nb2 As Long, ll_Idx As Long
    
    Dim ls_ColNames As String
    
    Dim lb_ColorLine As Boolean
    
    lb_ColorLine = False
    
    ll_Nb = ao_grid.Rows - 1
    For ll_Count = 0 To ll_Nb
        
        'si cust_id = alkey mettre ŕ jour la ligne de la grille
        If ao_grid.Data(ll_Count, as_keyField) = al_Key Then
            lv_SrzFields = Split(as_SrzFields, SEP)
            ll_Nb2 = UBound(lv_SrzFields) - 1
            
            'build the list of columns of the grid
            ls_ColNames = SEP2
            Dim i As Long
            For i = 0 To ao_grid.Cols - 1
                ls_ColNames = ls_ColNames & UCase(ao_grid.Columns(i).FieldName) & SEP2
            Next i
            
            For ll_Idx = 0 To ll_Nb2
                lv_Values = Split(lv_SrzFields(ll_Idx), SEP1)
                 If InStr(1, UCase(ls_ColNames), SEP2 & UCase(lv_Values(0)) & SEP2) Then
                    If ao_grid.Columns(lv_Values(0)).FieldType = DBTYPE_R4 Then
                        ao_grid.Data(ll_Count, lv_Values(0)) = Replace(lv_Values(1), ".", ms_DecimalSeparator, , , vbTextCompare)
                    Else
                    ao_grid.Data(ll_Count, lv_Values(0)) = lv_Values(1)
                End If
                    
                    lb_ColorLine = True
                    
                End If
            Next

            If lb_ColorLine = True Then ao_grid.LineColor(ll_Count) = COLOR_UPDLINE
            
            lb_ColorLine = False
                        
            'there is only on link per proj/cust
            If ab_OneRowToUpdate Then Exit For
        
        End If
    Next
    
    Exit Sub
ErrHandler:
    Call ErrorHandler("UpdateLineToGrid")
End Sub

Private Sub AddLineToGrid(ByVal ao_grid As ArmGrid, ByVal al_grdindex As Long, ByVal as_Key As String, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
    
    Dim lv_SrzFields As Variant
    Dim lv_Values
    Dim ll_Count As Long
    Dim ll_Nb As Long
    
    Dim ll_curs As Long
    Dim ls_Req As String
    
    Dim ls_ColNames As String
    Dim ll_grdindex As Integer
    
    
    If ao_grid.Requests(0) = "" Then Exit Sub
    
    ll_grdindex = al_grdindex
    
    ao_grid.AddLine
    ao_grid.LineColor(ao_grid.Row) = COLOR_ADDLINE
    
    ls_ColNames = SEP2
    Dim i As Long
    For i = 0 To ao_grid.Cols - 1
        ls_ColNames = ls_ColNames & ao_grid.Columns(i).FieldName & SEP2
    Next i
    
    
    For i = 0 To ao_grid.Cols - 1
        If GetFieldValueFromSrz(as_SrzFields, ao_grid.Columns(i).FieldName) = "" Then
            ls_Req = ReplaceHolders(UserControl.Controls, fra_filters(ll_grdindex), mt_ClassInfoLst(ll_grdindex).RequestGrid) & "," & GetFieldValueFromSrz(as_SrzFields, as_Key)
            as_SrzFields = ""
            ll_curs = OpenSQLSafe(mo_Db, ls_Req, 1)
            
            For ll_Count = 0 To mo_Db.FieldCount(ll_curs) - 1
                as_SrzFields = as_SrzFields & mo_Db.GetFieldName(ll_curs, ll_Count) & SEP1 & mo_Db.GetFields(ll_curs, ll_Count) & SEP
            Next ll_Count
            mo_Db.Close (ll_curs)
            Exit For
        End If
    Next i
    
    lv_SrzFields = Split(as_SrzFields, SEP)
    ll_Nb = UBound(lv_SrzFields) - 1

    For ll_Count = 0 To ll_Nb
        lv_Values = Split(lv_SrzFields(ll_Count), SEP1)
         If InStr(1, UCase(ls_ColNames), SEP2 & UCase(lv_Values(0)) & SEP2) Then
            ao_grid.SelectedLine(0, lv_Values(0)) = lv_Values(1)
            Debug.Print lv_SrzFields(ll_Count)
         End If
    Next ll_Count
    
    Exit Sub
ErrHandler:
    mo_Db.Close (ll_curs)
    Call ErrorHandler("AddLineToGrid")
End Sub
Private Function GetFieldValueFromSrz(ByVal as_SrzFields As String, ByVal as_Param As String) As String
On Error GoTo ErrHandler
    
    Dim lv_SrzFields As Variant
    Dim lv_Values
    Dim ll_Count As Long
    Dim ll_Nb As Long
       
    If right(as_SrzFields, 2) <> SEP Then as_SrzFields = as_SrzFields & SEP
       
    lv_SrzFields = Split(as_SrzFields, SEP)
    ll_Nb = UBound(lv_SrzFields) - 1

    For ll_Count = 0 To ll_Nb
        lv_Values = Split(lv_SrzFields(ll_Count), SEP1)
         If UCase(as_Param) = UCase(lv_Values(0)) Then
           GetFieldValueFromSrz = lv_Values(1)
           Exit For
         End If
    Next ll_Count
    
    Exit Function
ErrHandler:
    Call ErrorHandler("GetFieldValueFromSrz")
End Function
Private Sub SOM_Project_OnItemDelete(ByVal ae_CptType As eComponent, ByVal al_Key As Long)
On Error GoTo ErrHandler
    
    Select Case ae_CptType
        
        Case eLink
            Call SOM_Customer.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call DeleteLineToGrid(grd_main(2), "Quote_ID", "ProjCustLink_ID", al_Key)
        
        Case eProject
            Call SOM_Customer.Notify(ae_CptType, eMode.emDelete, al_Key, "")
        
            Call SOM_Quote.Notify(ae_CptType, eMode.emDelete, al_Key, "")
        
            Call DeleteLineToGrid(grd_main(0), "Proj_ID", "Proj_ID", al_Key)
            
            Call DeleteLineToGrid(grd_main(2), "Quote_ID", "Proj_ID", al_Key)
            
    
        Case eQuote
            Call SOM_Customer.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emDelete, al_Key, "")
            
            Call DeleteLineToGrid(grd_main(2), "Quote_ID", "Quote_ID", al_Key)
        
    End Select
        
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Project_OnItemDelete")
End Sub



Private Sub SOM_Project_OnItemNext()
On Error GoTo ErrHandler
    
    If Not grd_main(0).NextItem Then
        Call MsgBox(MsgText(928, ms_Language_Code, "#No more next item"), vbInformation)
    End If
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Project_OnItemNext")

End Sub

Private Sub SOM_Project_OnItemPrevious()
On Error GoTo ErrHandler
    
    If Not grd_main(0).PreviousItem Then
        Call MsgBox(MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation)
    End If
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Project_OnItemPrevious")
End Sub

Private Sub SOM_Project_OnItemUpdate(ByVal ae_CptType As eComponent, ByVal al_Key As Long, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
    
    Select Case ae_CptType
        
        Case eLink
            Call SOM_Customer.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call UpdateLineToGrid(grd_main(0), "Proj_ID", al_Key, as_SrzFields, True)
        
        Case eProject
            Call SOM_Customer.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call UpdateLineToGrid(grd_main(0), "Proj_ID", al_Key, as_SrzFields, True)
            Call UpdateLineToGrid(grd_main(2), "Proj_ID", al_Key, as_SrzFields, False)
    
        Case eQuote
            
            Call SOM_Customer.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            Call SOM_Quote.Notify(ae_CptType, eMode.emUpdate, al_Key, as_SrzFields)
            
            'todo check filters before adding
            Call UpdateLineToGrid(grd_main(2), "Quote_ID", al_Key, as_SrzFields, True)
        
    End Select
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Project_OnItemUpdate")
End Sub

Private Sub SOM_Quote_OnExit(ByVal ab_ByUser As Boolean)
On Error GoTo ErrHandler
    
    Call LockScreen(True)
    
    SOM_Quote.A_Visible = False
    fra_main(tbs_Navigator.SelectedItem.Tag).ZOrder
    fra_main(tbs_Navigator.SelectedItem.Tag).Visible = True
    tbl_main.ZOrder
    tbl_main.Visible = True
    
    Call LockScreen(False)
    
    Exit Sub

ErrHandler:
    Call LockScreen(False)
    Call ErrorHandler("SOM_Quote_OnExit")
End Sub

Private Sub SOM_Quote_OnItemNext()
On Error GoTo ErrHandler
    
    If Not grd_main(2).NextItem Then
        Call MsgBox(MsgText(928, ms_Language_Code, "#No more next item"), vbInformation)
    End If
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Quote_OnItemNext")

End Sub

Private Sub SOM_Quote_OnItemPrevious()
On Error GoTo ErrHandler
    
    If Not grd_main(2).PreviousItem Then
        Call MsgBox(MsgText(927, ms_Language_Code, "#No more previous item"), vbInformation)
    End If
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Quote_OnItemPrevious")

End Sub

Private Sub SOM_Selection_OnExit(Index As Integer)
On Error GoTo ErrHandler
    
    Call LockScreen(True)
    
    SOM_Selection(Index).A_Visible = False
    fra_main(Index).ZOrder
    fra_main(Index).Visible = True
    tbl_main.ZOrder
    tbl_main.Visible = True
    
    Call LockScreen(False)
    
    Exit Sub

ErrHandler:
    Call LockScreen(False)
    Call ErrorHandler("SOM_Selection_OnExit")
End Sub

Private Sub SOM_Selection_OnItemAdd(Index As Integer, ByVal ae_CptType As eComponent, ByVal al_Key As Long, ByVal as_SrzFields As String)
On Error GoTo ErrHandler
    Dim lValues As Variant
    
    lValues = Split(as_SrzFields, SEP)
    
    Call cbo_Selection(Index).AddItem(Array(al_Key, lValues(0), Mid(as_SrzFields, InStr(1, as_SrzFields, SEP) + Len(SEP))), True)
      
'    Call Apply_SelectionSrzFields(UserControl.Controls, fra_filters(Index), cbo_Selection(Index).SelectedItem.GetData(2))
'
'    Call OnFilterChange(False)
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Selection_OnItemAdd")
End Sub

Private Sub SOM_Selection_OnItemDelete(Index As Integer, ByVal ae_CptType As eComponent, ByVal al_Key As Long)
On Error GoTo ErrHandler

    If cbo_Selection(Index).SelectedItem Is Nothing Then
        cbo_Selection(Index).SearchItem "0", 0, , True
    Else
        If cbo_Selection(Index).SelectedItem.Key = al_Key Then
            cbo_Selection(Index).SearchItem "0", 0, , True
            Call OnFilterChange(False)
        End If
    End If
    
    mb_Internal = True
    Call cbo_Selection(Index).DeleteItemKey(al_Key)
    DoEvents
    mb_Internal = False
    
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("SOM_Selection_OnItemDelete")
End Sub

Private Sub Init_Excel(ByVal al_CtrlIndex As Long)
On Error GoTo ErrHandler
     
     Dim lb_LineSelected As Boolean
     
    Const CORE_REQUEST_P As String = "SELECT DISTINCT $fields$" & vbCr & "FROM SOM_Project P" & vbCr & "INNER JOIN SOM_ClgFunction CF ON P.Cf_code = CF.Cf_code AND CF.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_ProjectStatus PS ON P.PS_code = PS.PS_code AND PS.Language_code = '$Language_code$'" & vbCr & "INNER JOIN Countries CT_P ON P.CT_code = CT_P.CT_code AND CT_P.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_Sales_Reps SSR_P ON P.SSR_code = SSR_P.U_code " & vbCr & "INNER JOIN Gen_Systems_Users SU_P ON SSR_P.U_code = SU_P.U_code" & vbCr & "INNER JOIN Gen_People GP_P ON SU_P.P_code = GP_P.P_code" & vbCr & "INNER JOIN Gen_Systems_Users SU_P_CREA ON P.Z_creator = SU_P_CREA.U_code" & vbCr & "INNER JOIN Gen_People GP_P_CREA ON SU_P_CREA.P_code = GP_P_CREA.P_code" & vbCr & "INNER JOIN Gen_Systems_Users SU_P_LUPD ON P.Z_last_upd_user = SU_P_LUPD.U_code" & vbCr & _
                 "INNER JOIN Gen_People GP_P_LUPD ON SU_P_LUPD.P_code = GP_P_LUPD.P_code" & vbCr & "INNER JOIN SOM_MarketSegmentation MS ON P.MKS_code = MS.MKS_code AND MS.Language_code = '$Language_code$'" & vbCr & "INNER JOIN Unit_Of_Measure UM_P ON P.UM_code = UM_P.UM_code AND UM_P.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_ProjCustLink PCL ON P.Proj_ID = PCL.Proj_ID AND PCL.Drop_flag <> 'X'" & vbCr & _
                 "LEFT OUTER JOIN SOM_CustomerType SCT_PCL ON PCL.Cust_Proj_role = SCT_PCL.SCT_code and SCT_PCL.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Customer C ON PCL.Cust_ID = C.Cust_ID AND C.Drop_flag <> 'X'" & vbCr & "LEFT OUTER JOIN SOM_CustomerType SCT_C ON C.SCT_code = SCT_C.SCT_code and SCT_C.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Countries CT_C ON C.CT_code = CT_C.CT_code AND CT_C.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Sales_Reps SSR_C ON C.SSR_code = SSR_C.U_code " & vbCr & _
                 "LEFT OUTER JOIN Gen_Systems_Users SU_C ON SSR_C.U_code = SU_C.U_code" & vbCr & _
                 "LEFT OUTER JOIN Gen_People GP_C ON SU_C.P_code = GP_C.P_code" & vbCr & "LEFT OUTER JOIN SOM_Quote Q ON PCL.ProjCustLink_ID = Q.ProjCustLink_ID AND Q.Drop_flag <> 'X'" & vbCr & "LEFT OUTER JOIN SOM_Project P_Q ON P_Q.Proj_ID = PCL.Proj_ID" & vbCr & "LEFT OUTER JOIN SOM_Currencies_Exchanges CURR_Q ON Q.Quote_CURR_code = CURR_Q.CURR_code and CURR_Q.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Currencies_Exchanges CURR_FRGH ON Q.FRGHT_CURR_code = CURR_FRGH.CURR_code and CURR_FRGH.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN A_References_ML AR_INCL ON Q.Quote_IncludeGroup = AR_INCL.GR_Code and Q.Quote_Include = AR_INCL.RF_code and AR_INCL.Language_code = '$Language_code$'" & vbCr & _
                 "LEFT OUTER JOIN A_References_ML AR_TYPE ON Q.Quote_TypeGroup = AR_TYPE.GR_Code and Q.Quote_Type = AR_TYPE.RF_code and AR_TYPE.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN A_References_ML AR_STAT ON Q.StatusGroup = AR_STAT.GR_Code and Q.Status = AR_STAT.RF_code and AR_STAT.Language_code = '$Language_code$ '" & vbCr & _
                 "LEFT OUTER JOIN SOM_System SS_STD ON Q.STD_SS_code = SS_STD.SS_code and SS_STD.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_System SS_SEM ON Q.SEM_SS_code = SS_SEM.SS_code and SS_SEM.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_System SS_CUS ON Q.CUS_SS_code = SS_CUS.SS_code and SS_CUS.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_STD ON Q.STD_UM_code = UMQ_STD.UM_code AND UMQ_STD.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_SEM ON Q.SEM_UM_code = UMQ_SEM.UM_code AND UMQ_SEM.Language_code = '$Language_code$'" & vbCr & _
                 "LEFT OUTER JOIN Unit_Of_Measure UMQ_CUS ON Q.CUS_UM_code = UMQ_CUS.UM_code AND UMQ_CUS.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Realisation RL ON Q.RL_code = RL.RL_code AND RL.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Sales_Reps SSR_Q ON Q.SSR_code = SSR_Q.U_code " & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_Q ON SSR_Q.U_code = SU_Q.U_code" & vbCr & _
                 "LEFT OUTER JOIN Gen_People GP_Q ON SU_Q.P_code = GP_Q.P_code" & vbCr & "LEFT OUTER JOIN SOM_Sales_Reps SSR_BO ON Q.BO_SSR_code = SSR_BO.U_code " & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_BO ON SSR_BO.U_code = SU_BO.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_BO ON SU_BO.P_code = GP_BO.P_code" & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_Q_CREA ON Q.Z_creator = SU_Q_CREA.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_Q_CREA ON SU_Q_CREA.P_code = GP_Q_CREA.P_code" & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_Q_LUPD ON Q.Z_last_upd_user = SU_Q_LUPD.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_Q_LUPD ON SU_Q_LUPD.P_code = GP_Q_LUPD.P_code"
    
    Const CORE_REQUEST_Q As String = "SELECT DISTINCT $fields$" & vbCr & "FROM SOM_Quote Q " & vbCr & "INNER JOIN SOM_Currencies_Exchanges CURR_Q ON Q.Quote_CURR_code = CURR_Q.CURR_code and CURR_Q.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Currencies_Exchanges CURR_FRGH ON Q.FRGHT_CURR_code = CURR_FRGH.CURR_code and CURR_FRGH.Language_code = '$Language_code$'" & vbCr & "INNER JOIN A_References_ML AR_INCL ON Q.Quote_IncludeGroup = AR_INCL.GR_Code and Q.Quote_Include = AR_INCL.RF_code and AR_INCL.Language_code = '$Language_code$'" & vbCr & "INNER JOIN A_References_ML AR_TYPE ON Q.Quote_TypeGroup = AR_TYPE.GR_Code and Q.Quote_Type = AR_TYPE.RF_code and AR_TYPE.Language_code = '$Language_code$'" & vbCr & "INNER JOIN A_References_ML AR_STAT ON Q.StatusGroup = AR_STAT.GR_Code and Q.Status = AR_STAT.RF_code and AR_STAT.Language_code = '$Language_code$'" & vbCr & _
                "LEFT OUTER JOIN SOM_System SS_STD ON Q.STD_SS_code = SS_STD.SS_code and SS_STD.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_System SS_SEM ON Q.SEM_SS_code = SS_SEM.SS_code and SS_SEM.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_System SS_CUS ON Q.CUS_SS_code = SS_CUS.SS_code and SS_CUS.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_STD ON Q.STD_UM_code = UMQ_STD.UM_code AND UMQ_STD.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_SEM ON Q.SEM_UM_code = UMQ_SEM.UM_code AND UMQ_SEM.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_CUS ON Q.CUS_UM_code = UMQ_CUS.UM_code AND UMQ_CUS.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_Realisation RL ON Q.RL_code = RL.RL_code AND RL.Language_code = '$Language_code$'" & vbCr & _
                "INNER JOIN SOM_Sales_Reps SSR_Q ON Q.SSR_code = SSR_Q.U_code " & vbCr & "INNER JOIN Gen_Systems_Users SU_Q ON SSR_Q.U_code = SU_Q.U_code" & vbCr & "INNER JOIN Gen_People GP_Q ON SU_Q.P_code = GP_Q.P_code" & vbCr & "INNER JOIN SOM_Sales_Reps SSR_BO ON Q.BO_SSR_code = SSR_BO.U_code " & vbCr & "INNER JOIN Gen_Systems_Users SU_BO ON SSR_BO.U_code = SU_BO.U_code" & vbCr & "INNER JOIN Gen_People GP_BO ON SU_BO.P_code = GP_BO.P_code" & vbCr & "INNER JOIN Gen_Systems_Users SU_Q_CREA ON Q.Z_creator = SU_Q_CREA.U_code" & vbCr & "INNER JOIN Gen_People GP_Q_CREA ON SU_Q_CREA.P_code = GP_Q_CREA.P_code" & vbCr & "INNER JOIN Gen_Systems_Users SU_Q_LUPD ON Q.Z_last_upd_user = SU_Q_LUPD.U_code" & vbCr & "INNER JOIN Gen_People GP_Q_LUPD ON SU_Q_LUPD.P_code = GP_Q_LUPD.P_code" & vbCr & "INNER JOIN  SOM_ProjCustLink PCL ON Q.ProjCustLink_ID = PCL.ProjCustLink_ID AND PCL.Drop_flag <> 'X'" & vbCr & _
                "INNER JOIN  SOM_CustomerType SCT_PCL ON PCL.Cust_Proj_role = SCT_PCL.SCT_code and SCT_PCL.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_Project P_Q ON P_Q.Proj_ID = PCL.Proj_ID" & vbCr & "INNER JOIN SOM_Project P ON P.Proj_ID = PCL.Proj_ID" & vbCr & "INNER JOIN SOM_ClgFunction CF ON P.Cf_code = CF.Cf_code AND CF.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_ProjectStatus PS ON P.PS_code = PS.PS_code AND PS.Language_code = '$Language_code$'" & vbCr & "INNER JOIN Countries CT_P ON P.CT_code = CT_P.CT_code AND CT_P.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_Sales_Reps SSR_P ON P.SSR_code = SSR_P.U_code " & vbCr & "INNER JOIN Gen_Systems_Users SU_P ON SSR_P.U_code = SU_P.U_code" & vbCr & "INNER JOIN Gen_People GP_P ON SU_P.P_code = GP_P.P_code" & vbCr & "INNER JOIN Gen_Systems_Users SU_P_CREA ON P.Z_creator = SU_P_CREA.U_code" & vbCr & _
                "INNER JOIN Gen_People GP_P_CREA ON SU_P_CREA.P_code = GP_P_CREA.P_code" & vbCr & "INNER JOIN Gen_Systems_Users SU_P_LUPD ON P.Z_last_upd_user = SU_P_LUPD.U_code" & vbCr & "INNER JOIN Gen_People GP_P_LUPD ON SU_P_LUPD.P_code = GP_P_LUPD.P_code" & vbCr & "INNER JOIN SOM_MarketSegmentation MS ON P.MKS_code = MS.MKS_code AND MS.Language_code = '$Language_code$'" & vbCr & "INNER JOIN Unit_Of_Measure UM_P ON P.UM_code = UM_P.UM_code AND UM_P.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_Customer C ON PCL.Cust_ID = C.Cust_ID AND C.Drop_flag <> 'X'" & vbCr & "INNER JOIN SOM_CustomerType SCT_C ON C.SCT_code = SCT_C.SCT_code and SCT_C.Language_code = '$Language_code$'" & vbCr & "INNER JOIN Countries CT_C ON C.CT_code = CT_C.CT_code AND CT_C.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_Sales_Reps SSR_C ON C.SSR_code = SSR_C.U_code " & vbCr & _
                "INNER JOIN Gen_Systems_Users SU_C ON SSR_C.U_code = SU_C.U_code" & vbCr & "INNER JOIN Gen_People GP_C ON SU_C.P_code = GP_C.P_code"
    
    Const CORE_REQUEST_C As String = "SELECT DISTINCT $fields$" & vbCr & "FROM SOM_Customer C" & vbCr & "INNER JOIN SOM_CustomerType SCT_C ON C.SCT_code = SCT_C.SCT_code and SCT_C.Language_code = '$Language_code$'" & vbCr & "INNER JOIN Countries CT_C ON C.CT_code = CT_C.CT_code AND CT_C.Language_code = '$Language_code$'" & vbCr & "INNER JOIN SOM_Sales_Reps SSR_C ON C.SSR_code = SSR_C.U_code " & vbCr & "INNER JOIN Gen_Systems_Users SU_C ON SSR_C.U_code = SU_C.U_code" & vbCr & "INNER JOIN Gen_People GP_C ON SU_C.P_code = GP_C.P_code" & vbCr & "LEFT OUTER JOIN SOM_ProjCustLink PCL ON C.Cust_ID = PCL.Cust_ID AND PCL.Drop_flag <> 'X'" & vbCr & "LEFT OUTER JOIN SOM_CustomerType SCT_PCL ON PCL.Cust_Proj_role = SCT_PCL.SCT_code and SCT_PCL.Language_code = '$Language_code$'" & vbCr & _
                "LEFT OUTER JOIN SOM_Project P ON PCL.Proj_ID = P.Proj_ID AND P.Drop_flag <> 'X'" & vbCr & "LEFT OUTER JOIN SOM_ClgFunction CF ON P.Cf_code = CF.Cf_code AND CF.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_ProjectStatus PS ON P.PS_code = PS.PS_code AND PS.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Countries CT_P ON P.CT_code = CT_P.CT_code AND CT_P.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Sales_Reps SSR_P ON P.SSR_code = SSR_P.U_code " & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_P ON SSR_P.U_code = SU_P.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_P ON SU_P.P_code = GP_P.P_code" & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_P_CREA ON P.Z_creator = SU_P_CREA.U_code" & vbCr & _
                "LEFT OUTER JOIN Gen_People GP_P_CREA ON SU_P_CREA.P_code = GP_P_CREA.P_code" & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_P_LUPD ON P.Z_last_upd_user = SU_P_LUPD.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_P_LUPD ON SU_P_LUPD.P_code = GP_P_LUPD.P_code" & vbCr & "LEFT OUTER JOIN SOM_MarketSegmentation MS ON P.MKS_code = MS.MKS_code AND MS.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UM_P ON P.UM_code = UM_P.UM_code AND UM_P.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Quote Q ON PCL.ProjCustLink_ID = Q.ProjCustLink_ID AND Q.Drop_flag <> 'X'" & vbCr & "LEFT OUTER JOIN SOM_Project P_Q ON P_Q.Proj_ID = PCL.Proj_ID" & vbCr & "LEFT OUTER JOIN SOM_Currencies_Exchanges CURR_Q ON Q.Quote_CURR_code = CURR_Q.CURR_code and CURR_Q.Language_code = '$Language_code$'" & vbCr & _
                "LEFT OUTER JOIN SOM_Currencies_Exchanges CURR_FRGH ON Q.FRGHT_CURR_code = CURR_FRGH.CURR_code and CURR_FRGH.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN A_References_ML AR_INCL ON Q.Quote_IncludeGroup = AR_INCL.GR_Code and Q.Quote_Include = AR_INCL.RF_code and AR_INCL.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN A_References_ML AR_TYPE ON Q.Quote_TypeGroup = AR_TYPE.GR_Code and Q.Quote_Type = AR_TYPE.RF_code and AR_TYPE.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN A_References_ML AR_STAT ON Q.StatusGroup = AR_STAT.GR_Code and Q.Status = AR_STAT.RF_code and AR_STAT.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_System SS_STD ON Q.STD_SS_code = SS_STD.SS_code and SS_STD.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_System SS_SEM ON Q.SEM_SS_code = SS_SEM.SS_code and SS_SEM.Language_code = '$Language_code$'" & vbCr & _
                "LEFT OUTER JOIN SOM_System SS_CUS ON Q.CUS_SS_code = SS_CUS.SS_code and SS_CUS.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_STD ON Q.STD_UM_code = UMQ_STD.UM_code AND UMQ_STD.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_SEM ON Q.SEM_UM_code = UMQ_SEM.UM_code AND UMQ_SEM.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN Unit_Of_Measure UMQ_CUS ON Q.CUS_UM_code = UMQ_CUS.UM_code AND UMQ_CUS.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Realisation RL ON Q.RL_code = RL.RL_code AND RL.Language_code = '$Language_code$'" & vbCr & "LEFT OUTER JOIN SOM_Sales_Reps SSR_Q ON Q.SSR_code = SSR_Q.U_code " & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_Q ON SSR_Q.U_code = SU_Q.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_Q ON SU_Q.P_code = GP_Q.P_code" & vbCr & _
                "LEFT OUTER JOIN SOM_Sales_Reps SSR_BO ON Q.BO_SSR_code = SSR_BO.U_code " & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_BO ON SSR_BO.U_code = SU_BO.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_BO ON SU_BO.P_code = GP_BO.P_code" & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_Q_CREA ON Q.Z_creator = SU_Q_CREA.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_Q_CREA ON SU_Q_CREA.P_code = GP_Q_CREA.P_code" & vbCr & "LEFT OUTER JOIN Gen_Systems_Users SU_Q_LUPD ON Q.Z_last_upd_user = SU_Q_LUPD.U_code" & vbCr & "LEFT OUTER JOIN Gen_People GP_Q_LUPD ON SU_Q_LUPD.P_code = GP_Q_LUPD.P_code"


    Const FIELDSLIST_PALCEHOLDER As String = "$fields$"
    
    Dim ll_SelType As Long
    Dim ls_Req As String

    
    If grd_main(al_CtrlIndex).Rows = 0 Then
        Call MsgBox(MsgText(C_ERRORRAISE + 50, ms_Language_Code, "#There is no data to export. Please refresh you grid and try again"), vbInformation + vbOKOnly, "")
        Exit Sub
    End If
    
    Call Load_Control(SOM_ExcelExp(tbs_Navigator.SelectedItem.Tag))
    
            
    Select Case al_CtrlIndex
        Case 0 'Project
            ll_SelType = 4
            ls_Req = CORE_REQUEST_P
        Case 1 'Customer
            ll_SelType = 6
            ls_Req = CORE_REQUEST_C
        Case 2 'Quote
            ll_SelType = 5
            ls_Req = CORE_REQUEST_Q
    End Select
    
    ls_Req = Replace(ls_Req, "$Language_code$", ms_Language_Code)
    
    
    If grd_main(al_CtrlIndex).SelectedCount > 0 Then
        lb_LineSelected = True
    Else
        lb_LineSelected = False
    End If
    
    Call SOM_ExcelExp(al_CtrlIndex).Configure(ll_SelType, ls_Req, FIELDSLIST_PALCEHOLDER, lb_LineSelected)
    
    
    SOM_ExcelExp(tbs_Navigator.SelectedItem.Tag).ZOrder
    SOM_ExcelExp(tbs_Navigator.SelectedItem.Tag).A_Visible = True
    
    Exit Sub

ErrHandler:
    Call ErrorHandler("Init_Excel")

End Sub



Private Sub tbl_main_action(ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler
    Static DoCheck As Boolean
    
    If DoCheck = True Then Exit Sub
    DoCheck = True
    
    Call LockScreen(True)

    tbl_main.Enabled = False

    tbs_Navigator.Enabled = False

    Select Case as_Role
        Case "A" 'Add project
            Call Load_Control(SOM_Project)
            Call SOM_Project.Run(eMode.emAdd, 0)
            SOM_Project.ZOrder
            SOM_Project.A_Visible = True
        
        Case "B" 'Update project
            If grd_main(tbs_Navigator.SelectedItem.Tag).SelectedCount > 0 Then
                Call Load_Control(SOM_Project)
                Call SOM_Project.Run(eMode.emUpdate, grd_main(tbs_Navigator.SelectedItem.Tag).SelectedLine(0, "Proj_ID"))
                SOM_Project.ZOrder
                SOM_Project.A_Visible = True
            End If
            
        Case "C" 'Delete project
            If grd_main(tbs_Navigator.SelectedItem.Tag).SelectedCount > 0 Then
                Call Load_Control(SOM_Project)
                Call SOM_Project.Run(eMode.emDelete, grd_main(tbs_Navigator.SelectedItem.Tag).SelectedLine(0, "Proj_ID"))
                SOM_Project.ZOrder
                SOM_Project.A_Visible = True
            End If
                
        Case "H" 'Add customer
            Call Load_Control(SOM_Customer)
            Call SOM_Customer.Run(eMode.emAdd, 0)
            SOM_Customer.ZOrder
            SOM_Customer.A_Visible = True
            
         Case "E" 'update customer
            If grd_main(tbs_Navigator.SelectedItem.Tag).SelectedCount > 0 Then
                Call Load_Control(SOM_Customer)
                Call SOM_Customer.Run(eMode.emUpdate, grd_main(tbs_Navigator.SelectedItem.Tag).SelectedLine(0, "Cust_ID"))
                SOM_Customer.ZOrder
                SOM_Customer.A_Visible = True
            End If
            
         Case "c" 'Delete Customer
            If grd_main(tbs_Navigator.SelectedItem.Tag).SelectedCount > 0 Then
                Call Load_Control(SOM_Customer)
                Call SOM_Customer.Run(eMode.emDelete, grd_main(tbs_Navigator.SelectedItem.Tag).SelectedLine(0, "Cust_ID"))
                SOM_Customer.ZOrder
                SOM_Customer.A_Visible = True
            End If
         
         Case "F" 'reload grid
            grd_main(tbs_Navigator.SelectedItem.Tag).Refresh
         
         Case "G" 'export excel Quote
            Call Init_Excel(tbs_Navigator.SelectedItem.Tag)
         
           
        Case "T"
            RaiseEvent OnExit
    End Select
    
    tbs_Navigator.Enabled = True
    tbl_main.Enabled = True
    Call LockScreen(False)
    
    DoCheck = False

    Exit Sub
    
ErrHandler:
    
    DoCheck = False
    
    tbs_Navigator.Enabled = True
    
    tbl_main.Enabled = True
    Call LockScreen(False)
    Call ErrorHandler("tbl_main_action")
End Sub

Private Sub tbs_FiltersGroupStatus_Click()
On Error GoTo ErrHandler
        
        
    If opt_fieldP(3).value = True Then
        cbo_select(0).Clear
        cbo_select(0).Request = "exec SOM_ProjectStatusFilterProject_cbo '" & ms_Language_Code & "'," & tbs_FiltersGroupStatus.SelectedItem.Tag
    End If
        
        
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("tbs_FiltersGroupStatus_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select
    

End Sub

Private Sub tbs_Navigator_Click()
On Error GoTo ErrHandler
        
    Dim ll_FraIndex As Long
    
    Dim lo_Control As Object
    
    ll_FraIndex = tbs_Navigator.SelectedItem.Tag

    Call LockScreen(True)
        
        
        
    Set lo_Control = Nothing
    
    Select Case ll_FraIndex
        Case 0
            If SOM_Project.IsVisible Then
                Set lo_Control = SOM_Project
            End If
        
        'Call grd_main(tbs_Navigator.SelectedItem.Tag).Load(mt_ClassInfoLst(0).RequestGrid, False, , , True)
        
        Case 1
            If SOM_Customer.IsVisible Then
                Set lo_Control = SOM_Customer
            End If
        
        'Call grd_main(tbs_Navigator.SelectedItem.Tag).Load(mt_ClassInfoLst(1).RequestGrid, False, , , True)
                           
        Case 2
            If SOM_Quote.IsVisible Then
                Set lo_Control = SOM_Quote
            End If
        'Call grd_main(tbs_Navigator.SelectedItem.Tag).Load(mt_ClassInfoLst(2).RequestGrid, False, , , True)
            
    End Select
    
    If SOM_ExcelExp(ll_FraIndex).IsVisible Then
        Set lo_Control = SOM_ExcelExp(ll_FraIndex)
    End If
    
    If SOM_Selection(ll_FraIndex).IsVisible Then
        Set lo_Control = SOM_Selection(ll_FraIndex)
    End If
   
    Call HandleToolbar(tbl_main, ll_FraIndex, mb_IsFullAccess)
    
    If lo_Control Is Nothing Then
        fra_main(ll_FraIndex).ZOrder
        fra_main(ll_FraIndex).Visible = True
        
        tbl_main.ZOrder
        tbl_main.Visible = True
    Else
        lo_Control.ZOrder
        lo_Control.A_Visible = True
    End If
    

    Call LockScreen(False)
    
    Exit Sub
    
ErrHandler:
    Call LockScreen(False)
    
    Select Case Err.Number
    Case Else
        Call LogMessage("tbs_Navigator_Click: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub

Private Sub txt_LikeStr_Change(Index As Integer)
On Error GoTo ErrHandler
        
    If Not mb_Internal Then Call OnFilterChange(True)
    
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("txt_LikeStr_Change: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub



Private Sub txt_value_Change(Index As Integer)
On Error GoTo ErrHandler
    
    
    Dim ls_Caption As String
    Dim ll_Decimal As Long
    Dim lv_Min As Variant
    Dim lv_Max As Variant
    
    
    
    Dim lo_Control As Variant
    Dim ll_Nb As Long
    Dim ll_Count As Long
    Dim lv_Values As Variant
    
    If Not mb_Internal Then Call OnFilterChange(True)
    
    If txt_value(Index).Text = "" Then
        txt_value(Index).Text = "0"
    End If
    
    If txt_value(Index).Text = "0" Then Exit Sub
    
    Call CheckNumericFieldFilter(txt_value(Index))
            
    Exit Sub
    
ErrHandler:
    
    Select Case Err.Number
    Case Else
        Call LogMessage("txt_value_Change: " & Err.Number & ": " & Err.Source & ": " & Err.Description, "E")
        Call MsgBox("Error during the process, Contact immediatly your IT support.", vbCritical)
        End
    End Select

End Sub


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

