VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.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 frpt_comprasproveedor 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Reporte de Compras por Proveedor (10.120.00)"
   ClientHeight    =   5655
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6540
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   5655
   ScaleWidth      =   6540
   Begin TabDlg.SSTab SSTab1 
      Height          =   5535
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   6495
      _ExtentX        =   11456
      _ExtentY        =   9763
      _Version        =   393216
      Tabs            =   2
      TabHeight       =   520
      TabCaption(0)   =   "Criterios"
      TabPicture(0)   =   "1012000.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Frame2"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Frame1"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "cmdAceptar"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).Control(3)=   "cmdSalir"
      Tab(0).Control(3).Enabled=   0   'False
      Tab(0).Control(4)=   "Frame3"
      Tab(0).Control(4).Enabled=   0   'False
      Tab(0).Control(5)=   "RP"
      Tab(0).Control(5).Enabled=   0   'False
      Tab(0).ControlCount=   6
      TabCaption(1)   =   "Almacen"
      TabPicture(1)   =   "1012000.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "ctrl_sites"
      Tab(1).ControlCount=   1
      Begin Crystal.CrystalReport RP 
         Left            =   2520
         Top             =   4800
         _ExtentX        =   741
         _ExtentY        =   741
         _Version        =   348160
         PrintFileLinesPerPage=   60
      End
      Begin pry_list.ctrl_listarray ctrl_sites 
         Height          =   4815
         Left            =   -74520
         TabIndex        =   14
         Top             =   600
         Width           =   5535
         _ExtentX        =   9763
         _ExtentY        =   8493
      End
      Begin VB.Frame Frame3 
         Caption         =   "Tipos de Moneda"
         Height          =   1335
         Left            =   240
         TabIndex        =   11
         Top             =   600
         Width           =   3375
         Begin VB.OptionButton opt_umoneda 
            Caption         =   "Solo una Moneda"
            Height          =   375
            Left            =   120
            TabIndex        =   3
            Top             =   720
            Width           =   1695
         End
         Begin VB.OptionButton opt_mtodas 
            Caption         =   "Todas Las Monedas"
            Height          =   255
            Left            =   120
            TabIndex        =   6
            Top             =   360
            Value           =   -1  'True
            Width           =   2175
         End
         Begin MSDataListLib.DataCombo dtc_moneda 
            Height          =   315
            Left            =   1920
            TabIndex        =   12
            Top             =   720
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   556
            _Version        =   393216
            Enabled         =   0   'False
            Style           =   2
            Text            =   ""
         End
      End
      Begin VB.CommandButton cmdSalir 
         Caption         =   "Sa&lir"
         Height          =   735
         Left            =   4800
         Picture         =   "1012000.frx":0038
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   4560
         Width           =   1215
      End
      Begin VB.CommandButton cmdAceptar 
         Caption         =   "&Generar"
         Height          =   735
         Left            =   600
         Picture         =   "1012000.frx":0342
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   4560
         Width           =   1215
      End
      Begin VB.Frame Frame1 
         Caption         =   "Proveedores"
         Height          =   2415
         Left            =   240
         TabIndex        =   2
         Top             =   2040
         Width           =   6015
         Begin pry_list.ctrl_listarray ctrl_lista 
            Height          =   1935
            Left            =   240
            TabIndex        =   13
            Top             =   240
            Width           =   5535
            _ExtentX        =   9763
            _ExtentY        =   3413
         End
      End
      Begin VB.Frame Frame2 
         Caption         =   "Rango Fechas"
         Height          =   1335
         Left            =   3720
         TabIndex        =   1
         Top             =   600
         Width           =   2535
         Begin MSComCtl2.DTPicker dt_fechainicio 
            Height          =   375
            Left            =   1080
            TabIndex        =   7
            Top             =   240
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   661
            _Version        =   393216
            CustomFormat    =   "dd/MM/yyyy"
            Format          =   61210627
            CurrentDate     =   37257
         End
         Begin MSComCtl2.DTPicker dt_fechafinal 
            Height          =   375
            Left            =   1080
            TabIndex        =   8
            Top             =   720
            Width           =   1335
            _ExtentX        =   2355
            _ExtentY        =   661
            _Version        =   393216
            CustomFormat    =   "dd/MM/yyyy"
            Format          =   61210627
            CurrentDate     =   37531
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "Fecha Final:"
            Height          =   195
            Left            =   120
            TabIndex        =   10
            Top             =   840
            Width           =   870
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            Caption         =   "Fecha Inicial:"
            Height          =   195
            Left            =   120
            TabIndex        =   9
            Top             =   360
            Width           =   945
         End
      End
   End
End
Attribute VB_Name = "frpt_comprasproveedor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Se tiene que crear el procedimiento "salir_formulario"
'Variables para el Control de la Barra General
 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
'*******************************************************************************************************************
'falta decidir la cantidad de decimales para redondear los precios, calculos y costos
'debe obtenerse de la tabla in_setup
Dim cnxprueba As adodb.Connection
Dim mobj_calmacen As DB_INV_MANTENIMIENTOS.C_ALMACEN
Dim mobj_cproveedor As DB_INV_MANTENIMIENTOS.C_PROVEEDOR
Dim mobj_cmoneda As DB_MA_MANTENIMIENTOS.C_MONEDA

