VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{69F9D01E-F1DE-11D4-9536-002018603DA2}#7.0#0"; "ControlNumber.ocx"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{C4DED68B-C40F-11D6-AD1A-000795CA0957}#50.0#0"; "pry_list.ocx"
Begin VB.Form FReimpresionCierre 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Reimpresion de Cierres Z"
   ClientHeight    =   6300
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9795
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   6300
   ScaleWidth      =   9795
   Begin TabDlg.SSTab SSTab1 
      Height          =   6255
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   9795
      _ExtentX        =   17277
      _ExtentY        =   11033
      _Version        =   393216
      Tabs            =   1
      TabsPerRow      =   1
      TabHeight       =   520
      TabCaption(0)   =   "Tab 0"
      TabPicture(0)   =   "FReimpresionCierre.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Shape1"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Label1"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Shape2"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "Label2"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).Control(4)=   "Shape3"
      Tab(0).Control(4).Enabled=   0   'False
      Tab(0).Control(5)=   "Label3"
      Tab(0).Control(5).Enabled=   0   'False
      Tab(0).Control(6)=   "Label4"
      Tab(0).Control(6).Enabled=   0   'False
      Tab(0).Control(7)=   "Label5"
      Tab(0).Control(7).Enabled=   0   'False
      Tab(0).Control(8)=   "Shape4"
      Tab(0).Control(8).Enabled=   0   'False
      Tab(0).Control(9)=   "Line1"
      Tab(0).Control(9).Enabled=   0   'False
      Tab(0).Control(10)=   "Label6"
      Tab(0).Control(10).Enabled=   0   'False
      Tab(0).Control(11)=   "Image1"
      Tab(0).Control(11).Enabled=   0   'False
      Tab(0).Control(12)=   "lblestacion"
      Tab(0).Control(12).Enabled=   0   'False
      Tab(0).Control(13)=   "lsEstacion"
      Tab(0).Control(13).Enabled=   0   'False
      Tab(0).Control(14)=   "dtcEstacion"
      Tab(0).Control(14).Enabled=   0   'False
      Tab(0).Control(15)=   "dtpdesde"
      Tab(0).Control(15).Enabled=   0   'False
      Tab(0).Control(16)=   "dtphasta"
      Tab(0).Control(16).Enabled=   0   'False
      Tab(0).Control(17)=   "clMinutos"
      Tab(0).Control(17).Enabled=   0   'False
      Tab(0).Control(18)=   "optPantalla"
      Tab(0).Control(18).Enabled=   0   'False
      Tab(0).Control(19)=   "optImpresora"
      Tab(0).Control(19).Enabled=   0   'False
      Tab(0).Control(20)=   "cmdIniciar"
      Tab(0).Control(20).Enabled=   0   'False
      Tab(0).Control(21)=   "cmdSalir"
      Tab(0).Control(21).Enabled=   0   'False
      Tab(0).Control(22)=   "lstmensaje"
      Tab(0).Control(22).Enabled=   0   'False
      Tab(0).ControlCount=   23
      Begin VB.ListBox lstmensaje 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   450
         ItemData        =   "FReimpresionCierre.frx":001C
         Left            =   2970
         List            =   "FReimpresionCierre.frx":0023
         TabIndex        =   17
         Top             =   5430
         Width           =   6555
      End
      Begin VB.CommandButton cmdSalir 
         Caption         =   "&Salir"
         Height          =   915
         Left            =   1500
         Picture         =   "FReimpresionCierre.frx":0031
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   4980
         Width           =   1065
      End
      Begin VB.CommandButton cmdIniciar 
         Caption         =   "&Iniciar"
         Height          =   915
         Left            =   420
         Picture         =   "FReimpresionCierre.frx":033B
         Style           =   1  'Graphical
         TabIndex        =   13
         Top             =   4980
         Width           =   1065
      End
      Begin VB.OptionButton optImpresora 
         Caption         =   "Impresora"
         Height          =   225
         Left            =   810
         TabIndex        =   12
         Top             =   2700
         Width           =   1125
      End
      Begin VB.OptionButton optPantalla 
         Caption         =   "Pantalla"
         Height          =   255
         Left            =   810
         TabIndex        =   11
         Top             =   2370
         Value           =   -1  'True
         Width           =   1215
      End
      Begin MiControl.CtrlNumber clMinutos 
         Height          =   345
         Left            =   1650
         TabIndex        =   10
         Top             =   4440
         Width           =   795
         _ExtentX        =   1402
         _ExtentY        =   609
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin MSComCtl2.DTPicker dtphasta 
         Height          =   345
         Left            =   1140
         TabIndex        =   8
         Top             =   3750
         Width           =   1365
         _ExtentX        =   2408
         _ExtentY        =   609
         _Version        =   393216
         Format          =   16842753
         CurrentDate     =   37645
      End
      Begin MSComCtl2.DTPicker dtpdesde 
         Height          =   345
         Left            =   1140
         TabIndex        =   7
         Top             =   3270
         Width           =   1365
         _ExtentX        =   2408
         _ExtentY        =   609
         _Version        =   393216
         Format          =   16842753
         CurrentDate     =   37645
      End
      Begin MSDataListLib.DataCombo dtcEstacion 
         Height          =   315
         Left            =   4980
         TabIndex        =   4
         Top             =   1350
         Width           =   3885
         _ExtentX        =   6853
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   "DataCombo1"
      End
      Begin pry_list.ctrl_listarray lsEstacion 
         Height          =   2655
         Left            =   3300
         TabIndex        =   1
         Top             =   2400
         Width           =   5805
         _ExtentX        =   10239
         _ExtentY        =   4683
      End
      Begin VB.Label lblestacion 
         Alignment       =   1  'Right Justify
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   4140
         TabIndex        =   16
         Top             =   1350
         Width           =   825
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   300
         Picture         =   "FReimpresionCierre.frx":0645
         Top             =   270
         Width           =   480
      End
      Begin VB.Label Label6 
         Caption         =   "REIMPRESION DE CIERRES Z"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   870
         TabIndex        =   15
         Top             =   300
         Width           =   5565
      End
      Begin VB.Line Line1 
         X1              =   900
         X2              =   9420
         Y1              =   840
         Y2              =   840
      End
      Begin VB.Shape Shape4 
         Height          =   825
         Left            =   270
         Top             =   2220
         Width           =   2625
      End
      Begin VB.Label Label5 
         Caption         =   "Minutos después del ültimo Ticket :"
         Height          =   405
         Left            =   540
         TabIndex        =   9
         Top             =   4230
         Width           =   1545
      End
      Begin VB.Label Label4 
         Caption         =   "Hasta :"
         Height          =   315
         Left            =   510
         TabIndex        =   6
         Top             =   3840
         Width           =   675
      End
      Begin VB.Label Label3 
         Caption         =   "Desde :"
         Height          =   255
         Left            =   510
         TabIndex        =   5
         Top             =   3360
         Width           =   645
      End
      Begin VB.Shape Shape3 
         Height          =   1785
         Left            =   270
         Top             =   3120
         Width           =   2625
      End
      Begin VB.Label Label2 
         Caption         =   "Estación :"
         Height          =   285
         Left            =   3300
         TabIndex        =   3
         Top             =   1410
         Width           =   825
      End
      Begin VB.Shape Shape2 
         Height          =   615
         Left            =   2970
         Top             =   1230
         Width           =   6525
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "PUNTOS DE VENTAS"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   3240
         TabIndex        =   2
         Top             =   2100
         Width           =   6045
      End
      Begin VB.Shape Shape1 
         Height          =   3375
         Left            =   2970
         Top             =   1890
         Width           =   6525
      End
   End
