VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "msdatlst.ocx"
Begin VB.Form frmCajaRegistradora 
   BorderStyle     =   0  'None
   Caption         =   "Caja Registradora"
   ClientHeight    =   9465
   ClientLeft      =   105
   ClientTop       =   105
   ClientWidth     =   10905
   Icon            =   "frmCajaRegistradora.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   9465
   ScaleWidth      =   10905
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   WindowState     =   2  'Maximized
   Begin VB.TextBox txtSupervisor 
      Height          =   375
      Left            =   720
      TabIndex        =   86
      Top             =   8520
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Height          =   9390
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   10815
      Begin VB.TextBox txtLocal 
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   4200
         MaxLength       =   1
         TabIndex        =   38
         Top             =   1800
         Width           =   375
      End
      Begin VB.TextBox txtCliente 
         BackColor       =   &H80000014&
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   405
         Left            =   2370
         TabIndex        =   37
         Top             =   2175
         Width           =   5190
      End
      Begin VB.TextBox txtRuc 
         Alignment       =   2  'Center
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   360
         Left            =   5865
         MaxLength       =   11
         TabIndex        =   36
         Top             =   1770
         Width           =   1680
      End
      Begin VB.CommandButton cmdCambio 
         BackColor       =   &H00E0E0E0&
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   795
         Left            =   7875
         Picture         =   "frmCajaRegistradora.frx":08CA
         Style           =   1  'Graphical
         TabIndex        =   35
         ToolTipText     =   "Ir a Caja Registradora (Versión Full)"
         Top             =   8310
         Width           =   960
      End
      Begin VB.TextBox txtCantidad 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00000000&
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   21.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FF00&
         Height          =   570
         Left            =   3315
         MaxLength       =   3
         TabIndex        =   34
         Top             =   405
         Width           =   2415
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto1"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   1
         Left            =   615
         TabIndex        =   33
         ToolTipText     =   "F1"
         Top             =   2640
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto2"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   2
         Left            =   1785
         TabIndex        =   32
         Top             =   2640
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto3"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   3
         Left            =   2955
         TabIndex        =   31
         Top             =   2640
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto4"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   4
         Left            =   4125
         TabIndex        =   30
         Top             =   2640
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto5"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   5
         Left            =   5295
         TabIndex        =   29
         Top             =   2640
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto6"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   6
         Left            =   6465
         TabIndex        =   28
         Top             =   2640
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto7"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   7
         Left            =   615
         TabIndex        =   27
         Top             =   4020
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto8"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   8
         Left            =   1785
         TabIndex        =   26
         Top             =   4020
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto9"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   9
         Left            =   2955
         TabIndex        =   25
         Top             =   4020
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto10"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   10
         Left            =   4125
         TabIndex        =   24
         Top             =   4020
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto11"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   11
         Left            =   5295
         TabIndex        =   23
         Top             =   4020
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto12"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   12
         Left            =   6465
         TabIndex        =   22
         Top             =   4020
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "AC/TC"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   24
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1005
         Index           =   43
         Left            =   8415
         TabIndex        =   21
         Top             =   6675
         Width           =   1965
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Impr. Tickt"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   14.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1005
         Index           =   42
         Left            =   9585
         TabIndex        =   20
         Top             =   2640
         Width           =   975
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   " Cod. Prod."
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   14.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1005
         Index           =   0
         Left            =   8355
         TabIndex        =   19
         Top             =   2655
         Visible         =   0   'False
         Width           =   975
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto13"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   13
         Left            =   615
         TabIndex        =   18
         Top             =   5430
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto14"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   14
         Left            =   1785
         TabIndex        =   17
         Top             =   5430
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto15"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   15
         Left            =   2955
         TabIndex        =   16
         Top             =   5430
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto16"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   16
         Left            =   4125
         TabIndex        =   15
         Top             =   5430
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto17"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   17
         Left            =   5295
         TabIndex        =   14
         Top             =   5430
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto18"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   18
         Left            =   6465
         TabIndex        =   13
         Top             =   5430
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto19"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   19
         Left            =   630
         TabIndex        =   12
         Top             =   6885
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto20"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   20
         Left            =   1800
         TabIndex        =   11
         Top             =   6885
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto21"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   21
         Left            =   2970
         TabIndex        =   10
         Top             =   6885
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto22"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   22
         Left            =   4140
         TabIndex        =   9
         Top             =   6885
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto23"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   23
         Left            =   5295
         TabIndex        =   8
         Top             =   6885
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Producto24"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1155
         Index           =   24
         Left            =   6465
         TabIndex        =   7
         Top             =   6885
         Width           =   1155
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "BorraAC/TC"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   14.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1005
         Index           =   41
         Left            =   8370
         TabIndex        =   6
         Top             =   5340
         Width           =   975
      End
      Begin VB.TextBox txtTarjeta 
         Alignment       =   2  'Center
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   360
         Left            =   2370
         MaxLength       =   8
         TabIndex        =   5
         Top             =   1800
         Width           =   1680
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Tipo Venta"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   14.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1005
         Index           =   44
         Left            =   8370
         TabIndex        =   4
         Top             =   4005
         Width           =   975
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "Anula TRANS"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   14.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1005
         Index           =   45
         Left            =   9585
         TabIndex        =   3
         Top             =   3960
         Width           =   975
      End
      Begin VB.CommandButton cmdTecla 
         Caption         =   "PAGO"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   14.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1005
         Index           =   46
         Left            =   9585
         TabIndex        =   2
         Top             =   5340
         Width           =   975
      End
      Begin VB.CommandButton cmdSalir 
         Caption         =   "Salir"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   15.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   4620
         TabIndex        =   1
         Top             =   8475
         Width           =   1680
      End
      Begin MSDataListLib.DataCombo dcbLocal 
         Height          =   330
         Left            =   8520
         TabIndex        =   39
         Top             =   1800
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   582
         _Version        =   393216
         Enabled         =   0   'False
         Style           =   2
         Text            =   "DataCombo1"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Label Label4 
         Caption         =   "_"
         Height          =   375
         Left            =   4080
         TabIndex        =   85
         Top             =   1800
         Width           =   135
      End
      Begin VB.Label lblLocal 
         AutoSize        =   -1  'True
         Caption         =   "&Local :"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   7680
         TabIndex        =   84
         Top             =   1800
         Width           =   840
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "ALT+N"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   25
         Left            =   525
         TabIndex        =   83
         Top             =   2265
         Width           =   525
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "&Nombre :"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   1350
         TabIndex        =   82
         Top             =   2250
         Width           =   960
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F1"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   13
         Left            =   1005
         TabIndex        =   81
         Top             =   6585
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+R"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   50
         Left            =   4650
         TabIndex        =   80
         Top             =   1845
         Width           =   630
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "&RUC:"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   5370
         TabIndex        =   79
         Top             =   1845
         Width           =   480
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SPACE"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   49
         Left            =   8280
         TabIndex        =   78
         Top             =   9135
         Width           =   525
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+L"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   195
         Index           =   48
         Left            =   540
         TabIndex        =   77
         Top             =   1890
         Width           =   630
      End
      Begin VB.Label lblSubtotal 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00000000&
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   21.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FF00&
         Height          =   570
         Left            =   5820
         TabIndex        =   76
         Top             =   405
         Width           =   4785
      End
      Begin VB.Label lblProducto 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00000000&
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   21.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FF00&
         Height          =   1095
         Left            =   240
         TabIndex        =   75
         Top             =   405
         Width           =   2970
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "C&liente :"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   225
         Left            =   1230
         TabIndex        =   74
         Top             =   1875
         Width           =   1080
      End
      Begin VB.Label lblCliente 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   495
         Left            =   4125
         TabIndex        =   73
         Top             =   2100
         Width           =   6615
         WordWrap        =   -1  'True
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+0"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   0
         Left            =   8670
         TabIndex        =   72
         Top             =   3660
         Visible         =   0   'False
         Width           =   630
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F1"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   1
         Left            =   1530
         TabIndex        =   71
         Top             =   3795
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F2"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   2
         Left            =   2700
         TabIndex        =   70
         Top             =   3795
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F3"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   3
         Left            =   3870
         TabIndex        =   69
         Top             =   3795
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F4"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   4
         Left            =   5040
         TabIndex        =   68
         Top             =   3795
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F5"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   5
         Left            =   6225
         TabIndex        =   67
         Top             =   3795
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F6"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   6
         Left            =   7380
         TabIndex        =   66
         Top             =   3795
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F7"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   7
         Left            =   1530
         TabIndex        =   65
         Top             =   5175
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F8"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   8
         Left            =   2655
         TabIndex        =   64
         Top             =   5175
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F9"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   9
         Left            =   3825
         TabIndex        =   63
         Top             =   5175
         Width           =   210
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F10"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   10
         Left            =   4920
         TabIndex        =   62
         Top             =   5175
         Width           =   315
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F11"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   11
         Left            =   6090
         TabIndex        =   61
         Top             =   5175
         Width           =   315
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "F12"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   12
         Left            =   7260
         TabIndex        =   60
         Top             =   5175
         Width           =   315
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F2"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   14
         Left            =   2160
         TabIndex        =   59
         Top             =   6585
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F3"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   15
         Left            =   3345
         TabIndex        =   58
         Top             =   6585
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F4"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   16
         Left            =   4500
         TabIndex        =   57
         Top             =   6585
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F5"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   17
         Left            =   5685
         TabIndex        =   56
         Top             =   6585
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F6"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   18
         Left            =   6855
         TabIndex        =   55
         Top             =   6585
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F7"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   19
         Left            =   1020
         TabIndex        =   54
         Top             =   8040
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F8"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   20
         Left            =   2190
         TabIndex        =   53
         Top             =   8040
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F9"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   21
         Left            =   3315
         TabIndex        =   52
         Top             =   8040
         Width           =   735
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F10"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   22
         Left            =   4425
         TabIndex        =   51
         Top             =   8040
         Width           =   840
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F11"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   23
         Left            =   5580
         TabIndex        =   50
         Top             =   8040
         Width           =   840
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "SHFT+F12"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   24
         Left            =   6765
         TabIndex        =   49
         Top             =   8040
         Width           =   840
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+Z"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   41
         Left            =   8670
         TabIndex        =   48
         Top             =   6345
         Width           =   630
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+I"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   42
         Left            =   9900
         TabIndex        =   47
         Top             =   3660
         Visible         =   0   'False
         Width           =   630
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+ENTER"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   43
         Left            =   9315
         TabIndex        =   46
         Top             =   7680
         Width           =   1050
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+A"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   44
         Left            =   8670
         TabIndex        =   45
         Top             =   4995
         Width           =   630
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+S"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   45
         Left            =   9900
         TabIndex        =   44
         Top             =   4995
         Width           =   630
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "CTRL+X"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   46
         Left            =   9900
         TabIndex        =   43
         Top             =   6345
         Width           =   630
      End
      Begin VB.Label lblTecla 
         Alignment       =   1  'Right Justify
         AutoSize        =   -1  'True
         Caption         =   "ALT+F4"
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   240
         Index           =   47
         Left            =   5625
         TabIndex        =   42
         Top             =   9120
         Width           =   630
      End
      Begin VB.Label lblTipo 
         Alignment       =   2  'Center
         BackColor       =   &H00000000&
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   18
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FF00&
         Height          =   525
         Left            =   3300
         TabIndex        =   41
         Top             =   990
         Width           =   2430
      End
      Begin VB.Label lblTotal 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00000000&
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Courier New"
            Size            =   21.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000FF00&
         Height          =   525
         Left            =   5820
         TabIndex        =   40
         Top             =   975
         Width           =   4785
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H00000000&
         BorderColor     =   &H80000009&
         FillStyle       =   0  'Solid
         Height          =   1410
         Left            =   120
         Top             =   240
         Width           =   10620
      End
   End
