VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form C_Selection 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Selection"
   ClientHeight    =   5445
   ClientLeft      =   1665
   ClientTop       =   1740
   ClientWidth     =   9720
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   5445
   ScaleWidth      =   9720
   ShowInTaskbar   =   0   'False
   Begin VB.Frame lbl_Like 
      Height          =   1515
      Left            =   60
      TabIndex        =   25
      Top             =   3060
      Width           =   3555
      Begin VB.OptionButton Opt_Like3 
         Caption         =   "End by"
         Height          =   252
         Left            =   120
         TabIndex        =   29
         Top             =   840
         Width           =   1812
      End
      Begin VB.OptionButton Opt_Like1 
         Caption         =   "Begin by"
         Height          =   252
         Left            =   120
         TabIndex        =   28
         Top             =   240
         Value           =   -1  'True
         Width           =   1812
      End
      Begin VB.OptionButton Opt_Like2 
         Caption         =   "Contains"
         Height          =   252
         Left            =   120
         TabIndex        =   27
         Top             =   540
         Width           =   1812
      End
      Begin VB.TextBox txt_Like 
         BackColor       =   &H00FFFFFF&
         ForeColor       =   &H00FF0000&
         Height          =   288
         Left            =   120
         TabIndex        =   26
         Top             =   1140
         Width           =   3315
      End
   End
   Begin VB.Frame frm_Action 
      Height          =   732
      Left            =   60
      TabIndex        =   22
      Top             =   660
      Width           =   3555
      Begin VB.OptionButton opt_List 
         Caption         =   "List"
         Height          =   252
         Left            =   120
         TabIndex        =   24
         Top             =   300
         Value           =   -1  'True
         Width           =   1512
      End
      Begin VB.OptionButton opt_Reset 
         Caption         =   "Reset"
         Height          =   252
         Left            =   1680
         TabIndex        =   23
         Top             =   300
         Width           =   1452
      End
   End
   Begin VB.ListBox lst_ResultCode 
      Height          =   645
      ItemData        =   "CUSTOMER.frx":0000
      Left            =   4920
      List            =   "CUSTOMER.frx":0002
      TabIndex        =   17
      Top             =   3900
      Visible         =   0   'False
      Width           =   756
   End
   Begin VB.ListBox lst_ResultConcurrency 
      Height          =   645
      ItemData        =   "CUSTOMER.frx":0004
      Left            =   4500
      List            =   "CUSTOMER.frx":0006
      TabIndex        =   19
      Top             =   3900
      Visible         =   0   'False
      Width           =   756
   End
   Begin VB.TextBox txt_ResultConcurrency 
      BackColor       =   &H00C0C0C0&
      ForeColor       =   &H00FF0000&
      Height          =   288
      Left            =   6240
      Locked          =   -1  'True
      MaxLength       =   40
      TabIndex        =   18
      Top             =   660
      Visible         =   0   'False
      Width           =   492
   End
   Begin VB.PictureBox ButtonBox 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   665
      Left            =   0
      ScaleHeight     =   630
      ScaleWidth      =   2565
      TabIndex        =   11
      Top             =   4740
      Width           =   2592
      Begin VB.PictureBox pic_delete 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DrawStyle       =   5  'Transparent
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   1680
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   15
         Top             =   60
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.PictureBox pic_upd 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "CUSTOMER.frx":0008
         DrawStyle       =   5  'Transparent
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   800
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   14
         Top             =   60
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.PictureBox pic_add 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "CUSTOMER.frx":0312
         DrawStyle       =   5  'Transparent
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   100
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   13
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_help 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "CUSTOMER.frx":061C
         DrawStyle       =   5  'Transparent
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   8640
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   12
         Top             =   120
         Width           =   384
      End
   End
   Begin VB.OptionButton opt_2 
      Caption         =   "Claim customer"
      Height          =   252
      Left            =   180
      TabIndex        =   10
      Top             =   2040
      Width           =   1812
   End
   Begin VB.OptionButton opt_1 
      Caption         =   "SAP customer"
      Height          =   252
      Left            =   180
      TabIndex        =   9
      Top             =   1740
      Width           =   1812
   End
   Begin VB.PictureBox pic_pic 
      BackColor       =   &H00FFFFFF&
      Height          =   665
      Left            =   0
      ScaleHeight     =   600
      ScaleWidth      =   9630
      TabIndex        =   0
      Top             =   0
      Width           =   9690
      Begin VB.PictureBox pic_UnDo 
         Appearance      =   0  'Flat
         AutoRedraw      =   -1  'True
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   600
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   5
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_quit 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         DragIcon        =   "CUSTOMER.frx":0926
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   1800
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   4
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_Save 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "CUSTOMER.frx":0C30
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            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        =   3
         Top             =   60
         Width           =   480
      End
      Begin VB.PictureBox pic_search 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         DragIcon        =   "CUSTOMER.frx":0F3A
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   1200
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   2
         Top             =   60
         Width           =   480
      End
   End
   Begin VB.ListBox lst_ResultComp 
      Height          =   645
      ItemData        =   "CUSTOMER.frx":1244
      Left            =   4080
      List            =   "CUSTOMER.frx":1246
      TabIndex        =   20
      Top             =   3900
      Visible         =   0   'False
      Width           =   756
   End
   Begin VB.TextBox txt_ResultComp 
      BackColor       =   &H00C0C0C0&
      ForeColor       =   &H00FF0000&
      Height          =   288
      Left            =   5940
      Locked          =   -1  'True
      MaxLength       =   40
      TabIndex        =   21
      Top             =   660
      Visible         =   0   'False
      Width           =   492
   End
   Begin VB.TextBox txt_ResultCode 
      BackColor       =   &H00C0C0C0&
      ForeColor       =   &H00FF0000&
      Height          =   288
      Left            =   5640
      Locked          =   -1  'True
      MaxLength       =   40
      TabIndex        =   16
      Top             =   660
      Visible         =   0   'False
      Width           =   492
   End
   Begin VB.TextBox txt_Result 
      BackColor       =   &H00C0C0C0&
      ForeColor       =   &H00FF0000&
      Height          =   288
      Left            =   3660
      Locked          =   -1  'True
      TabIndex        =   6
      Top             =   660
      Width           =   6015
   End
   Begin VB.ListBox lst_Result 
      Height          =   4350
      ItemData        =   "CUSTOMER.frx":1248
      Left            =   3660
      List            =   "CUSTOMER.frx":124A
      TabIndex        =   7
      Top             =   1020
      Width           =   6030
   End
   Begin MSForms.ComboBox cbo_1 
      Height          =   315
      Left            =   1680
      TabIndex        =   1
      Top             =   2580
      Width           =   1935
      VariousPropertyBits=   679479323
      DisplayStyle    =   7
      Size            =   "3413;556"
      ListRows        =   12
      MatchEntry      =   0
      ShowDropButtonWhen=   2
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
   End
   Begin VB.Label lbl_1 
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   2580
      Width           =   1530
   End