End
Attribute VB_Name = "FReimpresionCierre"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' VISTAS : VW_RCIERREZ01
' STORED : OP_R*


Option Explicit

Dim StrFechaIni As String
Dim StrFechaFin As String

Dim IntMinutos As Integer

Dim StrEmpresa As String
Dim StrCabecera As String
Dim StrResVenta As String
Dim StrResTipoPago  As String
Dim StrResCategoria As String
Dim StrResProducto As String
Dim StrResVendedor As String
Dim StrResCara As String
Dim StrSalto As String

' VARIABLE PARA SABER SI ES CIERREX O CIERREZ
' 1 : CierreX
' 2 : CierreZ
Dim IntTipoCierre As Integer

' VARIABLE PARA SABER SI ES TIENDA O PLAYA
' 1 : Tienda
' 2 : Playa
Dim IntLugar As Integer

' VARIABLES DE PUNTO DE VENTA,VENDEDOR y FECHA DE CIERRE (FECHA DE PROCESO)
Dim StrSite As String
Dim StrNroPtoVta As String
Dim StrSalesPerId As String
Dim StrFechaCierre As String
Dim IntTurno As Integer

' DATOS DE IMPRESORA
Dim IntNroSaltosLineas As Integer
Dim StrCodCorte As String
Dim IntAnchoTicket As Integer

