VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "ControlNumber.ocx"
Begin VB.Form FMaestroArticulos 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Maestro de Artículos (01.010.00)"
   ClientHeight    =   6990
   ClientLeft      =   2325
   ClientTop       =   1365
   ClientWidth     =   10365
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   6990
   ScaleWidth      =   10365
   Begin TabDlg.SSTab StaMArticulo 
      Height          =   6975
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   10335
      _ExtentX        =   18230
      _ExtentY        =   12303
      _Version        =   393216
      Tabs            =   5
      Tab             =   1
      TabsPerRow      =   5
      TabHeight       =   520
      TabCaption(0)   =   "Datos Generales"
      TabPicture(0)   =   "0101000.frx":0000
      Tab(0).ControlEnabled=   0   'False
      Tab(0).Control(0)=   "Label1"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Label2"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Label3"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "Label4"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).Control(4)=   "Label5"
      Tab(0).Control(4).Enabled=   0   'False
      Tab(0).Control(5)=   "Label6"
      Tab(0).Control(5).Enabled=   0   'False
      Tab(0).Control(6)=   "Label7"
      Tab(0).Control(6).Enabled=   0   'False
      Tab(0).Control(7)=   "Label8"
      Tab(0).Control(7).Enabled=   0   'False
      Tab(0).Control(8)=   "Label9"
      Tab(0).Control(8).Enabled=   0   'False
      Tab(0).Control(9)=   "Label10"
      Tab(0).Control(9).Enabled=   0   'False
      Tab(0).Control(10)=   "Label11"
      Tab(0).Control(10).Enabled=   0   'False
      Tab(0).Control(11)=   "Label12"
      Tab(0).Control(11).Enabled=   0   'False
      Tab(0).Control(12)=   "Label13"
      Tab(0).Control(12).Enabled=   0   'False
      Tab(0).Control(13)=   "lbligv"
      Tab(0).Control(13).Enabled=   0   'False
      Tab(0).Control(14)=   "lblisc"
      Tab(0).Control(14).Enabled=   0   'False
      Tab(0).Control(15)=   "Ctndsctomonto"
      Tab(0).Control(15).Enabled=   0   'False
      Tab(0).Control(16)=   "Ctndscto2"
      Tab(0).Control(16).Enabled=   0   'False
      Tab(0).Control(17)=   "Ctndscto1"
      Tab(0).Control(17).Enabled=   0   'False
      Tab(0).Control(18)=   "DtcUmedida"
      Tab(0).Control(18).Enabled=   0   'False
      Tab(0).Control(19)=   "DtcCategoria"
      Tab(0).Control(19).Enabled=   0   'False
      Tab(0).Control(20)=   "DtcSubCategoria"
      Tab(0).Control(20).Enabled=   0   'False
      Tab(0).Control(21)=   "DtcTipo"
      Tab(0).Control(21).Enabled=   0   'False
      Tab(0).Control(22)=   "DtcIgv"
      Tab(0).Control(22).Enabled=   0   'False
      Tab(0).Control(23)=   "DtcISC"
      Tab(0).Control(23).Enabled=   0   'False
      Tab(0).Control(24)=   "Ctnequivalencia"
      Tab(0).Control(24).Enabled=   0   'False
      Tab(0).Control(25)=   "Txtcodarticulo"
      Tab(0).Control(25).Enabled=   0   'False
      Tab(0).Control(26)=   "Txtdescripcion"
      Tab(0).Control(26).Enabled=   0   'False
      Tab(0).Control(27)=   "FraOtros"
      Tab(0).Control(27).Enabled=   0   'False
      Tab(0).Control(28)=   "cmdbuscarUmedida"
      Tab(0).Control(28).Enabled=   0   'False
      Tab(0).Control(29)=   "cmdbuscarCategoria"
      Tab(0).Control(29).Enabled=   0   'False
      Tab(0).Control(30)=   "CmdbuscatSubCateg"
      Tab(0).Control(30).Enabled=   0   'False
      Tab(0).Control(31)=   "CmdBuscarTipo"
      Tab(0).Control(31).Enabled=   0   'False
      Tab(0).Control(32)=   "cmdbuscarIgv"
      Tab(0).Control(32).Enabled=   0   'False
      Tab(0).Control(33)=   "cmdbuscarisc"
      Tab(0).Control(33).Enabled=   0   'False
      Tab(0).Control(34)=   "Fraventa"
      Tab(0).Control(34).Enabled=   0   'False
      Tab(0).Control(35)=   "ChkEstado"
      Tab(0).Control(35).Enabled=   0   'False
      Tab(0).Control(36)=   "FraBloqueos"
      Tab(0).Control(36).Enabled=   0   'False
      Tab(0).Control(37)=   "cdmbuscararticulo"
      Tab(0).Control(37).Enabled=   0   'False
      Tab(0).Control(38)=   "FraDesemsamble"
      Tab(0).Control(38).Enabled=   0   'False
      Tab(0).Control(39)=   "Chkdesensamble"
      Tab(0).Control(39).Enabled=   0   'False
      Tab(0).ControlCount=   40
      TabCaption(1)   =   "Stock-Precios"
      TabPicture(1)   =   "0101000.frx":001C
      Tab(1).ControlEnabled=   -1  'True
      Tab(1).Control(0)=   "lblcodigostk"
      Tab(1).Control(0).Enabled=   0   'False
      Tab(1).Control(1)=   "lblcodigoartstock"
      Tab(1).Control(1).Enabled=   0   'False
      Tab(1).Control(2)=   "lbldescripcion"
      Tab(1).Control(2).Enabled=   0   'False
      Tab(1).Control(3)=   "Label23"
      Tab(1).Control(3).Enabled=   0   'False
      Tab(1).Control(4)=   "DbStock"
      Tab(1).Control(4).Enabled=   0   'False
      Tab(1).Control(5)=   "Frame3"
      Tab(1).Control(5).Enabled=   0   'False
      Tab(1).Control(6)=   "cmdreplicar"
      Tab(1).Control(6).Enabled=   0   'False
      Tab(1).Control(7)=   "cmdmodificar"
      Tab(1).Control(7).Enabled=   0   'False
      Tab(1).Control(8)=   "Frame5"
      Tab(1).Control(8).Enabled=   0   'False
      Tab(1).ControlCount=   9
      TabCaption(2)   =   "Códigos Alternativos"
      TabPicture(2)   =   "0101000.frx":0038
      Tab(2).ControlEnabled=   0   'False
      Tab(2).Control(0)=   "cmdnuevocodalter"
      Tab(2).Control(1)=   "DBCodAlter"
      Tab(2).Control(2)=   "Label17"
      Tab(2).Control(3)=   "lblcodalter"
      Tab(2).Control(4)=   "lbldescralter"
      Tab(2).Control(5)=   "Label14"
      Tab(2).ControlCount=   6
      TabCaption(3)   =   "Códigos de Compra"
      TabPicture(3)   =   "0101000.frx":0054
      Tab(3).ControlEnabled=   0   'False
      Tab(3).Control(0)=   "cmdmodcodcomp"
      Tab(3).Control(1)=   "cmdnuevocodcomp"
      Tab(3).Control(2)=   "DBCodcompra"
      Tab(3).Control(3)=   "Label19"
      Tab(3).Control(4)=   "lblbdescrcompra"
      Tab(3).Control(5)=   "lblcodartcompra"
      Tab(3).Control(6)=   "Label15"
      Tab(3).ControlCount=   7
      TabCaption(4)   =   "Código Solomon"
      TabPicture(4)   =   "0101000.frx":0070
      Tab(4).ControlEnabled=   0   'False
      Tab(4).Control(0)=   "txtcodinventariable"
      Tab(4).Control(1)=   "txtcodnoinventariable"
      Tab(4).Control(2)=   "Label29"
      Tab(4).Control(3)=   "lblcodsolom"
      Tab(4).Control(4)=   "lbldscrsolo"
      Tab(4).Control(5)=   "Label24"
      Tab(4).Control(6)=   "Label22"
      Tab(4).Control(7)=   "Label21"
      Tab(4).ControlCount=   8
      Begin VB.TextBox txtcodinventariable 
         Height          =   285
         Left            =   -72720
         MaxLength       =   20
         TabIndex        =   98
         Top             =   1680
         Width           =   2895
      End
      Begin VB.TextBox txtcodnoinventariable 
         Height          =   285
         Left            =   -72720
         MaxLength       =   20
         TabIndex        =   99
         Text            =   "12345678912345678912"
         Top             =   2280
         Width           =   2895
      End
      Begin VB.CheckBox Chkdesensamble 
         Caption         =   "Desensamble"
         Height          =   255
         Left            =   -70560
         TabIndex        =   32
         Top             =   4140
         Width           =   1455
      End
      Begin VB.Frame FraDesemsamble 
         Height          =   2175
         Left            =   -70560
         TabIndex        =   33
         Top             =   4260
         Width           =   5655
         Begin VB.CommandButton cmdbuscardesem 
            Height          =   375
            Left            =   3360
            Picture         =   "0101000.frx":008C
            Style           =   1  'Graphical
            TabIndex        =   35
            Top             =   240
            Width           =   495
         End
         Begin MiControl.CtrlNumber CTNfactordesem 
            Height          =   375
            Left            =   1080
            TabIndex        =   36
            Top             =   1200
            Width           =   1575
            _ExtentX        =   2778
            _ExtentY        =   661
            BackColor       =   -2147483643
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
         End
         Begin VB.TextBox Txtcoddesemsamble 
            Height          =   285
            Left            =   1080
            MaxLength       =   20
            TabIndex        =   34
            Top             =   360
            Width           =   2175
         End
         Begin VB.Label Label20 
            Caption         =   "Factor"
            Height          =   255
            Left            =   120
            TabIndex        =   95
            Top             =   1200
            Width           =   1095
         End
         Begin VB.Label lbldescripdesemsamble 
            BorderStyle     =   1  'Fixed Single
            Height          =   285
            Left            =   1080
            TabIndex        =   94
            Top             =   720
            Width           =   4455
         End
         Begin VB.Label Label18 
            Caption         =   "Descripción"
            Height          =   255
            Left            =   120
            TabIndex        =   93
            Top             =   720
            Width           =   1815
         End
         Begin VB.Label Label16 
            Caption         =   "Código"
            Height          =   255
            Left            =   120
            TabIndex        =   92
            Top             =   360
            Width           =   1815
         End
      End
      Begin VB.CommandButton cmdmodcodcomp 
         Caption         =   "Modificar"
         Height          =   615
         Left            =   -65880
         TabIndex        =   91
         Top             =   2520
         Width           =   975
      End
      Begin VB.CommandButton cmdnuevocodcomp 
         Caption         =   "Nuevo"
         Height          =   615
         Left            =   -65880
         Picture         =   "0101000.frx":05BE
         Style           =   1  'Graphical
         TabIndex        =   90
         Top             =   1740
         Width           =   975
      End
      Begin MSDataGridLib.DataGrid DBCodcompra 
         Height          =   3495
         Left            =   -74760
         TabIndex        =   89
         Top             =   1740
         Width           =   8775
         _ExtentX        =   15478
         _ExtentY        =   6165
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   10250
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   10250
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
      Begin VB.CommandButton cmdnuevocodalter 
         Caption         =   "Nuevo"
         Height          =   735
         Left            =   -66120
         Picture         =   "0101000.frx":0AF0
         Style           =   1  'Graphical
         TabIndex        =   41
         Top             =   1680
         Width           =   1095
      End
      Begin MSDataGridLib.DataGrid DBCodAlter 
         Height          =   3615
         Left            =   -74760
         TabIndex        =   40
         Top             =   1680
         Width           =   8535
         _ExtentX        =   15055
         _ExtentY        =   6376
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   10250
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   10250
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
      Begin VB.Frame Frame5 
         Caption         =   "Costos"
         Height          =   2535
         Left            =   240
         TabIndex        =   53
         Top             =   3960
         Width           =   4575
         Begin VB.Label lblcostrepodol 
            Alignment       =   1  'Right Justify
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   80
            Top             =   1440
            Width           =   1575
         End
         Begin VB.Label lblcostreposol 
            Alignment       =   1  'Right Justify
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   79
            Top             =   1080
            Width           =   1575
         End
         Begin VB.Label lblcostpromdol 
            Alignment       =   1  'Right Justify
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   78
            Top             =   720
            Width           =   1575
         End
         Begin VB.Label lblcostpromsol 
            Alignment       =   1  'Right Justify
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   77
            Top             =   360
            Width           =   1575
         End
         Begin VB.Label Label42 
            Caption         =   "Costo Reposición en Dólares"
            Height          =   255
            Left            =   120
            TabIndex        =   57
            Top             =   1440
            Width           =   2175
         End
         Begin VB.Label Label41 
            Caption         =   "Costo Reposición en Soles"
            Height          =   255
            Left            =   120
            TabIndex        =   56
            Top             =   1080
            Width           =   1935
         End
         Begin VB.Label Label40 
            Caption         =   "Costo Promedio en Dólares"
            Height          =   255
            Left            =   120
            TabIndex        =   55
            Top             =   720
            Width           =   1935
         End
         Begin VB.Label Label39 
            Caption         =   "Costo Promedio en Soles"
            Height          =   255
            Left            =   120
            TabIndex        =   54
            Top             =   360
            Width           =   1935
         End
      End
      Begin VB.CommandButton cmdmodificar 
         Caption         =   "Modificar"
         Height          =   615
         Left            =   9120
         Style           =   1  'Graphical
         TabIndex        =   39
         Top             =   2160
         Width           =   975
      End
      Begin VB.CommandButton cmdreplicar 
         Caption         =   "Replicar"
         Height          =   615
         Left            =   9120
         TabIndex        =   38
         Top             =   1440
         Width           =   975
      End
      Begin VB.CommandButton cdmbuscararticulo 
         Enabled         =   0   'False
         Height          =   375
         Left            =   -71400
         Picture         =   "0101000.frx":1022
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   1080
         Width           =   495
      End
      Begin VB.Frame FraBloqueos 
         Caption         =   "Bloqueos"
         Height          =   615
         Left            =   -74760
         TabIndex        =   25
         Top             =   5100
         Width           =   3975
         Begin VB.CheckBox ChkBloqueoCompra 
            Caption         =   "Bloqueo para Compra"
            Height          =   255
            Left            =   1920
            TabIndex        =   27
            Top             =   240
            Width           =   1935
         End
         Begin VB.CheckBox ChkBloqueoVenta 
            Caption         =   "Bloqueo para Venta"
            Height          =   255
            Left            =   120
            TabIndex        =   26
            Top             =   240
            Width           =   1815
         End
      End
      Begin VB.Frame Frame3 
         Caption         =   "Datos"
         Height          =   2535
         Left            =   5040
         TabIndex        =   42
         Top             =   3960
         Width           =   3855
         Begin VB.Label lblstkultinv 
            Alignment       =   1  'Right Justify
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   52
            Top             =   1680
            Width           =   1335
         End
         Begin VB.Label Label35 
            Caption         =   "Stock de Ultimo Inv."
            Height          =   255
            Left            =   240
            TabIndex        =   51
            Top             =   1680
            Width           =   2175
         End
         Begin VB.Label lblfecultinv 
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   50
            Top             =   1320
            Width           =   1335
         End
         Begin VB.Label Label33 
            Caption         =   "Fecha de Ultimo Inv."
            Height          =   255
            Left            =   240
            TabIndex        =   49
            Top             =   1320
            Width           =   1695
         End
         Begin VB.Label lblfecinvini 
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   48
            Top             =   240
            Width           =   1335
         End
         Begin VB.Label Label31 
            Caption         =   "Fecha de Creación"
            Height          =   255
            Left            =   240
            TabIndex        =   47
            Top             =   240
            Width           =   1455
         End
         Begin VB.Label lblstkini 
            Alignment       =   1  'Right Justify
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   46
            Top             =   600
            Width           =   1335
         End
         Begin VB.Label Label27 
            Caption         =   "Stock Inicial del Periódo"
            Height          =   255
            Left            =   240
            TabIndex        =   45
            Top             =   600
            Width           =   1935
         End
         Begin VB.Label lblstkactual 
            Alignment       =   1  'Right Justify
            BorderStyle     =   1  'Fixed Single
            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            =   2280
            TabIndex        =   44
            Top             =   960
            Width           =   1335
         End
         Begin VB.Label Label25 
            Caption         =   "Stock Actual"
            Height          =   255
            Left            =   240
            TabIndex        =   43
            Top             =   960
            Width           =   1095
         End
      End
      Begin VB.CheckBox ChkEstado 
         Caption         =   "Activo"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   -74760
         TabIndex        =   20
         Top             =   3960
         Value           =   1  'Checked
         Width           =   2535
      End
      Begin VB.Frame Fraventa 
         Caption         =   "Venta "
         Height          =   735
         Left            =   -74760
         TabIndex        =   21
         Top             =   4260
         Width           =   3975
         Begin VB.OptionButton Optotrotipo 
            Caption         =   "De Otro Tipo"
            Height          =   255
            Left            =   2520
            TabIndex        =   24
            Top             =   360
            Width           =   1335
         End
         Begin VB.OptionButton Optplaya 
            Caption         =   "En Playa"
            Height          =   255
            Left            =   1320
            TabIndex        =   23
            Top             =   360
            Width           =   1215
         End
         Begin VB.OptionButton Opttienda 
            Caption         =   "En Tienda"
            Height          =   255
            Left            =   120
            TabIndex        =   22
            Top             =   360
            Value           =   -1  'True
            Width           =   1335
         End
      End
      Begin VB.CommandButton cmdbuscarisc 
         Height          =   375
         Left            =   -66120
         Picture         =   "0101000.frx":1554
         Style           =   1  'Graphical
         TabIndex        =   16
         Top             =   2040
         Width           =   495
      End
      Begin VB.CommandButton cmdbuscarIgv 
         Height          =   375
         Left            =   -66120
         Picture         =   "0101000.frx":1A86
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   1560
         Width           =   495
      End
      Begin VB.CommandButton CmdBuscarTipo 
         Height          =   375
         Left            =   -71400
         Picture         =   "0101000.frx":1FB8
         Style           =   1  'Graphical
         TabIndex        =   12
         Top             =   3480
         Width           =   495
      End
      Begin VB.CommandButton CmdbuscatSubCateg 
         Height          =   375
         Left            =   -71400
         Picture         =   "0101000.frx":24EA
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   3000
         Width           =   495
      End
      Begin VB.CommandButton cmdbuscarCategoria 
         Height          =   375
         Left            =   -71400
         Picture         =   "0101000.frx":2A1C
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   2520
         Width           =   495
      End
      Begin VB.CommandButton cmdbuscarUmedida 
         Height          =   375
         Left            =   -71400
         Picture         =   "0101000.frx":2F4E
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   2040
         Width           =   495
      End
      Begin VB.Frame FraOtros 
         Height          =   615
         Left            =   -74760
         TabIndex        =   28
         Top             =   5820
         Width           =   3975
         Begin VB.CheckBox Chkconsignacion 
            Caption         =   "Consignación"
            Height          =   255
            Left            =   2520
            TabIndex        =   31
            Top             =   240
            Width           =   1335
         End
         Begin VB.CheckBox Chkformula 
            Caption         =   "Fórmula"
            Height          =   255
            Left            =   1440
            TabIndex        =   30
            Top             =   240
            Width           =   975
         End
         Begin VB.CheckBox ChkInventariable 
            Caption         =   "Inventariable"
            Height          =   255
            Left            =   120
            TabIndex        =   29
            Top             =   240
            Value           =   1  'Checked
            Width           =   1935
         End
      End
      Begin VB.TextBox Txtdescripcion 
         Height          =   285
         Left            =   -69720
         MaxLength       =   40
         TabIndex        =   3
         Tag             =   "R-la descripción del Articulo"
         Top             =   1050
         Width           =   4575
      End
      Begin VB.TextBox Txtcodarticulo 
         Height          =   285
         Left            =   -73680
         MaxLength       =   20
         TabIndex        =   1
         Tag             =   "R-Código de Artículo"
         Top             =   1080
         Width           =   2175
      End
      Begin MiControl.CtrlNumber Ctnequivalencia 
         Height          =   375
         Left            =   -73680
         TabIndex        =   4
         Top             =   1560
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin MSDataListLib.DataCombo DtcISC 
         Height          =   315
         Left            =   -68640
         TabIndex        =   15
         Top             =   2040
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo DtcIgv 
         Height          =   315
         Left            =   -68640
         TabIndex        =   13
         Top             =   1560
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin MSDataListLib.DataCombo DtcTipo 
         Height          =   315
         Left            =   -73680
         TabIndex        =   11
         Top             =   3480
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo DtcSubCategoria 
         Height          =   315
         Left            =   -73680
         TabIndex        =   9
         Top             =   3000
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo DtcCategoria 
         Height          =   315
         Left            =   -73680
         TabIndex        =   7
         Top             =   2520
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo DtcUmedida 
         Height          =   315
         Left            =   -73680
         TabIndex        =   5
         Top             =   2040
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin MSDataGridLib.DataGrid DbStock 
         Height          =   2535
         Left            =   240
         TabIndex        =   37
         Top             =   1320
         Width           =   8775
         _ExtentX        =   15478
         _ExtentY        =   4471
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   10250
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   10250
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
      Begin MiControl.CtrlNumber Ctndscto1 
         Height          =   375
         Left            =   -68640
         TabIndex        =   17
         Top             =   2520
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin MiControl.CtrlNumber Ctndscto2 
         Height          =   375
         Left            =   -68640
         TabIndex        =   18
         Top             =   3000
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin MiControl.CtrlNumber Ctndsctomonto 
         Height          =   375
         Left            =   -68640
         TabIndex        =   19
         Top             =   3480
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Label Label29 
         Caption         =   "Código"
         Height          =   255
         Left            =   -74520
         TabIndex        =   103
         Top             =   960
         Width           =   615
      End
      Begin VB.Label lblcodsolom 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   -73800
         TabIndex        =   102
         Top             =   960
         Width           =   1935
      End
      Begin VB.Label lbldscrsolo 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   -70440
         TabIndex        =   101
         Top             =   960
         Width           =   5055
      End
      Begin VB.Label Label24 
         Caption         =   "Descripción"
         Height          =   255
         Left            =   -71640
         TabIndex        =   100
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label Label22 
         Caption         =   "Código No Inventariable"
         Height          =   375
         Left            =   -74520
         TabIndex        =   97
         Top             =   2280
         Width           =   2175
      End
      Begin VB.Label Label21 
         Caption         =   "Código Inventariable"
         Height          =   375
         Left            =   -74520
         TabIndex        =   96
         Top             =   1680
         Width           =   1815
      End
      Begin VB.Label Label19 
         Caption         =   "Descripción"
         Height          =   255
         Left            =   -71760
         TabIndex        =   88
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label lblbdescrcompra 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   -70560
         TabIndex        =   87
         Top             =   960
         Width           =   5055
      End
      Begin VB.Label lblcodartcompra 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   -73920
         TabIndex        =   86
         Top             =   960
         Width           =   1935
      End
      Begin VB.Label Label15 
         Caption         =   "Código"
         Height          =   255
         Left            =   -74640
         TabIndex        =   85
         Top             =   960
         Width           =   615
      End
      Begin VB.Label Label17 
         Caption         =   "Código"
         Height          =   255
         Left            =   -74640
         TabIndex        =   84
         Top             =   960
         Width           =   615
      End
      Begin VB.Label lblcodalter 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   -73920
         TabIndex        =   83
         Top             =   960
         Width           =   1935
      End
      Begin VB.Label lbldescralter 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   -70560
         TabIndex        =   82
         Top             =   960
         Width           =   5055
      End
      Begin VB.Label Label14 
         Caption         =   "Descripción"
         Height          =   255
         Left            =   -71760
         TabIndex        =   81
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label lblisc 
         Alignment       =   1  'Right Justify
         BorderStyle     =   1  'Fixed Single
         Height          =   315
         Left            =   -69360
         TabIndex        =   76
         Top             =   2040
         Width           =   615
      End
      Begin VB.Label lbligv 
         Alignment       =   1  'Right Justify
         BorderStyle     =   1  'Fixed Single
         Height          =   315
         Left            =   -69360
         TabIndex        =   75
         Top             =   1560
         Width           =   615
      End
      Begin VB.Label Label23 
         Caption         =   "Descripción"
         Height          =   255
         Left            =   3240
         TabIndex        =   74
         Top             =   960
         Width           =   1215
      End
      Begin VB.Label lbldescripcion 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   4440
         TabIndex        =   73
         Top             =   960
         Width           =   4815
      End
      Begin VB.Label lblcodigoartstock 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   1080
         TabIndex        =   72
         Top             =   960
         Width           =   1935
      End
      Begin VB.Label lblcodigostk 
         Caption         =   "Código"
         Height          =   255
         Left            =   360
         TabIndex        =   71
         Top             =   960
         Width           =   615
      End
      Begin VB.Label Label13 
         Caption         =   "Dscto por Monto"
         Height          =   255
         Left            =   -69960
         TabIndex        =   70
         Top             =   3480
         Width           =   1215
      End
      Begin VB.Label Label12 
         Caption         =   "Dscto(2) %"
         Height          =   255
         Left            =   -69960
         TabIndex        =   69
         Top             =   3000
         Width           =   975
      End
      Begin VB.Label Label11 
         Caption         =   "Dscto(1) %"
         Height          =   255
         Left            =   -69960
         TabIndex        =   68
         Top             =   2520
         Width           =   975
      End
      Begin VB.Label Label10 
         Caption         =   "ISC%"
         Height          =   255
         Left            =   -69960
         TabIndex        =   67
         Top             =   2040
         Width           =   615
      End
      Begin VB.Label Label9 
         Height          =   255
         Left            =   -69840
         TabIndex        =   66
         Top             =   2400
         Width           =   1455
      End
      Begin VB.Label Label8 
         Caption         =   "IGV %"
         Height          =   255
         Left            =   -69960
         TabIndex        =   65
         Top             =   1560
         Width           =   1335
      End
      Begin VB.Label Label7 
         Caption         =   "Tipo"
         Height          =   255
         Left            =   -74760
         TabIndex        =   64
         Top             =   3480
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "Sub Categoría"
         Height          =   255
         Left            =   -74760
         TabIndex        =   63
         Top             =   3000
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "Categoría"
         Height          =   255
         Left            =   -74760
         TabIndex        =   62
         Top             =   2520
         Width           =   1215
      End
      Begin VB.Label Label4 
         Caption         =   "U. de Medida"
         Height          =   255
         Left            =   -74760
         TabIndex        =   61
         Top             =   2040
         Width           =   1455
      End
      Begin VB.Label Label3 
         Caption         =   "Factor Galón"
         Height          =   255
         Left            =   -74760
         TabIndex        =   60
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "Descripción "
         Height          =   255
         Left            =   -70800
         TabIndex        =   59
         Top             =   1080
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "Código "
         Height          =   255
         Left            =   -74760
         TabIndex        =   58
         Top             =   1080
         Width           =   1215
      End
   End
