VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Form_Consulta_Jefe_Soporte 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Consulta Jefe de Soporte"
   ClientHeight    =   6660
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11085
   Icon            =   "Form_Consulta_Jefe_Soporte.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6660
   ScaleWidth      =   11085
   Begin VB.Frame frame_detalle 
      Caption         =   "Ingrese Detalle"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3855
      Left            =   3600
      TabIndex        =   28
      Top             =   1200
      Visible         =   0   'False
      Width           =   4095
      Begin VB.TextBox txt_detalle 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   3015
         Left            =   120
         MultiLine       =   -1  'True
         TabIndex        =   31
         Top             =   240
         Width           =   3855
      End
      Begin VB.CommandButton cmd_Aceptar 
         Caption         =   "Aceptar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   720
         TabIndex        =   30
         Top             =   3360
         Width           =   1215
      End
      Begin VB.CommandButton cmd_Cancelar 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2160
         TabIndex        =   29
         Top             =   3360
         Width           =   1215
      End
   End
   Begin VB.Frame frame_numeroticket 
      Caption         =   "Numero de Ticket"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1095
      Left            =   1560
      TabIndex        =   25
      Top             =   1800
      Visible         =   0   'False
      Width           =   2895
      Begin VB.TextBox txt_numero_ticket 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1560
         TabIndex        =   26
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "Ingrese Numero:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   27
         Top             =   480
         Width           =   1215
      End
   End
   Begin VB.Frame frame_estado 
      Caption         =   "Estado Ticket"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   1200
      TabIndex        =   19
      Top             =   4200
      Visible         =   0   'False
      Width           =   3615
      Begin VB.OptionButton Option1 
         Caption         =   "Abierto"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   24
         Top             =   600
         Width           =   975
      End
      Begin VB.OptionButton Option1 
         Caption         =   "Pendiente"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   2
         Left            =   240
         TabIndex        =   23
         Top             =   360
         Width           =   1095
      End
      Begin VB.OptionButton Option1 
         Caption         =   "Atendido Sin Solucion"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Index           =   1
         Left            =   1440
         TabIndex        =   22
         Top             =   360
         Width           =   2055
      End
      Begin VB.OptionButton Option1 
         Caption         =   "Atendido Solucionado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   3
         Left            =   1440
         TabIndex        =   21
         Top             =   600
         Width           =   1935
      End
      Begin VB.OptionButton Option1 
         Caption         =   "Cerrado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   4
         Left            =   240
         TabIndex        =   20
         Top             =   840
         Width           =   975
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Todo"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1575
      Left            =   2520
      TabIndex        =   9
      Top             =   120
      Width           =   8415
      Begin VB.ComboBox cb_colegio 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   840
         TabIndex        =   14
         Top             =   480
         Width           =   3375
      End
      Begin VB.ComboBox cb_tiposoporte 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   5640
         TabIndex        =   13
         Top             =   480
         Width           =   1335
      End
      Begin VB.ComboBox cb_usuario 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   840
         TabIndex        =   12
         Top             =   960
         Width           =   3375
      End
      Begin VB.CommandButton cmd_consultar 
         Caption         =   "Consultar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   7080
         TabIndex        =   11
         Top             =   600
         Width           =   1095
      End
      Begin MSComCtl2.DTPicker dtp_fecha 
         Height          =   375
         Left            =   5640
         TabIndex        =   10
         Top             =   960
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   661
         _Version        =   393216
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Format          =   98172929
         CurrentDate     =   40680
      End
      Begin VB.Label Label1 
         Caption         =   "Colegio"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   240
         TabIndex        =   18
         Top             =   480
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "Tipo de Soporte"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   4440
         TabIndex        =   17
         Top             =   480
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "Fecha"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   4440
         TabIndex        =   16
         Top             =   960
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "Usuario"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   240
         TabIndex        =   15
         Top             =   960
         Width           =   615
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "Consultar por"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1575
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   2295
      Begin VB.CheckBox check_FuncionarioSoporte 
         Caption         =   "Funcionario de Soporte"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   46
         Top             =   1080
         Width           =   2055
      End
      Begin VB.CheckBox check_Todo 
         Caption         =   "Todo"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   360
         Width           =   975
      End
      Begin VB.CheckBox check_ticketespecifico 
         Caption         =   "Ticket Especifico"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   7
         Top             =   600
         Width           =   1575
      End
      Begin VB.CheckBox check_ticketestado 
         Caption         =   "Ticket por Estado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   6
         Top             =   840
         Width           =   1575
      End
   End
   Begin VB.Frame Frame5 
      Height          =   735
      Left            =   120
      TabIndex        =   0
      Top             =   5760
      Width           =   6975
      Begin VB.CommandButton cmd_consulta 
         Caption         =   "Consulta"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton cmd_imprimir 
         Caption         =   "Imprimir"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1920
         TabIndex        =   3
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton cmd_salir 
         Caption         =   "Salir"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   5280
         TabIndex        =   2
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton cmd_limpiar 
         Caption         =   "Limpiar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3600
         TabIndex        =   1
         Top             =   240
         Width           =   1335
      End
   End
   Begin VB.Frame frame_Funcionario_Soporte 
      Caption         =   "Funcionario de Soporte"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1095
      Left            =   960
      TabIndex        =   47
      Top             =   3000
      Visible         =   0   'False
      Width           =   4215
      Begin VB.ComboBox cb_Funcionario_Soporte 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   120
         TabIndex        =   48
         Top             =   480
         Width           =   3855
      End
   End
   Begin VB.Frame frame_ticket 
      Caption         =   "Listado de Ticket"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3975
      Left            =   120
      TabIndex        =   32
      Top             =   1800
      Visible         =   0   'False
      Width           =   10815
      Begin VB.Frame Frame4 
         Caption         =   "Cambiar Estado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   2175
         Left            =   7080
         TabIndex        =   34
         Top             =   240
         Width           =   3615
         Begin VB.OptionButton opt_cambiar 
            Caption         =   "Abierto"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   2
            Left            =   240
            TabIndex        =   41
            Top             =   360
            Width           =   1095
         End
         Begin VB.OptionButton opt_cambiar 
            Caption         =   "Pendiente"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   3
            Left            =   240
            TabIndex        =   40
            Top             =   720
            Width           =   1215
         End
         Begin VB.OptionButton opt_cambiar 
            Caption         =   "Cerrado"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   4
            Left            =   240
            TabIndex        =   39
            Top             =   1080
            Width           =   975
         End
         Begin VB.OptionButton opt_cambiar 
            Caption         =   "Atendido Solucionado"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   1
            Left            =   1560
            TabIndex        =   38
            Top             =   360
            Width           =   1935
         End
         Begin VB.OptionButton opt_cambiar 
            Caption         =   "Atendido Sin Solución"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   0
            Left            =   1560
            TabIndex        =   37
            Top             =   720
            Width           =   1935
         End
         Begin VB.CommandButton cmd_cambiar 
            Caption         =   "Cambiar"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   360
            TabIndex        =   36
            Top             =   1560
            Width           =   1215
         End
         Begin VB.CommandButton cmd_detalle 
            Caption         =   "Detalle"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   2160
            TabIndex        =   35
            Top             =   1560
            Width           =   975
         End
         Begin VB.Label Label7 
            Alignment       =   2  'Center
            Caption         =   "(*)"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00000000&
            Height          =   375
            Left            =   3120
            TabIndex        =   42
            Top             =   1560
            Width           =   375
         End
      End
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid grid_ticket 
         Height          =   3615
         Left            =   120
         TabIndex        =   33
         Top             =   240
         Width           =   6855
         _ExtentX        =   12091
         _ExtentY        =   6376
         _Version        =   393216
         FocusRect       =   0
         FillStyle       =   1
         SelectionMode   =   1
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _NumberOfBands  =   1
         _Band(0).Cols   =   2
      End
      Begin VB.Label Label6 
         Caption         =   "El cambio de estado solo debe efectuarlo si usted comunico previamente esto al usuario"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   615
         Left            =   7080
         TabIndex        =   45
         Top             =   2640
         Width           =   3495
      End
      Begin VB.Label Label8 
         Alignment       =   2  'Center
         Caption         =   "(*)"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   7080
         TabIndex        =   44
         Top             =   3480
         Width           =   375
      End
      Begin VB.Label Label9 
         Caption         =   "Uso Obligatorio"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   7440
         TabIndex        =   43
         Top             =   3480
         Width           =   2775
      End
   End
