VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Object = "{00025600-0000-0000-C000-000000000046}#4.6#0"; "crystl32.ocx"
Begin VB.Form Form_FlujoChequesCobranza 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Flujo de Cheques a Cobranza"
   ClientHeight    =   6645
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11325
   Icon            =   "Form_FlujoChequesCobranza.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6645
   ScaleWidth      =   11325
   Begin VB.ListBox lst_Titular 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   690
      Left            =   2880
      TabIndex        =   22
      Top             =   1080
      Visible         =   0   'False
      Width           =   4695
   End
   Begin VB.ListBox lst_RutTitular 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   690
      Left            =   8400
      TabIndex        =   23
      Top             =   1080
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.ListBox lst_Alumnos 
      Height          =   450
      Left            =   12240
      TabIndex        =   20
      Top             =   3120
      Visible         =   0   'False
      Width           =   4935
   End
   Begin VB.Frame frm_factoring 
      Caption         =   "Listado de cheques a factoring"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   975
      Left            =   7800
      TabIndex        =   58
      Top             =   1440
      Width           =   3375
      Begin VB.OptionButton opt_vin 
         Caption         =   "Vinculados"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   0
         Left            =   360
         TabIndex        =   61
         Top             =   240
         Value           =   -1  'True
         Width           =   1455
      End
      Begin VB.OptionButton opt_vin 
         Caption         =   "No Vinculados"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   60
         Top             =   600
         Width           =   1575
      End
      Begin VB.CommandButton cmd_factoring 
         Caption         =   "Generar reporte"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   2040
         TabIndex        =   59
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.Frame frame_busqueda 
      Height          =   735
      Left            =   1920
      TabIndex        =   51
      Top             =   3600
      Visible         =   0   'False
      Width           =   7335
      Begin VB.Label Label11 
         Alignment       =   2  'Center
         Caption         =   "Realizando proceso de busqueda"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   14.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   52
         Top             =   240
         Width           =   6975
      End
   End
   Begin VB.Frame frame_progreso 
      Caption         =   "Progreso"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   120
      TabIndex        =   49
      Top             =   5280
      Width           =   5415
      Begin MSComctlLib.ProgressBar progreso 
         Height          =   855
         Left            =   120
         TabIndex        =   53
         Top             =   240
         Width           =   5175
         _ExtentX        =   9128
         _ExtentY        =   1508
         _Version        =   393216
         Appearance      =   1
         Min             =   1e-4
         Scrolling       =   1
      End
   End
   Begin VB.Frame frame_cancelar 
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   9120
      TabIndex        =   33
      Top             =   5280
      Width           =   2055
      Begin VB.CommandButton cmd_limpiar 
         Caption         =   "Limpiar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   36
         Top             =   240
         Width           =   1575
      End
      Begin VB.CommandButton cmd_Cancelar 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   34
         Top             =   720
         Width           =   1575
      End
   End
   Begin VB.Frame frame_buscar 
      Caption         =   "Buscar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2295
      Left            =   120
      TabIndex        =   26
      Top             =   120
      Width           =   1815
      Begin VB.OptionButton opt_factoring 
         Caption         =   "Factoring"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   57
         Top             =   1800
         Width           =   1095
      End
      Begin VB.OptionButton opt_todos 
         Caption         =   "Todos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   240
         TabIndex        =   30
         Top             =   1440
         Width           =   975
      End
      Begin VB.OptionButton opt_curso 
         Caption         =   "Por Curso"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   240
         TabIndex        =   29
         Top             =   1080
         Width           =   1095
      End
      Begin VB.OptionButton opt_banco 
         Caption         =   "Por Banco"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   240
         TabIndex        =   28
         Top             =   720
         Width           =   1095
      End
      Begin VB.OptionButton opt_alumno 
         Caption         =   "Por Alumno"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   240
         TabIndex        =   27
         Top             =   360
         Value           =   -1  'True
         Width           =   1335
      End
   End
   Begin Crystal.CrystalReport cr_flujocheques 
      Left            =   10680
      Top             =   6720
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   262150
   End
   Begin VB.ListBox lst_RutAlumno 
      Height          =   450
      Left            =   12240
      TabIndex        =   21
      Top             =   2520
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.Frame frame_reporte 
      Caption         =   "Reporte"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   5640
      TabIndex        =   10
      Top             =   5280
      Width           =   3375
      Begin VB.OptionButton opt_Pantalla 
         Caption         =   "Por Pantalla"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   13
         Top             =   360
         Value           =   -1  'True
         Width           =   1215
      End
      Begin VB.OptionButton opt_Impresora 
         Caption         =   "Por Impresora"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   12
         Top             =   720
         Width           =   1455
      End
      Begin VB.CommandButton cmd_GenerarReporte 
         Caption         =   "Reporte General"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1560
         TabIndex        =   11
         Top             =   720
         Width           =   1575
      End
      Begin VB.CommandButton cmd_ReporteReducido 
         Caption         =   "Reporte Reducido"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1560
         TabIndex        =   24
         Top             =   240
         Width           =   1575
      End
   End
   Begin VB.Frame frm_fecha 
      Caption         =   "Fecha"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   975
      Left            =   2040
      TabIndex        =   14
      Top             =   1440
      Width           =   5655
      Begin MSComCtl2.DTPicker dtp_FechaTermino 
         Height          =   375
         Left            =   4080
         TabIndex        =   18
         Top             =   360
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   661
         _Version        =   393216
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Format          =   264765441
         CurrentDate     =   40568
      End
      Begin MSComCtl2.DTPicker dtp_FechaInicio 
         Height          =   375
         Left            =   1200
         TabIndex        =   16
         Top             =   360
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   661
         _Version        =   393216
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Format          =   264765441
         CurrentDate     =   40568
      End
      Begin VB.Label Label6 
         Caption         =   "Fecha Termino"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2880
         TabIndex        =   17
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label333 
         Caption         =   "Fecha Inicio"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   15
         Top             =   360
         Width           =   975
      End
   End
   Begin VB.Frame frm_listado 
      Caption         =   "Listado de cheques"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2775
      Left            =   120
      TabIndex        =   31
      Top             =   2520
      Width           =   11055
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid grid_listado 
         Height          =   2295
         Left            =   120
         TabIndex        =   32
         Top             =   240
         Width           =   10815
         _ExtentX        =   19076
         _ExtentY        =   4048
         _Version        =   393216
         FocusRect       =   0
         FillStyle       =   1
         SelectionMode   =   1
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _NumberOfBands  =   1
         _Band(0).Cols   =   2
      End
   End
   Begin VB.Frame frm_curso 
      Caption         =   "Selección por Curso"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   2040
      TabIndex        =   37
      Top             =   120
      Width           =   9135
      Begin VB.CheckBox chec_tod_cur 
         Caption         =   "Todos los cursos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   50
         Top             =   840
         Width           =   1815
      End
      Begin VB.CheckBox Check_Letra 
         Caption         =   "Letra"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   195
         Left            =   6600
         TabIndex        =   39
         Top             =   240
         Value           =   1  'Checked
         Visible         =   0   'False
         Width           =   1095
      End
      Begin VB.CommandButton Btn_Ver_Lista 
         Caption         =   "Ver"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   8160
         Picture         =   "Form_FlujoChequesCobranza.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   38
         Top             =   360
         Width           =   735
      End
      Begin MSComctlLib.ImageCombo IC_Ensenanza 
         Height          =   345
         Left            =   1320
         TabIndex        =   40
         Top             =   480
         Width           =   3855
         _ExtentX        =   6800
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Ensenanza"
      End
      Begin MSComctlLib.ImageCombo IC_Nivel 
         Height          =   345
         Left            =   5280
         TabIndex        =   41
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Nivel"
      End
      Begin MSComctlLib.ImageCombo IC_Letra 
         Height          =   345
         Left            =   6600
         TabIndex        =   42
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         Enabled         =   0   'False
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Letra"
      End
      Begin MSComctlLib.ImageCombo IC_Agno 
         Height          =   345
         Left            =   120
         TabIndex        =   43
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Agno"
      End
      Begin VB.Label Label1 
         Caption         =   "Año"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   120
         TabIndex        =   46
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "Enseñanza"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   1320
         TabIndex        =   45
         Top             =   240
         Width           =   2895
      End
      Begin VB.Label Label3 
         Caption         =   "Nivel"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   5280
         TabIndex        =   44
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Frame frm_banco 
      Caption         =   "Banco"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   2040
      TabIndex        =   5
      Top             =   120
      Visible         =   0   'False
      Width           =   9135
      Begin VB.CommandButton cmd_ver_banco 
         Caption         =   "Ver"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   8160
         TabIndex        =   55
         Top             =   360
         Width           =   735
      End
      Begin VB.CheckBox chec_tod_ban 
         Caption         =   "Todos los Bancos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5880
         TabIndex        =   47
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox txt_RutTitular 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   6360
         TabIndex        =   19
         Top             =   720
         Width           =   1455
      End
      Begin VB.ComboBox cb_banco 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   840
         TabIndex        =   7
         Top             =   360
         Width           =   4695
      End
      Begin VB.TextBox txt_Titular 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   840
         TabIndex        =   6
         Top             =   720
         Width           =   4695
      End
      Begin VB.Label Label7 
         Caption         =   "RUT"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5880
         TabIndex        =   25
         Top             =   720
         Width           =   375
      End
      Begin VB.Label Label8 
         Caption         =   "Banco"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label9 
         Caption         =   "Titular"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   8
         Top             =   720
         Width           =   615
      End
   End
   Begin VB.Frame frame_todos 
      Caption         =   "Todos"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   2040
      TabIndex        =   35
      Top             =   120
      Visible         =   0   'False
      Width           =   9135
      Begin VB.CommandButton cmd_ver_todos 
         Caption         =   "Ver"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   8160
         TabIndex        =   56
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.Frame frm_alumno 
      Caption         =   "Alumno"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   2040
      TabIndex        =   0
      Top             =   120
      Visible         =   0   'False
      Width           =   9135
      Begin VB.CommandButton cmd_ver_alumno 
         Caption         =   "Ver"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   8160
         TabIndex        =   54
         Top             =   360
         Width           =   735
      End
      Begin VB.CheckBox chec_tod_alu 
         Caption         =   "Todos los alumnos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   48
         Top             =   840
         Width           =   1815
      End
      Begin VB.TextBox txt_Rut 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   6600
         TabIndex        =   2
         Top             =   360
         Width           =   1335
      End
      Begin VB.TextBox txt_Alumno 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   840
         TabIndex        =   1
         Top             =   360
         Width           =   4935
      End
      Begin VB.Label Label4 
         Caption         =   "Nombres"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label5 
         Caption         =   "RUT"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6000
         TabIndex        =   3
         Top             =   360
         Width           =   495
      End
   End
