VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "Crystl32.OCX"
Object = "{C4DED68B-C40F-11D6-AD1A-000795CA0957}#50.0#0"; "pry_list.ocx"
Begin VB.Form FReporteVentasConVales 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Reporte de Ventas con Vales Credito/Adelanto  (05.190.00)"
   ClientHeight    =   6060
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   10695
   Icon            =   "0519000.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   6060
   ScaleWidth      =   10695
   Begin TabDlg.SSTab SSTab1 
      Height          =   6015
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   10695
      _ExtentX        =   18865
      _ExtentY        =   10610
      _Version        =   393216
      Tabs            =   2
      TabsPerRow      =   2
      TabHeight       =   520
      TabCaption(0)   =   "Datos Generales"
      TabPicture(0)   =   "0519000.frx":030A
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Line1"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Label5"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Image1"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "Label2"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).Control(4)=   "lblMoneda"
      Tab(0).Control(4).Enabled=   0   'False
      Tab(0).Control(5)=   "lblTipoPago"
      Tab(0).Control(5).Enabled=   0   'False
      Tab(0).Control(6)=   "Shape1"
      Tab(0).Control(6).Enabled=   0   'False
      Tab(0).Control(7)=   "lstCriterios"
      Tab(0).Control(7).Enabled=   0   'False
      Tab(0).Control(8)=   "dtcMoneda"
      Tab(0).Control(8).Enabled=   0   'False
      Tab(0).Control(9)=   "cmdGenerar"
      Tab(0).Control(9).Enabled=   0   'False
      Tab(0).Control(10)=   "Frame2"
      Tab(0).Control(10).Enabled=   0   'False
      Tab(0).Control(11)=   "Frame1"
      Tab(0).Control(11).Enabled=   0   'False
      Tab(0).Control(12)=   "crReporteVentasConValeB"
      Tab(0).Control(12).Enabled=   0   'False
      Tab(0).Control(13)=   "cmdSalir"
      Tab(0).Control(13).Enabled=   0   'False
      Tab(0).Control(14)=   "cmbTipoPago"
      Tab(0).Control(14).Enabled=   0   'False
      Tab(0).Control(15)=   "fratipodocu"
      Tab(0).Control(15).Enabled=   0   'False
      Tab(0).Control(16)=   "Frame3"
      Tab(0).Control(16).Enabled=   0   'False
      Tab(0).Control(17)=   "crReporteVentasConValeA"
      Tab(0).Control(17).Enabled=   0   'False
      Tab(0).Control(18)=   "crpNuevRptVentasConVale"
      Tab(0).Control(18).Enabled=   0   'False
      Tab(0).ControlCount=   19
      TabCaption(1)   =   "Almacenes"
      TabPicture(1)   =   "0519000.frx":0326
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "Label8"
      Tab(1).Control(1)=   "Label6"
      Tab(1).Control(2)=   "Line4"
      Tab(1).Control(3)=   "Line5"
      Tab(1).Control(4)=   "Image2"
      Tab(1).Control(5)=   "Shape2"
      Tab(1).Control(6)=   "Label1"
      Tab(1).Control(7)=   "lstAlmacen"
      Tab(1).Control(8)=   "cmdGenerar2"
      Tab(1).Control(9)=   "cmdSalir2"
      Tab(1).ControlCount=   10
      Begin Crystal.CrystalReport crpNuevRptVentasConVale 
         Left            =   3120
         Top             =   1440
         _ExtentX        =   741
         _ExtentY        =   741
         _Version        =   348160
         PrintFileLinesPerPage=   60
      End
      Begin Crystal.CrystalReport crReporteVentasConValeA 
         Left            =   2475
         Top             =   1800
         _ExtentX        =   741
         _ExtentY        =   741
         _Version        =   348160
         WindowControlBox=   -1  'True
         WindowMaxButton =   -1  'True
         WindowMinButton =   -1  'True
         PrintFileLinesPerPage=   60
      End
      Begin VB.Frame Frame3 
         Caption         =   "Estado"
         Height          =   735
         Left            =   240
         TabIndex        =   25
         Top             =   3960
         Width           =   2550
         Begin VB.ComboBox cmbestado 
            Height          =   315
            ItemData        =   "0519000.frx":0342
            Left            =   240
            List            =   "0519000.frx":034F
            Style           =   2  'Dropdown List
            TabIndex        =   26
            Top             =   240
            Width           =   2175
         End
      End
      Begin VB.Frame fratipodocu 
         Caption         =   "Ordenado por"
         Height          =   735
         Left            =   240
         TabIndex        =   24
         Top             =   4920
         Visible         =   0   'False
         Width           =   2550
         Begin VB.ComboBox cmbOrden 
            Height          =   315
            ItemData        =   "0519000.frx":0372
            Left            =   240
            List            =   "0519000.frx":0385
            Style           =   2  'Dropdown List
            TabIndex        =   27
            Top             =   240
            Width           =   2175
         End
      End
      Begin VB.ComboBox cmbTipoPago 
         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
         ItemData        =   "0519000.frx":03C5
         Left            =   6240
         List            =   "0519000.frx":03D2
         Style           =   2  'Dropdown List
         TabIndex        =   22
         Top             =   840
         Width           =   4215
      End
      Begin VB.CommandButton cmdSalir2 
         Cancel          =   -1  'True
         Caption         =   "&Salir"
         Height          =   855
         Left            =   -66000
         Picture         =   "0519000.frx":03FB
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   2760
         Width           =   1335
      End
      Begin VB.CommandButton cmdSalir 
         Caption         =   "&Salir"
         Height          =   855
         Left            =   9240
         Picture         =   "0519000.frx":0705
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   4800
         Width           =   1200
      End
      Begin Crystal.CrystalReport crReporteVentasConValeB 
         Left            =   2475
         Top             =   2475
         _ExtentX        =   741
         _ExtentY        =   741
         _Version        =   348160
         PrintFileLinesPerPage=   60
      End
      Begin VB.Frame Frame1 
         Caption         =   "Formato"
         Height          =   990
         Left            =   240
         TabIndex        =   15
         Top             =   1680
         Width           =   2550
         Begin VB.OptionButton optResumido 
            Caption         =   "Resumido"
            Height          =   255
            Left            =   420
            TabIndex        =   17
            Top             =   270
            Value           =   -1  'True
            Width           =   1095
         End
         Begin VB.OptionButton optDetallado 
            Caption         =   "Detallado"
            Height          =   255
            Left            =   420
            TabIndex        =   16
            Top             =   585
            Width           =   1095
         End
      End
      Begin VB.Frame Frame2 
         Caption         =   "Rango de Fechas"
         Height          =   1080
         Left            =   240
         TabIndex        =   10
         Top             =   2760
         Width           =   2550
         Begin MSComCtl2.DTPicker dtpFechaFin 
            Height          =   315
            Left            =   840
            TabIndex        =   11
            Top             =   675
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   556
            _Version        =   393216
            Format          =   20971521
            CurrentDate     =   37533
         End
         Begin MSComCtl2.DTPicker dtpFechaIni 
            Height          =   315
            Left            =   840
            TabIndex        =   12
            Top             =   315
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   556
            _Version        =   393216
            Format          =   20971521
            CurrentDate     =   37533
         End
         Begin VB.Label Label4 
            Caption         =   "Al"
            Height          =   195
            Left            =   480
            TabIndex        =   14
            Top             =   735
            Width           =   135
         End
         Begin VB.Label Label3 
            Caption         =   "Del"
            Height          =   195
            Left            =   480
            TabIndex        =   13
            Top             =   375
            Width           =   240
         End
      End
      Begin VB.CommandButton cmdGenerar 
         Caption         =   "&Generar"
         Height          =   855
         Left            =   8040
         Picture         =   "0519000.frx":0A0F
         Style           =   1  'Graphical
         TabIndex        =   9
         Top             =   4800
         Width           =   1200
      End
      Begin VB.CommandButton cmdGenerar2 
         Caption         =   "&Generar"
         Height          =   855
         Left            =   -66000
         Picture         =   "0519000.frx":0D19
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   1920
         Width           =   1335
      End
      Begin pry_list.ctrl_listarray lstAlmacen 
         Height          =   2295
         Left            =   -73080
         TabIndex        =   2
         Top             =   1620
         Width           =   6630
         _ExtentX        =   11695
         _ExtentY        =   4048
      End
      Begin MSDataListLib.DataCombo dtcMoneda 
         Height          =   315
         Left            =   1035
         TabIndex        =   18
         Top             =   1305
         Width           =   1755
         _ExtentX        =   3096
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin pry_list.ctrl_listarray lstCriterios 
         Height          =   2850
         Left            =   3120
         TabIndex        =   19
         Top             =   1800
         Width           =   7170
         _ExtentX        =   12647
         _ExtentY        =   5027
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H80000004&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H80000006&
         Height          =   3405
         Left            =   3000
         Top             =   1320
         Width           =   7470
      End
      Begin VB.Label lblTipoPago 
         AutoSize        =   -1  'True
         Caption         =   "Tipo  de Pago"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   6240
         TabIndex        =   23
         Top             =   600
         Width           =   1215
      End
      Begin VB.Label lblMoneda 
         AutoSize        =   -1  'True
         Caption         =   "Moneda"
         Height          =   195
         Left            =   240
         TabIndex        =   21
         Top             =   1365
         Width           =   585
      End
      Begin VB.Label Label2 
         Caption         =   "CLIENTES"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   6120
         TabIndex        =   20
         Top             =   1440
         Width           =   1005
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   240
         Picture         =   "0519000.frx":1023
         Top             =   600
         Width           =   480
      End
      Begin VB.Label Label5 
         Caption         =   "REPORTE DE VENTAS CON VALES CREDITO / ADELANTO"
         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            =   765
         TabIndex        =   7
         Top             =   720
         Width           =   5700
      End
      Begin VB.Label Label1 
         Caption         =   "ALMACENES"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   -70095
         TabIndex        =   6
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Shape Shape2 
         BackColor       =   &H80000004&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H80000006&
         Height          =   3000
         Left            =   -73380
         Top             =   1215
         Width           =   7185
      End
      Begin VB.Image Image2 
         Height          =   480
         Left            =   -74760
         Picture         =   "0519000.frx":132D
         Top             =   480
         Width           =   480
      End
      Begin VB.Line Line5 
         X1              =   -74760
         X2              =   -64560
         Y1              =   4500
         Y2              =   4500
      End
      Begin VB.Line Line4 
         X1              =   -74760
         X2              =   -64560
         Y1              =   960
         Y2              =   960
      End
      Begin VB.Line Line1 
         X1              =   240
         X2              =   6000
         Y1              =   1080
         Y2              =   1080
      End
      Begin VB.Label Label6 
         Caption         =   "REPORTE DE VENTAS CON TICKET GUIA / VALE INTERNO"
         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            =   -74235
         TabIndex        =   5
         Top             =   675
         Width           =   6450
      End
      Begin VB.Label Label8 
         Alignment       =   2  'Center
         Caption         =   "ALMACENES"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   -73020
         TabIndex        =   4
         Top             =   1350
         Width           =   6480
      End
   End