End
Attribute VB_Name = "Form_Consulta_Jefe_Soporte"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub check_FuncionarioSoporte_Click()
    If check_FuncionarioSoporte.Value = 1 Then
        frame_Funcionario_Soporte.Visible = True
    Else
        frame_Funcionario_Soporte.Visible = False
    End If
End Sub

Private Sub check_ticketespecifico_Click()
If check_ticketespecifico.Value = 1 Then
    frame_numeroticket.Visible = True
Else
    frame_numeroticket.Visible = False
End If
End Sub

Private Sub check_ticketestado_Click()
If check_ticketestado.Value = 1 Then
    frame_estado.Visible = True
Else
    frame_estado.Visible = False
End If
End Sub

Private Sub cmd_Aceptar_Click()
    frame_detalle.Visible = False
End Sub

Private Sub cmd_cambiar_Click()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql, IpSeleccionada As String
    
    Dim i, Ind As Integer
    Dim sw As Boolean
    Ind = 10
    For i = 0 To 4
        If opt_cambiar(i).Value = True Then Ind = i
    Next i
    If Ind = 10 Then
        MsgBox "Para realizar un cambio de estado primero debe seleccionar uno", vbInformation
        Exit Sub
    End If
    If txt_detalle.Text = "" Then
        MsgBox "Para poder cambiar el estado, primero debe ingresar el detalle", vbInformation
        Exit Sub
    End If
