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_Gestion_Cheques 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Gestion de Cheques"
   ClientHeight    =   6795
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11340
   Icon            =   "Form_Gestion_Cheques.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6795
   ScaleWidth      =   11340
   Begin VB.ListBox lst_nom_apo 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   5400
      TabIndex        =   1
      Top             =   720
      Visible         =   0   'False
      Width           =   3255
   End
   Begin VB.ListBox lst_nom_alu 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   5400
      TabIndex        =   10
      Top             =   720
      Visible         =   0   'False
      Width           =   3255
   End
   Begin VB.ListBox lst_rut_apo 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   9120
      TabIndex        =   0
      Top             =   720
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.ListBox lst_rut_alu 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   9120
      TabIndex        =   11
      Top             =   720
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.Frame Frame7 
      Height          =   735
      Left            =   5880
      TabIndex        =   56
      Top             =   5880
      Width           =   2055
      Begin VB.CommandButton cmd_protestados 
         Caption         =   "Cheques 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            =   120
         TabIndex        =   57
         Top             =   240
         Width           =   1815
      End
   End
   Begin VB.Frame frame_cheques 
      Height          =   3375
      Left            =   3960
      TabIndex        =   40
      Top             =   1680
      Visible         =   0   'False
      Width           =   3735
      Begin VB.ComboBox cb_estado 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         ItemData        =   "Form_Gestion_Cheques.frx":2A8B2
         Left            =   1800
         List            =   "Form_Gestion_Cheques.frx":2A8B4
         Style           =   2  'Dropdown List
         TabIndex        =   48
         Top             =   2160
         Width           =   1695
      End
      Begin VB.CommandButton cmd_CambiarEstado 
         Caption         =   "Cambiar"
         Enabled         =   0   'False
         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        =   42
         Top             =   2760
         Width           =   1455
      End
      Begin VB.CommandButton cmd_Salir 
         Caption         =   "Salir"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1920
         TabIndex        =   41
         Top             =   2760
         Width           =   1455
      End
      Begin VB.Label Label16 
         Caption         =   "Cambiar estado a:"
         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        =   54
         Top             =   2160
         Width           =   1455
      End
      Begin VB.Label lbl_estado 
         Caption         =   "Label20"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   1800
         TabIndex        =   53
         Top             =   1680
         Width           =   1695
      End
      Begin VB.Label lbl_fecha 
         Caption         =   "Label19"
         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        =   52
         Top             =   1320
         Width           =   1575
      End
      Begin VB.Label lbl_monto 
         Caption         =   "Label18"
         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        =   51
         Top             =   960
         Width           =   735
      End
      Begin VB.Label lbl_numero_cheque 
         Caption         =   "Label17"
         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        =   50
         Top             =   600
         Width           =   1695
      End
      Begin VB.Label lbl_cta_cte 
         Caption         =   "Label16"
         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        =   49
         Top             =   240
         Width           =   1575
      End
      Begin VB.Label Label11 
         Caption         =   "Nro Cheque:"
         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        =   47
         Top             =   600
         Width           =   1455
      End
      Begin VB.Label Label12 
         Caption         =   "Cuenta Corriente:"
         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        =   46
         Top             =   240
         Width           =   1575
      End
      Begin VB.Label Label13 
         Caption         =   "Monto:"
         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        =   45
         Top             =   960
         Width           =   615
      End
      Begin VB.Label Label14 
         Caption         =   "Estado:"
         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        =   44
         Top             =   1680
         Width           =   855
      End
      Begin VB.Label Label15 
         Caption         =   "Fecha:"
         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        =   43
         Top             =   1320
         Width           =   735
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Opciones"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   975
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   3135
      Begin VB.OptionButton Option1 
         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
         Index           =   1
         Left            =   1200
         TabIndex        =   8
         Top             =   400
         Width           =   1695
      End
      Begin VB.OptionButton Option1 
         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
         Index           =   0
         Left            =   1200
         TabIndex        =   7
         Top             =   120
         Value           =   -1  'True
         Width           =   1695
      End
      Begin VB.OptionButton Option1 
         Caption         =   "Por Alumno"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Index           =   2
         Left            =   1200
         TabIndex        =   6
         Top             =   720
         Width           =   1695
      End
      Begin VB.Label Label4 
         Caption         =   "Seleccionar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   405
         Width           =   975
      End
   End
   Begin VB.Frame Frame6 
      Height          =   735
      Left            =   8040
      TabIndex        =   2
      Top             =   5880
      Width           =   3135
      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            =   120
         TabIndex        =   4
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton Command3 
         Caption         =   "Salir"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1560
         TabIndex        =   3
         Top             =   240
         Width           =   1455
      End
   End
   Begin MSComctlLib.ProgressBar progreso 
      Height          =   375
      Left            =   120
      TabIndex        =   55
      Top             =   5520
      Width           =   11055
      _ExtentX        =   19500
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   1
      Max             =   1
      Scrolling       =   1
   End
   Begin VB.Frame Frame3 
      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          =   4215
      Left            =   120
      TabIndex        =   34
      Top             =   1200
      Width           =   11055
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid grid 
         Height          =   3855
         Left            =   120
         TabIndex        =   35
         Top             =   240
         Width           =   10815
         _ExtentX        =   19076
         _ExtentY        =   6800
         _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 Frame5 
      Caption         =   "Seleccion por Apoderado"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   975
      Left            =   3360
      TabIndex        =   22
      Top             =   120
      Width           =   7815
      Begin VB.ComboBox cb_agno_apo 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   480
         TabIndex        =   36
         Text            =   "2011"
         Top             =   360
         Width           =   855
      End
      Begin VB.CommandButton Btn_Ver_Apoderado 
         Caption         =   "Ver"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   6960
         Picture         =   "Form_Gestion_Cheques.frx":2A8B6
         Style           =   1  'Graphical
         TabIndex        =   25
         Top             =   240
         Width           =   735
      End
      Begin VB.TextBox txt_rut_apo 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   5760
         TabIndex        =   24
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox txt_nom_apo 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   2040
         TabIndex        =   23
         Text            =   "Text3"
         Top             =   360
         Width           =   3255
      End
      Begin VB.Label Label9 
         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
         Left            =   120
         TabIndex        =   37
         Top             =   360
         Width           =   375
      End
      Begin VB.Label Label8 
         Caption         =   "Run"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5400
         TabIndex        =   27
         Top             =   360
         Width           =   495
      End
      Begin VB.Label Label7 
         Caption         =   "Nombre"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   1440
         TabIndex        =   26
         Top             =   360
         Width           =   615
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Selección por Curso"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   975
      Left            =   3360
      TabIndex        =   12
      Top             =   120
      Width           =   7815
      Begin VB.CommandButton Btn_Ver_Lista 
         Caption         =   "Ver"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   6960
         Picture         =   "Form_Gestion_Cheques.frx":2AE2D
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   240
         Width           =   735
      End
      Begin VB.CheckBox Check_Letra 
         Caption         =   "Letra"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   195
         Left            =   5760
         TabIndex        =   13
         Top             =   240
         Width           =   1095
      End
      Begin MSComctlLib.ImageCombo IC_Ensenanza 
         Height          =   345
         Left            =   1320
         TabIndex        =   15
         Top             =   480
         Width           =   3135
         _ExtentX        =   5530
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Ensenanza"
      End
      Begin MSComctlLib.ImageCombo IC_Nivel 
         Height          =   345
         Left            =   4560
         TabIndex        =   16
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Nivel"
      End
      Begin MSComctlLib.ImageCombo IC_Letra 
         Height          =   345
         Left            =   5760
         TabIndex        =   17
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         Enabled         =   0   'False
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Letra"
      End
      Begin MSComctlLib.ImageCombo IC_Agno 
         Height          =   345
         Left            =   120
         TabIndex        =   18
         Top             =   480
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Locked          =   -1  'True
         Text            =   "IC_Agno"
      End
      Begin VB.Label Label3 
         Caption         =   "Nivel"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   4560
         TabIndex        =   21
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "Enseñanza"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   1320
         TabIndex        =   20
         Top             =   240
         Width           =   2895
      End
      Begin VB.Label Label1 
         Caption         =   "Año"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Left            =   120
         TabIndex        =   19
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Frame Frame4 
      Caption         =   "Selección por 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          =   975
      Left            =   3360
      TabIndex        =   28
      Top             =   120
      Width           =   7815
      Begin VB.ComboBox cb_agno_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            =   480
         TabIndex        =   39
         Text            =   "2006"
         Top             =   360
         Width           =   855
      End
      Begin VB.CommandButton Btn_Ver_Alumno 
         Caption         =   "Ver"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   6960
         Picture         =   "Form_Gestion_Cheques.frx":2B3A4
         Style           =   1  'Graphical
         TabIndex        =   31
         Top             =   240
         Width           =   735
      End
      Begin VB.TextBox txt_rut_alu 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   5760
         TabIndex        =   30
         Text            =   "Text2"
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox txt_nom_alu 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   2040
         TabIndex        =   29
         Text            =   "Text1"
         Top             =   360
         Width           =   3255
      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
         Left            =   120
         TabIndex        =   38
         Top             =   360
         Width           =   375
      End
      Begin VB.Label Label6 
         Caption         =   "Run"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5400
         TabIndex        =   33
         Top             =   360
         Width           =   495
      End
      Begin VB.Label Label5 
         Caption         =   "Nombre"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   1440
         TabIndex        =   32
         Top             =   360
         Width           =   615
      End
   End
   Begin Crystal.CrystalReport cr_protestados 
      Left            =   1920
      Top             =   5880
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   262150
   End