End
Attribute VB_Name = "C_Selection"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
'Comment added by JJB in order to understand this window work 12 avril 2000
'gut_Param.Str1 : if equal to "" the opt1 and opt2 is not visible
'gut_Param2.Str1: param that define what information must be seen
'gut_Param.Str2 : System name for customer process
'gut_Param.Str3 : stored procedure for deleting data
'gut_Param.Str4 : request for the screen constants
'gut_Param.Str5 : code of the default value in the combo
'gut_Param.Str6 : description of the default value in the combo


Dim ms_Type As String
Dim ms_1 As String
Dim mb_1 As Boolean
Dim mb_ActualUpdated As Boolean

Public ms_CustTCode As String
Public ms_CustTDesc As String
Public mi_SysCode As Integer
Public ms_ContactTitle As String
Public ms_Email As String

Public s_OldCode As String ' must be initialized to the actual code (because if the user update the caracteristics of the data the calling window must be updated)
                            ' this param is only used by claim_project, quotation_customer and quotation_project. Other windows use a different scheme.
Public s_InitialLike As String  'if not equal to "" the search with like value is filed when the form is loaded and the respond is available in the list

Private Sub FillCsts()

Dim ls_Field As String
Dim ls_Text As String
Dim ls_Language As String
Dim ll_Statement As Long
Dim li_Status As Integer