End
Attribute VB_Name = "frmCajaRegistradora"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim TeclaRapida(50) As Long
Dim TeclaProducto(50) As Long
Dim iTipoVenta As Integer '1:Normal 2:Voucher 3:Dolares 4:Transaccion Anulada
Dim bProducto As Boolean 'Establece si se estan registrando ventas o no
Dim Producto() As tProducto 'Almacena los datos de cada producto que se va registrando
Dim nProducto As Long 'Cantidad de productos por transaccion
Public iTotalVenta As Double

Public bVuelto As Boolean
Public gfax As New XArrayDB
Dim Teclasel As Long

Public iEfectivo As Double
Public iVuelto As Double
Public iEfectivoDolares As Double
Public iVueltoDolares As Double
Public bAcceso As Boolean
Public sNombreCliente As String

Private Sub cmdCambio_Click()
  If cmdCambio.Enabled = True Then
    Dim i As Long
    
    Call txtCantidad_LostFocus
    Load frmCajaRegistradoraFull
  
    If nProducto > 0 And bProducto = True Then
      'Actualiza datos en la siguiente pantalla
      frmCajaRegistradoraFull.bSincronizaPantalla = True
      frmCajaRegistradoraFull.nProducto = nProducto
      frmCajaRegistradoraFull.txtTarjeta = txtTarjeta
      frmCajaRegistradoraFull.txtNombres = txtCliente
      frmCajaRegistradoraFull.iTipoVenta = IIf(iTipoVenta = 5, 1, iTipoVenta)
      
      gfax.ReDim 0, nProducto - 1, 0, 13
      For i = 1 To nProducto
        gfax(i - 1, 1) = Right("000000" & CStr(Producto(i).Codigo), 6)
        gfax(i - 1, 2) = RecuperaCodigoCatalogo(CStr(Producto(i).Codigo))
        gfax(i - 1, 3) = Producto(i).nombre
        gfax(i - 1, 6) = CStr(Format(Producto(i).Cant, "###,###,##0.00"))
        gfax(i - 1, 7) = CStr(Format(Producto(i).PUnit, "###,###,##0.00"))
        gfax(i - 1, 8) = CStr(Format(Producto(i).Dscto, "###,###,##0.00"))
        gfax(i - 1, 9) = CStr(Format(Producto(i).Cant * Producto(i).PUnit, "###,###,##0.00"))
        gfax(i - 1, 10) = Producto(i).Canje
        gfax(i - 1, 11) = val(Producto(i).Ptos)
        gfax(i - 1, 12) = Format(Producto(i).Serv, "###,###,##0.00")
      Next
      Set frmCajaRegistradoraFull.gfax = gfax
      frmCajaRegistradoraFull.bSincronizaPantalla = True
    Else
      frmCajaRegistradoraFull.bSincronizaPantalla = False
    End If
    
    Unload Me
    frmCajaRegistradoraFull.CalculaTotales
    frmCajaRegistradoraFull.Inicio
    frmCajaRegistradoraFull.Show
  End If
  
End Sub

Private Function RecuperaCodigoCatalogo(strCodigo As String) As String
  
  On Error GoTo LineaError

  Screen.MousePointer = vbHourglass
  
  Dim sSQL As String
  Dim ADORS As ADODB.Recordset

  RecuperaCodigoCatalogo = ""

  sSQL = " SELECT cCodCatalogo " & _
         "   FROM Producto " & _
         "  WHERE cProdCode = " & strCodigo
  
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  If Not ADORS.EOF Then
    RecuperaCodigoCatalogo = LeerCampo(ADORS("cCodCatalogo"))
  End If
  
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  Screen.MousePointer = vbDefault

Salir:
  Set ADORS = Nothing
  Screen.MousePointer = vbDefault
End Function

Private Sub cmdsalir_Click()
  Unload Me
End Sub

Private Sub dcbLocal_Change()
  SeleccionarClienteLocal val(dcbLocal.BoundText)
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  On Error Resume Next

'SHIFT
'-----
'1, se está pulsando la tecla Shift (mayúsculas)
'2, se está pulsando Control
'4, se está pulsando Alt
'3, se están pulsando Shift y Ctrl,
'5, se están pulsando Shift y Alt,
'6, se están pulsando Ctrl y Alt,
'7, se están pulsando las tres teclas.

  Select Case Shift
  
    Case 0
      Select Case KeyCode
        Case vbKeyF1, vbKeyF2, vbKeyF3, vbKeyF4, vbKeyF5, vbKeyF6, vbKeyF7, vbKeyF8, _
             vbKeyF9, vbKeyF10, vbKeyF11, vbKeyF12 '112 To 123 ---- 01 - 12
          Call cmdTecla_Click(KeyCode - 111)
          
        Case vbKeySpace
          Call cmdCambio_Click
      End Select
    Case 1
        Select Case KeyCode
          Case vbKeyF1, vbKeyF2, vbKeyF3, vbKeyF4, vbKeyF5, vbKeyF6, vbKeyF7, vbKeyF8, _
             vbKeyF9, vbKeyF10, vbKeyF11, vbKeyF12 '112 To 123 ---- 13 - 24
          Call cmdTecla_Click(KeyCode - 99)
        End Select
    Case 2
      Select Case KeyCode
        Case vbKeyF1, vbKeyF2, vbKeyF3, vbKeyF4, vbKeyF5, vbKeyF6, vbKeyF7, vbKeyF8, _
             vbKeyF9, vbKeyF10, vbKeyF11, vbKeyF12 '112 To 123 ---- 25 - 36
          Call cmdTecla_Click(KeyCode - 87)
        Case vbKey1, vbKey2, vbKey3, vbKey4 '49 To 52 ---- 37 - 40
          Call cmdTecla_Click(KeyCode - 12)
        Case vbKeyZ
          cmdTecla(41).SetFocus
          Call cmdTecla_Click(41) 'Cancelar Transaccion
        'Case vbKeyReturn
        '  Call cmdTecla_Click(42) 'AC/TC
        Case 13
          cmdTecla(43).SetFocus
          Call cmdTecla_Click(43) 'AC/TC
        Case vbKeyA
          cmdTecla(44).SetFocus
          Call cmdTecla_Click(44) 'Tipo Venta
        Case vbKeyS
          cmdTecla(45).SetFocus
          Call cmdTecla_Click(45) 'Anula TRANS
        Case vbKeyX
          cmdTecla(46).SetFocus
          Call cmdTecla_Click(46) 'PAGO
        Case vbKeyL
          txtTarjeta.SetFocus
        Case vbKeyR
          txtRUC.SetFocus
        Case vbKeyC
          txtCantidad.SetFocus
          txtCantidad.SelStart = 0
          txtCantidad.SelLength = Len(txtCantidad.Text)
      End Select
    Case 4
      Select Case KeyCode
        Case vbKeyF4
          Unload Me
      End Select
  End Select
  Exit Sub
  
End Sub

