VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "crystl32.ocx"
Begin VB.Form FVendedor 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Vendedor (01.140.00)"
   ClientHeight    =   6390
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6615
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   6390
   ScaleWidth      =   6615
   Begin VB.CommandButton cmdBusUsuarios 
      Height          =   375
      Left            =   4080
      Picture         =   "0114000.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   18
      Top             =   5880
      Width           =   375
   End
   Begin MSDataListLib.DataCombo dtcUsuarios 
      Height          =   315
      Left            =   1200
      TabIndex        =   17
      Top             =   5880
      Width           =   2775
      _ExtentX        =   4895
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin VB.CommandButton cmdBusEstadoVend 
      Height          =   375
      Left            =   5040
      Picture         =   "0114000.frx":0532
      Style           =   1  'Graphical
      TabIndex        =   16
      Top             =   5400
      Width           =   375
   End
   Begin MSDataListLib.DataCombo dtcEstadoVendedor 
      Height          =   315
      Left            =   1800
      TabIndex        =   15
      Top             =   5400
      Width           =   3135
      _ExtentX        =   5530
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin Crystal.CrystalReport crvendedores 
      Left            =   5400
      Top             =   360
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   348160
      PrintFileLinesPerPage=   60
   End
   Begin VB.TextBox txtLugar2 
      Height          =   285
      Left            =   1800
      TabIndex        =   14
      Top             =   4930
      Width           =   4575
   End
   Begin VB.TextBox txtLugar1 
      Height          =   285
      Left            =   1800
      TabIndex        =   13
      Top             =   4467
      Width           =   4575
   End
   Begin MSComCtl2.DTPicker dtpFechaNac 
      Height          =   285
      Left            =   1200
      TabIndex        =   11
      Top             =   4004
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   503
      _Version        =   393216
      Format          =   21364737
      CurrentDate     =   37565
   End
   Begin VB.TextBox txtPassword 
      Height          =   285
      IMEMode         =   3  'DISABLE
      Left            =   1200
      MaxLength       =   15
      PasswordChar    =   "*"
      TabIndex        =   10
      Top             =   3541
      Width           =   2055
   End
   Begin VB.CommandButton cmdBusAlmacen 
      Height          =   375
      Left            =   4440
      MouseIcon       =   "0114000.frx":0A64
      MousePointer    =   99  'Custom
      Picture         =   "0114000.frx":0BB6
      Style           =   1  'Graphical
      TabIndex        =   7
      ToolTipText     =   "Buscar Almacén"
      Top             =   2122
      Width           =   375
   End
   Begin MSComCtl2.DTPicker dtpFechaInicio 
      Height          =   285
      Left            =   4800
      TabIndex        =   12
      Top             =   4004
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   503
      _Version        =   393216
      Format          =   21364737
      CurrentDate     =   37565
   End
   Begin VB.ComboBox cmbSexo 
      Height          =   315
      ItemData        =   "0114000.frx":10E8
      Left            =   1200
      List            =   "0114000.frx":10F2
      Style           =   2  'Dropdown List
      TabIndex        =   4
      Top             =   1629
      Width           =   615
   End
   Begin VB.TextBox txtTelefono 
      Height          =   285
      Left            =   4920
      MaxLength       =   10
      TabIndex        =   5
      Top             =   1629
      Width           =   1455
   End
   Begin VB.TextBox txtDNI 
      Height          =   285
      Left            =   1200
      MaxLength       =   10
      TabIndex        =   3
      Top             =   1166
      Width           =   1455
   End
   Begin VB.CommandButton cmdBuscar 
      Enabled         =   0   'False
      Height          =   375
      Left            =   2760
      Picture         =   "0114000.frx":10FC
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   240
      Width           =   375
   End
   Begin VB.TextBox txtDireccion2 
      Height          =   285
      Left            =   1200
      MaxLength       =   50
      TabIndex        =   9
      Top             =   3078
      Width           =   5175
   End
   Begin VB.TextBox txtCodigo 
      Height          =   285
      Left            =   1200
      MaxLength       =   10
      TabIndex        =   0
      Top             =   240
      Width           =   1455
   End
   Begin VB.TextBox txtDireccion1 
      Height          =   285
      Left            =   1200
      MaxLength       =   50
      TabIndex        =   8
      Top             =   2615
      Width           =   5175
   End
   Begin VB.TextBox txtDescripcion 
      Height          =   285
      Left            =   1200
      MaxLength       =   50
      TabIndex        =   2
      Top             =   703
      Width           =   3735
   End
   Begin MSDataListLib.DataCombo dtcAlmacen 
      Height          =   315
      Left            =   1200
      TabIndex        =   6
      Top             =   2122
      Width           =   3135
      _ExtentX        =   5530
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin VB.Image Image1 
      Height          =   630
      Left            =   5730
      Picture         =   "0114000.frx":162E
      Stretch         =   -1  'True
      Top             =   240
      Width           =   585
   End
   Begin VB.Label lblUsuario 
      Caption         =   "Usuario"
      Height          =   255
      Left            =   120
      TabIndex        =   33
      Top             =   5880
      Width           =   735
   End
   Begin VB.Label lblEstadoVendedor 
      AutoSize        =   -1  'True
      Caption         =   "Estado Vendedor"
      Height          =   195
      Left            =   120
      TabIndex        =   32
      Top             =   5400
      Width           =   1230
   End
   Begin VB.Label lblLugarNac2 
      AutoSize        =   -1  'True
      Caption         =   "Lugar Nacimiento2"
      Height          =   195
      Left            =   120
      TabIndex        =   31
      Top             =   4940
      Width           =   1335
   End
   Begin VB.Label lblLugarNac1 
      AutoSize        =   -1  'True
      Caption         =   "Lugar Nacimiento1"
      Height          =   195
      Left            =   120
      TabIndex        =   30
      Top             =   4482
      Width           =   1335
   End
   Begin VB.Label lblFech_Nac 
      AutoSize        =   -1  'True
      Caption         =   "Fecha Nac."
      Height          =   195
      Left            =   120
      TabIndex        =   29
      Top             =   4024
      Width           =   840
   End
   Begin VB.Label lblPassword 
      AutoSize        =   -1  'True
      Caption         =   "Password"
      Height          =   195
      Left            =   120
      TabIndex        =   28
      Top             =   3566
      Width           =   690
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Almacen"
      Height          =   315
      Left            =   120
      TabIndex        =   27
      Top             =   2072
      Width           =   615
   End
   Begin VB.Label lblFechaInicio 
      AutoSize        =   -1  'True
      Caption         =   "Fecha Inicio"
      Height          =   195
      Left            =   3720
      TabIndex        =   26
      Top             =   4004
      Width           =   870
   End
   Begin VB.Label lblSexo 
      AutoSize        =   -1  'True
      Caption         =   "Sexo"
      Height          =   195
      Left            =   120
      TabIndex        =   25
      Top             =   1614
      Width           =   360
   End
   Begin VB.Label lblTelefono 
      AutoSize        =   -1  'True
      Caption         =   "Teléfono"
      Height          =   195
      Left            =   4080
      TabIndex        =   24
      Top             =   1629
      Width           =   630
   End
   Begin VB.Label lblDNI 
      AutoSize        =   -1  'True
      Caption         =   "DNI"
      Height          =   195
      Left            =   120
      TabIndex        =   23
      Top             =   1156
      Width           =   285
   End
   Begin VB.Label lblDireccion2 
      AutoSize        =   -1  'True
      Caption         =   "Dirección 2"
      Height          =   195
      Left            =   120
      TabIndex        =   22
      Top             =   3108
      Width           =   810
   End
   Begin VB.Label lblCodigo 
      AutoSize        =   -1  'True
      Caption         =   "Código "
      Height          =   195
      Left            =   120
      TabIndex        =   21
      Top             =   240
      Width           =   540
   End
   Begin VB.Label lblNombre 
      AutoSize        =   -1  'True
      Caption         =   "Nombre"
      Height          =   195
      Left            =   120
      TabIndex        =   20
      Top             =   698
      Width           =   555
   End
   Begin VB.Label lblDireccion1 
      AutoSize        =   -1  'True
      Caption         =   "Dirección 1"
      Height          =   195
      Left            =   120
      TabIndex        =   19
      Top             =   2650
      Width           =   810
   End