' LINEA DE SEPARACION
Dim StrLineaSeparacion As String

' variables de cabecera de cierre
Dim StrSerieMaqReg As String
Dim StrFecha As String
Dim DblMontoTipoCambio As Double
Dim IntNroTransacciones As Integer
Dim DblTicketBolIni As Double
Dim DblTicketFacIni As Double
Dim DblValorVta As Double
Dim DblVtaNoAfecta As Double
Dim DblIGV As Double
Dim DblVtaTotal As Double
Dim IntNroTicketAnul As Integer
Dim DblTotalTicketAnul As Double
Dim DblGranTotal As Double
Dim IntNroZeta As Integer
'dim IntTurno As Integer

' variables de resumen de ventas
Dim DblTotalTicketBol As Double
Dim DblTotalTicketFac As Double
Dim DblTotalGral As Double

' variables de resumen de tipos de pago
Dim DblEfectivo As Double
Dim DblVueltoEfectivo As Double
Dim DblNetoEfectivo As Double

Dim DblTarjeta As Double
Dim DblVueltoTarjeta As Double
Dim DblNetoTarjeta As Double

Dim DblVale As Double
Dim DblVueltoVale As Double
Dim DblNetoVale As Double

' variables para monedas
Dim StrMdaBase As String
Dim StrMdaCaja As String
Dim StrSimbMdaCaja As String
Dim StrSimbMdaExt As String

' cabeceras de ticket
Dim StrCab1 As String, StrCab2 As String, StrCab3 As String, StrCab4 As String, _
    StrCab5 As String

' variable de comprobacion de error
Dim BlnOK As Boolean

Public Sub salir_formulario()
Unload Me
End Sub

Sub Limpiar_Variables()
On Error GoTo eLimpiar
    StrEmpresa = ""
    StrCabecera = ""
    StrResVenta = ""
    StrResTipoPago = ""
    StrResCategoria = ""
    StrResProducto = ""
    StrResVendedor = ""
    StrResCara = ""

    IntTipoCierre = 2 ' cierre z
    'StrSite = ""
    
    ' VARIABLE PARA SABER SI ES TIENDA O PLAYA
    ' 1 : Tienda
    ' 2 : Playa
    IntLugar = 0 ' Tienda
    
    'StrNroPtoVta = ""
    StrSalesPerId = ""
    'StrFechaCierre = ""
    IntTurno = 0 ' para tiendas no importa el turno
'   DblMontoTipoCambio = 0
    BlnOK = True ' inicialmente todo bien
    
    
    ' DATOS DE IMPRESORA
'    IntNroSaltosLineas = 0
'    StrCodCorte = ""
'    IntAnchoTicket = 0
    
    ' LINEA DE SEPARACION
'    StrLineaSeparacion = ""
    
    ' variables de cabecera de cierre
    StrSerieMaqReg = ""
    'StrFecha = ""
    IntNroTransacciones = 0
    DblTicketBolIni = 0
    DblTicketFacIni = 0
    DblValorVta = 0
    DblVtaNoAfecta = 0
    DblIGV = 0
    DblVtaTotal = 0
    IntNroTicketAnul = 0
    DblTotalTicketAnul = 0
    DblGranTotal = 0
    IntNroZeta = 0
    
    ' variables de resumen de ventas
    DblTotalTicketBol = 0
    DblTotalTicketFac = 0
    DblTotalGral = 0
    
    ' variables de resumen de tipos de pago
    DblEfectivo = 0
    DblVueltoEfectivo = 0
    DblNetoEfectivo = 0
    
    DblTarjeta = 0
    DblVueltoTarjeta = 0
    DblNetoTarjeta = 0
    
    DblVale = 0
    DblVueltoVale = 0
    DblNetoVale = 0
    
    ' variables para monedas
    StrMdaBase = ""
    StrMdaCaja = ""
    StrSimbMdaCaja = ""
    StrSimbMdaExt = ""
    
    ' cabeceras de ticket
    'StrCab1 = ""
    'StrCab2 = ""
    'StrCab3 = ""
    'StrCab4 = ""
    'StrCab5 = ""
    
    ' variable de comprobacion de error
    BlnOK = True
    Exit Sub
