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 = "{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 FReporteRegtarjetas 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Reporte de Registros de Tarjetas de Crédito por Día (05.230.00)"
   ClientHeight    =   4755
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   10245
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   4755
   ScaleWidth      =   10245
   Begin VB.Frame Frame1 
      Height          =   4815
      Left            =   0
      TabIndex        =   0
      Top             =   -60
      Width           =   10215
      Begin Crystal.CrystalReport crReporteRegTarjetas 
         Left            =   3270
         Top             =   3810
         _ExtentX        =   741
         _ExtentY        =   741
         _Version        =   348160
         PrintFileLinesPerPage=   60
      End
      Begin VB.CommandButton cmdSalir 
         Caption         =   "&Salir"
         Height          =   855
         Left            =   1350
         Picture         =   "0523000.frx":0000
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   3690
         Width           =   1200
      End
      Begin VB.Frame Frame3 
         Caption         =   "Formato"
         Height          =   990
         Left            =   270
         TabIndex        =   8
         Top             =   2655
         Visible         =   0   'False
         Width           =   2070
         Begin VB.OptionButton optResumido 
            Caption         =   "Resumido"
            Height          =   255
            Left            =   420
            TabIndex        =   10
            Top             =   270
            Value           =   -1  'True
            Width           =   1095
         End
         Begin VB.OptionButton optDetallado 
            Caption         =   "Detallado"
            Height          =   255
            Left            =   420
            TabIndex        =   9
            Top             =   585
            Width           =   1095
         End
      End
      Begin VB.Frame Frame2 
         Caption         =   "Rango de Fechas"
         Height          =   1080
         Left            =   285
         TabIndex        =   3
         Top             =   1515
         Width           =   2025
         Begin MSComCtl2.DTPicker dtpFechaFin 
            Height          =   315
            Left            =   480
            TabIndex        =   4
            Top             =   675
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   556
            _Version        =   393216
            Format          =   69206017
            CurrentDate     =   37533
         End
         Begin MSComCtl2.DTPicker dtpFechaIni 
            Height          =   315
            Left            =   480
            TabIndex        =   5
            Top             =   315
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   556
            _Version        =   393216
            Format          =   69206017
            CurrentDate     =   37533
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            Caption         =   "Al"
            Height          =   195
            Left            =   195
            TabIndex        =   7
            Top             =   675
            Width           =   135
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "Del"
            Height          =   195
            Left            =   120
            TabIndex        =   6
            Top             =   315
            Width           =   240
         End
      End
      Begin VB.CommandButton cmdGenerar 
         Caption         =   "&Generar"
         Height          =   855
         Left            =   165
         Picture         =   "0523000.frx":030A
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   3690
         Width           =   1200
      End
      Begin MSDataListLib.DataCombo dtcMoneda 
         Height          =   315
         Left            =   915
         TabIndex        =   11
         Top             =   1020
         Width           =   1755
         _ExtentX        =   3096
         _ExtentY        =   556
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin pry_list.ctrl_listarray lstAlmacen 
         Height          =   2775
         Left            =   3060
         TabIndex        =   12
         Top             =   1560
         Width           =   6780
         _ExtentX        =   11959
         _ExtentY        =   4895
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "ALMACEN"
         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            =   3060
         TabIndex        =   15
         Top             =   1290
         Width           =   6675
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   150
         Picture         =   "0523000.frx":0614
         Top             =   240
         Width           =   480
      End
      Begin VB.Line Line1 
         X1              =   150
         X2              =   10020
         Y1              =   720
         Y2              =   720
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H80000004&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H80000006&
         Height          =   3525
         Left            =   2880
         Top             =   1020
         Width           =   7110
      End
      Begin VB.Label lblMoneda 
         AutoSize        =   -1  'True
         Caption         =   "Moneda"
         Height          =   195
         Left            =   210
         TabIndex        =   14
         Top             =   1050
         Width           =   585
      End
      Begin VB.Label Label5 
         Caption         =   "REPORTE DE REGISTROS DE TARJETA DE CRÉDITOS POR DÍA"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   705
         TabIndex        =   13
         Top             =   435
         Width           =   8925
      End
   End
End
Attribute VB_Name = "FReporteRegtarjetas"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'   PROGRAMADOR: JOE BREÑA HUACHIN
'   REPORTE DE REGISTROS DE TARJETA DE CREDITOS POR DIA

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 objArticulos As DB_INV_ARTICULO.C_ARTICULO
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 MstrFechaHoy As String