On Error GoTo suite
   
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, gut_Param.Str4) 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 = ODBCData(ll_Statement, 2)
        Select Case ls_Field
        Case "title": Caption = ls_Text
        Case "opt_1": opt_1.Caption = ls_Text
        Case "opt_2": opt_2.Caption = ls_Text
        Case "opt_Like1": Opt_Like1.Caption = ls_Text
        Case "opt_Like2": Opt_Like2.Caption = ls_Text
        Case "opt_Like3": Opt_Like3.Caption = ls_Text
        Case "opt_2": opt_2.Caption = ls_Text
        Case "opt_List": opt_List.Caption = ls_Text
        Case "opt_Reset": opt_Reset.Caption = ls_Text
        Case "lbl_1": lbl_1 = ls_Text
        Case "lbl_Like": lbl_Like = 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 GetProjectDetail()

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

On Error GoTo suite
    
If opt_List Then
    ls_req = "EXEC Claim_Project_dtl " & txt_ResultCode
    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
            gut_Param2.Str4 = txt_ResultCode
            gut_Param2.Str5 = ODBCData(ll_Statement, 1)
            gut_Param2.Str6 = ODBCData(ll_Statement, 2)
            gut_Param2.Str7 = ODBCData(ll_Statement, 3)
            gut_Param2.Str8 = ODBCData(ll_Statement, 4)
            gut_Param2.Str9 = ODBCData(ll_Statement, 5)
            gut_Param2.Str10 = ODBCData(ll_Statement, 6)
            gut_Param2.Str11 = ODBCData(ll_Statement, 7)
            gut_Param2.Str12 = ODBCData(ll_Statement, 8)
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Else
    gut_Param2.Str4 = "0"
    gut_Param2.Str5 = "0"
    gut_Param2.Str6 = ""
    gut_Param2.Str7 = ""
    gut_Param2.Str8 = ""
    gut_Param2.Str9 = ""
    gut_Param2.Str10 = ""
    gut_Param2.Str11 = ""
    gut_Param2.Str12 = ""
End If
Exit Sub

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

Private Sub GetQuotationProjectDetail()

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

On Error GoTo suite


    
If opt_List Then
    ls_req = "EXEC Sales_Project_t_dtl3 " & txt_ResultCode & ", '" & 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
            gut_Param2.Str4 = txt_ResultCode
            gut_Param2.Str6 = ODBCData(ll_Statement, 1) 'desc
            gut_Param2.Str7 = ODBCData(ll_Statement, 2) 'town
            gut_Param2.Str8 = ODBCData(ll_Statement, 3) 'country
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Else
    gut_Param2.Str4 = "0"
    'gut_Param2.Str5 = "0"
    gut_Param2.Str6 = ""
    gut_Param2.Str7 = ""
    gut_Param2.Str8 = ""
    'gut_Param2.Str9 = ""
    'gut_Param2.Str10 = ""
    'gut_Param2.Str11 = ""
    'gut_Param2.Str12 = ""
End If
Exit Sub

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

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

On Error GoTo suite
    
If opt_List Then
    ls_req = "EXEC Claim_Customer_dtl " & txt_ResultCode
    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
            gut_Param2.Str4 = txt_ResultCode
            gut_Param2.Str5 = ODBCData(ll_Statement, 1)
            gut_Param2.Str6 = ODBCData(ll_Statement, 2)
            gut_Param2.Str7 = ODBCData(ll_Statement, 3)
            gut_Param2.Str8 = ODBCData(ll_Statement, 4)
            gut_Param2.Str9 = ODBCData(ll_Statement, 5)
            gut_Param2.Str10 = ODBCData(ll_Statement, 6)
            gut_Param2.Str11 = ODBCData(ll_Statement, 7)
            gut_Param2.Str12 = ODBCData(ll_Statement, 8)
            gut_Param2.Str13 = ODBCData(ll_Statement, 9)
            gut_Param2.Str14 = ODBCData(ll_Statement, 10)
            gut_Param2.Str15 = ODBCData(ll_Statement, 11)
            gut_Param2.Str16 = ""
            ms_CustTCode = ODBCData(ll_Statement, 12)
            ms_CustTDesc = ODBCData(ll_Statement, 13)
            mi_SysCode = Formatage2(ODBCDataInt(ll_Statement, 14))
            ms_ContactTitle = ODBCData(ll_Statement, 15)
            C_address_mtnc.ms_CompCode = ODBCData(ll_Statement, 16)
            ms_Email = ODBCData(ll_Statement, 17)
            C_address_mtnc.ms_CompanyName = ODBCData(ll_Statement, 18)
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Else
    gut_Param2.Str4 = "0"
    gut_Param2.Str5 = "0"
    gut_Param2.Str6 = ""
    gut_Param2.Str7 = ""
    gut_Param2.Str8 = ""
    gut_Param2.Str9 = ""
    gut_Param2.Str10 = ""
    gut_Param2.Str11 = ""
    gut_Param2.Str12 = ""
    gut_Param2.Str13 = ""
    gut_Param2.Str14 = ""
    gut_Param2.Str15 = ""
    gut_Param2.Str16 = ""
    ms_CustTCode = ""
    ms_CustTDesc = ""
    mi_SysCode = 0
    ms_ContactTitle = ""
    ms_Email = ""