End
Attribute VB_Name = "FMaestroArticulos"
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
'************************************************************************************************************
'Variables para el Trbajo con las Búsquedas
'************************************************************************************************************
Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As Variant
'************************************************************************************************************
'Variables para el Manejo de los Temporales
'************************************************************************************************************
 Private MrsTempinvDat As ADODB.Recordset
 Private MrsTempinvAlter As ADODB.Recordset
 Private MrsTempinvCodCompra As ADODB.Recordset
'************************************************************************************************************
'Variables propias del Formulario
'************************************************************************************************************
 Private MDblIdentificador As Double
 Private MSTRMonedaBase As String
 Private MobjCorrelativo As DB_CORRELATIVO.C_Correlativos
 Public MobjArticulo As DB_INV_ARTICULO.C_ARTICULO
 Private MrslistadodeArticulos As ADODB.Recordset

  
 Private MobjUmedida As DB_INV_MANTENIMIENTOS.C_UNIDADMEDIDA
 Private MrslistadodeUmedida As ADODB.Recordset
  
 Private MobjCategoria As DB_INV_MANTENIMIENTOS.C_CATEGORIA
 Private MrslistadodeCategoria As ADODB.Recordset
 
 Private MobjSubCategoria As DB_INV_MANTENIMIENTOS.C_SUBCATEGORIA
 Private MrslistadodeSubCategoria As ADODB.Recordset
 
 Private MobjTipo As DB_INV_MANTENIMIENTOS.C_TIPO
 Private MrslistadodeTipo As ADODB.Recordset
 
 Private MobjImpuesto As DB_MA_MANTENIMIENTOS.C_TIPOIMPÙESTO
 Private MrslistadodeIGV As ADODB.Recordset
 Private MrslistadodeISC As ADODB.Recordset

 Private MrslistadodeIGVValue As ADODB.Recordset
 Private MrslistadodeISCValue As ADODB.Recordset

