VERSION 5.00
Begin VB.Form C_Filtre 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Filtre selection"
   ClientHeight    =   2010
   ClientLeft      =   1665
   ClientTop       =   3030
   ClientWidth     =   6060
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2010
   ScaleWidth      =   6060
   ShowInTaskbar   =   0   'False
   Begin VB.ComboBox cbo_Code4 
      Height          =   288
      Left            =   2340
      Style           =   2  'Dropdown List
      TabIndex        =   17
      Top             =   1560
      Visible         =   0   'False
      Width           =   396
   End
   Begin VB.ComboBox cbo_Code2 
      Height          =   288
      Left            =   5400
      Style           =   2  'Dropdown List
      TabIndex        =   14
      Top             =   600
      Visible         =   0   'False
      Width           =   396
   End
   Begin VB.TextBox txt_EndDate 
      ForeColor       =   &H00000000&
      Height          =   288
      Left            =   1260
      Locked          =   -1  'True
      TabIndex        =   9
      Top             =   600
      Visible         =   0   'False
      Width           =   1452
   End
   Begin VB.ComboBox cbo_Code3 
      Height          =   288
      Left            =   2340
      Style           =   2  'Dropdown List
      TabIndex        =   8
      Top             =   1080
      Visible         =   0   'False
      Width           =   396
   End
   Begin VB.TextBox txt_BeginDate 
      ForeColor       =   &H00000000&
      Height          =   288
      Left            =   1260
      Locked          =   -1  'True
      TabIndex        =   3
      Top             =   120
      Visible         =   0   'False
      Width           =   1452
   End
   Begin VB.ComboBox cbo_Code1 
      Height          =   288
      Left            =   5400
      Style           =   2  'Dropdown List
      TabIndex        =   2
      Top             =   120
      Visible         =   0   'False
      Width           =   396
   End
   Begin VB.ComboBox cbo_Desc1 
      Height          =   288
      Left            =   4320
      Style           =   2  'Dropdown List
      TabIndex        =   4
      Top             =   120
      Visible         =   0   'False
      Width           =   1692
   End
   Begin VB.ComboBox cbo_Desc3 
      Height          =   288
      Left            =   1260
      Style           =   2  'Dropdown List
      TabIndex        =   10
      Top             =   1080
      Visible         =   0   'False
      Width           =   1692
   End
   Begin VB.ComboBox cbo_Desc2 
      Height          =   288
      Left            =   4320
      Style           =   2  'Dropdown List
      TabIndex        =   15
      Top             =   600
      Visible         =   0   'False
      Width           =   1692
   End
   Begin VB.ComboBox cbo_Desc4 
      Height          =   288
      Left            =   1260
      Style           =   2  'Dropdown List
      TabIndex        =   18
      Top             =   1560
      Visible         =   0   'False
      Width           =   1692
   End
   Begin VB.CommandButton ssc_EndDate 
      Height          =   276
      Left            =   2700
      Style           =   1  'Graphical
      TabIndex        =   13
      Top             =   600
      Width           =   252
   End
   Begin VB.CommandButton ssc_BeginDate 
      Height          =   276
      Left            =   2700
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   120
      Visible         =   0   'False
      Width           =   252
   End
   Begin VB.CommandButton spp_save 
      Default         =   -1  'True
      Height          =   612
      Left            =   4440
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1200
      Width           =   612
   End
   Begin VB.CommandButton ssp_quit 
      Height          =   612
      Left            =   5160
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   1200
      Width           =   612
   End
   Begin VB.Label lbl_Combo4 
      Caption         =   "Sort by"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   60
      TabIndex        =   19
      Top             =   1560
      Visible         =   0   'False
      Width           =   1212
   End
   Begin VB.Label lbl_Combo2 
      Caption         =   "Market"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   3120
      TabIndex        =   16
      Top             =   600
      Visible         =   0   'False
      Width           =   1212
   End
   Begin VB.Label lbl_EndDate 
      Caption         =   "End date"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   60
      TabIndex        =   12
      Top             =   600
      Visible         =   0   'False
      Width           =   1212
   End
   Begin VB.Label lbl_Combo3 
      Caption         =   "Currency"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   60
      TabIndex        =   11
      Top             =   1080
      Visible         =   0   'False
      Width           =   1212
   End
   Begin VB.Label lbl_BeginDate 
      Caption         =   "Begin date"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   60
      TabIndex        =   6
      Top             =   120
      Visible         =   0   'False
      Width           =   1212
   End
   Begin VB.Label lbl_Combo1 
      Caption         =   "Plant"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   3120
      TabIndex        =   5
      Top             =   120
      Visible         =   0   'False
      Width           =   1212
   End