End If
C_address_mtnc.ms_CTCode = gut_Param2.Str11
Exit Sub

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

Dim ls_req As String
Dim ll_Statement As Long
Dim ll_lngrows As Long
Dim li_Status As Integer
   
On Error GoTo suite

lst_Result.Clear
txt_ResultCode = ""
lst_ResultCode.Clear
txt_ResultConcurrency = ""
lst_ResultConcurrency.Clear
txt_ResultComp = ""
lst_ResultComp.Clear

ls_req = "EXEC Customer_lst '" & ms_Type & "','" _
        & ms_1 & "', '" _
        & QuoteParam(txt_like) & "' "
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
        lst_ResultCode.AddItem ODBCData(ll_Statement, 1)
        lst_ResultComp.AddItem ODBCData(ll_Statement, 2)
        lst_Result.AddItem lst_ResultCode.List(lst_ResultCode.ListCount - 1) & " :  " & ODBCData(ll_Statement, 3)
    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 GetResult()

Dim ls_req As String
Dim ll_Statement As Long
Dim ll_lngrows As Long
Dim li_Status As Integer
Dim li_Count As Integer
Dim ls_OptLike As String
   
On Error GoTo suite
   

If Opt_Like1.value Then
    ls_OptLike = "B"
Else
    If Opt_Like2.value Then
        ls_OptLike = "C"
    Else
        ls_OptLike = "E"
    End If
End If


Select Case gut_Param2.Str1
Case "Claim_Customer"
    ls_req = "EXEC Customer_lst '" & ms_Type & "','" _
        & ms_1 & "', '" _
        & QuoteParam(txt_like) & "',  '" & ls_OptLike & "'"
Case "Quotation_Customer"
    ls_req = "EXEC Customer_lst '" & ms_Type & "','" _
        & ms_1 & "', '" _
        & QuoteParam(txt_like) & "',  '" & ls_OptLike & "'"
Case "Claim_Project"
    ls_req = "EXEC sales_Project_lst '" & ms_1 & "', '" _
        & QuoteParam(txt_like) & "', '" & ls_OptLike & "'"
Case "Quotation_Project"
    ls_req = "EXEC sales_Project_lst '" & ms_1 & "', '" _
        & QuoteParam(txt_like) & "', '" & ls_OptLike & "'"
End Select
If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
    li_Status = SQL_SUCCESS
Else
    li_Status = SQL_ERROR
End If
li_Count = 0
Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
    If li_Count > 100 And cbo_1.ListIndex = -1 Then
        li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
        SendMessage 64, "Too many records. Please give more restrictive criteria.", gut_LangLogin.Code
        Exit Do
    End If
    li_Status = SQLFetch(ll_Statement)
    If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
        li_Count = li_Count + 1
        If (gut_Param2.Str1 = "Claim_Customer" Or gut_Param2.Str1 = "Quotation_Customer") And opt_1 Then
            lst_ResultCode.AddItem ODBCData(ll_Statement, 1)
            lst_ResultComp.AddItem ODBCData(ll_Statement, 2)
            lst_Result.AddItem lst_ResultCode.List(lst_ResultCode.ListCount - 1) & " :  " & ODBCData(ll_Statement, 3)
        Else
            lst_ResultCode.AddItem ODBCData(ll_Statement, 1)
            lst_Result.AddItem ODBCData(ll_Statement, 2)
            lst_ResultConcurrency.AddItem ODBCData(ll_Statement, 3)
        End If
    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 CopyCustomer()

Dim ls_req As String
Dim ll_Statement As Long
Dim ll_lngrows As Long
Dim li_Status As Integer
   
On Error GoTo suite
   
