VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "tabctl32.ocx"
Begin VB.Form frmCuadre 
   Caption         =   "Cuadre del Día"
   ClientHeight    =   6630
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8340
   ControlBox      =   0   'False
   Icon            =   "frmCuadre.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   6630
   ScaleWidth      =   8340
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton Command1 
      Caption         =   "&Cerrar Caja"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   510
      Left            =   3120
      TabIndex        =   0
      Top             =   6000
      Width           =   1605
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   5775
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   8115
      _ExtentX        =   14314
      _ExtentY        =   10186
      _Version        =   393216
      Tab             =   2
      TabHeight       =   617
      TabCaption(0)   =   "Cuadre de Fichas"
      TabPicture(0)   =   "frmCuadre.frx":030A
      Tab(0).ControlEnabled=   0   'False
      Tab(0).Control(0)=   "Frame3"
      Tab(0).Control(1)=   "Frame1"
      Tab(0).Control(2)=   "Frame2"
      Tab(0).ControlCount=   3
      TabCaption(1)   =   "Cuadre de Productos"
      TabPicture(1)   =   "frmCuadre.frx":0326
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Frame5"
      Tab(1).Control(1)=   "Frame4"
      Tab(1).ControlCount=   2
      TabCaption(2)   =   "Cuadre de Caja"
      TabPicture(2)   =   "frmCuadre.frx":0342
      Tab(2).ControlEnabled=   -1  'True
      Tab(2).Control(0)=   "Label19"
      Tab(2).Control(0).Enabled=   0   'False
      Tab(2).Control(1)=   "Frame6(1)"
      Tab(2).Control(1).Enabled=   0   'False
      Tab(2).Control(2)=   "txtEntregado"
      Tab(2).Control(2).Enabled=   0   'False
      Tab(2).Control(3)=   "Frame6(0)"
      Tab(2).Control(3).Enabled=   0   'False
      Tab(2).ControlCount=   4
      Begin VB.Frame Frame2 
         Caption         =   " Detalle de Canjes "
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   2385
         Left            =   -74880
         TabIndex        =   86
         Top             =   3060
         Width           =   3930
         Begin MSComctlLib.ListView lvwFichas 
            Height          =   2025
            Left            =   90
            TabIndex        =   87
            Top             =   255
            Width           =   3735
            _ExtentX        =   6588
            _ExtentY        =   3572
            LabelEdit       =   1
            LabelWrap       =   -1  'True
            HideSelection   =   0   'False
            FullRowSelect   =   -1  'True
            _Version        =   393217
            ForeColor       =   -2147483640
            BackColor       =   -2147483643
            BorderStyle     =   1
            Appearance      =   1
            NumItems        =   0
         End
      End
      Begin VB.Frame Frame1 
         Caption         =   " Cuadre de Fichas "
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   2415
         Left            =   -73110
         TabIndex        =   75
         Top             =   525
         Width           =   4140
         Begin VB.TextBox txtFichasIF 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2085
            TabIndex        =   80
            Top             =   1455
            Width           =   1530
         End
         Begin VB.TextBox txtFichasC 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2085
            Locked          =   -1  'True
            TabIndex        =   79
            TabStop         =   0   'False
            Top             =   1080
            Width           =   1530
         End
         Begin VB.TextBox txtFichasT 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2085
            Locked          =   -1  'True
            TabIndex        =   78
            TabStop         =   0   'False
            Top             =   705
            Width           =   1530
         End
         Begin VB.TextBox txtFichasII 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2085
            TabIndex        =   77
            Top             =   330
            Width           =   1530
         End
         Begin VB.TextBox txtFichasFS 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2085
            Locked          =   -1  'True
            TabIndex        =   76
            TabStop         =   0   'False
            Top             =   1935
            Width           =   1530
         End
         Begin VB.Line Line1 
            BorderWidth     =   2
            X1              =   2070
            X2              =   3660
            Y1              =   1845
            Y2              =   1830
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            Caption         =   "Inventario Final :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   525
            TabIndex        =   85
            Top             =   1500
            Width           =   1470
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "Canje :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   1350
            TabIndex        =   84
            Top             =   1125
            Width           =   645
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            Caption         =   "Ticketeadas :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   840
            TabIndex        =   83
            Top             =   765
            Width           =   1155
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            Caption         =   "Inventario Inicial :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   405
            TabIndex        =   82
            Top             =   390
            Width           =   1590
         End
         Begin VB.Label Label14 
            AutoSize        =   -1  'True
            Caption         =   "FALT/SOB :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   900
            TabIndex        =   81
            Top             =   1980
            Width           =   1095
         End
      End
      Begin VB.Frame Frame3 
         Height          =   1800
         Left            =   -70815
         TabIndex        =   65
         Top             =   3330
         Width           =   3645
         Begin VB.CommandButton cmdGrabaCanje 
            Caption         =   "Aceptar"
            Height          =   420
            Left            =   2475
            TabIndex        =   70
            Top             =   1275
            Width           =   1050
         End
         Begin VB.TextBox txtCanjeTotal 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   1005
            Locked          =   -1  'True
            TabIndex        =   69
            TabStop         =   0   'False
            Top             =   1335
            Width           =   1260
         End
         Begin VB.TextBox txtCanjeCantidad 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   1005
            TabIndex        =   68
            Top             =   915
            Width           =   1260
         End
         Begin VB.TextBox txtCanjeFichas 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   1005
            Locked          =   -1  'True
            TabIndex        =   67
            TabStop         =   0   'False
            Top             =   555
            Width           =   1260
         End
         Begin VB.TextBox txtCanjeNombre 
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   1005
            Locked          =   -1  'True
            TabIndex        =   66
            TabStop         =   0   'False
            Top             =   195
            Width           =   2400
         End
         Begin VB.Line Line2 
            BorderWidth     =   2
            X1              =   990
            X2              =   2250
            Y1              =   1275
            Y2              =   1275
         End
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            Caption         =   "Fichas :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   330
            TabIndex        =   74
            Top             =   630
            Width           =   660
         End
         Begin VB.Label Label8 
            AutoSize        =   -1  'True
            Caption         =   "Total :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   375
            TabIndex        =   73
            Top             =   1380
            Width           =   615
         End
         Begin VB.Label Label7 
            AutoSize        =   -1  'True
            Caption         =   "Cantidad :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   90
            TabIndex        =   72
            Top             =   975
            Width           =   900
         End
         Begin VB.Label Label5 
            AutoSize        =   -1  'True
            Caption         =   "Producto :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   105
            TabIndex        =   71
            Top             =   225
            Width           =   885
         End
      End
      Begin VB.Frame Frame4 
         Caption         =   " Salida de  Productos "
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   2235
         Left            =   -74700
         TabIndex        =   63
         Top             =   480
         Width           =   7470
         Begin MSComctlLib.ListView lvwProductos 
            Height          =   1890
            Left            =   120
            TabIndex        =   64
            Top             =   225
            Width           =   7185
            _ExtentX        =   12674
            _ExtentY        =   3334
            LabelEdit       =   1
            LabelWrap       =   -1  'True
            HideSelection   =   0   'False
            _Version        =   393217
            ForeColor       =   -2147483640
            BackColor       =   -2147483643
            BorderStyle     =   1
            Appearance      =   1
            NumItems        =   0
         End
      End
      Begin VB.Frame Frame5 
         Caption         =   " Detalle De Productos "
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   2765
         Left            =   -74715
         TabIndex        =   49
         Top             =   2760
         Width           =   7485
         Begin VB.CommandButton cmdCuadraProductos 
            Caption         =   "Aceptar"
            Height          =   420
            Left            =   4110
            TabIndex        =   56
            Top             =   2250
            Width           =   1050
         End
         Begin VB.TextBox txtProductosNombre 
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   675
            Left            =   2400
            Locked          =   -1  'True
            MultiLine       =   -1  'True
            TabIndex        =   55
            TabStop         =   0   'False
            Top             =   330
            Width           =   4890
         End
         Begin VB.TextBox txtProductosII 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2400
            TabIndex        =   54
            Top             =   1065
            Width           =   1530
         End
         Begin VB.TextBox txtProductosT 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2400
            Locked          =   -1  'True
            TabIndex        =   53
            TabStop         =   0   'False
            Top             =   1440
            Width           =   1530
         End
         Begin VB.TextBox txtProductosIF 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2400
            TabIndex        =   52
            Top             =   1815
            Width           =   1530
         End
         Begin VB.TextBox txtProductosFS 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2400
            Locked          =   -1  'True
            TabIndex        =   51
            TabStop         =   0   'False
            Top             =   2295
            Width           =   1530
         End
         Begin VB.TextBox txtProductosID 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   2400
            TabIndex        =   50
            Top             =   690
            Visible         =   0   'False
            Width           =   1530
         End
         Begin VB.Label Label13 
            AutoSize        =   -1  'True
            Caption         =   "Producto :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   1425
            TabIndex        =   62
            Top             =   360
            Width           =   885
         End
         Begin VB.Label Label12 
            AutoSize        =   -1  'True
            Caption         =   "Inventario Inicial :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   720
            TabIndex        =   61
            Top             =   1080
            Width           =   1590
         End
         Begin VB.Label Label11 
            AutoSize        =   -1  'True
            Caption         =   "Ticketeadas :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   1155
            TabIndex        =   60
            Top             =   1500
            Width           =   1155
         End
         Begin VB.Label Label10 
            AutoSize        =   -1  'True
            Caption         =   "Inventario Final :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   840
            TabIndex        =   59
            Top             =   1860
            Width           =   1470
         End
         Begin VB.Label Label9 
            AutoSize        =   -1  'True
            Caption         =   "FALT/SOB :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   1215
            TabIndex        =   58
            Top             =   2350
            Width           =   1095
         End
         Begin VB.Line Line3 
            BorderWidth     =   2
            X1              =   2385
            X2              =   3960
            Y1              =   2220
            Y2              =   2220
         End
         Begin VB.Label Label25 
            AutoSize        =   -1  'True
            Caption         =   "Ingreso del Dia:"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   880
            TabIndex        =   57
            Top             =   720
            Visible         =   0   'False
            Width           =   1395
         End
      End
      Begin VB.Frame Frame6 
         Caption         =   " Cuadre de Caja "
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   4065
         Index           =   0
         Left            =   1110
         TabIndex        =   26
         Top             =   765
         Width           =   5745
         Begin VB.TextBox txtFALTSOB 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   39
            TabStop         =   0   'False
            Top             =   3300
            Width           =   1530
         End
         Begin VB.TextBox txtPagos 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   0
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   38
            TabStop         =   0   'False
            Top             =   1095
            Width           =   1530
         End
         Begin VB.TextBox txtVoucher 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   0
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   37
            TabStop         =   0   'False
            Top             =   675
            Width           =   1530
         End
         Begin VB.TextBox txtCash 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   36
            TabStop         =   0   'False
            Top             =   1905
            Width           =   1530
         End
         Begin VB.TextBox txtCashDRW 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   0
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   35
            TabStop         =   0   'False
            Top             =   2355
            Width           =   1530
         End
         Begin VB.TextBox txtCashDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   34
            TabStop         =   0   'False
            Top             =   1905
            Width           =   1530
         End
         Begin VB.TextBox txtCaja 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   2010
            TabIndex        =   33
            Top             =   2730
            Width           =   1530
         End
         Begin VB.TextBox txtCajaDolares 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   3855
            TabIndex        =   32
            Top             =   2730
            Width           =   1530
         End
         Begin VB.TextBox txtFALTSOBDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   31
            TabStop         =   0   'False
            Top             =   3300
            Width           =   1530
         End
         Begin VB.TextBox txtCashDRWDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   3840
            Locked          =   -1  'True
            TabIndex        =   30
            TabStop         =   0   'False
            Top             =   2355
            Width           =   1530
         End
         Begin VB.TextBox txtaperdolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0E0FF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   29
            TabStop         =   0   'False
            Top             =   1545
            Width           =   1530
         End
         Begin VB.TextBox txtapersoles 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0E0FF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   0
            Left            =   2025
            Locked          =   -1  'True
            TabIndex        =   28
            TabStop         =   0   'False
            Top             =   1545
            Width           =   1530
         End
         Begin VB.TextBox txtVoucherDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   0
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   27
            TabStop         =   0   'False
            Top             =   675
            Width           =   1530
         End
         Begin VB.Label Label15 
            AutoSize        =   -1  'True
            Caption         =   "FALT/SOB :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   600
            TabIndex        =   48
            Top             =   3345
            Width           =   1095
         End
         Begin VB.Label Label16 
            AutoSize        =   -1  'True
            Caption         =   "Pagos :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   1050
            TabIndex        =   47
            Top             =   1155
            Width           =   645
         End
         Begin VB.Label Label17 
            AutoSize        =   -1  'True
            Caption         =   "Voucher :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   855
            TabIndex        =   46
            Top             =   735
            Width           =   840
         End
         Begin VB.Label Label20 
            AutoSize        =   -1  'True
            Caption         =   "Total Cash :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   645
            TabIndex        =   45
            Top             =   1950
            Width           =   1050
         End
         Begin VB.Label Label21 
            AutoSize        =   -1  'True
            Caption         =   "Cash-DRW :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   630
            TabIndex        =   44
            Top             =   2400
            Width           =   1065
         End
         Begin VB.Label Label22 
            AutoSize        =   -1  'True
            Caption         =   "Saldo CAJA :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   510
            TabIndex        =   43
            Top             =   2775
            Width           =   1125
         End
         Begin VB.Line Line5 
            BorderWidth     =   2
            Index           =   0
            X1              =   1950
            X2              =   3540
            Y1              =   3150
            Y2              =   3135
         End
         Begin VB.Line Line4 
            BorderWidth     =   2
            Index           =   0
            X1              =   1965
            X2              =   3555
            Y1              =   1485
            Y2              =   1470
         End
         Begin VB.Line Line6 
            BorderWidth     =   2
            Index           =   0
            X1              =   1920
            X2              =   3510
            Y1              =   2295
            Y2              =   2280
         End
         Begin VB.Label Label23 
            AutoSize        =   -1  'True
            Caption         =   "Soles"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   2520
            TabIndex        =   42
            Top             =   390
            Width           =   525
         End
         Begin VB.Label Label24 
            AutoSize        =   -1  'True
            Caption         =   "Dólares"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   4215
            TabIndex        =   41
            Top             =   390
            Width           =   750
         End
         Begin VB.Line Line8 
            BorderWidth     =   2
            Index           =   0
            X1              =   3825
            X2              =   5415
            Y1              =   3150
            Y2              =   3135
         End
         Begin VB.Line Line9 
            BorderWidth     =   2
            Index           =   0
            X1              =   3825
            X2              =   5415
            Y1              =   2295
            Y2              =   2280
         End
         Begin VB.Line Line7 
            BorderWidth     =   2
            Index           =   0
            X1              =   1980
            X2              =   3570
            Y1              =   1035
            Y2              =   1020
         End
         Begin VB.Label Label18 
            AutoSize        =   -1  'True
            Caption         =   "Imp. Apertura :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   0
            Left            =   360
            TabIndex        =   40
            Top             =   1590
            Width           =   1350
         End
      End
      Begin VB.TextBox txtEntregado 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00C0FFFF&
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   1620
         Locked          =   -1  'True
         TabIndex        =   25
         TabStop         =   0   'False
         Top             =   5445
         Visible         =   0   'False
         Width           =   1530
      End
      Begin VB.Frame Frame6 
         Caption         =   " Cuadre de Caja "
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   4065
         Index           =   1
         Left            =   4200
         TabIndex        =   2
         Top             =   5160
         Visible         =   0   'False
         Width           =   5745
         Begin VB.TextBox txtapersoles 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0E0FF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   2025
            Locked          =   -1  'True
            TabIndex        =   15
            TabStop         =   0   'False
            Top             =   1545
            Width           =   1530
         End
         Begin VB.TextBox txtaperdolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0E0FF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   14
            TabStop         =   0   'False
            Top             =   1545
            Width           =   1530
         End
         Begin VB.TextBox txtCashDRWDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   3840
            Locked          =   -1  'True
            TabIndex        =   13
            TabStop         =   0   'False
            Top             =   2355
            Width           =   1530
         End
         Begin VB.TextBox txtFALTSOBDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   12
            TabStop         =   0   'False
            Top             =   3300
            Width           =   1530
         End
         Begin VB.TextBox txtCajaDolares 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   3855
            TabIndex        =   11
            Top             =   2730
            Width           =   1530
         End
         Begin VB.TextBox txtCaja 
            Alignment       =   1  'Right Justify
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   2010
            TabIndex        =   10
            Top             =   2730
            Width           =   1530
         End
         Begin VB.TextBox txtCashDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   9
            TabStop         =   0   'False
            Top             =   1905
            Width           =   1530
         End
         Begin VB.TextBox txtCashDRW 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   1
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   8
            TabStop         =   0   'False
            Top             =   2355
            Width           =   1530
         End
         Begin VB.TextBox txtCash 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   7
            TabStop         =   0   'False
            Top             =   1905
            Width           =   1530
         End
         Begin VB.TextBox txtVoucher 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   1
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   6
            TabStop         =   0   'False
            Top             =   675
            Width           =   1530
         End
         Begin VB.TextBox txtPagos 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFFF&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   1
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   5
            TabStop         =   0   'False
            Top             =   1095
            Width           =   1530
         End
         Begin VB.TextBox txtFALTSOB 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00FFFFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Index           =   1
            Left            =   2010
            Locked          =   -1  'True
            TabIndex        =   4
            TabStop         =   0   'False
            Top             =   3300
            Width           =   1530
         End
         Begin VB.TextBox txtVoucherDolares 
            Alignment       =   1  'Right Justify
            BackColor       =   &H00C0FFC0&
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Index           =   1
            Left            =   3855
            Locked          =   -1  'True
            TabIndex        =   3
            TabStop         =   0   'False
            Top             =   675
            Width           =   1530
         End
         Begin VB.Label Label18 
            AutoSize        =   -1  'True
            Caption         =   "Imp. Apertura :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   360
            TabIndex        =   24
            Top             =   1590
            Width           =   1350
         End
         Begin VB.Line Line7 
            BorderWidth     =   2
            Index           =   1
            X1              =   1980
            X2              =   3570
            Y1              =   1035
            Y2              =   1020
         End
         Begin VB.Line Line9 
            BorderWidth     =   2
            Index           =   1
            X1              =   3825
            X2              =   5415
            Y1              =   2295
            Y2              =   2280
         End
         Begin VB.Line Line8 
            BorderWidth     =   2
            Index           =   1
            X1              =   3825
            X2              =   5415
            Y1              =   3150
            Y2              =   3135
         End
         Begin VB.Label Label24 
            AutoSize        =   -1  'True
            Caption         =   "Dólares"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   4320
            TabIndex        =   23
            Top             =   360
            Width           =   750
         End
         Begin VB.Label Label23 
            AutoSize        =   -1  'True
            Caption         =   "Soles"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   2520
            TabIndex        =   22
            Top             =   390
            Width           =   525
         End
         Begin VB.Line Line6 
            BorderWidth     =   2
            Index           =   1
            X1              =   1920
            X2              =   3510
            Y1              =   2295
            Y2              =   2280
         End
         Begin VB.Line Line4 
            BorderWidth     =   2
            Index           =   1
            X1              =   1965
            X2              =   3555
            Y1              =   1485
            Y2              =   1470
         End
         Begin VB.Line Line5 
            BorderWidth     =   2
            Index           =   1
            X1              =   1950
            X2              =   3540
            Y1              =   3150
            Y2              =   3135
         End
         Begin VB.Label Label22 
            AutoSize        =   -1  'True
            Caption         =   "Saldo CAJA :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   510
            TabIndex        =   21
            Top             =   2775
            Width           =   1125
         End
         Begin VB.Label Label21 
            AutoSize        =   -1  'True
            Caption         =   "Cash-DRW :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   630
            TabIndex        =   20
            Top             =   2400
            Width           =   1065
         End
         Begin VB.Label Label20 
            AutoSize        =   -1  'True
            Caption         =   "Total Cash :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   645
            TabIndex        =   19
            Top             =   1950
            Width           =   1050
         End
         Begin VB.Label Label17 
            AutoSize        =   -1  'True
            Caption         =   "Voucher :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   855
            TabIndex        =   18
            Top             =   735
            Width           =   840
         End
         Begin VB.Label Label16 
            AutoSize        =   -1  'True
            Caption         =   "Pagos :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   1050
            TabIndex        =   17
            Top             =   1155
            Width           =   645
         End
         Begin VB.Label Label15 
            AutoSize        =   -1  'True
            Caption         =   "FALT/SOB :"
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Index           =   1
            Left            =   600
            TabIndex        =   16
            Top             =   3345
            Width           =   1095
         End
      End
      Begin VB.Label Label19 
         AutoSize        =   -1  'True
         Caption         =   "Total Entregado :"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   -180
         TabIndex        =   88
         Top             =   5490
         Visible         =   0   'False
         Width           =   1485
      End
   End