End
Attribute VB_Name = "Form_Gestion_Cheques"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fra, fna, frp, fnp As Boolean
Private Sub Rec2Grid(ByRef REC As ADODB.Recordset, ByRef grid As Object, Optional ByVal Numeracion As Boolean = True)
    grid.ClearStructure
    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
        For i = 1 To REC.RecordCount
            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 Btn_Ver_Alumno_Click()
    If txt_nom_alu.Text <> "" And txt_rut_alu.Text <> "" Then
        bloquear_opciones
        llena_grilla_con_cheques
    Else
        MsgBox "Para realizar la busqueda primero debe seleccionar un alumno", vbInformation
    End If
End Sub

Private Sub Btn_Ver_Apoderado_Click()
    If txt_nom_apo.Text <> "" And txt_rut_apo.Text <> "" Then
        bloquear_opciones
        llena_grilla_con_cheques
    Else
        MsgBox "Para realizar la busqueda primero debe seleccionar un apoderado", vbInformation
    End If
End Sub

Private Sub Btn_Ver_Lista_Click()
    bloquear_opciones
    llena_grilla_con_cheques
    Frame1.Enabled = False
End Sub

Private Sub cmd_cancelado_Click()
Dim R As Integer
R = MsgBox("¿Esta seguro de que desea marcar el cheque como cobrado?", _
vbQuestion + vbYesNo, "Mensaje de confirmación")
If R = 6 Then
    MsgBox "si"
