VERSION 5.00
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_InformeCheques 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Informe de Cheques"
   ClientHeight    =   6705
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11355
   Icon            =   "Form_InformeCheques.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6705
   ScaleWidth      =   11355
   Begin MSComctlLib.ProgressBar progreso 
      Height          =   855
      Left            =   240
      TabIndex        =   68
      Top             =   5520
      Width           =   4815
      _ExtentX        =   8493
      _ExtentY        =   1508
      _Version        =   393216
      Appearance      =   1
      Scrolling       =   1
   End
   Begin VB.Frame frame_busqueda 
      Height          =   735
      Left            =   2400
      TabIndex        =   66
      Top             =   3480
      Visible         =   0   'False
      Width           =   6975
      Begin VB.Label Label11 
         Alignment       =   2  'Center
         Caption         =   "Realizando proceso de busqueda"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   15.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   840
         TabIndex        =   67
         Top             =   240
         Width           =   5295
      End
   End
   Begin VB.Frame Frame1 
      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        =   61
      Top             =   5280
      Width           =   5055
   End
   Begin VB.Frame Frame5 
      Caption         =   "Tipos de Cheque"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   735
      Left            =   3120
      TabIndex        =   12
      Top             =   1560
      Width           =   6615
      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          =   375
         Left            =   5640
         TabIndex        =   16
         Top             =   240
         Value           =   -1  'True
         Width           =   855
      End
      Begin VB.OptionButton opt_Protestados 
         Caption         =   "Protestados"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2160
         TabIndex        =   15
         Top             =   240
         Width           =   1215
      End
      Begin VB.OptionButton opt_Cobrados 
         Caption         =   "Cobrados"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3960
         TabIndex        =   14
         Top             =   240
         Width           =   1095
      End
      Begin VB.OptionButton opt_SinCobrar 
         Caption         =   "Sin Cobrar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   360
         TabIndex        =   13
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.Frame Frame2 
      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            =   8880
      TabIndex        =   37
      Top             =   5280
      Width           =   2295
      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            =   360
         TabIndex        =   40
         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            =   360
         TabIndex        =   38
         Top             =   720
         Width           =   1575
      End
   End
   Begin VB.Frame frame_por 
      Caption         =   "Buscar por"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2175
      Left            =   120
      TabIndex        =   29
      Top             =   120
      Width           =   1695
      Begin VB.OptionButton opt_General 
         Caption         =   "Todos"
         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        =   34
         Top             =   1800
         Width           =   1335
      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          =   255
         Left            =   120
         TabIndex        =   33
         Top             =   1440
         Width           =   1335
      End
      Begin VB.OptionButton opt_apoderado 
         Caption         =   "Por Apoderado"
         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        =   32
         Top             =   1080
         Width           =   1455
      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          =   255
         Left            =   120
         TabIndex        =   31
         Top             =   720
         Width           =   1455
      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          =   255
         Left            =   120
         TabIndex        =   30
         Top             =   360
         Value           =   -1  'True
         Width           =   1455
      End
   End
   Begin Crystal.CrystalReport cr_InformeCheques 
      Left            =   10200
      Top             =   1560
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   262150
   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            =   5280
      TabIndex        =   17
      Top             =   5280
      Width           =   3495
      Begin VB.CommandButton cmd_sincheque 
         Caption         =   "Cuotas sin Cheque"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1680
         TabIndex        =   60
         Top             =   720
         Visible         =   0   'False
         Width           =   1575
      End
      Begin VB.CommandButton cmd_GenerarReporte 
         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          =   375
         Left            =   1680
         TabIndex        =   20
         Top             =   240
         Width           =   1575
      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          =   375
         Left            =   240
         TabIndex        =   19
         Top             =   720
         Width           =   1455
      End
      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            =   240
         TabIndex        =   18
         Top             =   360
         Value           =   -1  'True
         Width           =   1215
      End
   End
   Begin VB.ListBox lst_Alumnos 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      Left            =   4560
      TabIndex        =   23
      Top             =   720
      Visible         =   0   'False
      Width           =   3375
   End
   Begin VB.ListBox lst_RutAlumno 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      Left            =   8640
      TabIndex        =   27
      Top             =   720
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.ListBox lst_RutApoderado 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      Left            =   8640
      TabIndex        =   28
      Top             =   720
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.ListBox lst_Apoderados 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   480
      Left            =   4560
      TabIndex        =   26
      Top             =   720
      Visible         =   0   'False
      Width           =   3375
   End
   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          =   480
      Left            =   4440
      TabIndex        =   22
      Top             =   1080
      Visible         =   0   'False
      Width           =   4335
   End
   Begin VB.Frame frame_listado_cheques 
      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        =   35
      Top             =   2400
      Width           =   11055
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid grid_listado_cheques 
         Height          =   2415
         Left            =   120
         TabIndex        =   36
         Top             =   240
         Width           =   10815
         _ExtentX        =   19076
         _ExtentY        =   4260
         _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 frame_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            =   1920
      TabIndex        =   0
      Top             =   120
      Visible         =   0   'False
      Width           =   9255
      Begin VB.CommandButton btn_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
         Picture         =   "Form_InformeCheques.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   69
         Top             =   360
         Width           =   855
      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            =   240
         TabIndex        =   64
         Top             =   840
         Width           =   1815
      End
      Begin VB.ComboBox cb_fec_alu 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   720
         TabIndex        =   56
         Top             =   360
         Width           =   1095
      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            =   2640
         TabIndex        =   24
         Top             =   360
         Width           =   3375
      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            =   6720
         TabIndex        =   1
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label10 
         Caption         =   "Año"
         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            =   240
         TabIndex        =   52
         Top             =   360
         Width           =   615
      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            =   6240
         TabIndex        =   4
         Top             =   360
         Width           =   375
      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            =   1920
         TabIndex        =   3
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.Frame frame_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            =   1920
      TabIndex        =   8
      Top             =   120
      Visible         =   0   'False
      Width           =   9255
      Begin VB.CommandButton btn_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
         Picture         =   "Form_InformeCheques.frx":2AE29
         Style           =   1  'Graphical
         TabIndex        =   70
         Top             =   360
         Width           =   855
      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            =   240
         TabIndex        =   65
         Top             =   840
         Width           =   1575
      End
      Begin VB.ComboBox cb_fec_ban 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   600
         TabIndex        =   57
         Top             =   480
         Width           =   1095
      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            =   2520
         TabIndex        =   21
         Top             =   720
         Width           =   4335
      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            =   2520
         Style           =   2  'Dropdown List
         TabIndex        =   11
         Top             =   240
         Width           =   4335
      End
      Begin VB.Label Label10 
         Caption         =   "Año"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   2
         Left            =   240
         TabIndex        =   53
         Top             =   480
         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            =   1800
         TabIndex        =   10
         Top             =   720
         Width           =   615
      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            =   1800
         TabIndex        =   9
         Top             =   240
         Width           =   615
      End
   End
   Begin VB.Frame frame_todos 
      Caption         =   "Todos"
      ForeColor       =   &H00FF0000&
      Height          =   1215
      Left            =   1920
      TabIndex        =   39
      Top             =   120
      Visible         =   0   'False
      Width           =   9255
      Begin VB.CommandButton btn_ver_todos 
         Caption         =   "Ver"
         Height          =   615
         Left            =   8160
         TabIndex        =   71
         Top             =   360
         Width           =   855
      End
      Begin VB.ComboBox cb_fec_tod 
         Height          =   315
         Left            =   480
         TabIndex        =   58
         Text            =   "Combo1"
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label10 
         Caption         =   "Año"
         Height          =   255
         Index           =   3
         Left            =   120
         TabIndex        =   54
         Top             =   480
         Width           =   615
      End
   End
   Begin VB.Frame frame_apoderado 
      Caption         =   "Apoderado"
      ForeColor       =   &H00FF0000&
      Height          =   1215
      Left            =   1920
      TabIndex        =   2
      Top             =   120
      Visible         =   0   'False
      Width           =   9255
      Begin VB.CommandButton cmd_ver_apoderado 
         Caption         =   "Ver"
         Height          =   615
         Left            =   8160
         TabIndex        =   72
         Top             =   360
         Width           =   855
      End
      Begin VB.CheckBox chec_tod_apo 
         Caption         =   "Todos los Apoderados"
         Height          =   255
         Left            =   120
         TabIndex        =   62
         Top             =   840
         Width           =   1935
      End
      Begin VB.ComboBox cb_fec_apo 
         Height          =   315
         Left            =   480
         TabIndex        =   59
         Text            =   "Combo1"
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox txt_Apoderados 
         Height          =   285
         Left            =   2640
         TabIndex        =   25
         Top             =   360
         Width           =   3375
      End
      Begin VB.TextBox txt_RutApo 
         Height          =   285
         Left            =   6720
         TabIndex        =   5
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label10 
         Caption         =   "Año"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   51
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label7 
         Caption         =   "RUT"
         Height          =   255
         Left            =   6240
         TabIndex        =   7
         Top             =   360
         Width           =   375
      End
      Begin VB.Label Label6 
         Caption         =   "Nombres"
         Height          =   255
         Left            =   1800
         TabIndex        =   6
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.Frame frame_curso 
      Caption         =   "Selección por Curso"
      ForeColor       =   &H00FF0000&
      Height          =   1215
      Left            =   1920
      TabIndex        =   41
      Top             =   120
      Width           =   9255
      Begin VB.CheckBox chec_tod_cur 
         Caption         =   "Todos los cursos"
         Height          =   255
         Left            =   120
         TabIndex        =   63
         Top             =   840
         Width           =   1575
      End
      Begin VB.CommandButton Btn_Ver_Lista 
         Caption         =   "Ver"
         Height          =   615
         Left            =   8160
         TabIndex        =   43
         Top             =   360
         Width           =   855
      End
      Begin VB.CheckBox Check_Letra 
         Caption         =   "Letra"
         ForeColor       =   &H00C00000&
         Height          =   195
         Left            =   6360
         TabIndex        =   42
         Top             =   240
         Width           =   1095
      End
      Begin MSComctlLib.ImageCombo IC_Ensenanza 
         Height          =   330
         Left            =   1920
         TabIndex        =   44
         Top             =   480
         Width           =   3135
         _ExtentX        =   5530
         _ExtentY        =   582
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         Locked          =   -1  'True
         Text            =   "IC_Ensenanza"
      End
      Begin MSComctlLib.ImageCombo IC_Nivel 
         Height          =   330
         Left            =   5160
         TabIndex        =   45
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   582
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         Locked          =   -1  'True
         Text            =   "IC_Nivel"
      End
      Begin MSComctlLib.ImageCombo IC_Letra 
         Height          =   330
         Left            =   6360
         TabIndex        =   46
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   582
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         Enabled         =   0   'False
         Locked          =   -1  'True
         Text            =   "IC_Letra"
      End
      Begin MSComctlLib.ImageCombo IC_Agno 
         Height          =   330
         Left            =   720
         TabIndex        =   47
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   582
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         Locked          =   -1  'True
         Text            =   "IC_Agno"
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         Caption         =   "Nivel"
         ForeColor       =   &H00C00000&
         Height          =   255
         Left            =   5160
         TabIndex        =   50
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         Caption         =   "Enseñanza"
         ForeColor       =   &H00C00000&
         Height          =   255
         Left            =   1920
         TabIndex        =   49
         Top             =   240
         Width           =   2895
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "Año"
         ForeColor       =   &H00C00000&
         Height          =   255
         Left            =   720
         TabIndex        =   48
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Label lbl_agno 
      Caption         =   "2011"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   2160
      TabIndex        =   55
      Top             =   1560
      Visible         =   0   'False
      Width           =   615
   End