End
Attribute VB_Name = "frmCuadre"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Type t_productos
    Codigo  As Long
    Cantidad As Long
    Producto As String
    Catalogo As String
End Type

'Cuadre de Fichas
Sub CuadreFichas()
  On Error GoTo LineaError

  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  
  'Calcula las Ticketeadas
  sSQL = " SELECT SUM(P.cProdFichaCant * O.nProdCant) AS TOTAL" & _
         " FROM Producto AS P INNER JOIN Operacion AS O ON P.cProdCode = O.cProdCode AND P.cAlmaCode = O.cAlmaCode" & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cProdFlagCanje <> 1" & _
         " AND cProdFlagFicha = 1"
  
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  Do While Not ADORS.EOF
    txtFichasT.Text = Format(CStr(LeerCampo(ADORS("TOTAL"))), "###,###,###,##0")
    ADORS.MoveNext
  Loop

  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
Salir:
  Set ADORS = Nothing
End Sub

Private Sub ConfigurarColumnas()

  'Configura las columnas de la lista lvwFichas
  
  On Error GoTo LineaError

  Dim aColumnTitle() As String
  Dim aColumnWidth() As Single
  Dim aColumnAlign() As Integer
  
  ReDim aColumnTitle(5) As String
  ReDim aColumnWidth(5) As Single
  ReDim aColumnAlign(5) As Integer

  aColumnTitle(0) = "Cód."
  aColumnTitle(1) = "Producto"
  aColumnTitle(2) = "Fichas."
  aColumnTitle(3) = "Cant."
  aColumnTitle(4) = "Total"
  
  aColumnWidth(0) = 0.1
  aColumnWidth(1) = 0.4
  aColumnWidth(2) = 0.1
  aColumnWidth(3) = 0.17
  aColumnWidth(4) = 0.2
    
  aColumnAlign(0) = lvwColumnLeft
  aColumnAlign(1) = lvwColumnLeft
  aColumnAlign(2) = lvwColumnRight
  aColumnAlign(3) = lvwColumnRight
  aColumnAlign(4) = lvwColumnRight
    
  Call oListAdmin.InicializarLista(lvwFichas, aColumnTitle, _
                                   aColumnWidth, aColumnAlign, lvwReport)
  
  'Configura las columnas de la lista lvwProductos
  
  ReDim aColumnTitle(8) As String
  ReDim aColumnWidth(8) As Single
  ReDim aColumnAlign(8) As Integer

  aColumnTitle(0) = "Cód."
  aColumnTitle(1) = "Cód. Catalog."
  aColumnTitle(2) = "Producto"
  aColumnTitle(3) = "Ingreso"
  aColumnTitle(4) = "Inv.Inic."
  aColumnTitle(5) = "Salidas"
  aColumnTitle(6) = "Inv.Finl."
  aColumnTitle(7) = "FALT/SOB"
  
  aColumnWidth(0) = 0.1
  aColumnWidth(1) = 0.14
  aColumnWidth(2) = 0.3
  aColumnWidth(3) = 0.1
  aColumnWidth(4) = 0.1
  aColumnWidth(5) = 0.1
  aColumnWidth(6) = 0.1
  aColumnWidth(7) = 0.2
    
  aColumnAlign(0) = lvwColumnLeft
  aColumnAlign(1) = lvwColumnLeft
  aColumnAlign(2) = lvwColumnLeft
  aColumnAlign(3) = lvwColumnRight
  aColumnAlign(4) = lvwColumnRight
  aColumnAlign(5) = lvwColumnRight
  aColumnAlign(6) = lvwColumnRight
  aColumnAlign(7) = lvwColumnRight
    
  Call oListAdmin.InicializarLista(lvwProductos, aColumnTitle, _
                                   aColumnWidth, aColumnAlign, lvwReport)
                                   
  Exit Sub
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation

End Sub

Public Sub LlenarListaFichas()
  'Llena la lista
  On Error GoTo LineaError

  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim itemX As ListItem
  
  lvwFichas.ListItems.Clear
  
  sSQL = " SELECT cProdCode, sProdDescCrta, cProdFichaCant" & _
         " FROM Producto" & _
         " WHERE cProdFlagCanje = 1" & _
         " AND cProdFlagFicha = 1" & _
         " AND cProdEstd = 1" & _
         " AND cAlmaCode = '" & kPAR_ALMACEN & "'" & _
         " ORDER BY 1"
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  Do While Not ADORS.EOF
    Set itemX = lvwFichas.ListItems.Add(, , LeerCampo(ADORS!cProdCode))
    itemX.SubItems(1) = LeerCampo(ADORS!sProdDescCrta)
    itemX.SubItems(2) = LeerCampo(ADORS!cProdFichaCant)
    itemX.SubItems(3) = Format("0", "###,###,###,##0")
    itemX.SubItems(4) = Format("0", "###,###,###,##0")
    ADORS.MoveNext
  Loop
   
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  
Salir:
  Set ADORS = Nothing
End Sub

Private Sub cmdCuadraProductos_Click()
  If Not lvwProductos.SelectedItem Is Nothing Then
    lvwProductos.SelectedItem.SubItems(3) = Format(txtProductosID.Text, "###,###,###,##0")
    lvwProductos.SelectedItem.SubItems(4) = Format(txtProductosII.Text, "###,###,###,##0")
    lvwProductos.SelectedItem.SubItems(6) = Format(txtProductosIF.Text, "###,###,###,##0")
    lvwProductos.SelectedItem.SubItems(7) = Format(txtProductosFS.Text, "###,###,###,##0")
  End If