ls_req = "EXEC Claim_Customer_SAP_ins '" & txt_ResultCode & "','" _
    & txt_ResultComp & "','" & gut_Param.Str2 & "'"
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
        gut_Param2.Str4 = ODBCData(ll_Statement, 1)
        txt_ResultCode = gut_Param2.Str4
        gut_Param2.Str5 = ODBCData(ll_Statement, 2)
        gut_Param2.Str6 = ODBCData(ll_Statement, 3)
        gut_Param2.Str7 = ODBCData(ll_Statement, 4)
        gut_Param2.Str8 = ODBCData(ll_Statement, 5)
        gut_Param2.Str9 = ODBCData(ll_Statement, 6)
        gut_Param2.Str10 = ODBCData(ll_Statement, 7)
        gut_Param2.Str11 = ODBCData(ll_Statement, 8)
        gut_Param2.Str12 = ODBCData(ll_Statement, 9)
        gut_Param2.Str13 = ODBCData(ll_Statement, 10)
        gut_Param2.Str14 = ODBCData(ll_Statement, 11)
        gut_Param2.Str15 = ODBCData(ll_Statement, 12)
        gut_Param2.Str16 = lst_ResultCode.List(lst_Result.ListIndex)
        C_address_mtnc.ms_CompCode = ODBCData(ll_Statement, 13)
        C_address_mtnc.ms_CTCode = ODBCData(ll_Statement, 14)
        C_address_mtnc.ms_CompanyName = ODBCData(ll_Statement, 15)
    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 cbo_1_Click()

MouseOff
lst_Result.Clear
txt_Result = ""
lst_ResultCode.Clear
txt_ResultCode = ""
lst_ResultConcurrency.Clear
txt_ResultConcurrency = ""
lst_ResultComp.Clear
txt_ResultComp = ""
MouseOn

End Sub

Private Sub Form_Load()
Dim ls_req As String

On Error GoTo suite

MouseOff

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

pic_Save.Picture = LoadResPicture(RES_OK, 1)
pic_Quit.Picture = LoadResPicture(RES_QUIT, 1)
pic_search.Picture = LoadResPicture(RES_SEARCH, 1)
pic_Undo.Picture = LoadResPicture(RES_CANCEL, 1)
pic_add.Picture = LoadResPicture(RES_ADD, 1)
pic_delete.Picture = LoadResPicture(RES_DELETE, 1)
pic_upd.Picture = LoadResPicture(RES_MODIFY, 1)
C_address_mtnc.ms_CTCode = ""
C_address_mtnc.ms_CompCode = ""
ms_CustTCode = ""

mb_ActualUpdated = KO
If gut_Param.Str1 = "" Then
    opt_1.Visible = KO
    opt_2.Visible = KO
End If
FillCsts
mb_1 = KO
opt_2 = OK
opt_List = OK

cbo_1.Clear
MCombo_AddItemCode cbo_1, "", ""
ls_req = "Countries_cbo4 '" & gut_LangLogin.Code & "'"
MCombo_Fill cbo_1, ls_req
    
If gut_Param.Str5 <> "" Then
    MCombo_CodeSelect(cbo_1) = gut_Param.Str5
End If

If Trim(s_InitialLike) <> "" Then
    txt_like = s_InitialLike
    pic_search_Click
End If
MouseOn
Exit Sub
   
suite:
StdError
End Sub

Private Sub lst_result_Click()

MouseOff
txt_Result = lst_Result
txt_ResultCode = lst_ResultCode.List(lst_Result.ListIndex)
txt_ResultConcurrency = lst_ResultConcurrency.List(lst_Result.ListIndex)
txt_ResultComp = lst_ResultComp.List(lst_Result.ListIndex)
MouseOn

End Sub

Private Sub lst_Result_DblClick()
Dim ls_OldAction As String

If opt_2.value = KO Then Exit Sub
If gut_Param2.Str1 = "Claim_Project" Or gut_Param2.Str1 = "Quotation_Project" Then
    MouseOff
    ls_OldAction = gs_Action
    gs_Action = "MoreInfo"
    Sales_project_Mtnc.s_Data_Code = txt_ResultCode
    Sales_project_Mtnc.b_UseWithCMain = KO
    Sales_project_Mtnc.show 1
    gs_Action = ls_OldAction
    MouseOn