End
Attribute VB_Name = "Form_FlujoChequesCobranza"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Rec2Grid(ByRef REC As ADODB.Recordset, ByRef grid As Object, Optional ByVal Numeracion As Boolean = True)
    grid.ClearStructure
    Dim a, b As Integer
    If REC.RecordCount > 0 Then
        grid.Cols = REC.Fields.count + 1
        grid.Rows = REC.RecordCount + 1
        grid.FixedCols = 1
        grid.FixedRows = 1
        grid.TextMatrix(0, 0) = "Nº"
        grid.ColWidth(0) = IIf(Numeracion, TextWidth(grid.TextMatrix(0, 0)) + 100, 0)
        For i = 1 To REC.Fields.count
            grid.TextMatrix(0, i) = UCase(REC.Fields(i - 1).Name)
            grid.ColWidth(i) = TextWidth(grid.TextMatrix(0, i)) + 100
        Next i
        REC.MoveFirst
        a = Val(REC.RecordCount / 50)
        b = 0
        For i = 1 To REC.RecordCount
            b = b + 1
            If b = a Then
                b = 0
                If progreso.Value < 100 Then
                    progreso.Value = progreso.Value + 1
                    'progreso.Refresh
                End If
            End If
            grid.TextMatrix(i, 0) = i
            grid.ColWidth(0) = IIf(Numeracion, IIf(TextWidth(grid.TextMatrix(i, 0)) + 100 > grid.ColWidth(0), TextWidth(grid.TextMatrix(i, 0)) + 100, grid.ColWidth(0)), 0)
            For j = 1 To REC.Fields.count
                grid.TextMatrix(i, j) = IIf(IsNull(REC(j - 1)), "Null", REC(j - 1))
                grid.ColWidth(j) = IIf(TextWidth(grid.TextMatrix(i, j)) + 100 > grid.ColWidth(j), TextWidth(grid.TextMatrix(i, j)) + 100, grid.ColWidth(j))
            Next j
            REC.MoveNext
        Next i
    Else
        grid.Cols = 2
        grid.Rows = 2
    End If
End Sub

Public Sub llenar_listbox_titular()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select * from fnza_cheques_recibidos" _
            & " where nom_titular LIKE ('" & txt_Titular & "%')" _
            & " group by run_titular"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        lst_Titular.Visible = True
    End If
    lst_Titular.Clear
    While Not objRS.EOF
        lst_Titular.AddItem objRS("nom_titular")
        'cb_banco.ItemData(cb_banco.NewIndex) = objRS("banco")
        objRS.MoveNext
    Wend
    objRS.Close
End Sub

Private Sub carga_bancos()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select * from fnza_cod_banco"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        cb_banco.AddItem objRS("descripcion")
        cb_banco.ItemData(cb_banco.NewIndex) = objRS("banco")
        objRS.MoveNext
    Wend
    cb_banco.AddItem "TODOS"
    objRS.Close
End Sub

Private Sub chk_Alumnos_Click()
    If chk_Alumnos.Value = Checked Then
        txt_Alumno.Text = ""
        txt_Alumno.Enabled = False
        lst_Alumnos.Visible = False
        txt_rut.Enabled = False
        txt_rut.Text = ""
    Else
        txt_Alumno.Enabled = True
        txt_rut.Enabled = True
    End If
End Sub

Private Sub chk_Banco_Click()
     If chk_Banco.Value = Checked Then
        cb_banco.Text = "Todos"
        cb_banco.Enabled = False
     Else
        cb_banco.Enabled = True
        cb_banco.Text = ""
     End If
End Sub

Private Sub chk_Titular_Click()
    If chk_Titular.Value = Checked Then
        txt_Titular.Text = ""
        txt_RutTitular.Text = ""
        txt_RutTitular.Enabled = False
        txt_Titular.Enabled = False
        lst_Titular.Visible = False
    Else
        txt_Titular.Enabled = True
        txt_RutTitular.Enabled = True
    End If
End Sub






Private Sub Btn_Ver_Lista_Click()
    frame_busqueda.Visible = True
    frame_busqueda.Refresh
    progreso.Min = 0
    progreso.Value = 0
    grid_listado.Rows = 2
    grid_listado.ClearStructure
    'progreso.Value = 5
    crear_tabla_flujocheques
    'progreso.Value = 15
    llenar_flujocheques
    'progreso = 35
    If chec_tod_alu.Value = 0 And chec_tod_ban.Value = 0 And chec_tod_cur.Value = 0 Then
        filtrado
    End If
    progreso.Value = 40
    agrupamiento
    coloca_marca
    progreso.Value = 50
    llena_grilla
    progreso.Value = 100
    frame_busqueda.Visible = False
End Sub

Private Sub Check_Letra_Click()
    If Check_Letra.Value = 0 Then
        IC_Letra.Enabled = False
    ElseIf Check_Letra.Value = 1 And Not (ErrorStatus) And IC_Ensenanza.Enabled And IC_Nivel.Enabled Then
        IC_Letra.Enabled = True
        Call Set_IC_Letra
    Else
        Check_Letra.Value = 0
        IC_Letra.Enabled = False
    End If
End Sub

'Private Sub chk_todos_cob_Click()
'    If Me.chk_todos_cob.Value Then
'    For t = 0 To Me.lst_cursosinf.ListCount - 1
'        Me.lst_cursosinf.Selected(t) = True
'    Next t
'    Else
'    For t = 0 To Me.lst_cursosinf.ListCount - 1
'        Me.lst_cursosinf.Selected(t) = False
'        Me.lst_cursosinf.ListIndex = 0
'    Next t
'    End If
'End Sub

