VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{C4DED68B-C40F-11D6-AD1A-000795CA0957}#50.0#0"; "pry_list.ocx"
Object = "{2FF9B179-0BCC-11D7-8EF7-000795CE4721}#1.0#0"; "pry_listpicture.ocx"
Begin VB.Form Finicioinventario 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Inicio de Inventario Fisico (10.150.00)"
   ClientHeight    =   5925
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9555
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   5925
   ScaleWidth      =   9555
   Begin TabDlg.SSTab SSTab1 
      Height          =   5895
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   9495
      _ExtentX        =   16748
      _ExtentY        =   10398
      _Version        =   393216
      Tab             =   2
      TabHeight       =   617
      TabCaption(0)   =   "Seleccion Agrupamiento (1)"
      TabPicture(0)   =   "1015000.frx":0000
      Tab(0).ControlEnabled=   0   'False
      Tab(0).Control(0)=   "Frame2"
      Tab(0).Control(1)=   "cmd_cancelar"
      Tab(0).Control(2)=   "cmd_grabar"
      Tab(0).ControlCount=   3
      TabCaption(1)   =   "Seleccion  Articulos (2)"
      TabPicture(1)   =   "1015000.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "CMD_GRABAART"
      Tab(1).Control(1)=   "CMD_CANCELAART"
      Tab(1).Control(2)=   "Frame3"
      Tab(1).ControlCount=   3
      TabCaption(2)   =   "Activar Toma inventario (3)"
      TabPicture(2)   =   "1015000.frx":0038
      Tab(2).ControlEnabled=   -1  'True
      Tab(2).Control(0)=   "cmdSalir"
      Tab(2).Control(0).Enabled=   0   'False
      Tab(2).Control(1)=   "cmdAceptar"
      Tab(2).Control(1).Enabled=   0   'False
      Tab(2).Control(2)=   "Frame1"
      Tab(2).Control(2).Enabled=   0   'False
      Tab(2).ControlCount=   3
      Begin VB.Frame Frame1 
         Height          =   3855
         Left            =   240
         TabIndex        =   22
         Top             =   600
         Width           =   9135
         Begin VB.TextBox txt_fechainicio 
            Enabled         =   0   'False
            Height          =   375
            Left            =   960
            TabIndex        =   28
            Top             =   1680
            Width           =   1695
         End
         Begin VB.Frame fr_opciones 
            Caption         =   "Cambiar a"
            Height          =   2055
            Left            =   4800
            TabIndex        =   24
            Top             =   1440
            Width           =   3615
            Begin VB.OptionButton opt_desactivado 
               Caption         =   "Desactivado"
               Height          =   855
               Left            =   2160
               Picture         =   "1015000.frx":0054
               Style           =   1  'Graphical
               TabIndex        =   26
               Top             =   600
               Width           =   1095
            End
            Begin VB.OptionButton opt_activado 
               Caption         =   "Activado"
               Height          =   855
               Left            =   240
               Picture         =   "1015000.frx":0496
               Style           =   1  'Graphical
               TabIndex        =   25
               Top             =   600
               Width           =   1095
            End
         End
         Begin VB.TextBox txt_estado 
            Enabled         =   0   'False
            Height          =   375
            Left            =   960
            TabIndex        =   23
            Top             =   720
            Width           =   3135
         End
         Begin VB.Label Label11 
            Caption         =   $"1015000.frx":08D8
            Height          =   855
            Left            =   360
            TabIndex        =   5
            Top             =   2400
            Width           =   3135
         End
         Begin VB.Label Label2 
            Caption         =   "Fecha Inicio Ultimo Inventario:"
            Height          =   255
            Left            =   960
            TabIndex        =   29
            Top             =   1440
            Width           =   2175
         End
         Begin VB.Image Image3 
            Height          =   480
            Left            =   240
            Picture         =   "1015000.frx":095F
            Top             =   600
            Width           =   480
         End
         Begin VB.Label Label1 
            Caption         =   "Estado Actual del Inventario Fisico"
            Height          =   255
            Left            =   960
            TabIndex        =   27
            Top             =   360
            Width           =   2655
         End
      End
      Begin VB.CommandButton cmdAceptar 
         Caption         =   "&Grabar"
         Height          =   735
         Left            =   6360
         Picture         =   "1015000.frx":0DA1
         Style           =   1  'Graphical
         TabIndex        =   21
         Top             =   4680
         Width           =   1215
      End
      Begin VB.CommandButton cmdSalir 
         Caption         =   "Sa&lir"
         Height          =   735
         Left            =   7680
         Picture         =   "1015000.frx":12D3
         Style           =   1  'Graphical
         TabIndex        =   20
         Top             =   4680
         Width           =   1215
      End
      Begin VB.CommandButton cmd_grabar 
         Caption         =   "&Grabar"
         Height          =   795
         Left            =   -68400
         Picture         =   "1015000.frx":15DD
         Style           =   1  'Graphical
         TabIndex        =   19
         Top             =   4920
         Width           =   1275
      End
      Begin VB.CommandButton cmd_cancelar 
         Caption         =   "Cancelar"
         Height          =   795
         Left            =   -66960
         Picture         =   "1015000.frx":1B0F
         Style           =   1  'Graphical
         TabIndex        =   18
         Top             =   4920
         Width           =   1155
      End
      Begin VB.Frame Frame2 
         Height          =   4335
         Left            =   -74880
         TabIndex        =   11
         Top             =   480
         Width           =   9255
         Begin pry_listpicture.listpicture ctrl_seleccion 
            Height          =   3735
            Left            =   3360
            TabIndex        =   31
            Top             =   480
            Width           =   5895
            _ExtentX        =   10398
            _ExtentY        =   6588
         End
         Begin VB.ComboBox cmb_seleccion 
            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        =   "1015000.frx":1E19
            Left            =   120
            List            =   "1015000.frx":1E23
            Style           =   2  'Dropdown List
            TabIndex        =   12
            Top             =   600
            Width           =   2175
         End
         Begin VB.Label Label10 
            Caption         =   $"1015000.frx":1E41
            Height          =   1455
            Left            =   120
            TabIndex        =   30
            Top             =   1320
            Width           =   3015
         End
         Begin VB.Label Label14 
            AutoSize        =   -1  'True
            Caption         =   "Agrupar 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          =   195
            Left            =   120
            TabIndex        =   17
            Top             =   360
            Width           =   1080
         End
         Begin VB.Label Label4 
            Caption         =   "Todos los Articulos"
            Height          =   255
            Left            =   600
            TabIndex        =   16
            Top             =   3480
            Width           =   1575
         End
         Begin VB.Label Label5 
            Caption         =   "Algunos Articulos"
            Height          =   255
            Left            =   600
            TabIndex        =   15
            Top             =   3960
            Width           =   1335
         End
         Begin VB.Label Label6 
            Caption         =   "Disponibles"
            Height          =   255
            Left            =   3720
            TabIndex        =   14
            Top             =   240
            Width           =   1575
         End
         Begin VB.Label Label7 
            Caption         =   "Seleccionados"
            Height          =   255
            Left            =   6960
            TabIndex        =   13
            Top             =   240
            Width           =   1575
         End
         Begin VB.Image Image1 
            Height          =   480
            Left            =   120
            Picture         =   "1015000.frx":1F73
            Top             =   3360
            Width           =   480
         End
         Begin VB.Image Image2 
            Height          =   480
            Left            =   120
            Picture         =   "1015000.frx":227D
            Top             =   3840
            Width           =   480
         End
      End
      Begin VB.CommandButton cmdAceptarx 
         Caption         =   "&Ingresar"
         Default         =   -1  'True
         Height          =   800
         Left            =   -74200
         Picture         =   "1015000.frx":2587
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   4680
         Width           =   1035
      End
      Begin VB.CommandButton cmdSalirx 
         Cancel          =   -1  'True
         Caption         =   "Sa&lir"
         Height          =   800
         Left            =   -67600
         Picture         =   "1015000.frx":2891
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   4680
         Width           =   1035
      End
      Begin VB.Frame Frame3 
         Height          =   4215
         Left            =   -74760
         TabIndex        =   3
         Top             =   480
         Width           =   9015
         Begin pry_list.ctrl_listarray ctrl_ARTICULO 
            Height          =   3255
            Left            =   120
            TabIndex        =   32
            Top             =   840
            Width           =   8775
            _ExtentX        =   15478
            _ExtentY        =   5741
         End
         Begin MSDataListLib.DataCombo DTC_SUBCATS 
            Height          =   315
            Left            =   2400
            TabIndex        =   4
            Top             =   240
            Width           =   3255
            _ExtentX        =   5741
            _ExtentY        =   556
            _Version        =   393216
            Style           =   2
            Text            =   ""
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "Articulos de la Sub Categoria:"
            Height          =   195
            Left            =   240
            TabIndex        =   8
            Top             =   240
            Width           =   2085
         End
         Begin VB.Label Label8 
            Caption         =   "Seleccionados"
            Height          =   255
            Left            =   6360
            TabIndex        =   7
            Top             =   600
            Width           =   1575
         End
         Begin VB.Label Label9 
            Caption         =   "Disponibles"
            Height          =   255
            Left            =   360
            TabIndex        =   6
            Top             =   600
            Width           =   1575
         End
      End
      Begin VB.CommandButton CMD_CANCELAART 
         Caption         =   "Cancelar"
         Height          =   800
         Left            =   -67080
         Picture         =   "1015000.frx":2B9B
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   4920
         Width           =   1035
      End
      Begin VB.CommandButton CMD_GRABAART 
         Caption         =   "&Grabar"
         Height          =   800
         Left            =   -68400
         Picture         =   "1015000.frx":2EA5
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   4920
         Width           =   1155
      End
   End