Else
    MouseOff
    txt_Result = lst_Result
    txt_ResultCode = lst_ResultCode.List(lst_Result.ListIndex)
    txt_ResultConcurrency = lst_ResultConcurrency.List(lst_Result.ListIndex)
    txt_ResultComp = lst_ResultComp.List(lst_Result.ListIndex)
    gut_Param2.Str2 = "Detail"
    GetCustomerDetail
    C_address_mtnc.show 1
    MouseOn
End If
End Sub

Private Sub opt_1_Click()

MouseOff
ms_Type = gut_Param.Str1
txt_like = ""
txt_Result = ""
txt_ResultCode = ""
txt_ResultConcurrency = ""
txt_ResultComp = ""
lst_Result.Clear
lst_ResultCode.Clear
lst_ResultConcurrency.Clear
lst_ResultComp.Clear
ButtonBox.Visible = KO
MouseOn

End Sub
Private Sub opt_2_Click()

MouseOff
ms_Type = gut_Param.Str2
txt_like = ""
txt_Result = ""
txt_ResultCode = ""
txt_ResultConcurrency = ""
txt_ResultComp = ""
lst_Result.Clear
lst_ResultCode.Clear
lst_ResultConcurrency.Clear
lst_ResultComp.Clear
ButtonBox.Visible = OK
MouseOn

End Sub

Private Sub opt_List_Click()

MouseOff
C_Selection.Width = 9810
C_Selection.Height = 5820
MouseOn

End Sub

Private Sub opt_Reset_Click()

MouseOff
C_Selection.Width = 3656
C_Selection.Height = 1844
MouseOn

End Sub

Private Sub pic_add_Click()
Dim lb_OldReturn As String
Dim ls_OldAction As String
MouseOff
gut_Param2.Str2 = "Add"
gb_Return = KO
Select Case gut_Param2.Str1
Case "Quotation_Project"
    lb_OldReturn = gb_Return
    ls_OldAction = gs_Action
    gs_Action = "Add"
    Sales_project_Mtnc.s_Data_Code = ""
    Sales_project_Mtnc.b_UseWithCMain = KO
    Sales_project_Mtnc.show 1
    gs_Action = ls_OldAction
    If gb_Return Then
        txt_like = ""
        lst_Result.Clear
        lst_ResultCode.Clear
        lst_ResultConcurrency.Clear
        lst_ResultComp.Clear
        txt_Result = Sales_project_Mtnc.s_Data_Desc
        txt_ResultCode = Sales_project_Mtnc.s_Data_Code
        txt_ResultConcurrency = Sales_project_Mtnc.i_Data_iConcurrency
    End If
     gb_Return = lb_OldReturn
Case "Claim_Project"
    lb_OldReturn = gb_Return
    ls_OldAction = gs_Action
    gs_Action = "Add"
    Sales_project_Mtnc.s_Data_Code = ""
    Sales_project_Mtnc.b_UseWithCMain = KO
    Sales_project_Mtnc.show 1
    gs_Action = ls_OldAction
    If gb_Return Then
        txt_like = ""
        lst_Result.Clear
        lst_ResultCode.Clear
        lst_ResultConcurrency.Clear
        lst_ResultComp.Clear
        txt_Result = Sales_project_Mtnc.s_Data_Desc
        txt_ResultCode = Sales_project_Mtnc.s_Data_Code
        txt_ResultConcurrency = Sales_project_Mtnc.i_Data_iConcurrency
    End If
    gb_Return = lb_OldReturn
Case Else
'claim_customer, quotation_customer, ???
    C_address_mtnc.show 1
    If gb_Return Then
        txt_like = ""
        lst_Result.Clear
        lst_ResultCode.Clear
        lst_ResultConcurrency.Clear
        lst_ResultComp.Clear
        txt_Result = gut_Param2.Str6
        txt_ResultCode = gut_Param2.Str4
        txt_ResultConcurrency = gut_Param2.Str5
    End If
End Select
MouseOn

End Sub
Private Sub pic_delete_Click()

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

On Error GoTo suite