Private Sub Form_Load()
      
  On Error GoTo LineaError
  Screen.MousePointer = vbHourglass
  
  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim i As Long, j As Long
  Dim iInicio As Long, iFin As Long
  Dim sTecla1 As String, sTecla2 As String, sTecla3 As String
  
  If VerificarFechaSistema = False Then
    MsgBox "La fecha del sistema no puede ser posterior a al ultima operacion realizada...Verifique!!", vbInformation + vbOKOnly, "Mensaje"
    End
  End If
  
  'Configura la Impresora por default
  ConfiguraImpresora kPAR_IMPRESORA
  '----------------------------------

  For i = 1 To 24
    cmdTecla(i).Caption = ""
    TeclaProducto(i) = 0
  Next
   
  sSQL = " SELECT C.cTeclCode, C.sTeclDesc, C.sTeclRapd, C.cTeclFlagAsig, C.cProdCode," & _
         " P.sProdDescCrta" & _
         " FROM ConfiguracionTeclado AS C LEFT JOIN Producto AS P ON C.cProdCode = P.cProdCode where P.cAlmaCode = '" & kPAR_ALMACEN & "'"

  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  i = 0 ' Controla el indice del control Tecla
  
  Do While Not ADORS.EOF
  
    'Captura el texto de la BD o la descripcion del producto asociado
    If LeerCampo(ADORS("cProdCode")) = "" Then
      cmdTecla(ADORS("cTeclCode")).Caption = LeerCampo(ADORS("sTeclDesc"))
      TeclaProducto(ADORS("cTeclCode")) = 0
    Else
      If Len(ADORS("sProdDescCrta")) > 25 Then
        cmdTecla(ADORS("cTeclCode")).Caption = Left(LeerCampo(ADORS("sProdDescCrta")), 25) + "..."
      Else
        cmdTecla(ADORS("cTeclCode")).Caption = LeerCampo(ADORS("sProdDescCrta"))
      End If
      TeclaProducto(ADORS("cTeclCode")) = LeerCampo(ADORS("cProdCode"))
    End If
    
    i = i + 1
    ADORS.MoveNext
  Loop
  
  'Valores por default
  bProducto = False
  iTipoVenta = 5
  
  LlenarComboLocal
  
  'Reglas por punto e importe
  If bolExistenProblemasConexionBDCliente = False Then
    ConectarBDCliente     'Abrimos conexion
  End If
  
  If bolExisteConexionBDCliente = True Then
    sSQL = "SELECT * FROM Regla_Punto"
    If Not oDBAdmin.EjecutarConsulta(ADOCnn2, sSQL, ADORS) Then GoTo Salir
          
    If ADORS.EOF Then
      MsgBox "Reglas en relación a los puntos no han sido establecidos", vbOKOnly + vbInformation
      GoTo Salir
    End If
    lReglaImporteMaximo = LeerCampo(ADORS!nImpoMaxi)
    lReglaPuntoImporte = CLng(LeerCampo(ADORS!nPuntImpo))
    lReglaPuntoCantidad = CLng(LeerCampo(ADORS!nPuntCant))
    oDBAdmin.CerrarBD ADOCnn2     'Cerramos conexion
    bolExisteConexionBDCliente = False
    
    'Actualizamos estos parametros en la BD Local
    sSQL = " UPDATE Regla_Punto" & _
           "    SET nImpoMaxi = " & lReglaImporteMaximo & "," & _
           "        nPuntImpo = " & lReglaPuntoImporte & "," & _
           "        nPuntCant = " & lReglaPuntoCantidad
    If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then GoTo Salir
               
  Else
    sSQL = "SELECT * FROM Regla_Punto"
    If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
    
    If ADORS.EOF Then
      MsgBox "Reglas en relación a los puntos no han sido establecidos", vbOKOnly + vbInformation
      GoTo Salir
    End If
    lReglaImporteMaximo = LeerCampo(ADORS!nImpoMaxi)
    lReglaPuntoImporte = CLng(LeerCampo(ADORS!nPuntImpo))
    lReglaPuntoCantidad = CLng(LeerCampo(ADORS!nPuntCant))
    
  End If
  
  Screen.MousePointer = vbDefault
  
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  Screen.MousePointer = vbDefault

Salir:
  Set ADORS = Nothing
End Sub

Public Sub cmdTecla_Click(Index As Integer)

  If VerificarFechaSistema = False Then
    MsgBox "La fecha del sistema no puede ser posterior a al ultima operacion realizada...Verifique!!" & vbCrLf & "El sistema se cerrara!!!", vbInformation + vbOKOnly, "Mensaje"
    End
  End If
  
  cmdTecla(Index).SetFocus
  Select Case Index
    Case 0
      MsgBox "Ingrese el código del producto"
    Case 1 To 24
      Teclasel = Teclasel + 1
      CapturaDatosProducto TeclaProducto(Index)
    Case 41 'Setea a cero todo
      Call CancelarACTC
    Case 42
      'sw Add 19/06/2009

       Load frmAutorizarOperacion
       Set frmAutorizarOperacion.frmPadre = Me
       frmAutorizarOperacion.Show vbModal
      If Not bAcceso Then Exit Sub
       frmReimpresion.idLocal = Trim(CStr(Me.txtLocal.Text))
       
       frmReimpresion.Show vbModal
    Case 43 'Graba Transaccion
      If bProducto Then
        If EsValido = True Then
            Call RegistraVenta
        End If
      End If
    Case 44
      If bProducto Then
        Call TipoVenta
      End If
    Case 45 'Anula Transaccion
      Call AnularTransaccion
    Case 46 'Pago
      Call Pago
  End Select
  
End Sub

Private Function EsValido() As Boolean
  EsValido = True
    
  If Not Trim(Me.txtRUC.Text) = "" Then
    If Len(Trim(Me.txtRUC.Text)) <> 11 Then
      EsValido = False
      MsgBox "El RUC debe poseer 11 dígitos"
      Exit Function
    End If
  End If
  
End Function

Sub CapturaDatosProducto(iProducto As Long)
  On Error GoTo LineaError
  
  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim nServicio As Double
  
  If iProducto = 0 Then
    MsgBox "Este botón no tiene un producto asignado"
    GoTo Salir
  End If
  
  sSQL = " SELECT sProdDescCrta, sProdDesc, nProdPrecUnit, cFlagCanje, nPuntos, cFlagServicio" & _
         " FROM Producto" & _
         " WHERE cProdCode =" & iProducto & _
         " AND cAlmaCode ='" & kPAR_ALMACEN & "'"

  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  If ADORS.RecordCount = 1 Then
    lblProducto.Caption = Left(LeerCampo(ADORS("sProdDescCrta")) + "          ", 11) + _
                          Right("           " + Format(CStr(LeerCampo(ADORS("nProdPrecUnit"))), "###,###,##0.00"), 11)
    txtCantidad.Enabled = True
    txtCantidad.SetFocus
    
    If bProducto = False Then
      bProducto = True
      cmdTecla(45).Enabled = False
      cmdTecla(46).Enabled = False
      nProducto = 0
      iTotalVenta = 0
      txtCantidad.Text = 1
      ReDim Producto(1)
'      iTipoVenta = 1
'      lblTipo.Caption = "CASH"
       iTipoVenta = 5
       lblTipo.Caption = "C/VUELTO"
    Else
      Producto(nProducto).Cant = txtCantidad.Text
      txtCantidad.Text = 1
    End If
    'Registra un producto
    nServicio = (Producto(nProducto).Cant * (Producto(nProducto).PUnit / (1 + kIGV))) * _
                                (val(kPAR_PORCSERV) * IIf(Producto(nProducto).Serv = "SI", 1, 0)) / 100
    
    iTotalVenta = iTotalVenta + (Producto(nProducto).Cant * Producto(nProducto).PUnit) ' + nServicio
                                
    nProducto = nProducto + 1
    
    ReDim Preserve Producto(nProducto)
    Producto(nProducto).Almacen = kPAR_ALMACEN
    Producto(nProducto).Codigo = iProducto
    Producto(nProducto).nombre = LeerCampo(ADORS("sProdDesc"))
    Producto(nProducto).PUnit = LeerCampo(ADORS("nProdPrecUnit"))
    Producto(nProducto).Cant = txtCantidad.Text
    Producto(nProducto).Canje = IIf(LeerCampo(ADORS("cFlagCanje")) = "0", "NO", IIf(LeerCampo(ADORS("cFlagCanje")) = "1", "VNTA", "PTOS"))
    Producto(nProducto).Ptos = LeerCampo(ADORS("nPuntos"))
    Producto(nProducto).Serv = IIf(LeerCampo(ADORS("cFlagServicio")) = "0", "NO", "SI")
            
    lblSubtotal.Caption = "Sub:" + Right("               " + Format(CStr((Producto(nProducto).PUnit * Producto(nProducto).Cant)), "###,###,###,##0.00"), 14)
     '+ (Producto(nProducto).PUnit / (1 + kIGV)) * Producto(nProducto).Cant * (Val(kPAR_PORCSERV) * IIf(Producto(nProducto).Serv = "SI", 1, 0)) / 100
    Call TotalVenta
    lblTotal.Caption = "TOT:" + Right("               " + Format(CStr(iTotalVenta), "###,###,###,##0.00"), 14)
  Else
    MsgBox "El producto asignado no existe. Actualice la configuración de este botón."
    GoTo Salir
  End If
  
  txtCantidad.SetFocus
  txtCantidad.SelStart = 0
  txtCantidad.SelLength = Len(txtCantidad.Text)
  
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  Screen.MousePointer = vbDefault

Salir:
  Set ADORS = Nothing
End Sub

Private Sub Form_Resize()
  Frame1.Left = (Me.Width - Frame1.Width) / 2
  Frame1.Top = ((Me.Height - Frame1.Height) / 2) - 50
End Sub

Private Sub txtCantidad_GotFocus()
  cmdCambio.Enabled = True
End Sub

Private Sub txtCantidad_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    txtCantidad_LostFocus
  End If
  
End Sub