'    sw = False
    
'    If grid_ticket.TextMatrix(grid_ticket.Row, 6) = "Pendiente" Then
'    If opt_cambiar(Ind).Caption = "Atendido Solucionado" _
'    Or opt_cambiar(Ind).Caption = "Atendido Sin Solucion" Then
'        sw = True
'    Else
'        MsgBox "Del estado Pendiente solo puede pasar a Atendido Solucionado o Atendido Sin Solucion", vbInformation
'        Exit Sub
'    End If
'    End If
    
'    If grid_ticket.TextMatrix(grid_ticket.Row, 6) = "Atendido Solucionado" Then
'    If opt_cambiar(Ind).Caption = "Atendido Sin Solucion" _
'    Or opt_cambiar(Ind).Caption = "Cerrado" Then
'        sw = True
'    Else
'        MsgBox "Del estado Atendido Solucionado solo puede pasar a Atendido Sin Solucion o Cerrado", vbInformation
'        Exit Sub
'    End If
'    End If
    
'    If grid_ticket.TextMatrix(grid_ticket.Row, 6) = "Atendido Sin Solucion" Then
'    If opt_cambiar(Ind).Caption = "Atendido Solucionado" Then
'        sw = True
'    Else
'        MsgBox "Del estado Atendido Sin Solucion solo puede pasar a Atendido Solucionado", vbInformation
'        Exit Sub
'    End If
'    End If
'
'    If grid_ticket.TextMatrix(grid_ticket.Row, 6) = "Cerrado" Then
'        MsgBox "Del estado Cerrado no se puede pasar a ningun otro estado", vbInformation
'        Exit Sub
'    End If
    