End
Attribute VB_Name = "Form_InformeCheques"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

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

Private Sub Rec2Grid(ByRef REC As ADODB.Recordset, ByRef grid As Object, Optional ByVal Numeracion As Boolean = True)
    grid.ClearStructure
    Dim total As Long
    Dim z As Double
    Dim i As Double
    total = REC.RecordCount / 40
    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
        z = 0
        For i = 1 To REC.RecordCount
            z = z + 1
            
            If z = total Then
                If progreso.Value < 100 Then
                    progreso.Value = progreso.Value + 1
                End If
                z = 0
            End If
            
            'progreso.Value = i
            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

'Private Sub carga_nivel()
'    Dim objRS As ADODB.Recordset
'    Set objRS = New ADODB.Recordset
'    Dim var_sql As String
'    var_sql = "select cod_ens,des_ens from codigos_ensenanza order by cod_ens"
'    objRS.Open var_sql, conn
'    While Not objRS.EOF
''        cmb_mod_cob.AddItem objRS("des_ens")
'        cmb_mod_cob.ItemData(cmb_mod_cob.NewIndex) = objRS("cod_ens")
'        objRS.MoveNext
'    Wend
'        cmb_mod_cob.AddItem "Sin Curso"
'        cmb_mod_cob.AddItem "Todos"
'    objRS.Close
'End Sub

''Private Sub cb_nivel_Change()
''    Me.chk_todos_cob.Enabled = True
''    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
''        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
''    End If
''    Rs.Close
''    Set Rs = Nothing
''
''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_Apoderados_Click()
    If chk_Apoderados.Value = Checked Then
        txt_Apoderados.Text = ""
        txt_Apoderados.Enabled = False
        lst_Apoderados.Visible = False
        txt_RutApo.Enabled = False
        txt_RutApo.Text = ""
    Else
        txt_Apoderados.Enabled = True
        txt_RutApo.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_Titular.Enabled = False
        lst_Titular.Visible = False
    Else
        txt_Titular.Enabled = True
    End If
End Sub

Private Sub Btn_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
        bloquea_procesos
        Dim p As Long
        grid_listado_cheques.Rows = 2
        grid_listado_cheques.ClearStructure
        progreso.Min = 0
        progreso.Max = 100
        crear_tabla_informecheques
        progreso.Value = 0
        llenar_informecheques
        'progreso.Value = 30
        'agrupamiento
        filtrado_informe
        'progreso.Value = 60
        llena_grilla
        progreso.Value = 100
        desbloquea_procesos
        frame_busqueda.Visible = False
        Frame5.Enabled = False
    Else
        MsgBox "Para realizar la busqueda debe seleccionar un alumno", vbInformation
    End If
End Sub

Private Sub btn_ver_banco_Click()
    If (chec_tod_ban.Value = 1) Or _
    (chec_tod_ban.Value = 0 And (cb_banco.Text <> "" Or txt_Titular.Text <> "")) Then
        frame_busqueda.Visible = True
        frame_busqueda.Refresh
        bloquea_procesos
        Dim p As Long
        grid_listado_cheques.Rows = 2
        grid_listado_cheques.ClearStructure
        progreso.Min = 0
        progreso.Max = 100
        crear_tabla_informecheques
        progreso.Value = 0
        llenar_informecheques
        'progreso.Value = 30
        'agrupamiento
        filtrado_informe
        'progreso.Value = 60
        llena_grilla
        progreso.Value = 100
        desbloquea_procesos
        frame_busqueda.Visible = False
        Frame5.Enabled = False
    Else
        MsgBox "Para realizar la busqueda debe primero seleccionar un banco o titular" _
        , vbInformation
    End If
End Sub

Private Sub Btn_Ver_Lista_Click()
    frame_busqueda.Visible = True
    frame_busqueda.Refresh
    bloquea_procesos
    grid_listado_cheques.Rows = 2
    grid_listado_cheques.ClearStructure
    crear_tabla_informecheques
    progreso.Value = 0
    llenar_informecheques
    'progreso.Value = 50
    'agrupamiento
    filtrado_informe
    progreso.Value = 60
    llena_grilla
    progreso.Value = 100
    desbloquea_procesos
    frame_busqueda.Visible = False
    Frame5.Enabled = False
End Sub

Private Sub btn_ver_todos_Click()
    frame_busqueda.Visible = True
    frame_busqueda.Refresh
    bloquea_procesos
    Dim p As Long
    grid_listado_cheques.Rows = 2
    grid_listado_cheques.ClearStructure
    progreso.Min = 0
    progreso.Max = 100
    crear_tabla_informecheques
    progreso.Value = 0
    llenar_informecheques
    'progreso.Value = 30
    'agrupamiento
    filtrado_informe
    'progreso.Value = 60
    llena_grilla
    progreso.Value = 100
    desbloquea_procesos
    frame_busqueda.Visible = False
    Frame5.Enabled = False