End
Attribute VB_Name = "Finicioinventario"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
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


Dim mobj_ccategoria As DB_INV_MANTENIMIENTOS.C_CATEGORIA
Dim mobj_csubcategoria As DB_INV_MANTENIMIENTOS.C_SUBCATEGORIA
Dim mobj_inventario As DB_INV_TOMADEINVENTARIO.C_inventario
Dim mobj_calmacen As DB_INV_MANTENIMIENTOS.C_ALMACEN
Dim LBOL_ESTADOINVENTARIO As Boolean

Private Sub cmb_seleccion_click()
Set mobj_ccategoria = New DB_INV_MANTENIMIENTOS.C_CATEGORIA
Set mobj_csubcategoria = New DB_INV_MANTENIMIENTOS.C_SUBCATEGORIA
Dim ls_criterio As String
ls_criterio = cmb_seleccion.Text
Select Case ls_criterio
    Case "Categoria"
        ctrl_seleccion.llena_lista mobj_inventario.CAT_DISPONIBLES, mobj_inventario.CAT_SELECCIONADAS
    Case "Sub Categoria"
        ctrl_seleccion.llena_lista mobj_inventario.SCAT_DISPONIBLES, mobj_inventario.SCAT_SELECCIONADAS
End Select
End Sub

Private Sub CMD_CANCELAART_Click()
Call DTC_SUBCATS_Click(0)
End Sub

