VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form Tech_Value_Curve 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Tech_Value_Curve"
   ClientHeight    =   6225
   ClientLeft      =   165
   ClientTop       =   660
   ClientWidth     =   9330
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   6225
   ScaleWidth      =   9330
   ShowInTaskbar   =   0   'False
   Begin MSChart20Lib.MSChart cha_Curve 
      Height          =   3435
      Left            =   120
      OleObjectBlob   =   "TECH_VAL.frx":0000
      TabIndex        =   48
      Top             =   2670
      Width           =   9120
   End
   Begin VB.CommandButton spp_save 
      Default         =   -1  'True
      Height          =   615
      Left            =   7920
      Style           =   1  'Graphical
      TabIndex        =   22
      Top             =   1980
      Width           =   615
   End
   Begin VB.CommandButton ssp_quit 
      Height          =   615
      Left            =   8640
      Style           =   1  'Graphical
      TabIndex        =   23
      Top             =   1980
      Width           =   615
   End
   Begin VB.CommandButton SSC_dropped 
      Height          =   270
      Left            =   3060
      Style           =   1  'Graphical
      TabIndex        =   26
      TabStop         =   0   'False
      Top             =   2280
      Width           =   255
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   17
      Left            =   7860
      TabIndex        =   18
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   16
      Left            =   7080
      TabIndex        =   17
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   15
      Left            =   6300
      TabIndex        =   16
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   14
      Left            =   5520
      TabIndex        =   15
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   13
      Left            =   4740
      TabIndex        =   14
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   12
      Left            =   3960
      TabIndex        =   13
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   11
      Left            =   3180
      TabIndex        =   12
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   10
      Left            =   2400
      TabIndex        =   11
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   9
      Left            =   1620
      TabIndex        =   10
      Top             =   1500
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   8
      Left            =   7860
      TabIndex        =   9
      Top             =   660
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   7
      Left            =   7080
      TabIndex        =   8
      Top             =   660
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   6
      Left            =   6300
      TabIndex        =   7
      Top             =   660
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   5
      Left            =   5520
      TabIndex        =   6
      Top             =   660
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   4
      Left            =   4740
      TabIndex        =   5
      Top             =   660
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   3
      Left            =   3960
      TabIndex        =   4
      Top             =   660
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   2
      Left            =   3180
      TabIndex        =   3
      Top             =   660
      Width           =   672
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   1
      Left            =   2400
      TabIndex        =   2
      Top             =   660
      Width           =   672
   End
   Begin VB.CommandButton cmd_Curve 
      Caption         =   "cmd_Curve"
      Height          =   312
      Left            =   3480
      TabIndex        =   21
      Top             =   2280
      Width           =   1092
   End
   Begin VB.TextBox txt_dropped 
      ForeColor       =   &H00FF0000&
      Height          =   288
      Left            =   1800
      Locked          =   -1  'True
      TabIndex        =   20
      Top             =   2280
      Width           =   1212
   End
   Begin VB.CheckBox chk_Int 
      Caption         =   "Check1"
      Height          =   252
      Left            =   1800
      TabIndex        =   19
      Top             =   1920
      Width           =   252
   End
   Begin VB.TextBox txt_FHz 
      Height          =   288
      Index           =   0
      Left            =   1620
      TabIndex        =   1
      Top             =   660
      Width           =   672
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(17)"
      Height          =   255
      Index           =   17
      Left            =   7860
      TabIndex        =   47
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(16)"
      Height          =   255
      Index           =   16
      Left            =   7080
      TabIndex        =   46
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(15)"
      Height          =   255
      Index           =   15
      Left            =   6300
      TabIndex        =   45
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(14)"
      Height          =   255
      Index           =   14
      Left            =   5520
      TabIndex        =   44
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(13)"
      Height          =   255
      Index           =   13
      Left            =   4740
      TabIndex        =   43
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(12)"
      Height          =   255
      Index           =   12
      Left            =   3960
      TabIndex        =   42
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(11)"
      Height          =   255
      Index           =   11
      Left            =   3180
      TabIndex        =   41
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(10)"
      Height          =   255
      Index           =   10
      Left            =   2400
      TabIndex        =   40
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(9)"
      Height          =   255
      Index           =   9
      Left            =   1620
      TabIndex        =   39
      Top             =   1080
      Width           =   675
   End
   Begin VB.Label lbl_Value2 
      Caption         =   "lbl_Value"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   38
      Top             =   1500
      Width           =   1215
   End
   Begin VB.Label lbl_Frequency2 
      Caption         =   "lbl_Frequency"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   37
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(8)"
      Height          =   255
      Index           =   8
      Left            =   7860
      TabIndex        =   36
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(7)"
      Height          =   255
      Index           =   7
      Left            =   7080
      TabIndex        =   35
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(6)"
      Height          =   255
      Index           =   6
      Left            =   6300
      TabIndex        =   34
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(5)"
      Height          =   255
      Index           =   5
      Left            =   5520
      TabIndex        =   33
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(4)"
      Height          =   255
      Index           =   4
      Left            =   4740
      TabIndex        =   32
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(3)"
      Height          =   255
      Index           =   3
      Left            =   3960
      TabIndex        =   31
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(2)"
      Height          =   255
      Index           =   2
      Left            =   3180
      TabIndex        =   30
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(1)"
      Height          =   255
      Index           =   1
      Left            =   2400
      TabIndex        =   29
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_Int 
      Caption         =   "Internet flag"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   28
      Top             =   1920
      Width           =   1455
   End
   Begin VB.Label lbl_Drop 
      Caption         =   "Drop date"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   27
      Top             =   2280
      Width           =   1455
   End
   Begin VB.Label lbl_FHz 
      Alignment       =   2  'Center
      Caption         =   "FHz(0)"
      Height          =   255
      Index           =   0
      Left            =   1620
      TabIndex        =   25
      Top             =   240
      Width           =   675
   End
   Begin VB.Label lbl_Value 
      Caption         =   "lbl_Value"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   120
      TabIndex        =   24
      Top             =   660
      Width           =   1212
   End
   Begin VB.Label lbl_Frequency 
      Caption         =   "lbl_Frequency"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   1212
   End