End Sub

Private Sub cmdGrabaCanje_Click()
  Dim iTotal As Double
  Dim i As Long
  iTotal = 0
  If Not lvwFichas.SelectedItem Is Nothing Then
  lvwFichas.SelectedItem.SubItems(3) = Format(txtCanjeCantidad.Text, "###,###,###,##0")
  lvwFichas.SelectedItem.SubItems(4) = Format(txtCanjeTotal.Text, "###,###,###,##0")
  'Calcula Total por Canje
  For i = 1 To lvwFichas.ListItems.Count
    iTotal = iTotal + val(Format(lvwFichas.ListItems(i).SubItems(4), "###########0"))
  Next
  txtFichasC.Text = Format(CStr(iTotal), "###,###,###,##0")
  Call CuadreFichasTotal
  End If
End Sub

Private Sub Command1_Click()
  Dim sSQL As String
  'ssql = "DROP TABLE PROD "
  'If Not oDBAdmin.EjecutarSentencia(ADOCnn, ssql) Then Exit Sub

  If frmPrincipal.bCerrar Then Imprimir
  Unload Me
End Sub

Private Sub Form_Load()
  InicializaControles
  
  'Configura la Impresora por default
  ConfiguraImpresora kPAR_IMPRESORA
  '----------------------------------
  
  ConfigurarColumnas
  CuadreCaja
  CuadreCajaZ1
  
  'CuadreFichasTotal
  CuadreCajaTotal
  
  
  'lvwFichas_Click
End Sub

Sub InicializaControles()
  'Cuadre de Fichas
  txtFichasII.Text = "0"
  txtFichasC.Text = "0"
  txtFichasT.Text = "0"
  txtFichasIF.Text = "0"
  txtFichasFS.Text = "0"
  txtCanjeNombre.Text = ""
  txtCanjeFichas.Text = "0"
  txtCanjeCantidad.Text = "0"
  txtCanjeTotal.Text = "0"
  
  'Cuadre de Productos
  txtProductosID.Text = "0"
  txtProductosII.Text = "0"
  txtProductosT.Text = "0"
  txtProductosIF.Text = "0"
  txtProductosFS.Text = "0"
  
  SSTab1.Tab = 2
End Sub

Sub CuadreFichasTotal()
  Dim iTotal As Double
  iTotal = 0
  iTotal = iTotal + val(Format(txtFichasII.Text, "###########0"))
  iTotal = iTotal - val(Format(txtFichasT.Text, "###########0"))
  iTotal = iTotal - val(Format(txtFichasC.Text, "###########0"))
  iTotal = iTotal - val(Format(txtFichasIF.Text, "###########0"))
  txtFichasFS.Text = Format(CStr(iTotal), "###########0")
End Sub


Public Sub lvwFichas_Click()
  If lvwFichas.ListItems.Count > 0 Then
    txtCanjeNombre.Text = lvwFichas.SelectedItem.SubItems(1)
    txtCanjeFichas.Text = lvwFichas.SelectedItem.SubItems(2)
    txtCanjeCantidad.Text = lvwFichas.SelectedItem.SubItems(3)
    txtCanjeTotal.Text = val(txtCanjeFichas.Text) * val(txtCanjeCantidad.Text)
  End If
  txtCanjeCantidad.SetFocus
End Sub

Private Sub txtCanjeCantidad_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 txtCanjeCantidad_LostFocus()
  txtCanjeTotal.Text = val(txtCanjeFichas.Text) * val(txtCanjeCantidad.Text)
End Sub

Private Sub txtFichasII_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 txtFichasII_LostFocus()
  Call CuadreFichasTotal
End Sub

Private Sub txtFichasIF_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 txtFichasIF_LostFocus()
  Call CuadreFichasTotal
End Sub

Public Sub LlenarListaProductos()

  'Llena la lista
  
  On Error GoTo LineaError

  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim ADORS2 As ADODB.Recordset
  
  Dim itemX As ListItem
  
  lvwProductos.ListItems.Clear
  sSQL = "SELECT cProdcode, sum(cantidad) as Cant ,  max(catalogo) as Catal, max(descripcion) as Descrip " & _
        " FROM  " & _
        "      ( SELECT 1, CProdCode,  sum(cant) as Cantidad , max(catal) as Catalogo, max(Descrip) as Descripcion " & _
        "          FROM    (SELECT  d.cProdCode,  sum( d.nProdCant) as cant ,  max(p.cCodcatalogo)  as catal, max( p.sProdDesc)  as Descrip     FROM  Operacion d, Producto p " & _
        "                    WHERE d.cProdcode = p.cProdcode And d.cProdcode <> 0 And d.cOperflagabierto = 1 And d.cOperFlaganula = 0 " & _
        "                    GROUP BY d.cProdCode  ) " & _
        "       GROUP BY CPRODCODE  " & _
        "         UNION  " & _
        "       SELECT 2, d.cProdCode,  sum( d.nProdCant) as cantidad ,  max(p.cCodcatalogo)  as catalogo, max( p.sProdDesc)  as Descripcion " & _
        "         FROM  OperacionParalelaProducto  d, OperacionParalela o,   Producto  p    WHERE  d.cOpercode = o.cOpercode      AND  d.cProdCode = p.cProdCode      AND  d.cProdcode <> 0      AND  o.cOperflagabierto= 1      AND  o.cOperCodeanul =  0 AND cEstado= '1' AND o.cOpertipo in (20, 21)    GROUP BY d.cProdCode   ) " & _
        " GROUP BY  cProdcode " & _
        "  order by 3"
   
  
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir:
  Dim i As Long
  Do While Not ADORS.EOF
    Set itemX = lvwProductos.ListItems.Add(, , LeerCampo(ADORS!cProdCode))
    itemX.SubItems(1) = LeerCampo(ADORS!catal)
    itemX.SubItems(2) = LeerCampo(ADORS!descrip)
    itemX.SubItems(3) = Format("0", "###,###,###,###0")
    itemX.SubItems(4) = Format("0", "###,###,###,###0")
    itemX.SubItems(5) = Format(LeerCampo(ADORS!Cant), "###,###,###,###0")
    itemX.SubItems(6) = Format(CLng(itemX.SubItems(4)) - CLng(LeerCampo(ADORS!Cant)), "###,###,###,###0")
    itemX.SubItems(7) = Format("0", "###,###,###,###0")
    ADORS.MoveNext
  Loop
   
  