End
Attribute VB_Name = "C_Filtre"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mb_Combo1 As Boolean
Dim mb_Combo2 As Boolean
Dim mb_Combo3 As Boolean
Dim mb_Combo4 As Boolean
Dim ms_Combo1 As String
Dim ms_Combo2 As String
Dim ms_Combo3 As String
Dim ms_Combo4 As String

Private Sub PrepareFields()

If cbo_Desc1.ListIndex = -1 Then
    ms_Combo1 = ""
Else
    ms_Combo1 = cbo_Code1.List(cbo_Desc1.ListIndex)
End If
If cbo_Desc2.ListIndex = -1 Then
    ms_Combo2 = ""
Else
    ms_Combo2 = cbo_Code2.List(cbo_Desc2.ListIndex)
End If
If cbo_Desc3.ListIndex = -1 Then
    ms_Combo3 = ""
Else
    ms_Combo3 = cbo_Code3.List(cbo_Desc3.ListIndex)
End If
If cbo_Desc4.ListIndex = -1 Then
    ms_Combo4 = ""
Else
    ms_Combo4 = cbo_Code4.List(cbo_Desc4.ListIndex)
End If

End Sub

Private Sub cbo_Desc1_DropDown()

MouseOff
If mb_Combo1 = KO Then
    cbo_Desc1.Clear
    cbo_Code1.Clear
    FillCbo gut_Param.Str8, cbo_Code1, cbo_Desc1
    If gut_Param.Str11 = "" Then
        cbo_Desc1.AddItem "*"
        cbo_Code1.AddItem ""
    End If
    mb_Combo1 = OK
End If
MouseOn

End Sub


Private Sub Cbo_desc2_DropDown()

MouseOff
If mb_Combo2 = KO Then
    cbo_Desc2.Clear
    cbo_Code2.Clear
    FillCbo gut_Param.Str9, cbo_Code2, cbo_Desc2
    If gut_Param.Str12 = "" Then
        cbo_Desc2.AddItem "*"
        cbo_Code2.AddItem ""
    End If
    mb_Combo2 = OK
End If
MouseOn

End Sub

Private Sub Cbo_desc3_DropDown()

MouseOff
If mb_Combo3 = KO Then
    cbo_Desc3.Clear
    cbo_Code3.Clear
    FillCbo gut_Param.Str10, cbo_Code3, cbo_Desc3
    If gut_Param.Str13 = "" Then
        cbo_Desc3.AddItem "*"
        cbo_Code3.AddItem ""
    End If
    mb_Combo3 = OK
End If
MouseOn

End Sub

Private Sub Form_Load()

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)
GetCaption
DefineDimension
mb_Combo1 = KO
mb_Combo2 = KO
mb_Combo3 = KO
mb_Combo4 = KO
MouseOn

End Sub
Private Sub DefineDimension()

Height = gut_Param.Str2
cbo_Desc3.Top = gut_Param.Str3
lbl_combo3.Top = gut_Param.Str3
cbo_Desc4.Top = gut_Param.Str4
lbl_Combo4.Top = gut_Param.Str4
spp_save.Top = gut_Param.Str5
ssp_quit.Top = gut_Param.Str5
cbo_Desc1.Left = gut_Param.Str6
lbl_Combo1.Left = gut_Param.Str7

End Sub

Private Sub GetCaption()