End
Attribute VB_Name = "Tech_Value_Curve"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim mb_ShowCurve As Boolean


Public Sub ReadConcatField(ls_Field As String)
'------------------------------------------------------------------
' Name : ReadConcatField
'
' Purpose : Search and read string in a concatenated field
'
' Parameters : ls_field : (string) concatenated field
'
' review : 04/22/1999 by D. Pozzera
'------------------------------------------------------------------

Dim li_Last As Integer
Dim li_Next As Integer
Dim i As Integer

i = 0
li_Last = 0
li_Next = 0
Do While True
    li_Last = li_Next
    li_Next = InStr(li_Last + 1, ls_Field, "/")
    If li_Next = 0 Then
    ' no more \
        If li_Last > Len(ls_Field) Then
        ' overflow
            Exit Do
        Else
        ' last word
            li_Next = Len(ls_Field) + 1
        End If
    End If
    'If Mid(ls_path, li_Last + 1, li_Next - li_Last - 1) = "" Then Exit Do
    txt_FHz(i).Text = Trim(Mid(ls_Field, li_Last + 1, li_Next - li_Last - 1))
    i = i + 1
Loop

End Sub


Private Sub cmd_Curve_Click()

MouseOff
If Not mb_ShowCurve Then
    mb_ShowCurve = OK
    Me.Height = 6600
    cha_Curve.Visible = OK
    Graph_Init
    Graph_Draw
Else
    Graph_Draw
End If
MouseOn

End Sub
Private Sub Form_Load()

Dim li_Count As Integer

MouseOff

If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

spp_save.Picture = LoadResPicture(RES_OK, 1)
ssp_quit.Picture = LoadResPicture(RES_QUIT, 1)
SSC_dropped.Picture = LoadResPicture(RES_DOWN2, vbResIcon)