eLimpiar:
    MsgBox Err.Description, vbExclamation, "Error Nro " & CStr(Err.Number)
    
    
End Sub

Sub IniciarReimpresion()
On Error GoTo eIniciarReImpresion
    Dim nDias As Integer
    Dim i As Integer, j As Integer
    Dim StrCar As String
    
    Dim GintDecResultado As Integer
    Dim GintDecStock As Integer
    
        
    Dim StrNroPtoVtas As String
    
    GintDecResultado = 2
    GintDecStock = 2
    
    StrFechaIni = dtpDesde.Value
    StrFechaFin = dtpHasta.Value
    
    StrSite = Trim(Me.dtcEstacion.BoundText)
    
    StrNroPtoVtas = Me.lsEstacion.listar_codigos_seleccionados
    
    IntMinutos = Val(Me.clMinutos.Text)
    
    IntAnchoTicket = 40
    IntNroSaltosLineas = 3
    
    Call Crear_VW_RCierreZ(StrFechaIni, StrFechaFin, StrSite, StrNroPtoVtas)
    
    nDias = DateDiff("d", CDate(StrFechaIni), CDate(StrFechaFin))
    
    ' datos de cabecera de tickets
    Call Obtener_Cabeceras_Ticket(StrCab1, StrCab2, StrCab3, StrCab4, StrCab5)
    
    If optPantalla.Value Then Open "temp.txt" For Output As #1
    
    
    Me.lstmensaje.Clear
    Me.lstmensaje.AddItem "Iniciando reimpresión ..."
    Me.lstmensaje.ListIndex = Me.lstmensaje.ListCount - 1
    Me.lstmensaje.Refresh
    
    For i = 0 To nDias * 5000
    Next
    
    For i = 0 To nDias
    
        StrFechaCierre = DateAdd("d", i, CDate(StrFechaIni))
        
        DblMontoTipoCambio = Obtener_Tipo_Cambio(StrNroPtoVta, StrFechaCierre)
        
        For j = 1 To Len(StrNroPtoVtas) + 1
        
            StrCar = Mid(StrNroPtoVtas, j, 1)
            
            If StrCar <> "," And j < Len(StrNroPtoVtas) + 1 Then
                If StrCar <> "'" Then StrNroPtoVta = StrNroPtoVta & StrCar
            Else
                '***********************************
                
                Me.lstmensaje.AddItem "Generando... PtoVta : [" & UCase(StrNroPtoVta) & "] - Fecha de Proceso : [" & StrFechaCierre & "]"
                Me.lstmensaje.ListIndex = Me.lstmensaje.ListCount - 1
                Me.lstmensaje.Refresh
                
                ' Limpiando variables
                Limpiar_Variables
                
                ' colocando el tipo de cierre a reimprimir
                IntTipoCierre = 2 ' cierre z
                
                ' numero de lineas para salto
                IntNroSaltosLineas = 10
                
                ' colocar el tipo de negocio correspondiente al punto de venta
                IntLugar = IIf(Tipo_Negocio(StrNroPtoVta) = 1, 2, 1)
                
                ' por pantalla
                If optPantalla.Value Then
                    Call Imprimir_Cierre(IntTipoCierre, IntLugar, StrNroPtoVta, _
                        StrSalesPerId, StrFechaCierre, IntTurno, IntNroSaltosLineas, _
                        StrCodCorte, IntAnchoTicket, StrLineaSeparacion, StrSerieMaqReg, _
                        StrFecha, DblMontoTipoCambio, IntNroTransacciones, DblTicketBolIni, _
                        DblTicketFacIni, DblValorVta, DblVtaNoAfecta, DblIGV, DblVtaTotal, _
                        IntNroTicketAnul, DblTotalTicketAnul, DblGranTotal, IntNroZeta, _
                        DblTotalTicketBol, DblTotalTicketFac, DblTotalGral, _
                        DblEfectivo, DblVueltoEfectivo, DblNetoEfectivo, DblTarjeta, _
                        DblVueltoTarjeta, DblNetoTarjeta, DblVale, DblVueltoVale, _
                        DblNetoVale, StrMdaBase, StrMdaCaja, StrSimbMdaCaja, StrSimbMdaExt, _
                        StrCab1, StrCab2, StrCab3, StrCab4, StrCab5, BlnOK, GintDecResultado, GintDecStock, _
                        StrEmpresa, StrCabecera, StrResVenta, StrResTipoPago, StrResCategoria, _
                        StrResProducto, StrResVendedor, StrResCara, StrSalto, StrFechaIni, StrFechaFin, IntMinutos)
                
                    'Open "temp.txt" For Output As #1
                        If Trim(StrEmpresa) <> "" Then Print #1, StrEmpresa
                        If Trim(StrCabecera) <> "" Then Print #1, StrCabecera
                        If Trim(StrResVenta) <> "" Then Print #1, StrResVenta
                        If Trim(StrResTipoPago) <> "" Then Print #1, StrResTipoPago
                        If Trim(StrResCategoria) <> "" Then Print #1, StrResCategoria
                        If Trim(StrResProducto) <> "" Then Print #1, StrResProducto
                        If Trim(StrResVendedor) <> "" Then Print #1, StrResVendedor
                        If Trim(StrResCara) <> "" Then Print #1, StrResCara
                        If Trim(StrSalto) <> "" Then Print #1, StrSalto
                    'Close #1
                    Me.lstmensaje.AddItem "Imprimiendo ... "
                    Me.lstmensaje.ListIndex = Me.lstmensaje.ListCount - 1
                    Me.lstmensaje.Refresh
                End If
                
                ' por impresora
                If optImpresora.Value Then
                    Call Imprimir_Cierre(IntTipoCierre, IntLugar, StrNroPtoVta, _
                        StrSalesPerId, StrFechaCierre, IntTurno, IntNroSaltosLineas, _
                        StrCodCorte, IntAnchoTicket, StrLineaSeparacion, StrSerieMaqReg, _
                        StrFecha, DblMontoTipoCambio, IntNroTransacciones, DblTicketBolIni, _
                        DblTicketFacIni, DblValorVta, DblVtaNoAfecta, DblIGV, DblVtaTotal, _
                        IntNroTicketAnul, DblTotalTicketAnul, DblGranTotal, IntNroZeta, _
                        DblTotalTicketBol, DblTotalTicketFac, DblTotalGral, _
                        DblEfectivo, DblVueltoEfectivo, DblNetoEfectivo, DblTarjeta, _
                        DblVueltoTarjeta, DblNetoTarjeta, DblVale, DblVueltoVale, _
                        DblNetoVale, StrMdaBase, StrMdaCaja, StrSimbMdaCaja, StrSimbMdaExt, _
                        StrCab1, StrCab2, StrCab3, StrCab4, StrCab5, BlnOK, GintDecResultado, GintDecStock, _
                        StrEmpresa, StrCabecera, StrResVenta, StrResTipoPago, StrResCategoria, _
                        StrResProducto, StrResVendedor, StrResCara, StrSalto, StrFechaIni, StrFechaFin, IntMinutos)
        
                    If Trim(StrEmpresa) <> "" Then Printer.Print StrEmpresa
                    If Trim(StrCabecera) <> "" Then Printer.Print StrCabecera
                    If Trim(StrResVenta) <> "" Then Printer.Print StrResVenta
                    If Trim(StrResTipoPago) <> "" Then Printer.Print StrResTipoPago
                    If Trim(StrResCategoria) <> "" Then Printer.Print StrResCategoria
                    If Trim(StrResProducto) <> "" Then Printer.Print StrResProducto
                    If Trim(StrResVendedor) <> "" Then Printer.Print StrResVendedor
                    If Trim(StrResCara) <> "" Then Printer.Print StrResCara
                    If Trim(StrSalto) = "" Then
                        If Trim(StrSalto) <> "" Then Printer.Print StrSalto
                    End If
                    Printer.EndDoc
                End If
                StrNroPtoVta = ""
                '***********************************
            End If
        Next
    Next
    
    Me.lstmensaje.AddItem "Fin de Reimpresión."
    Me.lstmensaje.ListIndex = Me.lstmensaje.ListCount - 1
    Me.lstmensaje.Refresh
    
    If optPantalla.Value Then
        Close #1
        Shell "notepad.exe temp.txt", vbNormalFocus
    End If