'    If sw = False Then Exit Sub

    Select Case grid_ticket.TextMatrix(grid_ticket.Row, 1)
            Case "LA FARFANA"
                IpSeleccionada = "192.168.1.10"
            Case "LA FLORIDA"
                IpSeleccionada = "192.168.4.1"
            Case "MAIPU"
                IpSeleccionada = "192.168.2.1"
            Case "SAN MARTIN"
                IpSeleccionada = "192.168.3.1"
            Case "LINCOLN COLLEGE"
                IpSeleccionada = "192.168.5.1"
    End Select
    
    'Cambio coneccion
    'IpSeleccionada = devuelvecampo("cfg", "", "valor", "param like 'IP_%' and descripcion = '" & Trim(cb_colegio.Text) & "'", conn)
    If conn.State = 1 Then
        conn.Close
    End If
    varconecta = ConectarBDSiempre(conn, IpSeleccionada, Base, "groot", PassBDLocal, True)
        
    'Modifico el estado
    var_sql = "update spte_ticket set estado_actual = '" & opt_cambiar(Ind).Caption _
            & "' where numero_ticket = " & grid_ticket.TextMatrix(grid_ticket.Row, 2)
    conn.Execute var_sql
        
    'Inserto la descripcion de lo que el usuario realizo
    var_sql = "insert into spte_respuestas(ticket,fecha_respuesta,hora_respuesta,detalle)" _
            & " values(" & grid_ticket.TextMatrix(grid_ticket.Row, 2) _
            & ",current_date,current_time,'" & txt_detalle.Text & "')"
    
    conn.Execute var_sql
    
    'En caso de que soporte respuesta ya este ingresado
    var_sql = "select * from spte_respuesta where ticket = " _
            & grid_ticket.TextMatrix(grid_ticket.Row, 2)
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        var_sql = "Update spte_respuesta" _
                & " set detalle = '" & txt_detalle.Text _
                & "',fecha_respuesta=current_date,hora_respuesta=current_time," _
                & "estado_respuesta = '" & opt_cambiar(Ind).Caption _
                & "' Where ticket = " & grid_ticket.TextMatrix(grid_ticket.Row, 2)
        conn.Execute var_sql
    Else
        
    'Si cambio estado a cerrado
    If opt_cambiar(Ind).Caption = "Cerrado" Then
        var_sql = "insert into spte_respuesta(ticket,fecha_respuesta,hora_respuesta,detalle,estado_respuesta,usuario_confirmo)" _
                & " values(" & grid_ticket.TextMatrix(grid_ticket.Row, 2) _
                & ",current_date,current_time,'" & txt_detalle.Text & "','" & opt_cambiar(Ind).Caption & "','NO')"
        conn.Execute var_sql
    End If
    End If
    
    objRS.Close
    'txt_detalle.Text
    grid_ticket.TextMatrix(grid_ticket.Row, 6) = opt_cambiar(Ind).Caption
        
    txt_detalle.Text = ""
    varconecta = ConectarBDSiempre(conn, Servidor, Base, "groot", PassBDLocal, True)
    MsgBox "Cambio de estado fue realizado con exito", vbInformation
End Sub

Private Sub cmd_Cancelar_Click()
    frame_detalle.Visible = False
    txt_detalle.Text = ""
End Sub

Private Sub cmd_consulta_Click()
    If grid_ticket.Rows = 2 And grid_ticket.TextMatrix(1, 1) = "" Then
        Exit Sub
    End If
    form_consultar.Visible = True
    form_consultar.generar_consulta (grid_ticket.TextMatrix(grid_ticket.Row, 7))
    Load form_consultar
End Sub

Private Sub cmd_consultar_Click()
    'limpiar
    Dim i, Ind As Integer
    Dim arr(5) As String
    Dim desc(5) As String
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim REC As ADODB.Recordset
    Set REC = New ADODB.Recordset
    Dim tipo_soporte, colegio, IpSeleccionada, IpEstoy, var_sql, Consulta, Consulta2 As String
    Dim varconecta As Boolean
    frame_numeroticket.Visible = False
    frame_estado.Visible = False
    frame_ticket.Visible = True
    frame_Funcionario_Soporte.Visible = False
