VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "MiControl.ocx"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form FConfigPtoVta 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Configuración de Puntos de Venta (95.030.00)"
   ClientHeight    =   5370
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9960
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   5370
   ScaleWidth      =   9960
   Begin TabDlg.SSTab SSTab1 
      Height          =   5370
      Left            =   0
      TabIndex        =   35
      Top             =   0
      Width           =   9960
      _ExtentX        =   17568
      _ExtentY        =   9472
      _Version        =   393216
      TabHeight       =   520
      TabCaption(0)   =   "Datos Generales"
      TabPicture(0)   =   "9503000.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "lblActualizacion"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "lblSerie"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "lblMoneda"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "lblTerminal"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).Control(4)=   "lblPtoVta"
      Tab(0).Control(4).Enabled=   0   'False
      Tab(0).Control(5)=   "Line1"
      Tab(0).Control(5).Enabled=   0   'False
      Tab(0).Control(6)=   "Line2"
      Tab(0).Control(6).Enabled=   0   'False
      Tab(0).Control(7)=   "lblNegocio"
      Tab(0).Control(7).Enabled=   0   'False
      Tab(0).Control(8)=   "Image1"
      Tab(0).Control(8).Enabled=   0   'False
      Tab(0).Control(9)=   "lblFecha"
      Tab(0).Control(9).Enabled=   0   'False
      Tab(0).Control(10)=   "dtcNegocio"
      Tab(0).Control(10).Enabled=   0   'False
      Tab(0).Control(11)=   "dtcMoneda"
      Tab(0).Control(11).Enabled=   0   'False
      Tab(0).Control(12)=   "txtSerie"
      Tab(0).Control(12).Enabled=   0   'False
      Tab(0).Control(13)=   "txtTerminal"
      Tab(0).Control(13).Enabled=   0   'False
      Tab(0).Control(14)=   "txtPtoVta"
      Tab(0).Control(14).Enabled=   0   'False
      Tab(0).Control(15)=   "cmdBuscar"
      Tab(0).Control(15).Enabled=   0   'False
      Tab(0).ControlCount=   16
      TabCaption(1)   =   "Configuraciones de  Dispositivos"
      TabPicture(1)   =   "9503000.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Line4"
      Tab(1).Control(0).Enabled=   0   'False
      Tab(1).Control(1)=   "Image2"
      Tab(1).Control(1).Enabled=   0   'False
      Tab(1).Control(2)=   "Frame1"
      Tab(1).Control(2).Enabled=   0   'False
      Tab(1).Control(3)=   "fraTfactura"
      Tab(1).Control(3).Enabled=   0   'False
      Tab(1).Control(4)=   "fraDisplay"
      Tab(1).Control(4).Enabled=   0   'False
      Tab(1).Control(5)=   "fraPedido"
      Tab(1).Control(5).Enabled=   0   'False
      Tab(1).Control(6)=   "chkDpedido"
      Tab(1).Control(6).Enabled=   0   'False
      Tab(1).Control(7)=   "fraND"
      Tab(1).Control(7).Enabled=   0   'False
      Tab(1).Control(8)=   "chkDnd"
      Tab(1).Control(8).Enabled=   0   'False
      Tab(1).Control(9)=   "fraFactura"
      Tab(1).Control(9).Enabled=   0   'False
      Tab(1).Control(10)=   "chkDfac"
      Tab(1).Control(10).Enabled=   0   'False
      Tab(1).Control(11)=   "fraBoleta"
      Tab(1).Control(11).Enabled=   0   'False
      Tab(1).Control(12)=   "chkDbol"
      Tab(1).Control(12).Enabled=   0   'False
      Tab(1).Control(13)=   "fraNC"
      Tab(1).Control(13).Enabled=   0   'False
      Tab(1).Control(14)=   "chkDtfac"
      Tab(1).Control(14).Enabled=   0   'False
      Tab(1).Control(15)=   "chkDtbol"
      Tab(1).Control(15).Enabled=   0   'False
      Tab(1).Control(16)=   "fraCorrelativos"
      Tab(1).Control(16).Enabled=   0   'False
      Tab(1).ControlCount=   17
      TabCaption(2)   =   "Configuraciones Especiales"
      TabPicture(2)   =   "9503000.frx":0038
      Tab(2).ControlEnabled=   0   'False
      Tab(2).Control(0)=   "Frame2"
      Tab(2).Control(1)=   "dtcImpresoras"
      Tab(2).Control(2)=   "chk9"
      Tab(2).Control(3)=   "fraSalto"
      Tab(2).Control(4)=   "dtcAlmacen"
      Tab(2).Control(5)=   "Line5"
      Tab(2).Control(6)=   "Image3"
      Tab(2).Control(7)=   "lblCorrelTranSal"
      Tab(2).Control(8)=   "Label6"
      Tab(2).Control(9)=   "lblCorrelVta"
      Tab(2).Control(10)=   "Label4"
      Tab(2).Control(11)=   "lblImpresora"
      Tab(2).Control(12)=   "lblAlmacen"
      Tab(2).Control(13)=   "Line3"
      Tab(2).ControlCount=   14
      Begin VB.Frame Frame2 
         Height          =   3165
         Left            =   -74595
         TabIndex        =   61
         Top             =   1170
         Width           =   3345
         Begin VB.CheckBox chk7 
            Caption         =   "Salvar Transacciones"
            Height          =   285
            Left            =   180
            TabIndex        =   29
            Top             =   2385
            Width           =   1995
         End
         Begin VB.CheckBox chk5 
            Caption         =   "Realizar Cierre Z en Caja"
            Height          =   240
            Left            =   180
            TabIndex        =   27
            Top             =   1800
            Width           =   2670
         End
         Begin VB.CheckBox chk6 
            Caption         =   "Usar Teclas Rápidas"
            Height          =   330
            Left            =   180
            TabIndex        =   28
            Top             =   2070
            Width           =   2805
         End
         Begin VB.CheckBox chk8 
            Caption         =   "Solicita clave para anular documento"
            Height          =   285
            Left            =   180
            TabIndex        =   30
            Top             =   2700
            Width           =   2985
         End
         Begin VB.CheckBox chk2 
            Caption         =   "Emitir Ticket Boleta"
            Height          =   240
            Left            =   180
            TabIndex        =   24
            Top             =   630
            Width           =   2040
         End
         Begin VB.CheckBox chk3 
            Caption         =   "Emitir Factura Pre Impresa"
            Height          =   240
            Left            =   180
            TabIndex        =   25
            Top             =   945
            Width           =   2805
         End
         Begin VB.CheckBox chk4 
            Caption         =   "Emitir Boleta Pre Impresa"
            Height          =   240
            Left            =   180
            TabIndex        =   26
            Top             =   1305
            Width           =   2265
         End
         Begin VB.CheckBox Check1 
            Caption         =   "Emitir Ticket Factura"
            Height          =   285
            Left            =   180
            TabIndex        =   23
            Top             =   270
            Width           =   2130
         End
      End
      Begin MSDataListLib.DataCombo dtcImpresoras 
         Height          =   315
         Left            =   -68565
         TabIndex        =   34
         Top             =   2790
         Width           =   3120
         _ExtentX        =   5503
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin VB.CheckBox chk9 
         Caption         =   "Salto automático en Facturación"
         Height          =   285
         Left            =   -69420
         TabIndex        =   31
         Top             =   1170
         Width           =   2670
      End
      Begin VB.Frame fraCorrelativos 
         Caption         =   "Correlativos para Tickets"
         Height          =   1050
         Left            =   -68205
         TabIndex        =   49
         Top             =   3825
         Width           =   2985
         Begin VB.TextBox txtNroTBol 
            Alignment       =   1  'Right Justify
            Height          =   285
            Left            =   990
            MaxLength       =   10
            TabIndex        =   22
            Top             =   630
            Width           =   1815
         End
         Begin VB.TextBox txtNroTFac 
            Alignment       =   1  'Right Justify
            Height          =   285
            Left            =   990
            MaxLength       =   10
            TabIndex        =   21
            Top             =   270
            Width           =   1815
         End
         Begin VB.Label Label2 
            Caption         =   "Boleta"
            Height          =   195
            Left            =   180
            TabIndex        =   51
            Top             =   675
            Width           =   645
         End
         Begin VB.Label Label1 
            Caption         =   "Factura"
            Height          =   195
            Left            =   180
            TabIndex        =   50
            Top             =   315
            Width           =   645
         End
      End
      Begin VB.CheckBox chkDtbol 
         Caption         =   "Dispositivo de Salida para Tick. Bol"
         Height          =   330
         Left            =   -68115
         TabIndex        =   19
         Top             =   2475
         Width           =   2850
      End
      Begin VB.CheckBox chkDtfac 
         Caption         =   "Dispositivo de Salida para Tick. Fac "
         Height          =   330
         Left            =   -68115
         TabIndex        =   17
         Top             =   1080
         Width           =   2850
      End
      Begin VB.Frame fraNC 
         Height          =   1050
         Left            =   -74820
         TabIndex        =   43
         Top             =   3825
         Width           =   3120
         Begin VB.ComboBox cmbPnc 
            Height          =   315
            Left            =   315
            TabIndex        =   11
            Top             =   405
            Width           =   2535
         End
         Begin VB.CheckBox chkDnc 
            Caption         =   "Dispositivo de Salida para N Credito"
            Height          =   285
            Left            =   135
            TabIndex        =   10
            Top             =   -45
            Width           =   2850
         End
      End
      Begin VB.CheckBox chkDbol 
         Caption         =   "Dispositivo de Salida para Boleta"
         Height          =   285
         Left            =   -74685
         TabIndex        =   8
         Top             =   2475
         Width           =   2670
      End
      Begin VB.Frame fraBoleta 
         Height          =   1050
         Left            =   -74820
         TabIndex        =   42
         Top             =   2520
         Width           =   3075
         Begin VB.ComboBox cmbPbol 
            Height          =   315
            Left            =   315
            TabIndex        =   9
            Top             =   405
            Width           =   2490
         End
      End
      Begin VB.CheckBox chkDfac 
         Caption         =   "Dispositivo de Salida para Factura"
         Height          =   195
         Left            =   -74730
         TabIndex        =   6
         Top             =   1170
         Width           =   2760
      End
      Begin VB.CommandButton cmdBuscar 
         Enabled         =   0   'False
         Height          =   375
         Left            =   4815
         Picture         =   "9503000.frx":0054
         Style           =   1  'Graphical
         TabIndex        =   1
         ToolTipText     =   "Buscar"
         Top             =   1530
         Width           =   375
      End
      Begin VB.TextBox txtPtoVta 
         Height          =   285
         Left            =   2205
         TabIndex        =   0
         Top             =   1575
         Width           =   2445
      End
      Begin VB.TextBox txtTerminal 
         Height          =   285
         Left            =   2205
         TabIndex        =   2
         Top             =   2025
         Width           =   2445
      End
      Begin VB.TextBox txtSerie 
         Height          =   285
         Left            =   2205
         TabIndex        =   3
         Top             =   2475
         Width           =   2445
      End
      Begin MSDataListLib.DataCombo dtcMoneda 
         Height          =   315
         Left            =   2205
         TabIndex        =   4
         Top             =   3015
         Width           =   3135
         _ExtentX        =   5530
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin VB.Frame fraFactura 
         Height          =   1005
         Left            =   -74820
         TabIndex        =   41
         Top             =   1170
         Width           =   3030
         Begin VB.ComboBox cmbPfac 
            Height          =   315
            Left            =   270
            TabIndex        =   7
            Top             =   450
            Width           =   2535
         End
      End
      Begin VB.CheckBox chkDnd 
         Caption         =   "Dispositivo de Salida para N Debito"
         Height          =   195
         Left            =   -71400
         TabIndex        =   12
         Top             =   1170
         Width           =   2850
      End
      Begin VB.Frame fraND 
         Height          =   1005
         Left            =   -71490
         TabIndex        =   44
         Top             =   1170
         Width           =   3030
         Begin VB.ComboBox cmbPnd 
            Height          =   315
            Left            =   315
            TabIndex        =   13
            Top             =   450
            Width           =   2445
         End
      End
      Begin VB.CheckBox chkDpedido 
         Caption         =   "Dispositivo de Salida para Pedido"
         Height          =   195
         Left            =   -71355
         TabIndex        =   14
         Top             =   2520
         Width           =   2760
      End
      Begin VB.Frame fraPedido 
         Height          =   1050
         Left            =   -71445
         TabIndex        =   45
         Top             =   2520
         Width           =   3030
         Begin VB.ComboBox cmbPpedido 
            Height          =   315
            Left            =   315
            TabIndex        =   15
            Top             =   405
            Width           =   2445
         End
      End
      Begin VB.Frame fraDisplay 
         Caption         =   "Puerto de Impresora para Display"
         Height          =   1050
         Left            =   -71400
         TabIndex        =   46
         Top             =   3825
         Width           =   3030
         Begin VB.ComboBox cmbDisplay 
            Height          =   315
            Left            =   315
            TabIndex        =   16
            Top             =   405
            Width           =   2445
         End
      End
      Begin VB.Frame fraTfactura 
         Height          =   1005
         Left            =   -68205
         TabIndex        =   47
         Top             =   1170
         Width           =   3030
         Begin VB.ComboBox cmbPtfac 
            Height          =   315
            Left            =   315
            TabIndex        =   18
            Top             =   450
            Width           =   2445
         End
      End
      Begin VB.Frame Frame1 
         Height          =   1005
         Left            =   -68205
         TabIndex        =   48
         Top             =   2565
         Width           =   3030
         Begin VB.ComboBox cmbPtbol 
            Height          =   315
            Left            =   315
            TabIndex        =   20
            Top             =   450
            Width           =   2445
         End
      End
      Begin VB.Frame fraSalto 
         Height          =   1050
         Left            =   -69555
         TabIndex        =   52
         Top             =   1170
         Width           =   3165
         Begin MiControl.CtrlNumber ctnItem 
            Height          =   330
            Left            =   1440
            TabIndex        =   32
            Top             =   405
            Width           =   1410
            _ExtentX        =   2487
            _ExtentY        =   582
            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 Label3 
            Caption         =   "Cantidad por defecto "
            Height          =   420
            Left            =   315
            TabIndex        =   53
            Top             =   405
            Width           =   1005
         End
      End
      Begin MSDataListLib.DataCombo dtcAlmacen 
         Height          =   315
         Left            =   -68565
         TabIndex        =   33
         Top             =   2385
         Width           =   3135
         _ExtentX        =   5530
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo dtcNegocio 
         Height          =   315
         Left            =   7155
         TabIndex        =   5
         Top             =   3015
         Width           =   2085
         _ExtentX        =   3678
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin VB.Label lblFecha 
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   2205
         TabIndex        =   62
         Top             =   3600
         Width           =   1320
      End
      Begin VB.Line Line5 
         X1              =   -74640
         X2              =   -65370
         Y1              =   4590
         Y2              =   4590
      End
      Begin VB.Image Image3 
         Height          =   480
         Left            =   -74640
         Picture         =   "9503000.frx":0586
         Top             =   450
         Width           =   480
      End
      Begin VB.Image Image2 
         Height          =   480
         Left            =   -74640
         Picture         =   "9503000.frx":09C8
         Top             =   450
         Width           =   480
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   360
         Picture         =   "9503000.frx":0E0A
         Top             =   450
         Width           =   480
      End
      Begin VB.Label lblCorrelTranSal 
         Alignment       =   1  'Right Justify
         BorderStyle     =   1  'Fixed Single
         Height          =   285
         Left            =   -67665
         TabIndex        =   60
         Top             =   3870
         Width           =   1635
      End
      Begin VB.Label Label6 
         Caption         =   "Correlativo de Transacciones Salvadas"
         Height          =   510
         Left            =   -69600
         TabIndex        =   59
         Top             =   3825
         Width           =   1860
      End
      Begin VB.Label lblCorrelVta 
         Alignment       =   1  'Right Justify
         BorderStyle     =   1  'Fixed Single
         Height          =   285
         Left            =   -67665
         TabIndex        =   58
         Top             =   3375
         Width           =   1635
      End
      Begin VB.Label Label4 
         Caption         =   "Correlativo interno para Ventas"
         Height          =   420
         Left            =   -69600
         TabIndex        =   57
         Top             =   3330
         Width           =   1365
      End
      Begin VB.Label lblNegocio 
         Caption         =   "Tipo de Negocio"
         Height          =   285
         Left            =   5760
         TabIndex        =   56
         Top             =   3060
         Width           =   1185
      End
      Begin VB.Label lblImpresora 
         Caption         =   "Impresora"
         Height          =   285
         Left            =   -69555
         TabIndex        =   55
         Top             =   2835
         Width           =   960
      End
      Begin VB.Label lblAlmacen 
         AutoSize        =   -1  'True
         Caption         =   "Almacen"
         Height          =   195
         Left            =   -69555
         TabIndex        =   54
         Top             =   2430
         Width           =   615
      End
      Begin VB.Line Line4 
         X1              =   -74685
         X2              =   -65415
         Y1              =   945
         Y2              =   945
      End
      Begin VB.Line Line3 
         X1              =   -74640
         X2              =   -65370
         Y1              =   945
         Y2              =   945
      End
      Begin VB.Line Line2 
         X1              =   405
         X2              =   9585
         Y1              =   4635
         Y2              =   4635
      End
      Begin VB.Line Line1 
         X1              =   360
         X2              =   9630
         Y1              =   945
         Y2              =   945
      End
      Begin VB.Label lblPtoVta 
         Caption         =   "Punto de Venta"
         Height          =   285
         Left            =   720
         TabIndex        =   40
         Top             =   1575
         Width           =   1320
      End
      Begin VB.Label lblTerminal 
         Caption         =   "Terminal"
         Height          =   240
         Left            =   720
         TabIndex        =   39
         Top             =   2070
         Width           =   1095
      End
      Begin VB.Label lblMoneda 
         AutoSize        =   -1  'True
         Caption         =   "Moneda"
         Height          =   195
         Left            =   720
         TabIndex        =   38
         Top             =   3060
         Width           =   585
      End
      Begin VB.Label lblSerie 
         Caption         =   "Número de Serie"
         Height          =   285
         Left            =   720
         TabIndex        =   37
         Top             =   2475
         Width           =   1365
      End
      Begin VB.Label lblActualizacion 
         Caption         =   "Ultima Actualización"
         Height          =   330
         Left            =   675
         TabIndex        =   36
         Top             =   3645
         Width           =   1545
      End
   End
