VERSION 5.00
Object = "{90F3D7B3-92E7-44BA-B444-6A8E2A3BC375}#1.0#0"; "actskin4.ocx"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FCierreX_Playa 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Cierre X"
   ClientHeight    =   4005
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   Icon            =   "FCierreX_Playa.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4005
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox lblTurno 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1680
      Locked          =   -1  'True
      TabIndex        =   15
      Top             =   1200
      Width           =   855
   End
   Begin VB.TextBox lblFecha 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1680
      Locked          =   -1  'True
      TabIndex        =   14
      Top             =   720
      Width           =   1575
   End
   Begin VB.TextBox lblCaja 
      Appearance      =   0  'Flat
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1680
      Locked          =   -1  'True
      TabIndex        =   13
      Top             =   240
      Width           =   1575
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1 
      Height          =   255
      Left            =   840
      OleObjectBlob   =   "FCierreX_Playa.frx":030A
      TabIndex        =   10
      Top             =   240
      Width           =   615
   End
   Begin ACTIVESKINLibCtl.Skin sknCierreX 
      Left            =   120
      OleObjectBlob   =   "FCierreX_Playa.frx":0370
      Top             =   1320
   End
   Begin VB.CommandButton cmdAceptar 
      BackColor       =   &H00FFFFFF&
      Caption         =   "&Aceptar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   645
      Left            =   2400
      Picture         =   "FCierreX_Playa.frx":05A4
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   3120
      Width           =   1515
   End
   Begin VB.CommandButton cmdCancelar 
      BackColor       =   &H00FFFFFF&
      Caption         =   "&Cancelar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2400
      Picture         =   "FCierreX_Playa.frx":063A
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   2520
      Width           =   1515
   End
   Begin VB.CommandButton ccmdCierreXVendedor 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Cierre X por Vendedor"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2400
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   1920
      Width           =   1515
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   3900
      Top             =   270
   End
   Begin VB.Frame fraDestino 
      Appearance      =   0  'Flat
      BackColor       =   &H80000004&
      Caption         =   "Destino"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   1905
      Left            =   240
      TabIndex        =   0
      Top             =   1920
      Width           =   1815
      Begin VB.OptionButton optImpresora 
         Caption         =   "Impresora"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   885
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   960
         Width           =   1425
      End
      Begin VB.OptionButton optPantalla 
         Caption         =   "Pantalla"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   765
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   240
         Value           =   -1  'True
         Width           =   1455
      End
   End
   Begin MSComCtl2.Animation Animation1 
      Height          =   615
      Left            =   810
      TabIndex        =   6
      Top             =   4200
      Width           =   3045
      _ExtentX        =   5371
      _ExtentY        =   1085
      _Version        =   393216
      FullWidth       =   203
      FullHeight      =   41
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2 
      Height          =   255
      Left            =   600
      OleObjectBlob   =   "FCierreX_Playa.frx":06D7
      TabIndex        =   11
      Top             =   720
      Width           =   855
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel3 
      Height          =   255
      Left            =   600
      OleObjectBlob   =   "FCierreX_Playa.frx":073F
      TabIndex        =   12
      Top             =   1200
      Width           =   855
   End
   Begin VB.Label Lbldesvendedor 
      Height          =   255
      Left            =   2400
      TabIndex        =   9
      Top             =   1440
      Visible         =   0   'False
      Width           =   1815
   End
   Begin VB.Label lblvendedor 
      Height          =   375
      Left            =   2520
      TabIndex        =   8
      Top             =   1200
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.Image Image7 
      Height          =   480
      Left            =   3960
      Picture         =   "FCierreX_Playa.frx":07A7
      Top             =   2640
      Visible         =   0   'False
      Width           =   480
   End
   Begin VB.Image Image6 
      Height          =   480
      Left            =   3960
      Picture         =   "FCierreX_Playa.frx":0BE9
      Top             =   3240
      Visible         =   0   'False
      Width           =   480
   End
   Begin VB.Image Image5 
      Height          =   480
      Left            =   3960
      Picture         =   "FCierreX_Playa.frx":102B
      Top             =   2040
      Visible         =   0   'False
      Width           =   480
   End
   Begin VB.Label lblMensaje 
      Caption         =   "Generando Cierre X ..."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   1320
      TabIndex        =   7
      Top             =   4860
      Width           =   1995
   End
   Begin VB.Image Image4 
      Height          =   480
      Left            =   3600
      Picture         =   "FCierreX_Playa.frx":146D
      Top             =   600
      Width           =   480
   End
   Begin VB.Shape Shape1 
      Height          =   1665
      Left            =   270
      Top             =   150
      Width           =   4155
   End
   Begin VB.Image Image1 
      Height          =   660
      Left            =   180
      Picture         =   "FCierreX_Playa.frx":1777
      Stretch         =   -1  'True
      Top             =   4170
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image Image3 
      Height          =   480
      Left            =   4080
      Picture         =   "FCierreX_Playa.frx":2041
      Top             =   4440
      Visible         =   0   'False
      Width           =   480
   End
   Begin VB.Image Image2 
      Height          =   480
      Left            =   4080
      Picture         =   "FCierreX_Playa.frx":234B
      Top             =   4320
      Visible         =   0   'False
      Width           =   480
   End