'************************************************************************************************************
'Funcionalidad : Da formato a la Grilla de Stock
'************************************************************************************************************
Private Sub DatosAdicionalesStock()
 If Not IsNull(DbStock.Bookmark) Then
   lblcostpromsol.Caption = GFormatodeNumero(DbStock.Columns(10).Value, GintDecCosto)
   lblcostpromdol.Caption = GFormatodeNumero(DbStock.Columns(11).Value, GintDecCosto)
   lblcostreposol.Caption = GFormatodeNumero(DbStock.Columns(12).Value, GintDecCosto)
   lblcostrepodol.Caption = GFormatodeNumero(DbStock.Columns(13).Value, GintDecCosto)
   
   'TIENE QUE LEER DE IN_KDXHIST UN MES ANTERIOR A LA FECHA DE PROCESO ACTUAL
   'lblstkini.Caption = GFormatodeNumero(DbStock.Columns(14).Value, GintDecStock)
   
   lblstkini.Caption = GFormatodeNumero(MobjArticulo.ObtenerSaldodelPeriodo(Txtcodarticulo.Text, DbStock.Columns(0).Value), GintDecStock)
   
   If DbStock.Columns(15).Text = Empty Then
    lblfecinvini.Caption = "No existe Fecha"
   Else
    lblfecinvini.Caption = DbStock.Columns(15).Text
   End If
   lblstkactual.Caption = GFormatodeNumero(DbStock.Columns(16).Text, GintDecStock)
      
   If DbStock.Columns(17).Text = Empty Then
    lblfecultinv.Caption = "No existe Fecha"
   Else
    lblfecultinv.Caption = DbStock.Columns(17).Text
   End If
   If DbStock.Columns(18).Text = Empty Then
      lblstkultinv.Caption = GFormatodeNumero(0, GintDecStock)
   Else
      lblstkultinv.Caption = GFormatodeNumero(DbStock.Columns(18).Text, GintDecStock)
   End If
 Else
   lblcostpromsol.Caption = GFormatodeNumero("0", GintDecCosto)
   lblcostpromdol.Caption = GFormatodeNumero("0", GintDecCosto)
   lblcostreposol.Caption = GFormatodeNumero("0", GintDecCosto)
   lblcostrepodol.Caption = GFormatodeNumero("0", GintDecCosto)
   lblstkini.Caption = GFormatodeNumero("0", GintDecStock)
   lblstkactual.Caption = GFormatodeNumero("0", GintDecStock)
   lblstkultinv.Caption = GFormatodeNumero("0", GintDecStock)
   lblfecinvini.Caption = "No existe Fecha"
   lblfecultinv.Caption = "No existe Fecha"
 End If