'    If cb_colegio.Text <> "" Then
'        IpSeleccionada = devuelvecampo("cfg", "", "valor", "param like 'IP_%' and descripcion = '" & Trim(cb_colegio.Text) & "'", conn)
'    End If
    IpEstoy = Form_main.Winsock1.LocalIP
   ' MsgBox servidor
   
    'Consulta que llena grilla
    Consulta = "select nom_est as 'colegio',numero_ticket as 'ticket'," _
             & "date_format(fecha,'%Y-%m-%d')  as 'fecha',nombre_completo_usu as 'usuario'," _
             & "solicitud as 'soporte',estado_actual as 'estado'" _
             & ",st.folio_solicitud as 'folio'" _
             & " from spte_ticket st,spte_solicitud ss,usuarios u,establecimientos,spte_asignacion sa," _
             & " spte_personal sp" _
             & " where st.folio_solicitud = ss.folio and ss.login_usuario = u.aut_nombre_usuario" _
             & " and sa.folio_solicitud = st.folio_solicitud and sa.rut_personal_soporte = sp.rut_personal"
      
    'Si check_Todo esta seleccionado
    If check_Todo.Value = 1 Then
        Select Case cb_tiposoporte.Text
            Case "Hardware"
                tipo_soporte = "h"
            Case "Software"
                tipo_soporte = "s"
            Case "Gescol"
                tipo_soporte = "g"
            Case "Email"
                tipo_soporte = "e"
            Case "Otros"
                tipo_soporte = "o"
            Case "Internet"
                tipo_soporte = "i"
        End Select
        var_sql = "select aut_nombre_usuario as u from usuarios" _
                & " where nombre_completo_usu = '" & cb_usuario.Text & "'"
        REC.Open var_sql, conn
        If cb_tiposoporte.Text <> "" Then
            Consulta2 = " and ss.solicitud like '" & tipo_soporte & "%'"
            Consulta = Consulta & Consulta2
        End If
        If cb_usuario.Text <> "" Then
            Consulta2 = " and ss.login_usuario = '" & REC("u") & "'"
            Consulta = Consulta & Consulta2
        End If
        Consulta2 = " and date_format(ss.fecha,'%Y-%m-%d') = '" _
                  & Format(dtp_fecha.Value, "yyyy-mm-dd") & "'"
        Consulta = Consulta & Consulta2
        REC.Close
    End If
        
    'Si check_ticketespecifico es seleccionado
    If check_ticketespecifico.Value = 1 And txt_numero_ticket.Text <> "" Then
        Consulta2 = " and st.numero_ticket = " & txt_numero_ticket.Text
        Consulta = Consulta & Consulta2
    End If
    
    'Si check_ticketestado es seleccionado
    If check_ticketestado.Value = 1 Then
        For i = 0 To 4
            If Option1(i).Value = True Then
                Consulta2 = " and st.estado_actual = '" & Option1(i).Caption & "'"
            End If
        Next i
        Consulta = Consulta & Consulta2
    End If
    
    'Si check_FuncionarioSoporte
    If check_FuncionarioSoporte.Value = 1 Then
        If cb_Funcionario_Soporte.Text <> "" And cb_Funcionario_Soporte.Text <> "Todos los Funcionarios" Then
            var_sql = "select rut_personal as 'rp' from spte_personal" _
                    & " where nombre_personal = '" & cb_Funcionario_Soporte.Text & "'"
            REC.Open var_sql, conn
            
            Consulta2 = " and sa.rut_personal_soporte = '" & REC("rp") & "'"
            REC.Close
            Consulta = Consulta & Consulta2
        End If
    End If
             
    'Si check todo es seleccionado
    If check_Todo.Value = 1 Then
        If cb_colegio <> "" Then
            IpSeleccionada = devuelvecampo("cfg", "", "valor", "param like 'IP_%' and descripcion = '" & Trim(cb_colegio.Text) & "'", conn)
            If conn.State = 1 Then
                conn.Close
            End If
            varconecta = ConectarBDSiempre(conn, IpSeleccionada, Base, "groot", PassBDLocal, True)
            objRS.Open Consulta, conn
            Call Rec2Grid(objRS, grid_ticket, True)
            objRS.Close
        Else
            var_sql = "select * from cfg where param like 'IP_%';"
            REC.Open var_sql, conn
            i = 0
            While Not REC.EOF
                arr(i) = REC("valor")
                desc(i) = REC("descripcion")
                REC.MoveNext
                i = i + 1
            Wend
