VERSION 5.00
Begin VB.Form FCierrez 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   5025
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6750
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5025
   ScaleWidth      =   6750
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton CMD_ACEPTAR 
      Caption         =   "Aceptar"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   4710
      Picture         =   "FCierrezTienda.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   9
      Tag             =   "R ASDASD"
      Top             =   3000
      Width           =   1860
   End
   Begin VB.CommandButton CMD_CANCELAR 
      Cancel          =   -1  'True
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   4710
      Picture         =   "FCierrezTienda.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   3960
      Width           =   1860
   End
   Begin VB.Frame Frame2 
      Caption         =   "Imprimir Por"
      Height          =   1830
      Left            =   135
      TabIndex        =   5
      Top             =   2940
      Width           =   4155
      Begin VB.OptionButton optimpresora 
         Caption         =   "Impresora"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   885
         Left            =   285
         Picture         =   "FCierrezTienda.frx":0614
         TabIndex        =   7
         Top             =   870
         Width           =   1605
      End
      Begin VB.OptionButton optpantalla 
         Caption         =   "Pantalla"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   315
         TabIndex        =   6
         Top             =   390
         Value           =   -1  'True
         Width           =   1860
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Datos"
      Height          =   1575
      Left            =   135
      TabIndex        =   0
      Top             =   1215
      Width           =   6420
      Begin VB.Label lblfechaactual 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   15.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   1440
         TabIndex        =   4
         Top             =   855
         Width           =   3360
      End
      Begin VB.Label Label2 
         Caption         =   "Fecha Actual"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   15.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   150
         TabIndex        =   3
         Top             =   855
         Width           =   1245
      End
      Begin VB.Label Label1 
         Caption         =   "Caja"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   15.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   195
         TabIndex        =   2
         Top             =   330
         Width           =   645
      End
      Begin VB.Label lblcaja 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   15.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   345
         Left            =   1440
         TabIndex        =   1
         Top             =   345
         Width           =   3345
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   4320
      Top             =   2880
   End
   Begin VB.Shape Shape1 
      Height          =   960
      Left            =   135
      Top             =   135
      Width           =   6450
   End
   Begin VB.Label Label3 
      Caption         =   "ESTE PROCESO IMPRIME EL TOTAL DE VENTAS DEL DIA POR CAJA. SOLO DEBE EJECUTARSE AL FINALIZAR LAS VENTAS DEL DIA"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   780
      Left            =   270
      TabIndex        =   10
      Top             =   225
      Width           =   6180
   End
End
Attribute VB_Name = "FCierrez"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private MobjVentaPlaya As DB_OP_FACTURACION.C_VENTASPLAYA
Private MobjDispensador As DB_UT_MANTENIMIENTOS.C_DISPENSADORES
Private MrsDispensador As ADODB.Recordset

Private MobjCierrez As DB_OP_FACTURACION.C_CIERRES

Private Sub CMD_ACEPTAR_Click()
'On Error GoTo errhandler

    Dim IntVerificacionTrans As Integer
    
    Set MobjCierrez = New DB_OP_FACTURACION.C_CIERRES
    
    Screen.MousePointer = vbHourglass

                                        '¸------> Lugar(1=Tienda)
    Call MobjCierrez.Cargar_Datos_Cierre(1, lblcaja.Caption, 0, GstrCodigoVENDEDOR, Str(GDatFechaProcesoVentas), 2)
                   'Turno Actual(en Tienda no importa) <-----'                     Tipo de Cierre (2=Zeta)<------'
                  
    'Call MobjCierrez.Cargar_Datos_Cierre(2, "PTOVTA02", 0, "GUS", "27/12/2002", 2)
    
    IntVerificacionTrans = MobjCierrez.Ver_Transacciones_Pendientes
    Select Case IntVerificacionTrans
        Case 0: ' no puede realizarse cierre(ni pantalla , ni impresora)
        Case 1: ' existen transacciones pendiente
                ' 2 : por pantalla  <-------------------------------¸
                Call MobjCierrez.Imprimir_CierreX(GintDecResultado, 2)
                Call MobjCierrez.MensajeOK
        Case 2: ' no hay transacciones pendientes ==> OK !
            If optimpresora.Value = True Then
                ' 1 : por impresora  <------------------------------¸
                Call MobjCierrez.Imprimir_CierreX(GintDecResultado, 1)
                ' actualiza el campo STKCLOSEDX=1 si no hubo fallas
                Call MobjCierrez.Actualizar_Datos_LuegodeCierreZ
                Call MobjCierrez.MensajeOK
            Else
                ' 2 : por pantalla  <-------------------------------¸
                Call MobjCierrez.Imprimir_CierreX(GintDecResultado, 2)
                Call MobjCierrez.MensajeOK
            End If
    End Select
    
    Screen.MousePointer = vbDefault
    
    Exit Sub
errhandler:
    Screen.MousePointer = vbDefault
    MsgBox MensajedeError(Err.Number, Err.Description), vbDefaultButton1 + vbCritical, "Error"
End Sub

Private Sub CMD_CANCELAR_Click()
 Unload Me
End Sub

Private Sub Form_Load()
  
  Me.Left = (Screen.Width - Me.Width) / 2
  Me.Top = (Screen.Height - Me.Height) / 2
  
  
  Set MobjVentaPlaya = New DB_OP_FACTURACION.C_VENTASPLAYA
  Set MobjDispensador = New DB_UT_MANTENIMIENTOS.C_DISPENSADORES
  Me.Caption = "Cierre Z                                                Fecha Proceso [" & GDatFechaProcesoVentas & "]"
  lblfechaactual.Caption = Date & " " & Time
  lblcaja.Caption = GstrPuntodeVenta
 
End Sub

Private Sub Form_Unload(Cancel As Integer)
  
  Set MobjVentaPlaya = Nothing
  Set MobjDispensador = Nothing
  
End Sub

Private Sub Timer1_Timer()
  lblfechaactual.Caption = Date & " " & Time
End Sub