End
Attribute VB_Name = "FCierreX_Playa"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Se retiraron los Fuentes de la red el 24/04/2003
Dim RS1 As ADODB.Recordset
Dim RS2 As ADODB.Recordset
Dim RS3 As ADODB.Recordset
Dim RS4 As ADODB.Recordset
Dim RS5 As ADODB.Recordset

Dim RS_CARAS_POR_PTOVTA As ADODB.Recordset
Dim MobjSetup As UTIL_SETUP.C_SETUP
Dim Mcon As ADODB.Connection
Dim obj As DB_OP_FACTURACION.C_CIERRE
Private MobjVentaPlaya As DB_OP_FACTURACION.C_VENTASPLAYA
Public MintAceptarCancelar As Integer
Public MintResultadoLogin As Integer
Public MstrUsuario As String


Private Sub ccmdCierreXVendedor_Click()
    
' Solicitar Clave de Acceso
    
   MintResultadoLogin = -1
   FIngresoClave.GintPantalla = 3
   FIngresoClave.Show vbModal
   If MintResultadoLogin <> 0 Then
      Exit Sub
   End If
 
' Fin de Clave de Acceso
    
      
MintAceptarCancelar = 0
  
FbuscarVendedor.Show vbModal
  
If MintAceptarCancelar = 0 Then
   Exit Sub
End If