End Sub

Private Sub FormatoGrillaStock()
Dim Linticontador As Integer
   DbStock.Columns(0).Width = 500
   DbStock.Columns(0).AllowSizing = False
   DbStock.Columns(1).Width = 1500
   DbStock.Columns(1).AllowSizing = False
   
   DbStock.Columns(2).Width = 700
   DbStock.Columns(2).NumberFormat = GMascara(GintDecStock)
   DbStock.Columns(2).Alignment = dbgRight
   DbStock.Columns(2).AllowSizing = False
   
   DbStock.Columns(3).Width = 700
   DbStock.Columns(3).NumberFormat = GMascara(GintDecStock)
   DbStock.Columns(3).Alignment = dbgRight
   DbStock.Columns(3).AllowSizing = False
   
   DbStock.Columns(4).Width = 700
   DbStock.Columns(4).NumberFormat = GMascara(GintDecPrecio)
   DbStock.Columns(4).Alignment = dbgRight
   DbStock.Columns(4).AllowSizing = False
   
   DbStock.Columns(5).Visible = False
   DbStock.Columns(5).AllowSizing = False
   
   DbStock.Columns(6).Width = 1250
   DbStock.Columns(6).AllowSizing = False
   
   DbStock.Columns(7).Width = 1350
   DbStock.Columns(7).AllowSizing = False
   
   DbStock.Columns(8).Width = 1350
   DbStock.Columns(8).AllowSizing = False
   
   For Linticontador = 10 To DbStock.Columns().Count - 1
       DbStock.Columns(Linticontador).Visible = False
       DbStock.Columns(Linticontador).Width = 1450
       DbStock.Columns(Linticontador).AllowSizing = False
   Next
End Sub

'************************************************************************************************************
'Funcionalidad : Da formato a la Grilla de Códigos de Compra
'************************************************************************************************************
Private Sub FormatoGrillaCodCompra()
   DBCodcompra.Columns(0).Width = 1100
   DBCodcompra.Columns(1).Width = 1500
   DBCodcompra.Columns(2).Width = 1290
   DBCodcompra.Columns(3).Width = 1350
   DBCodcompra.Columns(4).Width = 700
   DBCodcompra.Columns(4).Alignment = dbgRight
   DBCodcompra.Columns(4).NumberFormat = GMascara(GintDecCosto)
   DBCodcompra.Columns(5).Visible = False
   DBCodcompra.Columns(5).AllowSizing = False
   DBCodcompra.Columns(6).Width = 1150
   DBCodcompra.Columns(7).Width = 1200
   
End Sub
'************************************************************************************************************
'Funcionalidad : Muestra los Datos de la Tabla IN_INVENTORYALTER en la Grilla
'************************************************************************************************************
Private Sub MuestraDatosINVENTORYVENDORINVT()
  Set DBCodcompra.DataSource = MobjArticulo.MostrarDetalleIN_INVENTORYVENDORINVT(Txtcodarticulo.Text)
  FormatoGrillaCodCompra
  DBCodcompra.Refresh
End Sub

'************************************************************************************************************
'Funcionalidad : Muestra los Datos de la Tabla IN_SOLINVENTORY
'************************************************************************************************************
Private Sub MuestraDatosIN_SOLINVENTORY()
    Dim LrsDeTalleIN_SOLINVENTORY As ADODB.Recordset
    Set LrsDeTalleIN_SOLINVENTORY = MobjArticulo.MostrarDetalleIN_SOLINVENTORY(Txtcodarticulo.Text)
    If Not LrsDeTalleIN_SOLINVENTORY.EOF Then
       txtcodinventariable.Text = LrsDeTalleIN_SOLINVENTORY!INVTIDSTK
       txtcodnoinventariable.Text = LrsDeTalleIN_SOLINVENTORY!INVTIDNOSTK
    Else
      txtcodinventariable.Text = Empty
      txtcodnoinventariable.Text = Empty
    End If
    Set LrsDeTalleIN_SOLINVENTORY = Nothing
End Sub

'************************************************************************************************************
'Funcionalidad : Muestra los Datos de la Tabla IN_INVENTORYDES
'************************************************************************************************************
Private Sub MuestraDatosIN_INVENTORYDES()
  If Chkdesensamble.Value = 1 Then
     Dim LrsDetalleIN_INVENTORYDES As ADODB.Recordset
     Set LrsDetalleIN_INVENTORYDES = MobjArticulo.MostrarDetalleIN_INVENTORYDES(Txtcodarticulo.Text)
     If Not LrsDetalleIN_INVENTORYDES.EOF Then
      Txtcoddesemsamble.Text = LrsDetalleIN_INVENTORYDES!INVTIDSKUDES
      lbldescripdesemsamble.Caption = MobjArticulo.ObtenerDescripcion(Txtcoddesemsamble.Text)
      CTNfactordesem.Text = GFormatodeNumero(LrsDetalleIN_INVENTORYDES!WTSTK2, GintDecStock)
     End If
     Set LrsDetalleIN_INVENTORYDES = Nothing
  Else
     Txtcoddesemsamble.Text = Empty
     lbldescripdesemsamble.Caption = Empty
     CTNfactordesem.ValorPorDefecto
  End If
End Sub

'************************************************************************************************************
'Funcionalidad : Muestra los Datos de la Tabla IN_INVENTORYALTER en la Grilla
'************************************************************************************************************
Private Sub MuestraDatosINVENTORYALTER()
  Set DBCodAlter.DataSource = MobjArticulo.MostrarDetalleIN_INVENTORYALTER(Txtcodarticulo.Text)
  DBCodAlter.Refresh
End Sub

'************************************************************************************************************
'Funcionalidad : Muestra los Datos de la Tabla InventoryDat en la Grilla
'************************************************************************************************************
Private Sub MuestraDatosInventoryDat()
   Set DbStock.DataSource = MobjArticulo.MostrarDetalleInventoryDat(Txtcodarticulo.Text)
   FormatoGrillaStock
   DbStock.Refresh
End Sub

'************************************************************************************************************
'Funcionalidad : Pasa los Datos de IN_INVENTORYDAT a TEMP_IN_INVENTORYDAT
'                Pasa los Datos de IN_INVENTORYALTER a TEMP_IN_INVENTORYALTER
'Parametros de Entrada : El código del Artículo , y el identificador
'                        asiganado a la transaccion
'************************************************************************************************************
Private Sub CargaDatosenTemporales()
   'Temporal InventiryDat
   MobjArticulo.CargaInventoryDataTemp Txtcodarticulo.Text, MDblIdentificador
   'Temporal InventoryAlter
   MobjArticulo.CargaInventoryAlteraTemp Txtcodarticulo.Text, MDblIdentificador
   'Temporal InvendorInv
   MobjArticulo.CargaInventoryVendorInvaTemp Txtcodarticulo.Text, MDblIdentificador