End Sub

'Private Sub cb_banco_Change()
'    If cb_banco.Text <> "" Then
'        frame_alumno.Enabled = False
'        frame_apoderado.Enabled = False
'        frame_curso.Enabled = False
'    End If
'End Sub

'Private Sub cb_Jornada_Change()
'  If cb_Jornada.Text <> "" Then
'    frame_alumno.Enabled = False
'    frame_apoderado.Enabled = False
'    frame_banco.Enabled = False
'  End If
'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
'If cmb_mod_cob.Text <> "" Then
'    frame_alumno.Enabled = False
'    frame_apoderado.Enabled = False
'    frame_banco.Enabled = False
'End If
'
'End Sub

'Private Sub cb_agno_Change(Index As Integer)
'    lbl_agno.Caption = cb_agno(3).Text
'End Sub





Private Sub cb_fec_alu_Click()
    lbl_agno.Caption = cb_fec_alu.Text
End Sub





Private Sub cb_fec_apo_Click()
    lbl_agno.Caption = cb_fec_apo.Text
End Sub

Private Sub cb_fec_ban_Click()
    lbl_agno.Caption = cb_fec_ban.Text
End Sub



Private Sub cb_fec_tod_Click()
    lbl_agno.Caption = cb_fec_tod.Text
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 cmd_Cancelar_Click()
    Unload Me
End Sub

Private Sub cmd_GenerarReporte_Click()
If grid_listado_cheques.TextMatrix(1, 1) <> "" Then
    Dim objRS As ADODB.Recordset
    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
    
    Dim tipo_cheque As String
    Dim por As Boolean
'    crear_tabla_informecheques
'    llenar_informecheques
'    agrupamiento
'    filtrado_informe
    'cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques.rpt"
    
    
    Call LimpiaFormulas(cr_InformeCheques, 30)
    If opt_General.Value = True Then
        cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_general.rpt"
    Else
        If opt_alumno.Value = True Then
            If chec_tod_alu.Value = 1 Then
                cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_general.rpt"
                cr_InformeCheques.Formulas(4) = "filtro = '" & "Filtro:" & "'"
                cr_InformeCheques.Formulas(5) = "todos_los = '" & "Todos los Alumnos" & "'"
            Else
                If txt_Alumno.Text <> "" Then
                    cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_alumno.rpt"
                End If
            End If
        End If
    
        If opt_apoderado.Value = True Then
            If chec_tod_apo.Value = 1 Then
                cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_general.rpt"
                cr_InformeCheques.Formulas(4) = "filtro = '" & "Filtro:" & "'"
                cr_InformeCheques.Formulas(5) = "todos_los = '" & "Todos los Apoderados" & "'"
            Else
                If txt_Apoderados.Text <> "" Then
                    cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_apoderado.rpt"
                End If
            End If
        End If
    
        If opt_banco.Value = True Then
            If chec_tod_ban.Value = 1 Then
                cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_general.rpt"
                cr_InformeCheques.Formulas(4) = "filtro = '" & "Filtro:" & "'"
                cr_InformeCheques.Formulas(5) = "todos_los = '" & "Todos los Bancos" & "'"
            Else
                If cb_banco.Text <> "" And txt_Titular.Text <> "" Then
                    cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_titular.rpt"
                Else
                    If cb_banco.Text <> "" Then
                        cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_banco.rpt"
                    End If
                    If txt_Titular.Text <> "" Then
                        cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_titular.rpt"
                    End If
                End If
            End If
        End If
    
        If opt_curso.Value = True Then
            If chec_tod_cur.Enabled = 1 Then
                cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_general.rpt"
                cr_InformeCheques.Formulas(4) = "filtro = '" & "Filtro:" & "'"
                cr_InformeCheques.Formulas(5) = "todos_los = '" & "Todos los Cursos" & "'"
            Else
                If Check_Letra.Value = 1 Then
                    cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_curso.rpt"
                Else
                    cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_general.rpt"
                    cr_InformeCheques.Formulas(4) = "filtro = '" & "Filtro:" & "'"
                    cr_InformeCheques.Formulas(5) = "todos_los = '" & "Por Curso" & "'"
                End If
            End If
        End If
    End If
    If opt_Cobrados.Value = True Then
        tipo_cheque = "COBRADOS"
    End If
    If opt_Protestados.Value = True Then
        tipo_cheque = "PROTESTADOS"
    End If
    If opt_SinCobrar.Value = True Then
        tipo_cheque = "SIN COBRAR"
    End If
    If opt_Todos.Value = True Then
        tipo_cheque = "TODOS"
    End If
    
    cr_InformeCheques.Formulas(1) = "tipo_cheque = '" & tipo_cheque & "'"
    cr_InformeCheques.Formulas(2) = "nom_est = '" & est & "'"
    cr_InformeCheques.Formulas(3) = "dir_est = '" & dir & "'"
    cr_InformeCheques.Formulas(6) = "agno_consultado = '" & lbl_agno.Caption & "'"
    
    If opt_pantalla.Value = True Then
        por = True
        cr_InformeCheques.Destination = crptToWindow
    Else
        por = False
        cr_InformeCheques.Destination = crptToPrinter
    End If
    cr_InformeCheques.Action = 1
    
    'carga_jornadas
    'carga_nivel
    carga_bancos
Else
    MsgBox "No hay datos seleccionados para generar reporte", vbInformation
End If
End Sub


Private Sub cmd_limpiar_Click()
    limpia_campos
End Sub

Private Sub cmd_sincheque_Click()
If grid_listado_cheques.TextMatrix(1, 1) <> "" Then
    Dim tipo_cheque As String
    Dim por As Boolean
'    crear_tabla_informecheques
'    llenar_informecheques
'    agrupamiento
'    filtrado_informe
    
    Call LimpiaFormulas(cr_InformeCheques, 30)
    crear_sincheque
    If llenar_sin_cheque Then
        cr_InformeCheques.ReportFileName = App.Path & "\Rpt\fnza_informe_de_cheques_sincheque.rpt"
        If opt_alumno.Value = True Then
            cr_InformeCheques.Formulas(1) = "por = '" & "Alumno" & "'"
        End If
        If opt_apoderado.Value = True Then
            cr_InformeCheques.Formulas(1) = "por = '" & "Apoderado" & "'"
        End If
        If opt_banco.Value = True Then
            cr_InformeCheques.Formulas(1) = "por = '" & "Banco" & "'"
        End If
        If opt_curso.Value Then
            cr_InformeCheques.Formulas(1) = "por = '" & "Curso" & "'"
        End If
        If opt_General.Value = True Then
            cr_InformeCheques.Formulas(1) = "por = '" & "Todos" & "'"
        End If
        cr_InformeCheques.Formulas(2) = "agno_consultado = '" & lbl_agno.Caption & "'"
        If opt_pantalla.Value = True Then
            cr_InformeCheques.Destination = crptToWindow
        Else
            cr_InformeCheques.Destination = crptToPrinter
        End If
        cr_InformeCheques.Action = 1
    Else
        MsgBox "No hay cuotas sin cheque", vbInformation
    End If
    'carga_jornadas
    'carga_nivel
    carga_bancos
Else
    MsgBox "No hay datos seleccionados para generar reporte", vbInformation
End If
End Sub

Private Sub cmd_ver_apoderado_Click()
    If (chec_tod_apo.Value = 1) _
    Or (chec_tod_apo.Value = 0 And txt_RutApo.Text <> "" And txt_Apoderados.Text <> "") Then
            frame_busqueda.Visible = True
            frame_busqueda.Refresh
            bloquea_procesos
            Dim p As Long
            grid_listado_cheques.Rows = 2
            grid_listado_cheques.ClearStructure
            progreso.Min = 0
            progreso.Max = 100
            crear_tabla_informecheques
            progreso.Value = 0
            llenar_informecheques
            'progreso.Value = 30
            'agrupamiento
            filtrado_informe
            'progreso.Value = 60
            llena_grilla
            progreso.Value = 100
            desbloquea_procesos
            frame_busqueda.Visible = False
            Frame5.Enabled = False
    Else
            MsgBox "Para realizar busqueda debe primero seleccionar un apoderado", vbInformation
    End If