Private Sub cmdAceptar_Click()
Dim ls_condicion As String
Dim li_todosprov                        ' 1 todos los elementos, 0 algunos
Dim LS_MONEDA As String             '
Dim ls_dmoneda As String            '
Dim ls_rutar As String              'ruta de los reportes
Dim li_todaslasmonedas As Byte      ' flag para todas las monedas

ls_rutar = GstrReportesInv
ls_dmoneda = dtc_moneda.Text
LS_MONEDA = dtc_moneda.BoundText

If opt_umoneda = True Then      'una moneda
    If LS_MONEDA = "" Then
        MsgBox "Debe Seleccionar un tipo de moneda", vbExclamation, "Parametros Incompletos"
        dtc_moneda.SetFocus
        Exit Sub
    Else
        li_todaslasmonedas = 0
        ls_cualmoneda = dtc_moneda.BoundText
    End If
Else
        li_todaslasmonedas = 1
        ls_cualmoneda = "T"
End If

If ctrl_lista.ndisponibles = 0 Or ctrl_lista.nseleccionados = 0 Then
    li_todosprov = 1
    ls_condicion = "T"
Else
    li_todosprov = 0
    ls_condicion = ctrl_lista.listar_codigos()
    If Len(ls_condicion) >= 255 Then    'se excedio el numero de items que soporta crystal
        MsgBox "Seleccione menos Items o Todos", vbCritical, "Demasiados Items Seleccionados"
        Exit Sub
    End If
End If

If ctrl_SITES.nseleccionados = 0 Then
    MsgBox "Debe Seleccionar un almacen como minimo", vbExclamation, "Parametros Incompletos"
    Exit Sub
End If
ls_sites = ctrl_SITES.listar_codigos()
Screen.MousePointer = 11
RP.Reset
RP.WindowState = crptMaximized
RP.Destination = crptToWindow
RP.WindowShowPrintSetupBtn = True
RP.WindowShowGroupTree = True
RP.WindowShowCloseBtn = True
RP.WindowShowSearchBtn = True
RP.WindowTitle = "Reporte de Compras por Proveedor"

RP.ReportFileName = ls_rutar + "RPT_listacomprasproveedor.RPT"

RP.Formulas(0) = "form_nreporte='10.120.00'"
RP.Formulas(1) = "form_usuario='" + GCUSERID + "'"
RP.Formulas(2) = "form_NDECPRECIO=" + Str(GintDecPrecio)

RP.StoredProcParam(0) = CStr(Format(dt_fechainicio.Value, "dd/mm/yyyy"))
RP.StoredProcParam(1) = CStr(Format(dt_fechafinal.Value, "dd/mm/yyyy"))
RP.StoredProcParam(2) = ls_sites
RP.StoredProcParam(3) = li_todaslasmonedas
RP.StoredProcParam(4) = li_todosprov
RP.StoredProcParam(5) = ls_cualmoneda
RP.StoredProcParam(6) = ls_condicion

RP.Action = 1
Screen.MousePointer = 0
End Sub

Private Sub cmdSalir_Click()
Unload Me
End Sub

Private Sub Form_Activate()
'********************************************************************************
 'Código que se Tiene que Copiar para Invocar a la Rutina de Seguridad para poder
    Call gactualizaopcion(pbderecho_agregar, pbderecho_editar, pbderecho_borrar, pbderecho_imprimir)
    Call gactualiza_barra(Me) 'pb_editar, pb_primerregistro, pb_ultimoregistro)
    If pbderecho_consultar = False Then
       Unload Me
    End If
 '********************************************************************************
End Sub

Private Sub Form_Load()

'********************************************************************************
'Código que se Tiene que Copiar para Invocar a la Rutina de Seguridad para poder
 Call gseguridad(Me)
 If pbderecho_consultar Then
 Else
    MsgBox ("No tiene Derechos de Consultar en este formulario"), vbCritical + vbDefaultButton1, "Mensaje"
 End If
'********************************************************************************

Set mobj_calmacen = New DB_INV_MANTENIMIENTOS.C_ALMACEN
Set mobj_cmoneda = New DB_MA_MANTENIMIENTOS.C_MONEDA

Me.Left = (MDIFInventarios.Width - Me.Width) / 2
Me.Top = 100


ctrl_SITES.Size (20)
ctrl_SITES.llena_lista mobj_calmacen.ListarAlmacenesPorStatus(0), mobj_calmacen.ListarAlmacenesPorStatus(1)

Set dtc_moneda.RowSource = mobj_cmoneda.ListarMonedas
dtc_moneda.ListField = "descr"
dtc_moneda.BoundColumn = "CURYID"
Set mobj_cproveedor = New DB_INV_MANTENIMIENTOS.C_PROVEEDOR
ctrl_lista.llena_lista mobj_cproveedor.ListarProveedoresAyuda
Me.Height = 6045
Me.Width = 6705

dt_fechainicio.Value = DateAdd("d", (-1) * (Day(Now) - 1), Now)
dt_fechafinal.Value = Now
End Sub

Private Sub opt_mtodas_Click()
dtc_moneda.Enabled = False

End Sub

Private Sub opt_umoneda_Click()
dtc_moneda.Enabled = True
End Sub

Sub actualizar_registro()
 
End Sub
Sub salir_formulario()
 gformmdi.Toolbar1.Buttons(18).Caption = "Salir"
 Unload Me
End Sub