Private Sub txtCantidad_LostFocus()
  On Error Resume Next
  Dim iCantidad As Double
  Dim iPUnitario As Double
  Dim nServicio As Double
  
  If Trim(txtCantidad.Text) = "" Then txtCantidad.Text = "0"
  
  iCantidad = val(txtCantidad.Text)
  iPUnitario = val(Trim(Right(lblProducto.Caption, 10)))
  
  nServicio = iCantidad * (iPUnitario / (1 + kIGV)) * (val(kPAR_PORCSERV) * IIf(Producto(nProducto).Serv = "SI", 1, 0)) / 100
  
  'lblSubtotal.Caption = "Sub:" + Right("               " + Format(CStr(iCantidad * iPUnitario * (100 + Val(kPAR_PORCSERV) * IIf(Producto(nProducto).Serv = "SI", 1, 0)) / 100), "###,###,###,##0.00"), 14)
  lblSubtotal.Caption = "Sub:" + Right("               " + Format(CStr((iCantidad * iPUnitario)), "###,###,###,##0.00"), 14) '+ nServicio
  
  Producto(Teclasel).Cant = iCantidad
  Call TotalVenta_actual
  'lblTotal.Caption = "TOT:" + Right("               " + Format(CStr(iTotalVenta + (iCantidad * iPUnitario)), "###,###,###,##0.00"), 14)
  lblTotal.Caption = "TOT:" + Right("               " + Format(CStr(iTotalVenta), "###,###,###,##0.00"), 14)
  
End Sub

Private Sub txtCantidad_KeyPress(KeyAscii As Integer)
  On Error GoTo LineaError
  Call ValidKeyPress(KeyAscii, kVKP_NUMERIC_INTEGER_ONLY)
  Exit Sub

LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
End Sub

Private Sub txtCliente_GotFocus()
  cmdCambio.Enabled = False
End Sub
Private Sub txtCliente_LostFocus()
  cmdCambio.Enabled = True
End Sub

Private Sub txtLocal_KeyDown(KeyCode As Integer, Shift As Integer)
 Select Case KeyCode
   Case 13
     If IsNumeric(txtLocal.Text) And (val(txtLocal.Text) = 1 Or val(txtLocal.Text) = 2) Then
       'Call txtTarjeta_LostFocus
       Call LlamarCliente
     End If
 End Select
 
End Sub

Private Sub txtLocal_KeyPress(KeyAscii As Integer)
  KeyAscii = IIf( _
          (KeyAscii = 49 Or KeyAscii = 50) Or _
          (KeyAscii = 8 Or KeyAscii = 32), _
          KeyAscii, 0)
End Sub

Private Sub txtTarjeta_GotFocus()
  txtTarjeta.SelStart = 0
  txtTarjeta.SelLength = Len(txtTarjeta.Text)
End Sub

Private Sub txtTarjeta_KeyPress(KeyAscii As Integer)
  
  'Valida q solo se ingresen números (valores enteros)
  
  On Error GoTo LineaError
  
  Call ValidKeyPress(KeyAscii, kVKP_NUMERIC_INTEGER_ONLY)
  
  Exit Sub
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  
End Sub

Private Sub txtTarjeta_KeyDown(KeyCode As Integer, Shift As Integer)
  Select Case KeyCode
    Case 13
      'Call txtTarjeta_LostFocus
      Call LlamarCliente
 End Select
 
End Sub

Private Sub LlamarCliente()
  On Error GoTo LineaError
  
  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim i As Long, j As Long
  Dim sTarjeta As String
  'sw To SQL Server era >>> nLocal
  Dim idLocal As Integer
  
  If frmBusquedaArticulos.Visible Then Exit Sub
 
  If Trim(txtTarjeta.Text) = "" Then
    txtCliente = ""
    dcbLocal.BoundText = -1
    GoTo Salir
  End If
 
  sTarjeta = Right("00000000" + Trim(txtTarjeta.Text), 8)
  'sw To SQL Server era >>> nLocal
  idLocal = val(txtLocal.Text)
  
  If sTarjeta <> "00000000" Then
    txtTarjeta.Text = sTarjeta
    
    'sw To SQL Server era >>> nIdLocal >>> Now()
    sSQL = "SELECT a.cClieCode, sClieApel,sClieName, dNacmDate,c.IdLocal, " + _
           "nPuntCant, nTickCant, dUltTDate, sTranDesc " + _
           "FROM Cliente a, Transaccion b, Tarjeta c " + _
           "WHERE a.cTranCode = b.cTranCode AND " + _
           " (c.cTarjActi=1 and Convert(Char(10), dcadudate,112)>=Convert(Char(10), getdate(),112)) and " + _
           "a.cClieCode = c.cClieCode AND a.IdLocal=c.IdLocal AND " + _
           "nTarjNumb = '$'"
    
    'sw To SQL Server era >>> nLocal
    If idLocal = 1 Or idLocal = 2 Then
      sSQL = sSQL + "    AND a.IdLocal = $ "
    End If
         
    'sw To SQL Server era >>> nLocal
    sSQL = VBsprintf(sSQL, sTarjeta, idLocal)

    If bolExistenProblemasConexionBDCliente = False Then
      ConectarBDCliente     'Abrimos conexion
    End If
 
    If Not oDBAdmin.EjecutarConsulta(ADOCnn2, sSQL, ADORS) Then GoTo Salir
    
    If ADORS.RecordCount = 0 Then
      txtTarjeta.Text = ""
      txtCliente.Text = ""
      'lblCliente.Caption = ""
      sNombreCliente = ""
      dcbLocal.BoundText = -1
      txtLocal.Text = ""
      MsgBox "El Código de cliente no existe o la Tarjeta se encuentra Inactiva "
      txtCliente.Enabled = True
      txtTarjeta.SetFocus
    ElseIf ADORS.RecordCount = 1 Then
      txtCliente.Text = sTarjeta + " - " + LeerCampo(ADORS("sClieApel")) + " " + LeerCampo(ADORS("sClieName"))
      'lblCliente.Caption = sTarjeta + " - " + LeerCampo(ADORS("sClieApel")) + " " + LeerCampo(ADORS("sClieName"))
      sNombreCliente = LeerCampo(ADORS("sClieApel")) + " " + LeerCampo(ADORS("sClieName"))
      txtCliente.Enabled = False
      'lblLocal.Visible = True: dcbLocal.Visible = True
      'sw To SQL Server eran >>> nIdLocal
      txtLocal.Text = ADORS("IdLocal")
      dcbLocal.BoundText = ADORS("IdLocal")
  
    ElseIf ADORS.RecordCount = 2 Then
      txtCliente.Text = ""
      lblLocal.Visible = True: dcbLocal.Visible = True
      'MsgBox "Seleccione local al cual pertenece!!", vbInformation + vbOKOnly, "Mensaje"
      dcbLocal.BoundText = -1
      
      'dcbLocal.SetFocus
      
      'sw SE DEBE MANDAR IdLocal a frmBusquedaArticulos
      frmBusquedaArticulos.frmPadre = "frmCajaRegistradora"
      frmBusquedaArticulos.pOpcion = "Cliente"
      frmBusquedaArticulos.Inicio
      frmBusquedaArticulos.txtBuscar.Text = txtTarjeta.Text
      frmBusquedaArticulos.cmdBuscar_Click
      frmBusquedaArticulos.Show vbModal
      'txtNombres.Enabled = (Trim(txtTarjeta.Text) = "")
      'txtNombres.Locked = Not (Trim(txtTarjeta.Text) = "")
      
      txtCliente.Enabled = False
      
    End If
    
    GoTo Salir
    
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  Screen.MousePointer = vbDefault
  Else
    txtCliente.Enabled = True
    txtCliente.Text = ""
    txtTarjeta.Text = ""
  End If
  
Salir:
  Set ADORS = Nothing
End Sub

Private Sub txtRuc_KeyPress(KeyAscii As Integer)
  'Valida q solo se ingresen números (valores enteros)
  On Error GoTo LineaError
  
  Call ValidKeyPress(KeyAscii, kVKP_NUMERIC_INTEGER_ONLY)
  
  Exit Sub
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
End Sub

