VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form FRecalculoStock 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Recálculo de Stock "
   ClientHeight    =   2955
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8580
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2955
   ScaleWidth      =   8580
   Begin TabDlg.SSTab SSTab1 
      Height          =   1935
      Left            =   90
      TabIndex        =   0
      Top             =   60
      Width           =   8370
      _ExtentX        =   14764
      _ExtentY        =   3413
      _Version        =   393216
      Tabs            =   2
      TabHeight       =   520
      TabCaption(0)   =   "General "
      TabPicture(0)   =   "9511000.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Image2"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Image1"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Label1"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).ControlCount=   3
      TabCaption(1)   =   "Por Artículo"
      TabPicture(1)   =   "9511000.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Txtcodarticulo"
      Tab(1).Control(1)=   "cdmbuscararticulo"
      Tab(1).Control(2)=   "lbldescripcion"
      Tab(1).Control(3)=   "Label2"
      Tab(1).ControlCount=   4
      Begin VB.TextBox Txtcodarticulo 
         Height          =   285
         Left            =   -74205
         MaxLength       =   20
         TabIndex        =   3
         Tag             =   "R-Código de Artículo"
         Top             =   735
         Width           =   2175
      End
      Begin VB.CommandButton cdmbuscararticulo 
         Enabled         =   0   'False
         Height          =   375
         Left            =   -71940
         Picture         =   "9511000.frx":0038
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   735
         Width           =   495
      End
      Begin VB.Label Label1 
         Caption         =   "Este proceso realiza el recálculo de Stock  de todos los producto"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   735
         Left            =   1890
         TabIndex        =   8
         Top             =   645
         Width           =   5025
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   960
         Picture         =   "9511000.frx":056A
         Top             =   600
         Width           =   480
      End
      Begin VB.Image Image2 
         Height          =   480
         Left            =   525
         Picture         =   "9511000.frx":09AC
         Top             =   720
         Width           =   480
      End
      Begin VB.Label lbldescripcion 
         BorderStyle     =   1  'Fixed Single
         Height          =   300
         Left            =   -71355
         TabIndex        =   7
         Top             =   750
         Width           =   4455
      End
      Begin VB.Label Label2 
         Caption         =   "Código "
         Height          =   255
         Left            =   -74820
         TabIndex        =   6
         Top             =   750
         Width           =   1215
      End
   End
   Begin MSComCtl2.Animation Animation1 
      Height          =   825
      Left            =   120
      TabIndex        =   5
      Top             =   2040
      Visible         =   0   'False
      Width           =   4680
      _ExtentX        =   8255
      _ExtentY        =   1455
      _Version        =   393216
      FullWidth       =   312
      FullHeight      =   55
   End
   Begin VB.CommandButton cmdActivar 
      Caption         =   "&Recalculo de Stock"
      Height          =   735
      Left            =   5175
      Picture         =   "9511000.frx":0CB6
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   2160
      Width           =   1635
   End
   Begin VB.CommandButton cmdCancelar 
      Caption         =   "&Cancelar"
      Height          =   735
      Left            =   6825
      Picture         =   "9511000.frx":0FC0
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   2160
      Width           =   1620
   End
End
Attribute VB_Name = "FRecalculoStock"
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 pbderecho_anular As Boolean
Public pbderecho_emitir As Boolean
Public pb_tiposcreen As String

'Variable para las ayudas
Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As String
Public GrecibeColumnaOpcional2 As String


Dim MBlnDatosCargados As Boolean
Dim MrslistadodeArticulos As ADODB.Recordset
Dim MobjUtilitarios As DB_UT_MANTENIMIENTOS.C_PROCESOS
Dim MobjArticulo As DB_INV_ARTICULO.C_ARTICULO
  

Private Sub cdmbuscararticulo_Click()
On Error GoTo errhandler
  Dim LArrayBusqueda(1 To 2, 1 To 3) As Variant
  LArrayBusqueda(1, 1) = "INVTIDSKU"
  LArrayBusqueda(1, 2) = "Código"
  LArrayBusqueda(1, 3) = 1000
  LArrayBusqueda(2, 1) = "DESCR"
  LArrayBusqueda(2, 2) = "Descripción"
  LArrayBusqueda(2, 3) = 4500
      
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
  FBusquedasUt.GObtenerRegistros MrslistadodeArticulos, LArrayBusqueda, 2, 2
  FBusquedasUt.Show vbModal
  If GrecibeUbicacion <> 0 Then
     Txtcodarticulo.Text = GrecibeColumnaID
     lbldescripcion.Caption = GrecibeColumnaOpcional
     MBlnDatosCargados = True
  End If