Else
    MsgBox "no"
End If
End Sub

Private Sub cb_estado_Click()
    Dim Estado As String
    Estado = grid.TextMatrix(grid.Row, 8)
    If cb_estado.Text <> Estado Then
        cmd_CambiarEstado.Enabled = True
    End If
End Sub

Private Sub cmd_CambiarEstado_Click()
    Dim estado_ant, Clave, Estado, var_sql, pass, Password As String
    Dim R As Integer
    Dim varsql As String
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim accion_detalle As String
    Dim colegio As String
    Dim conecta As Boolean
    
    If cb_estado.Text <> "" Then
        
        R = MsgBox("¿Esta seguro de que desea cambiar el estado a " & cb_estado.Text & "?", _
        vbQuestion + vbYesNo, "Mensaje de confirmación")
        If R = 6 Then
            
            '******************************************************************
            'Obtengo password
            varsql = "SELECT valor FROM `cfg`" _
                    & " where param = 'password_cheques'"
            objRS.Open varsql, conn
            Password = objRS("valor")
            objRS.Close
            
            '*******************************************************************
            'obtengo desde la base de datos el codigo del estado de cheque final
            var_sql = "select estado_chq, pass from fnza_cod_estado_chq" _
                    & " where descripcion = '" & cb_estado.Text & "'"
            objRS.Open var_sql, conn
            If Not objRS.EOF Then
                Estado = objRS("estado_chq")
                pass = objRS("pass")
            End If
            objRS.Close
                        
            
            '*****************************************************************
            'Pido password si el estado al que se quiere cambiar es
            If pass = "SI" Then
                Clave = InputBox("Para cambiar al estado seleccionado, debe ingresar su clave de autorizacion." & vbCrLf & "Password:", "Password")
                If Clave <> Password Then
                    MsgBox "Password Incorrecta", vbCritical
                    Exit Sub
                End If
            End If
            
            '**********************************************************************
            'obtengo desde la base de datos el codigo del estado de cheque anterior
            var_sql = "select estado_chq from fnza_cod_estado_chq" _
                    & " where descripcion = '" & lbl_estado.Caption & "'"
            objRS.Open var_sql, conn
            If Not objRS.EOF Then
                estado_ant = objRS("estado_chq")
            End If
            objRS.Close
                        
            '*****************************************************************
            'Pido password en caso de que el usuario quiera cambiar el estado cobrado a otro estado
            If estado_ant = "clda" Then
                 Clave = InputBox("Esta tratando de modificar el estado a un cheque ya cancelado y debe ingresar el password de validacion." & vbCrLf & "Password:", "Password")
                 If Clave <> Password Then
                     MsgBox "Password Incorrecta", vbCritical
                     Exit Sub
                 End If
            End If
            
            '********************************************************
            'Verifico que los cheques esten en el estado previo antes de ser cambiado
            If (Estado = "resc" Or Estado = "prto") Then
                If estado_ant <> "cart" And estado_ant <> "clda" Then
                    MsgBox "Para poder cambiar el estado del cheque a " & cb_estado.Text _
                    & ", el estado anterior debe ser En Cartera", vbInformation
                    Exit Sub
                End If
                varsql = " SELECT fdm.folio_blta, fdm.folio_mvto, fmm.monto_pago,fcm.run_apo " & _
                         " FROM fnza_chq_mvto fcm, fnza_dtll_mvto fdm, fnza_movimientos_mensualidad fmm " & _
                         " where fdm.folio_mvto = fcm.folio_mvto and fmm.folio_mvto = fdm.folio_mvto and fmm.folio_dtll = fdm.folio_dtll and fcm.folio_chq = " & grid.TextMatrix(grid.Row, 1)
                objRS.Open varsql, conn
                If objRS.RecordCount = 0 Then
                    MsgBox "Para poder cambiar el estado del cheque a " & cb_estado.Text _
                    & ", el cheque debe estar vinculado a algun movimiento", vbInformation
                    Exit Sub
                End If
                '******************************************************
                
                '******************************************************
                While Not objRS.EOF
                    CreaNTCR objRS("folio_blta"), objRS("folio_mvto"), objRS("monto_pago"), objRS("run_apo"), IIf((Estado = "prto"), "1", "2"), conn
                    objRS.MoveNext
                Wend
                objRS.Close
            End If
            
            If (Estado = "acla" Or Estado = "cjud") And estado_ant <> "prto" Then
                    MsgBox "Para poder cambiar el estado del cheque a " & cb_estado.Text _
                    & ", el estado anterior debe ser Protestado", vbInformation
                    Exit Sub
            End If
            
            If (Estado = "clda" Or Estado = "cart") Then
                If Not (estado_ant = "cart" Or estado_ant = "dsto" Or estado_ant = "endo" _
                Or estado_ant = "fact" Or estado_ant = "gtia" Or estado_ant = "cjte") Then
                    MsgBox "Para poder cambiar el estado del cheque a " & cb_estado.Text _
                    & ", el estado anterior debe ser cualquiera de los siguientes En cartera, En Descuento, Endosado, En Factoring, En Garantía o Cobrado Judicialmente", vbInformation
                    Exit Sub
                End If
            End If
            
            '*********************************************************
            'actualizamos la base de datos cheques con el nuevo estado
            var_sql = "update fnza_cheques_recibidos set" _
                    & " estado_chq = '" & Estado _
                    & "' where folio_chq = " & grid.TextMatrix(grid.Row, 1)
            conn.Execute var_sql
                       
            
            '*********************************************************
            'dejamos en el log el cambio que se le realizo al cheque
            var_sql = " INSERT INTO fnza_chq_log (folio_chq, estado_anterior,estado_actual,fecha,usuario,ip,proceso)" & _
                      " VALUES (" & grid.TextMatrix(grid.Row, 1) & ",'" & estado_ant & "','" & Estado & "', concat(date_format(current_date,'%Y-%m-%d'),' ',current_time),'" & Nom_usu_ses & "','" & Form_main.Winsock1.LocalIP & "','cambio manual');"
            conn.Execute var_sql
            
            'Log fnza_historico_log
            varsql = "select fcm.run_apo,fcm.run_alu,cta_cte,chq_serie,chq_numero,descripcion,concat(ape1_apo,' ',ape2_apo,' ',noms_apo) as apoderado,run_titular,nom_titular" _
                   & " from fnza_cheques_recibidos fcr,fnza_chq_mvto fcm,fnza_cod_banco fcb,apoderados a" _
                   & " Where fcr.folio_chq = fcm.folio_chq And" _
                   & " fcr.banco = fcb.banco And fcr.folio_chq = " _
                   & grid.TextMatrix(grid.Row, 1) & " and fcr.run_apo = a.rut_apo"
            objRS.Open varsql, conn
            
            If Estado = "prto" Then
                conecta = ConectarBDSiempre(conn_deuda, "192.168.7.91", "comunes_gescol", "groot", "kripplefight", True)
                colegio = DevuelveCampo("establecimientos", "", "NOM_EST", "1=1", conn)
                var_sql = "insert into apoderados_cheques_protestados(ci_apo,apoderado,ci_tit,titular,colegio)" _
                        & " values('" & objRS("run_apo") & "','" & objRS("apoderado") & "','" & objRS("run_titular") & "','" & objRS("nom_titular") & "','" & colegio & "')"
                conn_deuda.Execute var_sql
                conn_deuda.Close
            End If
            
            accion_detalle = "El nuevo estado del cheque Cuenta Corriente: " & objRS("cta_cte") _
                           & " Serie: " & objRS("chq_serie") & " Numero: " & objRS("chq_numero") _
                           & " del banco " & objRS("descripcion") & " es " & cb_estado.Text
            While Not objRS.EOF
                Call Inserta_Vitacora_Finanza(objRS("run_alu"), objRS("run_apo"), _
                "Cambio de Estado", accion_detalle, 0, 0)
                objRS.MoveNext
            Wend
            objRS.Close
            'Fin de log
            
            lbl_estado = cb_estado.Text
            grid.TextMatrix(grid.Row, 8) = cb_estado.Text
        Else
            cmd_salir_Click
        End If
    Else
        MsgBox "Debe seleccionar primero un estado", vbInformation
    End If
    cmd_salir_Click