'            For i = 0 To 4
'                MsgBox arr(i)
'            Next i
            If conn.State = 1 Then
                conn.Close
            End If
            varconecta = ConectarBDSiempre(conn, arr(0), Base, "groot", PassBDLocal, True)
            If varconecta = True Then
                objRS.Open Consulta, conn
                Call Rec2Grid(objRS, grid_ticket, True)
                objRS.Close
            Else
                MsgBox "No hubo conección con " & desc(0), vbInformation
            End If
            'REC.MoveNext
            For i = 1 To 4
                If conn.State = 1 Then
                    conn.Close
                End If
                varconecta = ConectarBDSiempre(conn, arr(i), Base, "groot", PassBDLocal, True)
                If varconecta = True Then
                    objRS.Open Consulta, conn
                    While Not objRS.EOF
                        grid_ticket.Rows = grid_ticket.Rows + 1
'                        grid_ticket.Row = grid_ticket.Rows - 1
'                        grid_ticket.Col = 0
'                        grid_ticket.Text = gri
                         grid_ticket.TextMatrix(grid_ticket.Rows - 1, 0) = grid_ticket.Rows - 1
                         grid_ticket.TextMatrix(grid_ticket.Rows - 1, 1) = objRS("ci_alu")
                         grid_ticket.TextMatrix(grid_ticket.Rows - 1, 2) = objRS("nom_est")
                        objRS.MoveNext
                    Wend
                    objRS.Close
                Else
                    MsgBox "No hubo conección con " & desc(i), vbInformation
                End If
                'REC.MoveNext
            Next i
            'REC.Close
        End If
        
    If conn.State = 1 Then
        conn.Close
    End If
    varconecta = ConectarBD(conn, Servidor, Base, "groot", PassBDLocal, True)
    End If
    
    'Si check_Todo no es seleccionado
    If (check_FuncionarioSoporte.Value = 1 Or check_ticketespecifico.Value = 1 Or check_ticketestado.Value = 1) And check_Todo.Value = 0 Then
        objRS.Open Consulta, conn
        Call Rec2Grid(objRS, grid_ticket, True)
        objRS.Close
    End If
    grid_ticket.Row = grid_ticket.Rows - 1
    
    'If no retorna filas
    If grid_ticket.Rows = 2 And grid_ticket.TextMatrix(1, 1) = "" Then
        MsgBox "La busqueda no arrojo resultados", vbInformation
        limpiar
        Exit Sub
    End If
    
    grid_ticket.ColSel = 6
    'grid_ticket.Col = 6
    'grid_ticket.ColSel = 6
    For i = 0 To grid_ticket.Rows - 1
        Select Case Mid(grid_ticket.TextMatrix(i, 5), 1, 1)
            Case "h"
                grid_ticket.TextMatrix(i, 5) = "Hardware"
            Case "s"
                grid_ticket.TextMatrix(i, 5) = "Software"
            Case "g"
                grid_ticket.TextMatrix(i, 5) = "Gescol"
            Case "e"
                grid_ticket.TextMatrix(i, 5) = "Email"
            Case "o"
                grid_ticket.TextMatrix(i, 5) = "Otros"
            Case "i"
                grid_ticket.TextMatrix(i, 5) = "Internet"
        End Select
    Next i
    
    For i = 0 To grid_ticket.Rows - 1
        Select Case grid_ticket.TextMatrix(i, 1)
            Case "COLEGIO BOSTON COLLEGE LA FARFANA"
                grid_ticket.TextMatrix(i, 1) = "LA FARFANA"
            Case "COLEGIO BOSTON COLLEGE LA FLORIDA"
                grid_ticket.TextMatrix(i, 1) = "LA FLORIDA"
            Case "COLEGIO BOSTON COLLEGE MAIPU"
                grid_ticket.TextMatrix(i, 1) = "MAIPU"
            Case "COLEGIO BOSTON COLLEGE SAN MARTIN"
                grid_ticket.TextMatrix(i, 1) = "SAN MARTIN"
            Case "CENTRO EDUCACIONAL LINCOLN COLLEGE"
                grid_ticket.TextMatrix(i, 1) = "LINCOLN COLLEGE"
        End Select
    Next i
    grid_ticket.ColWidth(1) = 1500
    grid_ticket.ColWidth(7) = 0
    Frame2.Enabled = False
    Frame3.Enabled = False
    