Private Sub cmdGenerar_Click()
    imprimir
End Sub

Private Sub cmdGenerar2_Click()
    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 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
        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
         
    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"
        dtcMoneda.SetFocus
        Exit Function
    End If

    If dtpFechaIni.Value > dtpFechaFin.Value Then
        valida_datos = False
        MsgBox "Rango de Fecha Incorrecto", vbExclamation, "Error de ingreso"
        dtpFechaIni.SetFocus
        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"
        Exit Function
    End If
        
    ' PARA LOS ALMACENES
    If lstAlmacen.nseleccionados = 0 Then
        valida_datos = False
        MsgBox "Seleccione al menos un Almacen", vbExclamation, "Error de ingreso"
        Exit Function
    Else
        If Len(lstAlmacen.listar_codigos_seleccionados) > 255 Then
            valida_datos = False
            MsgBox "Selecione menos Almacenes o Seleccione Todos", vbExclamation, "Error de ingreso"
            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"))
    MstrFechaHoy = CStr(Format(GDatFechaProceso, "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 objMoneda = Nothing
End Sub


Sub imprimir()
On Error GoTo TrataError


If Not valida_datos Then
    Exit Sub
End If

Screen.MousePointer = 11

    If optResumido.Value Then
        crReporteRegTarjetas.ReportFileName = GstrReportesVta + "rpt_Deposito_tarjetas2.rpt"
        crReporteRegTarjetas.WindowTitle = "Reporte de Registro de Tarjetas por Día"
    End If
    If optDetallado.Value Then
        crReporteRegTarjetas.ReportFileName = GstrReportesVta + "rpt_Deposito_tarjetas2.rpt"
        crReporteRegTarjetas.WindowTitle = "Reporte de Registro de Tarjetas por Día"
    End If
                      
    crReporteRegTarjetas.WindowTitle = "Reporte de Ventas Con Tarjeta"
    crReporteRegTarjetas.Formulas(1) = "formusuario=stringvar strusuario; strusuario:='" & GCUSERID & "'"
    crReporteRegTarjetas.Formulas(2) = "formscreen=stringvar strscreen; strscreen:='05.230.00'"
    crReporteRegTarjetas.Formulas(3) = "formMoneda=stringvar strMoneda; strMoneda:='" & Trim(dtcMoneda.Text) & "'"
    crReporteRegTarjetas.Formulas(4) = "formFechaIni= datevar FechaIni; FechaIni:=date(" & Format(dtpFechaIni.Value, "YYYY,MM,dd") & ")"
    crReporteRegTarjetas.Formulas(5) = "formFechaFin= datevar FechaFin; FechaFin:=date(" & Format(dtpFechaFin.Value, "YYYY,MM,dd") & ")"
    crReporteRegTarjetas.Formulas(6) = "formNDStock=" & GintDecStock
    crReporteRegTarjetas.Formulas(7) = "formNDCosto=" & GintDecCosto
    crReporteRegTarjetas.Formulas(8) = "formNDMonto=" & GintDecResultado
    crReporteRegTarjetas.Formulas(9) = "formNDPrecio=" & GintDecPrecio

    crReporteRegTarjetas.WindowState = crptMaximized
    crReporteRegTarjetas.WindowShowPrintSetupBtn = True
    
    crReporteRegTarjetas.StoredProcParam(0) = MstrCadena_Almacenes
    crReporteRegTarjetas.StoredProcParam(1) = MstrFechaHoy
    crReporteRegTarjetas.StoredProcParam(2) = MstrFechaIni
    crReporteRegTarjetas.StoredProcParam(3) = MstrFechaFin
    crReporteRegTarjetas.StoredProcParam(4) = dtcMoneda.BoundText
    
    crReporteRegTarjetas.Action = 1
    
    crReporteRegTarjetas.Reset
    
Screen.MousePointer = 0
Exit Sub
TrataError:
    MsgBox "Error generando Reporte", vbExclamation, "Error"
    crReporteRegTarjetas.Reset
    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 objMoneda = New DB_MA_MANTENIMIENTOS.C_MONEDA
End Sub

Private Sub CargaListaAlmacen()
        lstAlmacen.Size 12, 30
        lstAlmacen.llena_lista objAlmacen.ListarAlmacenesPorStatus(1)
End Sub