MouseOff
If txt_Result <> "" Then
    MouseOn
    If SendMessage(5, "Delete the record ?", gut_LangLogin.Code, vbQuestion + vbYesNo, "Delete ") = vbYes Then
        MouseOff
        ls_req = gut_Param.Str3 _
          & txt_ResultCode & ", " _
          & txt_ResultConcurrency
        If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
            li_Status = SQLRowCount(ll_Statement, ll_lngrows)
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
            If ll_lngrows = 0 Then
                SendMessage 7, "Delete failed : concurrency problem ?", gut_LangLogin.Code
            Else
                txt_ResultConcurrency = ""
                txt_Result = ""
                If lst_Result.ListIndex <> -1 Then
                    lst_ResultCode.RemoveItem lst_Result.ListIndex
                    lst_ResultConcurrency.RemoveItem lst_Result.ListIndex
                    lst_Result.RemoveItem lst_Result.ListIndex
                End If
            End If
        Else
            li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
            SendMessage 6, "Delete failed", gut_LangLogin.Code
        End If
    End If
Else
    SendMessage 1, "Please, first select a record.", gut_LangLogin.Code
End If
MouseOn
Exit Sub

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

MouseOff
If mb_ActualUpdated Then
    Select Case gut_Param2.Str1
    Case "Claim_Project"
        GetProjectDetail
    Case "Claim_Customer"
        'txt_ResultCode = gut_Param.Str7
        GetCustomerDetail
    Case "Quotation_Customer"
        'txt_ResultCode = gut_Param.Str7
        GetCustomerDetail
    Case "Quotation_Project"
        GetQuotationProjectDetail
    End Select
    gb_Return = OK
Else
    gb_Return = KO
End If
Unload Me
MouseOn

End Sub
Private Sub pic_Save_Click()
Dim ls_OldAction As String
MouseOff
If txt_Result = "" And opt_List Then
    SendMessage 1, "Please, first select a record.", gut_LangLogin.Code
Else
    Select Case gut_Param2.Str1
    Case "Claim_Project"
        GetProjectDetail
    Case "Claim_Customer"
        If opt_1 And opt_List Then
            CopyCustomer
        Else
            GetCustomerDetail
        End If
    Case "Quotation_Customer"
        If opt_1 And opt_List Then
            CopyCustomer
        Else
            GetCustomerDetail
        End If
        If C_address_mtnc.ms_CTCode = "" Or C_address_mtnc.ms_CompCode = "" Then
            If opt_1 Then GetResult2
            pic_upd_Click
            MouseOn
            If gb_Return = KO Then
                Exit Sub
            End If
        End If
    Case "Quotation_Project"
        GetQuotationProjectDetail
        If gut_Param2.Str7 = "" Or gut_Param2.Str8 = "" Then
            ls_OldAction = gs_Action
            gs_Action = "Update"
            pic_upd_Click
            gs_Action = ls_OldAction
            MouseOn
            If gb_Return = KO Then
                Exit Sub
            End If
        End If
    End Select
'    ' Only for quotation module
'    If gut_Param.Str2 = "Quotation" Then
'        If C_address_mtnc.ms_CTCode = "" Or C_address_mtnc.ms_CompCode = "" Then
'            If opt_1 Then GetResult2
'            pic_upd_Click
'            MouseOn
'            If gb_Return = KO Then
'                Exit Sub
'            End If
'        End If
'    End If

    gb_Return = OK
    Unload Me
End If
MouseOn

End Sub
Private Sub pic_search_Click()

On Error GoTo suite

MouseOff
txt_Result = ""
lst_Result.Clear
txt_ResultCode = ""
lst_ResultCode.Clear
txt_ResultConcurrency = ""
lst_ResultConcurrency.Clear
txt_ResultComp = ""
lst_ResultComp.Clear
If cbo_1.ListIndex = -1 Then
    ms_1 = ""
Else
    ms_1 = MCombo_GetCode(cbo_1)
End If
GetResult
MouseOn
Exit Sub

suite:
StdError
End Sub

Private Sub pic_UnDo_Click()

MouseOff
cbo_1.ListIndex = -1
txt_like = ""
txt_Result = ""
lst_Result.Clear
txt_ResultCode = ""
lst_ResultCode.Clear
txt_ResultConcurrency = ""
lst_ResultConcurrency.Clear
txt_ResultComp = ""
lst_ResultComp.Clear
MouseOn

End Sub

Private Sub pic_upd_Click()
Dim ls_OldAction As String
Dim li_Index As Integer