End Sub

'************************************************************************************************************
'Funcionalidad : Muestra los Datos del Temporal de InventoryDat en la Grilla
'                Muestra los Datos del Temporal de InventoryAlter en la Grilla
'                Muestra los Datos del Temporal de In_VendorInv en la Grilla
'************************************************************************************************************
Private Sub CargarTemporales()
   'Temporal InventoryDat
     
    Set DbStock.DataSource = MobjArticulo.MostrarDetalleTempInventoryDat(Txtcodarticulo.Text, MDblIdentificador)
    FormatoGrillaStock
    DbStock.Refresh
   'Temporal InventoryAlter
    Set DBCodAlter.DataSource = MobjArticulo.MostrarDetalleTempInventoryAlter(Txtcodarticulo.Text, MDblIdentificador)
    DBCodAlter.Refresh
   'Temporal In_VendorInv
    Set DBCodcompra.DataSource = MobjArticulo.MostrarDetalleTEMPINVENTORYVENDORINVT(Txtcodarticulo.Text, MDblIdentificador)
    FormatoGrillaCodCompra
    DBCodcompra.Refresh
    
End Sub

Private Sub InstanciarObjetos()

   'Establece las propiedades de los controles Datanumber
    Ctnequivalencia.Enteros = 4
    Ctnequivalencia.Decimales = GintDecStock
    Ctnequivalencia.ValorPorDefecto
    Ctndscto1.Enteros = 3
    Ctndscto1.Decimales = GintDecPrecio
    Ctndscto1.ValorPorDefecto
    Ctndscto2.Enteros = 3
    Ctndscto2.Decimales = GintDecPrecio
    Ctndscto2.ValorPorDefecto
    Ctndsctomonto.Enteros = 4
    Ctndsctomonto.Decimales = GintDecPrecio
    Ctndsctomonto.ValorPorDefecto
    CTNfactordesem.Enteros = 3
    CTNfactordesem.Decimales = GintDecStock
    CTNfactordesem.ValorPorDefecto
    
   'Obtener la Moneda Base
    MSTRMonedaBase = GstrCodMonedaBase
      
   'Instanciar Objetos
   
    Set MobjArticulo = New DB_INV_ARTICULO.C_ARTICULO
    Set MobjUmedida = New DB_INV_MANTENIMIENTOS.C_UNIDADMEDIDA
    Set MobjCategoria = New DB_INV_MANTENIMIENTOS.C_CATEGORIA
    Set MobjSubCategoria = New DB_INV_MANTENIMIENTOS.C_SUBCATEGORIA
    Set MobjTipo = New DB_INV_MANTENIMIENTOS.C_TIPO
    Set MobjImpuesto = New DB_MA_MANTENIMIENTOS.C_TIPOIMPÙESTO

End Sub


'   Procedimiento GCargaDataCombo
'   Elaborado por : Edgar Cancho Ruiz
'   Fecha : 12/09/2002

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
Private Sub CargarDatacombos()
    GCargaDataCombo DtcUmedida, MrslistadodeUmedida, "STKUNITID", "DESCR"
    GCargaDataCombo DtcCategoria, MrslistadodeCategoria, "CLASSID", "DESCR"
    GCargaDataCombo DtcSubCategoria, MrslistadodeSubCategoria, "CLASSUBID", "DESCR"
    GCargaDataCombo DtcTipo, MrslistadodeTipo, "INVTYPEID", "DESCR"
    GCargaDataCombo DtcIgv, MrslistadodeIGV, "TAXID", "DESCR"
    GCargaDataCombo DtcISC, MrslistadodeISC, "TAXID", "DESCR"
End Sub

Private Sub cdmbuscararticulo_Click()
  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) = 6000
      
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
  FBusquedasMa.GObtenerRegistros MrslistadodeArticulos, LArrayBusqueda, 2, 2
  FBusquedasMa.Show vbModal
  If GrecibeUbicacion <> 0 Then
     MrslistadodeArticulos.AbsolutePosition = GrecibeUbicacion
     asigna_campos
  End If
  
End Sub

Private Sub Chkdesensamble_Click()
 If pb_agregar = True Or pb_editar = True Then
  If Chkdesensamble.Value = 1 Then
     If MobjUmedida.EsDivisible(DtcUmedida.BoundText) = False Then
        MsgBox "Unidad de Medida " + Trim(DtcUmedida.Text) + " no es divisible", vbDefaultButton1 + vbExclamation, "Advertencia"
        Chkdesensamble.Value = 0
        Exit Sub
     End If
     FraDesemsamble.Enabled = True
     cmdbuscardesem.Enabled = True
  Else
     Txtcoddesemsamble.Text = Empty
     lbldescripdesemsamble.Caption = Empty
     CTNfactordesem.Text = 0
     CTNfactordesem.ValorPorDefecto
     FraDesemsamble.Enabled = False
     cmdbuscardesem.Enabled = False
  End If
 End If
End Sub

Private Sub cmdbuscarCategoria_Click()
  Dim LArrayBusqueda(1 To 2, 1 To 3) As Variant
  LArrayBusqueda(1, 1) = "classid"
  LArrayBusqueda(1, 2) = "Cod_Categoría"
  LArrayBusqueda(1, 3) = 1000
  LArrayBusqueda(2, 1) = "descr"
  LArrayBusqueda(2, 2) = "Descripción"
  LArrayBusqueda(2, 3) = 6000
  
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
  
  FBusquedasMa.GObtenerRegistros MrslistadodeCategoria, LArrayBusqueda, 2, 2, 7800
  FBusquedasMa.Show vbModal
   
  If GrecibeUbicacion <> 0 Then
     DtcCategoria.BoundText = GrecibeColumnaID
     DtcSubCategoria.BoundText = Empty
  End If
  'Procedimiento que actuliza los datos
End Sub

Private Sub cmdbuscardesem_Click()
  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) = 6000
  
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
  FBusquedasMa.GObtenerRegistros MobjArticulo.BuscarArticulos, LArrayBusqueda, 2, 2, , , , , 2
  FBusquedasMa.Show vbModal
  If GrecibeUbicacion <> 0 Then
     Txtcoddesemsamble.Text = GrecibeColumnaID
     lbldescripdesemsamble.Caption = GrecibeColumnaOpcional
  End If
End Sub

Private Sub cmdbuscarIgv_Click()
  Dim LArrayBusqueda(1 To 3, 1 To 3) As Variant
  LArrayBusqueda(1, 1) = "Taxid"
  LArrayBusqueda(1, 2) = "Código"
  LArrayBusqueda(1, 3) = 1000
  LArrayBusqueda(2, 1) = "descr"
  LArrayBusqueda(2, 2) = "Descripción"
  LArrayBusqueda(2, 3) = 4000
  LArrayBusqueda(3, 1) = "Value"
  LArrayBusqueda(3, 2) = "Porcentaje"
  LArrayBusqueda(3, 3) = 2000
  
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
    
  FBusquedasMa.GObtenerRegistros MrslistadodeIGV, LArrayBusqueda, 3, 2, 7800, , , , 3
  FBusquedasMa.Show vbModal
  
  If GrecibeUbicacion <> 0 Then
    DtcIgv.BoundText = GrecibeColumnaID
    lbligv.Caption = GrecibeColumnaOpcional
  End If
  'Procedimiento que actuliza los datos
End Sub

Private Sub cmdbuscarisc_Click()
  Dim LArrayBusqueda(1 To 3, 1 To 3) As Variant
  LArrayBusqueda(1, 1) = "Taxid"
  LArrayBusqueda(1, 2) = "Código"
  LArrayBusqueda(1, 3) = 1000
  LArrayBusqueda(2, 1) = "descr"
  LArrayBusqueda(2, 2) = "Descripción"
  LArrayBusqueda(2, 3) = 4000
  LArrayBusqueda(3, 1) = "Value"
  LArrayBusqueda(3, 2) = "Porcentaje"
  LArrayBusqueda(3, 3) = 2000
    
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty

    
  FBusquedasMa.GObtenerRegistros MrslistadodeISC, LArrayBusqueda, 3, 2, 7800, , , , 3
  FBusquedasMa.Show vbModal
  
  If GrecibeUbicacion <> 0 Then
    DtcISC.BoundText = GrecibeColumnaID
    lblisc.Caption = GrecibeColumnaOpcional
  End If

End Sub

Private Sub CmdBuscarTipo_Click()
  Dim LArrayBusqueda(1 To 2, 1 To 3) As Variant
  LArrayBusqueda(1, 1) = "invtypeid"
  LArrayBusqueda(1, 2) = "Cod_Tipo"
  LArrayBusqueda(1, 3) = 1000
  LArrayBusqueda(2, 1) = "descr"
  LArrayBusqueda(2, 2) = "Descripción"
  LArrayBusqueda(2, 3) = 6000
  
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
  
  FBusquedasMa.GObtenerRegistros MrslistadodeTipo, LArrayBusqueda, 2, 2, 7800
  FBusquedasMa.Show vbModal
  
  If GrecibeUbicacion <> 0 Then
    DtcTipo.BoundText = GrecibeColumnaID
  End If
  
  'Procedimiento que actuliza los datos
   
End Sub