Dim ls_Field As String
Dim ls_Text 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.Str1) 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 "lbl_BeginDate": lbl_BeginDate = ls_Text
                                    lbl_BeginDate.Visible = OK
                                    txt_BeginDate.Visible = OK
                                    ssc_BeginDate.Visible = OK
            Case "lbl_EndDate": lbl_EndDate = ls_Text
                                lbl_EndDate.Visible = OK
                                txt_EndDate.Visible = OK
                                ssc_EndDate.Visible = OK
            Case "lbl_Combo1": lbl_Combo1 = ls_Text
                                lbl_Combo1.Visible = OK
                                cbo_Desc1.Visible = OK
            Case "lbl_Combo2": lbl_Combo2 = ls_Text
                                lbl_Combo2.Visible = OK
                                cbo_Desc2.Visible = OK
            Case "lbl_Combo3": lbl_combo3 = ls_Text
                                lbl_combo3.Visible = OK
                                cbo_Desc3.Visible = OK
            Case "lbl_Combo4": lbl_Combo4 = ls_Text
                                lbl_Combo4.Visible = OK
                                cbo_Desc4.Visible = OK
            Case "Order1", "Order2", "Order3", "Order4"
                                cbo_Desc4.AddItem ls_Text
                                cbo_Code4.AddItem ls_Field
        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 spp_save_Click()

Dim li_Count As Integer

MouseOff
If Control Then
    PrepareFields
    Select Case gs_TableName
    Case "Claim_Report1"
        gs_ParamReq1 = "EXEC Claim_Report1_t_lst '" _
            & FormatD(txt_BeginDate, "mm/dd/yyyy") & "', '" _
            & FormatD(txt_EndDate, "mm/dd/yyyy") & "', '" _
            & ms_Combo4 & "', '" & ms_Combo1 & "', '" _
            & ms_Combo2 & "', '" & ms_Combo3 & "', '"
        If cbo_Desc4.ListIndex = 0 Or cbo_Desc4.ListIndex = 2 Then
            gs_ParamReq2 = "EXEC Screen_Csts main_SC, '" & gut_LangLogin.Code & "'"
        Else
            gs_ParamReq2 = "EXEC Screen_Csts main_SC2, '" & gut_LangLogin.Code & "'"
        End If
        gs_ParamReq3 = "EXEC Check_Security Claim_Report1, " & prg.LoginName
        gi_GridWidth(0) = 2000
        gi_GridWidth(1) = 1500
        gi_GridWidth(2) = 1500
        gi_GridWidth(3) = 1500
        gi_GridWidth(4) = 1500
        gi_GridWidth(5) = 1500
        gi_GridWidth(6) = 2000
        gi_GridWidth(7) = 1500
    Case "Claim_Report2"
        gs_ParamReq1 = "EXEC Claim_Report2_t_lst '" _
            & FormatD(txt_BeginDate, "mm/dd/yyyy") & "', '" _
            & FormatD(txt_EndDate, "mm/dd/yyyy") & "', '" _
            & ms_Combo4 & "', '" & ms_Combo1 & "', '" _
            & ms_Combo2 & "', '" & ms_Combo3 & "', '"
        gs_ParamReq2 = "EXEC Screen_Csts main_NA, '" & gut_LangLogin.Code & "'"
        gs_ParamReq3 = "EXEC Check_Security Claim_Report2, " & prg.LoginName
        gi_GridWidth(0) = 2000
        gi_GridWidth(1) = 1500
        gi_GridWidth(2) = 1500
        gi_GridWidth(3) = 1500
        gi_GridWidth(4) = 1500
        gi_GridWidth(5) = 1500
        gi_GridWidth(6) = 1500
        gi_GridWidth(7) = 1500
        gi_GridWidth(8) = 1500
        gi_GridWidth(9) = 1500
        gi_GridWidth(10) = 1500
        gi_GridWidth(11) = 1500
        gi_GridWidth(12) = 1500
    Case "Claim_Report3"
        gs_ParamReq1 = "EXEC Claim_Report3_t_lst '" _
            & ms_Combo3 & "', '" & ms_Combo1 & "', '"
        gs_ParamReq2 = "EXEC Screen_Csts main_SR, '" & gut_LangLogin.Code & "'"
        gs_ParamReq3 = "EXEC Check_Security Claim_Report3, " & prg.LoginName
        gi_GridWidth(0) = 1500
        gi_GridWidth(1) = 1500
        gi_GridWidth(2) = 2000
        gi_GridWidth(3) = 2000
        gi_GridWidth(4) = 2000
        gi_GridWidth(5) = 2000
        gi_GridWidth(6) = 1500
        gi_GridWidth(7) = 2000
        gi_GridWidth(8) = 2000
        gi_GridWidth(9) = 2000
        gi_GridWidth(10) = 1500
        gi_GridWidth(11) = 1500
        gi_GridWidth(12) = 1500
        gi_GridWidth(13) = 1500
        gi_GridWidth(14) = 1500
        gi_GridWidth(15) = 1500
        gi_GridWidth(16) = 1500
        gi_GridWidth(17) = 2000
    Case "Claim_Report4"
        gs_ParamReq1 = "EXEC Claim_Report4_t_lst '" _
            & ms_Combo4 & "', '" & ms_Combo1 & "', '" _
            & ms_Combo2 & "', '" & ms_Combo3 & "', '"
        If cbo_Desc4.ListIndex = 0 Or cbo_Desc4.ListIndex = 2 Then
            gs_ParamReq2 = "EXEC Screen_Csts main_OC, '" & gut_LangLogin.Code & "'"
        Else
            gs_ParamReq2 = "EXEC Screen_Csts main_OC2, '" & gut_LangLogin.Code & "'"
        End If
        gs_ParamReq3 = "EXEC Check_Security Claim_Report4, " & prg.LoginName
        gi_GridWidth(0) = 2000
        gi_GridWidth(1) = 1500
        gi_GridWidth(2) = 1500
        gi_GridWidth(3) = 1500
        gi_GridWidth(4) = 1500
        gi_GridWidth(5) = 1500
        gi_GridWidth(6) = 1500
        gi_GridWidth(7) = 2000
        gi_GridWidth(8) = 2000
        gi_GridWidth(9) = 2000
        gi_GridWidth(10) = 2000
        gi_GridWidth(11) = 2000
        gi_GridWidth(12) = 2000
        gi_GridWidth(13) = 2000
        gi_GridWidth(14) = 2000
        gi_GridWidth(15) = 1500
        gi_GridWidth(16) = 1500
        gi_GridWidth(17) = 1500
        gi_GridWidth(18) = 1500
        gi_GridWidth(19) = 1500
        gi_GridWidth(20) = 2000
        gi_GridWidth(21) = 2000
    Case "Claim_Report5"
        gs_ParamReq1 = "EXEC Claim_Report5_t_lst '" _
            & FormatD(txt_BeginDate, "mm/dd/yyyy") & "', '" _
            & FormatD(txt_EndDate, "mm/dd/yyyy") & "', '" _
            & ms_Combo1 & "', '"
        gs_ParamReq2 = "EXEC Screen_Csts 'main_TS', '" & gut_LangLogin.Code & "'"
        gs_ParamReq3 = "EXEC Check_Security Claim_Report5, " & prg.LoginName
        gi_GridWidth(0) = 1500
        gi_GridWidth(1) = 1500
        gi_GridWidth(2) = 1500
        gi_GridWidth(3) = 1500
        gi_GridWidth(4) = 1500
        gi_GridWidth(5) = 1500
        gi_GridWidth(6) = 1500
    End Select
    C_main.show 1