End Sub

Private Sub Form_Load()

    ' Setear el combo años.
    Me.Top = 0
    Me.Left = 0
    'IC_Letra.Text = ""
    'IC_Letra.ComboItems.Clear
    'Call Set_IC_Agno
    ' Limpiar textos
'    txt_nom_alu.Text = ""
'    txt_rut_alu.Text = ""
'    txt_nom_apo.Text = ""
'    txt_rut_apo.Text = ""
    'Mostrar opcion de curso al iniciar
    'Option1(0).Value = True
    'MuestraFrame ("curso")
    'ErrorStatus = False

    IC_Letra.Text = ""
    IC_Letra.ComboItems.Clear
    Call Set_IC_Agno
    opt_alumno_Click
    'carga_jornadas
    'carga_nivel
    carga_bancos
    carga_agno
    'Call Set_IC_Agno
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

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 nom_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")
        objRS.MoveNext
    Wend
    objRS.Close
End Sub



Private Sub IC_Agno_Change()
    IC_Ensenanza.Enabled = True
    Set_IC_Ensenanza
    lbl_agno.Caption = IC_Agno.Text
End Sub

Private Sub IC_Agno_Click()
lbl_agno.Caption = IC_Agno.Text
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 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 IC_Agno_Change()
'    IC_Ensenanza.Enabled = True
'    Set_IC_Ensenanza
'End Sub
'
'Private Sub IC_Ensenanza_Change()
'    IC_Nivel.Enabled = True
'    Call Set_IC_Nivel
'End Sub
'
'Private Sub IC_Nivel_Change()
'    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_Apoderados_DblClick()
    txt_Apoderados = lst_Apoderados.Text
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT rut_apo from apoderados" _
            & " Where concat(ape1_apo,' ',ape2_apo,' ',noms_apo)='" & txt_Apoderados & "'"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        txt_RutApo = objRS("rut_apo")
    End If
    lst_Apoderados.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_RutApoderado_DblClick()
    txt_RutApo = lst_RutApoderado.Text
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "SELECT concat(ape1_apo,' ',ape2_apo,' ',noms_apo) as nombre from apoderados" _
            & " Where rut_apo='" & txt_RutApo & "'"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        txt_Apoderados = objRS("nombre")
    End If
    lst_RutApoderado.Visible = False
End Sub

Private Sub lst_Titular_DblClick()
    txt_Titular = lst_Titular.Text
    lst_Titular.Visible = False
End Sub

Private Sub opt_alumno_Click()
    limpia_campos
    oculta_frames
    frame_alumno.Visible = True
    cmd_sincheque.Visible = True
End Sub

Private Sub opt_apoderado_Click()
    limpia_campos
    oculta_frames
    frame_apoderado.Visible = True
    cmd_sincheque.Visible = True
End Sub

Private Sub opt_banco_Click()
    limpia_campos
    oculta_frames
    frame_banco.Visible = True
End Sub

Private Sub opt_curso_Click()
    limpia_campos
    oculta_frames
    frame_curso.Visible = True
    cmd_sincheque.Visible = True
End Sub

Private Sub opt_General_Click()
    oculta_frames
    limpia_campos
    frame_todos.Visible = True
    cmd_sincheque.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"
            
    var_sql = "SELECT concat(ape_pat_alu,' ', ape_mat_alu,' ', nom_alu) nombre" _
            & " FROM postulantes p,fnza_detalle_mensualidad fdm,fnza_dtll_mvto fdmm," _
            & " fnza_movimientos_mensualidad fmm" _
            & " Where p.ci_alu = fdm.run_alu and fdm.folio_dtll = fdmm.folio_dtll and" _
            & " fdmm.folio_mvto = fmm.folio_mvto and tipo_pago = 'chqe'" _
            & " and concat(ape_pat_alu,' ', ape_mat_alu,' ', nom_alu)" _
            & " LIKE '" & txt_Alumno & "%' and concepto <> 'ct00'" _
            & " and fdm.agno = " & cb_fec_alu.Text _
            & " 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
'    If txt_Alumno.Text <> "" Then
'        frame_apoderado.Enabled = False
'        frame_banco.Enabled = False
'        frame_curso.Enabled = False
'    End If
End Sub


Private Sub txt_Apoderados_Change()
    If txt_Apoderados <> "" And txt_RutApo = "" Then
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
'    var_sql = "SELECT concat(ape1_apo,' ',ape2_apo,' ',noms_apo) nombre" _
'            & " FROM apoderados a,fnza_cheques_recibidos fcr" _
'            & " Where concat(ape1_apo,' ',ape2_apo,' ',noms_apo)" _
'            & " LIKE '" & txt_Apoderados & "%'" _
'            & " and a.rut_apo = fcr.run_apo" _
'            & " group by a.rut_apo"
            
    var_sql = "SELECT concat(ape1_apo,' ',ape2_apo,' ',noms_apo) nombre" _
            & " FROM apoderados a, fnza_mensualidad fm,fnza_detalle_mensualidad fdm," _
            & " fnza_dtll_mvto fdmm,fnza_movimientos_mensualidad fmm" _
            & " Where a.Rut_apo = fm.run_apo And" _
            & " fm.folio_mens = fdm.folio_mens And fdm.folio_dtll = fdmm.folio_dtll And" _
            & " fdmm.folio_mvto = fmm.folio_mvto and" _
            & " concat(ape1_apo,' ',ape2_apo,' ',noms_apo)" _
            & " LIKE '" & txt_Apoderados & "%' and tipo_pago = 'chqe'" _
            & " and concepto <> 'ct00' and fdm.agno = " & cb_fec_apo.Text _
            & " group by a.rut_apo"
                
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        lst_Apoderados.Visible = True
    End If
    lst_Apoderados.Clear
    While Not objRS.EOF
        lst_Apoderados.AddItem objRS("nombre")
        objRS.MoveNext
    Wend
    objRS.Close
    End If
'    If txt_Apoderados.Text <> "" Then
'        frame_alumno.Enabled = False
'        frame_banco.Enabled = False
'        frame_curso.Enabled = False
'    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"
            
        var_sql = "SELECT p.ci_alu" _
                & " FROM postulantes p,fnza_detalle_mensualidad fdm,fnza_dtll_mvto fdmm," _
                & " fnza_movimientos_mensualidad fmm" _
                & " Where p.ci_alu = fdm.run_alu and fdm.folio_dtll = fdmm.folio_dtll and" _
                & " fdmm.folio_mvto = fmm.folio_mvto and tipo_pago = 'chqe'" _
                & " and p.ci_alu LIKE '" & txt_rut & "%' and concepto <> 'ct00'" _
                & " and fdm.agno = " & cb_fec_alu.Text _
                & " 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
'    If txt_Rut.Text <> "" Then
'        frame_apoderado.Enabled = False
'        frame_banco.Enabled = False
'        frame_curso.Enabled = False
'    End If
End Sub

Private Sub txt_RutApo_Change()
     If txt_RutApo <> "" And txt_Apoderados = "" Then
        Dim objRS As ADODB.Recordset
        Set objRS = New ADODB.Recordset
        Dim var_sql As String
'        var_sql = "SELECT rut_apo FROM apoderados a, fnza_cheques_recibidos fcr" _
'            & " Where rut_apo LIKE '" & txt_rutapo & "%'" _
'            & " and a.rut_apo = fcr.run_apo" _
'            & " group by a.rut_apo"
            
        var_sql = "SELECT rut_apo" _
                & " FROM apoderados a, fnza_mensualidad fm,fnza_detalle_mensualidad fdm," _
                & " fnza_dtll_mvto fdmm,fnza_movimientos_mensualidad fmm" _
                & " Where a.Rut_apo = fm.run_apo And fm.folio_mens = fdm.folio_mens And" _
                & " fdm.folio_dtll = fdmm.folio_dtll And fdmm.folio_mvto = fmm.folio_mvto" _
                & " and rut_apo LIKE '" & txt_RutApo & "%' and tipo_pago = 'chqe'" _
                & " and concepto <> 'ct00' and fdm.agno = " & cb_fec_apo.Text _
                & " group by a.rut_apo"
        objRS.Open var_sql, conn
        lst_RutApoderado.Clear
        If Not objRS.EOF Then
            lst_RutApoderado.Visible = True
        End If
        While Not objRS.EOF
            lst_RutApoderado.AddItem objRS("rut_apo")
            objRS.MoveNext
        Wend
        objRS.Close
    End If