End Sub

Private Sub cmd_limpiar_Click()
    limpiar
End Sub

Private Sub cmd_protestados_Click()
    Dim bd As String
    bd = App.Path & "\Rpt\cheques_protestados.mdb"
    CreaBD (bd)
    Call CreaTablaReporte(bd, "reporte")
    Call llenar_tabla(bd, "reporte")
End Sub

Private Sub cmd_salir_Click()
    Frame2.Enabled = True
    Frame3.Enabled = True
    Frame6.Enabled = True
    Frame4.Enabled = True
    Frame5.Enabled = True
    frame_cheques.Visible = False
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    llenar_estado
' Setear el combo años.
    Dim agno, i As Integer
    agno = Year(Date)
    For i = 2005 To agno + 1
        cb_agno_alu.AddItem i
        cb_agno_apo.AddItem i
    Next i
    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
    cambia_estado_masivo
End Sub

Private Sub cambia_estado_masivo()
    Dim sql As String
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    
    sql = "select folio_chq from fnza_cheques_recibidos where estado_chq = 'cart' and chq_fecha < date_format(current_date,'%Y-%m-%d');"
    rs.Open sql, conn
    
    While Not rs.EOF
        '*********************************************************
        'actualizamos la base de datos cheques con el nuevo estado
        var_sql = "update fnza_cheques_recibidos set estado_chq = 'clda' where folio_chq = " & rs("folio_chq")
        conn.Execute var_sql
            
        '*********************************************************
        'dejamos en el log el cambio que se le realizo al cheque
        var_sql = " INSERT INTO fnza_chq_log (folio_chq, estado_anterior,estado_actual,fecha,usuario,ip,proceso)" & _
                  " VALUES (" & rs("folio_chq") & ",'cart','clda', concat(date_format(current_date,'%Y-%m-%d'),' ',current_time),'" & Nom_usu_ses & "','" & Form_main.Winsock1.LocalIP & "','cambio masivo');"
        conn.Execute var_sql
        rs.MoveNext
    Wend
    
    
End Sub

Private Sub grid_DblClick()
    frame_cheques.Visible = True
    lbl_cta_cte = grid.TextMatrix(grid.Row, 2)
    lbl_numero_cheque = grid.TextMatrix(grid.Row, 3)
    lbl_monto = grid.TextMatrix(grid.Row, 4)
    lbl_fecha = grid.TextMatrix(grid.Row, 5)
    lbl_estado = grid.TextMatrix(grid.Row, 8)
    Frame2.Enabled = False
    Frame3.Enabled = False
    Frame6.Enabled = False
    Frame4.Enabled = False
    Frame5.Enabled = False
    cmd_CambiarEstado.Enabled = False