GoTo Salir
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  
Salir:
  Set ADORS = Nothing
End Sub

Public Sub lvwProductos_Click()
  If lvwProductos.ListItems.Count > 0 Then
    txtProductosNombre.Text = lvwProductos.SelectedItem.SubItems(2)
    txtProductosID.Text = lvwProductos.SelectedItem.SubItems(3)
    txtProductosII.Text = lvwProductos.SelectedItem.SubItems(4)
    txtProductosT.Text = lvwProductos.SelectedItem.SubItems(5)
    txtProductosIF.Text = lvwProductos.SelectedItem.SubItems(6)
    txtProductosFS.Text = lvwProductos.SelectedItem.SubItems(7)
  End If
  txtProductosII.SetFocus
  Call CuadreProductosTotal
End Sub
Private Sub txtProductosID_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 txtProductosID_LostFocus()
  Call CuadreProductosTotal
End Sub

Private Sub txtProductosII_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 txtProductosII_LostFocus()
  Call CuadreProductosTotal
End Sub

Private Sub txtProductosIF_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 txtProductosIF_LostFocus()
  Call CuadreProductosTotal
End Sub

Sub CuadreProductosTotal()
  Dim iTotal As Double
  iTotal = 0
  iTotal = iTotal + val(Format(txtProductosID.Text, "###########0"))
  iTotal = iTotal + val(Format(txtProductosII.Text, "###########0"))
  iTotal = iTotal - val(Format(txtProductosT.Text, "###########0"))
  iTotal = iTotal - val(Format(txtProductosIF.Text, "###########0"))
  txtProductosFS.Text = Format(CStr(iTotal), "###########0")
End Sub

'-----------------------
'Cuadre Caja

Sub CuadreCaja()
  'Llena la lista
  
  On Error GoTo LineaError

  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim iTotal As Double
  Dim iTotalDolares As Double
  Dim nTipoCambio As Double
  Dim iAperturasoles As Double
  Dim iAperturadolares As Double
  Dim iPagos As Double
  
  iTotal = 0
  iTotalDolares = 0
  
  sSQL = " SELECT SUM(nProdPrecUnit) AS TOTAL" & _
         " FROM Operacion" & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cOperTipo = 5 " & _
         " AND cOperFlagAnula = 0 "
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  If Not ADORS.EOF Then
    If IsNull(LeerCampo(ADORS!Total)) Or (LeerCampo(ADORS!Total)) = "" Then
      iPagos = 0
      txtPagos(1).Text = "0.00"
    Else
      iPagos = val(LeerCampo(ADORS!Total))
      txtPagos(1).Text = Format(LeerCampo(ADORS!Total), "###,###,###,##0.00")
    End If
  End If
   
  
  Dim iEfeVoucher As Double
  sSQL = " SELECT SUM(nMontosoles) AS TOTAL" & _
           " FROM Operacion" & _
           " WHERE cOperFlagAbierto = 1 " & _
           " AND cOperTipo = 1 AND TRIM(cEmisor) <> '' " & _
           " AND cOperFlagAnula = 0 "
          
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  If Not ADORS.EOF Then
    iEfeVoucher = "0" & (ADORS!Total)
  Else
    iEfeVoucher = 0
  End If
  Set ADORS = Nothing
    
 ' >>> -- voucher ---<<<
sSQL = " SELECT SUM((nProdPrecUnit * nProdCant) +  ((nProdPrecUnit * nProdCant) * nDscto/100)) AS TOTAL" & _
         " FROM Operacion" & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cOperTipo = 2" & _
         " AND cOperFlagAnula = 0 " & _
         " AND cOpercodeAnula=0 "
         
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  Do While Not ADORS.EOF
    If IsNull(LeerCampo(ADORS!Total)) Or (LeerCampo(ADORS!Total)) = "" Then
      txtVoucher(1).Text = "0.00"
    Else
      txtVoucher(1).Text = Format(LeerCampo(ADORS!Total) - iEfeVoucher, "###,###,###,##0.00")
    End If
    ADORS.MoveNext
  Loop
  
  '-------------------Calcula importe en voucher en liquidaciones ----------
  sSQL = "SELECT SUM(nmontosoles +  nprodprecunit ) as TOTAL" & _
         "   FROM operacion " & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cOperTipo = 2 and cDocTipo='14' " & _
         " AND cOperFlagAnula = 0"
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  txtVoucher(1).Text = Format(val("0" & ADORS!Total) + val(txtVoucher(1).Text), "###,###,###,##0.00")
  
    
  'Total de Dolares obtenidos por ventas
 sSQL = " SELECT SUM(nMontoDolares - nVueltoDolares) AS TOTAL" & _
         " FROM Operacion" & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cOperTipo in (1, 3) " & _
         " AND cDoctipo in ('01','02') " & _
         " AND cOperFlaganula= 0 "
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  Do While Not ADORS.EOF
    If IsNull(LeerCampo(ADORS!Total)) Or (LeerCampo(ADORS!Total)) = "" Then
      txtCashDolares(1).Text = "0"
    Else
      txtCashDolares(1).Text = Format(LeerCampo(ADORS!Total), "###,###,###,##0.00")
      iTotalDolares = iTotalDolares + LeerCampo(ADORS!Total)
    End If
    ADORS.MoveNext
  Loop
  
  'Calculo del Cash Soles
   sSQL = " SELECT SUM(nMontoSoles + nProdPrecUnit) AS TOTAL" & _
         " FROM Operacion " & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND (cOperTipo in( 1, 3)) " & _
         " AND cDoctipo in ('01','02') " & _
         " AND cProdCode = 0 " & _
         " AND cOperFlaganula= 0 "
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  Do While Not ADORS.EOF
    If IsNull(LeerCampo(ADORS!Total)) Or (LeerCampo(ADORS!Total)) = "" Then
      txtCash(1).Text = "0"
    Else
      txtCash(1).Text = Format(LeerCampo(ADORS!Total), "###,###,###,##0.00")
      iTotal = LeerCampo(ADORS!Total)
    End If
    ADORS.MoveNext
  Loop
    
  Set ADORS = Nothing
  '---------------Datos de Apertura de caja
  sSQL = " SELECT  nImporApertSol, nImporApertDol " & _
         " FROM Configuracion "
       
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  iAperturasoles = (ADORS!nImporApertSol)
  iAperturadolares = (ADORS!nImporApertDol)
  txtapersoles(1).Text = Format(iAperturasoles, "###,###,###,###,##0.00")
  txtaperdolares(1).Text = Format(iAperturadolares, "###,###,###,###,##0.00")
    
  '-------------------------------------------
  iTotal = iTotal + iAperturasoles - iPagos
  iTotalDolares = iTotalDolares + iAperturadolares
  
  txtCashDRW(1).Text = Format(iTotal, "###,###,###,##0.00")
  txtCashDRWDolares(1).Text = Format(iTotalDolares, "###,###,###,##0.00")
  txtCaja(1) = Format(0, "###,###,###,##0.00")
  txtCajaDolares(1) = Format(0, "###,###,###,##0.00")
  txtFALTSOB(1).Text = Format((iTotal), "###,###,###,##0.00")
  txtFALTSOBDolares(1).Text = Format((iTotalDolares), "###,###,###,##0.00")
  
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  
Salir:
  Set ADORS = Nothing
End Sub
'-----------------------
'Cuadre Caja

Sub CuadreCajaZ1()
  'Llena la lista
  
  On Error GoTo LineaError

  Dim sSQL As String
  Dim ADORS As ADODB.Recordset
  Dim iTotal As Double
  Dim iTotalDolares As Double
  Dim nTipoCambio As Double
  Dim iAperturasoles As Double
  Dim iAperturadolares As Double
  Dim iPagos As Double
  
  iTotal = 0
  iTotalDolares = 0
  
  sSQL = " SELECT SUM(nProdPrecUnit) AS TOTAL" & _
         " FROM Operacion" & _
         " WHERE cOperFlagAbierto = 1 " & _
         "   AND cOperTipo = 5 " & _
         "   AND cOperFlagAnula = 0 "
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  If Not ADORS.EOF Then
    If IsNull(LeerCampo(ADORS!Total)) Or (LeerCampo(ADORS!Total)) = "" Then
      iPagos = 0
      txtPagos(0).Text = "0"
    Else
      iPagos = val(LeerCampo(ADORS!Total))
      txtPagos(0).Text = Format(LeerCampo(ADORS!Total), "###,###,###,##0.00")
    End If
  End If
 '-----vouchers venta
 Dim ivoucher, ivoucherdolares As Double