'    If txt_RutApo.Text <> "" Then
'        frame_alumno.Enabled = False
'        frame_banco.Enabled = False
'        frame_curso.Enabled = False
'    End If
End Sub

Private Sub txt_Titular_Change()
    If txt_Titular <> "" Then
        llenar_listbox_titular
'        frame_alumno.Enabled = False
'        frame_apoderado.Enabled = False
'        frame_curso.Enabled = False
    End If
End Sub

Private Sub crear_tabla_informecheques()
    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_informecheques_temp;"
    objCMD.CommandText = objQRY
    objCMD.Execute
    
    objQRY = "CREATE TABLE IF NOT EXISTS fnza_informecheques_temp " & _
                "(" & _
                "folio_dtll bigint(20) NOT NULL default '0', folio_mvto bigint(20) NOT NULL default '0'," & _
                "rut_apo varchar(10) NOT NULL default '', curso varchar(6) NOT NULL default '', " & _
                "jornada varchar(50) NOT NULL default '', correlativo bigint(20) NOT NULL default '0', " & _
                "ci_alu varchar(10) NOT NULL default '', nombres varchar(50) NOT NULL default '', " & _
                "mes varchar(10) NOT NULL default '', asig bigint(20) not null default '0', " & _
                "monto_tot_cuota bigint(20) NOT NULL default '0', " & _
                "monto_chq bigint(20) NOT NULL default '0', " & _
                "run_titular varchar(10) NOT NULL default '', " & _
                "estado_chq varchar(40) NOT NULL default '', numero_cheque varchar(40) NOT NULL default '', " & _
                "cta_cte varchar(20) NOT NULL default '', banco varchar(50) NOT NULL default '', " & _
                "chq_fecha date, marca bigint(20) NOT NULL default '0', " & _
                "nom_titular varchar(50) NOT NULL default '', " & _
                "tel_titular varchar(12) NOT NULL default '', cont_chq_alu bigint(20) NOT NULL default '0', " & _
                "monto_alu_mens bigint(20) NOT NULL default '0', " & _
                "monto_alu_chq bigint(20) NOT NULL default '0', " & _
                "cont_alu bigint(20) NOT NULL default '0', tipo_pago varchar(20) NOT NULL default '', " & _
                "acum_mens bigint(20) NOT NULL default '0', apoderado varchar(50) NOT NULL default '', " & _
                "acum_chq bigint(20) NOT NULL default '0', monto_asig bigint(20) NOT NULL default '0', " & _
                "cont_chq_total bigint(20) NOT NULL default '0', acum_chq_total bigint(20) NOT NULL default '0', " & _
                "PRIMARY KEY (correlativo,curso,mes,folio_dtll,folio_mvto,rut_apo,ci_alu,tel_titular,numero_cheque), " & _
                "UNIQUE KEY unique_index_fnza_informecheques_temp(correlativo,curso,mes,folio_dtll,folio_mvto,rut_apo,ci_alu,tel_titular,numero_cheque) " & _
                ") ENGINE=MyISAM;"
    
    
    objCMD.CommandText = objQRY
    objCMD.Execute
    
End Sub

Private Sub llenar_informecheques()
    Dim objRS As ADODB.Recordset
    Dim total As Long
    Set objRS = New ADODB.Recordset
    Dim REC As ADODB.Recordset
    Set REC = New ADODB.Recordset
'    Dim objRS_alu As ADODB.Recordset
'    Set objRS_alu = New ADODB.Recordset
'    Dim objRS_sin As ADODB.Recordset
'    Set objRS_sin = New ADODB.Recordset
    Dim var_sql, tipo_pago As String
    Dim i As Long
    Dim z As Integer
    Dim nombre, curso, jornada, Apoderado, run_apo As String
'    progreso.Value = 1
'var_sql = "select folio_dtll,fcm.folio_chq,fcm.folio_mvto,fcm.run_apo,fcm.run_alu," _
'        & "date_format(fech_venc_cptos,'%m') as mes,monto_pago,monto_chq," _
'        & "chq_numero,descripcion,chq_fecha,run_titular,nom_titular,tel_titular,estado_chq," _
'        & "concat(chq_serie,' ',chq_numero) numero_cheque,cta_cte" _
'        & " from fnza_cheques_recibidos fcr,fnza_chq_mvto fcm,fnza_cod_banco fcb," _
'        & "fnza_movimientos_mensualidad fmm" _
'        & " Where fcr.folio_chq = fcm.folio_chq And fcm.folio_mvto = " _
'        & "fmm.folio_mvto and fcr.banco = fcb.banco" _
'        & " order by fcm.run_apo,fcm.run_alu"
    var_sql = " select " _
            & " monto_pago,fech_venc,fnza.run_alu,monto_tot_cuota,fnza.folio_mvto,mes,tipo_pago," _
            & " estado_pago,agno,fnza.folio_dtll," _
            & " folio_chq ,run_apo," _
            & " monto_chq,chq_numero,descripcion,chq_fecha,run_titular,nom_titular,tel_titular," _
            & " estado_chq,numero_cheque,cta_cte" _
            & " from (select monto_pago,fech_venc,run_alu,monto_tot_cuota,fmm.folio_mvto,mes,tipo_pago," _
            & " estado_pago,agno,fmm.folio_dtll" _
            & " from fnza_detalle_mensualidad fdm,fnza_dtll_mvto fddm," _
            & " fnza_movimientos_mensualidad fmm" _
            & " where fdm.folio_dtll = fddm.folio_dtll and" _
            & " fddm.folio_mvto = fmm.folio_mvto and concepto <> 'ct00' and tipo_pago = 'chqe' and estado_pago = 'aprb' and agno = " & lbl_agno.Caption & ") as fnza" _
            & " left join (select fcm.folio_chq,fcm.folio_mvto,fcm.run_apo," _
            & " monto_chq,chq_numero,descripcion,chq_fecha,run_titular,nom_titular,tel_titular," _
            & " estado_chq,concat(chq_serie,' ',chq_numero) numero_cheque,cta_cte" _
            & " 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 order by fcm.run_apo,fcm.run_alu) as cheques on" _
            & " fnza.folio_mvto = cheques.folio_mvto" _
            & " order by fnza.run_alu,mes"

    objRS.Open var_sql, conn
    total = objRS.RecordCount / 30
    i = 0
    While Not objRS.EOF
        i = i + 1
        z = z + 1
        If z = total Then
           progreso.Value = progreso.Value + 1
           z = 0
        End If
        curso = ""
        nombre = ""
        jornada = "nada"
        Apoderado = ""
        run_apo = ""
        
        'llena alumno
        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
        
        'llena apoderado
        var_sql = "select axa.rut_apo,concat(ape1_apo,' ',ape2_apo,' ',noms_apo) as apoderado" _
                & " from apo_x_alu axa,apoderados a" _
                & " Where axa.Rut_apo = a.Rut_apo And axa.agno = " & lbl_agno.Caption _
                & " and axa.ci_alu = '" & objRS("run_alu") & "'"
        REC.Open var_sql, conn
        If Not REC.EOF Then
            run_apo = REC("rut_apo")
            Apoderado = REC("apoderado")
        End If
        REC.Close
        
        'llena curso
        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 = " & lbl_agno.Caption _
                & " 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
        
        
               
        If IsNull(objRS("numero_cheque")) Then
        
        var_sql = "insert into fnza_informecheques_temp(asig,folio_dtll,folio_mvto,rut_apo,curso," _
            & "jornada,correlativo,ci_alu,nombres,mes,monto_tot_cuota," _
            & "apoderado,chq_fecha)" _
            & " values(" & objRS("monto_pago") & "," & objRS("folio_dtll") & "," & objRS("folio_mvto") & ",'" & run_apo _
            & "','" & curso & "','" & jornada & "'," & i & ",'" & objRS("run_alu") & "','" & nombre & "','" _
            & MesATexto(objRS("mes")) & "'," & objRS("monto_tot_cuota") & ",'" _
            & Apoderado & "','" & Format(objRS("fech_venc"), "yyyy-mm-dd") & "')"
        Else
        var_sql = "insert into fnza_informecheques_temp(asig,folio_dtll,folio_mvto,rut_apo,curso," _
            & "jornada,correlativo,ci_alu,nombres,mes,monto_tot_cuota," _
            & "monto_chq,run_titular,estado_chq,numero_cheque,cta_cte,banco,chq_fecha,nom_titular,tel_titular,apoderado)" _
            & " values(" & objRS("monto_pago") & "," & objRS("folio_dtll") & "," & objRS("folio_mvto") & ",'" & run_apo _
            & "','" & curso & "','" & jornada & "'," & i & ",'" & objRS("run_alu") & "','" & nombre & "','" _
            & MesATexto(objRS("mes")) & "'," & objRS("monto_tot_cuota") & "," _
            & objRS("monto_chq") & ",'" & objRS("run_titular") & "','" _
            & objRS("estado_chq") & "','" & objRS("numero_cheque") & "','" _
            & objRS("cta_cte") & "','" _
            & objRS("descripcion") & "','" & Format(objRS("chq_fecha"), "yyyy/mm/dd") & "','" & objRS("nom_titular") & "','" _
            & objRS("tel_titular") & "','" & Apoderado & "')"
        End If
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
    
    '**** Cambio el estado de los cheques para sacar los que estan cobrados
    var_sql = "select * from fnza_informecheques_temp"
    objRS.Open var_sql, conn
    var_sql = "select date_format(current_date,'%Y-%m-%d') as fecha"
    REC.Open var_sql, conn
    While Not objRS.EOF
        If objRS("numero_cheque") <> "" Then
            If Format(REC("fecha"), "yyyy-mm-dd") > Format(objRS("chq_fecha"), "yyyy-mm-dd") Then
                var_sql = "update fnza_informecheques_temp set" _
                        & " estado_chq = 'clda' where correlativo = " _
                        & objRS("correlativo")
               conn.Execute var_sql
            End If
        End If
        objRS.MoveNext
    Wend
    REC.Close
    objRS.Close
    
    '**** Busco y marco cuando el pago es contado y se ha cancelado con un solo cheque
    var_sql = "select fict.*,numero_cheque,ind_cont,ind_cup,ind_cheq" _
            & " from fnza_informecheques_temp fict,matriculas m" _
            & " Where fict.Ci_alu = m.Ci_alu And anno_mat = date_format(chq_fecha,'%Y')" _
            & " order by correlativo"
    objRS.Open var_sql, conn
    
    While Not objRS.EOF
        tipo_pago = 0
        If objRS("ind_cont") = 1 Then
            tipo_pago = "cont"
        End If
        If objRS("ind_cup") = 1 Then
            tipo_pago = "cup"
        End If
        If objRS("ind_cheq") = 1 Then
            tipo_pago = "cheq"
        End If
        var_sql = "update fnza_informecheques_temp set tipo_pago = '" & tipo_pago _
                & "' where correlativo = " & objRS("correlativo")
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    
    '*Eliminar los que no tienen banco cuando la opcion sea totdos los bancos
    If opt_banco.Value = True And chec_tod_ban.Value = 1 Then
        var_sql = "delete from fnza_informecheques_temp where banco = ''"
        conn.Execute var_sql
    End If
    