End Sub

Private Sub IC_Agno_Change()
    IC_Ensenanza.Enabled = True
    Set_IC_Ensenanza
End Sub
Private Sub lst_nom_alu_Click()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    txt_nom_alu.Text = lst_nom_alu.Text
    lst_nom_alu.Visible = False
    lst_rut_alu.Visible = False
    RC.Open "SELECT ci_alu FROM postulantes WHERE left(CONCAT(ape_Pat_alu,' ',ape_Mat_alu,' ',nom_alu)," & Len(txt_nom_alu.Text) & ")='" & txt_nom_alu.Text & "' ORDER BY ape_pat_alu, ape_mat_alu, nom_alu;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_rut_alu.Text = RC("ci_alu")
    RC.Close
    Flag_sub = False
    Btn_Ver_Alumno.Enabled = True
    If txt_nom_alu.Text <> "" And txt_rut_alu.Text <> "" Then
        txt_nom_alu.Locked = True
        txt_rut_alu.Locked = True
    End If
End Sub

Private Sub lst_rut_alu_Click()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    txt_rut_alu.Text = lst_rut_alu.Text
    lst_rut_alu.Visible = False
    lst_nom_alu.Visible = False
    RC.Open "SELECT CONCAT(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) as nombre_alu FROM postulantes WHERE ci_alu='" & txt_rut_alu.Text & "' ORDER BY ci_alu;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_nom_alu.Text = RC("nombre_alu")
    RC.Close
    Flag_sub = False
    Btn_Ver_Alumno.Enabled = True
End Sub

Private Sub lst_nom_apo_Click()
    Dim RC As ADODB.Recordset
    txt_nom_apo.Text = lst_nom_apo.Text
    lst_nom_apo.Visible = False
    lst_rut_apo.Visible = False
    Set RC = New ADODB.Recordset
    RC.Open "SELECT rut_apo FROM `apoderados` where left(CONCAT(ape1_apo,' ',ape2_apo,' ',noms_apo)," & Len(txt_nom_apo.Text) & ")='" & txt_nom_apo.Text & "' ORDER BY ape1_apo, ape2_apo, noms_apo;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_rut_apo.Text = RC("rut_apo")
    Flag_sub = False
    Btn_Ver_Apoderado.Enabled = True
    RC.Close
    If txt_nom_apo.Text <> "" And txt_rut_apo.Text <> "" Then
        txt_nom_apo.Locked = True
        txt_rut_apo.Locked = True
    End If
End Sub

Private Sub lst_rut_apo_Click()
    Dim RC As ADODB.Recordset
    txt_rut_apo.Text = lst_rut_apo.Text
    lst_rut_apo.Visible = False
    lst_nom_apo.Visible = False
    Set RC = New ADODB.Recordset
    RC.Open "SELECT CONCAT(ape1_apo,' ',ape2_apo,' ',noms_apo) as nombre_apo FROM apoderados where rut_apo='" & txt_rut_apo.Text & "' ORDER BY rut_apo;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_nom_apo.Text = RC("nombre_apo")
    Flag_sub = False
    Btn_Ver_Apoderado.Enabled = True
    RC.Close
    If txt_nom_apo.Text <> "" And txt_rut_apo.Text <> "" Then
        txt_nom_apo.Locked = True
        txt_rut_apo.Locked = True
    End If
End Sub

Private Sub Option1_Click(Index As Integer)
    limpiar
'    txt_nom_alu.Text = ""
'    txt_rut_alu.Text = ""
'    txt_nom_apo.Text = ""
'    txt_rut_apo.Text = ""
'    lst_nom_alu.Visible = False
'    lst_rut_alu.Visible = False
'    lst_nom_apo.Visible = False
'    lst_rut_apo.Visible = False
    If Option1(Index).Value = True Then
        If Index = 0 Then
            MuestraFrame "curso"
        ElseIf Index = 1 Then
            MuestraFrame "apoderado"
        ElseIf Index = 2 Then
            MuestraFrame "alumno"
        End If
    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
        ' 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 IC_Ensenanza_Click()
    IC_Nivel.Enabled = True
    Call Set_IC_Nivel
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 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_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 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 MuestraFrame(ByVal frm As String)
    ' Muestra seleccion por curso
    If frm = "curso" Then
        Frame1.Visible = True
        'SeteaVistaCurso
    Else
        Frame1.Visible = False
    End If
    ' Muestra seleccion por apoderado
    If frm = "apoderado" Then
        Frame5.Visible = True
        'SeteaVistaApoderado
        Btn_Ver_Alumno.Enabled = False
    Else
        Frame5.Visible = False
    End If
    ' Muestra seleccion por alumno
    If frm = "alumno" Then
        Frame4.Visible = True
        Btn_Ver_Apoderado.Enabled = False
        'SeteaVistaAlumno
    Else
        Frame4.Visible = False
    End If
End Sub

Private Sub Set_IC_Agno()
    Dim agno As Integer
    
    agno = IIf(Year(Date) < 2005, 2005, Year(Date))
    IC_Agno.ComboItems.Clear
    For i = 1 To (agno - 2004) + 1
        IC_Agno.ComboItems.Add i, , str(i + 2004)
    Next i
    Set IC_Agno.SelectedItem = IC_Agno.ComboItems.Item(i - 2)
    ErrorStatus = False
    ' Llenar combo enseñanza
    IC_Ensenanza.Enabled = True
    IC_Nivel.Enabled = False
    IC_Letra.Enabled = False
    Call Set_IC_Ensenanza