Exit Sub
eIniciarReImpresion:
MsgBox Err.Description, vbExclamation, "Error Nro " & CStr(Err.Number)
End Sub

Public Sub CargaDataCombo(objDataCombo As DataCombo, rsSource As ADODB.Recordset, istrCampo1 As String, istrCampo2 As String)
On Error GoTo eCargaDataCombo
    Set objDataCombo.DataSource = rsSource
    objDataCombo.DataField = istrCampo2
    Set objDataCombo.RowSource = rsSource
    objDataCombo.ListField = istrCampo2
    objDataCombo.BoundColumn = istrCampo1
    
    If Not rsSource.EOF Then
        objDataCombo.BoundText = rsSource.Fields(istrCampo2)
    End If
Exit Sub
eCargaDataCombo:
MsgBox Err.Description, vbExclamation, "Error Nro " & CStr(Err.Number)
End Sub

Sub CargarListaPtoVta(StrSiteId As String)
On Error GoTo eOrror
    Me.lsEstacion.llena_lista ListarPtoVtas(StrSiteId)
    Exit Sub
eOrror:
    MsgBox Err.Description, vbExclamation, "Error Nro " & CStr(Err.Number)
    
End Sub

Sub Inicializar()
On Error GoTo eInicializar
    Me.CargaDataCombo Me.dtcEstacion, ListarAlmacenes, "SiteId", "Name"
    CargarListaPtoVta (dtcEstacion.BoundText)
    Exit Sub