' Inicio de CierreX por Vendedor
    
        Screen.MousePointer = 11
        
        Me.Height = 5610
        If optPantalla.Value = True Then
            Image1.Visible = True
            Image2.Visible = True
        Else
            Image1.Visible = True
            Image3.Visible = True
        End If
        
        Animation1.Open GstrReportesVta & "Proceso.avi"
        Animation1.Visible = True
        Animation1.Play
        
        Image1.Refresh
        Image2.Refresh
        Image3.Refresh
        lblMensaje.Refresh
        
        'Verifica las transacciones pendientes
        '***************************************
        Dim intPendientes As Integer
        
        intPendientes = Ver_Transacciones_Pendientes(RS_CARAS_POR_PTOVTA)
        
        If intPendientes = 0 Then
            Screen.MousePointer = 0
            MDestruye_Objetos
            MsgBox "No se ha Configurado Caras para el Punto de Venta " & lblCaja.Text, vbExclamation, "Cierre X"
            Exit Sub
        End If
        
        If intPendientes = 1 Then
            Screen.MousePointer = 0
            MDestruye_Objetos
            MsgBox "Existen Transacciones pendientes", vbExclamation, "Cierre X"
            Exit Sub
        End If
        
        If intPendientes = 3 Then
            Screen.MousePointer = 0
            MDestruye_Objetos
            MsgBox "Error Inesperedo", vbExclamation, "Cierre X"
            Exit Sub
        End If
        
        '**************************************
        'lblfecha.Caption = "15/03/2003"
        'lblTurno.Caption = 2
        
        Dim LArrayDatosCierre(1, 5) As Variant
        
        LArrayDatosCierre(1, 1) = CInt(lblTurno.Text)
        LArrayDatosCierre(1, 2) = CDate(lblFecha.Text)
        LArrayDatosCierre(1, 3) = Trim(lblvendedor.Caption)
        
        LArrayDatosCierre(1, 4) = 1
        LArrayDatosCierre(1, 5) = MstrUsuario
        Set RS1 = obj.Auxiliar2(LArrayDatosCierre, "")
        
        LArrayDatosCierre(1, 4) = 2
        LArrayDatosCierre(1, 5) = MstrUsuario
        Set RS2 = obj.Auxiliar2(LArrayDatosCierre, "")
        
        LArrayDatosCierre(1, 4) = 3
        LArrayDatosCierre(1, 5) = MstrUsuario
        Set RS3 = obj.Auxiliar2(LArrayDatosCierre, "")
        
        LArrayDatosCierre(1, 4) = 4
        LArrayDatosCierre(1, 5) = MstrUsuario
        Set RS4 = obj.Auxiliar2(LArrayDatosCierre, "")
                
        Set RS5 = obj.OBTIENECABECERA_PLAYA_CIERREX(CInt(lblTurno.Text), CDate(lblFecha.Text), lblCaja.Text)
        
        
        If optPantalla.Value = True Then
             
            If RS1.EOF Then
               Animation1.Stop
               MsgBox "No existen Ventas para el Turno " & lblTurno.Text, vbDefaultButton1 + vbExclamation, "Cierre X"
               Screen.MousePointer = 0
               MDestruye_Objetos
               Unload Me
               Exit Sub
            End If
                  
            Call GVerCierreXVendedor(0, 0, Trim(Lbldesvendedor.Caption), GstrSimboloMonedaBase, GstrSimboloMonedaExt, 40, GintDecResultado, RS5, RS1, RS2, RS3, RS4, lblTurno.Text)
            MDestruye_Objetos
            Screen.MousePointer = 0
            
            Me.Hide
            MsgBox "Cierre X generado con éxito", vbInformation, "Cierre X"
            Unload Me
        
        Else
            
            'Dim LrsSecuencia As ADODB.Recordset
            'Dim LstrMensaje As String
        
            'Set LrsSecuencia = obj.Auxiliar1(LTrim(lblcaja.Caption))
        
            'If Not LrsSecuencia.EOF Then
            '     Screen.MousePointer = 0
            '     LstrMensaje = "Deben rezalizar Cierre X los Siguientes Puntos de Venta : " & Chr(13) & Chr(13)
           
            '     LrsSecuencia.MoveFirst
         
            '     Do While Not LrsSecuencia.EOF
            '        LstrMensaje = LstrMensaje & LrsSecuencia!salespoint & " [" & LrsSecuencia!TerminalName & "]" & Chr(13)
            '        LrsSecuencia.MoveNext
            '     Loop
            '     Animation1.Stop
            '     MsgBox LstrMensaje, vbDefaultButton1 + vbInformation, "Mensaje"
            '     Set LrsSecuencia = Nothing
            '     Unload Me
            '     Exit Sub
            'End If
            
            
            If RS1.EOF Then
               Animation1.Stop
               MsgBox "No existen Ventas para el Turno " & lblTurno.Text, vbDefaultButton1 + vbExclamation, "Cierre X"
               Animation1.Play
               'Call obj.Actualizar_Datos_LuegodeCierreX(lblcaja.Caption, 2, lblturno.Caption, lblfecha.Caption, Empty)
               
               Screen.MousePointer = 0
               MDestruye_Objetos
               Unload Me
               Exit Sub
            End If
            
            'Call obj.Actualizar_Datos_LuegodeCierreX(lblcaja.Caption, 2, lblturno.Caption, lblfecha.Caption, Empty)
        
            Call GImprimeCierreXVendedor(0, 0, Trim(Lbldesvendedor.Caption), GstrSimboloMonedaBase, GstrSimboloMonedaExt, 40, GintDecResultado, RS5, RS1, RS2, RS3, RS4, lblTurno.Text)
            
            MDestruye_Objetos
            Screen.MousePointer = 0
            
            Me.Hide
            MsgBox "Cierre X generado con éxito", vbInformation, "Cierre X"
            'End
            Unload Me
            
        End If
   
