VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{5C8CED40-8909-11D0-9483-00A0C91110ED}#1.0#0"; "MSDATREP.OCX"
Begin VB.Form fingresostockbloque 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Ingreso de Stock Fisico por Bloque"
   ClientHeight    =   5805
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   12120
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5805
   ScaleWidth      =   12120
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin MSDataRepeaterLib.DataRepeater dtr_fisico 
      Bindings        =   "fingresostockbloque.frx":0000
      Height          =   3960
      Left            =   0
      TabIndex        =   2
      Top             =   480
      Width           =   11955
      _ExtentX        =   21087
      _ExtentY        =   6985
      _StreamID       =   -1412567295
      _Version        =   393216
      Caption         =   $"fingresostockbloque.frx":0011
      BeginProperty RepeatedControlName {21FC0FC0-1E5C-11D1-A327-00AA00688B10} 
         _StreamID       =   -1412567295
         _Version        =   65536
         Name            =   "Pry_StockPorBloque.ctrl_stockb"
      EndProperty
   End
   Begin VB.Frame Frame1 
      Caption         =   "Ubicar Artículo"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   0
      TabIndex        =   12
      Top             =   4440
      Width           =   4455
      Begin VB.ComboBox cmbCampo 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         ItemData        =   "fingresostockbloque.frx":00E2
         Left            =   2520
         List            =   "fingresostockbloque.frx":00EC
         Style           =   2  'Dropdown List
         TabIndex        =   14
         Top             =   240
         Width           =   1815
      End
      Begin VB.TextBox TxtCodArticulo 
         Height          =   285
         Left            =   120
         TabIndex        =   13
         Top             =   240
         Width           =   2295
      End
   End
   Begin MSComCtl2.Animation Animation1 
      Height          =   615
      Left            =   4800
      TabIndex        =   7
      Top             =   4560
      Visible         =   0   'False
      Width           =   3855
      _ExtentX        =   6800
      _ExtentY        =   1085
      _Version        =   393216
      FullWidth       =   257
      FullHeight      =   41
   End
   Begin VB.TextBox TXT_TODOS 
      Enabled         =   0   'False
      Height          =   285
      Left            =   9480
      TabIndex        =   6
      Top             =   120
      Visible         =   0   'False
      Width           =   495
   End
   Begin VB.TextBox txt_lista 
      Enabled         =   0   'False
      Height          =   285
      Left            =   4680
      TabIndex        =   5
      Top             =   120
      Width           =   4455
   End
   Begin VB.TextBox txt_grupo 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1920
      TabIndex        =   3
      Top             =   120
      Width           =   2655
   End
   Begin VB.CommandButton cmd_cancelar 
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      Height          =   735
      Left            =   10800
      Picture         =   "fingresostockbloque.frx":0105
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4920
      Width           =   1215
   End
   Begin VB.CommandButton cmd_aceptar 
      Caption         =   "Grabar"
      Height          =   735
      Left            =   9240
      Picture         =   "fingresostockbloque.frx":040F
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   4920
      Width           =   1455
   End
   Begin VB.Label lblReg 
      Alignment       =   1  'Right Justify
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   8640
      TabIndex        =   11
      Top             =   4560
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "Registros Recuperados"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   9960
      TabIndex        =   10
      Top             =   4560
      Width           =   2055
   End
   Begin VB.Label lbl_mensaje2 
      Caption         =   "Procesando....."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4800
      TabIndex        =   9
      Top             =   5400
      Visible         =   0   'False
      Width           =   2055
   End
   Begin VB.Label lbl_mensaje1 
      Caption         =   "Espere Por Favor"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4800
      TabIndex        =   8
      Top             =   5160
      Visible         =   0   'False
      Width           =   2535
   End
   Begin VB.Label Label1 
      Caption         =   "Agrupado Por:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   480
      TabIndex        =   4
      Top             =   120
      Width           =   1455
   End
End
Attribute VB_Name = "fingresostockbloque"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As String 'columna para codigo de compra
Public GrecibeColumnaOpcional2 As String
Public GrecibeColumnaOpcional3 As String
Public GrecibeColumnaOpcional4 As String

Dim bln_busqueda As Boolean

Dim mobj_tomainventario As DB_INV_TOMADEINVENTARIO.C_inventario
Dim rs As ADODB.Recordset
Dim lint_nart As Integer    'numero de articulos recuperados