End Sub
 
Private Sub txt_nom_alu_Change()
If fnp = True Then
    Dim var_sql As String
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If txt_nom_alu.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
    
    var_sql = "select distinct ape_pat_alu,ape_mat_alu,nom_alu" _
        & " from fnza_cheques_recibidos fcr,apo_x_alu axa,postulantes p" _
        & " where fcr.run_apo = axa.rut_apo and date_format(chq_fecha,'%Y') = axa.agno and" _
        & " axa.ci_alu = p.ci_alu and" _
        & " concat(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) like '" _
        & txt_nom_alu.Text & "%'"
    RC.Open var_sql, conn
    lst_nom_alu.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            lst_nom_alu.AddItem RC("ape_pat_alu") & " " & RC("ape_mat_alu") & " " & RC("nom_alu")
            RC.MoveNext
        Wend
        lst_nom_alu.Visible = True
        lst_rut_alu.Visible = False
    End If
    RC.Close
    Btn_Ver_Alumno.Enabled = False
End If
End Sub

Private Sub txt_nom_alu_Click()
    fra = False
    fna = False
    frp = False
    fnp = True
End Sub

Private Sub txt_nom_apo_Click()
    fra = False
    fna = True
    frp = False
    fnp = False
End Sub



Private Sub txt_rut_alu_Change()
If frp = True Then
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If txt_rut_alu.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
    
    RC.Open "select distinct p.ci_alu" _
        & " from fnza_cheques_recibidos fcr,apo_x_alu axa,postulantes p" _
        & " where fcr.run_apo = axa.rut_apo and date_format(chq_fecha,'%Y') = axa.agno and" _
        & " axa.ci_alu = p.ci_alu and" _
        & " p.ci_alu like '" & txt_rut_alu.Text & "%'", conn
    lst_rut_alu.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            lst_rut_alu.AddItem RC("ci_alu")
            RC.MoveNext
        Wend
        lst_nom_alu.Visible = False
        lst_rut_alu.Visible = True
    End If
    RC.Close
    Btn_Ver_Alumno.Enabled = False
End If
End Sub

Private Sub txt_nom_apo_Change()
If fna = True Then
    Dim var_sql As String
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If txt_nom_apo.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
        
    var_sql = "SELECT DISTINCT a.ape1_apo, a.ape2_apo, a.noms_apo" _
            & " FROM apoderados a, fnza_cheques_recibidos fcr" _
            & " where a.rut_apo = fcr.run_apo and" _
            & " concat(ape1_apo,' ',ape2_apo,' ',noms_apo)" _
            & " like '" & txt_nom_apo.Text & "%'"
            
    RC.Open var_sql, conn
    lst_nom_apo.Clear
    While Not (RC.EOF)
        lst_nom_apo.AddItem RC("ape1_apo") & " " & RC("ape2_apo") & " " & RC("noms_apo")
        RC.MoveNext
    Wend
    RC.Close
    Btn_Ver_Apoderado.Enabled = False
    lst_nom_apo.Visible = True
    lst_rut_apo.Visible = False
End If
End Sub

Private Sub txt_rut_alu_Click()
    fra = False
    fna = False
    frp = True
    fnp = False
End Sub

Private Sub txt_rut_apo_Change()
' Si el cambio lo hace un Sub no hacer nada
If fra = True Then
    If Flag_sub Then Exit Sub
    If txt_rut_apo.Text = "" Then Exit Sub
    Dim Str_Query As String
    Dim RC As ADODB.Recordset
    
    Set RC = New ADODB.Recordset
    Str_Query = "select distinct run_apo from fnza_cheques_recibidos" _
              & " where run_apo like '" & txt_rut_apo.Text & "%'"
    RC.Open Str_Query, conn
    lst_rut_apo.Clear
    While Not (RC.EOF)
        lst_rut_apo.AddItem RC("run_apo")
        RC.MoveNext
    Wend
    RC.Close
    Btn_Ver_Apoderado.Enabled = False
    lst_rut_apo.Visible = True
    lst_nom_apo.Visible = False
End If
End Sub