End
Attribute VB_Name = "FVendedor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Option Explicit
Public pb_editar As Boolean
Public pb_agregar As Boolean
Public pb_primerregistro As Boolean
Public pb_ultimoregistro As Boolean

Public pbderecho_agregar As Boolean
Public pbderecho_consultar As Boolean
Public pbderecho_editar As Boolean
Public pbderecho_borrar As Boolean
Public pbderecho_imprimir As Boolean
Public pb_tiposcreen As String

Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As String

Public rs_vendedores As ADODB.Recordset
Public objAlmacen As DB_INV_MANTENIMIENTOS.C_ALMACEN
Public objEstadoVendedor As DB_OP_MANTENIMIENTOS.C_ESTADO_VENDEDOR
Public objVendedor As DB_OP_MANTENIMIENTOS.C_VENDEDOR
Public objUsuarios As DB_SE_MANTENIMIENTOS.C_USUARIO

Private Sub cmbSexo_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtTelefono.SetFocus
    End If
End Sub

Private Sub cmdBusAlmacen_Click()
    'Lineas que llaman al Formulario de Búsqueda
    
    Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
    ArrayBusqueda(1, 1) = "siteid"
    ArrayBusqueda(1, 2) = "Código "
    ArrayBusqueda(1, 3) = 1000
    ArrayBusqueda(2, 1) = "name"
    ArrayBusqueda(2, 2) = "Descripción "
    ArrayBusqueda(2, 3) = 4000
      
    FBusquedasMa.GObtenerRegistros objAlmacen.ListarAlmacenesAyuda, ArrayBusqueda, 2, 2
    FBusquedasMa.Show vbModal
    
    If GrecibeUbicacion <> 0 Then
        dtcAlmacen.BoundText = GrecibeColumnaID
    End If