End
Attribute VB_Name = "FConfigPtoVta"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' CONFIGURACION DEL MODULO DE VENTAS
' EDGAR MARTIN CANCHO RUIZ

Option Explicit
Public pb_editar As Boolean
Public pb_agregar As Boolean
Public pb_primerregistro As Boolean
Public pb_ultimoregistro As Boolean

Public pbderecho_agregar As Boolean
Public pbderecho_consultar As Boolean
Public pbderecho_editar As Boolean
Public pbderecho_borrar As Boolean
Public pbderecho_imprimir As Boolean
Public pb_tiposcreen As String

Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As String

Public strUSER6 As String

Public curcontrol As Control
Public rs_config As ADODB.Recordset
Public objConfig As DB_UT_MANTENIMIENTOS.C_PUNTODEVENTA
Public objAlmacen As DB_INV_MANTENIMIENTOS.C_ALMACEN
Public objMoneda As DB_MA_MANTENIMIENTOS.C_MONEDA

Private Sub chk9_Click()
If chk9.Value Then
    ctnItem.Enabled = True
    ctnItem.Text = "1"
Else
    ctnItem.Enabled = False
End If
End Sub

Private Sub cmdBuscar_Click()
    'Lineas que llaman al Formulario de Búsqueda
    
    Dim ArrayBusqueda(1 To 2, 1 To 3) As Variant
    ArrayBusqueda(1, 1) = "SALESPOINT"
    ArrayBusqueda(1, 2) = "Código "
    ArrayBusqueda(1, 3) = 1000
    ArrayBusqueda(2, 1) = "DESCRBUSINESS"
    ArrayBusqueda(2, 2) = "Descripción_Negocio "
    ArrayBusqueda(2, 3) = 4000
      
          
    FBusquedasUt.GObtenerRegistros objConfig.ListarPuntodeVentaAyuda, ArrayBusqueda, 2, 2
    FBusquedasUt.Show vbModal
    If GrecibeUbicacion <> 0 And GrecibeUbicacion <= rs_config.RecordCount Then
          rs_config.AbsolutePosition = GrecibeUbicacion
          asigna_campos
          Call gestadoactualrs(Me, rs_config)
          Call gactualiza_barra(Me)
    End If