GetConstants
cha_Curve.Visible = KO
mb_ShowCurve = KO
Select Case gut_Param.Str1
    Case "AcoustAW", "AcoustRW", "AcoustNRC", "AcoustDncW", "AcoustCAC", "Dnfw", "RedInd", "Rain", "EquivSoundAbs"
        For li_Count = 6 To 17
            lbl_FHz(li_Count).Visible = KO
            txt_FHz(li_Count).Visible = KO
        Next
        lbl_Frequency2.Visible = KO
        lbl_Value2.Visible = KO
        spp_save.Left = 4700
        spp_save.Top = 1100
        ssp_quit.Left = 5420
        ssp_quit.Top = 1100
        lbl_Int.Top = 1100
        chk_Int.Top = 1100
        lbl_Drop.Top = 1460
        txt_dropped.Top = 1460
        cmd_Curve.Top = 1460
        SSC_dropped.Top = 1460
        Me.Width = 6204
        Me.Height = 2450
        Me.Left = 1500
        cha_Curve.Width = (Me.Width - cha_Curve.Left * 3)
        If gs_Action <> "Add" Then
            ReadConcatField gs_TableCode3
        End If
        
    Case "Test_6"
        For li_Count = 6 To 17
            lbl_FHz(li_Count).Visible = KO
            txt_FHz(li_Count).Visible = KO
        Next
        lbl_Frequency2.Visible = KO
        lbl_Value2.Visible = KO
        spp_save.Left = 4800
        spp_save.Top = 1100
        ssp_quit.Left = 5520
        ssp_quit.Top = 1100
        lbl_Int.Top = 1100
        chk_Int.Top = 1100
        lbl_Drop.Top = 1460
        txt_dropped.Top = 1460
        cmd_Curve.Top = 1460
        SSC_dropped.Top = 1460
        Me.Width = 6500
        Me.Height = 2450
        Me.Left = 1500
        cha_Curve.Width = (Me.Width - cha_Curve.Left * 3)
        lbl_Int.Visible = KO
        chk_Int.Visible = KO
        lbl_Drop.Visible = KO
        txt_dropped.Visible = KO
        SSC_dropped.Visible = KO
        ReadConcatField gut_Param.Str28
    Case "Test_18"
        Me.Height = 3165
        lbl_Int.Visible = KO
        chk_Int.Visible = KO
        lbl_Drop.Visible = KO
        txt_dropped.Visible = KO
        SSC_dropped.Visible = KO
        ReadConcatField gut_Param.Str28
        cha_Curve.Width = (Me.Width - cha_Curve.Left * 3)

End Select

If gs_Action <> "Add" Then
    Set_Description
    If gs_TableCode4 = "X" Then
        chk_Int.Value = 1
    End If
    
    If txt_dropped.Visible = True Then
        txt_dropped = gs_TableCode5
    Else
        txt_dropped = ""
    End If
    
    If gs_Action = "Delete" Or gs_Action = "MoreInfo" Then
        For li_Count = 0 To 17
            txt_FHz(li_Count).Enabled = KO
        Next
        chk_Int.Enabled = KO
        SSC_dropped.Visible = KO
        txt_dropped.Enabled = KO
        If gs_Action = "MoreInfo" Then
            spp_save.Visible = KO
        End If
    End If
End If
MouseOn
Exit Sub

suite:
StdError
End Sub





Private Sub spp_save_Click()

Dim li_Count As Integer

MouseOff
Select Case gs_Action
Case "Add"
    If Add_Table Then
        Select Case gut_Param.Str1
            Case "Test_6"
                Unload Me
                Exit Sub
            Case "Test_18"
                Unload Me
                Exit Sub
            Case Else
            For li_Count = 0 To 9
                txt_FHz(li_Count) = ""
            Next
            chk_Int.Value = 0
            txt_dropped = ""
            txt_FHz(0).SetFocus
            If gl_NbLineDisplay < 2 Then
                C_main.FillGrid
            End If
        End Select
    End If
Case "Update"
    If Upd_Table Then
        Unload Me
        Exit Sub
    End If
Case "Delete"
    If Dlt_Table Then
        Unload Me
        Exit Sub
   End If
End Select
MouseOn

End Sub
Private Sub SSC_dropped_Click()

