VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form fseguridad 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Seguridad Ventas C-Store"
   ClientHeight    =   2790
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4605
   Icon            =   "fseguridad_cstore.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2790
   ScaleWidth      =   4605
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton CMD_CANCELAR 
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   2535
      Picture         =   "fseguridad_cstore.frx":0442
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1751
      Width           =   1815
   End
   Begin VB.TextBox txt_password 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      IMEMode         =   3  'DISABLE
      Left            =   2055
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   904
      Width           =   2295
   End
   Begin VB.CommandButton CMD_ACEPTAR 
      Caption         =   "Aceptar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   255
      Picture         =   "fseguridad_cstore.frx":074C
      Style           =   1  'Graphical
      TabIndex        =   3
      Tag             =   "R ASDASD"
      Top             =   1751
      Width           =   1815
   End
   Begin VB.TextBox txt_usuario 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      Left            =   2055
      TabIndex        =   0
      Top             =   184
      Width           =   2295
   End
   Begin MSWinsockLib.Winsock Winsock1 
      Left            =   1335
      Top             =   1151
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "Clave"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   255
      TabIndex        =   5
      Top             =   949
      Width           =   795
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Vendedor"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   255
      TabIndex        =   2
      Top             =   244
      Width           =   1410
   End
End
Attribute VB_Name = "fseguridad"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mobj_cseguridad As DB_SE_MANTENIMIENTOS.c_seguridad
Dim mobj_cventasgen As DB_OP_FACTURACION.C_VENTASGENERAL

Private Sub CMD_ACEPTAR_Click()
Set mobj_cseguridad = New DB_SE_MANTENIMIENTOS.c_seguridad
Set mobj_cventasgen = New DB_OP_FACTURACION.C_VENTASGENERAL
Dim qwerty As String
Dim ytrewq As String
Dim cadena As String
Dim clave As String
Dim validar As Integer
Dim pendiente As String

qwerty = UCase(Trim(txt_usuario.Text))
ytrewq = Trim(Encrip(Trim(UCase(txt_password.Text))))

If Len(qwerty) = 0 Then
    MsgBox ("Debe ingresar un usuario")
    txt_usuario.SetFocus
    Exit Sub
End If
If Len(ytrewq) = 0 Then
    MsgBox ("Debe ingresar un password")
    txt_password.SetFocus
    Exit Sub
End If
validar = mobj_cventasgen.Validarvendedor(qwerty, ytrewq)
Call MENSAJES_VENDEDOR(validar)
If validar <> 0 Then
    Exit Sub
End If

GstrCodigoVENDEDOR = qwerty
GCUSERID = mobj_cventasgen.obtenerusuariovendedor(qwerty)
validar = mobj_cventasgen.ValidarUsuario(GCUSERID)

Call MENSAJES_USUARIO(validar)
If validar <> 0 Then
    Exit Sub
Else
    'Verifica_dias_Venc GCUSERID, ""
End If

GstrTerminal = Winsock1.LocalHostName
GstrPuntodeVenta = mobj_cventasgen.obtenernombrepv(GstrTerminal)
If Len(Trim(GstrPuntodeVenta)) = 0 Then
    MsgBox "Este terminal no tiene una caja configurada", vbExclamation, "Configuracion Erronea"
    Exit Sub
End If
        
pendiente = mobj_cventasgen.cierres_pendientes(GDatFechaProcesoVentas, GstrPuntodeVenta)
If Len(Trim(pendiente)) > 0 Then
    If MsgBox("No se ha realizado el cierre X del Vendedor " + pendiente, vbOKCancel, "Procesos Incompletos") = vbCancel Then
        Exit Sub
    End If
End If
If mobj_cventasgen.cierreZPtovta(GDatFechaProcesoVentas, GstrPuntodeVenta) Then
    MsgBox "Ya se realizo el Cierre Z en Este Punto de Venta", vbExclamation, "No se ha realizado el cambio de fecha de proceso"
    Exit Sub
End If
        
'If mobj_cventasgen.obtenertiponegocio(GstrTerminal) <> 0 Then
'    MsgBox "Este terminal no esta configurada para acceder al modulo de ventas tienda", vbExclamation, "Configuracion Erronea"
'    Exit Sub
'End If

Call GObtenerDatosdePtoVta(GstrPuntodeVenta)
gstrtipoventas = "A" 'ventas automatica
f_ventascstore.Caption = "Ventas C-Store (05.020.00)"
'Me.Hide
f_ventascstore.Show
'F_inicio.Show
Unload Me

End Sub
Private Sub cmd_Cancelar_Click()
    End
End Sub

Private Sub txt_password_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = vbKeyDown Then
    If Len(Trim(txt_usuario.Text)) > 0 Then
        Call CMD_ACEPTAR_Click
    End If
End If
End Sub

Private Sub txt_usuario_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = vbKeyDown Then
    If Len(Trim(txt_usuario.Text)) > 0 Then
        txt_password.SetFocus
    End If
End If
End Sub