MouseOff
gut_Param2.Str2 = "Update"
If txt_Result <> "" Then
    Select Case gut_Param2.Str1
    'Case "Claim_Project"
        'GetProjectDetail
    Case "Claim_Customer"
        GetCustomerDetail
    Case "Quotation_Customer"
        GetCustomerDetail
    End Select
    gb_Return = KO
    Select Case gut_Param2.Str1
    Case "Quotation_Project"
        ls_OldAction = gs_Action
        gs_Action = "Update"
        Sales_project_Mtnc.s_Data_Code = txt_ResultCode
        Sales_project_Mtnc.b_UseWithCMain = KO
        Sales_project_Mtnc.show 1
        gs_Action = ls_OldAction
        If gb_Return Then
            If txt_ResultCode = s_OldCode Then
                mb_ActualUpdated = OK
            End If
            txt_ResultConcurrency = Sales_project_Mtnc.i_Data_iConcurrency
            txt_Result = Sales_project_Mtnc.s_Data_Desc
            If lst_Result.ListIndex <> -1 Then
                li_Index = lst_Result.ListIndex
                lst_ResultConcurrency.RemoveItem li_Index
                lst_Result.RemoveItem li_Index
                lst_ResultConcurrency.AddItem Sales_project_Mtnc.i_Data_iConcurrency, li_Index
                lst_Result.AddItem Sales_project_Mtnc.s_Data_Desc, li_Index
            End If
        End If
    Case "Claim_Project"
        ls_OldAction = gs_Action
        gs_Action = "Update"
        Sales_project_Mtnc.s_Data_Code = txt_ResultCode
        Sales_project_Mtnc.b_UseWithCMain = KO
        Sales_project_Mtnc.show 1
        gs_Action = ls_OldAction
        If gb_Return Then
            If txt_ResultCode = s_OldCode Then
                mb_ActualUpdated = OK
            End If
            txt_ResultConcurrency = Sales_project_Mtnc.i_Data_iConcurrency
            txt_Result = Sales_project_Mtnc.s_Data_Desc
            If lst_Result.ListIndex <> -1 Then
                li_Index = lst_Result.ListIndex
                lst_ResultConcurrency.RemoveItem li_Index
                lst_Result.RemoveItem li_Index
                lst_ResultConcurrency.AddItem Sales_project_Mtnc.i_Data_iConcurrency, li_Index
                lst_Result.AddItem Sales_project_Mtnc.s_Data_Desc, li_Index
            End If
        End If
    Case "Quotation_Customer"
        C_address_mtnc.show 1
        If gb_Return Then
            If txt_ResultCode = s_OldCode Then
                mb_ActualUpdated = OK
            End If
            txt_ResultConcurrency = gut_Param2.Str5
            txt_Result = gut_Param2.Str6
            If lst_Result.ListIndex <> -1 Then
                li_Index = lst_Result.ListIndex
                lst_ResultConcurrency.RemoveItem li_Index
                lst_Result.RemoveItem li_Index
                lst_ResultConcurrency.AddItem gut_Param2.Str5, li_Index
                lst_Result.AddItem gut_Param2.Str6, li_Index
            End If
        End If
    Case Else
        C_address_mtnc.show 1
        If gb_Return Then
            If txt_ResultCode = gut_Param.Str7 Then
                mb_ActualUpdated = OK
            End If
            txt_ResultConcurrency = gut_Param2.Str5
            txt_Result = gut_Param2.Str6
            If lst_Result.ListIndex <> -1 Then
                li_Index = lst_Result.ListIndex
                lst_ResultConcurrency.RemoveItem li_Index
                lst_Result.RemoveItem li_Index
                lst_ResultConcurrency.AddItem gut_Param2.Str5, li_Index
                lst_Result.AddItem gut_Param2.Str6, li_Index
            End If
        End If
    End Select
Else
    SendMessage 1, "Please, first select a record.", gut_LangLogin.Code
End If
MouseOn

End Sub
Private Sub txt_Like_Change()

MouseOff
lst_Result.Clear
lst_ResultCode.Clear
lst_ResultConcurrency.Clear
txt_Result = ""
txt_ResultCode = ""
txt_ResultConcurrency = ""
MouseOn

End Sub

Private Sub txt_Result_Change()

MouseOff
If txt_Result = "" Then
    pic_upd.Visible = KO
    pic_delete.Visible = KO
Else
    pic_upd.Visible = OK
    pic_delete.Visible = OK
End If
MouseOn

End Sub