MouseOff
gb_Return = KO
gs_Date = txt_dropped
Dates.show 1
If gb_Return Then
    txt_dropped = gs_Date
End If
MouseOn

End Sub
Private Sub ssp_quit_Click()

MouseOff
Unload Me

End Sub
Public 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 suite

ls_req = gut_Param.Str23 & ", '" & 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
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 = Left(ODBCData(ll_Statement, 2), 30)
        Select Case ls_Field
        Case "title": Caption = ls_Text
        Case "titleA": If gs_Action = "Add" Then Caption = Caption & " - " & ls_Text
        Case "titleU": If gs_Action = "Update" Then Caption = Caption & " - " & ls_Text
        Case "titleD": If gs_Action = "Delete" Then Caption = Caption & " - " & ls_Text
        Case "lbl_Frequency":
            lbl_Frequency = ls_Text
            lbl_Frequency2 = ls_Text
        Case "lbl_Value":
            lbl_Value = ls_Text
            lbl_Value2 = ls_Text
        Case "lbl_int": lbl_Int = ls_Text
        Case "lbl_drop": lbl_Drop = ls_Text
        Case "lbl_FHz01": lbl_FHz(0) = ls_Text
        Case "lbl_FHz02": lbl_FHz(1) = ls_Text
        Case "lbl_FHz03": lbl_FHz(2) = ls_Text
        Case "lbl_FHz04": lbl_FHz(3) = ls_Text
        Case "lbl_FHz05": lbl_FHz(4) = ls_Text
        Case "lbl_FHz06": lbl_FHz(5) = ls_Text
        Case "lbl_FHz07": lbl_FHz(6) = ls_Text
        Case "lbl_FHz08": lbl_FHz(7) = ls_Text
        Case "lbl_FHz09": lbl_FHz(8) = ls_Text
        Case "lbl_FHz10": lbl_FHz(9) = ls_Text
        Case "lbl_FHz11": lbl_FHz(10) = ls_Text
        Case "lbl_FHz12": lbl_FHz(11) = ls_Text
        Case "lbl_FHz13": lbl_FHz(12) = ls_Text
        Case "lbl_FHz14": lbl_FHz(13) = ls_Text
        Case "lbl_FHz15": lbl_FHz(14) = ls_Text
        Case "lbl_FHz16": lbl_FHz(15) = ls_Text
        Case "lbl_FHz17": lbl_FHz(16) = ls_Text
        Case "lbl_FHz18": lbl_FHz(17) = ls_Text
        Case "lbl_Curve": cmd_Curve.Caption = ls_Text
        End Select
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

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

Private Sub Set_Description()

Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim li_Count As Integer

On Error GoTo suite

If gut_Param.Str1 <> "Test_6" And gut_Param.Str1 <> "Test_18" Then
    ls_req = "EXEC Tech_" & gut_Param.Str21 & "_Curve_dtl " _
         & gs_TableCode & ", '" & gut_LangWork.Code & "'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            For li_Count = 0 To 9
                txt_FHz(li_Count) = ODBCData(ll_Statement, li_Count + 1)
            Next
        End If
    End If
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End If
Exit Sub

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

Private Function Add_Table()

Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim ls_Code As String
Dim ls_Line As String
Dim ls_IntFlag As String
Dim ls_DropFlag As String
Dim ls_DropDate As String
Dim ls_Description As String
Dim lb_test As Boolean

Add_Table = KO
lb_test = KO

On Error GoTo suite

