VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "mscomctl.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFlxGrd.ocx"
Begin VB.Form BaseItemMarketing_detail 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   7725
   ClientLeft      =   1290
   ClientTop       =   405
   ClientWidth     =   8625
   ControlBox      =   0   'False
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   7725
   ScaleWidth      =   8625
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.ImageList img_pictList 
      Left            =   8040
      Top             =   1200
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      MaskColor       =   12632256
      _Version        =   393216
   End
   Begin MSComctlLib.TabStrip tbs_Test 
      Height          =   375
      Left            =   120
      TabIndex        =   12
      Top             =   480
      Width           =   7695
      _ExtentX        =   13573
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   3
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "General"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Acoustic"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Fire"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.PictureBox pic_pics 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ClipControls    =   0   'False
      ForeColor       =   &H80000008&
      Height          =   4452
      Left            =   7920
      ScaleHeight     =   4425
      ScaleWidth      =   630
      TabIndex        =   4
      Top             =   3240
      Width           =   665
      Begin VB.PictureBox pic_Print 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   11
         TabStop         =   0   'False
         Top             =   1800
         Width           =   480
      End
      Begin VB.PictureBox pic_add 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   10
         Top             =   60
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.PictureBox pic_delete 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DrawStyle       =   5  'Transparent
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   9
         Top             =   1200
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.PictureBox pic_refresh 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   8
         TabStop         =   0   'False
         Top             =   2400
         Width           =   480
      End
      Begin VB.PictureBox pic_upd 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "BI_MARKT.frx":0000
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   7
         Top             =   660
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.PictureBox pic_help 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "BI_MARKT.frx":030A
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   6
         TabStop         =   0   'False
         Top             =   3600
         Width           =   480
      End
      Begin VB.PictureBox pic_quit 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "BI_MARKT.frx":0614
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   5
         TabStop         =   0   'False
         Top             =   3000
         Width           =   480
      End
   End
   Begin VB.TextBox txt_SAP 
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H00000000&
      Height          =   288
      Left            =   1260
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   120
      Width           =   1512
   End
   Begin VB.TextBox txt_Desc 
      BackColor       =   &H00FFFFFF&
      ForeColor       =   &H00000000&
      Height          =   288
      Left            =   4140
      Locked          =   -1  'True
      TabIndex        =   1
      Top             =   120
      Width           =   4395
   End
   Begin VB.Frame frm_tabTest 
      Height          =   6735
      Index           =   0
      Left            =   120
      TabIndex        =   13
      Top             =   900
      Width           =   7695
      Begin MSFlexGridLib.MSFlexGrid grd_Value0 
         Height          =   6375
         Left            =   120
         TabIndex        =   18
         Top             =   240
         Width           =   7455
         _ExtentX        =   13150
         _ExtentY        =   11245
         _Version        =   393216
         Cols            =   10
         FixedRows       =   0
         FixedCols       =   0
         SelectionMode   =   1
      End
   End
   Begin VB.Frame frm_tabTest 
      Height          =   6735
      Index           =   2
      Left            =   120
      TabIndex        =   15
      Top             =   960
      Width           =   7695
      Begin MSComctlLib.TreeView tvw_fire 
         Height          =   6375
         Left            =   120
         TabIndex        =   17
         Top             =   240
         Width           =   7455
         _ExtentX        =   13150
         _ExtentY        =   11245
         _Version        =   393217
         Style           =   7
         Appearance      =   1
      End
   End
   Begin VB.Frame frm_tabTest 
      Height          =   6735
      Index           =   1
      Left            =   120
      TabIndex        =   14
      Top             =   900
      Width           =   7695
      Begin MSComctlLib.TreeView tvw_acoustic 
         Height          =   6375
         Left            =   120
         TabIndex        =   16
         Top             =   240
         Width           =   7455
         _ExtentX        =   13150
         _ExtentY        =   11245
         _Version        =   393217
         Style           =   7
         Appearance      =   1
      End
   End
   Begin VB.Label lbl_SAP 
      Caption         =   "SAP code"
      Height          =   285
      Left            =   120
      TabIndex        =   3
      Top             =   180
      Width           =   1155
   End
   Begin VB.Label lbl_Desc 
      Caption         =   "Description"
      Height          =   285
      Left            =   2880
      TabIndex        =   2
      Top             =   180
      Width           =   1215
   End
End
Attribute VB_Name = "BaseItemMarketing_detail"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim mb_AllowAdd As Boolean
Dim mb_AllowUpd As Boolean
Dim mb_AllowDel As Boolean
Dim ms_Acoustic() As String
Dim ms_AcousticDesc9 As String
Dim ms_AcousticDesc10 As String
Dim ms_AcousticDesc11 As String
Dim ms_AcousticDesc14 As String
Dim ms_AcousticDesc15 As String
Dim mb_FirstAcoustic As Boolean
Dim ms_Fire() As String
Dim ms_FireDesc3 As String
Dim ms_FireDesc4 As String
Dim mb_FirstFire As Boolean
'task789
Dim ms_AcousticDesc16 As String
Dim ms_AcousticDesc17 As String
Dim ms_AcousticDesc18 As String
Dim ms_AcousticDesc19 As String
Dim ms_AcousticDesc20 As String             ' 5/2/2015 JUNA

Private Sub Permission()
Dim ls_Perm As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_req As String

    On Error GoTo Permission_Err
    
    mb_AllowAdd = KO
    mb_AllowUpd = KO
    mb_AllowDel = KO
    
    ls_req = "EXEC Check_Security 'BI_Marketing', '" & prg.LoginName & "'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
    Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            ls_Perm = ODBCData(ll_Statement, 1)
            If ls_Perm = "Insert" Then
                mb_AllowAdd = OK
            End If
            If ls_Perm = "Update" Then
                mb_AllowUpd = OK
            End If
            If ls_Perm = "Delete" Then
                mb_AllowDel = OK
            End If
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
Permission_Err:
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Sub

Private Sub FillGridValue()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim li_Count As Integer
Dim ls_Row(11) As String
Dim i As Integer
Dim indx As Integer
Dim test_code As Integer
Dim no_test As Integer
    On Error GoTo FillGridValue_Err
    
    grd_Value0.Cols = 13
    
    grd_Value0.Row = 0
    grd_Value0.ColWidth(0) = 4750 '5000
    grd_Value0.ColWidth(1) = 1
    grd_Value0.ColWidth(2) = 1
    grd_Value0.ColWidth(3) = 1
    grd_Value0.ColWidth(4) = 1
    grd_Value0.ColWidth(5) = 1
    grd_Value0.ColWidth(6) = 2400 '2500
    grd_Value0.ColWidth(7) = 1
    grd_Value0.ColWidth(8) = 1
    grd_Value0.ColWidth(9) = 1
    grd_Value0.ColWidth(10) = 1
    grd_Value0.ColWidth(11) = 1
    grd_Value0.ColWidth(12) = 200
    grd_Value0.ColAlignment(0) = flexAlignLeftCenter
    grd_Value0.ColAlignment(6) = flexAlignLeftCenter
    
    For li_Count = 1 To 12
        ls_Row(li_Count - 1) = ""
    Next li_Count
    ReDim ms_Acoustic(11, 0) As String
    mb_FirstAcoustic = OK
    ReDim ms_Fire(11, 0) As String
    mb_FirstFire = OK
    ls_req = "EXEC BI_Public_Value_t_lst '" _
        & txt_SAP & "', '" _
        & gut_LangWork.Code & "'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Count = 0
        li_Status = SQL_SUCCESS
        Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
            li_Status = SQLFetch(ll_Statement)
            If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
                For i = 0 To 10
    '           Market code, Market desc, Categorycode, Type code, Value code
    '            Value desc, concurrency, internet, drop date
                    ls_Row(i) = ODBCData(ll_Statement, i + 1)
                Next i
'789 bis                If (ls_Row(2) = "5" Or ls_Row(2) = "16" Or ls_Row(2) = "17" ) And ls_Row(4) <> "" Then
                If (ls_Row(2) = "5" Or ls_Row(2) = "16" Or ls_Row(2) = "17" Or ls_Row(2) = "26" Or ls_Row(2) = "25") And ls_Row(4) <> "" Then
                    If mb_FirstAcoustic Then
                        mb_FirstAcoustic = KO
                    Else
                        ReDim Preserve ms_Acoustic(11, UBound(ms_Acoustic, 2) + 1)
                    End If
                End If
                If (ls_Row(2) = "4" Or ls_Row(2) = "15") And ls_Row(4) <> "" Then
                    If mb_FirstFire Then
                        mb_FirstFire = KO
                    Else
                        ReDim Preserve ms_Fire(11, UBound(ms_Fire, 2) + 1)
                    End If
                End If
                For i = 0 To 10
                    Select Case ls_Row(2)
                    Case "4", "15"
                        If ls_Row(4) <> "" Then
                            ms_Fire(i + 1, UBound(ms_Fire, 2)) = ls_Row(i)
                        End If