Private Sub RegistraVenta()
  'On Error GoTo LineaError
  
  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim i As Long, j As Long, iCodOper As Long
  Dim iTotal As Double, iSubTotal As Double, iTotItems As Double, iServicio As Double
  Dim sFecha As String
  Dim sTexto As String
  Dim iSigno As Integer
  Dim iFlagTipo As Integer
  Dim sTarjeta As String
  Dim iMontoDolares  As Double
  Dim nImporte As Double, nPuntos As Double, nPtosImp As Double
  Dim iTipoVentaMod As Integer
  Dim Texto_imprimir As String
  
  Dim blnfactura As Boolean
  Dim intPuntosAcumulados As Long
  Dim iPuntos As Long
  Dim IGV_1 As Double
  Dim cDocCodigo As Long
  Dim cDocSerie As String
  Dim cdocTipo As String
  Dim cRuc As String
  Dim isubtotal_1 As Double
  Dim toti As Double
  
  'sw To SQL Server add
  Dim idLocal As String
  
  blnfactura = False
  cDocCodigo = 0
  'Verifica si es Factura
  If Not Trim(Me.txtRUC.Text) = "" Then
    blnfactura = True
    cRuc = Trim(Me.txtRUC.Text)
    cdocTipo = "01"
    'cDocSerie = kSERIE_FACTURA
  Else
    cRuc = ""
    cdocTipo = "02"
    'cDocSerie = kSERIE
  End If
  
  sSQL = "SELECT  * FROM Config_Documento WHERE cTipoDoc='" & IIf(cdocTipo = "01", "02", cdocTipo) & "'"
  
  If oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then
     
        If blnfactura = True Then
            If ADORS.EOF Then
              'kSERIE_FACTURA = "F01"
              kSERIE_FACTURA = Right("000" & Right(kPAR_CAJA, 2), 3)
              sSQL = "INSERT INTO Config_Documento (cTipoDoc,cOperCode,nDocCodigo,cSerieDoc,cUserDesc,dUltAct,observacion) " & _
                     " VALUES ('01',0, 0, 'F01','',#" & Date & "#,'Primer Registro') "
              If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then GoTo Salir
              cDocCodigo = 1
            Else
              kSERIE_FACTURA = LeerCampo(ADORS!cSerieDoc)
              cDocCodigo = LeerCampo(ADORS!nDocCodigo) + 1
            End If
            cDocSerie = kSERIE_FACTURA
        Else
            If ADORS.EOF Then
              'kSERIE = "B01"
              kSERIE = Right("00" & Right(kPAR_CAJA, 2), 3)
              sSQL = "INSERT INTO Config_Documento (cTipoDoc,cOperCode,nDocCodigo,cSerieDoc,cUserDesc,dUltAct,observacion)" & _
              " VALUES ('02',0, 0, 'B01', '', #" & Date & "#,'Primer Registro') "
              If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then GoTo Salir
              cDocCodigo = 1
            Else
              kSERIE = LeerCampo(ADORS!cSerieDoc)
              cDocCodigo = LeerCampo(ADORS!nDocCodigo) + 1
            End If
            cDocSerie = kSERIE
        End If
  Else
       
    If blnfactura = False Then
      kSERIE = LeerCfg("PARAMETROS", "SerieBOL", psArchivoCfg)
      cDocCodigo = LeerCfg("PARAMETROS", "cOpeB", psArchivoCfg) + 1
    Else
      kSERIE_FACTURA = LeerCfg("PARAMETROS", "SerieFAC", psArchivoCfg)
      cDocCodigo = LeerCfg("PARAMETROS", "cOpeF", psArchivoCfg) + 1
    End If
  End If
  
  'Registra la cantidad del ultimo producto
  Producto(nProducto).Cant = txtCantidad.Text
  
  If Trim(txtTarjeta.Text) <> "" Then
    sTarjeta = Right("00000000" + Trim(txtTarjeta.Text), 8)
  Else
    sTarjeta = ""
  End If
  
  'sw To SQL Server add
  idLocal = IIf(Trim(Me.txtLocal.Text) = "", "NULL", Trim(Me.txtLocal.Text))
  
  'Calcula el total de las ventas
  Call TotalVenta
  lblTotal.Caption = "TOT:" + Right("               " + Format(CStr(iTotalVenta), "###,###,###,##0.00"), 14)
  If iTipoVenta = 5 Or iTipoVenta = 3 Then
    bVuelto = False
    frmVuelto.iTipoVenta = iTipoVenta
    frmVuelto.Show vbModal
    If Not bVuelto Then GoTo Salir
  End If
  
  'If iTipoVenta=5 Then
  'End If
  '--------------------
  '-- Registra Venta --
  '--------------------
  'sSQL = "SELECT MAX(cOperCode) AS maximo FROM Operacion WHERE cOperFlagAbierto=1"
  sSQL = "SELECT MAX(cOperCode) AS maximo FROM Operacion"
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  If ADORS.RecordCount = 1 Then
    If IsNull(ADORS("maximo")) Then
      iCodOper = 1
    Else
      iCodOper = LeerCampo(ADORS("maximo")) + 1
'      EscribirCfg "PARAMETROS", "cOpeB", psArchivoCfg, Str(iCodOper + 1)
    End If
  End If
  
  If iCodOper = 1 Then
'    kOPERACION = LeerCfg("PARAMETROS", "cOpeB", psArchivoCfg)
'    iCodOper = Val(kOPERACION)
  End If
  
    'SE OBTIENE FECHA DEL SISTEMA DE LA BASE DE DATOS DE SQL - version 2.0.5
   
   Dim cnFECHASQL As ADODB.Connection
   Dim sqlFECHASIS As String
   Dim rsFEchaSis As ADODB.Recordset
      
   If oDBAdmin.AbrirBD(cnFECHASQL, psConnectString, False) = True Then
     
     sqlFECHASIS = "select convert(varchar,getdate(),120) as fechasis"
     If oDBAdmin.EjecutarConsulta(cnFECHASQL, sqlFECHASIS, rsFEchaSis) = True Then
         
         If rsFEchaSis!fechasis <> "" Then
             sFecha = rsFEchaSis!fechasis
         End If

     Else
         'no pudo abrir el rs: que consulte al access
         'MsgBox "No se pudo obtener la fecha, hay problemas de conexión de la red con la Base de Datos Principal", vbOKOnly + vbExclamation, "Aviso"
         sFecha = Format(Now(), "DD/MM/YYYY hh:mm")
         'Unload Me
     End If

     Set cnFECHASQL = Nothing

   Else
     'no pudo conectarse al sql: que consulte al access
      'MsgBox "No se pudo obtener la fecha, hay problemas de conexión de la red con la Base de Datos Principal", vbOKOnly + vbExclamation, "Aviso"
      sFecha = Format(Now(), "DD/MM/YYYY hh:mm")
      'Unload Me
   End If
   
   'FIN FECHA DEL SISTEMA DE LA BASE DE DATOS DE SQL


  'sFecha = Format(Now(), "DD/MM/YYYY hh:mm")
  
   Set ADORS = Nothing
  
  iFlagTipo = iTipoVenta
  If iTipoVenta = 4 Then
    iSigno = -1
    iFlagTipo = 1
  Else
    iSigno = 1
    iFlagTipo = iTipoVenta
  End If
  If iTipoVenta = 5 Then
    iFlagTipo = 1
  End If
  
  If iTipoVenta = 3 Then
    iFlagTipo = 1
  End If
  '--------Abre la gaveta de dinero automaticamente al aceptar la venta ----
  Dim opc_gaveta As String
  opc_gaveta = LeerCfg("PARAMETROS", "GAVETA", psArchivoCfg)
  If Trim(UCase(opc_gaveta)) = "S" Then
    Abre_Gaveta_Dinero (LeerCfg("PARAMETROS", "PRINTER", psArchivoCfg))
  End If
  '-------------------------------------------------------------------------
  
  '------------------------
  '-- Captura Parámetros --
  '------------------------
  Call CabeceraImpresion
  
  sTexto = ""
  printer.FontSize = 8 '11
  printer.FontName = "Courier New"
  '------------------------------------------------------------------
  
  For i = 0 To UBound(sCabecera) - 1
    If Not Trim(sCabecera(i)) = "" Then
      sTexto = sTexto + Right(Space(60) + sCabecera(i), Int(Len(Space(40) + sCabecera(i)) / 2)) + vbCrLf
    End If
  Next
  'sTexto = sTexto + vbCrLf
  
  'Linea de Datos del Socio
  If Not sTarjeta = "" Then
    sTexto = sTexto + vbCrLf + " COD.TARJ.: " + sTarjeta + " "
    If Not blnfactura = True Then
      sTexto = sTexto + vbCrLf + " NOMBRE: " + sNombreCliente + vbCrLf
    End If
  Else
    If Not blnfactura = True And Trim(txtCliente.Text) <> "" Then
      sTexto = sTexto + vbCrLf + " NOMBRE: " + UCase(Trim(txtCliente.Text)) + vbCrLf
    End If
  End If
     
  If blnfactura = True Then
    sTexto = sTexto + vbCrLf + " NOMBRE: " & "____________________________" + vbCrLf
    sTexto = sTexto + vbCrLf + "         " & "____________________________" + vbCrLf
    sTexto = sTexto + vbCrLf + " RUC Cliente: " & Trim(Me.txtRUC.Text) + vbCrLf
  End If
  
  'Serie, Nro de ticket y Serie Disco Duro
  '------------------Validacion de Numeración Correlativa ----------------------------
          Dim NameArchivo As String
          Dim archivo
          Dim Texto As String
          Dim fso, MyFile
    
  'tendria que preguntar primero si hay valor en venta01 del sql para la caja
      Dim cnSQL As ADODB.Connection
      Dim rsVenta01 As ADODB.Recordset
      Dim bValorSQL As Boolean
      Dim nValorSQL As Long
      bValorSQL = False
      
      If oDBAdmin.AbrirBD(cnSQL, psConnectString) = True Then
        'sSQL = "select isnull(max(cast(NroDoc as int)),0) as maximo from venta01  WHERE cCodCaja='" & kPAR_CAJA & "' AND TipoDoc = '" & cdocTipo & "'"
        sSQL = "select isnull(max(cast(NroDoc as int)),0) as maximo from venta01  WHERE cCodCaja='" & kPAR_CAJA & "' AND TipoDoc in('01','02')"
        If oDBAdmin.EjecutarConsulta(cnSQL, sSQL, rsVenta01) = True Then
            If rsVenta01!Maximo = 0 Then
                'no hay nada para la caja y el tipo de documento en sql
            Else
                'si hay, y el valor a actualizar en ndoccodigo de configdocumento deberia ser el valor retornado
                bValorSQL = True
                nValorSQL = rsVenta01!Maximo
            End If
        Else
            'no pudo abrir el rs: que consulte al access nomas
            
        End If

        Set cnSQL = Nothing
      Else
        'no pudo conectarse al sql: que consulte al access nomas
        
      End If
      
    
    If bValorSQL = True Then
    
         'aca tendria que preguntar si el codigo del access es mayor, si es asi manda el del access
        'sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo = '" & cdocTipo & "'"
        sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo in ('01','02')"
        If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
        Dim nValorAccess As Long
        nValorAccess = ADORS!Maximo
        If nValorAccess > nValorSQL Then
            nValorSQL = nValorAccess
        End If
        
        If val(cDocCodigo) <> val("0" & (nValorSQL) + 1) And val("0" & nValorSQL) > 0 Then