End Sub

Private Sub cmdBuscar_Click()
    'Lineas que llaman al Formulario de Búsqueda
    
    Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
    ArrayBusqueda(1, 1) = "salesperid"
    ArrayBusqueda(1, 2) = "Código "
    ArrayBusqueda(1, 3) = 1000
    ArrayBusqueda(2, 1) = "salespername"
    ArrayBusqueda(2, 2) = "Descripción "
    ArrayBusqueda(2, 3) = 4000
      
          
    FBusquedasMa.GObtenerRegistros rs_vendedores, ArrayBusqueda, 2, 2
    FBusquedasMa.Show vbModal
    If GrecibeUbicacion <> 0 And GrecibeUbicacion <= rs_vendedores.RecordCount Then
          rs_vendedores.AbsolutePosition = GrecibeUbicacion
          asigna_campos
          Call gestadoactualrs(Me, rs_vendedores)
          Call gactualiza_barra(Me) 'pb_editar, pb_primerregistro, pb_ultimoregistro)
    End If
  
End Sub

Private Sub cmdBusEstadoVend_Click()
    'Lineas que llaman al Formulario de Búsqueda
    
    Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
    ArrayBusqueda(1, 1) = "STATUSPERSONID"
    ArrayBusqueda(1, 2) = "Código "
    ArrayBusqueda(1, 3) = 1000
    ArrayBusqueda(2, 1) = "DESCRSTATUSPERSON"
    ArrayBusqueda(2, 2) = "Descripción "
    ArrayBusqueda(2, 3) = 4000
      
    FBusquedasMa.GObtenerRegistros objEstadoVendedor.ListarEstados_VendedoresAyuda, ArrayBusqueda, 2, 2
    FBusquedasMa.Show vbModal
    
    If GrecibeUbicacion <> 0 Then
       dtcEstadoVendedor.BoundText = GrecibeColumnaID
    End If
End Sub

