VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form C_audit 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Table C_audit"
   ClientHeight    =   6750
   ClientLeft      =   150
   ClientTop       =   360
   ClientWidth     =   9360
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   6750
   ScaleMode       =   0  'User
   ScaleWidth      =   9360
   ShowInTaskbar   =   0   'False
   Begin VB.Frame SSPanel1 
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      Caption         =   "SSPanel1"
      Height          =   6015
      Left            =   0
      TabIndex        =   6
      Top             =   780
      Width           =   9375
      Begin VB.TextBox ssp_code 
         Alignment       =   2  'Center
         BackColor       =   &H0080FFFF&
         Height          =   300
         Left            =   1800
         TabIndex        =   11
         Top             =   5585
         Width           =   765
      End
      Begin VB.Frame SSPanel2 
         BackColor       =   &H00C0C0C0&
         Height          =   5000
         Left            =   120
         TabIndex        =   10
         Top             =   420
         Width           =   9135
         Begin MSFlexGridLib.MSFlexGrid grid 
            Height          =   4935
            Left            =   0
            TabIndex        =   12
            Top             =   60
            Width           =   9135
            _ExtentX        =   16113
            _ExtentY        =   8705
            _Version        =   393216
            FixedCols       =   0
            AllowUserResizing=   1
         End
      End
      Begin VB.PictureBox pic_next25 
         AutoSize        =   -1  'True
         Height          =   408
         Left            =   3150
         ScaleHeight     =   345
         ScaleWidth      =   345
         TabIndex        =   7
         Top             =   5500
         Width           =   408
      End
      Begin VB.Label lbl_rcd 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   240
         TabIndex        =   9
         Top             =   5580
         Width           =   1485
      End
      Begin VB.Label lbl_Category 
         Height          =   315
         Left            =   240
         TabIndex        =   8
         Top             =   120
         Width           =   8955
      End
   End
   Begin VB.PictureBox ButtonBox 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   765
      Left            =   0
      ScaleHeight     =   735
      ScaleWidth      =   9345
      TabIndex        =   0
      Top             =   0
      Width           =   9375
      Begin VB.PictureBox pic_help 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "C_AUDIT.frx":0000
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   2190
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   5
         Top             =   120
         Width           =   384
      End
      Begin VB.PictureBox pic_print 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   870
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   4
         Top             =   120
         Width           =   384
      End
      Begin VB.PictureBox pic_exit 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "C_AUDIT.frx":030A
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   1590
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   3
         Top             =   120
         Width           =   384
      End
      Begin VB.PictureBox pic_search 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "C_AUDIT.frx":0614
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   240
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   2
         Top             =   120
         Width           =   384
      End
   End
   Begin VB.PictureBox Picture2 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   0  'None
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   495
      Left            =   1440
      ScaleHeight     =   495
      ScaleWidth      =   615
      TabIndex        =   1
      Top             =   240
      Width           =   615
   End
End
Attribute VB_Name = "C_audit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim y As Integer
Dim ml_Hstmt As Long
Dim mi_Status As Integer

Dim mo_Fetch As Fetch


Private Sub Form_Load()

Dim p_code As String

On Error GoTo suite
MouseOff

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

pic_search.Picture = LoadResPicture(RES_SEARCH, 1)
pic_Print.Picture = LoadResPicture(RES_PRINT, 1)
pic_exit.Picture = LoadResPicture(RES_QUIT, 1)
pic_help.Picture = LoadResPicture(RES_HELP, 1)
pic_next25.Picture = LoadResPicture(RES_DOWN, 1)
y = 0
p_code = gs_TableCode
ssp_code = 0
audit_Categories_cst
Set mo_Fetch = New Fetch
mo_Fetch.EnvironmentIdentifier = gl_Environment
mo_Fetch.DatabaseIdentifier = gl_Database

FillGrid

MouseOn

Exit Sub

suite:
StdError
End Sub
Private Sub Form_Unload(Cancel As Integer)

Set mo_Fetch = Nothing

C_audit.grid.HighLight = flexHighlightNever

End Sub

Private Sub pic_exit_Click()
MouseOff
Unload Me
End Sub

Private Sub pic_next25_Click()
    MouseOff
    pic_next25.Visible = Next25
    MouseOn
End Sub
Private Sub pic_print_Click()
Dim li_PrintTable() As Integer
Dim li_PrintTableOrder() As Integer
Dim i As Integer

If Printers.Count = 0 Then
    SendMessage 135, "No printer is installed on your computer. Please, contact your system administrator.", gut_LangLogin.Code
    Exit Sub
End If