'Private Sub cmb_mod_cob_Click()
'Me.chk_todos_cob.Enabled = True
'Me.chk_todos_cob.Value = Unchecked
'modalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.cmb_mod_cob.Text & "'", conn)
'Set Rs = New ADODB.Recordset
'Rs.CursorLocation = adUseClient
'Rs.Open "SELECT num_gra, let_cur FROM CURSOS where cod_ens ='" & modalidad & "' ORDER BY NUM_GRA,let_cur", conn
'If Rs.RecordCount > 0 Then
'    ReDim Anuevocurso(Rs.RecordCount, 2)
'    Me.lst_cursosinf.Clear
'    chk_todos_cob.Visible = True
'    c = 0
'    While Not Rs.EOF
'        lst_cursosinf.AddItem Rs("num_gra") + " " + Rs("LET_CUR")
'        Anuevocurso(c, 1) = Rs("num_gra")
'        Anuevocurso(c, 2) = Rs("let_cur")
'        Rs.MoveNext
'        c = c + 1
'    Wend
'Else
'    Me.lst_cursosinf.Clear
'    chk_todos_cob.Visible = False
'End If
'
'Rs.Close
''Set Rs = Nothing
'End Sub


Private Sub cmd_Cancelar_Click()
Unload Me
End Sub

Private Sub cmd_factoring_Click()
    Dim objRS As ADODB.Recordset
    Dim nivel, Filtro As String
    Set objRS = New ADODB.Recordset
    Dim var_sql, est, dir, Desde As String
    var_sql = "SELECT nom_est,dir_est FROM establecimientos"
    objRS.Open var_sql, conn
    var_sql = "drop table if exists fnza_rpt_cheques_factoring;"
    conn.Execute var_sql
    
 
   If opt_vin(0).Value = True Then

    var_sql = " create table fnza_rpt_cheques_factoring type = MyISAM" _
            & " select run_titular,nom_titular,descripcion as 'banco'," _
            & "cta_cte,chq_serie,chq_numero,chq_fecha,monto_chq," _
            & "date_format(chq_fecha,'%m') as 'mes',date_format(chq_fecha,'%Y') as agno" _
            & " from fnza_cheques_recibidos fcr,fnza_cod_banco fcb,fnza_chq_mvto fcm," _
            & "fnza_movimientos_mensualidad fmm,fnza_detalle_mensualidad fdm" _
            & " where fdm.folio_dtll = fmm.folio_dtll and fmm.folio_mvto = fcm.folio_mvto" _
            & " and fcm.folio_chq = fcr.folio_chq and " _
            & " fcr.banco = fcb.banco and date_format(chq_fecha,'%Y') = " _
            & Format(dtp_FechaInicio.Value, "yyyy") _
            & " and chq_fecha >= '" & Format(dtp_FechaInicio.Value, "yyyy-mm-dd") _
            & "' and chq_fecha <= '" & Format(dtp_FechaTermino.Value, "yyyy-mm-dd") & "'" _
            & " and CHAR_LENGTH(colegio) < 7" _
            & " group by cta_cte,chq_serie,chq_numero"
    Else
    var_sql = " create table fnza_rpt_cheques_factoring type = MyISAM" _
            & " select run_titular,nom_titular,banco,cta_cte,chq_serie,chq_numero,chq_fecha,monto_chq,date_format(chq_fecha,'%m') as 'mes',date_format(chq_fecha,'%Y') as agno" _
            & " from (select folio_chq,run_titular,nom_titular,descripcion as 'banco'," _
            & "cta_cte,chq_serie,chq_numero,chq_fecha,monto_chq," _
            & "date_format(chq_fecha,'%m') as 'mes',date_format(chq_fecha,'%Y') as agno" _
            & " from fnza_cheques_recibidos fcr,fnza_cod_banco fcb where fcr.banco = fcb.banco" _
            & " and date_format(chq_fecha,'%Y') = " & Format(dtp_FechaInicio.Value, "yyyy") _
            & " and chq_fecha >= '" & Format(dtp_FechaInicio.Value, "yyyy-mm-dd") _
            & "' and chq_fecha <= '" & Format(dtp_FechaTermino.Value, "yyyy-mm-dd") & "') as c left join" _
            & " (select * from fnza_chq_mvto) as m on c.folio_chq = m.folio_chq" _
            & " Where folio_mvto Is Null" _
            & " group by cta_cte,chq_serie,chq_numero"
    End If
    conn.Execute var_sql
    
    'Format(dtp_FechaInicio.Value, "yyyy-mm-dd")
    
    If Not objRS.EOF Then
        est = objRS("nom_est")
        dir = objRS("dir_est")
        Desde = "desde " & dtp_FechaInicio.Value & " hasta " & dtp_FechaTermino.Value
    End If
    objRS.Close
     
    Call LimpiaFormulas(cr_flujocheques, 30)
    cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_factoring.rpt"
    cr_flujocheques.Formulas(3) = "est = '" & est & "'"
    cr_flujocheques.Formulas(4) = "dir = '" & dir & "'"
    
    If opt_vin(0).Value = True Then
        cr_flujocheques.Formulas(5) = "desde = '" & Desde & "'"
    Else
        cr_flujocheques.Formulas(5) = "desde = '" & " NO VINCULADOS " & Desde & "'"
    End If
    
    If opt_pantalla.Value = True Then
        cr_flujocheques.Destination = crptToWindow
    End If
    cr_flujocheques.Action = 1
End Sub

Private Sub cmd_GenerarReporte_Click()
If grid_listado.TextMatrix(1, 1) <> "" Then
    Dim objRS As ADODB.Recordset
    Dim cont_hojas As Long
    Set objRS = New ADODB.Recordset
    Dim var_sql, est, dir As String
    var_sql = "SELECT nom_est,dir_est FROM establecimientos"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        est = objRS("nom_est")
        dir = objRS("dir_est")
    End If
    objRS.Close
     
'    MsgBox "listo"
    'cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar.rpt"
     
    Call LimpiaFormulas(cr_flujocheques, 30)
    If opt_Todos.Value = True Then
        cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_general.rpt"
    Else
        If opt_alumno.Value = True Then
            If chec_tod_alu.Value = 1 Then
                cr_flujocheques.Formulas(5) = "filtro = '" & "Filtro:" & "'"
                cr_flujocheques.Formulas(6) = "todos_los = '" & "Todos los alumnos" & "'"
                cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_general.rpt"
            Else
                cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_alumno.rpt"
            End If
        End If
        If opt_banco.Value = True Then
            If chec_tod_ban.Value = 1 Then
                cr_flujocheques.Formulas(5) = "filtro = '" & "Filtro:" & "'"
                cr_flujocheques.Formulas(6) = "todos_los = '" & "Todos los Bancos" & "'"
                cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_general.rpt"
            Else
                If cb_banco.Text <> "" And txt_Titular.Text <> "" Then
                    cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_titular.rpt"
                Else
                    If cb_banco.Text <> "" Then
                        cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_banco.rpt"
                    End If
                    If txt_Titular.Text <> "" Then
                        cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_titular.rpt"
                    End If
                End If
            End If
        End If
'        If opt_fecha.Value = True Then
'            cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_fecha.rpt"
'            cr_flujocheques.Formulas(1) = "fecha_inicio = '" & dtp_FechaInicio.Value & "'"
'            cr_flujocheques.Formulas(2) = "fecha_termnino = '" & dtp_FechaTermino.Value & "'"
'        End If
        If opt_curso.Value = True Then
            If chec_tod_cur.Value = 1 Then
                cr_flujocheques.Formulas(5) = "filtro = '" & "Filtro:" & "'"
                cr_flujocheques.Formulas(6) = "todos_los = '" & "Todos los cursos" & "'"
                cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_general.rpt"
            Else
                cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_cheques_a_cobrar_curso.rpt"
            End If
        End If
    End If
    
    Call LimpiaFormulas(cr_flujocheques, 30)
    cr_flujocheques.Formulas(1) = "fecha_inicio = '" & dtp_FechaInicio.Value & "'"
    cr_flujocheques.Formulas(2) = "fecha_termnino = '" & dtp_FechaTermino.Value & "'"
    cr_flujocheques.Formulas(3) = "nom_est = '" & est & "'"
    cr_flujocheques.Formulas(4) = "dir_est = '" & dir & "'"
    cr_flujocheques.Formulas(7) = "agno_consultado = '" & Year(dtp_FechaTermino.Value) & "'"
'   MsgBox cr_flujocheques.ReportLatestPage
    
'    cont_hojas = 0
'    While Not cr_flujocheques.ReportLatestPage > 0
'        cont_hojas = cont_hojas + 1
'    Wend
        
    If opt_pantalla.Value = True Then
        cr_flujocheques.Destination = crptToWindow
    Else
        cr_flujocheques.Destination = crptToPrinter
    End If
    
    'MsgBox cr_flujocheques.ReportDisplayPage
    'MsgBox cr_flujocheques.ReportStartPage
    'MsgBox cr_flujocheques.R
    cr_flujocheques.Action = 1
    cr_flujocheques.Formulas(7) = "agno_consultado = '" & cr_flujocheques.ReportLatestPage & "'"
    