Private Sub CMD_CANCELAR_Click()
cmb_seleccion_click
End Sub

Private Sub CMD_GRABAART_Click()
Dim lstr_lista1 As String
Dim lstr_lista2 As String
lstr_lista1 = ctrl_ARTICULO.listar_codigos_disponibles
lstr_lista2 = ctrl_ARTICULO.listar_codigos_seleccionados

mobj_inventario.ACTUALIZA_articulo lstr_lista1, lstr_lista2
Call DTC_SUBCATS_Click(0)
cmb_seleccion_click
MsgBox "Articulos Grabados", vbInformation, "Proceso Concluido"

End Sub

Private Sub cmd_grabar_Click()
Dim lstr_lista As String
Dim lstr_criterio As String
Dim lint_nume As Integer
lstr_criterio = cmb_seleccion.Text
lstr_lista = ctrl_seleccion.listar_codigos_seleccionados
Select Case lstr_criterio
    Case "Categoria"
        If ctrl_seleccion.nseleccionados = 0 Then lstr_lista = "' '"
        mobj_inventario.ACTUALIZA_CATEGORIA lstr_lista
        MsgBox "Categorias Actualizadas", vbInformation, "Proceso Concluido"
    Case "Sub Categoria"
        mobj_inventario.ACTUALIZA_SUBCATEGORIA lstr_lista
        MsgBox "Sub Categorias Actualizadas", vbInformation, "Proceso Concluido"