MouseOff
ReDim li_PrintTable(grid.Cols - 1) As Integer
ReDim li_PrintTableOrder(grid.Cols - 1) As Integer

For i = 0 To grid.Cols - 1
    li_PrintTable(i) = 70
    li_PrintTableOrder(i) = i
Next i

Select Case gs_TableName
    Case "Problems_ToSolve":
        PrintGrid 1, 10, Array(15, 15, 60)
    Case "DGrid_MainRunner":
        PrintGrid 1, 10, Array(15, 20, 20, 20, 10, 15)
    Case "DGrid_CrossTee":
        PrintGrid 1, 10, Array(15, 20, 20, 20, 10, 15)
    Case "DGrid_Interface":
        PrintGrid 1, 10, Array(15, 20, 20, 20, 10, 15)
    Case "DGrid_Group":
        PrintGrid 1, 10, Array(15, 20, 20, 20, 10, 15)
    Case "Ceiling_InternetGroup":
        PrintGrid 1, 10, Array(15, 20, 20, 20, 10, 15)
    Case "ProductsFamilies_Group":
        PrintGrid 1, 10, Array(15, 20, 20, 20)
    Case "AccProductsFamilies_Group":
        PrintGrid 1, 10, Array(15, 20, 20, 20)
    Case "Media_Manager":
        PrintGrid 1, 10, Array(15, 20, 20, 20)
    Case Else:
        PrintGrid2 (54 - Len(Caption)) / 2, li_PrintTable, li_PrintTableOrder
End Select
MouseOn

End Sub

Private Sub pic_search_Click()
On Error GoTo suite
C_a_search.show 1
Unload C_a_search
MouseOn
Exit Sub

suite:
StdError
MouseOn
End Sub

'---------------------------------------------
' NEXT 25
' Get the 25 next rows of the audit table
'---------------------------------------------
' Modified 12/08/99 by AD and JC
'---------------------------------------------
Private Function Next25() As Boolean

Dim li_Count, li_NBcol As Integer
Dim i As Integer 'Use to scan rows
Dim j As Integer 'Use to scan columns
Dim ls_Date As String ' Use to store the audit action date

On Error GoTo suite

'At least one record left
Next25 = OK
'Number of columns returned by the query
li_NBcol = mo_Fetch.NbCol
'get 25 new records
li_Count = mo_Fetch.FillMore

For i = 1 To li_Count
    y = y + 1
    'Add a row into the grid
    grid.Rows = y + 1
    'Select the last row and the first column
    grid.Row = grid.Rows - 1
    grid.Col = 0
    'Get the action date from the audit and convert it into a date format
    ls_Date = mo_Fetch.GetData(i, 1)
    grid.Text = FormatDate(Mid$(ls_Date, 1, 10))
    For j = 1 To li_NBcol - 1
        'select the good column and fill it with data
        grid.Col = j
        grid.Text = mo_Fetch.GetData(i, j + 1)
    Next j
Next i
'No more record left
If li_Count < 25 Then
    Next25 = KO
End If

'Number of row to display in the bottom on the screen
ssp_code = y

Exit Function

suite:
Next25 = KO
StdError
End Function

'---------------------------------------------
' FILL GRID
' Fill the grid with the audit table
'---------------------------------------------
' Modified 12/08/99 by AD and JC
'---------------------------------------------
Private Sub FillGrid()

Dim li_Count, li_Count2 As Integer

On Error GoTo suite

'Fill the first row with the captions
grid.Cols = gi_GridNbColumns

For li_Count = 0 To gi_GridNbColumns - 1
    grid.Col = li_Count
    grid.ColWidth(li_Count) = gi_GridWidth2(li_Count)
    li_Count2 = 0
    grid.Row = 0
    grid.Text = gs_GridColumn2(li_Count, 0)
Next li_Count

'Execute the request to get the audit data
If mo_Fetch.ExecuteQry(gs_Param2Req2, OK) Then
    mi_Status = SQL_SUCCESS
    'Request for the 25 first records
    pic_next25.Visible = Next25
Else
    mi_Status = SQL_ERROR
End If

Exit Sub

suite:
StdError
End Sub

Private Sub audit_Categories_cst()

Dim ls_Field As String
Dim ls_Text As String
Dim ls_Req As String

On Error GoTo suite

If SQLSubmit(gl_Environment, gl_Database, ml_Hstmt, gs_Param2Req1) Then
    mi_Status = SQL_SUCCESS
Else
    mi_Status = SQL_ERROR