' Fin de CierreX por Vendedor
   
  
End Sub

Private Sub ccmdCierreXVendedor_GotFocus()
   
   Image5.Visible = True
   Image6.Visible = False
   Image7.Visible = False
   
End Sub

Private Sub ccmdCierreXVendedor_LostFocus()
   Image5.Visible = False
End Sub

Private Sub cmdAceptar_Click()
On Error GoTo TrataError

Screen.MousePointer = 11


If optPantalla.Value = True Then
    Image1.Visible = True
    Image2.Visible = True
Else
    If MsgBox("Seguro que desea realizar el Cierre X", vbYesNo + vbQuestion, "Mensaje") = vbNo Then
       Screen.MousePointer = 0
       Exit Sub
    End If
    
    Image1.Visible = True
    Image3.Visible = True
End If

Me.Height = 5610

Animation1.Open GstrReportesVta & "Proceso.avi"
Animation1.Visible = True
Animation1.Play

Image1.Refresh
Image2.Refresh
Image3.Refresh
lblMensaje.Refresh

'Verifica las transacciones pendientes
'***************************************
Dim intPendientes As Integer

intPendientes = Ver_Transacciones_Pendientes(RS_CARAS_POR_PTOVTA)

If intPendientes = 0 Then
    Screen.MousePointer = 0
    MDestruye_Objetos
    MsgBox "No se ha Configurado Caras para el Punto de Venta " & lblCaja.Text, vbExclamation, "Cierre X"
    Exit Sub
End If

If intPendientes = 1 Then
    Screen.MousePointer = 0
    MDestruye_Objetos
    MsgBox "Existen Transacciones pendientes", vbExclamation, "Cierre X"
    Exit Sub
End If

If intPendientes = 3 Then
    Screen.MousePointer = 0
    MDestruye_Objetos
    MsgBox "Error Inesperedo", vbExclamation, "Cierre X"
    Exit Sub
End If

'**************************************
'lblfecha.Caption = "15/03/2003"
'lblTurno.Caption = 2

Set RS1 = obj.OBTIENERESUMEN_PLAYA_CIERREX(CInt(lblTurno.Text), CDate(lblFecha.Text), lblCaja.Text, 1)
Set RS2 = obj.OBTIENERESUMEN_PLAYA_CIERREX(CInt(lblTurno.Text), CDate(lblFecha.Text), lblCaja.Text, 2)
Set RS3 = obj.OBTIENERESUMEN_PLAYA_CIERREX(CInt(lblTurno.Text), CDate(lblFecha.Text), lblCaja.Text, 3)
Set RS4 = obj.OBTIENERESUMEN_PLAYA_CIERREX(CInt(lblTurno.Text), CDate(lblFecha.Text), lblCaja.Text, 4)

Set RS5 = obj.OBTIENECABECERA_PLAYA_CIERREX(CInt(lblTurno.Text), CDate(lblFecha.Text), lblCaja.Text)