End If
MouseOn

End Sub
Private Function Control() As Boolean

Control = KO
If txt_BeginDate = "" And txt_BeginDate.Visible Then
    ssc_BeginDate.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If txt_EndDate = "" And txt_EndDate.Visible Then
    ssc_EndDate.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If IsDateGreater(txt_BeginDate, txt_EndDate) Then
    SendMessage 23, "Ending date must be greather than starting date", gut_LangLogin.Code
    Exit Function
End If
If cbo_Desc1.ListIndex = -1 And cbo_Desc1.Visible And gut_Param.Str11 = "MustBe" Then
    cbo_Desc1.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If cbo_Desc2.ListIndex = -1 And cbo_Desc2.Visible And gut_Param.Str12 = "MustBe" Then
    cbo_Desc2.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If cbo_Desc3.ListIndex = -1 And cbo_Desc3.Visible And gut_Param.Str13 = "MustBe" Then
    cbo_Desc3.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If cbo_Desc4.ListIndex = -1 And cbo_Desc4.Visible Then
    cbo_Desc4.SetFocus
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
Control = OK

End Function

Private Sub ssc_BeginDate_Click()

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

End Sub

Private Sub ssc_EndDate_Click()

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

End Sub


Private Sub ssp_quit_Click()

MouseOff
Unload Me
MouseOn

End Sub