gb_Return = OK
If Control Then
    If chk_Int.Value = 1 Then ls_IntFlag = "X"
    If txt_dropped <> "" Then
        ls_DropFlag = "X"
        ls_DropDate = FormatD(txt_dropped, "mm/dd/yyyy")
    End If
    Select Case gut_Param.Str1
    Case "AcoustAW", "AcoustRW", "AcoustNRC", "AcoustDncW", "AcoustCAC", "Dnfw", "RedInd", "Rain", "EquivSoundAbs"
        ls_Description = txt_FHz(0) & " / " _
                        & txt_FHz(1) & " / " _
                        & txt_FHz(2) & " / " _
                        & txt_FHz(3) & " / " _
                        & txt_FHz(4) & " / " _
                        & txt_FHz(5)
        ls_req = gs_ParamReqIns & " '" _
                & ls_Description & "', " _
                & txt_FHz(0) & ", " & txt_FHz(1) & ", " _
                & txt_FHz(2) & ", " & txt_FHz(3) & ", " _
                & txt_FHz(4) & ", " & txt_FHz(5) & ", " _
                & "0, 0, 0, 0, '" _
                & ls_IntFlag & "', '" _
                & ls_DropFlag & "', '" _
                & ls_DropDate & "'"
    Case "Test_6"
            lb_test = OK
            ls_Description = txt_FHz(0) & " / " _
                        & txt_FHz(1) & " / " _
                        & txt_FHz(2) & " / " _
                        & txt_FHz(3) & " / " _
                        & txt_FHz(4) & " / " _
                        & txt_FHz(5)
            ls_req = gs_ParamReqIns & " " _
                & gut_Param.Str27 & ", " _
                & gut_Param.Str26 & ", '" _
                & ls_Description & "', " _
                & txt_FHz(0) & ", " & txt_FHz(1) & ", " _
                & txt_FHz(2) & ", " & txt_FHz(3) & ", " _
                & txt_FHz(4) & ", " & txt_FHz(5) & ", '" _
                & ls_IntFlag & "', '" _
                & ls_DropFlag & "', '" _
                & ls_DropDate & "'"

        Case "Test_18"
            lb_test = OK
            ls_Description = txt_FHz(0) & " / " & txt_FHz(1) & " / " & txt_FHz(2) & " / " & txt_FHz(3) & " / " _
                & txt_FHz(4) & " / " & txt_FHz(5) & " / " & txt_FHz(6) & " / " & txt_FHz(7) & " / " _
                & txt_FHz(8) & " / " & txt_FHz(9) & " / " & txt_FHz(10) & " / " & txt_FHz(11) & " / " _
                & txt_FHz(12) & " / " & txt_FHz(13) & " / " & txt_FHz(14) & " / " & txt_FHz(15) & " / " _
                & txt_FHz(16) & " / " & txt_FHz(17)
            ls_req = gs_ParamReqIns & " " _
                & gut_Param.Str27 & ", " _
                & gut_Param.Str26 & ", '" _
                & ls_Description & "', " _
                & txt_FHz(0) & ", " & txt_FHz(1) & ", " & txt_FHz(2) & ", " & txt_FHz(3) & ", " _
                & txt_FHz(4) & ", " & txt_FHz(5) & ", " & txt_FHz(6) & ", " & txt_FHz(7) & ", " _
                & txt_FHz(8) & ", " & txt_FHz(9) & ", " & txt_FHz(10) & ", " & txt_FHz(11) & ", " _
                & txt_FHz(12) & ", " & txt_FHz(13) & ", " & txt_FHz(14) & ", " & txt_FHz(15) & ", " _
                & txt_FHz(16) & ", " & txt_FHz(17) & ", '" _
                & ls_IntFlag & "', '" & ls_DropFlag & "', '" & ls_DropDate & "'"
    End Select
    
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQLRowCount(ll_Statement, ll_lngrows)
        If ll_lngrows = 0 Then
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
            SendMessage 4, "Insert failed", gut_LangLogin.Code
            C_main.FillGrid
        Else
            Add_Table = OK
            li_Status = SQLFetch(ll_Statement)
            If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
                ls_Code = ODBCData(ll_Statement, 1)
            End If
            If lb_test = KO Then
                ls_Line = ls_Code & Chr(9) & 1 & Chr(9) & ls_Description & Chr(9) & ls_IntFlag & Chr(9) & txt_dropped
                C_main.Grid.AddItem ls_Line
                C_main.Grid.Row = C_main.Grid.Rows - 1
            Else
                'concatenated field
                gut_Param.Str28 = ls_Description
                'curve ID
                gut_Param.Str29 = ls_Code
            End If
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        End If
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 4, "Insert failed", gut_LangLogin.Code
    End If