'    cr_flujocheques.Action = 1
Else
    MsgBox "Na hay datos seleccionados para generar informe", vbInformation
End If
End Sub

Private Sub cmd_ProtestarCheques_Click()
    crear_tabla_flujocheques
    llenar_flujocheques
    filtrado
    agrupamiento
    Dim var_sql As String
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    var_sql = "select dia_cobro,Monto_Cheque,Banco,Numero_Cheque," _
            & "Rut_Titular,Nombre_Titular," _
            & "Fono_Titular,Nom_alu,curso" _
    & " from fnza_flujocheques_temp"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        Form_ProtestarCheques.Show 1
    Else
        MsgBox "La busqueda no arrojo resultados", vbInformation
    End If
    objRS.Close
End Sub

Private Sub cmd_limpiar_Click()
    limpia_campos
End Sub

Private Sub cmd_ReporteReducido_Click()
If grid_listado.TextMatrix(1, 1) <> "" Then
    Dim objRS As ADODB.Recordset
    Dim nivel, Filtro As String
    Set objRS = New ADODB.Recordset
    Dim var_sql, est, dir As String
    var_sql = "SELECT nom_est,dir_est FROM establecimientos"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        est = objRS("nom_est")
        dir = objRS("dir_est")
    End If
    objRS.Close
     
    Call LimpiaFormulas(cr_flujocheques, 30)
    cr_flujocheques.ReportFileName = App.Path & "\Rpt\fnza_reducido.rpt"
    cr_flujocheques.Formulas(3) = "fecha_inicio = '" & dtp_FechaInicio & "'"
    cr_flujocheques.Formulas(4) = "fecha_termino = '" & dtp_FechaTermino & "'"
    If opt_alumno.Value = True Then
        If chec_tod_alu.Value = 0 Then
            cr_flujocheques.Formulas(5) = "filtro = '" & "Alumno" & "'"
            Filtro = "Rut: " & txt_rut.Text
            cr_flujocheques.Formulas(6) = "parametros = '" & Filtro & "'"
            Filtro = "Alumno: " & txt_Alumno.Text
            cr_flujocheques.Formulas(2) = "parametros2 = '" & Filtro & "'"
        Else
            cr_flujocheques.Formulas(5) = "filtro = '" & "Todos los Alumnos" & "'"
        End If
        
    End If
    If opt_banco.Value = True Then
        If chec_tod_ban.Value = 0 Then
            If txt_Titular.Text = "" And txt_RutTitular.Text = "" Then
                cr_flujocheques.Formulas(5) = "filtro = '" & "Banco" & "'"
                Filtro = "Banco: " & cb_banco.Text
                cr_flujocheques.Formulas(6) = "parametros = '" & Filtro & "'"
            Else
                cr_flujocheques.Formulas(5) = "filtro = '" & "Titular" & "'"
                Filtro = "Rut: " & txt_RutTitular.Text
                cr_flujocheques.Formulas(6) = "parametros = '" & Filtro & "'"
                Filtro = "Titular: " & txt_Titular.Text
                cr_flujocheques.Formulas(2) = "parametros2 = '" & Filtro & "'"
            End If
        Else
            cr_flujocheques.Formulas(5) = "filtro = '" & "Todos los Bancos" & "'"
        End If
    End If
    If opt_curso.Value = True Then
        Select Case IC_Ensenanza.Text
            Case Is = "Educación Parvularia"
                nivel = "K"
            Case Is = "Educación General Básica"
                nivel = "EB"
            Case Is = "Educación Media H/C niños y jóvenes"
                nivel = "EM"
            Case Is = "Otros Tipos (Pre Kinder)"
                nivel = "PK"
        End Select
        If chec_tod_cur.Value = 0 Then
            cr_flujocheques.Formulas(5) = "filtro = '" & "Curso" & "'"
            Filtro = "Curso: " & IC_Nivel.Text & " " & IC_Letra.Text & " " & nivel
            cr_flujocheques.Formulas(6) = "parametros = '" & Filtro & "'"
        Else
            cr_flujocheques.Formulas(5) = "filtro = '" & "Todos los Cursos" & "'"
        End If
    End If
    If opt_Todos.Value = True Then
        cr_flujocheques.Formulas(5) = "filtro = '" & "Todos los Cheques" & "'"
    End If
    cr_flujocheques.Formulas(7) = "agno_consultado = '" & Year(dtp_FechaTermino.Value) & "'"
    If opt_pantalla.Value = True Then
        cr_flujocheques.Destination = crptToWindow
    Else
        cr_flujocheques.Destination = crptToPrinter
    End If
    cr_flujocheques.Action = 1
Else
    MsgBox "Na hay datos seleccionados para generar informe", vbInformation
End If
End Sub

Private Sub cmd_ver_Click(Index As Integer)
    frame_busqueda.Visible = True
    frame_busqueda.Refresh
    progreso.Min = 0
    grid_listado.Rows = 2
    grid_listado.ClearStructure
    progreso.Value = 5
    crear_tabla_flujocheques
    progreso.Value = 15
    llenar_flujocheques
    progreso = 35
    If chec_tod_alu.Value = 0 And chec_tod_ban.Value = 0 And chec_tod_cur.Value = 0 Then
        filtrado
    End If
    progreso.Value = 40
    agrupamiento
    coloca_marca
    progreso.Value = 50
    llena_grilla
    progreso.Value = 100
    frame_busqueda.Visible = False
End Sub

Private Sub Set_IC_Ensenanza()
    Dim REC As ADODB.Recordset
    Dim QRY As String
    
    QRY = "SELECT DISTINCT m.cod_ens, ce.des_ens FROM matriculas as m, codigos_ensenanza as ce WHERE m.cod_ens=ce.cod_ens AND m.anno_mat=" & IC_Agno.SelectedItem.Text & " ORDER BY ce.ord_ens;"
    Set REC = New ADODB.Recordset
    REC.Open QRY, conn
    
    IC_Ensenanza.ComboItems.Clear
    If REC.RecordCount > 0 Then
        REC.MoveFirst
        For i = 1 To REC.RecordCount
            IC_Ensenanza.ComboItems.Add i, "K" & Format(REC!Cod_Ens, "000"), REC!des_ens
            REC.MoveNext
        Next i
        Set IC_Ensenanza.SelectedItem = IC_Ensenanza.ComboItems.Item(1)
        ErrorStatus = False
        IC_Nivel.Enabled = True
        IC_Letra.Enabled = False
        Call Set_IC_Nivel
    Else
        ErrorStatus = True
        IC_Ensenanza.Enabled = False
        IC_Nivel.Enabled = False
        IC_Letra.Enabled = False
    End If
    REC.Close
End Sub

Private Sub cmd_ver_alumno_Click()
    If (chec_tod_alu.Value = 1) Or _
    (chec_tod_alu.Value = 0 And txt_Alumno.Text <> "" And txt_rut.Text <> "") Then
    frame_busqueda.Visible = True
    frame_busqueda.Refresh
    progreso.Min = 0
    progreso.Value = 0
    grid_listado.Rows = 2
    grid_listado.ClearStructure
    'progreso.Value = 5
    crear_tabla_flujocheques
    'progreso.Value = 15
    llenar_flujocheques
    'progreso = 35
    If chec_tod_alu.Value = 0 And chec_tod_ban.Value = 0 And chec_tod_cur.Value = 0 Then
        filtrado
    End If
    progreso.Value = 40
    agrupamiento
    coloca_marca
    progreso.Value = 50
    llena_grilla
    progreso.Value = 100
    frame_busqueda.Visible = False
    Else
    MsgBox "Para poder realizar la busqueda primero debe seleccionar un alumno", vbInformation
    End If
End Sub