End Sub

Private Sub agrupamiento()
    Dim var_sql As String
    Dim tot As Long
    Dim total_cheques As Long
    Dim total_monto As Double
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    var_sql = "SELECT * FROM fnza_informecheques_temp" _
            & " group by curso,ci_alu,chq_fecha,folio_mvto"
    objRS.Open var_sql, conn
    conn.Execute "delete from fnza_informecheques_temp"
    While Not objRS.EOF
        
        var_sql = "insert into fnza_informecheques_temp(folio_dtll,folio_mvto,rut_apo,jornada,curso,ci_alu,nombres,mes,monto_tot_cuota," _
            & "monto_chq,run_titular,estado_chq,numero_cheque,cta_cte,banco,chq_fecha,nom_titular,tel_titular,apoderado)" _
            & " values(" & objRS("folio_dtll") & "," & objRS("folio_mvto") & ",'" & objRS("rut_apo") _
            & "','" & objRS("jornada") & "','" & objRS("curso") & "','" & objRS("ci_alu") & "','" _
            & objRS("nombres") & "','" & objRS("mes") & "'," & objRS("monto_tot_cuota") & "," _
            & objRS("monto_chq") & ",'" & objRS("run_titular") & "','" _
            & objRS("estado_chq") & "','" & objRS("numero_cheque") & "','" _
            & objRS("cta_cte") & "','" _
            & objRS("banco") & "','" & Format(objRS("chq_fecha"), "yyyy/mm/dd") & "','" & objRS("nom_titular") & "','" _
            & objRS("tel_titular") & "','" & objRS("apoderado") & "')"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
       
   
End Sub

Private Sub filtrado_informe()
    
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim REC As ADODB.Recordset
    Set REC = New ADODB.Recordset
    Dim sql_run As String
    
    Dim tot As Long
    Dim nivel, curso, sql As String
    Dim total_cheques As Long
    Dim total_monto As Double
    Dim estado_cheque, cur_completo As String
    estado_cheque = ""
    
    Dim var_sql, condicion As String
    If chec_tod_alu.Value = 0 And chec_tod_apo.Value = 0 And chec_tod_ban.Value = 0 And chec_tod_cur.Value = 0 Then
    
    var_sql = "select * from fnza_informecheques_temp where "
    