End Sub

Private Sub cmd_detalle_Click()
    frame_detalle.Visible = True
End Sub

Private Sub cmd_imprimir_Click()
    If grid_ticket.Rows = 2 And grid_ticket.TextMatrix(1, 1) = "" Then
        Exit Sub
    End If
    form_consultar.generar_consulta (grid_ticket.TextMatrix(grid_ticket.Row, 7))
    'Load form_consultar
    form_consultar.Visible = False
    form_consultar.imprimir_consulta
    form_consultar.Visible = False
    'Unload form_consultar
End Sub

Private Sub cmd_limpiar_Click()
    limpiar
End Sub

Private Sub cmd_Salir_Click()
    Unload Me
End Sub

Private Sub llena_colegio()
Dim Col As ADODB.Recordset
Set Col = New ADODB.Recordset
Col.Open "select * from cfg where param like 'IP_%';", conn
'Me.txtUserName = ""
'Me.txtPassword = ""

While Not Col.EOF
    If Servidor = Col!valor Then
        'cb_colegio.Text = Col!descripcion
    End If
    cb_colegio.AddItem Col!descripcion
    Col.MoveNext
Wend
Col.Close
'    cb_colegio.AddItem "COLEGIO BOSTON COLLEGE LA FARFANA"
'    cb_colegio.AddItem "COLEGIO BOSTON COLLEGE LA FLORIDA"
'    cb_colegio.AddItem "COLEGIO BOSTON COLLEGE MAIPU"
'    cb_colegio.AddItem "COLEGIO BOSTON COLLEGE SAN MARTIN"
'    cb_colegio.AddItem "CENTRO EDUCACIONAL LINCOLN COLLEGE"
End Sub

Public Sub llena_tipo_soporte()
    cb_tiposoporte.AddItem "Hardware"
    cb_tiposoporte.AddItem "Software"
    cb_tiposoporte.AddItem "Internet"
    cb_tiposoporte.AddItem "Gescol"
    cb_tiposoporte.AddItem "Email"
    cb_tiposoporte.AddItem "Otros"
End Sub

Private Sub llena_usuarios()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    'var_sql = "select nombre_completo_usu as n from usuarios"
    var_sql = "select distinct nombre_completo_usu as n from spte_solicitud ss,usuarios u" _
            & " Where login_usuario = aut_nombre_usuario"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        cb_usuario.AddItem objRS("n")
        objRS.MoveNext
    Wend
    objRS.Close
End Sub

Private Sub Form_Load()
'    Dim objRS As ADODB.Recordset
'    Set objRS = New ADODB.Recordset
'    Dim var_sql As String
'    llena_funcionario_soporte
'    var_sql = "select rut_usu from usuarios" _
'            & " where aut_nombre_usuario = '" & Nom_usu_ses & "'"
'    objRS.Open var_sql, conn
'    If objRS("rut_usu") = "" Then
'        MsgBox "Debe ingresar su RUT. en la tabla usuarios", vbInformation
'        Exit Sub
'    End If
'    'lbl_rut_personal.Caption = objRS("rut_usu")
'    objRS.Close
    