Private Sub cmd_ver_banco_Click()
    If (chec_tod_ban.Value = 1) Or _
    (chec_tod_ban.Value = 0 And ((txt_RutTitular.Text <> "" And txt_Titular.Text <> "") Or _
    cb_banco.Text <> "")) Then
        frame_busqueda.Visible = True
        frame_busqueda.Refresh
        progreso.Min = 0
        progreso.Value = 0
        grid_listado.Rows = 2
        grid_listado.ClearStructure
        'progreso.Value = 5
        crear_tabla_flujocheques
        'progreso.Value = 15
        llenar_flujocheques
        'progreso = 35
        If chec_tod_alu.Value = 0 And chec_tod_ban.Value = 0 And chec_tod_cur.Value = 0 Then
            filtrado
        End If
        progreso.Value = 40
        agrupamiento
        coloca_marca
        progreso.Value = 50
        llena_grilla
        progreso.Value = 100
        frame_busqueda.Visible = False
    Else
        MsgBox "Para poder realizar la busqueda primero debe seleccionar un titular o banco", vbInformation
    End If
End Sub

Private Sub cmd_ver_todos_Click()
    frame_busqueda.Visible = True
    frame_busqueda.Refresh
    progreso.Min = 0
    progreso.Value = 0
    grid_listado.Rows = 2
    grid_listado.ClearStructure
    'progreso.Value = 5
    crear_tabla_flujocheques
    'progreso.Value = 15
    llenar_flujocheques
    'progreso = 35
    If chec_tod_alu.Value = 0 And chec_tod_ban.Value = 0 And chec_tod_cur.Value = 0 Then
        filtrado
    End If
    'progreso.Value = 40
    agrupamiento
    coloca_marca
    progreso.Value = 50
    llena_grilla
    'progreso.Value = 100
    frame_busqueda.Visible = False
End Sub



Private Sub Form_Load()
    Me.Top = 0
    Me.Left = 0
    IC_Letra.Text = ""
    IC_Letra.ComboItems.Clear
    Call Set_IC_Agno
    dtp_FechaInicio.Value = Date
    dtp_FechaTermino.Value = Date
    carga_bancos
    opt_alumno_Click
End Sub

Private Sub IC_Agno_Click()
    IC_Ensenanza.Enabled = True
    Set_IC_Ensenanza
End Sub

Private Sub IC_Ensenanza_Click()
    IC_Nivel.Enabled = True
    Call Set_IC_Nivel
End Sub

Private Sub IC_Nivel_Click()
    If Check_Letra.Value = 1 Then
        IC_Letra.Enabled = True
        Call Set_IC_Letra
    End If
End Sub

Private Sub lst_Alumnos_dblClick()
    txt_Alumno = lst_Alumnos.Text
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT ci_alu from postulantes" _
            & " Where concat(ape_pat_alu,' ', ape_mat_alu,' ', nom_alu)='" & txt_Alumno & "'"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        txt_rut = objRS("ci_alu")
    End If
    lst_Alumnos.Visible = False
End Sub

Private Sub lst_RutAlumno_DblClick()
    txt_rut = lst_RutAlumno.Text
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT concat(ape_pat_alu,' ', ape_mat_alu,' ', nom_alu) as nombre from postulantes" _
            & " Where ci_alu='" & txt_rut & "'"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        txt_Alumno = objRS("nombre")
    End If
    lst_RutAlumno.Visible = False
End Sub

Private Sub lst_RutTitular_DblClick()
    txt_RutTitular = lst_RutTitular.Text
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT nom_titular from fnza_cheques_recibidos" _
            & " Where run_titular='" & txt_RutTitular & "'"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        txt_Titular = objRS("nom_titular")
    End If
    lst_RutTitular.Visible = False
End Sub

Private Sub lst_Titular_Click()
    txt_Titular = lst_Titular.Text
    lst_Titular.Visible = False
    Dim objRS As ADODB.Recordset
    Dim var_sql As String
    Set objRS = New ADODB.Recordset
    var_sql = "select run_titular from fnza_cheques_recibidos" _
            & " where nom_titular = '" & txt_Titular & "'"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        txt_RutTitular = objRS("run_titular")
    End If
End Sub

Private Sub opt_alumno_Click()
    oculta_frame
    limpia_campos
    frm_alumno.Visible = True
End Sub

Private Sub opt_banco_Click()
    oculta_frame
    limpia_campos
    frm_banco.Visible = True
End Sub

Private Sub opt_curso_Click()
    oculta_frame
    limpia_campos
    frm_curso.Visible = True
End Sub

Private Sub opt_fecha_Click()
    oculta_frame
    limpia_campos
    frm_fecha.Visible = True
End Sub

Private Sub opt_factoring_Click()
    oculta_frame
    limpia_campos
    frm_factoring.Visible = True
End Sub

Private Sub opt_todos_Click()
    oculta_frame
    limpia_campos
    frame_todos.Visible = True
End Sub

Private Sub txt_Alumno_Change()
    If txt_Alumno <> "" And txt_rut = "" Then
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT concat(ape_pat_alu,' ', ape_mat_alu,' ', nom_alu) nombre" _
            & " FROM postulantes p,fnza_chq_mvto fcm" _
            & " Where concat(ape_pat_alu,' ', ape_mat_alu,' ', nom_alu)" _
            & " LIKE '" & txt_Alumno & "%'" _
            & " and p.ci_alu = fcm.run_alu" _
            & " group by p.ci_alu"
    objRS.Open var_sql, conn
    lst_Alumnos.Clear
    If Not objRS.EOF Then
        lst_Alumnos.Visible = True
    End If
    While Not objRS.EOF
        lst_Alumnos.AddItem objRS("nombre")
        objRS.MoveNext
    Wend
    objRS.Close
    End If
  
End Sub

Private Sub txt_rut_Change()
If txt_rut <> "" And txt_Alumno = "" Then
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT ci_alu" _
            & " FROM postulantes p,fnza_chq_mvto fcm" _
            & " Where ci_alu LIKE '" & txt_rut & "%'" _
            & " and p.ci_alu = fcm.run_alu" _
            & " group by p.ci_alu"
    objRS.Open var_sql, conn
    lst_RutAlumno.Clear
    If Not objRS.EOF Then
        lst_RutAlumno.Visible = True
    End If
    While Not objRS.EOF
        lst_RutAlumno.AddItem objRS("ci_alu")
        objRS.MoveNext
    Wend
    objRS.Close
End If
End Sub

Private Sub txt_RutTitular_Change()
    If txt_RutTitular <> "" And txt_Titular = "" Then
        Dim objRS As ADODB.Recordset
        Set objRS = New ADODB.Recordset
        Dim var_sql As String
        var_sql = "SELECT run_titular FROM fnza_cheques_recibidos" _
            & " Where run_titular LIKE '" & txt_RutTitular & "%'" _
            & " group by run_titular"
        objRS.Open var_sql, conn
        lst_RutTitular.Clear
        If Not objRS.EOF Then
            lst_RutTitular.Visible = True
        End If
        While Not objRS.EOF
            lst_RutTitular.AddItem objRS("run_titular")
            objRS.MoveNext
        Wend
        objRS.Close
    End If
  
End Sub

Private Sub txt_Titular_Change()
    If txt_Titular <> "" And txt_RutTitular = "" Then
        llenar_listbox_titular
    End If
  
End Sub

Private Sub crear_tabla_flujocheques()
    Dim j As Long
    Dim var_sql As String
    Dim objQRY As String
    Dim objCMD As ADODB.Command
    Set objCMD = New ADODB.Command
    objCMD.ActiveConnection = conn
    objCMD.CommandType = adCmdText
    objQRY = "DROP TABLE IF EXISTS fnza_flujocheques_temp;"
    objCMD.CommandText = objQRY
    objCMD.Execute
    objQRY = "CREATE TABLE IF NOT EXISTS fnza_flujocheques_temp " & _
                "(" & _
                "dia_cobro date NOT NULL default '0000-00-00', " & _
                "monto_cheque bigint(20) NOT NULL default '0', " & _
                "folio_chq bigint(20) NOT NULL default '0', " & _
                "folio_mvto bigint(20) NOT NULL default '0', " & _
                "banco varchar(50) NOT NULL default '', " & _
                "numero_cheque varchar(40) NOT NULL default '', " & _
                "rut_titular varchar(10) NOT NULL default '', " & _
                "nombre_titular varchar(20) NOT NULL default '', " & _
                "fono_titular varchar(12) NOT NULL default '', " & _
                "run_alu varchar(50) NOT NULL default '', " & _
                "nom_alu varchar(50) NOT NULL default '', " & _
                "marca bigint(20) NOT NULL default '0', " & _
                "cta_cte varchar(50) NOT NULL default '', " & _
                "curso varchar(6) NOT NULL default '', " & _
                "cont_chq_dia bigint(20) NOT NULL default '0', " & _
                "acum_chq_dia bigint(20) NOT NULL default '0', " & _
                "cont_chq_tot bigint(20) NOT NULL default '0', " & _
                "acum_chq_tot bigint(20) NOT NULL default '0', " & _
                "cant_banco bigint(20) NOT NULL default '0', " & _
                "monto_banco bigint(20) NOT NULL default '0', " & _
                "PRIMARY KEY (folio_chq,folio_mvto,dia_cobro), " & _
                "UNIQUE KEY unique_index_fnza_flujocheques_temp(folio_chq,folio_mvto,dia_cobro) " & _
                ") ENGINE=MyISAM;"
    objCMD.CommandText = objQRY
    objCMD.Execute