'          Dim NameArchivo As String
'          Dim archivo
'          Dim Texto As String
'          Dim fso, MyFile
          
          cDocCodigo = nValorSQL + 1
          
          Set fso = CreateObject("Scripting.FileSystemObject")
          archivo = "Error_Full_1" & cdocTipo & cDocCodigo
          If Trim(archivo) = "" Then
              archivo = "textfile"
          End If
          Texto = Texto + "Codigo generado " & cDocCodigo & Chr(13)
          
          NameArchivo = "C:\Temp\" + Trim(archivo) + ".log"
          Set MyFile = fso.CreateTextFile(NameArchivo, True)
          cDocCodigo = ("0" & (rsVenta01!Maximo)) + 1
          Texto = Texto + "Nuevo Codigo " & cDocCodigo & Chr(13)
          Texto = Texto + CStr(Now)
          MyFile.WriteLine (Texto)
          MsgBox "Ocurrio un error en la numeración, se asignará el " & cDocCodigo & " al documento "
          MyFile.Close
        End If
        
    
    
    Else
        'sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo = '" & cdocTipo & "'"
        sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo IN ('01','02')"
        
               If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
        If cDocCodigo <> ((ADORS!Maximo) + 1) And val("0" & ADORS!Maximo) > 0 Then

          Set fso = CreateObject("Scripting.FileSystemObject")
          archivo = "Error_Rapida_1" & cdocTipo & cDocCodigo
          If Trim(archivo) = "" Then
            archivo = "textfile"
          End If
          Texto = Texto + "Codigo generado " & cDocCodigo & Chr(13)
          
          NameArchivo = "C:\Temp\" + Trim(archivo) + ".log"
          Set MyFile = fso.CreateTextFile(NameArchivo, True)
          cDocCodigo = ("0" & (ADORS!Maximo)) + 1
          Texto = Texto + "Nuevo Codigo " & cDocCodigo & Chr(13)
          Texto = Texto + CStr(Now)
          MyFile.WriteLine (Texto)
          MsgBox "Ocurrio un error en la numeración, se asignará el " & cDocCodigo & " al documento "
        End If
    End If
  
  
  '---------------Actualizando el valor de la numeración ----------------
  sSQL = "UPDATE Config_Documento " & _
        " SET cSerieDoc='" & cDocSerie & "'," & _
        " nDocCodigo=" & cDocCodigo & " " & _
        " WHERE cTipodoc='" & IIf(cdocTipo = "01", "02", cdocTipo) & "'"
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then GoTo Salir
  
  '------------------Fin de Validacion de Numeración Correlativa ----------------------------
  
  If Not blnfactura = True Then
    sTexto = sTexto + vbCrLf + " TK NRO: " & kSERIE & "-" & Right("000000" & CStr(cDocCodigo), 6) & " NS:" & kSERIE_DISCO_DURO
  Else
       
    sTexto = sTexto + vbCrLf + " TK NRO: " & kSERIE_FACTURA & "-" & Right("000000" & CStr(cDocCodigo), 6) & " NS:" & kSERIE_DISCO_DURO
  End If
  
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  sTexto = ""
  
  'Cabecera segun tipo de venta
  Select Case iTipoVenta
    Case 2 'Voucher
      sTexto = "VOUCHER"
      sTexto = Right(Space(60) + sTexto, Int(Len(Space(40) + sTexto) / 2)) + vbCrLf
    Case 3 'Dolares
      sTexto = "U$(TC: " + Format(CStr(nTipoCambio), "###,##0.00") + ")"
      sTexto = Right(Space(60) + sTexto, Int(Len(Space(40) + sTexto) / 2)) + vbCrLf
    Case 4 'Anula Productos
      sTexto = "ANULA PROD"
      sTexto = Right(Space(60) + sTexto, Int(Len(Space(40) + sTexto) / 2)) + vbCrLf
  End Select
  'Printer.Print sTexto
  If iEfectivoDolares > 0 Then
        sTexto = "U$(TC: " + Format(CStr(nTipoCambio), "###,##0.00") + ")"
        sTexto = Right(Space(60) + sTexto, Int(Len(Space(40) + sTexto) / 2)) + vbCrLf
  End If
  
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  sTexto = ""
  
  'Ancho de linea = 27
  Dim PUnit As Double
  iSubTotal = 0
  iTotal = 0
  iTotItems = 0
  iServicio = 0
  
  sTexto = sTexto + "Producto           Cant. Precio SubTot." + vbCrLf
  sTexto = sTexto + "---------------------------------------" + vbCrLf
  For i = 1 To nProducto
  
    If blnfactura = True Then
      'iSubTotal = Producto(i).Cant * Producto(i).PUnit / (1 + kIGV + kPAR_PORCSERV * (IIf(Producto(i).Serv = "SI", 1, 0)) / 100)
      
      sTexto = sTexto + Left(Producto(i).nombre + Space(18), 18) & _
               " " + Right(Space(7) & CStr(Producto(i).Cant), 4) & _
               " " + Right(Space(6) & Format(CStr(Producto(i).PUnit), "###,###,##0.00"), 6) & _
               " " + Right(Space(7) & Format(CStr(Producto(i).PUnit * Producto(i).Cant), "###,###,##0.00"), 7) + vbCrLf
      
      
      If (Producto(i).Serv = "SI") Then
        PUnit = Producto(i).PUnit / (1 + kIGV + (kPAR_PORCSERV / 100))
        iServicio = iServicio + (Producto(i).Cant * (PUnit * (kPAR_PORCSERV / 100)))
      Else
        PUnit = Producto(i).PUnit / (1 + kIGV)
      End If
      IGV_1 = IGV_1 + (Producto(i).Cant * (kIGV * PUnit))
      isubtotal_1 = isubtotal_1 + (PUnit * Producto(i).Cant)
                       
    Else
      
      'PUnit = (iSubTotal + IGV_1) / Producto(i).Cant
      IGV_1 = 0
      If (Producto(i).Serv = "SI") Then
        PUnit = Producto(i).PUnit / (1 + kIGV + (kPAR_PORCSERV / 100))
        iServicio = iServicio + (PUnit * (kPAR_PORCSERV / 100))
      End If
      
      sTexto = sTexto + Left(Producto(i).nombre + Space(18), 18) & _
               " " + Right(Space(7) & CStr(Producto(i).Cant), 4) & _
               " " + Right(Space(6) & Format(CStr(Producto(i).PUnit), "###,###,##0.00"), 6) & _
               " " + Right(Space(7) & Format(CStr(Producto(i).PUnit * Producto(i).Cant), "###,###,##0.00"), 7) + vbCrLf
               
    End If
    
    iSubTotal = (Producto(i).Cant * Producto(i).PUnit)
    iTotItems = iTotItems + Producto(i).Cant
    iTotal = iTotal + iSubTotal
    
  Next
  
  'Ańade el % de servicio al total
  'iTotal = iTotal + iServicio
  
  sTexto = sTexto + "---------------------------------------"
    
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  sTexto = ""
  
  'Total segun tipo de venta
  Select Case iTipoVenta
    Case 1, 2 'Normal, Voucher
    
      If blnfactura = True Then
        sTexto = Left(" VALOR VTA" + Space(23), 23) + Right(Space(15) + Format(CStr(iTotal - IGV_1 - iServicio), "###,###,##0.00"), 15) + vbCrLf
        'IGV_1 = (iTotalVenta - Val(Format(CStr(iTotal), "###,###,##0.00")))
        sTexto = sTexto + Left(" IGV" + Space(23), 23) + Right(Space(15) + Format(CStr(IGV_1), "###,###,##0.00"), 15) + vbCrLf
        If iServicio > 0 Then
          sTexto = sTexto + Left(" SERVICIO" + Trim(CStr(kPAR_PORCSERV)) + " %" + Space(23), 23) + Right(Space(15) + Format(CStr(iServicio), "###,###,##0.00"), 15) + vbCrLf
        End If
        sTexto = sTexto + Left(" TOTAL" + Space(23), 23) + Right(Space(15) + Format(CStr(val(Format(CStr(iTotal), "###,###,##0.00"))), "###,###,##0.00"), 15) + vbCrLf + vbCrLf
        
      Else
        If iTipoVenta = 1 Then
          sTexto = vbCrLf + Left(" EFECTIVO" + Space(23), 23) + Right(Space(15) + Format(CStr(iTotal), "###,###,##0.00"), 15)
        Else
          sTexto = vbCrLf + Left(" VOUCHER" + Space(23), 23) + Right(Space(15) + Format(CStr(iTotal), "###,###,##0.00"), 15)
        End If
        If iServicio > 0 Then
          sTexto = sTexto + Left(" SERVICIO" + Trim(CStr(kPAR_PORCSERV)) + " %" + Space(23), 23) + Right(Space(15) + Format(CStr(iServicio), "###,###,##0.00"), 15) + vbCrLf
        End If
      End If
    
    Case 4 'Anula Productos
      sTexto = " CASH/TL  " + Right("                    " + Format(CStr(iTotal), "###,###,##0.00"), 20)
    Case 5 'Efectivo
    
      If blnfactura = True Then
        sTexto = Left(" VALOR VTA" + Space(23), 23) + Right(Space(15) + Format(CStr(iTotal - IGV_1 - iServicio), "###,###,##0.00"), 15) + vbCrLf
        sTexto = sTexto + Left(" IGV" + Space(23), 23) + Right(Space(15) + Format(CStr(IGV_1), "###,###,##0.00"), 15) + vbCrLf
        If iServicio > 0 Then
          sTexto = sTexto + Left(" SERVICIO" + Trim(CStr(kPAR_PORCSERV)) + " %" + Space(23), 23) + Right(Space(15) + Format(CStr(iServicio), "###,###,##0.00"), 15) + vbCrLf
        End If
        sTexto = sTexto + Left(" TOTAL" + Space(23), 23) + Right(Space(15) + Format(CStr(val(Format(CStr(iTotal), "###,###,##0.00"))), "###,###,##0.00"), 15) + vbCrLf + vbCrLf
      
      Else
        'sTexto = sTexto + Left(" VALOR VTA" + Space(23), 23) + Right(Space(15) + Format(CStr(iTotal), "###,###,##0.00"), 15) + vbCrLf
        sTexto = sTexto + Left(" TOTAL VTA" + Space(23), 23) + Right(Space(15) + Format(CStr(iTotal), "###,###,##0.00"), 15) + vbCrLf
        If iServicio > 0 Then
          sTexto = sTexto + Left(" SERVICIO" + Trim(CStr(kPAR_PORCSERV)) + " %" + Space(23), 23) + Right(Space(15) + Format(CStr(iServicio), "###,###,##0.00"), 15) + vbCrLf
        End If
          
      End If
      
      If iEfectivo <> 0 Then
        sTexto = sTexto + Left(" EFECTIVO(S/)" + Space(23), 23) + Right(Space(15) + Format(CStr(iEfectivo), "###,###,##0.00"), 15) + vbCrLf
      End If
      If iEfectivoDolares <> 0 Then
        sTexto = sTexto + Left(" EFECTIVO(U$)" + Space(23), 23) + Right(Space(15) + Format(CStr(iEfectivoDolares), "###,###,##0.00"), 15) + vbCrLf
      End If
      If iVuelto <> 0 Then
        sTexto = sTexto + Left(" VUELTO(S/)" + Space(23), 23) + Right(Space(15) + Format(CStr(iVuelto), "###,###,##0.00"), 15) + vbCrLf
      End If
      If iVueltoDolares <> 0 Then
        sTexto = sTexto + Left(" VUELTO(U$)" + Space(23), 23) + Right(Space(15) + Format(CStr(iVueltoDolares), "###,###,##0.00"), 15)
      End If
  End Select
  
  printer.FontSize = 9 '12
  printer.FontBold = True
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  sTexto = ""
  
  sTexto = Left(" ITEM" + Space(23), 23) + Right(Space(15) + Format(CStr(iTotItems), "###,##0.00"), 15)
  Select Case iTipoVenta
    Case 4 'Anula Productos
      sTexto = sTexto + vbCrLf + "VO-POSTN"
  End Select
  
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto + vbCrLf
  
  sTexto = ""
  
  nImporte = iTotalVenta
  iPuntos = Int(nImporte / lReglaPuntoImporte) * lReglaPuntoCantidad

  If sTarjeta <> "" Then
    'sw Add 19/06/2009, era solo >>> intPuntosAcumulados = ObtenerPuntosAcumulados(sTarjeta)
    intPuntosAcumulados = ObtenerPuntosAcumulados(sTarjeta, Trim(Me.txtLocal.Text))
    If (intPuntosAcumulados + iPuntos) >= 0 And iPuntos > 0 And intPuntosAcumulados <> -1 Then
      sTexto = sTexto & " UD. ACUMULO: " & iPuntos & " PUNTOS" & vbCrLf
      sTexto = sTexto & " TIENE ACUMULADO: " & IIf(intPuntosAcumulados + iPuntos < 0, "**", intPuntosAcumulados + iPuntos) & " PUNTOS" & vbCrLf & vbCrLf
    End If
  End If
  
  'sTexto = ""
  sTexto = sTexto + Space(9) + Format(CStr(Now()), "(DDD) DD/MM/YYYY ") + Format(CStr(Now()), "hh:mm") + vbCrLf 'Hora: 6 + 1
  sTexto = sTexto + Space(3) + Left(psUsuario_Descripcion, 10) + " " 'Usuario: 10 + 1
  sTexto = sTexto + Space(1) + "Cj:" + kPAR_CAJA + "T:" + kPAR_TURNO
  sTexto = sTexto + Space(1) + "v" & App.Major & "." & App.Minor & "." & App.Revision
  sTexto = sTexto + vbCrLf & "         Correlativo: " & ObtenerCorrelativo(1)
  sTexto = sTexto + vbCrLf + vbCrLf + "   " + kPIE_TICKET
  
  printer.FontSize = 8 '11
  printer.FontBold = False
  '-----------Para corte de papel--------
 
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  Select Case KImpresora
    Case 1
      Call CortePapel(Texto_imprimir, 1, CStr(iCodOper))
    Case 0
      printer.Print Texto_imprimir
      printer.Print " "
      printer.Print " "
      printer.EndDoc
  End Select
  
  '------------Graba Venta ------------------------------------------
  
  nImporte = 0
  nPtosImp = 0
  nPuntos = 0
  
  
  
  '------------------Validacion de Numeración Correlativa ----------------------------
  
  
  
  
  'tendria que preguntar primero si hay valor en venta01 del sql para la caja
      Dim cnSQL_ As ADODB.Connection
      Dim rsVenta01_ As ADODB.Recordset
      Dim bValorSQL_ As Boolean
      Dim nValorSQL_ As Long
      bValorSQL_ = False
      
      If oDBAdmin.AbrirBD(cnSQL_, psConnectString) = True Then
        'sSQL = "select isnull(max(cast(NroDoc as int)),0) as maximo from venta01  WHERE cCodCaja='" & kPAR_CAJA & "' AND TipoDoc = '" & cdocTipo & "'"
        sSQL = "select isnull(max(cast(NroDoc as int)),0) as maximo from venta01  WHERE cCodCaja='" & kPAR_CAJA & "' AND TipoDoc in ('01','02')"
        If oDBAdmin.EjecutarConsulta(cnSQL_, sSQL, rsVenta01_) = True Then
            If rsVenta01_!Maximo = 0 Then
                'no hay nada para la caja y el tipo de documento en sql
            Else
                'si hay, y el valor a actualizar en ndoccodigo de configdocumento deberia ser el valor retornado
                bValorSQL_ = True
                nValorSQL_ = rsVenta01_!Maximo
            End If
        Else
            'no pudo abrir el rs: que consulte al access nomas
            
        End If

        Set cnSQL_ = Nothing
      Else
        'no pudo conectarse al sql: que consulte al access nomas
        
      End If
    
    If bValorSQL_ = True Then
         'aca tendria que preguntar si el codigo del access es mayor, si es asi manda el del access
        'sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo = '" & cdocTipo & "'"
        sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo in ('01','02')"
        If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
        Dim nValorAccess_ As Long
        nValorAccess_ = ADORS!Maximo
        If nValorAccess_ > nValorSQL_ Then
            nValorSQL_ = nValorAccess_
        End If
        
        If val(cDocCodigo) <> val("0" & (nValorSQL_) + 1) And val("0" & nValorSQL_) > 0 Then