End Sub

Private Sub ctnItem_GotFocus()
ctnItem.BackColor = GC_ColorEnfoque
End Sub


Private Sub ctnItem_LostFocus()
ctnItem.BackColor = GC_ColorDefecto
End Sub

Private Sub dtcMoneda_GotFocus()
 dtcMoneda.BackColor = GC_ColorEnfoque
End Sub

Private Sub dtcMoneda_LostFocus()
dtcMoneda.BackColor = GC_ColorDefecto
End Sub

Private Sub dtcNegocio_GotFocus()
dtcNegocio.BackColor = GC_ColorEnfoque
End Sub

Private Sub dtcNegocio_LostFocus()
dtcNegocio.BackColor = GC_ColorDefecto
End Sub

Private Sub Form_Activate()

    Call gactualizaopcion(pbderecho_agregar, pbderecho_editar, pbderecho_borrar, pbderecho_imprimir)
    Call gactualiza_barra(Me)
    'lineas nuevas
    If pbderecho_consultar = False Then
        Unload Me
    End If

End Sub

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

Public Sub ultimo_registro()
    Call Gultimo_registro(Me, rs_config)
    Call asigna_campos
End Sub

Public Sub registro_anterior()
    Call Gregistro_anterior(Me, rs_config)
    Call asigna_campos