'Private Sub cdmbuscararticulo_Click()
'    'Lineas que llaman al Formulario de Búsqueda
'
'     bln_busqueda = True
'
'     Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
'     ArrayBusqueda(1, 1) = "INVTIDSKU"
'     ArrayBusqueda(1, 2) = "Código "
'     ArrayBusqueda(1, 3) = 1000
'     ArrayBusqueda(2, 1) = "Descr"
'     ArrayBusqueda(2, 2) = "Descripción "
'     ArrayBusqueda(2, 3) = 4000
'
'     FBusquedasInv2.GObtenerRegistros mobj_tomainventario.ART_SELECCIONADOS_PARA_AYUDA(txt_grupo.Text, Val(TXT_TODOS.Text), txt_lista.Text), ArrayBusqueda, 2, 2
'     FBusquedasInv2.Show vbModal
'
'     If GrecibeUbicacion <> 0 Then
'         TxtCodArticulo.Text = GrecibeColumnaID
'     End If
'
'     bln_busqueda = False
     
'End Sub

Private Sub CMD_ACEPTAR_Click()


If lint_nart > 0 Then
    Dim lstr_video As String
    lstr_video = GstrReportesInv + "proceso.avi"
    Me.Refresh
    Animation1.Open lstr_video
    Animation1.Visible = True
    lbl_mensaje1.Visible = True
    lbl_mensaje2.Visible = True
    Me.Refresh
    Animation1.Play
    
    Screen.MousePointer = 11
    'LLAMAR AL PROCEDIMIENTO DE GRABAR
    If rs.EOF Then rs.MovePrevious
    If Not rs.EOF Then rs.MoveNext
    
    mobj_tomainventario.ACTUALIZA_stock_cluster rs
    Animation1.Stop
    Animation1.Visible = False
    lbl_mensaje1.Visible = False
    lbl_mensaje2.Visible = False
    Screen.MousePointer = 0
    MsgBox "Cambios Grabados", vbInformation, "Stock por Bloque"
    Unload Me
Else
    MsgBox "No existen Registros para Grabar", vbExclamation, "Stock por Bloque"
End If
End Sub

Private Sub CMD_CANCELAR_Click()
Unload Me
End Sub

Private Sub dtr_fisico_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo errhandler
If (KeyCode = vbKeyDown Or KeyCode = vbKeyReturn) And Not rs.EOF Then
    rs.MoveNext
End If
If KeyCode = 38 And Not rs.BOF Then
    rs.MovePrevious
    'rs.UpdateBatch
End If
Exit Sub
errhandler:
  MsgBox Err.Description, vbDefaultButton1 + vbExclamation, "Advertencia"
End Sub
Private Sub Form_Activate()
Dim lstr_grupo As String
Dim lint_todos As Integer
Dim lstr_lista As String

lstr_grupo = txt_grupo.Text
lint_todos = Val(TXT_TODOS.Text)
lstr_lista = txt_lista.Text

Set mobj_tomainventario = New DB_INV_TOMADEINVENTARIO.C_inventario

'rs.CursorLocation = adUseClient
Set rs = mobj_tomainventario.ART_SELECCIONADOS_CLUSTER(lstr_grupo, lint_todos, lstr_lista).Clone
  
lint_nart = rs.RecordCount
lblReg.Caption = Str(lint_nart)

Set dtr_fisico.DataSource = rs
dtr_fisico.RepeaterBindings.Add "ncat", "ncat"
dtr_fisico.RepeaterBindings.Add "nscat", "nscat"
dtr_fisico.RepeaterBindings.Add "idprod", "invtidsku"
dtr_fisico.RepeaterBindings.Add "descr", "descr"
dtr_fisico.RepeaterBindings.Add "fisico", "stockphisical"
dtr_fisico.Refresh
dtr_fisico.SetFocus

End Sub

Public Sub salir_formulario()

End Sub

Private Sub Form_Load()
    cmbCampo.ListIndex = 0
End Sub

Private Sub TxtCodArticulo_Change()
    
    On Error Resume Next
    rs.MoveFirst
    If cmbCampo.ListIndex = 0 Then
        rs.Find "INVTIDSKU" & " LIKE '" & Trim(TxtCodArticulo.Text) & "%'"
        'Mi Mercado: modificado por Jorge Illescas
        'Codigo para hacer busqueda por Codigo Alternativo
        If rs.EOF Then 'No encontro el registro buscado
           rs.MoveFirst
           rs.Find "INVTIDBARR" & " LIKE '" & Trim(TxtCodArticulo.Text) & "%'"
        End If
    Else
        rs.Find "DESCR" & " LIKE '" & Trim(TxtCodArticulo.Text) & "%'"
    End If
End Sub

Private Sub TxtCodArticulo_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    dtr_fisico.SetFocus
End If
End Sub