Private Sub cmdbuscarUmedida_Click()
  
  Dim LArrayBusqueda(1 To 2, 1 To 3) As Variant
  LArrayBusqueda(1, 1) = "stkunitID"
  LArrayBusqueda(1, 2) = "Cod_Unidad"
  LArrayBusqueda(1, 3) = 1000
  LArrayBusqueda(2, 1) = "descr"
  LArrayBusqueda(2, 2) = "Descripción"
  LArrayBusqueda(2, 3) = 6000
  
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
  
  FBusquedasMa.GObtenerRegistros MrslistadodeUmedida, LArrayBusqueda, 2, 2, 7800
  FBusquedasMa.Show vbModal
  
  If GrecibeUbicacion <> 0 Then
     DtcUmedida.BoundText = GrecibeColumnaID
  End If
  'Procedimiento que actuliza los datos

End Sub
Private Sub CmdbuscatSubCateg_Click()
  Dim LArrayBusqueda(1 To 2, 1 To 3) As Variant
  LArrayBusqueda(1, 1) = "classubid"
  LArrayBusqueda(1, 2) = "Cod_SubCategoría"
  LArrayBusqueda(1, 3) = 1000
  LArrayBusqueda(2, 1) = "DESCR"
  LArrayBusqueda(2, 2) = "Descripción"
  LArrayBusqueda(2, 3) = 6000
      
  If DtcSubCategoria.BoundText = Empty Then
     Set MrslistadodeSubCategoria = MobjSubCategoria.ListarPorCategoriaID(DtcCategoria.BoundText)
     GCargaDataCombo DtcSubCategoria, MrslistadodeSubCategoria, "CLASSUBID", "DESCR"
   End If
      
  GrecibeUbicacion = 0
  GrecibeColumnaID = Empty
  GrecibeColumnaOpcional = Empty
  
    
  FBusquedasMa.GObtenerRegistros MrslistadodeSubCategoria, LArrayBusqueda, 2, 2, 7800
  FBusquedasMa.Show vbModal
     
  If GrecibeUbicacion <> 0 Then
     DtcSubCategoria.BoundText = GrecibeColumnaID
  End If
  
  'Procedimiento que actuliza los datos
End Sub

Private Sub cmdmodcodcomp_Click()
 If Not IsNull(DBCodcompra.Bookmark) Then
   Fcodcompra.GSTRMonedaBase = MSTRMonedaBase
   Fcodcompra.GstrcodArticulo = Txtcodarticulo.Text
   Fcodcompra.GDblIdentificador = MDblIdentificador
   Fcodcompra.GstrcodProveedor = DBCodcompra.Columns(0)
   Fcodcompra.GstrCodCompra = DBCodcompra.Columns(2)
   Fcodcompra.GSTRdescripcion = DBCodcompra.Columns(3)
   Fcodcompra.GDBLCosto = DBCodcompra.Columns(4)
   Fcodcompra.GSTRMonedaRecibida = DBCodcompra.Columns(5)
   Fcodcompra.Gblnagregando = False
   Fcodcompra.Gblnmodificando = True
   Fcodcompra.Show vbModal
   
   Set MrsTempinvCodCompra = MobjArticulo.MostrarDetalleTEMPINVENTORYVENDORINVT(Txtcodarticulo.Text, MDblIdentificador)
   Set DBCodcompra.DataSource = MrsTempinvCodCompra
   FormatoGrillaCodCompra
   DBCodcompra.Refresh
   
   
 Else
   MsgBox "Debe seleccionar un Proveedor", vbDefaultButton1 + vbExclamation, "Mensaje"
 End If
End Sub

Private Sub cmdmodificar_Click()
   If Not IsNull(DbStock.Bookmark) Then
      FModificarStock.GstrcodArticulo = Txtcodarticulo.Text
      FModificarStock.GDblIdentificador = MDblIdentificador
      
      
      FModificarStock.lblcodalmacen = DbStock.Columns(0).Value
      FModificarStock.lblalmacendscr = DbStock.Columns(1).Value
      FModificarStock.GDblstkmax = DbStock.Columns(2).Value
      FModificarStock.GDblstkmin = DbStock.Columns(3).Value
      FModificarStock.GDblprecioventa = DbStock.Columns(4).Value
      If Trim(DbStock.Columns(5).Text) = Empty Then
        FModificarStock.GstrTipoPrecio = Empty
      Else
        FModificarStock.GstrTipoPrecio = DbStock.Columns(5).Value
      End If
      
      If Trim(DbStock.Columns(7).Text) = Empty Then
         FModificarStock.GstrMoneda = Empty
      Else
         FModificarStock.GstrMoneda = DbStock.Columns(7).Value
      End If
      FModificarStock.Show vbModal
      
      Set MrsTempinvDat = MobjArticulo.MostrarDetalleTempInventoryDat(Txtcodarticulo.Text, MDblIdentificador)
      Set DbStock.DataSource = MrsTempinvDat
      FormatoGrillaStock
      DbStock.Refresh
            
   Else
      MsgBox "Debe seleccionar un almacén", vbDefaultButton1 + vbExclamation, "Mensaje"
   End If
End Sub

Private Sub cmdnuevocodalter_Click()
On Error GoTo errhandler

   FAgregaCodAlter.GstrcodArticulo = Txtcodarticulo.Text
   FAgregaCodAlter.GDblIdentificador = MDblIdentificador
   FAgregaCodAlter.Show vbModal
   
   Set MrsTempinvAlter = MobjArticulo.MostrarDetalleTempInventoryAlter(Txtcodarticulo.Text, MDblIdentificador)
   Set DBCodAlter.DataSource = MrsTempinvAlter
   DBCodAlter.Refresh
   
Exit Sub
errhandler:
     MsgBox Err.Description, vbCritical + vbDefaultButton1, Err.Source
End Sub

Private Sub cmdnuevocodcomp_Click()
   
   Fcodcompra.GSTRdescripcion = txtDescripcion.Text
   Fcodcompra.GSTRMonedaBase = MSTRMonedaBase
   Fcodcompra.GstrcodArticulo = Txtcodarticulo.Text
   Fcodcompra.GDblIdentificador = MDblIdentificador
   Fcodcompra.Gblnagregando = True
   Fcodcompra.Gblnmodificando = False
   Fcodcompra.Caption = "Agregar Código de Compra"
   Fcodcompra.Show vbModal
   
   'Una vez regitrado en el Temporal de Códigos de Compra se refresca el Grid
    
   Set MrsTempinvCodCompra = MobjArticulo.MostrarDetalleTEMPINVENTORYVENDORINVT(Txtcodarticulo.Text, MDblIdentificador)
   Set DBCodcompra.DataSource = MrsTempinvCodCompra
   FormatoGrillaCodCompra
   DBCodcompra.Refresh
   
   
   
End Sub

Private Sub cmdreplicar_Click()
   FReplicar.GSTRMonedaBase = MSTRMonedaBase
   FReplicar.GstrcodArticulo = Txtcodarticulo.Text
   FReplicar.GDblIdentificador = MDblIdentificador
   FReplicar.Show vbModal
   
  'Una Vez Efectuada la Replicación se Refresca el Grid
  'Tabla InventoryDat
   Set MrsTempinvDat = MobjArticulo.MostrarDetalleTempInventoryDat(Txtcodarticulo.Text, MDblIdentificador)
   Set DbStock.DataSource = MrsTempinvDat
   FormatoGrillaStock
   DbStock.Refresh
     
End Sub

Private Sub DbStock_Click()
   DatosAdicionalesStock
End Sub

Private Sub DbStock_KeyUp(KeyCode As Integer, Shift As Integer)
   DatosAdicionalesStock
End Sub

Private Sub DbStock_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
  DatosAdicionalesStock
End Sub

Private Sub DtcCategoria_Click(Area As Integer)
   If DtcCategoria.BoundText <> Empty Then
    Set MrslistadodeSubCategoria = MobjSubCategoria.ListarPorCategoriaID(DtcCategoria.BoundText)
    GCargaDataCombo DtcSubCategoria, MrslistadodeSubCategoria, "CLASSUBID", "DESCR"
   End If
End Sub

Private Sub DtcIgv_Click(Area As Integer)
  If DtcIgv.BoundText <> Empty Then
     Set MrslistadodeIGVValue = MobjImpuesto.ListarPorTipoImpuestoID(DtcIgv.BoundText)
     lbligv.Caption = GFormatodeNumero(MrslistadodeIGVValue!Value, GintDecPrecio)
     Set MrslistadodeIGVValue = Nothing
  End If
End Sub

Private Sub DtcISC_Click(Area As Integer)
  If DtcISC.BoundText <> Empty Then
     Set MrslistadodeISCValue = MobjImpuesto.ListarPorTipoImpuestoID(DtcISC.BoundText)
     lblisc.Caption = GFormatodeNumero(MrslistadodeISCValue!Value, GintDecPrecio)
     Set MrslistadodeISCValue = Nothing
  End If
End Sub

Private Sub DtcSubCategoria_GotFocus()
  If DtcSubCategoria.BoundText = Empty Then
    Set MrslistadodeSubCategoria = MobjSubCategoria.ListarPorCategoriaID(DtcCategoria.BoundText)
    GCargaDataCombo DtcSubCategoria, MrslistadodeSubCategoria, "CLASSUBID", "DESCR"
   End If
End Sub

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

Public Sub primer_registro()
Call Gprimer_registro(Me, MrslistadodeArticulos)
Call asigna_campos
End Sub

Public Sub ultimo_registro()
Call Gultimo_registro(Me, MrslistadodeArticulos)
Call gactualiza_barra(pb_editar, pb_primerregistro, pb_ultimoregistro)
Call asigna_campos
End Sub