End If
Exit Function

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Function
Private Function Dlt_Table()

Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long

On Error GoTo suite

Dlt_Table = KO
gb_Return = OK
MouseOn
If SendMessage(5, "Delete record ?", gut_LangLogin.Code, vbQuestion + vbYesNo, "Delete ") = vbYes Then
    MouseOff
    Select Case gut_Param.Str1
        Case "AcoustAW", "AcoustRW", "AcoustNRC", "AcoustDncW", "AcoustCAC", "Dnfw", "RedInd", "Rain", "EquivSoundAbs"
            ls_req = gs_ParamReqDel & " " & gs_TableCode
    End Select
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQLRowCount(ll_Statement, ll_lngrows)
        If ll_lngrows = 0 Then
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
            SendMessage 7, "Delete failed : concurrency problem ?", gut_LangLogin.Code
            C_main.FillGrid
        Else
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
            Dlt_Table = OK
            C_main.Grid.RemoveItem C_main.Grid.Row
        End If
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 6, "Delete failed ", gut_LangLogin.Code
    End If
End If
MouseOff
Exit Function

suite:
Select Case Err
Case 30015
    C_main.FillGrid
Case Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Select
End Function

Private Function Upd_Table()

Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ll_lngrows As Long
Dim ls_Line As String
Dim ls_IntFlag As String
Dim ls_DropFlag As String
Dim ls_DropDate As String
Dim ls_Description As String

Upd_Table = KO

On Error GoTo suite

gb_Return = OK
If Control Then
    If chk_Int.Value = 1 Then ls_IntFlag = "X"
    If txt_dropped <> "" Then
        ls_DropFlag = "X"
        ls_DropDate = FormatD(txt_dropped, "mm/dd/yyyy")
    End If
    Select Case gut_Param.Str1
    Case "AcoustAW", "AcoustRW", "AcoustNRC", "AcoustDncW", "AcoustCAC", "Dnfw", "RedInd", "Rain", "EquivSoundAbs"
        ls_Description = txt_FHz(0) & " / " _
                        & txt_FHz(1) & " / " _
                        & txt_FHz(2) & " / " _
                        & txt_FHz(3) & " / " _
                        & txt_FHz(4) & " / " _
                        & txt_FHz(5)
        ls_req = gs_ParamReqUpd & " " & gs_TableCode & ", " _
                & gs_TableCode2 & ", '" _
                & ls_Description & "', " _
                & txt_FHz(0) & ", " & txt_FHz(1) & ", " _
                & txt_FHz(2) & ", " & txt_FHz(3) & ", " _
                & txt_FHz(4) & ", " & txt_FHz(5) & ", " _
                & "0, 0, 0, 0, '" _
                & ls_IntFlag & "', '" _
                & ls_DropFlag & "', '" _
                & ls_DropDate & "'"
    Case "Test_6"
            ls_Description = txt_FHz(0) & " / " _
                        & txt_FHz(1) & " / " _
                        & txt_FHz(2) & " / " _
                        & txt_FHz(3) & " / " _
                        & txt_FHz(4) & " / " _
                        & txt_FHz(5)
            ls_req = gs_ParamReqUpd & " " _
                & gut_Param.Str29 & ", " _
                & gut_Param.Str25 & ", '" _
                & ls_Description & "', " _
                & txt_FHz(0) & ", " & txt_FHz(1) & ", " _
                & txt_FHz(2) & ", " & txt_FHz(3) & ", " _
                & txt_FHz(4) & ", " & txt_FHz(5) & ", '" _
                & ls_IntFlag & "', '" _
                & ls_DropFlag & "', '" _
                & ls_DropDate & "'"

        Case "Test_18"
            ls_Description = txt_FHz(0) & " / " & txt_FHz(1) & " / " & txt_FHz(2) & " / " & txt_FHz(3) & " / " _
                & txt_FHz(4) & " / " & txt_FHz(5) & " / " & txt_FHz(6) & " / " & txt_FHz(7) & " / " _
                & txt_FHz(8) & " / " & txt_FHz(9) & " / " & txt_FHz(10) & " / " & txt_FHz(11) & " / " _
                & txt_FHz(12) & " / " & txt_FHz(13) & " / " & txt_FHz(14) & " / " & txt_FHz(15) & " / " _
                & txt_FHz(16) & " / " & txt_FHz(17)
            ls_req = gs_ParamReqUpd & " " _
                & gut_Param.Str29 & ", " _
                & gut_Param.Str25 & ", '" _
                & ls_Description & "', " _
                & txt_FHz(0) & ", " & txt_FHz(1) & ", " & txt_FHz(2) & ", " & txt_FHz(3) & ", " _
                & txt_FHz(4) & ", " & txt_FHz(5) & ", " & txt_FHz(6) & ", " & txt_FHz(7) & ", " _
                & txt_FHz(8) & ", " & txt_FHz(9) & ", " & txt_FHz(10) & ", " & txt_FHz(11) & ", " _
                & txt_FHz(12) & ", " & txt_FHz(13) & ", " & txt_FHz(14) & ", " & txt_FHz(15) & ", " _
                & txt_FHz(16) & ", " & txt_FHz(17) & ", '" _
                & ls_IntFlag & "', '" & ls_DropFlag & "', '" & ls_DropDate & "'"
    End Select
    
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQLRowCount(ll_Statement, ll_lngrows)
        Select Case gut_Param.Str1
        Case "AcoustAW", "AcoustRW", "AcoustNRC", "AcoustDncW", "AcoustCAC", "Dnfw", "RedInd", "Rain", "EquivSoundAbs"
            If ll_lngrows = 0 Then
                li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
                SendMessage 2, "Another user change the record", gut_LangLogin.Code
                C_main.FillGrid
            Else
                li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
                Upd_Table = OK
                C_main.Grid.RemoveItem C_main.Grid.Row
                ls_Line = gs_TableCode & Chr(9) & CInt(gs_TableCode2) + 1 & Chr(9) & ls_Description & Chr(9) & ls_IntFlag & Chr(9) & txt_dropped
                C_main.Grid.AddItem ls_Line, C_main.Grid.Row
            End If
        Case "Test_6", "Test_18"
            If ll_lngrows = 0 Then
                li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
                SendMessage 2, "Another user change the record", gut_LangLogin.Code
            Else
                li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
                Upd_Table = OK
                ' add one to iconcurrency
                gut_Param.Str25 = gut_Param.Str25 + 1
            End If
        End Select
        
    Else
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 3, "Update failed", gut_LangLogin.Code
    End If