sSQL = " SELECT SUM((nProdPrecUnit * nProdCant) +  ((nProdPrecUnit * nProdCant) * nDscto/100)) AS TOTAL" & _
         " FROM Operacion" & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cOperTipo = 2" & _
         " AND cOperFlagAnula = 0 " & _
         " AND cOpercodeAnula=0 "
         
 If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
 ivoucher = 0
 ivoucher = val("0" & ADORS!Total)
 ivoucherdolares = 0
  '-----Vouchers en liquidacion
  
  sSQL = "SELECT SUM(nmontosoles +  nprodprecunit ) as TOTAL" & _
         " FROM operacion " & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cOperTipo = 2 and cDocTipo='14' " & _
         " AND cOperFlagAnula = 0"
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  ivoucher = ivoucher + val("0" & ADORS!Total)
  txtVoucher(0).Text = Format(ivoucher, "###,###,###,##0.00")
  
  
  'Total de Dolares obtenidos por ventas
  sSQL = " SELECT SUM(nMontoDolares-nVueltoDolares) AS TOTAL" & _
         " FROM Operacion" & _
         " WHERE cOperFlagAbierto = 1 " & _
         " AND cOperTipo in (1) " & _
         " AND cDoctipo in ('01','02', '14', '10') " & _
         " AND cOperFlaganula= 0 "
       
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  iTotalDolares = val("0" & ADORS!Total)
    
  txtCashDolares(0).Text = Format(iTotalDolares, "###,###,###,##0.00")
   
  
  'Calculo del Cash Soles
  sSQL = " SELECT SUM(nMontoSoles + nProdPrecUnit) AS TOTAL" & _
           " FROM Operacion " & _
           " WHERE cOperFlagAbierto = 1 " & _
           " AND (cOperTipo in( 1)) " & _
           " AND cDoctipo in ('01','02','10', '14') " & _
           " AND cProdCode = 0 " & _
           " AND cOperFlaganula= 0 "

If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
iTotal = 0

iTotal = val("0" & ADORS!Total)

 txtCash(0).Text = Format(iTotal, "###,###,###,##0.00")
  Set ADORS = Nothing
  '------------------------ PADES ----------------------------------'
  '-----NO LIQUIDADOS ----------------------------------------------'
  Dim iTotPADENOLIQSoles As Double
  Dim iTotPADENOLIQDolares As Double
  sSQL = " SELECT Sum(nEfectivosoles) as PADES, Sum(nEfectivoDolares) as PADED FROM OperacionParalela " & _
         " WHERE cOperTipo in (22) and cOperFlagAbierto=1 and cEstado in ('1') and cOpercodeAnul=0"
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  If Not ADORS.EOF Then
    If ADORS!PADES = Null Then
      iTotPADENOLIQSoles = 0
    Else
      iTotPADENOLIQSoles = "0" & (ADORS!PADES)
    End If
    If ADORS!PADED = Null Then
      iTotPADENOLIQDolares = 0
    Else
      iTotPADENOLIQDolares = "0" & (ADORS!PADED)
    End If
  End If
  Set ADORS = Nothing
  
  '---------------PADES LIQUIDADOS--------------------------------------------------------
  Dim PADLIQDIASoles As Double
  Dim PADLIQDIADolares As Double
  Dim iItemPADLIQDIASoles As Long
  Dim iItemPADLIQDIADolares As Long
  
  sSQL = " SELECT nEfectivosoles as padliqs, nEfectivoDolares as padliqd, nMoneda FROM OperacionParalela " & _
         " WHERE cOperTipo in (22) and cOperFlagAbierto=1 and cEstado in ('2') and cOperCodeAnul=0 "
         
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  PADLIQDIASoles = 0
  PADLIQDIADolares = 0
  iItemPADLIQDIASoles = 0
  iItemPADLIQDIADolares = 0
  Do While Not ADORS.EOF
    If LeerCampo(ADORS!nMoneda) = 2 Then
      If Not IsNull(ADORS!PADLIQD) Then
        PADLIQDIADolares = PADLIQDIADolares + LeerCampo(ADORS!PADLIQD)
        iItemPADLIQDIADolares = iItemPADLIQDIADolares + 1
      End If
    Else
      If Not IsNull(ADORS!PADLIQS) Then
        PADLIQDIASoles = PADLIQDIASoles + LeerCampo(ADORS!PADLIQS)
        iItemPADLIQDIASoles = iItemPADLIQDIASoles + 1
      End If
    End If
    ADORS.MoveNext
  Loop
  
  '-----LIQUIDADOS y CERRADOS--------------------------------------'
  Dim iTotPADELIQ As Double
  sSQL = " SELECT Sum(nMontosoles) as PADE FROM OperacionParalela " & _
         " WHERE cOperTipo in (22) and cOperFlagAbierto=0 and cEstado in ('2') AND " & _
         " cOperCodeRela in (Select copercode from OperacionParalela WHERE coperflagabierto = 1 and cOpercodeAnul=0 )"
          
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  If Not ADORS.EOF Then
    iTotPADELIQ = "0" & (ADORS!PADE)
  Else
    iTotPADELIQ = 0
  End If
  Set ADORS = Nothing
  
  iTotal = iTotal + iTotPADENOLIQSoles
  iTotalDolares = iTotalDolares + iTotPADENOLIQDolares
  
  '------------------------ PADVS ----------------------------------'
  '-----NO LIQUIDADOS ----------------------------------------------'
  Dim iTotPADVNOLIQSoles As Double
  Dim iTotPADVNOLIQDolares As Double
  
  sSQL = " SELECT Sum(nEfectivosoles) as PADVS, Sum(nEfectivoDolares) as PADVD FROM OperacionParalela " & _
         " WHERE cOperTipo in (23) and cOperFlagAbierto=1 and cEstado in ('1') and cOpercodeAnul=0"
           
          
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  If Not ADORS.EOF Then
    If ADORS!PADVS = Null Then
      iTotPADVNOLIQSoles = 0
    Else
      iTotPADVNOLIQSoles = "0" & (ADORS!PADVS)
    End If
    If ADORS!PADVD = Null Then
      iTotPADVNOLIQDolares = 0
    Else
      iTotPADVNOLIQDolares = "0" & (ADORS!PADVD)
    End If
  End If
  
  Set ADORS = Nothing
  '---------------PADVS LIQUIDADOS--------------------------------------------------------
  Dim PADVLIQDIASoles As Double
  Dim PADVLIQDIADolares As Double
  Dim iItemPADVLIQDIASoles As Long
  Dim iItemPADVLIQDIADolares As Long
  
  sSQL = " SELECT nEfectivosoles as padliqs, nEfectivoDolares as padliqd, nMoneda FROM OperacionParalela " & _
         " WHERE cOperTipo in (23) and cOperFlagAbierto=1 and cEstado in ('2') and cOperCodeAnul=0 "
      
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  PADVLIQDIASoles = 0
  PADVLIQDIADolares = 0
  iItemPADVLIQDIASoles = 0
  iItemPADVLIQDIADolares = 0
  
  Do While Not ADORS.EOF
    If LeerCampo(ADORS!nMoneda) = 2 Then
      If Not IsNull(ADORS!PADLIQD) Then
        PADVLIQDIADolares = PADVLIQDIADolares + LeerCampo(ADORS!PADLIQD)
        iItemPADVLIQDIADolares = iItemPADVLIQDIADolares + 1
      End If
    Else
      If Not IsNull(ADORS!PADLIQS) Then
        PADVLIQDIASoles = PADVLIQDIASoles + LeerCampo(ADORS!PADLIQS)
        iItemPADVLIQDIASoles = iItemPADVLIQDIASoles + 1
      End If
    End If
    ADORS.MoveNext
  Loop
  
  
  '-----LIQUIDADOS y CERRADOS--------------------------------------'
  Dim iTotPADVLIQ As Double
  sSQL = " SELECT Sum(nMontosoles) as PADE FROM OperacionParalela " & _
         " WHERE cOperTipo in (23) and cOperFlagAbierto=0 and cEstado in ('2') AND " & _
         " cOperCodeRela in (Select copercode from OperacionParalela WHERE coperflagabierto = 1) and cOpercodeAnul=0"
            
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  If Not ADORS.EOF Then
    iTotPADVLIQ = "0" & (ADORS!PADE)
  Else
    iTotPADVLIQ = 0
  End If
  Set ADORS = Nothing
  '------------------------------------------------------------------
  Dim iEfeVoucher As Double
  sSQL = " SELECT SUM(nMontosoles + nProdPrecUnit) AS TOTAL" & _
           " FROM Operacion" & _
           " WHERE cOperFlagAbierto = 1 " & _
           " AND cOperTipo = 1 AND TRIM(cEmisor) <> '' " & _
           " AND cOperFlagAnula = 0 "

  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  iEfeVoucher = val("0" & (ADORS!Total))
    
  Set ADORS = Nothing
  txtVoucher(0).Text = Format(CDbl(txtVoucher(0).Text) + iTotPADVNOLIQSoles + PADVLIQDIASoles - iEfeVoucher, "###,###,###,##0.00")
  txtVoucherDolares(0).Text = Format(CDbl(IIf(Len(Trim(txtVoucherDolares(0).Text)) = 0, "0", txtVoucherDolares(0).Text)) + iTotPADVNOLIQDolares + PADVLIQDIADolares, "###,###,###,##0.00")
  iTotal = iTotal + PADLIQDIASoles
  iTotalDolares = iTotalDolares + PADLIQDIADolares
  txtCash(0).Text = Format(iTotal, "###,###,###,##0.00")
  txtCashDolares(0).Text = Format(iTotalDolares, "###,###,###,##0.00")
  '---------------Datos de Apertura de caja
  sSQL = " SELECT  nImporApertSol, nImporApertDol " & _
         " FROM Configuracion "
       
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  
  iAperturasoles = (ADORS!nImporApertSol)
  iAperturadolares = (ADORS!nImporApertDol)
  txtapersoles(0).Text = Format(iAperturasoles, "###,###,###,###,##0.00")
  txtaperdolares(0).Text = Format(iAperturadolares, "###,###,###,###,##0.00")
    
  '-------------------------------------------
  iTotal = iTotal + iAperturasoles - iPagos
  iTotalDolares = iTotalDolares + iAperturadolares
  txtCashDRW(0).Text = Format(iTotal, "###,###,###,##0.00")
  txtCashDRWDolares(0).Text = Format(iTotalDolares, "###,###,###,##0.00")
  txtCaja(0) = Format(0, "###,###,###,##0.00")
  txtCajaDolares(0) = Format(0, "###,###,###,##0.00")
  txtFALTSOB(0).Text = Format((iTotal), "###,###,###,##0.00")
  txtFALTSOBDolares(0).Text = Format((iTotalDolares), "###,###,###,##0.00")
  
  GoTo Salir
  
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
  