Public Sub registro_anterior()
Call Gregistro_anterior(Me, MrslistadodeArticulos)
Call gactualiza_barra(pb_editar, pb_primerregistro, pb_ultimoregistro)
Call asigna_campos
End Sub
Public Sub registro_siguiente()
Call Gregistro_siguiente(Me, MrslistadodeArticulos)
Call asigna_campos
End Sub
Private Sub Form_Initialize()
Call gHabilitarReg(Me, False)
End Sub

Private Sub Form_Load()
'seguridad
Me.Left = (MDIFMaestros.Width - Me.Width) / 2
Me.Top = ((MDIFMaestros.Height - Me.Height) / 2) - MDIFMaestros.Toolbar1.Height

Call gseguridad(Me)
If pbderecho_consultar Then
    Dim numreg As Long
     
    StaMArticulo.Tab = 0
    ' Se instancian los Objetos
      InstanciarObjetos
          
    Call obtener_datos
    ' se cargan los DataCombos
      CargarDatacombos
      
    Call asigna_campos
    ' se cargan las Grillas
      
    pb_primerregistro = True

Else
    MsgBox ("No tiene Derechos de Consultar en este formulario"), vbCritical + vbDefaultButton1, "Mensaje"
End If
End Sub
Public Sub borrar_registro()
Call gborrar_Registro(Me, MrslistadodeArticulos, Txtcodarticulo)
End Sub

Function valida_datos()
  If Trim(Txtcodarticulo.Text) = Empty Then
     MsgBox "Ingrese Código de Artículo", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     Txtcodarticulo.SetFocus
     Exit Function
  End If
  If Trim(txtDescripcion.Text) = Empty Then
     MsgBox "Ingrese Descripción de Artículo", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     txtDescripcion.SetFocus
     Exit Function
  End If
  If Trim(DtcUmedida.Text) = Empty Then
     MsgBox "Ingrese Unidad de Medida", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     DtcUmedida.SetFocus
     Exit Function
  End If
  If Trim(DtcCategoria.Text) = Empty Then
     MsgBox "Ingrese Categoría", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     DtcCategoria.SetFocus
     Exit Function
  End If
  If Trim(DtcSubCategoria.Text) = Empty Then
     MsgBox "Ingrese Subcategoría", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     DtcSubCategoria.SetFocus
     Exit Function
  End If
  If Trim(DtcTipo.Text) = Empty Then
     MsgBox "Ingrese el Tipo de Artículo", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     DtcTipo.SetFocus
     Exit Function
  End If
  If Trim(DtcIgv.Text) = Empty Then
     MsgBox "Ingrese IGV ", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     DtcIgv.SetFocus
     Exit Function
  End If
  If Trim(DtcISC.Text) = Empty Then
     MsgBox "Ingrese ISC ", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     DtcISC.SetFocus
     Exit Function
  End If
  If Trim(txtcodinventariable.Text) = Empty And Trim(txtcodinventariable.Text) = Empty Then
     MsgBox "Ingrese Código Solomon ", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     valida_datos = False
     StaMArticulo.Tab = 4
     txtcodinventariable.SetFocus
     Exit Function
  End If
  If Chkdesensamble.Value = 1 Then
     If Trim(Txtcoddesemsamble.Text) = Empty Then
        MsgBox "Ingrese Código de Desensamble ", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
        valida_datos = False
        Txtcoddesemsamble.SetFocus
        Exit Function
     End If
  
     If MobjArticulo.ObtenerDescripcion(Txtcoddesemsamble.Text) = Empty Then
        MsgBox "Código de Desensamble no existe", vbDefaultButton1 + vbExclamation, "Advertencia"
        Txtcoddesemsamble.SetFocus
        valida_datos = False
        Exit Function
     End If
     If MobjUmedida.EsDivisible(DtcUmedida.BoundText) = False Then
        MsgBox "Unidad de Medida " + Trim(DtcUmedida.Text) + " no es divisible", vbDefaultButton1 + vbExclamation, "Advertencia"
        Chkdesensamble.Value = 0
        valida_datos = False
        Exit Function
     End If
   
     If Trim(Txtcodarticulo.Text) = Trim(Txtcoddesemsamble.Text) Then
        MsgBox "Código de Desensamble no puede ser igual al código del artículo", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
        valida_datos = False
        Txtcoddesemsamble.SetFocus
        Exit Function
     End If
  End If
  
  If DtcIgv.BoundText = DtcISC.BoundText Then
     MsgBox "Código de IGV no puede ser igual al código de ISC", vbDefaultButton1 + vbExclamation, "Faltan Parámetros"
     DtcIgv.SetFocus
     valida_datos = False
     Exit Function
  End If
  
  valida_datos = True
End Function
Public Sub grabar_registro()
Dim LstrUltSubCategor As String
Dim Linttienda As Integer
Dim Lintplaya As Integer
Dim Lintotro As Integer

On Error GoTo errhandler

If valida_datos() = True Then
      If Opttienda.Value = True Then
         Linttienda = 1
      Else
         Linttienda = 0
      End If
      If Optplaya.Value = True Then
         Lintplaya = 1
      Else
         Lintplaya = 0
      End If
      If Optotrotipo.Value = True Then
         Lintotro = 1
      Else
         Lintotro = 0
      End If
    ' llamada al proc de grabacion
   If pb_agregar = True Then

      MobjArticulo.AgregarArticulo Txtcodarticulo.Text, txtDescripcion.Text, Ctnequivalencia.Text, _
                                   Lintplaya, Linttienda, Lintotro, ChkInventariable.Value, Chkformula.Value, _
                                   DtcUmedida.BoundText, DtcCategoria.BoundText, DtcSubCategoria.BoundText, _
                                   DtcTipo.BoundText, DtcIgv.BoundText, DtcISC.BoundText, Ctndscto1.Text, Ctndscto2.Text, _
                                   Ctndsctomonto.Text, ChkBloqueoCompra.Value, ChkBloqueoVenta.Value, ChkEstado.Value, _
                                   Chkconsignacion.Value, Chkdesensamble.Value, MDblIdentificador, Txtcoddesemsamble.Text, _
                                   CTNfactordesem.Text, txtcodinventariable.Text, txtcodnoinventariable.Text
   Else
     If pb_editar = True Then
        MobjArticulo.ActualizarArticulo Txtcodarticulo.Text, txtDescripcion.Text, Ctnequivalencia.Text, _
                                   Lintplaya, Linttienda, Lintotro, ChkInventariable.Value, Chkformula.Value, _
                                   DtcUmedida.BoundText, DtcCategoria.BoundText, DtcSubCategoria.BoundText, _
                                   DtcTipo.BoundText, DtcIgv.BoundText, DtcISC.BoundText, Ctndscto1.Text, Ctndscto2.Text, _
                                   Ctndsctomonto.Text, ChkBloqueoCompra.Value, ChkBloqueoVenta.Value, ChkEstado.Value, _
                                   Chkconsignacion.Value, Chkdesensamble.Value, MDblIdentificador, Txtcoddesemsamble.Text, _
                                   CTNfactordesem.Text, txtcodinventariable.Text, txtcodnoinventariable.Text

     End If
   End If
    'Cargar el DtcSubCategoria con Todas las SubCategorias
    LstrUltSubCategor = DtcSubCategoria.BoundText
    Set MrslistadodeSubCategoria = MobjSubCategoria.ListarSubCategorias
    GCargaDataCombo DtcSubCategoria, MrslistadodeSubCategoria, "CLASSUBID", "DESCR"
    DtcSubCategoria.BoundText = LstrUltSubCategor
    Call ggrabar_registro(Me)
End If

Exit Sub

errhandler:
    MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbCritical, "Advertencia"

 
End Sub
Public Sub actualizar_registro()
'llamar al procedimiento de carga
Call obtener_datos
Call asigna_campos
MsgBox ("Registros Actualizados"), vbInformation + vbDefaultButton1, "Mensaje"
End Sub

Public Sub agregar_registro()
'Obtener el correlativo
 Set MobjCorrelativo = New DB_CORRELATIVO.C_Correlativos
 MDblIdentificador = MobjCorrelativo.ObtenerCorrelativo(GCUSERID)
 Set MobjCorrelativo = Nothing
 
'Se direccionan los Grids a los Temporales
 CargarTemporales
 Call gagregar_registro(Me, Txtcodarticulo)
 
'La función gagregar_registro pone en blanco los valores de los checkbox
'Pero en el Maestro de Artículos tienen que estar habilitadas por defecto
'las siguientes opciones :
  
   ChkInventariable.Value = 1
   Opttienda.Value = True
   ChkEstado.Value = 1
   lbligv.Caption = Empty
   lblisc.Caption = Empty
   DtcIgv.BoundText = GStrCodigoIGV
   lbligv.Caption = GFormatodeNumero(GdblIGV, GintDecPrecio)
   DatosAdicionalesStock
End Sub
Public Sub modificar_registro()
 Dim LstrCodSubCategor As String
 
 Set MobjCorrelativo = New DB_CORRELATIVO.C_Correlativos
 MDblIdentificador = MobjCorrelativo.ObtenerCorrelativo(GCUSERID)
 Set MobjCorrelativo = Nothing

 MobjArticulo.CargaInventoryDataTemp Txtcodarticulo.Text, MDblIdentificador
 MobjArticulo.CargaInventoryAlteraTemp Txtcodarticulo.Text, MDblIdentificador
 MobjArticulo.CargaInventoryVendorInvaTemp Txtcodarticulo.Text, MDblIdentificador
 
 'Guardar el Valor Actual del DataCombo de Subcategoria , Cargar el combo
 'de acuerdo a las subcategorias disponibles para la Categoria Seleccionada
 
 LstrCodSubCategor = DtcSubCategoria.BoundText
 Set MrslistadodeSubCategoria = MobjSubCategoria.ListarPorCategoriaID(DtcCategoria.BoundText)
 GCargaDataCombo DtcSubCategoria, MrslistadodeSubCategoria, "CLASSUBID", "DESCR"
 DtcSubCategoria.BoundText = LstrCodSubCategor

 Call gmodificar_registro(Me, Txtcodarticulo)
 
 'Corrige si es que el Flag de desemsamble está Habilitado
 'Para Hablitar el Boton de Busqueda de desensamble
 
  If Chkdesensamble.Value = 1 Then
     FraDesemsamble.Enabled = True
     cmdbuscardesem.Enabled = True
     Txtcoddesemsamble.Enabled = True
     CTNfactordesem.Enabled = True
  End If
  