eInicializar:
    MsgBox Err.Description, vbExclamation, "Error Nro " & CStr(Err.Number)
End Sub

Private Sub clMinutos_change()
    Me.cmdIniciar.SetFocus
End Sub

Private Sub cmdIniciar_Click()
On Error GoTo eIniciar
    DoEvents
    Screen.MousePointer = vbHourglass
    If Valida_Parametros Then
        Call IniciarReimpresion
    End If
    Screen.MousePointer = vbDefault
Exit Sub
eIniciar:
MsgBox Err.Description, vbExclamation, "Error Nro " & CStr(Err.Number)
End Sub

Private Sub cmdSalir_Click()
    'Unload Me
    End
End Sub

Private Sub dtcEstacion_Change()
 Call CargarListaPtoVta(dtcEstacion.BoundText)
 Me.lblestacion.Caption = Trim(Me.dtcEstacion.BoundText)
End Sub

Private Sub dtpdesde_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        dtpHasta.SetFocus
    End If
End Sub

Private Sub dtphasta_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        Me.clMinutos.SetFocus
    End If
End Sub

Private Sub Form_Load()
    Call Inicializar
    dtpDesde.Value = Date
    dtpHasta.Value = Date
End Sub

Function Valida_Parametros() As Boolean
On Error GoTo eValidar
    Valida_Parametros = True
    
    If Val(Me.clMinutos.Text) = 0 Or Me.clMinutos.Text = "" Then
        MsgBox "Ingrese minutos despues de último ticket", vbExclamation, Me.Caption
        Valida_Parametros = False
        Exit Function
    End If
    If Me.lsEstacion.nseleccionados = 0 Then
        MsgBox "Selecicone al menos un elemento", vbExclamation, Me.Caption
        Valida_Parametros = False
        Exit Function
    End If
    If Me.dtpDesde.Value > Me.dtpHasta.Value Then
        MsgBox "Rango de Fechas de Procesos es incorrecto", vbExclamation, Me.Caption
        Valida_Parametros = False
        Exit Function
    End If
    Exit Function
eValidar:
    MsgBox Err.Description, vbExclamation, "Error Nro " & CStr(Err.Number)
End Function