'789 bis                    Case "5", "16", "17"
                    Case "5", "16", "17", "26", "25"
                        If ls_Row(4) <> "" Then
                            ms_Acoustic(i + 1, UBound(ms_Acoustic, 2)) = ls_Row(i)
                        End If
                    Case Else
                        grd_Value0.Col = i + 1
                        grd_Value0.Text = ls_Row(i)
                    End Select
                Next i
                Select Case ls_Row(2)
                Case "4", "15"
                    If ls_Row(4) <> "" Then
                        If ls_Row(3) = "3" Then
                            ms_Fire(0, UBound(ms_Fire, 2)) = ms_FireDesc3
                        Else
                            ms_Fire(0, UBound(ms_Fire, 2)) = ms_FireDesc4
                        End If
                    End If
'789 bis                Case "5", "16", "17"
                Case "5", "16", "17", "26", "25"
                    If ls_Row(4) <> "" Then
                        Select Case ls_Row(3)
                        Case "9"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc9
                        Case "10"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc10
                        Case "11"
'789 bis                    ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc11
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc18
                        Case "14"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc14
                        Case "15"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc15
'task789
                        Case "27"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc16
                        Case "28"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc17
'789 bis                Case "29"
'789 bis                    ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc18
                        Case "30"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc19
                        Case "37"
                            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = ms_AcousticDesc20
                        End Select
                    End If
                Case Else
                    grd_Value0.Col = 1
                    If grd_Value0.Text = "0" Then
                        grd_Value0.Col = 2
                        grd_Value0.Text = ""
                    End If
                    grd_Value0.Col = 5
                    If grd_Value0.Text = "" Then
                        grd_Value0.Col = 6
                        grd_Value0.Text = ""
                    End If
                    If grd_Value0.Row < grd_Value0.Rows - 1 Then
                        grd_Value0.Row = grd_Value0.Row + 1
                    End If
                End Select
            End If
        Loop
    End If
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    grd_Value0.HighLight = flexHighlightAlways
    FillAcoustic
    FillFire
    
    For indx = 0 To grd_Value0.Rows - 1
        grd_Value0.Row = indx
        grd_Value0.Col = 3
'task789 if  + endif added
        If grd_Value0.Text <> "" Then
            test_code = grd_Value0.Text
            grd_Value0.Col = 12
            grd_Value0.Text = Test_available(test_code)
        End If
    Next indx
    
    Dim mapped_code As Integer
    For indx = 1 To tvw_fire.Nodes.Count
        no_test = 0
        'Debug.Print tvw_fire.Nodes.Item(indx).Text
        If tvw_fire.Nodes.Item(indx).Parent Is Nothing Then
        If Mid(tvw_fire.Nodes.Item(indx).Key, 4, 2) = 3 Then mapped_code = 4
        If Mid(tvw_fire.Nodes.Item(indx).Key, 4, 2) = 4 Then mapped_code = 15
        no_test = Test_available(mapped_code)
        If no_test > 0 Then tvw_fire.Nodes.Item(indx).Text = tvw_fire.Nodes.Item(indx).Text & " {" & no_test & "}"
        End If
    Next indx
    
    For indx = 1 To tvw_acoustic.Nodes.Count
        no_test = 0
'    Debug.Print tvw_acoustic.Nodes.Item(indx).Text
        If tvw_acoustic.Nodes.Item(indx).Parent Is Nothing Then
        
            Select Case tvw_acoustic.Nodes.Item(indx).Text
            Case ms_AcousticDesc9
                mapped_code = 5 'test
            Case ms_AcousticDesc10
                mapped_code = 16 'test
            Case ms_AcousticDesc11
                mapped_code = 17 'test
            Case ms_AcousticDesc14
                mapped_code = 5 'test
            Case ms_AcousticDesc15
                mapped_code = 16 'test
    'task789
            Case ms_AcousticDesc16
                mapped_code = 16
            Case ms_AcousticDesc17
                mapped_code = 5
            Case ms_AcousticDesc18
'789 bis        mapped_code = 16
                mapped_code = 17
            Case ms_AcousticDesc19
'789 bis        mapped_code = 16
                mapped_code = 26
            Case ms_AcousticDesc20
'789 bis        mapped_code = 16
                mapped_code = 25
            End Select
            
            no_test = Test_available(mapped_code)
            If no_test > 0 Then tvw_acoustic.Nodes.Item(indx).Text = tvw_acoustic.Nodes.Item(indx).Text & " {" & no_test & "}"
        End If
    Next indx

    Exit Sub
    
    
FillGridValue_Err:
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Sub

Private Sub FillGeneralInfo()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer

    On Error GoTo FillGeneralInfo_Err
    
    txt_SAP.Text = gs_SAPCode
    ls_req = "EXEC Base_Item_Tech_t_sel '" & txt_SAP & "','" _
       & gut_LangWork.Code & "'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
        Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
            li_Status = SQLFetch(ll_Statement)
            If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
                txt_Desc.Text = ODBCData(ll_Statement, 1)
            End If
        Loop
    End If
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
FillGeneralInfo_Err:
    StdError
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End Sub