'          Dim NameArchivo As String
'          Dim archivo
'          Dim Texto As String
'          Dim fso, MyFile
          
          cDocCodigo = nValorSQL_ + 1
          
          Set fso = CreateObject("Scripting.FileSystemObject")
          archivo = "Error_Full_1" & cdocTipo & cDocCodigo
          If Trim(archivo) = "" Then
              archivo = "textfile"
          End If
          Texto = Texto + "Codigo generado " & cDocCodigo & Chr(13)
          
          NameArchivo = "C:\Temp\" + Trim(archivo) + ".log"
          Set MyFile = fso.CreateTextFile(NameArchivo, True)
          cDocCodigo = ("0" & (rsVenta01_!Maximo)) + 1
          Texto = Texto + "Nuevo Codigo " & cDocCodigo & Chr(13)
          Texto = Texto + CStr(Now)
          MyFile.WriteLine (Texto)
          MsgBox "Ocurrio un error en la numeración, se asignará el " & cDocCodigo & " al documento "
          MyFile.Close
        End If
    
    
    Else
  
  
  
        'sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo = '" & cdocTipo & "'"
        
        sSQL = "SELECT MAX(cDocCodigo) AS maximo FROM Operacion WHERE cDocTipo in ('01','02')"
               If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
        If cDocCodigo <> ((ADORS!Maximo) + 1) And val("0" & ADORS!Maximo) > 0 Then
          Set fso = CreateObject("Scripting.FileSystemObject")
          archivo = "Error_Rapida2" & cdocTipo & cDocCodigo
          If Trim(archivo) = "" Then
              archivo = "textfile"
          End If
          Texto = Texto + "Codigo generado " & cDocCodigo & Chr(13)
          
          NameArchivo = "C:\Temp\" + Trim(archivo) + ".log"
          Set MyFile = fso.CreateTextFile(NameArchivo, True)
          cDocCodigo = ("0" & (ADORS!Maximo)) + 1
          Texto = Texto + "Nuevo Codigo " & cDocCodigo & Chr(13)
          Texto = Texto + CStr(Now)
          MyFile.WriteLine (Texto)
          MsgBox "Ocurrio un error en la numeración, se asignará el " & cDocCodigo & " al documento "
        End If
    End If
  
  
  
  
  '---------------Actualizando el valor de la numeración ----------------
  'sSQL = "UPDATE Config_Documento " & _
         " SET cOperCode=" & CStr(iCodOper) & "," & _
         " cUserDesc='" & psUsuario_Descripcion & "', " & _
         " nDocCodigo=" & cDocCodigo & " " & _
         " WHERE cTipodoc='" & cdocTipo & "'"
  
  'jpcb171011
  sSQL = "UPDATE Config_Documento " & _
         " SET cOperCode=" & CStr(iCodOper) & "," & _
         " cUserDesc='" & psUsuario_Descripcion & "' " & _
         " WHERE cTipodoc='" & cdocTipo & "'"
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then GoTo Salir
  
  '------------------fin Validacion de Numeración Correlativa ----------------------------
  For i = 1 To nProducto
    'sw To SQL Server add >>> IdLocal
    sSQL = "INSERT INTO OPERACION (cOperCode, cUserDesc, nTarjNumb, cAlmaCode, cProdCode, nProdCant, nProdPrecUnit," & _
                                  "nMontoDolares, dOperFech, cOperTipo, cCajaCodi, cTurnoCodi, nServicio, cDocCodigo, cRuc, cDocSerie, cDocTipo, IdLocal) " + _
           "VALUES" + _
           "($, '$', '$', '$', $, $, $, $, '$', $, '$', '$', $, $, '$', '$', '$', $)"
    sSQL = VBsprintf(sSQL, CStr(iCodOper), psUsuario_Descripcion, sTarjeta, kPAR_ALMACEN, CStr(Producto(i).Codigo), CStr(Producto(i).Cant * iSigno), _
                           CStr(Producto(i).PUnit), CStr(0), sFecha, CStr(iFlagTipo), kPAR_CAJA, kPAR_TURNO, IIf(Producto(i).Serv = "SI", kPAR_PORCSERV, "0"), cDocCodigo, cRuc, cDocSerie, cdocTipo, idLocal)
    If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then GoTo Salir
    
    nImporte = nImporte + ((Producto(i).Cant * Producto(i).PUnit) - (((Producto(i).Cant * Producto(i).PUnit) * (Producto(i).Dscto) / 100)))
  Next
  nPuntos = 0

  'ACTUALIZA PUNTOS
  '----------------
  If nImporte > 0 And sTarjeta <> "" Then
    Call Guarda_Puntos(sTarjeta, "VNTA", cdocTipo, cDocSerie, cDocCodigo, nImporte, , dcbLocal.BoundText)
    iPuntos = Int(nImporte / lReglaPuntoImporte) * lReglaPuntoCantidad
  End If
  If nPuntos > 0 And sTarjeta <> "" Then
    Call Guarda_Puntos(sTarjeta, "PTOS", cdocTipo, cDocSerie, cDocCodigo, nPuntos, nPtosImp, dcbLocal.BoundText)
  End If
  '----------------
           
  If iTipoVenta = 1 Or iTipoVenta = 3 Or iTipoVenta = 5 Then
  
    If iTipoVenta = 1 Then iEfectivo = nImporte
  
    'sw To SQL Server add >>> IdLocal
    sSQL = "INSERT INTO OPERACION (cOperCode, cUserDesc, nTarjNumb, cAlmaCode, cProdCode, nProdCant, nProdPrecUnit," & _
                                  "nMontoDolares, dOperFech, cOperTipo, cCajaCodi, cTurnoCodi, nMontoSoles, nVueltoDolares, cDocCodigo, cRuc, cDocSerie, cDocTipo, IdLocal) " + _
           "VALUES" + _
           "($, '$', '$', '$', $, $, $, $, '$', $, '$', '$', $, $, $, '$', '$', '$', $)"
    sSQL = VBsprintf(sSQL, CStr(iCodOper), psUsuario_Descripcion, sTarjeta, kPAR_ALMACEN, CStr(0), CStr(1), _
                           CStr(-1 * iVuelto), CStr(iEfectivoDolares), sFecha, CStr(1), kPAR_CAJA, kPAR_TURNO, CStr(iEfectivo), CStr(iVueltoDolares), CStr(cDocCodigo), cRuc, cDocSerie, cdocTipo, idLocal)
    If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then GoTo Salir
  
  End If
  
  '----------------------
  '-- Blanquea la Caja --
  '----------------------
  
  bProducto = False
  nProducto = 0
  iTotalVenta = 0
  cmdTecla(45).Enabled = True
  cmdTecla(46).Enabled = True
  iTipoVenta = 1
  lblTipo.Caption = ""
  txtCantidad.Text = ""
  txtCantidad.Enabled = False
  lblProducto.Caption = ""
  lblSubtotal.Caption = ""
  lblTotal.Caption = ""
  txtTarjeta.Text = ""
  txtCliente.Text = ""
  'lblCliente.Caption = ""
  txtRUC.Text = ""
  
  txtLocal = ""
  dcbLocal.BoundText = -1
  
  iEfectivo = 0
  iEfectivoDolares = 0
  iVuelto = 0
  iVueltoDolares = 0
  
  'SINCRONIZAR
  'Sincronizar
  
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  Screen.MousePointer = vbDefault