End Select
Call cmb_seleccion_click
Call LLENA_SUBCAT
End Sub
Private Sub DTC_SUBCATS_Click(Area As Integer)
Dim LSTR_CSCAT As String
LSTR_CSCAT = DTC_SUBCATS.BoundText
If LSTR_CSCAT = "" Then
    Exit Sub
End If
ctrl_ARTICULO.llena_lista mobj_inventario.ART_DISPONIBLES(LSTR_CSCAT), mobj_inventario.ART_SELECCIONADOS(LSTR_CSCAT)
End Sub

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

End Sub

Private Sub Form_Load()
Call gseguridad(Me)
If pbderecho_consultar Then
    Call obtener_estado
    Call MOSTRAR_ESTADO
    Call actualiza_estado
    ctrl_seleccion.Size 20
    ctrl_ARTICULO.Size 17, 42
    Set mobj_calmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN
    Set mobj_inventario = New DB_INV_TOMADEINVENTARIO.C_inventario
    cmb_seleccion.Text = "Categoria"
    Me.Top = 300
    Me.Left = (Screen.Width - Me.Width) / 2
    Call LLENA_SUBCAT
    SSTab1.Tab = 0
Else
    MsgBox ("No tiene Derechos de Consultar en este formulario")
End If

End Sub
Public Sub MOSTRAR_ESTADO()
If LBOL_ESTADOINVENTARIO Then
    txt_estado = "Activado"
Else
    txt_estado = "Desactivado"
End If

End Sub

Public Sub actualiza_estado()
If LBOL_ESTADOINVENTARIO Then
    opt_activado.Value = True
    opt_desactivado.Value = False
Else
    opt_activado.Value = False
    opt_desactivado.Value = True
End If

End Sub

Sub salir_formulario()
    Unload Me
End Sub
Sub obtener_estado()
    Set mobj_calmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN
    LBOL_ESTADOINVENTARIO = mobj_calmacen.estadoinventarioAlmacen()
End Sub

Private Sub LLENA_SUBCAT()
    Set DTC_SUBCATS.RowSource = mobj_inventario.SCAT_SELECCIONADAS
    DTC_SUBCATS.BoundColumn = "CLASSUBID"
    DTC_SUBCATS.ListField = "DESCR"
End Sub
Private Sub cmdaceptar_Click()

Dim lint_seguro As Integer
Dim lint_error As Integer
Dim mobj_cinventario As DB_INV_TOMADEINVENTARIO.C_inventario

Set mobj_cinventario = New DB_INV_TOMADEINVENTARIO.C_inventario

If (LBOL_ESTADOINVENTARIO = 1 And opt_activado.Value) Or _
(LBOL_ESTADOINVENTARIO = 0 And Not opt_activado.Value) Then    ' no se ha cambiado nada
    MsgBox "No hay Cambios", vbInformation, "Mensaje"
Else
    If opt_activado.Value Then
        lint_seguro = MsgBox(" Esta seguro de Activar la Toma de Inventario" + Chr(13) + _
                             " Los datos leídos del PDT en la última Toma de Inventario serán eliminados  ", vbYesNo + vbQuestion, "Atencion")
        If lint_seguro = vbYes Then
            'llamada a la clase de activacion
            If mobj_cinventario.ACTIVAR_TOMAINVENTARIO = 1 Then
                MsgBox "Error Activando Toma de Inventario ", vbCritical, "Error"
            Else
                MsgBox "Toma de Inventario activada", vbInformation, "Mensaje"
            End If
        End If
    Else
        lint_seguro = MsgBox("Esta seguro de Desactivar la Toma de Inventario", vbYesNo, "Atencion")
        If lint_seguro = vbYes Then
            'llamada a la clase de desactivacion
            If mobj_cinventario.DESACTIVAR_TOMAINVENTARIO = 1 Then
                MsgBox "Error Desactivando Toma de Inventario ", vbCritical, "Error"
            Else
                MsgBox "Toma de Inventario Desactivada", vbInformation, "Mensaje"
            End If
            
        End If
    End If
End If
Call obtener_estado
Call MOSTRAR_ESTADO
Call actualiza_estado
End Sub

Private Sub cmdsalir_Click()
Call salir_formulario
End Sub


Sub actualizar_registro()

End Sub