'    If cb_Jornada.Text <> "" And cb_Jornada.Text <> "Todas" Then
'        condicion = "jornada = '" & cb_Jornada.Text & "'"
'    End If
    
    If opt_SinCobrar.Value = True Then estado_cheque = "cart"
    If opt_Cobrados.Value = True Then estado_cheque = "clda"
    If opt_Protestados.Value = True Then estado_cheque = "prto"
    
    If estado_cheque <> "" Then
        If condicion <> "" Then
            condicion = condicion & " and estado_chq = '" & estado_cheque & "'"
        Else
            condicion = condicion & "estado_chq = '" & estado_cheque & "'"
        End If
    End If
    
    If txt_Alumno.Text <> "" Then
        If condicion <> "" Then
            condicion = condicion & " and ci_alu = '" & txt_rut & "'"
        Else
            condicion = condicion & "ci_alu = '" & txt_rut & "'"
        End If
    End If
    
    If txt_Apoderados <> "" Then
        If condicion <> "" Then
            condicion = condicion & " and rut_apo = '" & txt_RutApo & "'"
        Else
            condicion = condicion & "rut_apo = '" & txt_RutApo & "'"
        End If
    End If
    
    If txt_Titular <> "" Then
        sql_run = "select run_titular from fnza_cheques_recibidos" _
            & " where nom_titular = '" & txt_Titular & "'"
        REC.Open sql_run, conn
        If condicion <> "" Then
            condicion = condicion & " and run_titular = '" & REC("run_titular") & "'"
        Else
            condicion = condicion & "run_titular = '" & REC("run_titular") & "'"
        End If
        REC.Close
    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 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_informecheques_temp"
    End If
    'MsgBox var_sql
       

    objRS.Open var_sql, conn
    'objRS.MoveFirst
    conn.Execute "delete from fnza_informecheques_temp"
    While Not objRS.EOF
    var_sql = "insert into fnza_informecheques_temp(correlativo,asig,folio_dtll,folio_mvto,rut_apo,jornada,curso,ci_alu,nombres,mes,monto_tot_cuota," _
        & "monto_chq,run_titular,estado_chq,numero_cheque,cta_cte,tipo_pago,banco,chq_fecha,nom_titular,tel_titular,cont_chq_alu," _
        & "monto_alu_mens,monto_alu_chq,cont_alu,acum_mens,acum_chq,cont_chq_total,acum_chq_total,apoderado)" _
        & " values(" & objRS("correlativo") & "," & objRS("asig") & "," & objRS("folio_dtll") & "," & objRS("folio_mvto") & ",'" & objRS("rut_apo") _
        & "','" & objRS("jornada") & "','" & objRS("curso") & "','" & objRS("ci_alu") & "','" _
        & objRS("nombres") & "','" & objRS("mes") & "'," & objRS("monto_tot_cuota") & "," _
        & objRS("monto_chq") & ",'" & objRS("run_titular") & "','" _
        & objRS("estado_chq") & "','" & objRS("numero_cheque") & "','" _
        & objRS("cta_cte") & "','" & objRS("tipo_pago") & "','" _
        & objRS("banco") & "','" & Format(objRS("chq_fecha"), "yyyy/mm/dd") & "','" & objRS("nom_titular") & "','" _
        & objRS("tel_titular") & "'," & objRS("cont_chq_alu") & "," & objRS("monto_alu_mens") & "," _
        & objRS("monto_alu_chq") & "," & objRS("cont_alu") & "," & objRS("acum_mens") & "," _
        & objRS("acum_chq") & "," & objRS("cont_chq_total") & "," & objRS("acum_chq_total") & ",'" & objRS("apoderado") & "')"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
    End If
    
    var_sql = "SELECT ci_alu,curso,chq_fecha,sum(monto_tot_cuota) mens,monto_chq cheque" _
            & " FROM fnza_informecheques_temp group by ci_alu"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        var_sql = "select numero_cheque from fnza_informecheques_temp" _
                & " where ci_alu = '" & objRS("ci_alu") & "'"
        REC.Open var_sql, conn
        cont = 0
        While Not REC.EOF
            If REC("numero_cheque") <> "" Then
                cont = cont + 1
            End If
            REC.MoveNext
        Wend
        REC.Close
        var_sql = "update fnza_informecheques_temp" _
                & " set cont_chq_alu = " & cont _
                & ",monto_alu_mens = " & objRS("mens") _
                & ",monto_alu_chq = " & objRS("cheque") _
                & " where ci_alu = '" & objRS("ci_alu") & "' and curso = '" & objRS("curso") & "'"
                
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    progreso.Value = progreso.Value + 5
    objRS.Close
       
    var_sql = "select ci_alu from fnza_informecheques_temp group by ci_alu"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
    objRS.MoveFirst
    While Not objRS.EOF
        var_sql = "SELECT ci_alu,cta_cte,numero_cheque,monto_chq,curso,chq_fecha,count(ci_alu) cont,sum(monto_tot_cuota) mens,monto_chq cheque" _
                & " FROM fnza_informecheques_temp" _
                & " where ci_alu = '" & objRS("ci_alu") _
                & "' group by ci_alu,cta_cte,numero_cheque"
        REC.Open var_sql, conn
        tot = 0
        While Not REC.EOF
            tot = tot + REC("cheque")
            REC.MoveNext
        Wend
        REC.MoveFirst
        var_sql = "update fnza_informecheques_temp" _
                & " set monto_alu_chq = " & tot _
                & " where ci_alu = '" & objRS("ci_alu") & "' and curso = '" & REC("curso") & "'" ' _
                '& " cta_cte = '" & rec("cta_cte") & "' and numero_cheque = '" & rec("numero_cheque") & "'" ' _
                ''& "' and monto_chq = " rec("monto_chq")
        conn.Execute var_sql
        REC.Close
        objRS.MoveNext
    Wend
    End If
    objRS.Close
    
'***************************
    var_sql = "SELECT curso,count(distinct ci_alu) cant_alu,sum(monto_tot_cuota) monto_cuota,sum(monto_chq) monto_cheque" _
            & " FROM fnza_informecheques_temp group by curso"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        var_sql = "update fnza_informecheques_temp" _
                & " set cont_alu = " & objRS("cant_alu") _
                & ",acum_mens = " & objRS("monto_cuota") _
                & ",acum_chq = " & objRS("monto_cheque") _
                & " where curso = '" & objRS("curso") & "'"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
    progreso.Value = progreso.Value + 5
    var_sql = "SELECT monto_chq total" _
            & " From fnza_informecheques_temp group by cta_cte,numero_cheque"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        total_monto = total_monto + objRS("total")
        total_cheques = total_cheques + 1
        objRS.MoveNext
    Wend
    objRS.Close
    
    var_sql = "update fnza_informecheques_temp" _
                & " set cont_chq_total = " & total_cheques _
                & ",acum_chq_total = " & total_monto
             
    conn.Execute var_sql
    
    var_sql = "select rut_apo from fnza_informecheques_temp" _
            & " group by rut_apo"
    
    objRS.Open var_sql, conn
    While Not objRS.EOF
        var_sql = "select monto_chq from fnza_informecheques_temp" _
                & " where rut_apo = '" & objRS("rut_apo") & "'" _
                & " group by cta_cte,numero_cheque"
        REC.Open var_sql
        tot = 0
        While Not REC.EOF
            tot = tot + REC("monto_chq")
            REC.MoveNext
        Wend
        REC.Close
    
        var_sql = "select monto_pago" _
                & " from fnza_cheques_recibidos fcr,fnza_chq_mvto fcm,fnza_movimientos_mensualidad fmm" _
                & " Where fcr.folio_chq = fcm.folio_chq And" _
                & " fcm.folio_mvto = fmm.folio_mvto And fcr.run_apo = '" & objRS("rut_apo") & "'"
        REC.Open var_sql, conn
        While Not REC.EOF
            tot = tot - REC("monto_pago")
            REC.MoveNext
        Wend
        REC.Close
        
        var_sql = "update fnza_informecheques_temp set monto_asig = " & tot _
                & " where rut_apo = '" & objRS("rut_apo") & "'"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
    progreso.Value = progreso.Value + 5
    
'**********************************
    
    var_sql = "select curso from fnza_informecheques_temp group by curso"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
    objRS.MoveFirst
    While Not objRS.EOF
        var_sql = "SELECT ci_alu,cta_cte,numero_cheque,monto_chq,curso,chq_fecha,count(ci_alu) cont,sum(monto_tot_cuota) mens,monto_chq cheque" _
                & " FROM fnza_informecheques_temp" _
                & " where curso = '" & objRS("curso") _
                & "' group by curso,cta_cte,numero_cheque"
        REC.Open var_sql, conn
        tot = 0
        While Not REC.EOF
            tot = tot + REC("cheque")
            REC.MoveNext
        Wend
        REC.MoveFirst
        var_sql = "update fnza_informecheques_temp" _
                & " set acum_chq = " & tot _
                & " where curso = '" & REC("curso") & "'" ' _
                '& " cta_cte = '" & rec("cta_cte") & "' and numero_cheque = '" & rec("numero_cheque") & "'" ' _
                ''& "' and monto_chq = " rec("monto_chq")
        conn.Execute var_sql
        REC.Close
        objRS.MoveNext
    Wend
    End If
    objRS.Close
    progreso.Value = progreso.Value + 5
    var_sql = "select * from fnza_informecheques_temp fict,fnza_cod_estado_chq fcec" _
            & " where fict.estado_chq = fcec.estado_chq" _
            & " group by cta_cte,numero_cheque"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        var_sql = "update fnza_informecheques_temp set" _
                & " estado_chq = '" & objRS("descripcion") _
                & "' where cta_cte = '" & objRS("cta_cte") _
                & "' and numero_cheque = '" & objRS("numero_cheque") & "'"
        conn.Execute var_sql
        objRS.MoveNext
    Wend
    objRS.Close
    'coloca marca
    var_sql = "select * from fnza_informecheques_temp" _
            & " group by ci_alu"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        If objRS("tipo_pago") = "cont" Then
            var_sql = "update fnza_informecheques_temp set marca = 1" _
                    & " where correlativo = " & objRS("correlativo")
            conn.Execute var_sql
        End If
        objRS.MoveNext
    Wend
    objRS.Close
    'borra registros con pago cuponera
    var_sql = "delete from fnza_informecheques_temp where tipo_pago = 'cup'"
    conn.Execute var_sql
    progreso.Value = progreso.Value + 5
End Sub