End Sub
Public Sub descartar_registro()
 ' Revertir cambios
  Set MrslistadodeSubCategoria = MobjSubCategoria.ListarSubCategorias
  GCargaDataCombo DtcSubCategoria, MrslistadodeSubCategoria, "CLASSUBID", "DESCR"
  MobjArticulo.BorrarTemporales MDblIdentificador
       
  Call gdescartar_registro(Me)
  Call asigna_campos
End Sub
Sub obtener_datos()

' Private MrslistadodeIGVValue As ADODB.Recordset
' Private MrslistadodeISCValue As ADODB.Recordset
  
  Set MrslistadodeArticulos = MobjArticulo.ListarArticulos
  Set MrslistadodeUmedida = MobjUmedida.ListarUnitMed
  Set MrslistadodeCategoria = MobjCategoria.ListarCategorias
  Set MrslistadodeSubCategoria = MobjSubCategoria.ListarSubCategorias
  Set MrslistadodeTipo = MobjTipo.ListarTiposInventario
  Set MrslistadodeIGV = MobjImpuesto.ListarTiposImpuestos
  Set MrslistadodeISC = MobjImpuesto.ListarTiposImpuestos
  
End Sub
Sub salir_formulario()
' validar que no haya procesos pendientes
' si no hay problemas
gformmdi.Toolbar1.Buttons(18).Caption = "Salir"    ' boton salir
Unload Me
End Sub
Sub asigna_campos()
  If Not MrslistadodeArticulos.EOF Then
     Txtcodarticulo.Text = MrslistadodeArticulos!INVTIDSKU
     txtDescripcion.Text = MrslistadodeArticulos!DESCR
     lblcodigoartstock.Caption = MrslistadodeArticulos!INVTIDSKU
     lbldescripcion.Caption = txtDescripcion.Text
     lblcodalter.Caption = MrslistadodeArticulos!INVTIDSKU
     lbldescralter.Caption = MrslistadodeArticulos!DESCR
     lblcodartcompra.Caption = MrslistadodeArticulos!INVTIDSKU
     lblbdescrcompra.Caption = MrslistadodeArticulos!DESCR
     lblcodsolom.Caption = MrslistadodeArticulos!INVTIDSKU
     lbldscrsolo.Caption = MrslistadodeArticulos!DESCR
     
     lblcodalter.Caption = Txtcodarticulo.Text
     lbldescralter.Caption = txtDescripcion.Text
     Ctnequivalencia.Text = GFormatodeNumero(MrslistadodeArticulos!wtstk1, GintDecStock)
     DtcUmedida.BoundText = MrslistadodeArticulos!StkUnitID
     DtcCategoria.BoundText = MrslistadodeArticulos!classid
     DtcSubCategoria.BoundText = MrslistadodeArticulos!classubid
     DtcTipo.BoundText = MrslistadodeArticulos!InvTypeid
     DtcIgv.BoundText = MrslistadodeArticulos!TAXIGV
     If IsNull(MrslistadodeArticulos!TAXISC) Then
       DtcISC.BoundText = ""
     Else
       DtcISC.BoundText = MrslistadodeArticulos!TAXISC
     End If
     Ctndscto1.Text = GFormatodeNumero(MrslistadodeArticulos!discdscto1, 2)
     Ctndscto2.Text = GFormatodeNumero(MrslistadodeArticulos!discdscto2, 2)
     Ctndsctomonto.Text = GFormatodeNumero(MrslistadodeArticulos!discmto, 2)
     If MrslistadodeArticulos!Status = True Then
        ChkEstado.Value = 1
     Else
        ChkEstado.Value = 0
     End If
     
     Optplaya.Value = CBool(MrslistadodeArticulos!stkfuels)
     Opttienda.Value = CBool(MrslistadodeArticulos!stkstore)
     Optotrotipo.Value = CBool(MrslistadodeArticulos!stkother)
     
     If MrslistadodeArticulos!stkitem = True Then
       ChkInventariable.Value = 1
     Else
       ChkInventariable.Value = 0
     End If
     If MrslistadodeArticulos!kit = True Then
        Chkformula.Value = 1
     Else
        Chkformula.Value = 0
     End If
     If MrslistadodeArticulos!Consignment = True Then
       Chkconsignacion.Value = 1
     Else
       Chkconsignacion.Value = 0
     End If
     If MrslistadodeArticulos!disassemble = True Then
       Chkdesensamble.Value = 1
     Else
       Chkdesensamble.Value = 0
     End If
     If MrslistadodeArticulos!Stksales = True Then
       ChkBloqueoVenta.Value = 1
     Else
       ChkBloqueoVenta.Value = 0
     End If
     If MrslistadodeArticulos!Stkrecept = True Then
       ChkBloqueoCompra.Value = 1
     Else
       ChkBloqueoCompra.Value = 0
     End If
     
     'Carga los Valores del Impuesto
      Set MrslistadodeIGVValue = MobjImpuesto.ListarPorTipoImpuestoID(DtcIgv.BoundText)
      lbligv.Caption = GFormatodeNumero(MrslistadodeIGVValue!Value, GintDecPrecio)
      Set MrslistadodeIGVValue = Nothing
            
      Set MrslistadodeISCValue = MobjImpuesto.ListarPorTipoImpuestoID(DtcISC.BoundText)
      If Not MrslistadodeISCValue.EOF Then
         lblisc.Caption = GFormatodeNumero(MrslistadodeISCValue!Value, GintDecPrecio)
      Else
         lblisc.Caption = GFormatodeNumero(0, GintDecPrecio)
      End If
      
      Set MrslistadodeISCValue = Nothing
    
     'Mostrar los Detalles Inventory Dat---------------
     
      MuestraDatosInventoryDat
      DatosAdicionalesStock
      
     'Mostrar los Detalles de Códigos Alternativos-----
      
      MuestraDatosINVENTORYALTER
      
     'Mostrar los Detalles de Códigos de Compra--------
      
      MuestraDatosINVENTORYVENDORINVT
      
     'Mostrar el Código de Desemsamble------
      
      MuestraDatosIN_INVENTORYDES
      
     'Mostrar los Códigos de Solomon--------
     
      MuestraDatosIN_SOLINVENTORY
      
  End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If pb_editar Then
    If MsgBox("Desea Cancelar los Cambios", vbYesNo + vbQuestion, "Esta Modificando un registro") = vbNo Then
        Cancel = True
    Else
        Call gdesactiva_barra
    End If
Else
    Call gdesactiva_barra
End If
  
End Sub

Private Sub Form_Unload(Cancel As Integer)
  'Destruir Instancias de las clases
  
   Set MobjArticulo = Nothing
   Set MobjUmedida = Nothing
   Set MobjCategoria = Nothing
   Set MobjSubCategoria = Nothing
   Set MobjTipo = Nothing
   Set MobjImpuesto = Nothing
   
   Set MrslistadodeArticulos = Nothing
   Set MrslistadodeUmedida = Nothing
   Set MrslistadodeCategoria = Nothing
   Set MrslistadodeSubCategoria = Nothing
   Set MrslistadodeTipo = Nothing
   Set MrslistadodeIGV = Nothing
   Set MrslistadodeISC = Nothing
         
End Sub

Private Sub Txtcodarticulo_KeyPress(KeyAscii As Integer)
  KeyAscii = GBloqueaCaracter(KeyAscii)
End Sub
Private Sub Txtcoddesemsamble_KeyPress(KeyAscii As Integer)
  KeyAscii = GBloqueaCaracter(KeyAscii)
  If KeyAscii = 13 Then
      lbldescripdesemsamble.Caption = MobjArticulo.ObtenerDescripcion(Txtcoddesemsamble.Text)
      If Trim(lbldescripdesemsamble.Caption) = Empty Then
         MsgBox "Código de desensamble no existe", vbDefaultButton1 + vbExclamation, "Advertencia"
         Txtcoddesemsamble.Text = Empty
         CTNfactordesem.ValorPorDefecto
         Txtcoddesemsamble.SetFocus
      Else
         CTNfactordesem.SetFocus
      End If
  End If
End Sub
Private Sub txtcodinventariable_Change()
   txtcodinventariable.Text = Trim(txtcodinventariable.Text)
End Sub
Private Sub txtcodinventariable_KeyPress(KeyAscii As Integer)
  KeyAscii = GBloqueaCaracter(KeyAscii)
End Sub
Private Sub txtcodnoinventariable_Change()
  txtcodnoinventariable.Text = Trim(txtcodnoinventariable.Text)
End Sub
Private Sub txtcodnoinventariable_KeyPress(KeyAscii As Integer)
  KeyAscii = GBloqueaCaracter(KeyAscii)
End Sub
Private Sub txtDescripcion_KeyPress(KeyAscii As Integer)
  KeyAscii = GBloqueaCaracter(KeyAscii)
End Sub
Sub imprimir()
  
End Sub