End If
Do While mi_Status = SQL_SUCCESS Or mi_Status = SQL_SUCCESS_WITH_INFO
    mi_Status = SQLFetch(ml_Hstmt)
    If mi_Status = SQL_SUCCESS Or mi_Status = SQL_SUCCESS_WITH_INFO Then
        ls_Field = ODBCData(ml_Hstmt, 1)
        ls_Text = left(ODBCData(ml_Hstmt, 2), 30)
        Select Case ls_Field
        Case "title": Caption = ls_Text
        Case "lbl_Category": lbl_Category = ls_Text
        Case "lbl_record": lbl_rcd = ls_Text
        Case "c0": gs_GridColumn2(0, 0) = ls_Text
        Case "c1": gs_GridColumn2(1, 0) = ls_Text
        Case "c2": gs_GridColumn2(2, 0) = ls_Text
        Case "c3": gs_GridColumn2(3, 0) = ls_Text
        Case "c4": gs_GridColumn2(4, 0) = ls_Text
        Case "c5": gs_GridColumn2(5, 0) = ls_Text
        Case "c6": gs_GridColumn2(6, 0) = ls_Text
        Case "c7": gs_GridColumn2(7, 0) = ls_Text
        Case "c8": gs_GridColumn2(8, 0) = ls_Text
        Case "c9": gs_GridColumn2(9, 0) = ls_Text
        Case "c10": gs_GridColumn2(10, 0) = ls_Text
        Case "c11": gs_GridColumn2(11, 0) = ls_Text
        Case "c12": gs_GridColumn2(12, 0) = ls_Text
        Case "c13": gs_GridColumn2(13, 0) = ls_Text
        Case "c14": gs_GridColumn2(14, 0) = ls_Text
        Case "c15": gs_GridColumn2(15, 0) = ls_Text
        Case "c16": gs_GridColumn2(16, 0) = ls_Text
        Case "c17": gs_GridColumn2(17, 0) = ls_Text
        Case "c18": gs_GridColumn2(18, 0) = ls_Text
        Case "c19": gs_GridColumn2(19, 0) = ls_Text
        Case "c20": gs_GridColumn2(20, 0) = ls_Text
        Case "c21": gs_GridColumn2(21, 0) = ls_Text
        Case "c22": gs_GridColumn2(22, 0) = ls_Text
        Case "c23": gs_GridColumn2(23, 0) = ls_Text
        Case "c24": gs_GridColumn2(24, 0) = ls_Text
        Case "c25": gs_GridColumn2(25, 0) = ls_Text
        Case "c26": gs_GridColumn2(26, 0) = ls_Text
        Case "c27": gs_GridColumn2(27, 0) = ls_Text
        Case "c28": gs_GridColumn2(28, 0) = ls_Text
        Case "c29": gs_GridColumn2(29, 0) = ls_Text
        Case "c30": gs_GridColumn2(30, 0) = ls_Text
        End Select
    End If
Loop
mi_Status = SQLFreeStatement(ml_Hstmt, SQL_DROP)
Select Case gs_TableName
Case "Base_Material", "Colours", "Priv_Labels", "Products_Edges", "Products_Families", "Products_Groups", "Product_Module", "Products_Patterns", "Products_Segmentation", "Shapes", "Surfaces", "BI_Marketing", "Estimate_GridType", "Estimate_Slot", "Estimate_Length", "Perforation", "Perforation_Shape", "Form", "Component_Type"
    lbl_Category = lbl_Category & " " & gs_MenuChoice
End Select
ls_Req = "EXEC Screen_Csts 'search','" & gut_LangLogin.Code & "'"
If SQLSubmit(gl_Environment, gl_Database, ml_Hstmt, ls_Req) Then
    mi_Status = SQL_SUCCESS
Else
    mi_Status = SQL_ERROR
End If
Do While mi_Status = SQL_SUCCESS Or mi_Status = SQL_SUCCESS_WITH_INFO
    mi_Status = SQLFetch(ml_Hstmt)
    If mi_Status = SQL_SUCCESS Or mi_Status = SQL_SUCCESS_WITH_INFO Then
        ls_Field = ODBCData(ml_Hstmt, 1)
        ls_Text = left(ODBCData(ml_Hstmt, 2), 30)
        Select Case ls_Field
        Case "title": gs_TitleSearch = ls_Text
        Case "criteria": gs_CriteriaSearch = ls_Text
        Case "Next": gs_NextSearch = ls_Text
        Case "cancel": gs_CancelSearch = ls_Text
        End Select
    End If
Loop
mi_Status = SQLFreeStatement(ml_Hstmt, SQL_DROP)

Exit Sub

suite:
mi_Status = SQLFreeStatement(ml_Hstmt, SQL_DROP)
StdError
End Sub