Salir:
  Set ADORS = Nothing
End Sub

Sub CuadreCajaTotal()
  Dim iTotal As Double
  iTotal = 0
  iTotal = iTotal + val(Format(txtCashDRW(0).Text, "###########0.00"))
  iTotal = iTotal - val(Format(txtCaja(0).Text, "###########0.00"))
  txtFALTSOB(0).Text = Format(CStr(iTotal), "###,###,###,##0.00")
  
  iTotal = 0
  iTotal = iTotal + val(Format(txtCashDRWDolares(0).Text, "###########0.00"))
  iTotal = iTotal - val(Format(txtCajaDolares(0).Text, "###########0.00"))
  txtFALTSOBDolares(0).Text = Format(CStr(iTotal), "###,###,###,##0.00")
  
  iTotal = 0
  iTotal = iTotal + val(Format(txtCashDRW(1).Text, "###########0.00"))
  iTotal = iTotal - val(Format(txtCaja(1).Text, "###########0.00"))
  txtFALTSOB(1).Text = Format(CStr(iTotal), "###,###,###,##0.00")
  
  iTotal = 0
  iTotal = iTotal + val(Format(txtCashDRWDolares(1).Text, "###########0.00"))
  iTotal = iTotal - val(Format(txtCajaDolares(1).Text, "###########0.00"))
  txtFALTSOBDolares(1).Text = Format(CStr(iTotal), "###,###,###,##0.00")
End Sub

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

Private Sub txtCaja_LostFocus(Index As Integer)
  txtCaja(0).Text = Format(txtCaja(0).Text, "###,###,###,##0.00")
  txtCaja(1).Text = Format(txtCaja(1).Text, "###,###,###,##0.00")
  Call CuadreCajaTotal
End Sub

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

Private Sub txtCajaDolares_LostFocus(Index As Integer)
  txtCajaDolares(0).Text = Format(txtCajaDolares(0).Text, "###,###,###,##0.00")
  txtCajaDolares(1).Text = Format(txtCajaDolares(1).Text, "###,###,###,##0.00")
  Call CuadreCajaTotal
End Sub

Sub Imprimir()
  On Error GoTo LineaError
  
  Dim sTexto As String
  Dim i As Long, j As Long
  Dim ID As Long
  Dim sFecha As String
  Dim ADORS As ADODB.Recordset
  Dim sSQL As String
  Dim ActualizarTabla As Boolean
  Dim Texto_imprimir As String
  
  
  '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")


  sTexto = ""
  
  'CAPTURA EL NUMERO DE CUADRE
  sSQL = " SELECT MAX(dCuadreID) AS TOTAL FROM CUADRE_CAJA"
  
  If Not oDBAdmin.EjecutarConsulta(ADOCnn, sSQL, ADORS) Then GoTo Salir
  Do While Not ADORS.EOF
    If LeerCampo(ADORS("TOTAL")) = "" Or IsNull(LeerCampo(ADORS("TOTAL"))) Then
      ID = 1
    Else
      ID = LeerCampo(ADORS("TOTAL")) + 1
    End If
    ADORS.MoveNext
  Loop
    
  
  printer.FontSize = 8 ' 11
  printer.FontName = "Courier New"
  
 
      
  sTexto = sTexto + "      " + Format(CStr(Now()), "DD/MM/YYYY (DDD)")
  Texto_imprimir = Texto_imprimir + sTexto
  ActualizarTabla = True
  
  'Empieza impresion e insercion de lineas
  i = 1
  sTexto = LPad("", 27, "-")
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
'  i = i + 1
'  sTexto = "      CUADRE DE FICHAS"
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = LPad("", 27, "-")
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  'Valores de cuadre de fichas
'  i = i + 1
'  sTexto = "  Inv. Inicial" + Right(LPad("", 12) + "*" + txtFichasII.Text, 12)
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = "   Ticketeadas" + Right(LPad("", 12) + "*" + txtFichasT.Text, 12)
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = "         Canje" + Right(LPad("", 12) + "*" + txtFichasC.Text, 12)
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = "    Inv. Final" + Right(LPad("", 12) + "*" + txtFichasIF.Text, 12)
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = "      FALT/SOB" + Right(LPad("", 12) + "*" + txtFichasFS.Text, 12)
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  Printer.Print ""
'
'  'DETALLE DE CANJE DE FICHAS
'  i = i + 1
'  sTexto = LPad("", 27, "-")
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = "   DETALLE CUADRE FICHAS   "
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = LPad("", 27, "-")
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = "   CANJE   " + "   CANT  " + "  FICHAS "
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  For j = 1 To lvwFichas.ListItems.Count
'    i = i + 1
'    sTexto = Right("         " + lvwFichas.ListItems(j).SubItems(1), 11) + _
'             Right("         " + "*" + lvwFichas.ListItems(j).SubItems(3), 9) + _
'             Right("         " + "*" + lvwFichas.ListItems(j).SubItems(4), 9)
'    sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle)" & _
'           " VALUES ('$', $, $, '$')"
'    sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'    If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'    Printer.Print sTexto
'  Next
'
'  i = i + 1
'  sTexto = LPad("", 27, "-")
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  Printer.Print ""
'
   'CUADRE DE PRODUCTOS