End If
Exit Function

suite:
Select Case Err
Case 30015
    C_main.FillGrid
Case Else
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Select
End Function
Private Function Control() As Boolean

Dim li_Count As Integer

Control = KO
Select Case gut_Param.Str1
Case "AcoustAW", "AcoustNRC", "EquivSoundAbs"
    For li_Count = 0 To 5
        If Not CheckNumericValue(txt_FHz(li_Count)) Or txt_FHz(li_Count).Text = "" Then     ' 28/1/2008 JN fixt task 462
            If gs_Action <> "Delete" And gs_Action <> "MoreInfo" Then
                txt_FHz(li_Count).SetFocus
            End If
            SendMessage 12, "Value must be numeric", gut_LangLogin.Code
            Exit Function
        End If
        If Not Check_Interval(txt_FHz(li_Count), 0, 1.2) Then
            If gs_Action <> "Delete" And gs_Action <> "MoreInfo" Then
                txt_FHz(li_Count).SetFocus
            End If
            SendMessage 104, "Value must be between 0 and 1.2", gut_LangLogin.Code
            Exit Function
        End If
    Next
Case "AcoustRW", "AcoustDncW", "AcoustCAC", "Dnfw", "RedInd", "Rain"
    For li_Count = 0 To 5
        If Not CheckNumericValue(txt_FHz(li_Count)) Or txt_FHz(li_Count).Text = "" Then     ' 28/1/2008 JN fixt task 462
            If gs_Action <> "Delete" And gs_Action <> "MoreInfo" Then
                 txt_FHz(li_Count).SetFocus
            End If
            SendMessage 12, "Value must be numeric", gut_LangLogin.Code
            Exit Function
        End If
        If Not Check_Interval(txt_FHz(li_Count), 10, 80) Then
            If gs_Action <> "Delete" And gs_Action <> "MoreInfo" Then
                txt_FHz(li_Count).SetFocus
            End If
            SendMessage 105, "Value must be between 10 and 80", gut_LangLogin.Code
            Exit Function
        End If
    Next