End
Attribute VB_Name = "FReporteVentasConVales"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'   PROGRAMADOR: EDGAR CANCHO RUIZ
'   REPORTE DE VENTAS CON VALES DE CREDITO

Option Explicit
Public pb_editar As Boolean
Public pb_agregar As Boolean
Public pb_primerregistro As Boolean
Public pb_ultimoregistro As Boolean

Public pbderecho_agregar As Boolean
Public pbderecho_consultar As Boolean
Public pbderecho_editar As Boolean
Public pbderecho_borrar As Boolean
Public pbderecho_imprimir As Boolean
Public pb_tiposcreen As String

Public GrecibeUbicacion As BookmarkEnum
Public GrecibeColumnaID As String
Public GrecibeColumnaOpcional As String

Public objAlmacen As DB_INV_MANTENIMIENTOS.C_ALMACEN
Public objClientes As DB_MA_MANTENIMIENTOS.C_CLIENTE
Public objMoneda  As DB_MA_MANTENIMIENTOS.C_MONEDA

Dim MstrCadena_Criterios As String
Dim MstrCadena_Almacenes As String
Dim MstrGrupo As String
Dim MintTodos_Alm As Integer
Dim MintTodos_Cri As Integer

Dim MstrFechaIni As String
Dim MstrFechaFin As String

