VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frm_procesocierre 
   Caption         =   "Espere Por Favor...... Procesando"
   ClientHeight    =   4530
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4935
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   4530
   ScaleWidth      =   4935
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdAceptar 
      Caption         =   "Aceptar"
      Height          =   735
      Left            =   3360
      Picture         =   "frm_procesocierre.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   3720
      Width           =   1215
   End
   Begin VB.TextBox txt_ajuste 
      Enabled         =   0   'False
      Height          =   285
      Left            =   360
      TabIndex        =   7
      Top             =   2160
      Visible         =   0   'False
      Width           =   3495
   End
   Begin VB.TextBox txt_generar 
      Enabled         =   0   'False
      Height          =   285
      Left            =   2880
      TabIndex        =   6
      Top             =   1440
      Width           =   495
   End
   Begin MSComCtl2.Animation Animation1 
      Height          =   855
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   4335
      _ExtentX        =   7646
      _ExtentY        =   1508
      _Version        =   393216
      FullWidth       =   289
      FullHeight      =   57
   End
   Begin VB.Label lbl_mensaje3 
      Caption         =   "Agregando Inventario al archivo  Historico"
      Height          =   255
      Left            =   360
      TabIndex        =   11
      Top             =   3000
      Visible         =   0   'False
      Width           =   3495
   End
   Begin VB.Label lbl_status3 
      Caption         =   "OK!"
      Height          =   255
      Left            =   3960
      TabIndex        =   10
      Top             =   3000
      Visible         =   0   'False
      Width           =   735
   End
   Begin VB.Label lbl_status4 
      Caption         =   "OK!"
      Height          =   255
      Left            =   3960
      TabIndex        =   9
      Top             =   3360
      Visible         =   0   'False
      Width           =   735
   End
   Begin VB.Label lbl_mensaje4 
      Caption         =   "Desactivando Toma Inventario"
      Height          =   255
      Left            =   360
      TabIndex        =   8
      Top             =   3360
      Visible         =   0   'False
      Width           =   3495
   End
   Begin VB.Label Label1 
      Caption         =   "Generar Ajuste Automatico"
      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            =   360
      TabIndex        =   5
      Top             =   1440
      Width           =   2415
   End
   Begin VB.Label lbl_status2 
      Caption         =   "OK!"
      Height          =   255
      Left            =   3960
      TabIndex        =   4
      Top             =   2640
      Visible         =   0   'False
      Width           =   735
   End
   Begin VB.Label lbl_status1 
      Caption         =   "OK!"
      Height          =   255
      Left            =   3960
      TabIndex        =   3
      Top             =   1800
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.Label lbl_mensaje2 
      Caption         =   "Actualizando Stock Docs.no Procesados"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   2640
      Visible         =   0   'False
      Width           =   3495
   End
   Begin VB.Label lbl_mensaje1 
      Caption         =   "Generando Ingresos/Salidas x Ajuste Inventario"
      Height          =   255
      Left            =   360
      TabIndex        =   1
      Top             =   1800
      Visible         =   0   'False
      Width           =   3375
   End
End
Attribute VB_Name = "frm_procesocierre"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mobj_cinventario As DB_INV_TOMADEINVENTARIO.C_inventario
Dim mobj_calmacen As DB_INV_MANTENIMIENTOS.C_ALMACEN

Private Sub cmdAceptar_Click()
Unload Me
End Sub

Private Sub Form_Activate()

Set mobj_cinventario = New DB_INV_TOMADEINVENTARIO.C_inventario
Set mobj_calmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN

Dim lbol_ajustado As Boolean
Dim lint_error_ajuste As Integer
Dim lint_error_actualizacion As Integer
Dim lint_error_historico As Integer
Dim lint_error_cierre As Integer

If txt_generar.Text = "SI" Then
    lbl_mensaje1.Visible = True
    Animation1.Play
    'llamada al procedimientod de ajuste automatico
    lint_error_ajuste = mobj_cinventario.ajuste_automatico(GCUSERID)
    If lint_error_ajuste = 1 Then
        lbl_status1.Caption = "Error"
        txt_ajuste.Text = "Ajuste no realizado"
        txt_ajuste.Visible = True
        lbl_status1.Visible = True
        Exit Sub
    Else
        txt_ajuste.Text = "Ajuste realizado"
        lbl_status1.Caption = "Ok"
        txt_ajuste.Visible = True
        lbl_status1.Visible = True
    End If
End If

'llamada al procedimiento de ajuste de documentos no procesados
lbl_mensaje2.Visible = True
lint_error_actualizacion = mobj_cinventario.actualiza_stock_fintomainventario
If lint_error_actualizacion = 1 Then
    lbl_status2.Caption = "Error"
    lbl_status2.Visible = True
    Exit Sub
Else
    lbl_status2.Caption = "Ok"
    lbl_status2.Visible = True
End If

'llamada al procedimiento de historico
lbl_mensaje3.Visible = True
lint_error_historico = mobj_cinventario.inventario_historico
If lint_error_historico = 1 Then
    lbl_status3.Caption = "Error"
    lbl_status3.Visible = True
    Exit Sub
Else
    lbl_status3.Caption = "Ok"
    lbl_status3.Visible = True
End If

lbl_mensaje4.Visible = True
'llamada a la clase de desactivacion
lint_error_cierre = mobj_cinventario.DESACTIVAR_TOMAINVENTARIO
If lint_error_cierre = 1 Then
        MsgBox "Error Desactivando Toma de Inventario ", vbCritical, "Error"
        lbl_status4.Visible = "Error"
End If
 lbl_status4.Visible = True
 cmdAceptar.Enabled = True
 frm_procesocierre.Caption = "Proceso Terminado"
 Animation1.Stop
 
End Sub

Private Sub Form_Load()
cmdAceptar.Enabled = False
Animation1.Open GstrReportesInv + "proceso.avi"

    Me.Top = 1000
    Me.Left = (Screen.Width - Me.Width) / 2

End Sub
Private Sub frm_procesocierre_Click()

End Sub