End Sub

Private Sub crear_tabla_reducido()
    Dim j As Long
    Dim var_sql As String
    Dim objQRY As String
    Dim objCMD As ADODB.Command
    Set objCMD = New ADODB.Command
    objCMD.ActiveConnection = conn
    objCMD.CommandType = adCmdText
    objQRY = "DROP TABLE IF EXISTS fnza_reducido_temp;"
    objCMD.CommandText = objQRY
    objCMD.Execute
    objQRY = "CREATE TABLE IF NOT EXISTS fnza_reducido_temp " & _
                "(" & _
                "dia_cobro date NOT NULL default '0000-00-00', " & _
                "monto_cheque bigint(20) NOT NULL default '0', " & _
                "folio_chq bigint(20) NOT NULL default '0', " & _
                "folio_mvto bigint(20) NOT NULL default '0', " & _
                "banco varchar(50) NOT NULL default '', " & _
                "numero_cheque varchar(40) NOT NULL default '', " & _
                "rut_titular varchar(10) NOT NULL default '', " & _
                "nombre_titular varchar(20) NOT NULL default '', " & _
                "fono_titular varchar(12) NOT NULL default '', " & _
                "run_alu varchar(50) NOT NULL default '', " & _
                "nom_alu varchar(50) NOT NULL default '', " & _
                "marca bigint(20) NOT NULL default '0', " & _
                "cta_cte varchar(50) NOT NULL default '', " & _
                "curso varchar(6) NOT NULL default '', " & _
                "cont_chq_dia bigint(20) NOT NULL default '0', " & _
                "acum_chq_dia bigint(20) NOT NULL default '0', " & _
                "cont_chq_tot bigint(20) NOT NULL default '0', " & _
                "acum_chq_tot bigint(20) NOT NULL default '0', " & _
                "cant_banco bigint(20) NOT NULL default '0', " & _
                "monto_banco bigint(20) NOT NULL default '0', " & _
                "PRIMARY KEY (folio_chq,folio_mvto,dia_cobro), " & _
                "UNIQUE KEY unique_index_fnza_reducido_temp(folio_chq,folio_mvto,dia_cobro) " & _
                ") ENGINE=MyISAM;"
    objCMD.CommandText = objQRY
    objCMD.Execute
End Sub


Private Sub llenar_flujocheques()
    Dim nombre, curso As String
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim REC As ADODB.Recordset
    Set REC = New ADODB.Recordset
    Dim var_sql As String
    Dim a, b As Integer

var_sql = "select fcr.cta_cte,fcm.folio_chq,fcm.folio_mvto,fcm.run_apo,fcm.run_alu," _
& "chq_fecha,monto_chq,descripcion," _
& "concat(chq_serie,' ',chq_numero) as numero_cheque,run_titular,nom_titular,tel_titular" _
& " from fnza_cheques_recibidos fcr,fnza_chq_mvto fcm,fnza_cod_banco fcb" _
& " Where fcr.folio_chq = fcm.folio_chq And fcr.Banco = fcb.Banco" _
& " and estado_chq = 'cart' and chq_fecha >= '" & Format(dtp_FechaInicio.Value, "yyyy-mm-dd") _
& "' and chq_fecha <= '" & Format(dtp_FechaTermino.Value, "yyyy-mm-dd") _
& "' group by cta_cte,numero_cheque,fcm.run_alu"

    
    objRS.Open var_sql, conn
    a = objRS.RecordCount
    a = Val(a / 35)
    b = 0
    While Not objRS.EOF
        b = b + 1
        If b = a Then
            progreso.Value = progreso.Value + 1
            'progreso.Refresh
            b = 0
        End If
        curso = ""
        nombre = ""
        
        var_sql = "select mat.num_gra,mat.cod_des,axc.let_cur from" _
                & " (select * from matriculas m,codigos_ensenanza ce" _
                & " where m.cod_ens = ce.cod_ens and m.anno_mat = " & Format(dtp_FechaTermino.Value, "yyyy") _
                & " and m.ci_alu = '" & objRS("run_alu") & "') as mat" _
                & " left join alu_x_cur axc on mat.ci_alu = axc.ci_alu and" _
                & " mat.anno_mat = axc.agno and mat.fec_mat = axc.fec_mat and" _
                & " mat.activo_alu = axc.activo_alu And mat.Cod_Ens = axc.Cod_Ens" _
                & " And mat.Num_Gra = axc.Num_Gra"
        REC.Open var_sql, conn
        If Not REC.EOF Then
            If IsNull(REC("let_cur")) Then
                curso = ""
            Else
                curso = REC("num_gra") & " " & REC("let_cur") & " " & REC("cod_des")
            End If
        End If
        REC.Close
        
        var_sql = "select concat(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu)as nom_alu" _
                & " From postulantes p" _
                & " where p.ci_alu = '" & objRS("run_alu") & "'"
        REC.Open var_sql, conn
        If Not REC.EOF Then
            nombre = REC("nom_alu")
        End If
        REC.Close
        
'        var_sql = "SELECT p.ci_alu,concat(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) as nombre," _
'                & "concat(axc.num_gra,' ',let_cur,' ',cod_des) as curso,des_ens" _
'                & " FROM postulantes p,alu_x_cur axc,codigos_ensenanza ce" _
'                & " Where p.Ci_alu = axc.Ci_alu And p.Cod_Ens = ce.Cod_Ens and " _
'                & " p.ci_alu = '" & objRS("run_alu") & "'"
'        objRS_alu.Open var_sql, conn
'
'        If Not objRS_alu.EOF Then
'            nombre = objRS_alu("nombre")
'            curso = objRS_alu("curso")
'        Else
'            var_sql = "SELECT ci_alu,concat(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) as nombre" _
'                    & " FROM postulantes Where ci_alu = '" & objRS("run_alu") & "'"
'            objRS_sin.Open var_sql, conn
'            If Not objRS_sin.EOF Then
'                nombre = objRS_sin("nombre")
'            End If
'            objRS_sin.Close
'        End If
'        objRS_alu.Close
        
        var_sql = "insert into fnza_flujocheques_temp(cta_cte,folio_chq,folio_mvto,dia_cobro,monto_cheque,banco,numero_cheque," _
            & "rut_titular,nombre_titular,fono_titular,run_alu,nom_alu,curso)" _
            & " values('" & objRS("cta_cte") & "'," & objRS("folio_chq") & "," & objRS("folio_mvto") & ",'" _
            & Format(objRS("chq_fecha"), "yyyy-mm-dd") _
            & "'," & objRS("monto_chq") & ",'" & objRS("descripcion") _
            & "','" & objRS("numero_cheque") & "','" & objRS("run_titular") & "','" _
            & objRS("nom_titular") & "','" _
            & objRS("tel_titular") & "','" _
            & objRS("run_alu") & "','" _
            & nombre & "','" & curso & "')"
       
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
    
End Sub