Dim objCorrelativo As DB_CORRELATIVO.C_Correlativos
Dim lngCorrelativo As Long

Private Sub cmbTipoPago_Click()
  If cmbTipoPago.ListIndex = 1 Then
     cmbestado.ListIndex = 2
     cmbestado.Enabled = False
  Else
     cmbestado.ListIndex = 0
     cmbestado.Enabled = True
  End If
End Sub

Private Sub cmdGenerar_Click()
    lngCorrelativo = objCorrelativo.ObtenerCorrelativo(GCUSERID)
    imprimir
End Sub

Private Sub cmdGenerar2_Click()
    lngCorrelativo = objCorrelativo.ObtenerCorrelativo(GCUSERID)
    imprimir
End Sub

Private Sub cmdSalir_Click()
    Unload Me
End Sub

Public Sub actualizar_registro()
    
End Sub

Private Sub cmdSalir2_Click()
    Unload Me
End Sub

Private Sub Command1_Click()
MsgBox CStr(cmbTipoPago.ListIndex)
End Sub

Private Sub dtcMoneda_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        DTPFechaIni.SetFocus
    End If
End Sub

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

Private Sub Form_Activate()

    Call gactualizaopcion(pbderecho_agregar, pbderecho_editar, pbderecho_borrar, pbderecho_imprimir)
    Call gactualiza_barra(Me)
    'lineas nuevas
    If pbderecho_consultar = False Then
        Unload Me
    End If