Private Sub cmdBusUsuarios_Click()
    'Lineas que llaman al Formulario de Búsqueda
    
    Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
    ArrayBusqueda(1, 1) = "USERID"
    ArrayBusqueda(1, 2) = "Código "
    ArrayBusqueda(1, 3) = 1000
    ArrayBusqueda(2, 1) = "USERNAME"
    ArrayBusqueda(2, 2) = "Nombre "
    ArrayBusqueda(2, 3) = 4000
      
    FBusquedasMa.GObtenerRegistros objUsuarios.ListarUsuariosAyuda, ArrayBusqueda, 2, 2
    FBusquedasMa.Show vbModal
    
    If GrecibeUbicacion <> 0 Then
       dtcUsuarios.BoundText = GrecibeColumnaID
    End If
End Sub

Private Sub dtcAlmacen_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtDireccion1.SetFocus
    End If
End Sub

Private Sub dtcEstadoVendedor_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        dtcUsuarios.SetFocus
    End If
End Sub

Private Sub dtpFechaInicio_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        txtLugar1.SetFocus
    End If
End Sub

Private Sub dtpFechaNac_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        dtpFechaInicio.SetFocus
    End If
End Sub

Private Sub Form_Activate()

    Call gactualizaopcion(pbderecho_agregar, pbderecho_editar, pbderecho_borrar, pbderecho_imprimir)
    Call gactualiza_barra(Me) 'pb_editar, pb_primerregistro, pb_ultimoregistro)
    'lineas nuevas
    If pbderecho_consultar = False Then
        Unload Me
    End If

End Sub

Public Sub primer_registro()
    Call Gprimer_registro(Me, rs_vendedores)
    Call asigna_campos
End Sub

Public Sub ultimo_registro()
    Call Gultimo_registro(Me, rs_vendedores)
    Call asigna_campos
End Sub

Public Sub registro_anterior()
    Call Gregistro_anterior(Me, rs_vendedores)
    Call asigna_campos
End Sub
Public Sub registro_siguiente()
    Call Gregistro_siguiente(Me, rs_vendedores)
    Call asigna_campos
End Sub
Private Sub Form_Initialize()
    Call gHabilitarReg(Me, False)
End Sub

Private Sub Form_Load()
    'seguridad
    Call gseguridad(Me)
    
    If pbderecho_consultar Then
        Dim numreg As Long
        Set objVendedor = New DB_OP_MANTENIMIENTOS.C_VENDEDOR
        Set objAlmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN
        Set objEstadoVendedor = New DB_OP_MANTENIMIENTOS.C_ESTADO_VENDEDOR
        Set objUsuarios = New DB_SE_MANTENIMIENTOS.C_USUARIO
        
        Call obtener_datos
        Call CargaDataCombo(dtcAlmacen, objAlmacen.ListarAlmacenesPorStatus(1), "SiteId", "Name")
        Call CargaDataCombo(dtcEstadoVendedor, objEstadoVendedor.ListarEstados_Vendedores, "STATUSPERSONID", "DESCRSTATUSPERSON")
        Call CargaDataCombo(dtcUsuarios, objUsuarios.ListarUsuariosAyuda, "USERID", "USERNAME")
        Call asigna_campos
        
        pb_primerregistro = True
    'lineas nuevas
    Else
        'Unload Me
        MsgBox ("No tiene Derechos de Consultar en este formulario"), vbCritical + vbDefaultButton1, "Mensaje"
    End If
     Me.Top = 100
     Me.Left = (Screen.Width - Me.Width) / 2
     
 
End Sub
Public Sub borrar_registro()

On Error GoTo errhandler

    objVendedor.EliminarVendedor txtCodigo
    Call gborrar_Registro(Me, rs_vendedores, txtCodigo)
    
Exit Sub

errhandler:
    MsgBox MensajedeError(ERR.Number, ERR.Description), vbDefaultButton1 + vbCritical, "Error"