Salir:
  Set ADORS = Nothing
 Teclasel = 0
End Sub

Sub AnularTransaccion()
  frmAnulaTransaccion.Show vbModal
End Sub

Sub CancelarACTC()
  Me.txtTarjeta.Text = ""
  txtCliente.Text = ""
  'Me.lblCliente.Caption = ""
  txtRUC.Text = ""
  txtCantidad.Text = ""
  lblProducto.Caption = ""
  lblTipo.Caption = ""
  lblSubtotal.Caption = ""
  lblTotal.Caption = ""
  bProducto = False
  cmdTecla(45).Enabled = True
  cmdTecla(46).Enabled = True
  iTipoVenta = 5
  Teclasel = 0
End Sub

Sub TipoVenta()
  lblTipo.FontSize = 18
  Select Case iTipoVenta
    Case 1
      iTipoVenta = 2
      lblTipo.Caption = "VOUCHER"
      Me.txtRUC.Enabled = True
      Me.txtRUC.BackColor = &H80000005
    Case 2
'      If nTipoCambio = 0 Then
'        MsgBox "Para registrar ventas en dólares debe registrar el tipo de cambio"
'        iTipoVenta = 4
'        lblTipo.Caption = "ANULA PROD"
'        Exit Sub
'      End If
'      iTipoVenta = 3
'      lblTipo.Caption = "U$(TC:" + Format(CStr(nTipoCambio), "###,##0.00") + ")"
      
'      iTipoVenta = 4
'      lblTipo.Caption = "ANULA PROD"
'      Me.txtRuc.Text = ""
'      Me.txtRuc.Enabled = False
'      Me.txtRuc.BackColor = &H8000000F
      
      If nTipoCambio = 0 Then
        MsgBox "Para registrar ventas en dólares debe registrar el tipo de cambio"
        iTipoVenta = 1
        lblTipo.Caption = "CASH"
        Me.txtRUC.Enabled = True
        Me.txtRUC.BackColor = &H80000005
        Exit Sub
      End If
      
      iTipoVenta = 5
      lblTipo.Caption = "C/VUELTO"
      Me.txtRUC.Enabled = True
      Me.txtRUC.BackColor = &H80000005
      
'    Case 3
'      iTipoVenta = 4
'      lblTipo.Caption = "ANULA PROD"

'    Case 4
'      If nTipoCambio = 0 Then
'        MsgBox "Para registrar ventas en dólares debe registrar el tipo de cambio"
'        iTipoVenta = 1
'        lblTipo.Caption = "CASH"
'        Me.txtRuc.Enabled = True
'        Me.txtRuc.BackColor = &H80000005
'        Exit Sub
'      End If
'
'      iTipoVenta = 5
'      lblTipo.Caption = "C/VUELTO"
'      Me.txtRuc.Enabled = True
'      Me.txtRuc.BackColor = &H80000005

    Case 5
      iTipoVenta = 1
      lblTipo.Caption = "CASH"
      Me.txtRUC.Enabled = True
      Me.txtRUC.BackColor = &H80000005

  End Select
End Sub
Sub Pago()
  frmPago.Show vbModal
End Sub

Sub TotalVenta()
  Dim i As Long
  Dim iSubTotal As Double
  Dim nServicio As Double
  
  iTotalVenta = 0
  For i = 1 To nProducto
    nServicio = Producto(i).Cant * (Producto(i).PUnit / (1 + kIGV)) * (val(kPAR_PORCSERV) * IIf(Producto(i).Serv = "SI", 1, 0)) / 100
    iSubTotal = Producto(i).Cant * Producto(i).PUnit '+ nServicio
    iTotalVenta = iTotalVenta + iSubTotal
  Next
End Sub

Sub TotalVenta_actual()
  Dim i As Long
  Dim iSubTotal As Double
  Dim nServicio As Double
  
  iTotalVenta = 0
  For i = 1 To Teclasel
  
    nServicio = Producto(i).Cant * (Producto(i).PUnit / (1 + kIGV)) * (val(kPAR_PORCSERV) * IIf(Producto(i).Serv = "SI", 1, 0)) / 100
    iSubTotal = (Producto(i).Cant * Producto(i).PUnit) '+ nServicio
    iTotalVenta = iTotalVenta + iSubTotal
    
  Next
End Sub

Private Sub SeleccionarClienteLocal(nIdLocal As Integer)
  Dim cn As New ADODB.Connection
  Dim rs As New ADODB.Recordset
  Dim STRSQL As String

  If val(txtTarjeta) <> 0 And nIdLocal <> 0 Then
    'sw To SQL Server era >>> kCONNECT_STRING + psRutaMDB
    cn.ConnectionString = psCadenaConexionSQLServer
    cn.Open
    
    'sw To SQL Server era >>> nIdLocal
    rs.Open "SELECT * FROM cliente WHERE cClieCode=" & CLng(txtTarjeta) & " AND IdLocal=" & nIdLocal & "", cn, adOpenStatic, adLockReadOnly
    
    If Not rs.EOF Then
      sNombreCliente = LeerCampo(rs("sClieApel")) + " " + LeerCampo(rs("sClieName"))
      txtCliente = LeerCampo(rs("sClieApel")) + " " + LeerCampo(rs("sClieName"))
    Else
      sNombreCliente = ""
      txtCliente = ""
    End If
    
    Set cn = Nothing
  End If
End Sub

Private Sub LlenarComboLocal()
  Dim cnSQL As ADODB.Connection
  Dim ADORS As ADODB.Recordset
  Dim sSQL As String

  If Not oDBAdmin.AbrirBD(cnSQL, psCadenaConexionSQLServer, False) Then GoTo Salir
  'sw To SQL Server era >>> kCONNECT_STRING + psRutaMDB
  'cnSQL.ConnectionString = psCadenaConexionSQLServer
  'cn.Open

  sSQL = "SELECT idlocal,dsclocal FROM local"

  If Not oDBAdmin.EjecutarConsulta(cnSQL, sSQL, ADORS) Then GoTo Salir

  With dcbLocal
    Set dcbLocal.RowSource = ADORS
    dcbLocal.BoundColumn = "idlocal"
    dcbLocal.ListField = "dsclocal"
  End With
    
Set cnSQL = Nothing

Exit Sub
Salir:
Set cnSQL = Nothing

 
End Sub