End Sub

Private Sub Form_Initialize()
    'Call gHabilitarReg(Me, False)
End Sub

Private Sub Form_Load()
    'seguridad
    Call gseguridad(Me)
    
    If pbderecho_consultar Then
        InstanciaObjetos
        CargaListaCriterios
        CargaListaAlmacen
        Call CargaDataCombo(dtcMoneda, objMoneda.ListarMonedas, "CuryId", "Descr")
        
    Else

        MsgBox ("No tiene Derechos de Consultar en este formulario"), vbCritical + vbDefaultButton1, "Mensaje"
    End If
     
    DTPFechaIni.Value = Date
    DTPFechaFin.Value = Date
    dtcMoneda.BoundText = GstrCodMonedaBase
    cmbTipoPago.ListIndex = 0
    cmbOrden.ListIndex = 0
    cmbestado.ListIndex = 2 '@ Jorge: modificado
    
    Me.Top = 200
    Me.Left = (Screen.Width - Me.Width) / 2
     
 
End Sub

Function valida_datos()
   
    If GVDATO(dtcMoneda.Text) = Empty And dtcMoneda.Enabled Then
        valida_datos = False
        MsgBox "Ingrese Moneda", vbExclamation, "Falta Parámetro"
        SSTab1.Tab = 0
        dtcMoneda.SetFocus
        Exit Function
    End If

    If DTPFechaIni.Value > DTPFechaFin.Value Then
        valida_datos = False
        MsgBox "Rango de Fecha Incorrecto", vbExclamation, "Error de ingreso"
        SSTab1.Tab = 0
        DTPFechaIni.SetFocus
        Exit Function
    End If
    
    If lstCriterios.ndisponibles = 0 And lstCriterios.nseleccionados = 0 Then
        valida_datos = False
        MsgBox "No existen registros de Categorias o Sub Categorias", vbExclamation, "Error de ingreso"
        SSTab1.Tab = 0
        Exit Function
    End If
    
    If lstAlmacen.ndisponibles = 0 And lstAlmacen.nseleccionados = 0 Then
        valida_datos = False
        MsgBox "No existen registros de Almacenes", vbExclamation, "Error de ingreso"
        SSTab1.Tab = 0
        Exit Function
    End If
        
    ' PARA LOS CRITERIOS DE CLIENTES
    If lstCriterios.ndisponibles = 0 Or lstCriterios.nseleccionados = 0 Then
        MintTodos_Cri = 1
        MstrCadena_Criterios = " "
    Else
        MintTodos_Cri = 0
        If Len(lstCriterios.listar_codigos_seleccionados) > 255 Then
            valida_datos = False
            MsgBox "Selecione menos Tipos de Tarjetas o Seleccione Todos", vbExclamation, "Error de ingreso"
            SSTab1.Tab = 0
            Exit Function
        Else
            MstrCadena_Criterios = lstCriterios.listar_codigos_seleccionados
        End If
    End If
        
    ' PARA LOS ALMACENES
    If lstAlmacen.ndisponibles = 0 Or lstAlmacen.nseleccionados = 0 Then
        MintTodos_Alm = 1
        MstrCadena_Almacenes = " "
    Else
        MintTodos_Alm = 0
        If Len(lstAlmacen.listar_codigos_seleccionados) > 255 Then
            valida_datos = False
            MsgBox "Selecione menos Almacenes o Seleccione Todos", vbExclamation, "Error de ingreso"
            SSTab1.Tab = 1
            Exit Function
        Else
            MstrCadena_Almacenes = lstAlmacen.listar_codigos_seleccionados
        End If
    End If
    
    MstrFechaIni = CStr(Format(DTPFechaIni.Value, "YYYYMMdd"))
    MstrFechaFin = CStr(Format(DTPFechaFin.Value, "YYYYMMdd"))
    valida_datos = True