End Sub
Function valida_datos()
    If GVDATO(txtCodigo.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Código de Vendedor", vbInformation, "Error"
        txtCodigo.SetFocus
        Exit Function
    End If
   
    If GVDATO(txtDescripcion.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Nombre del Vendedor", vbInformation, "Error"
        txtDescripcion.SetFocus
        Exit Function
    End If

    If GVDATO(txtDNI.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Documento de Identidad del Vendedor", vbInformation, "Error"
        txtDNI.SetFocus
        Exit Function
    End If
    
    If GVDATO(cmbSexo.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Sexo del Vendedor", vbInformation, "Error"
        cmbSexo.SetFocus
        Exit Function
    End If
    
    If GVDATO(dtcAlmacen.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Almacen", vbInformation, "Error"
        dtcAlmacen.SetFocus
        Exit Function
    End If
    
    If GVDATO(txtDireccion1.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dirección del Vendedor", vbInformation, "Error"
        txtDireccion1.SetFocus
        Exit Function
    End If
    
    If GVDATO(txtPassword.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Password del Vendedor", vbInformation, "Error"
        txtPassword.SetFocus
        Exit Function
    End If

    If GVDATO(dtcEstadoVendedor.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Estado del Vendedor", vbInformation, "Error"
        dtcEstadoVendedor.SetFocus
        Exit Function
    End If
    
    If GVDATO(dtcUsuarios.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Usuario para Vendedor", vbInformation, "Error"
        dtcUsuarios.SetFocus
        Exit Function
    End If
    
    valida_datos = True
End Function
Public Sub grabar_registro()

On Error GoTo errhandler
    If valida_datos() = True Then
        ' llamada al proc de grabacion
        If pb_agregar Then
            objVendedor.AgregarVendedor Trim(txtCodigo), Trim(txtDescripcion), Trim(txtDNI), Trim(txtTelefono), cmbSexo.Text, dtpFechaInicio.Value, _
                                        dtcAlmacen.BoundText, Trim(txtDireccion1), Trim(txtDireccion2), Encrip(Trim(UCase(txtPassword))), dtpFechaNac.Value, _
                                        Trim(txtLugar1), Trim(txtLugar2), dtcEstadoVendedor.BoundText, GCUSERID, dtcUsuarios.BoundText
        Else
            objVendedor.ActualizarVendedor txtCodigo, Trim(txtDescripcion), Trim(txtDNI), Trim(txtTelefono), cmbSexo, dtpFechaInicio.Value, _
                                        dtcAlmacen.BoundText, Trim(txtDireccion1), Trim(txtDireccion2), Encrip(Trim(UCase(txtPassword))), dtpFechaNac.Value, _
                                        Trim(txtLugar1), Trim(txtLugar2), dtcEstadoVendedor.BoundText, GCUSERID, dtcUsuarios.BoundText
        End If
        
        Call ggrabar_registro(Me)
        actualizar_registro
    End If
Exit Sub
errhandler:
    MsgBox MensajedeError(ERR.Number, ERR.Description), vbDefaultButton1 + vbCritical, "Error"
          
End Sub
Public Sub actualizar_registro()
    'llamar al procedimiento de carga
    Call obtener_datos
    Call asigna_campos
    'MsgBox ("Registros Actualizados")
End Sub
Public Sub agregar_registro()
    Call gagregar_registro(Me, txtCodigo)
    dtpFechaNac.Value = Now
    dtpFechaInicio = Now
    cmbSexo.ListIndex = 0
End Sub
Public Sub modificar_registro()
    Call gmodificar_registro(Me, txtCodigo)
End Sub
Public Sub descartar_registro()
    ' Revertir cambios
    'adodc1.Recordset.CancelUpdate
    Call gdescartar_registro(Me)
    Call asigna_campos
End Sub

Sub obtener_datos()
    Set rs_vendedores = objVendedor.ListarVendedores
End Sub

Sub salir_formulario()
    ' validar que no haya procesos pendientes
    ' si no hay problemas
    MDIFMaestros.Toolbar1.Buttons(18).Caption = "Salir"    ' boton salir
    Unload Me
End Sub

Sub asigna_campos() ' falta decidir si va ha ser public o private
    If rs_vendedores.RecordCount <> 0 Then
        txtCodigo.Text = rs_vendedores!SALESPERID
        txtDescripcion.Text = rs_vendedores!SALESPERNAME
        txtDNI.Text = rs_vendedores!IDENTITYDOC
        txtTelefono.Text = GVDATO(rs_vendedores!PHONE)
        cmbSexo.Text = rs_vendedores!SEX
        dtpFechaInicio.Value = rs_vendedores!INITIALDATE
        dtcAlmacen.BoundText = rs_vendedores!SITEID
        txtDireccion1.Text = GVDATO(rs_vendedores!ADDRESS1)
        txtDireccion2.Text = GVDATO(rs_vendedores!ADDRESS2)
        txtPassword.Text = Encrip(Trim(rs_vendedores!Password))
        dtpFechaNac.Value = rs_vendedores!BIRTHDATE
        txtLugar1.Text = GVDATO(rs_vendedores!BIRTHADDRESS1)
        txtLugar2.Text = GVDATO(rs_vendedores!BIRTHADDRESS2)
        dtcEstadoVendedor.BoundText = rs_vendedores!STATUSPERSONID
        dtcUsuarios.BoundText = rs_vendedores!ACCESSUSERID
    End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If pb_editar Then
        If MsgBox("Desea Cancelar los Cambios", vbYesNo, "Esta Modificando un registro") = vbNo Then
            Cancel = True
        Else
            Call gdesactiva_barra
        End If
    Else
        Call gdesactiva_barra
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set objVendedor = Nothing
    Set rs_vendedores = Nothing
    Set objAlmacen = Nothing
    Set objEstadoVendedor = Nothing
    Set objUsuarios = Nothing
End Sub


Private Sub txtCodigo_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        txtDescripcion.SetFocus
    End If
End Sub

Sub imprimir()
    crvendedores.ReportFileName = GstrReportesInv + "rpt_vendedores.rpt"
    crvendedores.WindowTitle = "Reporte de Vendedores"
    crvendedores.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
    crvendedores.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='01.140.00'"
    crvendedores.WindowState = crptMaximized
    crvendedores.WindowShowPrintSetupBtn = True
    crvendedores.Action = 1
    
End Sub

Private Sub txtDescripcion_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        txtDNI.SetFocus
    End If
End Sub

Public Sub CargaDataCombo(objDataCombo As DataCombo, rsSource As Recordset, istrCampo1 As String, istrCampo2 As String)

    Set objDataCombo.DataSource = rsSource
    objDataCombo.DataField = istrCampo2
    Set objDataCombo.RowSource = rsSource
    objDataCombo.ListField = istrCampo2
    objDataCombo.BoundColumn = istrCampo1
    
    If Not rsSource.EOF Then
        objDataCombo.BoundText = rsSource.Fields(istrCampo2)
    End If

End Sub
Private Function MValidaNumeros(KeyAscii As Integer) As Integer
    If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 13 Or KeyAscii = 8 Then
        MValidaNumeros = KeyAscii
    Else
        MValidaNumeros = 0
    End If
End Function

Private Sub txtDireccion1_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        txtDireccion2.SetFocus
    End If
End Sub

Private Sub txtDireccion2_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        txtPassword.SetFocus
    End If
End Sub

Private Sub txtDNI_KeyPress(KeyAscii As Integer)
    KeyAscii = MValidaNumeros(KeyAscii)
    If KeyAscii = 13 Then
        cmbSexo.SetFocus
    End If
End Sub

Private Sub txtEdad_KeyPress(KeyAscii As Integer)
    KeyAscii = MValidaNumeros(KeyAscii)
End Sub

Private Sub txtLugar1_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        txtLugar2.SetFocus
    End If
End Sub

Private Sub txtLugar2_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        dtcEstadoVendedor.SetFocus
    End If
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)
    KeyAscii = GBloqueaCaracter(KeyAscii)
    If KeyAscii = 13 Then
        dtpFechaNac.SetFocus
    End If
End Sub

Private Sub txtTelefono_KeyPress(KeyAscii As Integer)
    KeyAscii = MValidaNumeros(KeyAscii)
    If KeyAscii = 13 Then
        dtcAlmacen.SetFocus
    End If
End Sub