Private Sub crear_sincheque()
    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_alu_sincheques_temp;"
    objCMD.CommandText = objQRY
    objCMD.Execute
    
    objQRY = "CREATE TABLE IF NOT EXISTS fnza_alu_sincheques_temp " & _
                "(" & _
                "rut_apo varchar(10) NOT NULL default '', nom_apo varchar(50) NOT NULL default ''," & _
                "curso varchar(10) NOT NULL default '', ci_alu varchar(10) NOT NULL default ''," & _
                "nombre varchar(50) NOT NULL default '', cuota varchar(20) NOT NULL default '0', " & _
                "valor_cuota bigint(20) NOT NULL default '0', " & _
                "correlativo bigint(20) NOT NULL default '0', " & _
                "PRIMARY KEY (correlativo,rut_apo,curso,ci_alu,cuota), " & _
                "UNIQUE KEY unique_index_fnza_alu_sincheques_temp(correlativo,rut_apo,curso,ci_alu,cuota) " & _
                ") ENGINE=MyISAM;"
    objCMD.CommandText = objQRY
    objCMD.Execute
End Sub

'Public Function llenar_sin_cheque() As Boolean
'Dim var_sql As String
'llenar_sin_cheque = False
'Dim objRS As ADODB.Recordset
'Set objRS = New ADODB.Recordset
'Dim RC As ADODB.Recordset
'Set RC = New ADODB.Recordset
'var_sql = "select run_alu,fd.mes,fd.monto_tot_cuota" _
'        & " from (select  fdm.*" _
'        & " from fnza_informecheques_temp fict,fnza_detalle_mensualidad fdm" _
'        & " where fict.ci_alu = fdm.run_alu and date_format(chq_fecha,'%Y') =  date_format(fech_venc,'%Y')  and fdm.mes <> 2" _
'        & " group by run_alu,fech_venc) as fd left join fnza_informecheques_temp fic" _
'        & " on fd.folio_dtll = fic.folio_dtll" _
'        & " Where fic.folio_dtll Is Null"
'objRS.Open var_sql, conn
'If objRS.EOF Then
'    objRS.Close
'    Exit Function
'End If
'While Not objRS.EOF
'    var_sql = "select curso,nombres,rut_apo,apoderado from fnza_informecheques_temp" _
'            & " where ci_alu = '" & objRS("run_alu") & "'"
'    RC.Open var_sql, conn
'    var_sql = "insert into fnza_alu_sincheques_temp(rut_apo,nom_apo,curso,ci_alu,nombre,cuota,valor_cuota)" _
'            & " values('" & RC("rut_apo") & "','" & RC("apoderado") & "','" & RC("curso") & "','" & objRS("run_alu") & "','" _
'            & RC("nombres") & "'," & objRS("mes") & "," & objRS("monto_tot_cuota") & ")"
'    conn.Execute var_sql
'    objRS.MoveNext
'    RC.Close
'Wend
'objRS.Close
'llenar_sin_cheque = True
'End Function

Public Function llenar_sin_cheque() As Boolean
Dim var_sql As String
Dim sw As Boolean
llenar_sin_cheque = False
Dim objRS As ADODB.Recordset
Set objRS = New ADODB.Recordset
Dim REC As ADODB.Recordset
Set REC = New ADODB.Recordset
Dim i As Integer
'var_sql = "select run_alu,fd.mes,fd.monto_tot_cuota" _
'        & " from (select  fdm.*" _
'        & " from fnza_informecheques_temp fict,fnza_detalle_mensualidad fdm" _
'        & " where fict.ci_alu = fdm.run_alu and date_format(chq_fecha,'%Y') =  date_format(fech_venc,'%Y')  and fdm.mes <> 2" _
'        & " group by run_alu,fech_venc) as fd left join fnza_informecheques_temp fic" _
'        & " on fd.folio_dtll = fic.folio_dtll" _
'        & " Where fic.folio_dtll Is Null"
'objRS.Open var_sql, conn
'If objRS.EOF Then
'    objRS.Close
'    Exit Function
'End If

var_sql = "select ci_alu,rut_apo,apoderado,curso,nombres,monto_tot_cuota,mes from fnza_informecheques_temp" _
        & " Where numero_cheque = ''"
objRS.Open var_sql, conn
i = 0
While Not objRS.EOF
     var_sql = "select * from fnza_informecheques_temp where ci_alu = '" & objRS("ci_alu") & "'"
     REC.Open var_sql, conn
     sw = False
     While Not REC.EOF
        If REC("tipo_pago") = "cheq" Then sw = True
        REC.MoveNext
     Wend
     REC.Close
     i = i + 1
'    var_sql = "select curso,nombres,rut_apo,apoderado from fnza_informecheques_temp" _
'            & " where ci_alu = '" & objRS("run_alu") & "'"
'    RC.Open var_sql, conn
    If sw = True Then
        var_sql = "insert into fnza_alu_sincheques_temp(correlativo,rut_apo,nom_apo,curso,ci_alu,nombre,cuota,valor_cuota)" _
            & " values(" & i & ",'" & objRS("rut_apo") & "','" & objRS("apoderado") & "','" & objRS("curso") & "','" & objRS("ci_alu") & "','" _
            & objRS("nombres") & "','" & objRS("mes") & "'," & objRS("monto_tot_cuota") & ")"
        conn.Execute var_sql
    End If
    objRS.MoveNext
'    RC.Close
Wend
objRS.Close
llenar_sin_cheque = True
End Function


Public Sub limpia_campos()
    chec_tod_alu.Value = 0
    chec_tod_ban.Value = 0
    chec_tod_cur.Value = 0
    chec_tod_apo.Value = 0
    Frame5.Enabled = True
    cmd_sincheque.Visible = False
    progreso.Min = 0
    lst_Alumnos.Visible = False
    lst_RutAlumno.Visible = False
    lst_Apoderados.Visible = False
    lst_RutApoderado.Visible = False
    lst_Titular.Visible = False
    'cmb_mod_cob.Clear
    'carga_nivel
    txt_Alumno.Text = ""
    txt_rut.Text = ""
    txt_Apoderados.Text = ""
    txt_RutApo.Text = ""
    cb_banco.Clear
    'cb_Jornada.Clear
    txt_Titular.Text = ""
    'cb_Jornada.Text = ""
    'cmb_mod_cob.Text = ""
    'lst_cursosinf.Clear
    carga_bancos
    'carga_jornadas
    frame_reporte.Enabled = True
    grid_listado_cheques.Rows = 2
    grid_listado_cheques.ClearStructure
End Sub
Public Sub oculta_frames()
    frame_alumno.Visible = False
    frame_apoderado.Visible = False
    frame_banco.Visible = False
    frame_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 rut_apo as 'Rut. Apo.',apoderado,curso,ci_alu as 'Rut. Alu. '," _
            & " nombres as 'Alumno',mes,monto_tot_cuota as 'Cuota'," _
            & " monto_chq as 'Monto Cheque',monto_tot_cuota as 'Mon. Asig.'," _
            & " run_titular as 'Rut. Tit.',numero_cheque as 'Nro. Cheque',banco," _
            & " chq_fecha as 'Fecha',nom_titular as 'Titular',tel_titular as 'Telefono'" _
            & " From fnza_informecheques_temp"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        Call Rec2Grid(objRS, grid_listado_cheques, True)
        grid_listado_cheques.ColSel = grid_listado_cheques.Cols - 1
    Else
        MsgBox "La busqueda no arrojo resultados", vbInformation
    End If
    
End Sub

Public Sub carga_agno()
   For i = 2005 To Year(Date)
        cb_fec_alu.AddItem i
        cb_fec_ban.AddItem i
        cb_fec_tod.AddItem i
        cb_fec_apo.AddItem i
   Next i
   cb_fec_ban = Year(Date)
   cb_fec_tod = Year(Date)
   cb_fec_apo = Year(Date)
   cb_fec_alu.Text = Year(Date)
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
        ' Llenar Siguiente Combo.
        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 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 bloquea_procesos()
    frame_por.Enabled = False
    Frame5.Enabled = False
    Frame2.Enabled = False
    frame_reporte.Enabled = False
    
    frame_curso.Enabled = False
    frame_alumno.Enabled = False
    frame_banco.Enabled = False
    frame_apoderado.Enabled = False
    frame_todos.Enabled = False
End Sub

Private Sub desbloquea_procesos()
    frame_por.Enabled = True
    Frame5.Enabled = True
    Frame2.Enabled = True
    frame_reporte.Enabled = True
    
    frame_curso.Enabled = True
    frame_alumno.Enabled = True
    frame_banco.Enabled = True
    frame_apoderado.Enabled = True
    frame_todos.Enabled = True
End Sub