If optPantalla.Value = True Then
     
    If RS1.EOF Then
       Animation1.Stop
       MsgBox "No existen Ventas para el Turno " & lblTurno.Text, vbDefaultButton1 + vbExclamation, "Cierre X"
       Screen.MousePointer = 0
       MDestruye_Objetos
       Unload Me
       Exit Sub
    End If
          
    Call GVerCierre(0, 0, Empty, GstrSimboloMonedaBase, GstrSimboloMonedaExt, 40, GintDecResultado, RS5, RS1, RS2, RS3, RS4, lblTurno.Text)
    MDestruye_Objetos
    Screen.MousePointer = 0
    
    Me.Hide
    MsgBox "Cierre X generado con éxito", vbInformation, "Cierre X"
    Unload Me

Else
    
    Dim LrsSecuencia As ADODB.Recordset
    Dim LstrMensaje As String
 ''Set LrsSecuencia = obj.Auxiliar1(LTrim(lblcaja.Caption))
    Set LrsSecuencia = obj.Auxiliar1(LTrim(lblCaja.Text))

    If Not LrsSecuencia.EOF Then
         Screen.MousePointer = 0
         LstrMensaje = "Deben rezalizar Cierre X los Siguientes Puntos de Venta : " & Chr(13) & Chr(13)
   
         LrsSecuencia.MoveFirst
 
         Do While Not LrsSecuencia.EOF
            LstrMensaje = LstrMensaje & LrsSecuencia!salespoint & " [" & LrsSecuencia!TerminalName & "]" & Chr(13)
            LrsSecuencia.MoveNext
         Loop
         Animation1.Stop
         MsgBox LstrMensaje, vbDefaultButton1 + vbInformation, "Mensaje"
         Set LrsSecuencia = Nothing
         Unload Me
         Exit Sub
    End If
    
    
    If RS1.EOF Then
       Animation1.Stop
       MsgBox "No existen Ventas para el Turno " & lblTurno.Text, vbDefaultButton1 + vbExclamation, "Cierre X"
       Animation1.Play
       Call obj.Actualizar_Datos_LuegodeCierreX(lblCaja.Text, 2, lblTurno.Text, lblFecha.Text, Empty)
       
       Screen.MousePointer = 0
       MDestruye_Objetos
       Unload Me
       Exit Sub
    End If
    
    Call obj.Actualizar_Datos_LuegodeCierreX(lblCaja.Text, 2, lblTurno.Text, lblFecha.Text, Empty)

    Call GImprimeCierre(0, 0, Empty, GstrSimboloMonedaBase, GstrSimboloMonedaExt, 40, GintDecResultado, RS5, RS1, RS2, RS3, RS4, lblTurno.Text)
    
    MDestruye_Objetos
    Screen.MousePointer = 0
    
    Me.Hide
    MsgBox "Cierre X generado con éxito", vbInformation, "Cierre X"
    End
    
End If
'***************************************

'MDestruye_Objetos

'Screen.MousePointer = 0

'    Me.Hide
'    MsgBox "Cierre X generado con éxito", vbInformation, "Cierre X"
'    Unload Me

Exit Sub
TrataError:
    Screen.MousePointer = 0
    MDestruye_Objetos
    Me.Hide
    MsgBox Err.Description, vbCritical, "Error Generando Cierre X"
    Unload Me
End Sub

Private Sub cmdAceptar_GotFocus()
 
  Image5.Visible = False
  Image6.Visible = True
  Image7.Visible = False
 
End Sub

Private Sub cmdAceptar_LostFocus()
  Image6.Visible = False
End Sub

Private Sub cmdCancelar_Click()
 Unload Me
End Sub

Private Sub cmdcancelar_GotFocus()
  
  Image5.Visible = False
  Image6.Visible = False
  Image7.Visible = True

End Sub

Private Sub cmdcancelar_LostFocus()
  Image7.Visible = False
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
 If KeyAscii = 27 Then
    Unload Me
 End If
End Sub

Private Sub Form_Load()