Private Sub FillFire()
Dim ls_LastType As String, ls_auxStr As String
Dim i As Integer
Dim lo_parentNode As MSComctlLib.Node

    tvw_fire.Nodes.Clear
    
    Call InsertNode(tvw_fire, "", "_0_3", ms_FireDesc3, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
    Call InsertNode(tvw_fire, "", "_0_4", ms_FireDesc4, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)

    For i = 0 To UBound(ms_Fire, 2)
        Set lo_parentNode = GetNode(tvw_fire, "_0_" & ms_Fire(4, i))
        If Not lo_parentNode Is Nothing Then
            ls_auxStr = ms_Fire(2, i) & " :  " & ms_Fire(6, i)
            Call InsertNode(tvw_fire, lo_parentNode.Key, "_1_" & ls_auxStr, ls_auxStr, _
                            RES_DOCUMENT, RES_DOCUMENT, , vbResBitmap)
            lo_parentNode.Expanded = True
        End If
    Next i
    
    
    
'    out_Fire.Clear
'    out_Fire.AddItem ms_FireDesc3
'    out_Fire.AddItem ms_FireDesc4
'    For i = 0 To UBound(ms_Fire, 2)
'        Select Case ms_Fire(4, i)
'        Case "3"
'            out_Fire.ListIndex = OutlineFindItem(out_Fire, ms_FireDesc3)
'        Case "4"
'            out_Fire.ListIndex = OutlineFindItem(out_Fire, ms_FireDesc4)
'        Case Else
'            Exit For
'        End Select
'        out_Fire.AddItem ms_Fire(2, i) & " :  " & ms_Fire(6, i)
'    Next i
'    For i = 0 To out_Fire.ListCount - 1
'        If out_Fire.Indent(i) = 1 Then
'            out_Fire.Expand(i) = OK
'        Else
'            out_Fire.PictureType(i) = 2
'        End If
'    Next i
'    out_Fire.ListIndex = -1

End Sub

Private Sub FillAcoustic()
Dim ls_LastType As String
Dim i As Integer
Dim lo_parentNode As MSComctlLib.Node
Dim ls_auxStr As String


    
    Call tvw_acoustic.Nodes.Clear
    ' new item into treeView
    Call InsertNode(tvw_acoustic, "", "_0_14", ms_AcousticDesc14, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
    Call InsertNode(tvw_acoustic, "", "_0_9", ms_AcousticDesc9, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
    Call InsertNode(tvw_acoustic, "", "_0_10", ms_AcousticDesc10, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
'tas789
    Call InsertNode(tvw_acoustic, "", "_0_27", ms_AcousticDesc16, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
    Call InsertNode(tvw_acoustic, "", "_0_28", ms_AcousticDesc17, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
'789 bis    Call InsertNode(tvw_acoustic, "", "_0_29", ms_AcousticDesc18, _
'789 bis                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
    Call InsertNode(tvw_acoustic, "", "_0_11", ms_AcousticDesc18, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
    Call InsertNode(tvw_acoustic, "", "_0_30", ms_AcousticDesc19, _
                    RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
    
    Call InsertNode(tvw_acoustic, "", "_0_37", ms_AcousticDesc20, RES_CLOSEFOLDER, RES_OPENFOLDER, , vbResBitmap)
'    out_Acoustic.Clear
'    out_Acoustic.AddItem ms_AcousticDesc14
'    out_Acoustic.AddItem ms_AcousticDesc9
'    out_Acoustic.AddItem ms_AcousticDesc10
'    'out_Acoustic.AddItem ms_AcousticDesc11
'    'out_Acoustic.AddItem ms_AcousticDesc15
    For i = 0 To UBound(ms_Acoustic, 2)
        Set lo_parentNode = GetNode(tvw_acoustic, "_0_" & ms_Acoustic(4, i))
        If Not lo_parentNode Is Nothing Then
            ls_auxStr = ms_Acoustic(2, i) & " :  " & ms_Acoustic(6, i)
            Call InsertNode(tvw_acoustic, lo_parentNode.Key, "_1_" & ms_Acoustic(4, i) & "_" & ls_auxStr, ls_auxStr, RES_DOCUMENT, RES_DOCUMENT, , vbResBitmap)
            'Call InsertNode(tvw_acoustic, lo_ParentNode.Key, "_1_" & ls_auxStr, ls_auxStr, _
            '                RES_DOCUMENT, RES_DOCUMENT, , vbResBitmap)
            lo_parentNode.Expanded = True
        End If
        
        
'        Select Case ms_Acoustic(4, i)
'        Case "9"
'            out_Acoustic.ListIndex = OutlineFindItem(out_Acoustic, ms_AcousticDesc9)
'        Case "10"
'            out_Acoustic.ListIndex = OutlineFindItem(out_Acoustic, ms_AcousticDesc10)
'        Case "11"
'    '        out_Acoustic.ListIndex = OutlineFindItem(out_Acoustic, ms_AcousticDesc11)
'        Case "14"
'            out_Acoustic.ListIndex = OutlineFindItem(out_Acoustic, ms_AcousticDesc14)
'        Case "15"
'    '        out_Acoustic.ListIndex = OutlineFindItem(out_Acoustic, ms_AcousticDesc15)
'        Case Else
'            Exit For
'        End Select
 '       out_Acoustic.AddItem ms_Acoustic(2, i) & " :  " & ms_Acoustic(6, i)
    Next i
'    For i = 0 To out_Acoustic.ListCount - 1
'        If out_Acoustic.Indent(i) = 1 Then
'            out_Acoustic.Expand(i) = OK
'        Else
'            out_Acoustic.PictureType(i) = 2
'        End If
'    Next i
'    out_Acoustic.ListIndex = -1
    
End Sub

Private Function FindLineFire(ls_Category As String, ls_Type As String, ls_Market As String, ls_Value As String) As Integer
Dim i As Integer
    
    i = 0
    While ms_Fire(3, i) <> ls_Category Or ms_Fire(0, i) <> ls_Type Or ms_Fire(2, i) <> ls_Market Or ms_Fire(6, i) <> ls_Value
        i = i + 1
    Wend
    FindLineFire = i

End Function

Private Function FindLineAcoustic(ls_Type As String, ls_Market As String, ls_Value As String) As Integer
Dim i As Integer

    i = 0
'789 bis    While (ms_Acoustic(3, i) <> "5" And ms_Acoustic(3, i) <> "16" And ms_Acoustic(3, i) <> "17") Or ms_Acoustic(0, i) <> ls_Type Or ms_Acoustic(2, i) <> ls_Market Or ms_Acoustic(6, i) <> ls_Value
    While (ms_Acoustic(3, i) <> "5" And ms_Acoustic(3, i) <> "16" And ms_Acoustic(3, i) <> "17" And ms_Acoustic(3, i) <> "26" And ms_Acoustic(3, i) <> "25") Or ms_Acoustic(0, i) <> ls_Type Or ms_Acoustic(2, i) <> ls_Market Or ms_Acoustic(6, i) <> ls_Value
        i = i + 1
    Wend
    FindLineAcoustic = i

End Function

Private Sub GetConstants()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Field As String
Dim ls_Text As String

    On Error GoTo GetConstants_Err
    
    ls_req = "EXEC Screen_Csts 'BI_Marketing', '" & gut_LangLogin.Code & "'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
' JUNA task213 update
'task 789
    grd_Value0.Rows = 26    '19    '13 '9          JUNA 23/06/2016
    grd_Value0.Col = 0
    Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            ls_Field = ODBCData(ll_Statement, 1)
            ls_Text = ODBCData(ll_Statement, 2)
            Select Case ls_Field
            Case "lbl_sap": lbl_SAP = ls_Text
            Case "lbl_desc": lbl_Desc = ls_Text
'            Case "tab_general": tab_Test.TabCaption(0) = ls_Text
'            Case "tab_acoustic": tab_Test.TabCaption(1) = ls_Text
    ' NEW 22.1.2005 remove SSTab begin
            Case "tab_general": tbs_Test.Tabs("_0").Caption = ls_Text
            Case "tab_acoustic": tbs_Test.Tabs("_1").Caption = ls_Text
            Case "tab_fire": tbs_Test.Tabs("_2").Caption = ls_Text
    ' NEW 22.1.2005 remove SSTab end
            Case "1": grd_Value0.Row = 0
                        grd_Value0.Text = ls_Text
            Case "2": grd_Value0.Row = 1
                        grd_Value0.Text = ls_Text
            Case "3": ms_FireDesc3 = ls_Text
            Case "4": ms_FireDesc4 = ls_Text
            Case "5": grd_Value0.Row = 2
                        grd_Value0.Text = ls_Text
            Case "6": grd_Value0.Row = 3
                        grd_Value0.Text = ls_Text
            Case "7": grd_Value0.Row = 4
                        grd_Value0.Text = ls_Text
            Case "8": grd_Value0.Row = 5
                        grd_Value0.Text = ls_Text
            Case "9": ms_AcousticDesc9 = ls_Text
            Case "10": ms_AcousticDesc10 = ls_Text
            Case "11": ms_AcousticDesc11 = ls_Text
            Case "12": grd_Value0.Row = 6
                        grd_Value0.Text = ls_Text
            Case "13": grd_Value0.Row = 7
                        grd_Value0.Text = ls_Text
            Case "14": ms_AcousticDesc14 = ls_Text
            Case "15": ms_AcousticDesc15 = ls_Text
            Case "16": grd_Value0.Row = 8
                        grd_Value0.Text = ls_Text
' JUNA task213 insert Begin
            Case "17": grd_Value0.Row = 9
                        grd_Value0.Text = ls_Text
            Case "18": grd_Value0.Row = 10
                        grd_Value0.Text = ls_Text
            Case "19": grd_Value0.Row = 11
                        grd_Value0.Text = ls_Text
            Case "20": grd_Value0.Row = 12
                        grd_Value0.Text = ls_Text
' JUNA task213 insert End
' task789 Begin
            Case "21": ms_AcousticDesc16 = ls_Text
            Case "22": ms_AcousticDesc17 = ls_Text '           Case "22": grd_Value0.Row = 14
            Case "23": ms_AcousticDesc18 = ls_Text '           Case "23": grd_Value0.Row = 15
            Case "24": ms_AcousticDesc19 = ls_Text
' task789 End
            Case "25": grd_Value0.Row = 13              ' In Armstrong Recycling Program
                        grd_Value0.Text = ls_Text
            Case "26": grd_Value0.Row = 18              ' Recyclable
                        grd_Value0.Text = ls_Text
            Case "27": grd_Value0.Row = 17              ' Environmental Product Declaration
                        grd_Value0.Text = ls_Text
            Case "28": grd_Value0.Row = 16              ' C2C Certified
                        grd_Value0.Text = ls_Text
            Case "29": grd_Value0.Row = 14              ' VOC (CE)
                        grd_Value0.Text = ls_Text
            Case "30": grd_Value0.Row = 15              ' VOC (FR)
                        grd_Value0.Text = ls_Text
            Case "31": ms_AcousticDesc20 = ls_Text
            Case "33": grd_Value0.Row = 19              ' Dry cleaning
                        grd_Value0.Text = ls_Text
            Case "34": grd_Value0.Row = 20              ' Moist cleaning
                        grd_Value0.Text = ls_Text
            Case "35": grd_Value0.Row = 21              ' Damp sponge cleaning
                        grd_Value0.Text = ls_Text
            Case "36": grd_Value0.Row = 22              ' Scrubbable
                        grd_Value0.Text = ls_Text
            Case "37": grd_Value0.Row = 23              ' High pressure cleaning
                        grd_Value0.Text = ls_Text
            Case "38": grd_Value0.Row = 24              ' Disinfectant resistant
                        grd_Value0.Text = ls_Text
            Case "39": grd_Value0.Row = 25              ' Seismic component
                        grd_Value0.Text = ls_Text
            End Select
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
GetConstants_Err:
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Sub

Private Sub Form_Load()
    MouseOff
    
    If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

    pic_add.Picture = LoadResPicture(RES_ADD, 1)
    pic_upd.Picture = LoadResPicture(RES_MODIFY, 1)
    pic_delete.Picture = LoadResPicture(RES_DELETE, 1)
    pic_Print.Picture = LoadResPicture(RES_PRINT, 1)
    pic_refresh.Picture = LoadResPicture(RES_REFRESH, 1)
    pic_help.Picture = LoadResPicture(RES_HELP, 1)
    pic_quit.Picture = LoadResPicture(RES_QUIT, 1)
    Top = 1580 + frmMain.Top
    Left = 3280 + frmMain.Left
    Width = 8650
    Height = 7750
    
    ' NEW 22.1.2005 remove SSTab begin
    Call InitTabStrip(tbs_Test, frm_tabTest)
    ' NEW 22.1.2005 remove SSTab end
    
    ' NEW remove TreeView begin
    Call InitImageList(img_pictList)
    Call InitTreeView(tvw_acoustic, img_pictList)
    Call InitTreeView(tvw_fire, img_pictList)
    ' NEW remove TreeView end

    GetConstants
    FillGeneralInfo
    FillGridValue
    Permission
'    tab_Test.Tab = gi_ChoosenTab
    
    ' NEW 22.1.2005 remove SSTab begin
    tbs_Test.Tabs("_" & gi_ChoosenTab).Selected = True
    Call SetTabStripVisible(tbs_Test, frm_tabTest, True)
    ' NEW 22.1.2005 remove SSTab end
    MouseOn
End Sub

Private Sub grd_Value0_DblClick()
    MouseOff
    GetValueGrid0
    Dim test_form As New Test_Visu
    test_form.TestTypeLabel = gut_Param.Str11
    Call LoadForm(test_form)
    MouseOn
End Sub

Private Sub grd_Value0_SelChange()
    MouseOff
    grd_Value0.HighLight = flexHighlightAlways
    If grd_Value0.TextMatrix(grd_Value0.Row, 6) = "" And mb_AllowAdd Then
        pic_add.Visible = OK
        pic_upd.Visible = KO
        pic_delete.Visible = KO
    Else
        pic_add.Visible = KO
        If mb_AllowUpd Then
            pic_upd.Visible = OK
        End If
        If mb_AllowDel Then
            pic_delete.Visible = OK
        End If
    End If
    MouseOn
End Sub

Private Sub pic_add_Click()
Dim li_line As Integer
Dim ls_Market As String, ls_Type As String
Dim ls_procName As String
Dim i As Integer

    MouseOff
    gut_Param.Str10 = "Add"
    gut_Param.Str22 = "EXEC Screen_Csts 'mtnc_BIMarket','" & gut_LangLogin.Code & "'"
'    Select Case tab_Test.Tab
    Select Case tbs_Test.SelectedItem.Key         ' NEW 22.1.2005 remove SSTab
    Case "_0"
        GetValueGrid0
    '   Query for action
        gut_Param.Str21 = "EXEC " & GetProcName & "ins"
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            grd_Value0.Col = 1
    '       Market code
            grd_Value0.Text = gut_Param.Str12
            grd_Value0.Col = 2
    '       Market_desc (optionnal)
            grd_Value0.Text = gut_Param.Str13
            grd_Value0.Col = 5
    '       Value code
            grd_Value0.Text = gut_Param.Str16
            grd_Value0.Col = 6
    '       Value description
            grd_Value0.Text = gut_Param.Str17
            grd_Value0.Col = 7
    '       iConcurrency
            grd_Value0.Text = gut_Param.Str18
            grd_Value0.Col = 8
    '       Internet
            grd_Value0.Text = gut_Param.Str19
            grd_Value0.Col = 9
    '       Drop date
            grd_Value0.Text = gut_Param.Str20
        End If
        grd_Value0_SelChange
'        grd_Value0_Click
    Case "_1"
        GetValueAcoustic
        ls_Market = gut_Param.Str13
    '   Query for action
        gut_Param.Str21 = "EXEC " & GetProcName & "ins"
        
        'debug.assert (Not tvw_acoustic.SelectedItem Is Nothing)
        ls_Type = tvw_acoustic.SelectedItem.Text
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            If mb_FirstAcoustic Then
                mb_FirstAcoustic = KO
            Else
                ReDim Preserve ms_Acoustic(11, UBound(ms_Acoustic, 2) + 1)
            End If
            ms_Acoustic(0, UBound(ms_Acoustic, 2)) = gut_Param.Str11
            ms_Acoustic(1, UBound(ms_Acoustic, 2)) = gut_Param.Str12
            ms_Acoustic(2, UBound(ms_Acoustic, 2)) = gut_Param.Str13
            ms_Acoustic(3, UBound(ms_Acoustic, 2)) = gut_Param.Str14
            ms_Acoustic(4, UBound(ms_Acoustic, 2)) = gut_Param.Str15
            ms_Acoustic(5, UBound(ms_Acoustic, 2)) = gut_Param.Str16
            ms_Acoustic(6, UBound(ms_Acoustic, 2)) = gut_Param.Str17
            ms_Acoustic(7, UBound(ms_Acoustic, 2)) = gut_Param.Str18
            ms_Acoustic(8, UBound(ms_Acoustic, 2)) = gut_Param.Str19
            ms_Acoustic(9, UBound(ms_Acoustic, 2)) = gut_Param.Str20
            ms_Acoustic(10, UBound(ms_Acoustic, 2)) = gut_Param.Str28
            ms_Acoustic(11, UBound(ms_Acoustic, 2)) = gut_Param.Str29
            
            ' new item into treeView
            Call InsertNode(tvw_acoustic, tvw_acoustic.SelectedItem.Key, "_1_" & gut_Param.Str13 & " :  " & ms_Acoustic(6, UBound(ms_Acoustic, 2)), gut_Param.Str13 & " :  " & ms_Acoustic(6, UBound(ms_Acoustic, 2)), _
                            RES_DOCUMENT, RES_DOCUMENT, , vbResBitmap)
            tvw_acoustic.SelectedItem.Expanded = True
            
'            out_Acoustic.AddItem gut_Param.Str13 & " :  " & ms_Acoustic(6, UBound(ms_Acoustic, 2))
'            For i = 0 To out_Acoustic.ListCount - 1
'                If out_Acoustic.Indent(i) = 1 Then
'                    out_Acoustic.Expand(i) = OK
'                Else
'                    out_Acoustic.PictureType(i) = 2
'                End If
'            Next i
        End If
    Case "_2"
        GetValueFire
        ls_Market = gut_Param.Str13
    '   Query for action
        ls_procName = GetProcName
        If ls_procName = "BI_FireRes_Value_" Then
            ls_procName = "BI_FireReac_Value_"
        End If
        gut_Param.Str21 = "EXEC " & ls_procName & "ins"
        
        'debug.assert (tvw_fire.SelectedItem.Key Like "_0_*")    ' we are in first level
        ls_Type = tvw_fire.SelectedItem.Text
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            If mb_FirstFire Then
                mb_FirstFire = KO
            Else
                ReDim Preserve ms_Fire(11, UBound(ms_Fire, 2) + 1)
            End If
            ms_Fire(0, UBound(ms_Fire, 2)) = gut_Param.Str11
            ms_Fire(1, UBound(ms_Fire, 2)) = gut_Param.Str12
            ms_Fire(2, UBound(ms_Fire, 2)) = gut_Param.Str13
            ms_Fire(3, UBound(ms_Fire, 2)) = gut_Param.Str14
            ms_Fire(4, UBound(ms_Fire, 2)) = gut_Param.Str15
            ms_Fire(5, UBound(ms_Fire, 2)) = gut_Param.Str16
            ms_Fire(6, UBound(ms_Fire, 2)) = gut_Param.Str17
            ms_Fire(7, UBound(ms_Fire, 2)) = gut_Param.Str18
            ms_Fire(8, UBound(ms_Fire, 2)) = gut_Param.Str19
            ms_Fire(9, UBound(ms_Fire, 2)) = gut_Param.Str20
            
            Call InsertNode(tvw_fire, tvw_fire.SelectedItem.Key, "_1_" & gut_Param.Str13 & " :  " & ms_Fire(6, UBound(ms_Fire, 2)), gut_Param.Str13 & " :  " & ms_Fire(6, UBound(ms_Fire, 2)), _
                            RES_DOCUMENT, RES_DOCUMENT, , vbResBitmap)
                            
            ' new item into treeView
            tvw_fire.SelectedItem.Expanded = True
            
'            out_Fire.AddItem gut_Param.Str13 & " :  " & ms_Fire(6, UBound(ms_Fire, 2))
'            For i = 0 To out_Fire.ListCount - 1
'                If out_Fire.Indent(i) = 1 Then
'                    out_Fire.Expand(i) = OK
'                Else
'                    out_Fire.PictureType(i) = 2
'                End If
'            Next i
        End If
    End Select
    MouseOn
    
End Sub

Private Sub pic_delete_Click()
    MouseOff
    gut_Param.Str10 = "Delete"
    gut_Param.Str21 = "EXEC BI_Public_Value_del"
    gut_Param.Str22 = "EXEC Screen_Csts 'mtnc_BIMarket','" & gut_LangLogin.Code & "'"
'    Select Case tab_Test.Tab
    Select Case tbs_Test.SelectedItem.Key         ' NEW 22.1.2005 remove SSTab
    Case "_0"
        grd_Value0.Col = 6
        GetValueGrid0
    '   Query for action
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            grd_Value0.Col = 1
    '       Market code
            grd_Value0.Text = gut_Param.Str12
            grd_Value0.Col = 2
    '       Market_desc (optionnal)
            grd_Value0.Text = gut_Param.Str13
            grd_Value0.Col = 5
    '       Value code
            grd_Value0.Text = gut_Param.Str16
            grd_Value0.Col = 6
    '       Value description
            grd_Value0.Text = gut_Param.Str17
            grd_Value0.Col = 7
    '       iConcurrency
            grd_Value0.Text = gut_Param.Str18
            grd_Value0.Col = 8
    '       Internet
            grd_Value0.Text = gut_Param.Str19
            grd_Value0.Col = 9
    '       Drop date
            grd_Value0.Text = gut_Param.Str20
        End If
        grd_Value0_SelChange
'        grd_Value0_Click
    Case "_1"
        GetValueAcoustic
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            'debug.assert (Not tvw_acoustic.SelectedItem Is Nothing)
            tvw_acoustic.Nodes.Remove (tvw_acoustic.SelectedItem.Key)
'            out_Acoustic.RemoveItem out_Acoustic.ListIndex
        End If
    Case "_2"
        GetValueFire
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            'debug.assert (Not tvw_fire.SelectedItem Is Nothing)
            tvw_fire.Nodes.Remove (tvw_fire.SelectedItem.Key)
'            out_Fire.RemoveItem out_Fire.ListIndex
        End If
    End Select
    MouseOn
    pic_refresh_Click
End Sub

Private Sub pic_help_Click()
    MouseOff
    gs_TableName = "BI_Marketing"
    frm_help.show 1
    MouseOn
End Sub

Private Sub pic_print_Click()
Dim i As Integer
Dim ls_Label As String

    If Printers.Count = 0 Then
        SendMessage 135, "No printer is installed on your computer. Please, contact your system administrator.", gut_LangLogin.Code
        Exit Sub
    End If
    
    MouseOff
    InitPrinter 1
    
    'title
    Printer.Font.Italic = 0
    SetBold -1
    SetFontSize 12
    Printer.Print Date;
    Printer.Print " - ";
    Printer.Print Time
    SetFontSize 36
    Printer.Print "Armstrong Ceiling Solutions"
    SetFontSize 24
    Printer.Print BaseItemMarketing_detail.Caption & " - " & BaseItem_main.cmd_Marketing.Caption
    SetFontSize 12
    Printer.Print Tab(100 - 5);
    Printer.Print Printer.Page
    Printer.Print ""
    SetFontSize 18
    Printer.Print ""
    PrintField lbl_SAP, txt_SAP.Text
    PrintField lbl_Desc, txt_Desc.Text
    SetFontSize 12
    Printer.Print ""
    
    SetBold 1
    SetFontSize 18
    Printer.Print tbs_Test.Tabs("_0").Caption     ' NEW 22.1.2005 remove SSTab
    SetFontSize 12
    SetBold -1
    Printer.Print ""
    For i = 0 To grd_Value0.Rows - 1
        grd_Value0.Col = 0
        grd_Value0.Row = i
        ls_Label = grd_Value0.Text
        grd_Value0.Col = 6
        PrintField ls_Label, grd_Value0.Text
    Next
    
    Printer.Print ""
    Printer.Print ""
    
    SetBold 1
    SetFontSize 18
'    Printer.Print tab_Test.TabCaption(1)
    Printer.Print tbs_Test.Tabs("_1").Caption     ' NEW 22.1.2005 remove SSTab
    SetFontSize 12
    SetBold -1
    Printer.Print ""
    ls_Label = ""
'    For i = 0 To out_Acoustic.ListCount - 1
' BUGFIXED JUNA 22.11.2005
    For i = 1 To tvw_acoustic.Nodes.Count
        If tvw_acoustic.Nodes(i).Key Like "_0_*" Then
            ls_Label = tvw_acoustic.Nodes(i).Text
        Else
            PrintField ls_Label, tvw_acoustic.Nodes(i).Text
        End If
    Next
    
    Printer.Print ""
    Printer.Print ""
    
    SetBold 1
    SetFontSize 18
'    Printer.Print tab_Test.TabCaption(2)
    Printer.Print tbs_Test.Tabs("_2").Caption     ' NEW 22.1.2005 remove SSTab
    SetFontSize 12
    SetBold -1
    Printer.Print ""
    ls_Label = ""
' BUGFIDEX JUNA 22.11.2005
    For i = 1 To tvw_fire.Nodes.Count
        If tvw_fire.Nodes(i).Key Like "_0_*" Then
            ls_Label = tvw_fire.Nodes(i).Text
        Else
            PrintField ls_Label, tvw_fire.Nodes(i).Text
        End If
    Next
    
    Printer.EndDoc
    MouseOn

End Sub

Private Sub pic_quit_Click()
    MouseOff
    Unload Me
    MouseOn
End Sub

Private Sub pic_refresh_Click()
    MouseOff
    pic_add.Visible = KO
    pic_delete.Visible = KO
    pic_upd.Visible = KO
    FillGridValue
    MouseOn
End Sub

Private Sub pic_upd_Click()
Dim li_line As Integer
Dim ls_Market As String, ls_Type As String
Dim ls_Value As String
Dim i As Integer
Dim lo_parentNode As MSComctlLib.Node

    MouseOff
    gut_Param.Str10 = "Update"
    gut_Param.Str22 = "EXEC Screen_Csts 'mtnc_BIMarket','" & gut_LangLogin.Code & "'"
'    Select Case tab_Test.Tab
    Select Case tbs_Test.SelectedItem.Key         ' NEW 22.1.2005 remove SSTab
    Case "_0"
        GetValueGrid0
    '   Query for action
        gut_Param.Str21 = "EXEC " & GetProcName & "upd2"
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            grd_Value0.Col = 1
    '       Market code
            grd_Value0.Text = gut_Param.Str12
            grd_Value0.Col = 2
    '       Market_desc (optionnal)
            grd_Value0.Text = gut_Param.Str13
            grd_Value0.Col = 5
    '       Value code
            grd_Value0.Text = gut_Param.Str16
            grd_Value0.Col = 6
    '       Value description
            grd_Value0.Text = gut_Param.Str17
            grd_Value0.Col = 7
    '       iConcurrency
            grd_Value0.Text = gut_Param.Str18
            grd_Value0.Col = 8
    '       Internet
            grd_Value0.Text = gut_Param.Str19
            grd_Value0.Col = 9
    '       Drop date
            grd_Value0.Text = gut_Param.Str20
        End If
        grd_Value0_SelChange
'        grd_Value0_Click
    Case "_1"
        GetValueAcoustic
        ls_Market = gut_Param.Str13
    '   Query for action
        
        Set lo_parentNode = tvw_acoustic.SelectedItem.Parent
        
        'update August 05 for truncating test count
        ls_Type = OutlinePathPart(tvw_acoustic.SelectedItem.FullPath, 1)
        If right(ls_Type, 1) = "}" Then ls_Type = Truncate_Count(ls_Type)
        
        gut_Param.Str21 = "EXEC " & GetProcName & "upd2"
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            li_line = FindLineAcoustic(ls_Type, ls_Market, right(tvw_acoustic.SelectedItem.Text, Len(tvw_acoustic.SelectedItem.Text) - InStr(1, tvw_acoustic.SelectedItem.Text, ": ", 1) - 2))
            ms_Acoustic(5, li_line) = gut_Param.Str16
            ms_Acoustic(6, li_line) = gut_Param.Str17
            ms_Acoustic(7, li_line) = gut_Param.Str18
            ms_Acoustic(8, li_line) = gut_Param.Str19
            ms_Acoustic(9, li_line) = gut_Param.Str20
            ms_Acoustic(10, li_line) = gut_Param.Str28
            ms_Acoustic(11, li_line) = gut_Param.Str29
            
            ' remove old value
            tvw_acoustic.Nodes.Remove (tvw_acoustic.SelectedItem.Key)
            ' insert it again
            Call InsertNode(tvw_acoustic, lo_parentNode.Key, "_1_" & gut_Param.Str13 & " :  " & ms_Acoustic(6, li_line), gut_Param.Str13 & " :  " & ms_Acoustic(6, li_line), _
                            RES_DOCUMENT, RES_DOCUMENT, , vbResBitmap)
            
'            out_Acoustic.RemoveItem out_Acoustic.ListIndex
'            out_Acoustic.ListIndex = OutlineFindItem(out_Acoustic, ls_Type)
'            out_Acoustic.AddItem gut_Param.Str13 & " :  " & ms_Acoustic(6, li_line)
'            For i = 0 To out_Acoustic.ListCount - 1
'                If out_Acoustic.Indent(i) = 1 Then
'                    out_Acoustic.Expand(i) = OK
'                Else
'                    out_Acoustic.PictureType(i) = 2
'                End If
'            Next i
        End If
    Case "_2"
        'debug.assert (tvw_fire.SelectedItem.Key Like "_1_*")
        
        GetValueFire
        ls_Market = gut_Param.Str13
        ls_Value = gut_Param.Str17
        
        Set lo_parentNode = tvw_fire.SelectedItem.Parent
        
    '   Query for action
        'update August 05 for truncating test count
        ls_Type = OutlinePathPart(tvw_fire.SelectedItem.FullPath, 1)
        If right(ls_Type, 1) = "}" Then ls_Type = Truncate_Count(ls_Type)

        gut_Param.Str21 = "EXEC " & GetProcName & "upd2"
        gb_Return = KO
        BI_Test_Mtnc.show 1
        If gb_Return Then
            li_line = FindLineFire(gut_Param.Str14, ls_Type, ls_Market, ls_Value)
            ms_Fire(5, li_line) = gut_Param.Str16
            ms_Fire(6, li_line) = gut_Param.Str17
            ms_Fire(7, li_line) = gut_Param.Str18
            ms_Fire(8, li_line) = gut_Param.Str19
            ms_Fire(9, li_line) = gut_Param.Str20
            
            ' remove old value
            tvw_fire.Nodes.Remove (tvw_fire.SelectedItem.Key)
            ' insert it again
            Call InsertNode(tvw_fire, lo_parentNode.Key, "_1_" & gut_Param.Str13 & " :  " & ms_Fire(6, li_line), gut_Param.Str13 & " :  " & ms_Fire(6, li_line), _
                            RES_DOCUMENT, RES_DOCUMENT, , vbResBitmap)
            
'            out_Fire.RemoveItem out_Fire.ListIndex
'            out_Fire.ListIndex = OutlineFindItem(out_Fire, ls_Type)
'            out_Fire.AddItem gut_Param.Str13 & " :  " & ms_Fire(6, li_line)
'            For i = 0 To out_Fire.ListCount - 1
'                If out_Fire.Indent(i) = 1 Then
'                    out_Fire.Expand(i) = OK
'                Else
'                    out_Fire.PictureType(i) = 2
'                End If
'            Next i
        End If
    End Select
    MouseOn
    pic_refresh_Click
End Sub

Private Sub GetValueGrid0()
    grd_Value0.Col = 0
    ' Category/type description
    gut_Param.Str11 = grd_Value0.Text
    grd_Value0.Col = 1
    ' Market code (optionnal)
    gut_Param.Str12 = grd_Value0.Text
    grd_Value0.Col = 2
    ' Market description (optionnal)
    gut_Param.Str13 = grd_Value0.Text
    grd_Value0.Col = 3
    ' Category code
    gut_Param.Str14 = grd_Value0.Text
    grd_Value0.Col = 4
    ' Type code
    gut_Param.Str15 = grd_Value0.Text
    grd_Value0.Col = 5
    ' Value code
    gut_Param.Str16 = grd_Value0.Text
    grd_Value0.Col = 6
    ' Value description
    gut_Param.Str17 = grd_Value0.Text
    grd_Value0.Col = 7
    ' iConcurrency
    gut_Param.Str18 = grd_Value0.Text
    grd_Value0.Col = 8
    ' Internet
    gut_Param.Str19 = grd_Value0.Text
    grd_Value0.Col = 9
    ' Drop date
    gut_Param.Str20 = grd_Value0.Text
End Sub

Private Sub GetValueFire()
If tvw_fire.SelectedItem Is Nothing Then Exit Sub

Dim li_line As Integer
Dim i As Integer
Dim ls_Market As String
Dim ls_Type As String
Dim ls_Value As String
Dim ls_path As String
Dim ls_topString As String

    ls_path = tvw_fire.SelectedItem.FullPath
    ls_topString = OutlinePathPart(ls_path, 1)
    If right(ls_topString, 1) = "}" Then
    Do Until right(ls_topString, 1) = "{"
    ls_topString = Left(ls_topString, Len(ls_topString) - 1)
    Loop
        ls_topString = Trim(Left(ls_topString, Len(ls_topString) - 1))
    End If

    Select Case ls_topString
        Case ms_FireDesc3
            gut_Param.Str14 = "4"
        Case ms_FireDesc4
            gut_Param.Str14 = "15"
    End Select
    
    If tvw_fire.SelectedItem.Key Like "_0_*" Then
    '   Type level
        gut_Param.Str11 = tvw_fire.SelectedItem.Text
        gut_Param.Str12 = "0"
        gut_Param.Str13 = ""
        
        'update Sept. 05 for truncating test count
        ls_Type = gut_Param.Str11
        If right(ls_Type, 1) = "}" Then ls_Type = Truncate_Count(ls_Type)

'        If gut_Param.Str11 = ms_FireDesc3 Then
        If ls_Type = ms_FireDesc3 Then
            gut_Param.Str15 = "3"
        Else
            gut_Param.Str15 = "4"
        End If
        gut_Param.Str16 = ""
        gut_Param.Str17 = ""
        gut_Param.Str18 = "0"
        gut_Param.Str19 = ""
        gut_Param.Str20 = ""
    Else
    '   Market/option level
'        ls_Type = OutlinePathPart(tvw_fire.SelectedItem.FullPath, 1)
'        If right(ls_Type, 1) = "}" Then
'            Do Until right(ls_Type, 1) = "{"
'            ls_Type = Left(ls_Type, Len(ls_Type) - 1)
'            Loop
'            ls_Type = Trim(Left(ls_Type, Len(ls_Type) - 1))
'        End If
        'update August 05 for truncating test count
        ls_Type = OutlinePathPart(tvw_fire.SelectedItem.FullPath, 1)
        If right(ls_Type, 1) = "}" Then ls_Type = Truncate_Count(ls_Type)

        ls_Market = Left(tvw_fire.SelectedItem.Text, InStr(1, tvw_fire.SelectedItem.Text, " :  ", 1) - 1)
        ls_Value = right(tvw_fire.SelectedItem.Text, Len(tvw_fire.SelectedItem.Text) - InStr(1, tvw_fire.SelectedItem.Text, " :  ", 1) - 3)
        li_line = FindLineFire(gut_Param.Str14, ls_Type, ls_Market, ls_Value)
        gut_Param.Str11 = ms_Fire(0, li_line)
        gut_Param.Str12 = ms_Fire(1, li_line)
        gut_Param.Str13 = ms_Fire(2, li_line)
        gut_Param.Str15 = ms_Fire(4, li_line)
        gut_Param.Str16 = ms_Fire(5, li_line)
        gut_Param.Str17 = ms_Fire(6, li_line)
        gut_Param.Str18 = ms_Fire(7, li_line)
        gut_Param.Str19 = ms_Fire(8, li_line)
        gut_Param.Str20 = ms_Fire(9, li_line)
    End If
End Sub

Private Sub GetValueAcoustic()
If tvw_acoustic.SelectedItem Is Nothing Then Exit Sub

Dim li_line As Integer
Dim i As Integer
Dim ls_Market As String
Dim ls_Type As String

    If Left(tvw_acoustic.SelectedItem.Key, 3) = "_0_" Then
    '   Type level
        gut_Param.Str11 = tvw_acoustic.SelectedItem.Text
            If right(gut_Param.Str11, 1) = "}" Then
    Do Until right(gut_Param.Str11, 1) = "{"
    gut_Param.Str11 = Left(gut_Param.Str11, Len(gut_Param.Str11) - 1)
    Loop
        gut_Param.Str11 = Trim(Left(gut_Param.Str11, Len(gut_Param.Str11) - 1))

    End If

        
        gut_Param.Str12 = "0"
        gut_Param.Str13 = ""
    '    gut_Param.Str14 = "5"
        Select Case gut_Param.Str11
        Case ms_AcousticDesc9
            gut_Param.Str14 = "5" 'test
            gut_Param.Str15 = "9"
        Case ms_AcousticDesc10
            gut_Param.Str14 = "16" 'test
            gut_Param.Str15 = "10"
        Case ms_AcousticDesc11
            gut_Param.Str14 = "17" 'test
            gut_Param.Str15 = "11"
        Case ms_AcousticDesc14
            gut_Param.Str14 = "5" 'test
            gut_Param.Str15 = "14"
        Case ms_AcousticDesc15
            gut_Param.Str14 = "16" 'test
            gut_Param.Str15 = "15"
'task789
        Case ms_AcousticDesc16
            gut_Param.Str14 = "16"
            gut_Param.Str15 = "27"
        Case ms_AcousticDesc17
            gut_Param.Str14 = "5"
            gut_Param.Str15 = "28"
        Case ms_AcousticDesc18
'789 bis            gut_Param.Str14 = "16"
'789 bis            gut_Param.Str15 = "29"
           gut_Param.Str14 = "17"
           gut_Param.Str15 = "11"
        Case ms_AcousticDesc19
'789 bis            gut_Param.Str14 = "16"
'789 bis            gut_Param.Str15 = "30"
           gut_Param.Str14 = "26"
           gut_Param.Str15 = "30"
        Case ms_AcousticDesc20
'789 bis            gut_Param.Str14 = "16"
'789 bis            gut_Param.Str15 = "30"
           gut_Param.Str14 = "25"
           gut_Param.Str15 = "37"
        End Select
        
        gut_Param.Str16 = ""
        gut_Param.Str17 = ""
        gut_Param.Str18 = "0"
        gut_Param.Str19 = ""
        gut_Param.Str20 = ""
        gut_Param.Str28 = "0"
        gut_Param.Str29 = ""
    Else
    
    '   Market/option level
'        ls_Type = OutlinePathPart(tvw_acoustic.SelectedItem.FullPath, 1)
'        If right(ls_Type, 1) = "}" Then
'            Do Until right(ls_Type, 1) = "{"
'                ls_Type = Left(ls_Type, Len(ls_Type) - 1)
'            Loop
'            ls_Type = Trim(Left(ls_Type, Len(ls_Type) - 1))
'        End If
        'update August 05 for truncating test count
        ls_Type = OutlinePathPart(tvw_acoustic.SelectedItem.FullPath, 1)
        If right(ls_Type, 1) = "}" Then ls_Type = Truncate_Count(ls_Type)
        
        ls_Market = Left(tvw_acoustic.SelectedItem.Text, InStr(1, tvw_acoustic.SelectedItem.Text, " :  ", 1) - 1)
        li_line = FindLineAcoustic(ls_Type, ls_Market, right(tvw_acoustic.SelectedItem.Text, Len(tvw_acoustic.SelectedItem.Text) - InStr(1, tvw_acoustic.SelectedItem.Text, ": ", 1) - 2))
        gut_Param.Str11 = ms_Acoustic(0, li_line)
        gut_Param.Str12 = ms_Acoustic(1, li_line)
        gut_Param.Str13 = ms_Acoustic(2, li_line)
        gut_Param.Str14 = ms_Acoustic(3, li_line)
        gut_Param.Str15 = ms_Acoustic(4, li_line)
        gut_Param.Str16 = ms_Acoustic(5, li_line)
        gut_Param.Str17 = ms_Acoustic(6, li_line)
        gut_Param.Str18 = ms_Acoustic(7, li_line)
        gut_Param.Str19 = ms_Acoustic(8, li_line)
        gut_Param.Str20 = ms_Acoustic(9, li_line)
        gut_Param.Str28 = ms_Acoustic(10, li_line)
        gut_Param.Str29 = ms_Acoustic(11, li_line)
    End If
End Sub

Private Function GetProcName() As String
    Select Case gut_Param.Str14
    Case 3
    ' Humidity
        GetProcName = "BI_Humidity_Value_"
    Case 4, 15
    ' Fire
        Select Case gut_Param.Str15
            Case 3
    ' Reaction
            GetProcName = "BI_FireReac_Value_"
            Case 4
    ' Resistance
            GetProcName = "BI_FireRes_Value_"
        End Select
'789 bis    Case 5, 16, 17
    Case 5, 16, 17, 26, 25
    ' Acoustic
        Select Case gut_Param.Str15
            Case 9
    '    NRC
            GetProcName = "BI_AcoustNRC_Value_"
            Case 10
    '    DncW/STC
            GetProcName = "BI_AcoustDncW_Value_"
        
            Case 11
    '    RW
'789 bis        GetProcName = "BI_AcoustRW_Value_"
            GetProcName = "BI_RedInd_Value_"
        
            Case 14
    '    aW
            GetProcName = "BI_AcoustaW_Value_"
            Case 15
    '    CAC
            GetProcName = "BI_AcoustCAC_Value_"
'task789 begin
            Case 27
    ' Dnfw
            GetProcName = "BI_Dnfw_Value_"
            Case 28
    ' AbsClass
            GetProcName = "BI_AbsClass_Value_"
'789 bis        Case 29
    ' RedInd
'789 bis         GetProcName = "BI_RedInd_Value_"
            Case 30
    ' Rain noise
            GetProcName = "BI_Rain_Value_"
            Case 37
    ' Equivalent Sound Absorbtion Area
            GetProcName = "BI_EquivSoundAbs_Value_"
        End Select
        
    Case 6
    ' Density
        GetProcName = "BI_Density_Value_"
    Case 7
    ' Light
        GetProcName = "BI_Light_Value_"
    Case 8
    ' Impact
        GetProcName = "BI_Impact_Value_"
    Case 9
    ' Thermal
        GetProcName = "BI_Thermal_Value_"
    Case 10
    ' Hygiene
        GetProcName = "BI_Hygiene_Value_"
    Case 11
    ' Washability
        GetProcName = "BI_Wash_Value_"
    Case 12
    ' Weight
        GetProcName = "BI_Weight_Value_"
    Case 13
    ' Price
        GetProcName = "BI_Price_Value_"
' JUNA task213 insert Begin
    Case 21
    ' Anti-Microbial
        GetProcName = "BI_AntiMicrobial_Value_"
    Case 22
    ' Cleanable
        GetProcName = "BI_Cleanable_Value_"
    Case 23
    ' Air_Quality
        GetProcName = "BI_Air_Quality_Value_"
    Case 24
    ' Recycled_Content
        GetProcName = "BI_Recycled_Content_Value_"
' JUNA task213 insert End
' JUNA 5/2/2015 begin
    Case 27
    ' In Armstrong Recycling Program
        GetProcName = "BI_RecycleProgram_Value_"
    Case 28
    ' Formaldehyde Emissions
        GetProcName = "BI_VOCCE_Value_"
    Case 29
    ' VOC emissions
        GetProcName = "BI_VOCFR_Value_"
    Case 30
    ' C2C Certified
        GetProcName = "BI_C2C_Value_"
    Case 31
    ' Environmental Product Declaration (EPD)
        GetProcName = "BI_DPD_Value_"
    Case 32
    ' Recyclable%
        GetProcName = "BI_Recyclable_Value_"
' JUNA 5/2/2015 end
' JUNA 23/06/2016 begin
    Case 33
    ' Dry cleaning
        GetProcName = "BI_CleanDry_Value_"
    Case 34
    ' Moist cleaning
        GetProcName = "BI_CleanMoist_Value_"
    Case 35
    ' Damp sponge cleaning
        GetProcName = "BI_CleanSponge_Value_"
    Case 36
    ' Scrubbable
        GetProcName = "BI_CleanScrubbable_Value_"
    Case 37
    ' High pressure cleaning
        GetProcName = "BI_CleanHighPressure_Value_"
    Case 38
    ' Disinfectant resistant
        GetProcName = "BI_CleanDisinfectant_Value_"
    Case 39
    ' Seismic component
        GetProcName = "BI_SeismicComponent_Value_"
' JUNA 23/06/2016 end
    End Select
End Function

' NEW 22.1.2005 remove SSTab begin
Private Sub InitTabStrip(ByVal ao_tbStrip As MSComctlLib.TabStrip, ByRef ao_tabs As Object)
Dim lo_Object As Object
    For Each lo_Object In ao_tabs
        Select Case ao_tbStrip.Placement
            Case tabPlacementLeft
                Call lo_Object.Move(ao_tbStrip.Left + ao_tbStrip.Width, ao_tbStrip.Top)
            Case tabPlacementTop
                Call lo_Object.Move(ao_tbStrip.Left, ao_tbStrip.Top + ao_tbStrip.Height)
            Case tabPlacementRight
                Call lo_Object.Move(ao_tbStrip.Left - lo_Object.Width, ao_tbStrip.Top)
            Case tabPlacementBottom
                Call lo_Object.Move(ao_tbStrip.Left, ao_tbStrip.Top - lo_Object.Height)
        End Select
    Next
    
    For Each lo_Object In ao_tbStrip.Tabs
        lo_Object.Key = "_" & lo_Object.Index - 1
    Next
End Sub

Private Sub UpdateTabStrip(ByVal ao_tbStrip As MSComctlLib.TabStrip, ByRef ao_tabs As Object)
Dim lo_Object As Object
    For Each lo_Object In ao_tabs
        lo_Object.Visible = (lo_Object.Index = CLng(Mid(ao_tbStrip.SelectedItem.Key, 2)))
    Next
End Sub

Private Sub SetTabStripVisible(ByRef ao_tbStrip As MSComctlLib.TabStrip, ByRef ao_tabs As Object, ByVal ab_Visible As Boolean)
    ao_tbStrip.Visible = ab_Visible

    If ab_Visible Then
        Call UpdateTabStrip(ao_tbStrip, ao_tabs)
    Else
        Dim lo_Object As Object
        ' hide all tabs
        For Each lo_Object In ao_tabs
            lo_Object.Visible = False
        Next
    End If
End Sub

Private Sub tbs_Test_Click()
    MouseOff
    grd_Value0.HighLight = flexHighlightNever   '= KO
    Set tvw_acoustic.SelectedItem = Nothing
    Set tvw_fire.SelectedItem = Nothing
    pic_add.Visible = KO
    pic_upd.Visible = KO
    pic_delete.Visible = KO
    gi_ChoosenTab = CInt(Mid(tbs_Test.SelectedItem.Key, 2))  ' NEW 22.1.2005 remove SSTab
    Call UpdateTabStrip(tbs_Test, frm_tabTest)
    MouseOn
End Sub

' NEW remove TreeView begin
Private Function InsertNode(ByVal ao_tvw As MSComctlLib.TreeView, ByVal ao_parentKey As String, ByVal as_Key As String, ByVal as_Text As String, Optional ByVal al_Image As Long = -1, Optional ByVal al_imageSel As Long = -1, Optional ByVal al_relationship As MSComctlLib.TreeRelationshipConstants = tvwChild, Optional ByVal al_imageType As LoadResConstants = vbResIcon) As MSComctlLib.Node
    Dim lo_retNode As MSComctlLib.Node
    Set lo_retNode = GetNode(ao_tvw, as_Key)
    If lo_retNode Is Nothing Then
        Set lo_retNode = ao_tvw.Nodes.Add(IIf(ao_parentKey = "", Null, ao_parentKey), _
                                          al_relationship, _
                                          as_Key, _
                                          as_Text, _
                                          GetImageIndex(ao_tvw.ImageList, al_Image, al_imageType), _
                                          GetImageIndex(ao_tvw.ImageList, al_imageSel, al_imageType))
    End If
    Set InsertNode = lo_retNode
End Function

Private Function GetNode(ByVal ao_tvw As MSComctlLib.TreeView, ByVal as_Key As String) As MSComctlLib.Node
    Dim lo_Node As MSComctlLib.Node
    
    Set GetNode = Nothing
    For Each lo_Node In ao_tvw.Nodes
        If lo_Node.Key = as_Key Then
            Set GetNode = lo_Node
            Exit For
        End If
    Next
End Function

Private Function GetImageIndex(ByVal ao_ImageList As MSComctlLib.ImageList, ByVal al_resIndex As Long, ByVal al_resType As LoadResConstants) As Variant
    If (ao_ImageList Is Nothing) Or (al_resIndex = -1) Then
        GetImageIndex = Empty
        Exit Function
    End If
    
    Dim lo_image As MSComctlLib.ListImage
    For Each lo_image In ao_ImageList.ListImages
        If lo_image.Key = "_" & al_resIndex Then
            GetImageIndex = lo_image.Index
            Exit Function
        End If
    Next
    
    GetImageIndex = LoadImage(ao_ImageList, al_resIndex, al_resType)
End Function

Private Function LoadImage(ByVal ao_ImageList As MSComctlLib.ImageList, ByVal al_resIndex As Long, ByVal al_resType As LoadResConstants) As Long
    Dim lo_image As MSComctlLib.ListImage
    Set lo_image = ao_ImageList.ListImages.Add(, "_" & al_resIndex, LoadResPicture(al_resIndex, al_resType))
    LoadImage = lo_image.Index
End Function

Private Sub InitTreeView(ByRef ao_tvw As MSComctlLib.TreeView, Optional ByVal ao_imgList As MSComctlLib.ImageList = Nothing)
    ao_tvw.HideSelection = False        ' don't hide selection when lostFocus
    ao_tvw.LineStyle = tvwRootLines
    ao_tvw.LabelEdit = tvwManual        ' disable edit labels
    ao_tvw.Indentation = 300
    Set ao_tvw.ImageList = ao_imgList
End Sub

Private Sub InitImageList(ByRef ao_imgList As MSComctlLib.ImageList)
    ao_imgList.ImageHeight = 16
    ao_imgList.ImageWidth = 16
    ao_imgList.MaskColor = vbMagenta

    ' at least one image must be loaded to correctly initialize imagelist
    Call LoadImage(ao_imgList, RES_OPENFOLDER, vbResBitmap)
    
End Sub
' NEW remove TreeView end


Private Sub tvw_acoustic_Click()
    If tvw_acoustic.SelectedItem Is Nothing Then Exit Sub
    
    MouseOff
    If Left(tvw_acoustic.SelectedItem.Key, 3) Like "_0_*" And mb_AllowAdd Then
        pic_add.Visible = OK
        pic_upd.Visible = KO
        pic_delete.Visible = KO
    Else
        pic_add.Visible = KO
        If mb_AllowUpd Then
            pic_upd.Visible = OK
        End If
        If mb_AllowDel Then
            pic_delete.Visible = OK
        End If
    End If
    MouseOn
End Sub

Private Sub tvw_acoustic_DblClick()
    MouseOff
    GetValueAcoustic
    Dim test_form As New Test_Visu
    test_form.TestTypeLabel = gut_Param.Str11
    Call LoadForm(test_form)
    MouseOn
End Sub

Private Sub tvw_fire_Click()
    If tvw_fire.SelectedItem Is Nothing Then Exit Sub

    MouseOff
    If tvw_fire.SelectedItem.Key Like "_0_*" And mb_AllowAdd Then
        pic_add.Visible = OK
        pic_upd.Visible = KO
        pic_delete.Visible = KO
    Else
        pic_add.Visible = KO
        If mb_AllowUpd Then
            pic_upd.Visible = OK
        End If
        If mb_AllowDel Then
            pic_delete.Visible = OK
        End If
    End If
    MouseOn
End Sub

Private Sub tvw_fire_DblClick()
    MouseOff
    GetValueFire
    Dim test_form As New Test_Visu
    test_form.TestTypeLabel = gut_Param.Str11
    Call LoadForm(test_form)
    MouseOn
End Sub

Private Function Test_available(ByVal test_code As Integer) As Integer
Dim mylist As String
Dim mytestcode As String
mylist = ""
Dim ll_Statement As Long, li_Status As Long, li_Count As Long, ls_req As String
    ls_req = "EXEC Test_t_lst5 " & test_code & ",'" & gs_SAPCode & "','E'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Count = 0
        li_Status = SQL_SUCCESS
        Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
            li_Status = SQLFetch(ll_Statement)
            If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            mytestcode = ODBCData(ll_Statement, 5)
            If InStr(1, mylist, mytestcode & SEP) = 0 Then
            mylist = mylist & mytestcode & SEP
              li_Count = li_Count + 1
              End If
              End If
        Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    End If
Test_available = li_Count
End Function

Private Function Truncate_Count(as_Truncated As String) As String

Truncate_Count = as_Truncated

Do Until right(as_Truncated, 1) = "{"
    as_Truncated = Left(as_Truncated, Len(as_Truncated) - 1)
Loop
Truncate_Count = Trim(Left(as_Truncated, Len(as_Truncated) - 1))

End Function