'  i = i + 1
'  sTexto = LPad("", 27, "-")
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = "    CUADRE DE PRODUCTOS    "
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
'
'  i = i + 1
'  sTexto = LPad("", 27, "-")
'  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
'  Printer.Print sTexto
  Dim cCodProd As Long
  Dim nummov As Long
  Dim nCantidad As Long
    
 
    
'  i = i + 1
  'Texto_imprimir = Texto_imprimir + vbCrLf
  'Printer.Print ""
    
  'CUADRE DE CAJA
  'Valores de cuadre de fichas
  'sTexto = LPad("", 27, "-")
'  ssql = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
'           "VALUES ('$', $, $, '$')"
'  ssql = VBsprintf(ssql, sFecha, CStr(ID), CStr(i), sTexto)
'  If Not oDBAdmin.EjecutarSentencia(ADOCnn, ssql) Then ActualizarTabla = False
'  'Printer.Print sTexto
'  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
'
  i = i + 1
  sTexto = "CUADRE CAJA Z1"
  sTexto = Right(LPad(sTexto, 14), Int(Len(sTexto) / 2) + 14)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  i = i + 1
  sTexto = LPad("", 27, "-")
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
    
  i = i + 1
  sTexto = "CONCEPTO" + "   SOLES  " + " DOLARES "
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  i = i + 1
  sTexto = "   PAGOS" + Right(LPad("", 9) + "*" + txtPagos(0).Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  i = i + 1
  sTexto = " VOUCHER" + Right(LPad("", 9) + "*" + txtVoucher(0).Text, 9) + Right(LPad("", 9) + "*" + txtVoucherDolares(0).Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  i = i + 1
  sTexto = "ENTREG. " + Right(LPad("", 9) + "*" + txtEntregado.Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  '----------Inserta linea de apertura --------
  i = i + 1
  sTexto = "APERTURA" + Right(LPad("", 9) + "*" + txtapersoles(0).Text, 9) + Right(LPad("", 9) + "*" + txtaperdolares(0).Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  '--------------------------------------------------------------
  i = i + 1
  sTexto = "    CASH" + Right(LPad("", 9) + "*" + txtCash(0).Text, 9) + Right(LPad("", 9) + "*" + txtCashDolares(0).Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  i = i + 1
  sTexto = "CASH-DRW" + Right(LPad("", 9) + "*" + txtCashDRW(0).Text, 9) + Right(LPad("", 9) + "*" + txtCashDRWDolares(0).Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  i = i + 1
  sTexto = "    CAJA" + Right(LPad("", 9) + "*" + txtCaja(0).Text, 9) + Right(LPad("", 9) + "*" + txtCajaDolares(0).Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  i = i + 1
  sTexto = "FALT/SOB" + Right(LPad("", 9) + "*" + txtFALTSOB(0).Text, 9) + Right(LPad("", 9) + "*" + txtFALTSOBDolares(0).Text, 9)
  sSQL = " INSERT INTO CUADRE_CAJA(dCuadreFecha, dCuadreID, dCuadreLinea, dCuadreDetalle) " & _
           "VALUES ('$', $, $, '$')"
  sSQL = VBsprintf(sSQL, sFecha, CStr(ID), CStr(i), sTexto)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  'Printer.Print sTexto
  '-------------segun impresora seleccionada --------
  sTexto = sTexto + vbCrLf + vbCrLf + "CAJA: " + kPAR_CAJA
  sTexto = sTexto + vbCrLf + "Versión " & App.Major & "." & App.Minor & "." & App.Revision
  sTexto = sTexto + vbCrLf & "Correlativo: " & ObtenerCorrelativo(2)
  
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  If Not ActualizarTabla Then
    sSQL = " DELETE FROM CUADRE_CAJA WHERE format(dCuadreFecha,'dd/mm/yyyy') = '$' AND dCuadreID = $"
    sSQL = VBsprintf(sSQL, sFecha, CStr(ID))
    oDBAdmin.EjecutarSentencia ADOCnn, sSQL
  Else
    ConfiguraImpresora kPAR_IMPRESORA_ALTERNA
    Select Case KImpresoraALT
    Case 1
        Call CortePapel(Texto_imprimir, 1, "Cuadre1")
    Case 0
        printer.Print Texto_imprimir
        printer.Print " "
        printer.Print " "
        printer.EndDoc
     End Select
  End If
  '---------------------------Impresión de -cuadre de ticketeada -------------
  Texto_imprimir = ""
  sTexto = ""
  
  Call CabeceraImpresion
  
  For i = 0 To UBound(sCabecera) - 1
    sTexto = sTexto + Right("              " + sCabecera(i), Int(Len(sCabecera(i)) / 2) + 14) + vbCrLf
  Next
  sTexto = sTexto + vbCrLf
  
  sTexto = sTexto + "      " + Format(CStr(Now()), "DD/MM/YYYY (DDD)")
  Texto_imprimir = Texto_imprimir + sTexto
  
  'Empieza impresion e insercion de lineas
  i = 1
  sTexto = LPad("", 27, "-")
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  i = i + 1
  sTexto = "CUADRE CAJA"
  sTexto = Right(LPad(sTexto, 14), Int(Len(sTexto) / 2) + 14)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  i = i + 1
  sTexto = LPad("", 27, "-")
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
    
  sTexto = "CONCEPTO" + "   SOLES  " + " DOLARES "
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  sTexto = "   PAGOS" + Right(LPad("", 9) + "*" + txtPagos(1).Text, 9)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  

  sTexto = " VOUCHER" + Right(LPad("", 9) + "*" + txtVoucher(1).Text, 9)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  

  sTexto = "ENTREG. " + Right(LPad("", 9) + "*" + txtEntregado.Text, 9)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  '----------Inserta linea de apertura --------

  sTexto = "APERTURA" + Right(LPad("", 9) + "*" + txtapersoles(1).Text, 9) + Right(LPad("", 9) + "*" + txtaperdolares(1).Text, 9)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  '--------------------------------------------------------------

  sTexto = "    CASH" + Right(LPad("", 9) + "*" + txtCash(1).Text, 9) + Right(LPad("", 9) + "*" + txtCashDolares(1).Text, 9)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto

  sTexto = "CASH-DRW" + Right(LPad("", 9) + "*" + txtCashDRW(1).Text, 9) + Right(LPad("", 9) + "*" + txtCashDRWDolares(1).Text, 9)
  If Not oDBAdmin.EjecutarSentencia(ADOCnn, sSQL) Then ActualizarTabla = False
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto

  sTexto = "    CAJA" + Right(LPad("", 9) + "*" + txtCaja(1).Text, 9) + Right(LPad("", 9) + "*" + txtCajaDolares(1).Text, 9)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
  
  
  sTexto = "FALT/SOB" + Right(LPad("", 9) + "*" + txtFALTSOB(1).Text, 9) + Right(LPad("", 9) + "*" + txtFALTSOBDolares(1).Text, 9)
  '-------------segun impresora seleccionada --------
  sTexto = sTexto + vbCrLf + vbCrLf + "CAJA: " + kPAR_CAJA
  sTexto = sTexto + vbCrLf + "Versión " & App.Major & "." & App.Minor & "." & App.Revision
  sTexto = sTexto + vbCrLf & "Correlativo: " & ObtenerCorrelativo(1)
  Texto_imprimir = Texto_imprimir + vbCrLf + sTexto
    ConfiguraImpresora kPAR_IMPRESORA
    Select Case KImpresora
    Case 1
        Call CortePapel(Texto_imprimir, 1, "Cuadre")
    Case 0
        printer.Print Texto_imprimir
        printer.Print " "
        printer.Print " "
        printer.EndDoc
     End Select
 
  '-----------------------fin impresion -------------------------------------------------------------
  GoTo Salir
    
LineaError:
  MsgBox Err.Description, vbOKOnly + vbInformation
Salir:
  Set ADORS = Nothing
End Sub

Public Sub Inicio(OP As Integer)
 If OP = 1 Then
    Me.SSTab1.TabVisible(0) = False
    Me.SSTab1.TabVisible(1) = False
Else
    Me.SSTab1.TabVisible(0) = False
    Command1.Caption = "Cerrar"
    End If
 LlenarListaProductos

End Sub