sknCierreX.LoadSkin (App.Path & "\Skins\" & gstrSkin)
sknCierreX.ApplySkin (Me.hWnd)

    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2
    Me.Height = 4400
    
    KeyPreview = True
    
    Set MobjVentaPlaya = New DB_OP_FACTURACION.C_VENTASPLAYA
    Set MobjSetup = New UTIL_SETUP.C_SETUP
    Set obj = New DB_OP_FACTURACION.C_CIERRE
    
    lblCaja.Text = GstrPuntodeVenta
    
    'OBTENGO LAS CARAS CONFIGURADAS AL PUNTO DE VENTAS **** 7777**7*7*7*777****77*******
    Set RS_CARAS_POR_PTOVTA = New ADODB.Recordset
    Set RS_CARAS_POR_PTOVTA = obj.ObtenerCarasdePtovta(lblCaja.Text)
    

    'lblfecha.Caption = Format(GDatFechaProcesoVentas, "DD/MM/YYYY")
         
    lblFecha.Text = Format(MobjSetup.ObtenerSetupVentas!DATEPROCESALES, "DD/MM/YYYY")
         
    lblTurno.Text = MobjVentaPlaya.ObtenerTurnoActual
        
    'Establecemos la conexion con GASBOY para ver si existen transacciones pendientes
    
    If GIntVentaAutoCombust = 1 Then
       Set Mcon = New ADODB.Connection
       Mcon.Provider = "MSDASQL"
       Mcon.ConnectionString = Trim(GSTRCADENACONECTA) '"FILEDSN=GASBOY"
       Mcon.Open
    End If
   
End Sub

Private Sub MDestruye_Objetos()
Set RS1 = Nothing
Set RS2 = Nothing
Set RS3 = Nothing
Set RS4 = Nothing
Set RS5 = Nothing
Set obj = Nothing

Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Animation1.AutoPlay = False
Animation1.Stop
Animation1.Visible = False
Me.Height = 4400
Close #1
End Sub

Private Function Ver_Transacciones_Pendientes(rsTrans As ADODB.Recordset) As Integer
 
    Dim StrSql As String
    Dim rs As ADODB.Recordset
    
On Error GoTo errhandler

        Ver_Transacciones_Pendientes = 2 ' se asume inicialmente todo bien
        
        If GIntVentaAutoCombust = 0 Then ' Si la Venta es Manual
           Ver_Transacciones_Pendientes = 2 ' se asume inicialmente todo bien
           Exit Function
        End If
        
        If Not rsTrans.EOF Then
            While Not rsTrans.EOF
               '' StrSql = "Select * from tran where estado<>'CANCEL'"
                
            Cad = "id_surtido= " & Trim(Str(rsTrans!side)) & ""
                StrSql = " Select * FROM ventadia WHERE ESTADO!='CANCEL' AND " & Cad & "" & _
                          " Order by Fecha,Hora ASC"
                          
                ''StrSql = "Select * from tran" & rsTrans!side & " where estado<>'CANCEL'"
                Set rs = New ADODB.Recordset
                
                rs.Open StrSql, Mcon, adOpenStatic
                
                ' si hay alguna transaccion pendiente
                If Not rs.EOF Then
                        ' se procede a verificar transacciones en OP_TRAN
                        If Not obj.Tran_Facturado(rs) Then
                            Ver_Transacciones_Pendientes = 1  'Revisar
                            Exit Function
                        End If
                End If
                
                Set rs = Nothing
                
                rsTrans.MoveNext
            Wend
        Else
            Ver_Transacciones_Pendientes = 0
        End If
        
        Exit Function
    
errhandler:
    Ver_Transacciones_Pendientes = 3
    MsgBox "Error - " & Err.Description, vbCritical, "Error"
End Function

Private Sub Form_Unload(Cancel As Integer)

Set Mcon = Nothing
Set MobjSetup = Nothing

End Sub

Private Sub optImpresora_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then
     ccmdCierreXVendedor.SetFocus
  End If
End Sub

Private Sub optPantalla_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then
     ccmdCierreXVendedor.SetFocus
  End If
End Sub