Public Sub llena_grilla_con_cheques()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql, condicion, Cod_Ens As String
        
    If Option1(0).Value = True Then
        Select Case IC_Ensenanza.Text
            Case Is = "Educación Parvularia"
                Cod_Ens = "010"
            Case Is = "Educación General Básica"
                Cod_Ens = "110"
            Case Is = "Educación Media H/C niños y jóvenes"
                Cod_Ens = "310"
            Case Is = "Otros Tipos (Pre Kinder)"
                Cod_Ens = "996"
        End Select
        If Check_Letra.Value = 1 Then
        var_sql = "select rut_apo" _
                & " from alu_x_cur axc,apo_x_alu axa" _
                & " Where axc.Ci_alu = axa.Ci_alu And axc.agno = axa.agno" _
                & " and axc.num_gra = " & IC_Nivel.Text _
                & " and axc.cod_ens = '" & Cod_Ens & "'" _
                & " and axc.let_cur = '" & IC_Letra.Text & "'" _
                & " and axc.agno = " & Year(Date)
        Else
            var_sql = "select rut_apo" _
                & " from alu_x_cur axc,apo_x_alu axa" _
                & " Where axc.Ci_alu = axa.Ci_alu And axc.agno = axa.agno" _
                & " and axc.num_gra = " & IC_Nivel.Text _
                & " and axc.cod_ens = '" & Cod_Ens & "'" _
                & " and axc.agno = " & Year(Date)
        End If
    
        objRS.Open var_sql, conn
        condicion = ""
        While Not objRS.EOF
            condicion = condicion & "fcr.run_apo = '" & objRS("rut_apo") & "' or "
            objRS.MoveNext
        Wend
        objRS.Close
        If condicion <> "" Then
            condicion = Mid(condicion, 1, Len(condicion) - 4)
            condicion = " and (" & condicion _
                      & ") and date_format(chq_fecha,'%Y') = " & IC_Agno.Text
        End If
    End If
    If Option1(1).Value Then
        condicion = " and fcr.run_apo = '" & txt_rut_apo.Text & "'" _
                  & " and date_format(chq_fecha,'%Y') = " & cb_agno_apo.Text
    End If
    If Option1(2).Value Then
        var_sql = " select rut_apo from apo_x_alu apa" _
                & " where ci_alu = '" & txt_rut_alu.Text & "' and" _
                & " apa.agno = " & cb_agno_alu.Text
        objRS.Open var_sql, conn
        If Not objRS.EOF Then
            condicion = " and fcr.run_apo = '" & objRS("rut_apo") & "'" _
                  & " and date_format(chq_fecha,'%Y') = " & cb_agno_alu.Text
        End If
        objRS.Close
    End If
    var_sql = "SELECT folio_chq,cta_cte as 'Cta. Cte.'," _
            & "concat(chq_serie,' ',chq_numero) as 'Numero Cheque'," _
            & "monto_chq as 'Monto',chq_fecha as 'Fecha'," _
            & "run_titular as 'Rut.Tit.',nom_titular as 'Titular'," _
            & "descripcion as 'Estado'" _
            & " FROM fnza_cheques_recibidos fcr,fnza_cod_estado_chq fcec" _
            & " Where fcr.estado_chq = fcec.estado_chq" & condicion
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        progreso.Min = 0
        progreso.Max = objRS.RecordCount
        Call Rec2Grid(objRS, grid, True)
        grid.ColWidth(1) = 0
        grid.ColSel = 8
    Else
        MsgBox "La busqueda no devolvio resultados", vbInformation
    End If
    objRS.Close
End Sub

Public Sub limpiar()
    Option1(0).Enabled = True
    Option1(1).Enabled = True
    Option1(2).Enabled = True
    
    lst_nom_alu.Visible = False
    lst_rut_alu.Visible = False
    lst_nom_apo.Visible = False
    lst_rut_apo.Visible = False
    
    txt_nom_alu.Text = ""
    txt_rut_alu.Text = ""
    txt_rut_apo.Text = ""
    txt_nom_apo.Text = ""
    grid.Rows = 2
    grid.ClearStructure
    
    Frame1.Enabled = True
    Btn_Ver_Alumno.Enabled = True
    cb_agno_alu.Locked = False
    txt_nom_alu.Locked = False
    txt_rut_alu.Locked = False
    Btn_Ver_Apoderado.Enabled = True
    cb_agno_apo.Locked = False
    txt_nom_apo.Locked = False
    txt_rut_apo.Locked = False
End Sub

Private Sub txt_rut_apo_Click()
    fra = True
    fna = False
    frp = False
    fnp = False
End Sub

Private Sub llenar_estado()
    Dim var_sql As String
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    var_sql = "SELECT * FROM fnza_cod_estado_chq"
    objRS.Open var_sql, conn
    While Not objRS.EOF
        cb_estado.Tag = objRS("estado_chq")
        cb_estado.AddItem objRS("descripcion")
        objRS.MoveNext
    Wend
    objRS.Close
'    cb_estado.AddItem "Cancelado"
'    cb_estado.AddItem "Protestado"
'    cb_estado.AddItem "En Garantia"
'    cb_estado.AddItem "Cobranza Judicial"
'    cb_estado.AddItem "En descuento"
'    cb_estado.AddItem "Aclarado"
'    cb_estado.AddItem "Rescatado"
'    cb_estado.AddItem "Endosado"
End Sub

Private Sub bloquear_opciones()
    cb_agno_apo.Locked = True
    txt_rut_apo.Locked = True
    txt_nom_apo.Locked = True
    Btn_Ver_Apoderado.Enabled = False
    cb_agno_alu.Locked = True
    txt_nom_alu.Locked = True
    txt_rut_alu.Locked = True
    Btn_Ver_Alumno.Enabled = False
    Option1(0).Enabled = False
    Option1(1).Enabled = False
    Option1(2).Enabled = False
End Sub

Private Sub CreaTablaReporte(NomBd As String, NomTabla As String)
'On Error GoTo errores
Dim dbsTemp As Database
Dim NumCampos, TipoCampo As Integer
Dim tdfNuevo As TableDef
Set dbsTemp = OpenDatabase(NomBd)
Set tdfNuevo = dbsTemp.CreateTableDef(NomTabla)

    With tdfNuevo
        .Fields.Append .CreateField("correlativo", adInteger)
        .Fields.Append .CreateField("rut_apo", dbText, 10)
        .Fields.Append .CreateField("nom_apo", dbText, 50)
        .Fields.Append .CreateField("rut_alu", dbText, 10)        ' Una cadena de 50 caracteres
        .Fields.Append .CreateField("nom_alu", dbText, 50)
        .Fields.Append .CreateField("curso", dbText, 6)
    End With