Case "Test_6"
    For li_Count = 0 To 5
        If Not CheckNumericValue(txt_FHz(li_Count)) Or txt_FHz(li_Count).Text = "" Then     ' 28/1/2008 JN fixt task 462
            If gs_Action <> "Delete" And gs_Action <> "MoreInfo" Then
                txt_FHz(li_Count).SetFocus
            End If
            SendMessage 12, "Value must be numeric", gut_LangLogin.Code
            Exit Function
        End If
    Next

Case "Test_18"
    For li_Count = 0 To 17
        If Not CheckNumericValue(txt_FHz(li_Count)) Or txt_FHz(li_Count).Text = "" Then     ' 28/1/2008 JN fixt task 462
            If gs_Action <> "Delete" And gs_Action <> "MoreInfo" Then
                txt_FHz(li_Count).SetFocus
            End If
            SendMessage 12, "Value must be numeric", gut_LangLogin.Code
            Exit Function
        End If
    Next

End Select
Control = OK

End Function

Private Sub Graph_Init()
    Select Case gut_Param.Str1
    Case "AcoustAW", "AcoustNRC", "Test_6", "EquivSoundAbs"
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Minimum = 0
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Maximum = 1.2
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.MajorDivision = 6
        cha_Curve.ShowLegend = False
        cha_Curve.Plot.AutoLayout = True
        cha_Curve.AllowSelections = True
    Case "AcoustRW", "AcoustDncW", "AcoustCAC", "Dnfw", "RedInd", "Rain"
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Minimum = 10
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Maximum = 80
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.MajorDivision = 7
        cha_Curve.ShowLegend = False
        cha_Curve.Plot.AutoLayout = True
        cha_Curve.AllowSelections = True
    Case "Test_18"
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Minimum = 0
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Maximum = 1.2
        cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.MajorDivision = 6
        cha_Curve.ShowLegend = False
        cha_Curve.Plot.AutoLayout = True
        cha_Curve.AllowSelections = True
    End Select
End Sub

Private Function Graph_Draw()

Dim lv_Data() As Variant
Dim ld_value As Double
Dim li_Index As Integer, li_Count As Integer

If Control Then
    Select Case gut_Param.Str1
    Case "AcoustAW", "AcoustRW", "AcoustNRC", "AcoustDncW", "AcoustCAC", "Test_6", "Dnfw", "RedInd", "Rain", "EquivSoundAbs"
        li_Count = 6
    Case "Test_18"
        li_Count = 18
    Case Else
        li_Count = 10
    End Select
    
    ReDim lv_Data(1 To li_Count, 1 To 2)
    
    For li_Index = 1 To li_Count
        lv_Data(li_Index, 1) = CStr(lbl_FHz(li_Index - 1).Caption)
        ld_value = Val(txt_FHz(li_Index - 1))
        If (ld_value > 10#) And (cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Maximum < 10#) Then
            cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Maximum = 80#
            cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Minimum = 10#
            cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.MajorDivision = 7
        End If
        If (ld_value > cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Maximum) Then
            cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Maximum = ld_value
        ElseIf (ld_value < cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Minimum) Then
            cha_Curve.Plot.axis(VtChAxisIdY).ValueScale.Minimum = ld_value
        End If
        lv_Data(li_Index, 2) = Val(txt_FHz(li_Index - 1))
    Next li_Index
    cha_Curve.ChartData = lv_Data
End If

End Function

Private Function Check_Interval(txt_val As String, lr_Min As Single, lr_Max As Single) As Boolean

Check_Interval = KO
If Val(txt_val) >= lr_Min And Val(txt_val) <= lr_Max Then
    Check_Interval = OK
End If

End Function