End Function

Sub salir_formulario()
    ' validar que no haya procesos pendientes
    ' si no hay problemas
    MDIFVENTAS.Toolbar1.Buttons(18).Caption = "Salir"    ' boton salir
    Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set objAlmacen = Nothing
    Set objClientes = Nothing
    Set objMoneda = Nothing
    Set objCorrelativo = Nothing
End Sub

Sub imprimir()

Dim StrEstado As String
Dim IntTodos As Integer

If Not valida_datos Then
    Exit Sub
End If
'@ Jorge: estado de documentos
If Trim(cmbestado.Text) = "Pendientes" Then
   StrEstado = "PE"
   IntTodos = 0
End If
If Trim(cmbestado.Text) = "Cancelados" Then
   StrEstado = "CA"
   IntTodos = 0
End If
If Trim(cmbestado.Text) = "Anulados" Then
   StrEstado = "AN"
   IntTodos = 0
End If
If Trim(cmbestado.Text) = "Todos" Then
   StrEstado = "TD"
   IntTodos = 1
End If


Screen.MousePointer = 11

    Dim strPago As String
    strPago = cmbTipoPago.Text
    
    If optResumido.Value Then
        If cmbTipoPago.ListIndex = 2 Then
            crpNuevRptVentasConVale.ReportFileName = GstrReportesVta + "rpt_ticket_vale.rpt"
            crpNuevRptVentasConVale.WindowTitle = "Reporte de Ventas con Vales Adelanto"
            crpNuevRptVentasConVale.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
            
            crpNuevRptVentasConVale.WindowState = crptMaximized
            crpNuevRptVentasConVale.WindowShowPrintSetupBtn = True
            
            crpNuevRptVentasConVale.StoredProcParam(0) = MstrFechaIni