Private Sub agrupamiento()
    Dim a, b As Integer
    Dim objRS As ADODB.Recordset
    Dim total_cheques, Monto_Total, cont, acum As Long
    total_cheques = 0
    Monto_Total = 0
    Set objRS = New ADODB.Recordset
    Dim objRS_agr As ADODB.Recordset
    Set objRS_agr = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT dia_cobro,count(numero_cheque) as total,sum(monto_cheque) as monto" _
            & " FROM fnza_flujocheques_temp" _
            & " group by dia_cobro" _
            & " order by dia_cobro"
    objRS.Open var_sql, conn
    a = Val(objRS.RecordCount / 5)
    b = 0
    While Not objRS.EOF
        b = b + 1
        If b = a Then
            progreso.Value = progreso.Value + 1
            b = 0
        End If
        var_sql = "update fnza_flujocheques_temp set" _
                    & " cont_chq_dia = " & objRS("total") _
                    & ",acum_chq_dia = " & objRS("monto") _
                    & " where dia_cobro = '" & Format(objRS("dia_cobro"), "yyyy-mm-dd") & "'"
        Monto_Total = Monto_Total + objRS("monto")
        total_cheques = total_cheques + objRS("total")
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
    If total_cheques > 0 And Monto_Total > 0 Then
        var_sql = "update fnza_flujocheques_temp set" _
                & " cont_chq_tot = " & total_cheques _
                & ",acum_chq_tot = " & Monto_Total
        conn.Execute var_sql
    End If
    
    var_sql = "SELECT dia_cobro,monto_cheque,count(numero_cheque) cant_banco," _
            & "sum(monto_cheque) as monto_banco,banco" _
            & " From fnza_flujocheques_temp" _
            & " group by dia_cobro,banco" _
            & " order by dia_cobro,banco"
    objRS.Open var_sql, conn
    a = Val(objRS.RecordCount / 5)
    b = 0
    While Not objRS.EOF
        b = b + 1
        If b = a Then
            progreso.Value = progreso.Value + 1
            b = 0
        End If
        var_sql = "update fnza_flujocheques_temp set" _
                & " cant_banco = " & objRS("cant_banco") _
                & ",monto_banco = " & objRS("monto_banco") _
                & " where dia_cobro = '" & Format(objRS("dia_cobro"), "yyyy-mm-dd") & "'" _
                & " and banco = '" & objRS("banco") & "'"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
End Sub

Private Sub filtrado()
    Dim nivel, curso, sql As String
    Dim total_cheques As Long
    Dim total_monto As Double
    Dim estado_cheque As String
    estado_cheque = ""
    
    Dim var_sql, condicion As String
    
    var_sql = "select * from fnza_flujocheques_temp where "
    
    If txt_Alumno.Text <> "" Then
        If condicion <> "" Then
            condicion = condicion & " and run_alu = '" & txt_rut & "'"
        Else
            condicion = condicion & "run_alu = '" & txt_rut & "'"
        End If
    End If
    
    If txt_Titular <> "" Then
        If condicion <> "" Then
            condicion = condicion & " and nombre_titular = '" & txt_Titular & "'"
        Else
            condicion = condicion & "nombre_titular = '" & txt_Titular & "'"
        End If
    End If
    
    If cb_banco.Text <> "" Then
        If cb_banco.Text <> "TODOS" Then
            If condicion <> "" Then
                condicion = condicion & " and banco = '" & cb_banco & "'"
            Else
                condicion = condicion & "banco = '" & cb_banco & "'"
            End If
        End If
    End If
        
    If frm_fecha.Enabled = True Then
        If condicion <> "" Then
            condicion = condicion & " and dia_cobro Between '" _
            & Format(dtp_FechaInicio.Value, "yyyy-mm-dd") & "' and '" _
            & Format(dtp_FechaTermino.Value, "yyyy-mm-dd") & "'"
        Else
            condicion = condicion & "dia_cobro Between '" _
            & Format(dtp_FechaInicio.Value, "yyyy-mm-dd") & "' and '" _
            & Format(dtp_FechaTermino.Value, "yyyy-mm-dd") & "'"
        End If
    End If

    If opt_curso.Value = True Then
        Select Case IC_Ensenanza.Text
            Case Is = "Educación Parvularia"
                nivel = "K"
            Case Is = "Educación General Básica"
                nivel = "EB"
            Case Is = "Educación Media H/C niños y jóvenes"
                nivel = "EM"
            Case Is = "Otros Tipos (Pre Kinder)"
                nivel = "PK"
            End Select
        If Check_Letra.Value = 0 Then
            curso = "curso like '" & Val(IC_Nivel.Text) & "%' and" _
                  & " curso like '%" & nivel & "'"
        Else
            cur_completo = Val(IC_Nivel.Text) & " " & IC_Letra.Text & " " & nivel
            curso = "curso = '" & cur_completo & "'"
        End If
        
        If condicion <> "" Then
            condicion = condicion & " and " & curso
        Else
            condicion = curso
        End If
    End If
    
    If Len(condicion) > 2 Then
        var_sql = var_sql & condicion
    Else
        var_sql = "select * from fnza_flujocheques_temp"
    End If
    'MsgBox var_sql
    
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset

    objRS.Open var_sql, conn
    conn.Execute "delete from fnza_flujocheques_temp"
    While Not objRS.EOF
        var_sql = "insert into fnza_flujocheques_temp(cta_cte,folio_chq,folio_mvto," _
            & "dia_cobro,monto_cheque,banco,numero_cheque," _
            & "rut_titular,nombre_titular,fono_titular,run_alu,nom_alu,curso," _
            & "cont_chq_dia,acum_chq_dia,cont_chq_tot,acum_chq_tot)" _
            & " values('" & objRS("cta_cte") & "'," & objRS("folio_chq") & "," & objRS("folio_mvto") & ",'" _
            & Format(objRS("dia_cobro"), "yyyy-mm-dd") _
            & "'," & objRS("monto_cheque") & ",'" & objRS("banco") _
            & "','" & objRS("numero_cheque") & "','" & objRS("rut_titular") & "','" _
            & objRS("nombre_titular") & "','" _
            & objRS("fono_titular") & "','" & objRS("run_alu") & "','" _
            & objRS("nom_alu") & "','" & objRS("curso") & "'," _
            & objRS("cont_chq_dia") & "," & objRS("acum_chq_dia") & "," _
            & objRS("cont_chq_tot") & "," & objRS("acum_chq_tot") & ")"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
End Sub

Private Sub agrupar_por_diabanco()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select * from fnza_flujocheques_temp" _
            & " group by dia_cobro,banco,cta_cte,numero_cheque"
    objRS.Open var_sql, conn
    'var_sql = "delete from table fnza_flujocheques_temp"
    conn.Execute "delete from fnza_flujocheques_temp"
    While Not objRS.EOF
        var_sql = "insert into fnza_flujocheques_temp(cta_cte,folio_chq,folio_mvto," _
            & "dia_cobro,monto_cheque,banco,numero_cheque," _
            & "rut_titular,nombre_titular,fono_titular,run_alu,nom_alu,curso," _
            & "cont_chq_dia,acum_chq_dia,cont_chq_tot,acum_chq_tot,cant_banco,monto_banco)" _
            & " values('" & objRS("cta_cte") & "'," & objRS("folio_chq") & "," & objRS("folio_mvto") & ",'" _
            & Format(objRS("dia_cobro"), "yyyy-mm-dd") _
            & "'," & objRS("monto_cheque") & ",'" & objRS("banco") _
            & "','" & objRS("numero_cheque") & "','" & objRS("rut_titular") & "','" _
            & objRS("nombre_titular") & "','" _
            & objRS("fono_titular") & "','" & objRS("run_alu") & "','" _
            & objRS("nom_alu") & "','" & objRS("curso") & "'," _
            & objRS("cont_chq_dia") & "," & objRS("acum_chq_dia") & "," _
            & objRS("cont_chq_tot") & "," & objRS("acum_chq_tot") & "," _
            & objRS("cant_banco") & "," & objRS("monto_banco") & ")"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
End Sub

Private Sub agrupamiento_reducido()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select * from fnza_reducido_temp" _
            & " group by dia_cobro,banco"
    objRS.Open var_sql, conn
    'var_sql = "delete from table fnza_flujocheques_temp"
    conn.Execute "delete from fnza_reducido_temp"
    While Not objRS.EOF
        var_sql = "insert into fnza_reducido_temp(cta_cte,folio_chq,folio_mvto," _
            & "dia_cobro,monto_cheque,banco,numero_cheque," _
            & "rut_titular,nombre_titular,fono_titular,run_alu,nom_alu,curso," _
            & "cont_chq_dia,acum_chq_dia,cont_chq_tot,acum_chq_tot,cant_banco,monto_banco)" _
            & " values('" & objRS("cta_cte") & "'," & objRS("folio_chq") & "," & objRS("folio_mvto") & ",'" _
            & Format(objRS("dia_cobro"), "yyyy-mm-dd") _
            & "'," & objRS("monto_cheque") & ",'" & objRS("banco") _
            & "','" & objRS("numero_cheque") & "','" & objRS("rut_titular") & "','" _
            & objRS("nombre_titular") & "','" _
            & objRS("fono_titular") & "','" & objRS("run_alu") & "','" _
            & objRS("nom_alu") & "','" & objRS("curso") & "'," _
            & objRS("cont_chq_dia") & "," & objRS("acum_chq_dia") & "," _
            & objRS("cont_chq_tot") & "," & objRS("acum_chq_tot") & "," _
            & objRS("cant_banco") & "," & objRS("monto_banco") & ")"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
