VERSION 5.00
Begin VB.Form frmAutorizar1 
   Caption         =   "Valida"
   ClientHeight    =   5430
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4710
   LinkTopic       =   "Form2"
   ScaleHeight     =   5430
   ScaleWidth      =   4710
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdNum 
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   0
      Left            =   120
      TabIndex        =   13
      Top             =   4320
      Width           =   3135
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "1"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   1
      Left            =   120
      TabIndex        =   12
      Top             =   3240
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "2"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   2
      Left            =   1200
      TabIndex        =   11
      Top             =   3240
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "3"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   3
      Left            =   2280
      TabIndex        =   10
      Top             =   3240
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "4"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   4
      Left            =   120
      TabIndex        =   9
      Top             =   2160
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "5"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   5
      Left            =   1200
      TabIndex        =   8
      Top             =   2160
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "6"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   6
      Left            =   2280
      TabIndex        =   7
      Top             =   2160
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "7"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   7
      Left            =   120
      TabIndex        =   6
      Top             =   1080
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "8"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   8
      Left            =   1200
      TabIndex        =   5
      Top             =   1080
      Width           =   1000
   End
   Begin VB.CommandButton cmdNum 
      Caption         =   "9"
      BeginProperty Font 
         Name            =   "Arial Black"
         Size            =   20.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1000
      Index           =   9
      Left            =   2280
      TabIndex        =   4
      Top             =   1080
      Width           =   1000
   End
   Begin VB.TextBox TxtCodigo 
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0080FF80&
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   120
      MaxLength       =   15
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   480
      Width           =   3255
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "&OK"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   21.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1125
      Left            =   3480
      TabIndex        =   2
      Top             =   3720
      Width           =   1125
   End
   Begin VB.CommandButton cmdLimpiar 
      Caption         =   "&Limpiar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   11.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1125
      Left            =   3480
      TabIndex        =   1
      Top             =   1080
      Width           =   1125
   End
   Begin VB.CommandButton cmdCancelar 
      Caption         =   "&Cancelar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   11.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1125
      Left            =   3480
      TabIndex        =   0
      Top             =   2400
      Width           =   1125
   End
   Begin VB.Label Label1 
      Caption         =   "Ingrese su contraseña:"
      BeginProperty Font 
         Name            =   "Arial Narrow"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   255
      Left            =   240
      TabIndex        =   14
      Top             =   120
      Width           =   3135
   End
End
Attribute VB_Name = "frmAutorizar1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public frmPadre As Form

Public Sub inicio(ByVal frm As Form)
 ' frmPadre = frm
End Sub

Private Sub cmdCancelar_Click()
  Unload Me
End Sub

Private Sub cmdLimpiar_Click()
  TxtCodigo.Text = ""
End Sub

Private Sub cmdOK_Click()
On Error GoTo LineaError
  Dim psw As String

  If TxtCodigo.Text = "" Then
    frmMsgBox.inicio Me, "Validación de Contraseña", "Ingrese su contraseña.", 1
    frmMsgBox.Show vbModal
    TxtCodigo.SetFocus
    Exit Sub
  End If
  psw = Trim(ReemplazarComilla(TxtCodigo.Text))
  
  If Len(psw) = TxtCodigo.MaxLength And Len(psw) > 0 Then
     psw = Mid(psw, 2, Len(psw) - 2)
  Else
    If IsNumeric(psw) = True And (Len(psw) <> TxtCodigo.MaxLength - 2 And Len(psw) > 3) Then
       psw = Left(Trim(psw), 3) & "00000" & Right(Trim(psw), Len(Trim(psw)) - 3)
    End If
  End If
  
  Dim sSql As String
  Dim adoRS As ADODB.Recordset
  sSql = "SELECT * FROM Usuario WHERE TRIM(sUserPass) = '$'"
  sSql = VBsprintf(sSql, psw)
      
  If oDBAdmin.EjecutarConsulta(ADOCnn, sSql, adoRS) Then
    If Not adoRS.EOF Then
      If Not (LeerCampo(adoRS!cPerfCode) = 2 Or LeerCampo(adoRS!cPerfCode) = 1) Then
         frmMsgBox.inicio Me, "Validación de Contraseña", "Ud. no puede autorizar la operación. Sólo un SUPERVISOR puede hacerlo.", 2
         frmMsgBox.Show vbModal
         TxtCodigo.Text = ""
         TxtCodigo.SetFocus
         Exit Sub
      End If
    Else
         frmMsgBox.inicio Me, "Validación de Contraseña", "La contraseña no es válida.", 2
         frmMsgBox.Show vbModal
         TxtCodigo.Text = ""
         TxtCodigo.SetFocus
      Exit Sub
    End If
  End If
        
  'frmPadre.txtSupervisor.Text = LeerCampo(adoRS!sUserDesc)
  'frmPadre.bAcceso = True
  
  Set adoRS = Nothing
  valid = 1
  Unload Me
  Exit Sub
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
Salir:
  Set adoRS = Nothing
End Sub

Private Sub cmdNum_Click(Index As Integer)
  TxtCodigo.Text = TxtCodigo.Text + cmdNum(Index).Caption
End Sub


Private Sub TxtCodigo_Change()
  If Len(Trim(TxtCodigo.Text)) = TxtCodigo.MaxLength Then
     cmdOK_Click
  End If

End Sub

