VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FBuscar 
   Caption         =   "Buscar Ingreso"
   ClientHeight    =   2145
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3810
   LinkTopic       =   "Form1"
   ScaleHeight     =   2145
   ScaleWidth      =   3810
   StartUpPosition =   2  'CenterScreen
   Begin MSDataListLib.DataCombo dtcAlmacen 
      Height          =   315
      Left            =   1320
      TabIndex        =   4
      Top             =   480
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   556
      _Version        =   393216
      Style           =   2
      Text            =   ""
   End
   Begin VB.CommandButton cmdAceptar 
      Caption         =   "Aceptar"
      Height          =   375
      Left            =   1200
      TabIndex        =   1
      Top             =   1560
      Width           =   1455
   End
   Begin VB.TextBox txtnumero 
      Height          =   285
      Left            =   1320
      MaxLength       =   10
      TabIndex        =   0
      Top             =   960
      Width           =   2055
   End
   Begin VB.Label Label2 
      Caption         =   "Nro Ingreso"
      Height          =   255
      Left            =   360
      TabIndex        =   3
      Top             =   960
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "Almacen"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   480
      Width           =   975
   End
End
Attribute VB_Name = "FBuscar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim objAlmacen As DB_INV_MANTENIMIENTOS.C_ALMACEN
Private Sub cmdAceptar_Click()
    Call FIngresos.MCargaDatos(dtcAlmacen.BoundText, txtnumero.Text)
    Unload Me
End Sub

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

Private Sub Form_Activate()
    dtcAlmacen.SetFocus
End Sub

Private Sub Form_Load()
    
    Set objAlmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN
    Call GCargaDataCombo(dtcAlmacen, objAlmacen.ListarAlmacenesAyuda, "SiteId", "Name")
    Me.Top = 1300
    Me.Left = (Screen.Width - Me.Width) / 2
    
End Sub
Public Sub GCargaDataCombo(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
' funcion que valida el ingreso de caracteres numéricos
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 txtnumero_KeyPress(KeyAscii As Integer)
   KeyAscii = MValidaNumeros(KeyAscii)
   If KeyAscii = 13 Then
        cmdAceptar.SetFocus
   End If
End Sub