End Sub
Public Sub registro_siguiente()
    Call Gregistro_siguiente(Me, rs_config)
    Call asigna_campos
End Sub
Private Sub Form_Initialize()
    Call gHabilitarReg(Me, False)
End Sub

Private Sub Form_Load()
    'seguridad
    Call gseguridad(Me)
    
    If pbderecho_consultar Then
        LlenaCombos
        InstanciaObjetos
        
        ctnItem.Enabled = True
        ctnItem.Decimales = 0
        ctnItem.ValorPorDefecto
     
        Call obtener_datos
        LlenaDataCombos
        Call asigna_campos
        pb_primerregistro = True
    'lineas nuevas
    Else
        'Unload Me
        MsgBox ("No tiene Derechos de Consultar en este formulario"), vbCritical + vbDefaultButton1, "Mensaje"
    End If
     Me.Top = 100
     Me.Left = (Screen.Width - Me.Width) / 2
     SSTab1.Tab = 0
    
End Sub
Public Sub borrar_registro()

On Error GoTo errhandler

    Call gborrar_Registro(Me, rs_config, txtPtoVta)
    
Exit Sub

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

End Sub
Function valida_datos()
    If GVDATO(txtPtoVta.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Punto de Venta", vbInformation, "Error"
        SSTab1.Tab = 0
        txtPtoVta.SetFocus
        Exit Function
    End If

    If GVDATO(txtTerminal.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Terminal de Pto de Venta", vbInformation, "Error"
        SSTab1.Tab = 0
        txtTerminal.SetFocus
        Exit Function
    End If

    If GVDATO(txtSerie.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Número de Serie", vbInformation, "Error"
        SSTab1.Tab = 0
        txtSerie.SetFocus
        Exit Function
    End If

    If GVDATO(dtcNegocio.BoundText) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Tipo de Negocio", vbInformation, "Error"
        SSTab1.Tab = 0
        dtcNegocio.SetFocus
        Exit Function
    End If
    
    If chkDfac.Value And GVDATO(cmbPfac.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dispositivo de Salida", vbInformation, "Error"
        SSTab1.Tab = 1
        cmbPfac.SetFocus
        Exit Function
    End If

    If chkDbol.Value And GVDATO(cmbPbol.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dispositivo de Salida", vbInformation, "Error"
        SSTab1.Tab = 1
        cmbPbol.SetFocus
        Exit Function
    End If

    If chkDnc.Value And GVDATO(cmbPnc.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dispositivo de Salida", vbInformation, "Error"
        SSTab1.Tab = 1
        cmbPnc.SetFocus
        Exit Function
    End If

    If chkDnd.Value And GVDATO(cmbPnd.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dispositivo de Salida", vbInformation, "Error"
        SSTab1.Tab = 1
        cmbPnd.SetFocus
        Exit Function
    End If

    If chkDpedido.Value And GVDATO(cmbPpedido.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dispositivo de Salida", vbInformation, "Error"
        SSTab1.Tab = 1
        cmbPpedido.SetFocus
        Exit Function
    End If

    If chkDtfac.Value And GVDATO(cmbPtfac.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dispositivo de Salida", vbInformation, "Error"
        SSTab1.Tab = 1
        cmbPtfac.SetFocus
        Exit Function
    End If

    If chkDtbol.Value And GVDATO(cmbPtbol.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Dispositivo de Salida", vbInformation, "Error"
        SSTab1.Tab = 1
        cmbPtbol.SetFocus
        Exit Function
    End If

    If GVDATO(txtNroTFac.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Número de Ticket Factura", vbInformation, "Error"
        SSTab1.Tab = 1
        txtNroTFac.SetFocus
        Exit Function
    End If

    If GVDATO(txtNroTBol.Text) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Número de Ticket Boleta", vbInformation, "Error"
        SSTab1.Tab = 1
        txtNroTBol.SetFocus
        Exit Function
    End If

    If chk9.Value And GVDATO(ctnItem.Text) = "0" Then
        valida_datos = False
        MsgBox "Ingrese Cantidad por Defecto", vbInformation, "Error"
        SSTab1.Tab = 2
        ctnItem.SetFocus
        Exit Function
    End If

    If GVDATO(dtcImpresoras.BoundText) = Empty Then
        valida_datos = False
        MsgBox "Ingrese Impresora", vbInformation, "Error"
        SSTab1.Tab = 2
        dtcImpresoras.SetFocus
        Exit Function
    End If

    valida_datos = True
End Function
Public Sub grabar_registro()

On Error GoTo errhandler
    If valida_datos() = True Then
        ' llamada al proc de grabacion
        If pb_agregar Then

            objConfig.AgregarPtovta txtPtoVta.Text, txtTerminal.Text, Now, txtSerie.Text, Check1.Value, chk2.Value, _
                                        dtcMoneda.BoundText, chk7.Value, chk3.Value, chk4.Value, chkDfac.Value, cmbPfac.Text, _
                                        chkDbol.Value, cmbPbol.Text, chkDnc.Value, cmbPnc.Text, chkDnd.Value, cmbPnd.Text, _
                                        chkDpedido.Value, cmbPpedido.Text, chkDtfac.Value, cmbPtfac.Text, CDbl(txtNroTFac.Text), _
                                        chkDtbol.Value, cmbPtbol.Text, CDbl(txtNroTBol.Text), cmbDisplay.Text, chk9.Value, _
                                        CInt(ctnItem.Text), chk6.Value, chk8.Value, dtcNegocio.BoundText, DtcAlmacen.BoundText, _
                                        chk5.Value, dtcImpresoras.BoundText


        Else
            objConfig.ActualizarPtovta txtPtoVta.Text, txtTerminal.Text, Now, txtSerie.Text, Check1.Value, chk2.Value, _
                                        dtcMoneda.BoundText, chk7.Value, chk3.Value, chk4.Value, chkDfac.Value, cmbPfac.Text, _
                                        chkDbol.Value, cmbPbol.Text, chkDnc.Value, cmbPnc.Text, chkDnd.Value, cmbPnd.Text, _
                                        chkDpedido.Value, cmbPpedido.Text, chkDtfac.Value, cmbPtfac.Text, CDbl(txtNroTFac.Text), _
                                        chkDtbol.Value, cmbPtbol.Text, CDbl(txtNroTBol.Text), cmbDisplay.Text, chk9.Value, _
                                        CInt(ctnItem.Text), chk6.Value, chk8.Value, dtcNegocio.BoundText, DtcAlmacen.BoundText, _
                                        chk5.Value, dtcImpresoras.BoundText

        End If
        
        Call ggrabar_registro(Me)
        actualizar_registro
    End If
Exit Sub
errhandler:
    MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbCritical, "Error"
     
End Sub
Public Sub actualizar_registro()
    'llamar al procedimiento de carga
    Call obtener_datos
    Call asigna_campos
    'MsgBox ("Registros Actualizados")
End Sub
Public Sub agregar_registro()
    Call gagregar_registro(Me, txtPtoVta)
    lblCorrelVta.Caption = "0"
    lblCorrelTranSal.Caption = "0"
    lblFecha.Caption = Format(Now, "DD/MM/YYYY")
    dtcMoneda.BoundText = GstrCodMonedaBase
    DtcAlmacen.BoundText = GstrSiteProce
    txtNroTFac = "0"
    txtNroTBol = "0"
End Sub
Public Sub modificar_registro()
    Call gmodificar_registro(Me, txtPtoVta)
End Sub
Public Sub descartar_registro()
    ' Revertir cambios
    'adodc1.Recordset.CancelUpdate
    Call gdescartar_registro(Me)
    Call asigna_campos
End Sub

Sub obtener_datos()
    Set rs_config = objConfig.ObtenerConfiguracion
End Sub

Sub salir_formulario()
    ' validar que no haya procesos pendientes
    ' si no hay problemas
    MDIFUtilitarios.Toolbar1.Buttons(18).Caption = "Salir"    ' boton salir
    Unload Me
End Sub

Sub asigna_campos() ' falta decidir si va ha ser public o private
    If rs_config.RecordCount <> 0 Then
        
        txtPtoVta.Text = GVDATO(rs_config!SALESPOINT)
        txtTerminal.Text = GVDATO(rs_config!TERMINALNAME)
        txtSerie.Text = GVDATO(rs_config!serialnumber)
        dtcMoneda.BoundText = GVDATO(rs_config!curyid)
        lblFecha.Caption = Format(rs_config!ENDDATEACT, "DD/MM/YYYY")
        chkDfac.Value = IIf(rs_config!TYPEDISPFAC, 1, 0)
        cmbPfac.Text = GVDATO(rs_config!DISPFAC)
        
        chkDbol.Value = IIf(rs_config!TYPEDISPBOL, 1, 0)
        cmbPbol.Text = GVDATO(rs_config!DISPBOL)

        chkDnc.Value = IIf(rs_config!TYPEDISPNC, 1, 0)
        cmbPnc.Text = GVDATO(rs_config!DISPNC)

        chkDnd.Value = IIf(rs_config!TYPEDISPND, 1, 0)
        cmbPnd.Text = GVDATO(rs_config!DISPND)

        chkDpedido.Value = IIf(rs_config!TYPEDISORDER, 1, 0)
        cmbPpedido.Text = GVDATO(rs_config!DISPORDER)

        cmbDisplay.Text = GVDATO(rs_config!DISPDISPLAY)
        
        chkDtfac.Value = IIf(rs_config!TYPEDISPTICKFAC, 1, 0)
        cmbPtfac.Text = GVDATO(rs_config!DISPTICKFAC)

        chkDtbol.Value = IIf(rs_config!TYPEDISPTICKBOL, 1, 0)
        cmbPtbol.Text = GVDATO(rs_config!DISPTICKBOL)
        
        
        Check1.Value = IIf(rs_config!STKTICKFAC, 1, 0)
        chk2.Value = IIf(rs_config!STKTICKBOL, 1, 0)
        chk3.Value = IIf(rs_config!STKPRINTERFAC, 1, 0)
        chk4.Value = IIf(rs_config!STKPRINTEDBOL, 1, 0)
        
        chk5.Value = IIf(rs_config!STKTOFORCEZ, 1, 0)
        chk6.Value = IIf(rs_config!STKHOTKEYS, 1, 0)
        chk7.Value = IIf(rs_config!stkloadsale, 1, 0)
        chk8.Value = IIf(rs_config!stkdeletedoc, 1, 0)
        
        chk9.Value = IIf(rs_config!stkjumpautomat, 1, 0)
        ctnItem.Text = rs_config!qtyjumpautomat
        
        dtcNegocio.BoundText = GVDATO(rs_config!BusinessType)
        DtcAlmacen.BoundText = rs_config!SITEID
        dtcImpresoras.BoundText = rs_config!PrinterTypeID
        
        lblCorrelVta.Caption = rs_config!BATNBRSALES
        lblCorrelTranSal.Caption = rs_config!NBRLOADSALE
        strUSER6 = rs_config!USER6
        
        If strUSER6 = 0 Then  'Se asignan Factura y Boleta con su propio correlativo
            txtNroTFac.Text = rs_config!NBRTICKFAC
            txtNroTBol.Text = rs_config!NBRTICKBOL
        Else                  'Se asignan Factura y Boleta con el mismo correlativo
            txtNroTFac.Text = rs_config!NBRTICKBOL
            txtNroTBol.Text = rs_config!NBRTICKBOL
        End If
        
    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, "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)
   DestruyeObjetos
End Sub

Sub imprimir()
'    crBancos.ReportFileName = GstrReportesInv + "rpt_bancos.rpt"
'    crBancos.WindowTitle = "Reporte de Bancos"
'    crBancos.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
'    crBancos.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='01.117.00'"
'    crBancos.WindowState = crptMaximized
'    crBancos.WindowShowPrintSetupBtn = True
'    crBancos.Action = 1
    
End Sub

Public Sub CargaDataCombo(objDataCombo As DataCombo, rsSource As ADODB.Recordset, istrCampo1 As String, istrCampo2 As String)
    If rsSource.RecordCount <> 0 Then
        Set objDataCombo.DataSource = rsSource
        objDataCombo.DataField = istrCampo2
        Set objDataCombo.RowSource = rsSource
        objDataCombo.ListField = istrCampo2
        objDataCombo.BoundColumn = istrCampo1
        objDataCombo.BoundText = rsSource.Fields(istrCampo2)
    End If
End Sub

' Procedimiento de carga de los DataCombos del formulario
Private Sub LlenaDataCombos()
    Call CargaDataCombo(dtcMoneda, objMoneda.ListarMonedas, "CuryId", "Descr")
    Call CargaDataCombo(dtcNegocio, objConfig.Listartiposnegocio, "BUSINESSTYPE", "DESCRBUSINESS")
    Call CargaDataCombo(dtcImpresoras, objConfig.ListarTiposImpresoras, "PRINTERTYPEID", "DESCRPRINTER")
    Call CargaDataCombo(DtcAlmacen, objAlmacen.ListarAlmacenesPorStatus(1), "SiteId", "Name")
End Sub


Private Sub InstanciaObjetos()
    Set objConfig = New DB_UT_MANTENIMIENTOS.C_PUNTODEVENTA
    Set objAlmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN
    Set objMoneda = New DB_MA_MANTENIMIENTOS.C_MONEDA

End Sub

Private Sub DestruyeObjetos()
    Set objConfig = Nothing
    Set rs_config = Nothing
    Set objAlmacen = Nothing
    Set objMoneda = Nothing
End Sub

Private Sub LlenaCombos()
    Call CargaPuertos(cmbPfac)
    Call CargaPuertos(cmbPbol)
    Call CargaPuertos(cmbPnc)
    Call CargaPuertos(cmbPnd)
    Call CargaPuertos(cmbPpedido)
    Call CargaPuertos(cmbDisplay)
    Call CargaPuertos(cmbPtfac)
    Call CargaPuertos(cmbPtbol)
End Sub

Private Sub CargaPuertos(objCombo As ComboBox)
    Dim TPrinter As Printer
    objCombo.Clear
    For Each TPrinter In Printers
        objCombo.AddItem UCase(TPrinter.Port) & " " & TPrinter.DeviceName
    Next
End Sub

Private Function MValidaNumeros(KeyAscii As Integer) As Integer
    If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 13 Or KeyAscii = 8 Then
        MValidaNumeros = KeyAscii
    Else
        MValidaNumeros = 0
    End If
End Function


Private Sub txtNroTBol_GotFocus()
txtNroTBol.BackColor = GC_ColorEnfoque
End Sub

Private Sub txtNroTBol_LostFocus()
txtNroTBol.BackColor = GC_ColorDefecto
End Sub

Private Sub txtNroTFac_GotFocus()
    txtNroTFac.BackColor = GC_ColorEnfoque
End Sub

Private Sub txtNroTFac_KeyPress(KeyAscii As Integer)
    KeyAscii = MValidaNumeros(KeyAscii)
    If KeyAscii = 13 Then
        txtNroTBol.SetFocus
    End If
End Sub

Private Sub txtNroTFac_LostFocus()
    txtNroTFac.BackColor = GC_ColorDefecto
End Sub

Private Sub txtPtoVta_GotFocus()
    txtPtoVta.BackColor = GC_ColorEnfoque
End Sub

Private Sub txtPtoVta_KeyPress(KeyAscii As Integer)
KeyAscii = GBloqueaCaracter(KeyAscii)
If KeyAscii = 13 Then
    txtTerminal.SetFocus
End If
End Sub

Private Sub txtPtoVta_LostFocus()
txtPtoVta.BackColor = GC_ColorDefecto
End Sub

Private Sub txtSerie_GotFocus()
txtSerie.BackColor = GC_ColorEnfoque
End Sub

Private Sub txtSerie_LostFocus()
txtSerie.BackColor = GC_ColorDefecto
End Sub

Private Sub txtTerminal_GotFocus()
txtTerminal.BackColor = GC_ColorEnfoque
End Sub

Private Sub txtTerminal_LostFocus()
txtTerminal.BackColor = GC_ColorDefecto
End Sub