Exit Sub
errhandler:
    MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbExclamation, "Advertencia"
End Sub

Private Sub cmdActivar_Click()
  
On Error GoTo errhandler
  
  If SSTab1.Tab = 0 Then
    Screen.MousePointer = 11
    Animation1.Open GstrReportesVta & "findedia.avi"
    Animation1.Visible = True
    Animation1.Play
  
    MobjUtilitarios.RecalcularStock
       
    Screen.MousePointer = 0
       
    Animation1.AutoPlay = False
    Animation1.Stop
    Animation1.Visible = False
      
  End If
  
  If SSTab1.Tab = 1 Then
     If Trim(Txtcodarticulo.Text) <> Empty Then
        If Trim(lbldescripcion.Caption) <> Empty Then  ' Trim(lbldescripcion.Caption) <> Empty
           Screen.MousePointer = 11
           Animation1.Open GstrReportesVta & "findedia.avi"
           Animation1.Visible = True
           Animation1.Play
        
           MobjUtilitarios.RecalcularStock Txtcodarticulo.Text, 1
           
           Animation1.AutoPlay = False
           Animation1.Stop
           Animation1.Visible = False
        Else
          MsgBox "Código de Artículo no existe", vbDefaultButton1 + vbExclamation, "Advertencia"
          Exit Sub
        End If
     Else
        MsgBox "Debe Ingresar un Código de Artículo", vbDefaultButton1 + vbExclamation, "Advertencia"
        Exit Sub
     End If
  End If
  
  Screen.MousePointer = 0
  MsgBox "Proceso Terminado con éxito ", vbDefaultButton1 + vbExclamation, "Advertencia"
      
  Unload Me
  
Exit Sub
errhandler:
   Animation1.AutoPlay = False
   Animation1.Stop
   Animation1.Visible = False
   Screen.MousePointer = 0
   MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbExclamation, "Advertencia"
   
End Sub
Public Sub salir_formulario()
   cmdcancelar_Click
End Sub

Private Sub cmdcancelar_Click()
   Unload Me
End Sub

Private Sub Form_Load()
    
   Set MobjUtilitarios = New DB_UT_MANTENIMIENTOS.C_PROCESOS
   Set MobjArticulo = New DB_INV_ARTICULO.C_ARTICULO
   Set MrslistadodeArticulos = MobjArticulo.ListarArticulosayuda
   
   Me.Top = 1300
   Me.Left = (Screen.Width - Me.Width) / 2
   cdmbuscararticulo.Enabled = True
   MBlnDatosCargados = False
   
   SSTab1.Tab = 0
   
End Sub

Private Sub Form_Unload(Cancel As Integer)
   
   Set MobjUtilitarios = Nothing
   Set MobjArticulo = Nothing
   Set MrslistadodeArticulos = Nothing

End Sub

Private Sub Txtcodarticulo_Change()
  
  If MBlnDatosCargados = True Then
     lbldescripcion.Caption = Empty
     MBlnDatosCargados = False
  End If
  
End Sub

Private Sub txtcodarticulo_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyF2 Then cdmbuscararticulo_Click
End Sub

Private Sub Txtcodarticulo_KeyPress(KeyAscii As Integer)
On Error GoTo errhanlder
  KeyAscii = GBloqueaCaracter(KeyAscii)
  If KeyAscii = 13 Then
     lbldescripcion.Caption = MobjArticulo.ObtenerDescripcion(Txtcodarticulo.Text)
     If Trim(lbldescripcion.Caption) = Empty Then
        MsgBox "Código de artículo no existe", vbDefaultButton1 + vbExclamation, "Advertencia"
        lbldescripcion.Caption = Empty
        Txtcodarticulo.SetFocus
        MBlnDatosCargados = False
     Else
        cmdActivar.SetFocus
        MBlnDatosCargados = True
     End If
  End If
Exit Sub
errhanlder:
    MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbExclamation, "Advertencia"
End Sub




