VERSION 5.00
Begin VB.Form frmAutorizarOperacion 
   BorderStyle     =   1  'Fixed Single
   Caption         =   " Caja Registradora - Autorizaciňn"
   ClientHeight    =   2475
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4200
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2475
   ScaleWidth      =   4200
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2415
      Left            =   45
      TabIndex        =   5
      Top             =   -15
      Width           =   4065
      Begin VB.CommandButton cmdCancelar 
         Caption         =   "&Cancelar"
         Height          =   405
         Left            =   2340
         TabIndex        =   4
         Top             =   1815
         Width           =   1200
      End
      Begin VB.CommandButton cmdAceptar 
         Caption         =   "&Aceptar"
         Height          =   405
         Left            =   555
         TabIndex        =   3
         Top             =   1815
         Width           =   1200
      End
      Begin VB.TextBox txtPassword 
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   1170
         PasswordChar    =   "*"
         TabIndex        =   2
         Top             =   1290
         Width           =   2625
      End
      Begin VB.TextBox txtUsuario 
         Height          =   300
         Left            =   1170
         TabIndex        =   1
         Top             =   915
         Width           =   2625
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "Password:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   240
         TabIndex        =   7
         Top             =   1350
         Width           =   855
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "Usuario:"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   405
         TabIndex        =   6
         Top             =   975
         Width           =   690
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         Caption         =   "INGRESE SU USUARIO Y CLAVE PARA AUTORIZAR LA OPERACION"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   390
         Left            =   285
         TabIndex        =   0
         Top             =   225
         Width           =   3405
         WordWrap        =   -1  'True
      End
   End
End
Attribute VB_Name = "frmAutorizarOperacion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public frmPadre As Form


Private Sub cmdaceptar_Click()

  On Error GoTo LineaError
  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
    
  sSQL = "SELECT * FROM Usuario WHERE TRIM(sUserDesc) = '$'"
  sSQL = VBsprintf(sSQL, ReemplazarComilla(Trim(txtUsuario.Text)))
      
  If oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then
    If Not ADORS.EOF Then
      If LeerCampo(ADORS!cUserActi) <> kSI Then
        MsgBox "Usuario no activo. Contactar al supervisor.", vbOKOnly + vbInformation
        txtpassword.SetFocus
        Exit Sub
      End If
      
      If Not Trim(txtpassword.Text) = Trim(LeerCampo(ADORS!suserPass)) Then
        MsgBox "Password no válido", vbOKOnly + vbInformation
        txtpassword.SetFocus
        Exit Sub
      End If
          
      If LeerCampo(ADORS!cPerfCode) <> 1 Then
        MsgBox "Usuario no autorizado. Sólo el SUPERVISOR puede autorizar esta operación", vbOKOnly + vbInformation
        txtUsuario.SetFocus
        Exit Sub
      End If
    Else
      MsgBox "Usuario no válido", vbOKOnly + vbInformation
      txtUsuario.SetFocus
      Exit Sub
    End If
  End If
        
  Set ADORS = Nothing
  frmPadre.txtsupervisor.Text = txtUsuario.Text
  frmPadre.bAcceso = True
  Unload Me
  Exit Sub
  
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation

Salir:
  Set ADORS = Nothing
End Sub
Private Sub cmdCancelar_Click()

  frmPadre.bAcceso = False
  Unload Me
  
End Sub

Private Sub Form_Unload(Cancel As Integer)

  If Trim(frmPadre.txtsupervisor.Text) = "" Then
     frmPadre.bAcceso = False
  End If
  
End Sub