'            crNuevRptVentasConVale.StoredProcParam(1) = MstrFechaFin
            
            crpNuevRptVentasConVale.Connect = "DSN=SIES"
        
            crpNuevRptVentasConVale.Action = 1
            crpNuevRptVentasConVale.Reset
        Else
        crReporteVentasConValeA.ReportFileName = GstrReportesVta + "rpt_VentasConVale_Res.rpt"
        
        crReporteVentasConValeA.WindowTitle = "Reporte de Ventas Con Vales"
        crReporteVentasConValeA.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
        crReporteVentasConValeA.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='05.190.00'"
        crReporteVentasConValeA.Formulas(3) = "formMoneda=stringvar strMoneda; strMoneda:='" & Trim(dtcMoneda.Text) & "'"
        crReporteVentasConValeA.Formulas(4) = "formFechaIni= datevar FechaIni; FechaIni:=date(" & Format(DTPFechaIni.Value, "YYYY,MM,dd") & ")"
        crReporteVentasConValeA.Formulas(5) = "formFechaFin= datevar FechaFin; FechaFin:=date(" & Format(DTPFechaFin.Value, "YYYY,MM,dd") & ")"
        crReporteVentasConValeA.Formulas(6) = "formNDStock=" & GintDecStock
        crReporteVentasConValeA.Formulas(7) = "formNDCosto=" & GintDecCosto
        crReporteVentasConValeA.Formulas(8) = "formNDMonto=" & GintDecResultado
        crReporteVentasConValeA.Formulas(9) = "formNDPrecio=" & GintDecPrecio
        crReporteVentasConValeA.Formulas(10) = "formPago=stringvar strPago;strPago:='" & strPago & "'"
        crReporteVentasConValeA.Formulas(11) = "formestado=stringvar strEstado;strEstado:='Estado : " & Trim(cmbestado.Text) & "'"
        
        crReporteVentasConValeA.WindowState = crptMaximized
        crReporteVentasConValeA.WindowShowPrintSetupBtn = True

        crReporteVentasConValeA.StoredProcParam(0) = MstrFechaIni
        crReporteVentasConValeA.StoredProcParam(1) = MstrFechaFin
        crReporteVentasConValeA.StoredProcParam(2) = dtcMoneda.BoundText
        crReporteVentasConValeA.StoredProcParam(3) = 1
        crReporteVentasConValeA.StoredProcParam(4) = MstrCadena_Almacenes
        crReporteVentasConValeA.StoredProcParam(5) = MintTodos_Alm
        crReporteVentasConValeA.StoredProcParam(6) = MstrCadena_Criterios
        crReporteVentasConValeA.StoredProcParam(7) = MintTodos_Cri
        crReporteVentasConValeA.StoredProcParam(8) = cmbTipoPago.ListIndex
        crReporteVentasConValeA.StoredProcParam(9) = StrEstado
        crReporteVentasConValeA.StoredProcParam(10) = IntTodos
        crReporteVentasConValeA.Connect = "DSN=SIES"
        
        crReporteVentasConValeA.Action = 1
        crReporteVentasConValeA.Reset
        End If
    Else
    
        ' Aquí se tiene que Modificar para filtrar correctamene si existen tickets con mas de un vale
        
    
    
        If Not objClientes.ExistenVentasConVariosVales(DTPFechaIni.Value, DTPFechaFin.Value, StrEstado, IntTodos) Then
         
            crReporteVentasConValeA.ReportFileName = GstrReportesVta + "rpt_VentasConVale_DetA.rpt"
            crReporteVentasConValeB.ReportFileName = GstrReportesVta + "rpt_VentasConVale_DetB.rpt"
            
    
            crReporteVentasConValeA.WindowTitle = "Reporte de Ventas Con Vales"
            crReporteVentasConValeA.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
            crReporteVentasConValeA.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='05.190.00'"
            crReporteVentasConValeA.Formulas(3) = "formMoneda=stringvar strMoneda; strMoneda:='" & Trim(dtcMoneda.Text) & "'"
            crReporteVentasConValeA.Formulas(4) = "formFechaIni= datevar FechaIni; FechaIni:=date(" & Format(DTPFechaIni.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeA.Formulas(5) = "formFechaFin= datevar FechaFin; FechaFin:=date(" & Format(DTPFechaFin.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeA.Formulas(6) = "formNDStock=" & GintDecStock
            crReporteVentasConValeA.Formulas(7) = "formNDCosto=" & GintDecCosto
            crReporteVentasConValeA.Formulas(8) = "formNDMonto=" & GintDecResultado
            crReporteVentasConValeA.Formulas(9) = "formNDPrecio=" & GintDecPrecio
            crReporteVentasConValeA.Formulas(10) = "formPago=stringvar strPago;strPago:='" & strPago & "'"
            crReporteVentasConValeA.Formulas(11) = "formestado=stringvar strEstado;strEstado:='Estado : " & Trim(cmbestado.Text) & "'"
            
            crReporteVentasConValeA.WindowState = crptMaximized
            crReporteVentasConValeA.WindowShowPrintSetupBtn = True
            
            crReporteVentasConValeA.StoredProcParam(0) = MstrFechaIni
            crReporteVentasConValeA.StoredProcParam(1) = MstrFechaFin
            crReporteVentasConValeA.StoredProcParam(2) = dtcMoneda.BoundText
            crReporteVentasConValeA.StoredProcParam(3) = 1
            crReporteVentasConValeA.StoredProcParam(4) = MstrCadena_Almacenes
            crReporteVentasConValeA.StoredProcParam(5) = MintTodos_Alm
            crReporteVentasConValeA.StoredProcParam(6) = MstrCadena_Criterios
            crReporteVentasConValeA.StoredProcParam(7) = MintTodos_Cri
            crReporteVentasConValeA.StoredProcParam(8) = cmbTipoPago.ListIndex
            crReporteVentasConValeA.StoredProcParam(9) = StrEstado
            crReporteVentasConValeA.StoredProcParam(10) = IntTodos
            
            crReporteVentasConValeA.Connect = "DSN=SIES"
            
            
            crReporteVentasConValeB.WindowTitle = "Reporte de Ventas Con Vales"
            crReporteVentasConValeB.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
            crReporteVentasConValeB.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='05.190.00'"
            crReporteVentasConValeB.Formulas(3) = "formMoneda=stringvar strMoneda; strMoneda:='" & Trim(dtcMoneda.Text) & "'"
            crReporteVentasConValeB.Formulas(4) = "formFechaIni= datevar FechaIni; FechaIni:=date(" & Format(DTPFechaIni.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeB.Formulas(5) = "formFechaFin= datevar FechaFin; FechaFin:=date(" & Format(DTPFechaFin.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeB.Formulas(6) = "formNDStock=" & GintDecStock
            crReporteVentasConValeB.Formulas(7) = "formNDCosto=" & GintDecCosto
            crReporteVentasConValeB.Formulas(8) = "formNDMonto=" & GintDecResultado
            crReporteVentasConValeB.Formulas(9) = "formNDPrecio=" & GintDecPrecio
            crReporteVentasConValeB.Formulas(10) = "formPago=stringvar strPago;strPago:='" & strPago & "'"
            crReporteVentasConValeB.Formulas(11) = "formestado=stringvar strEstado;strEstado:='Estado : " & Trim(cmbestado.Text) & "'"
            
            crReporteVentasConValeB.WindowState = crptMaximized
            crReporteVentasConValeB.WindowShowPrintSetupBtn = True
            
            crReporteVentasConValeB.StoredProcParam(0) = MstrFechaIni
            crReporteVentasConValeB.StoredProcParam(1) = MstrFechaFin
            crReporteVentasConValeB.StoredProcParam(2) = dtcMoneda.BoundText
            crReporteVentasConValeB.StoredProcParam(3) = 1
            crReporteVentasConValeB.StoredProcParam(4) = MstrCadena_Almacenes
            crReporteVentasConValeB.StoredProcParam(5) = MintTodos_Alm
            crReporteVentasConValeB.StoredProcParam(6) = MstrCadena_Criterios
            crReporteVentasConValeB.StoredProcParam(7) = MintTodos_Cri
            crReporteVentasConValeB.StoredProcParam(8) = cmbTipoPago.ListIndex
            crReporteVentasConValeB.StoredProcParam(9) = StrEstado
            crReporteVentasConValeB.StoredProcParam(10) = IntTodos

            crReporteVentasConValeB.Connect = "DSN=SIES"
            
            crReporteVentasConValeA.Action = 1
            crReporteVentasConValeB.Action = 1
            
            crReporteVentasConValeA.Reset
            crReporteVentasConValeB.Reset
        Else
        
            crReporteVentasConValeA.ReportFileName = GstrReportesVta + "rpt_VentasConVale_DetC.rpt"
            crReporteVentasConValeB.ReportFileName = GstrReportesVta + "rpt_VentasConVale_DetD.rpt"
            
    
            crReporteVentasConValeA.WindowTitle = "Reporte de Ventas Con Vales"
            crReporteVentasConValeA.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
            crReporteVentasConValeA.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='05.190.00'"
            crReporteVentasConValeA.Formulas(3) = "formMoneda=stringvar strMoneda; strMoneda:='" & Trim(dtcMoneda.Text) & "'"
            crReporteVentasConValeA.Formulas(4) = "formFechaIni= datevar FechaIni; FechaIni:=date(" & Format(DTPFechaIni.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeA.Formulas(5) = "formFechaFin= datevar FechaFin; FechaFin:=date(" & Format(DTPFechaFin.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeA.Formulas(6) = "formNDStock=" & GintDecStock
            crReporteVentasConValeA.Formulas(7) = "formNDCosto=" & GintDecCosto
            crReporteVentasConValeA.Formulas(8) = "formNDMonto=" & GintDecResultado
            crReporteVentasConValeA.Formulas(9) = "formNDPrecio=" & GintDecPrecio
            crReporteVentasConValeA.Formulas(10) = "formPago=stringvar strPago;strPago:='" & strPago & "'"
            crReporteVentasConValeA.Formulas(11) = "formestado=stringvar strEstado;strEstado:='Estado : " & Trim(cmbestado.Text) & "'"
            
            
            crReporteVentasConValeA.WindowState = crptMaximized
            crReporteVentasConValeA.WindowShowPrintSetupBtn = True
            
            crReporteVentasConValeA.StoredProcParam(0) = lngCorrelativo
            crReporteVentasConValeA.StoredProcParam(1) = MstrFechaIni
            crReporteVentasConValeA.StoredProcParam(2) = MstrFechaFin
            crReporteVentasConValeA.StoredProcParam(3) = dtcMoneda.BoundText
            crReporteVentasConValeA.StoredProcParam(4) = 1
            crReporteVentasConValeA.StoredProcParam(5) = MstrCadena_Almacenes
            crReporteVentasConValeA.StoredProcParam(6) = MintTodos_Alm
            crReporteVentasConValeA.StoredProcParam(7) = MstrCadena_Criterios
            crReporteVentasConValeA.StoredProcParam(8) = MintTodos_Cri
            crReporteVentasConValeA.StoredProcParam(9) = cmbTipoPago.ListIndex
            crReporteVentasConValeA.StoredProcParam(10) = StrEstado
            crReporteVentasConValeA.StoredProcParam(11) = IntTodos
            
            
            crReporteVentasConValeA.Connect = "DSN=SIES"
            
            
            crReporteVentasConValeB.WindowTitle = "Reporte de Ventas Con Vales"
            crReporteVentasConValeB.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
            crReporteVentasConValeB.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='05.190.00'"
            crReporteVentasConValeB.Formulas(3) = "formMoneda=stringvar strMoneda; strMoneda:='" & Trim(dtcMoneda.Text) & "'"
            crReporteVentasConValeB.Formulas(4) = "formFechaIni= datevar FechaIni; FechaIni:=date(" & Format(DTPFechaIni.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeB.Formulas(5) = "formFechaFin= datevar FechaFin; FechaFin:=date(" & Format(DTPFechaFin.Value, "YYYY,MM,dd") & ")"
            crReporteVentasConValeB.Formulas(6) = "formNDStock=" & GintDecStock
            crReporteVentasConValeB.Formulas(7) = "formNDCosto=" & GintDecCosto
            crReporteVentasConValeB.Formulas(8) = "formNDMonto=" & GintDecResultado
            crReporteVentasConValeB.Formulas(9) = "formNDPrecio=" & GintDecPrecio
            crReporteVentasConValeB.Formulas(10) = "formPago=stringvar strPago;strPago:='" & strPago & "'"
            crReporteVentasConValeB.Formulas(11) = "formestado=stringvar strEstado;strEstado:='Estado : " & Trim(cmbestado.Text) & "'"
            
            crReporteVentasConValeB.WindowState = crptMaximized
            crReporteVentasConValeB.WindowShowPrintSetupBtn = True
            
            crReporteVentasConValeB.StoredProcParam(0) = lngCorrelativo
            crReporteVentasConValeB.Connect = "DSN=SIES"
            
            crReporteVentasConValeA.Action = 1
            crReporteVentasConValeB.Action = 1
            
            crReporteVentasConValeA.Reset
            crReporteVentasConValeB.Reset
        
        End If
    End If
Screen.MousePointer = 0

End Sub

Public Sub CargaDataCombo(objDataCombo As DataCombo, rsSource As Recordset, istrCampo1 As String, istrCampo2 As String)

    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

End Sub

Private Sub InstanciaObjetos()
    Set objAlmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN
    Set objClientes = New DB_MA_MANTENIMIENTOS.C_CLIENTE
    Set objMoneda = New DB_MA_MANTENIMIENTOS.C_MONEDA
    Set objCorrelativo = New DB_CORRELATIVO.C_Correlativos
End Sub

Private Sub CargaListaCriterios()
        lstCriterios.Size 15, 33
        '@ Jorge: Modifique solo para filtrar los clientes no contado
        '@ Antes
'        lstCriterios.llena_lista objClientes.ListarClientesAyudaTPC
        '@ Ahora(lo retire hasta comprobar monto total)
        lstCriterios.llena_lista objClientes.ListarClientesAyudaNocontado
End Sub

Private Sub CargaListaAlmacen()
        lstAlmacen.Size 15, 33
        lstAlmacen.llena_lista objAlmacen.ListarAlmacenesPorStatus(1)
End Sub