End Sub

Public Sub limpia_campos()
    chec_tod_alu.Value = 0
    chec_tod_ban.Value = 0
    chec_tod_cur.Value = 0
    progreso.Min = 0
    lst_Alumnos.Visible = False
    lst_RutAlumno.Visible = False
    lst_RutTitular.Visible = False
    lst_Titular.Visible = False
    txt_Alumno.Text = ""
    txt_rut.Text = ""
    txt_RutTitular.Text = ""
    txt_Titular.Text = ""
    cb_banco.Text = ""
    frame_reporte.Enabled = True
    grid_listado.ClearStructure
    grid_listado.Rows = 2
End Sub

Public Sub oculta_frame()
    frm_factoring.Visible = False
    frm_alumno.Visible = False
    frm_banco.Visible = False
    frm_curso.Visible = False
    frame_todos.Visible = False
End Sub

Public Sub llena_grilla()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT dia_cobro as 'Dia Cobro',run_alu as 'Rut. Alu.'," _
            & " nom_alu as 'Alumno',banco,monto_cheque as 'Monto'," _
            & " numero_cheque as 'Nro. Cheque',rut_titular as 'Rut. Titular'," _
            & " nombre_titular as 'titular',fono_titular as 'telefono'" _
            & " FROM `fnza_flujocheques_temp`"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        Call Rec2Grid(objRS, grid_listado, True)
        grid_listado.ColSel = grid_listado.Cols - 1
    Else
        MsgBox "La consulta no arrojo resultados", vbInformation
    End If
End Sub

Private Sub Set_IC_Nivel()
    Dim REC As ADODB.Recordset
    Dim QRY As String

    QRY = "SELECT DISTINCT m.num_gra FROM matriculas as m WHERE m.cod_ens='" & Mid(IC_Ensenanza.SelectedItem.Key, 2) & "' AND m.anno_mat=" & IC_Agno.SelectedItem.Text & " ORDER BY m.num_gra;"
    Set REC = New ADODB.Recordset
    REC.Open QRY, conn
    
    IC_Nivel.ComboItems.Clear
    If REC.RecordCount > 0 Then
        REC.MoveFirst
        For i = 1 To REC.RecordCount
            IC_Nivel.ComboItems.Add i, , str(REC!Num_Gra)
            REC.MoveNext
        Next i
        Set IC_Nivel.SelectedItem = IC_Nivel.ComboItems.Item(1)
        ErrorStatus = False
        ' Llenar Siguiente Combo.
        If Check_Letra.Value = 1 Then
            IC_Letra.Enabled = True
            Call Set_IC_Letra
        End If
    Else
        ErrorStatus = True
        IC_Nivel.Enabled = False
        IC_Letra.Enabled = False
    End If
    REC.Close
End Sub

Private Sub Set_IC_Letra()
    Dim REC As ADODB.Recordset
    Dim QRY As String
    
    If Check_Letra.Value = 1 Then
        IC_Letra.ComboItems.Clear
        IC_Letra.Text = ""
        QRY = "SELECT DISTINCT m.let_cur FROM alu_x_cur as m WHERE m.cod_ens='" & Mid(IC_Ensenanza.SelectedItem.Key, 2) & "' AND m.agno=" & Trim(IC_Agno.SelectedItem.Text) & " AND m.num_gra='" & Trim(IC_Nivel.SelectedItem.Text) & "' ORDER BY m.num_gra;"
        Set REC = New ADODB.Recordset
        REC.Open QRY, conn
        If REC.RecordCount > 0 Then
            REC.MoveFirst
            For i = 1 To REC.RecordCount
                IC_Letra.ComboItems.Add i, , REC!Let_Cur
                REC.MoveNext
            Next i
            Set IC_Letra.SelectedItem = IC_Letra.ComboItems.Item(1)
            ErrorStatus = False
            ' Llenar Siguiente Combo.
        Else
            ErrorStatus = True
            Check_Letra.Value = 0
            IC_Letra.Enabled = False
        End If
        REC.Close
    Else
        ErrorStatus = False
        IC_Letra.Enabled = False
    End If
End Sub

Private Sub Set_IC_Agno()
    Dim agno As Integer
    
    agno = IIf(Year(Date) < 2005, 2005, Year(Date))
    IC_Agno.ComboItems.Clear
    For i = 1 To (agno - 2004) + 1
        IC_Agno.ComboItems.Add i, , str(i + 2004)
    Next i
    Set IC_Agno.SelectedItem = IC_Agno.ComboItems.Item(i - 2)
    ErrorStatus = False
    ' Llenar combo enseñanza
    IC_Ensenanza.Enabled = True
    IC_Nivel.Enabled = False
    IC_Letra.Enabled = False
    Call Set_IC_Ensenanza
End Sub




Public Sub coloca_marca()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select * from fnza_flujocheques_temp" _
            & " group by cta_cte,numero_cheque"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        var_sql = "update fnza_flujocheques_temp set" _
                & " marca = " & 1 _
                & " where cta_cte = '" & objRS("cta_cte") & "' and" _
                & " numero_cheque = '" & objRS("numero_cheque") _
                & "' and run_alu = '" & objRS("run_alu") & "'"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
End Sub

Public Sub llenar_reducido()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select * from fnza_flujocheques_temp" _
            & " group by cta_cte,numero_cheque"
    
    objRS.Open var_sql, conn
    conn.Execute "delete from fnza_flujocheques_temp"
    While Not objRS.EOF
        var_sql = "insert into fnza_flujocheques_temp(cta_cte,folio_chq,folio_mvto," _
            & "dia_cobro,monto_cheque,banco,numero_cheque," _
            & "rut_titular,nombre_titular,fono_titular,run_alu,nom_alu,curso," _
            & "cont_chq_dia,acum_chq_dia,cont_chq_tot,acum_chq_tot)" _
            & " values('" & objRS("cta_cte") & "'," & objRS("folio_chq") & "," & objRS("folio_mvto") & ",'" _
            & Format(objRS("dia_cobro"), "yyyy-mm-dd") _
            & "'," & objRS("monto_cheque") & ",'" & objRS("banco") _
            & "','" & objRS("numero_cheque") & "','" & objRS("rut_titular") & "','" _
            & objRS("nombre_titular") & "','" _
            & objRS("fono_titular") & "','" & objRS("run_alu") & "','" _
            & objRS("nom_alu") & "','" & objRS("curso") & "'," _
            & objRS("cont_chq_dia") & "," & objRS("acum_chq_dia") & "," _
            & objRS("cont_chq_tot") & "," & objRS("acum_chq_tot") & ")"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
End Sub

Private Sub agrupar_por_diabanco_reducido()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select * from fnza_reducido_temp" _
            & " group by dia_cobro,banco"
    objRS.Open var_sql, conn
    'var_sql = "delete from table fnza_flujocheques_temp"
    conn.Execute "delete from fnza_reducido_temp"
    While Not objRS.EOF
        var_sql = "insert into fnza_reducido_temp(cta_cte,folio_chq,folio_mvto," _
            & "dia_cobro,monto_cheque,banco,numero_cheque," _
            & "rut_titular,nombre_titular,fono_titular,run_alu,nom_alu,curso," _
            & "cont_chq_dia,acum_chq_dia,cont_chq_tot,acum_chq_tot,cant_banco,monto_banco)" _
            & " values('" & objRS("cta_cte") & "'," & objRS("folio_chq") & "," & objRS("folio_mvto") & ",'" _
            & Format(objRS("dia_cobro"), "yyyy-mm-dd") _
            & "'," & objRS("monto_cheque") & ",'" & objRS("banco") _
            & "','" & objRS("numero_cheque") & "','" & objRS("rut_titular") & "','" _
            & objRS("nombre_titular") & "','" _
            & objRS("fono_titular") & "','" & objRS("run_alu") & "','" _
            & objRS("nom_alu") & "','" & objRS("curso") & "'," _
            & objRS("cont_chq_dia") & "," & objRS("acum_chq_dia") & "," _
            & objRS("cont_chq_tot") & "," & objRS("acum_chq_tot") & "," _
            & objRS("cant_banco") & "," & objRS("monto_banco") & ")"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
End Sub