'    Next campos
'Next l
dbsTemp.TableDefs.Append tdfNuevo
dbsTemp.Close
Exit Sub
errores:
If Err.Number = 3010 Then
    dbsTemp.TableDefs.Delete NomTabla
    Resume
End If
End Sub

Private Sub llenar_tabla(bd As String, tabla As String)
    Dim i As Integer
    Dim curso As String
    Dim sw As Boolean
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim dbsTemp As Database
    Set dbsTemp = OpenDatabase(bd)
    Dim var_sql As String
    Dim est, dir As String

'    var_sql = "select d.*,concat(num_gra,' ',let_cur,' ',cod_des) as curso from" _
'            & " (select alu.*,axc.let_cur from" _
'            & " (select apo.*,cod_ens,num_gra from" _
'            & " (SELECT fcr.run_apo,concat(noms_apo,' ',ape1_apo,' ',ape2_apo) as nom_apo," _
'            & "p.ci_alu,concat(nom_alu,' ',ape_pat_alu,' ',ape_mat_alu) as nom_alu" _
'            & " FROM fnza_cheques_recibidos fcr,apo_x_alu axa,postulantes p,apoderados a" _
'            & " Where fcr.run_apo = axa.Rut_apo And axa.Ci_alu = p.Ci_alu And axa.Rut_apo = a.Rut_apo" _
'            & " and estado_chq = 'cart'" _
'            & " group by fcr.run_apo,p.ci_alu" _
'            & " order by fcr.run_apo) as apo" _
'            & " left join (select * from matriculas where activo_alu = 'SI' and anno_mat = " & Anno & ") as m" _
'            & " on apo.ci_alu = m.ci_alu) as alu left join" _
'            & " (select * from alu_x_cur where activo_alu = 'SI' and agno = " & Anno & ") axc" _
'            & " on alu.ci_alu = axc.ci_alu) as d left join codigos_ensenanza as ce" _
'            & " on d.cod_ens = ce.cod_ens"
            
    var_sql = "select t.*,cod_des from (select mat.*,let_cur from" _
            & " (select c.*,num_gra,cod_ens from" _
            & " (select che.*,tipo_pago from" _
            & " (SELECT axa.agno,fcr.run_apo,concat(noms_apo,' ',ape1_apo,' ',ape2_apo) as nom_apo," _
            & "axa.ci_alu,concat(nom_alu,' ',ape_pat_alu,' ',ape_mat_alu) as nom_alu FROM" _
            & " fnza_cheques_recibidos fcr,(select * from apo_x_alu where agno = " & Anno & ") as axa,postulantes p,apoderados a" _
            & " Where fcr.run_apo = axa.Rut_apo And axa.Ci_alu = p.Ci_alu" _
            & " And axa.Rut_apo = a.Rut_apo and estado_chq = 'prto') as che" _
            & " left join (select * from fnza_detalle_mensualidad fdm,fnza_movimientos_mensualidad fmm" _
            & " where fdm.folio_dtll = fmm.folio_dtll and fmm.tipo_pago = 'chqe') as pag" _
            & " on che.ci_alu = pag.run_alu" _
            & " group by run_apo,ci_alu) as c" _
            & " left join (select * from matriculas where anno_mat = " & Anno _
            & " and activo_alu = 'SI') as m" _
            & " on c.ci_alu = m.ci_alu) as mat" _
            & " left join (select * from alu_x_cur where agno = " & Anno _
            & " and activo_alu = 'SI') as axc" _
            & " on mat.ci_alu = axc.ci_alu) as t left join codigos_ensenanza ce" _
            & " on t.cod_ens = ce.cod_ens"
            
    'En este codigo despliego todos los apoderados que tienen cheques protestados
    'y todos los alumno que tiene matriculados en el año actual no importando si estos pagan
    'o no con cheques.
    'Para saber los alumnos que no cancelan tienen NULL en el campo tipo de pago
    
    objRS.Open var_sql, conn
    i = 0
    sw = False
    While Not objRS.EOF
        i = i + 1
        If i = 1 Then sw = True
        curso = ""
        
        If Not IsNull(objRS("num_gra")) Then curso = objRS("num_gra")
        If Not IsNull(objRS("let_cur")) Then curso = curso & " " & objRS("let_cur")
        If Not IsNull(objRS("cod_des")) Then curso = curso & " " & objRS("cod_des")
        
        If curso <> "" Then
            var_sql = "insert into reporte(correlativo,rut_apo,nom_apo,rut_alu,nom_alu,curso)" _
                    & " values(" & i & ",'" & objRS("run_apo") & "','" _
                    & objRS("nom_apo") & "','" & objRS("ci_alu") & "','" & objRS("nom_alu") & "','" _
                    & curso & "')"
            dbsTemp.Execute var_sql
        End If
        objRS.MoveNext
    Wend
    objRS.Close
    
    'Genero reporte
    If sw = True Then
        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
        cr_protestados.ReportFileName = App.Path & "\Rpt\cheques_protestados.rpt"
        Call LimpiaFormulas(cr_protestados, 30)
        cr_protestados.Formulas(1) = "nom_est = '" & est & "'"
        cr_protestados.Formulas(2) = "dir_est = '" & dir & "'"
        cr_protestados.Formulas(3) = "agno = '" & Anno & "'"
        'If opt_pantalla.Value = True Then
            cr_protestados.Destination = crptToWindow
        'Else
        '    cr_prof_x_curso.Destination = crptToPrinter
        'End If
        cr_protestados.Action = 1
    Else
        MsgBox "No hay alumnos con cheques protestados", vbInformation
    End If
End Sub