'    var_sql = "select rut_usu from usuarios u,spte_personal sp " _
'            & " where aut_nombre_usuario = '" & Nom_usu_ses & "' and u.rut_usu = sp.rut_personal "
'    objRS.Open var_sql, conn
'    If objRS.EOF Then
'        MsgBox "Su RUT. de la tabla usuarios no concuerda con el su RUT. de la tabla spte_personal", vbInformation
'        Exit Sub
'    End If
'    objRS.Close
    
'    'Valido que sea jefe soporte informatico
'    var_sql = "select cargo_personal from usuarios u,spte_personal sp " _
'            & " where aut_nombre_usuario = '" & Nom_usu_ses & "' and u.rut_usu = sp.rut_personal " _
'            & " and sp.cargo_personal = 'Jefe Soporte Informatico'"
'    objRS.Open var_sql, conn
'    If objRS.EOF Then
'        MsgBox "Aqui solo el Jefe de Soporte Informatico tiene acceso a esta ventana", vbInformation
'        Exit Sub
'    End If
'
'    objRS.Close

    llena_funcionario_soporte
    llena_usuarios
    llena_tipo_soporte
    llena_colegio
    dtp_fecha.Value = Date
End Sub

Private Sub Rec2Grid(ByRef REC As ADODB.Recordset, ByRef grid As Object, Optional ByVal Numeracion As Boolean = True)
    grid.ClearStructure
    If REC.RecordCount > 0 Then
        grid.Cols = REC.Fields.count + 1
        grid.Rows = REC.RecordCount + 1
        grid.FixedCols = 1
        grid.FixedRows = 1
        grid.TextMatrix(0, 0) = "Nº"
        grid.ColWidth(0) = IIf(Numeracion, TextWidth(grid.TextMatrix(0, 0)) + 100, 0)
        For i = 1 To REC.Fields.count
            grid.TextMatrix(0, i) = UCase(REC.Fields(i - 1).Name)
            grid.ColWidth(i) = TextWidth(grid.TextMatrix(0, i)) + 100
        Next i
        REC.MoveFirst
        For i = 1 To REC.RecordCount
            grid.TextMatrix(i, 0) = i
            grid.ColWidth(0) = IIf(Numeracion, IIf(TextWidth(grid.TextMatrix(i, 0)) + 100 > grid.ColWidth(0), TextWidth(grid.TextMatrix(i, 0)) + 100, grid.ColWidth(0)), 0)
            For j = 1 To REC.Fields.count
                grid.TextMatrix(i, j) = IIf(IsNull(REC(j - 1)), "Null", REC(j - 1))
                grid.ColWidth(j) = IIf(TextWidth(grid.TextMatrix(i, j)) + 100 > grid.ColWidth(j), TextWidth(grid.TextMatrix(i, j)) + 100, grid.ColWidth(j))
            Next j
            REC.MoveNext
        Next i
    Else
        grid.Cols = 2
        grid.Rows = 2
    End If
End Sub

Public Sub limpiar()
    Dim i As Integer
    Frame2.Enabled = True
    Frame3.Enabled = True
    check_ticketespecifico.Value = 0
    check_Todo.Value = 0
    check_ticketestado.Value = 0
    check_FuncionarioSoporte.Value = 0
    cb_colegio.Text = ""
    cb_tiposoporte.Text = ""
    cb_usuario.Text = ""
    cb_Funcionario_Soporte.Text = ""
    txt_numero_ticket.Text = ""
    For i = 0 To 4
        Option1(i).Value = False
        opt_cambiar(i).Value = False
    Next i
    frame_numeroticket.Visible = False
    frame_estado.Visible = False
    frame_ticket.Visible = False
    frame_Funcionario_Soporte.Visible = False
End Sub

Public Sub llena_funcionario_soporte()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select nombre_personal as n from spte_personal"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        cb_Funcionario_Soporte.AddItem "Todos los Funcionarios"
        While Not objRS.EOF
            cb_Funcionario_Soporte.AddItem objRS("n")
            objRS.MoveNext
        Wend
    End If
    objRS.Close
End Sub
