VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.2#0"; "MSCOMCTL.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Form_Tipos_de_Pago 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Edición de Tipos de Pago"
   ClientHeight    =   7005
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11295
   Icon            =   "Form_Tipos_de_Pago.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   467
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   753
   Begin VB.ListBox List2 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   8880
      TabIndex        =   30
      Top             =   720
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.ListBox List4 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   8880
      TabIndex        =   32
      Top             =   720
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.ListBox List3 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   4080
      TabIndex        =   31
      Top             =   720
      Visible         =   0   'False
      Width           =   4335
   End
   Begin VB.ListBox List1 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1320
      Left            =   4080
      TabIndex        =   29
      Top             =   720
      Visible         =   0   'False
      Width           =   4335
   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          =   1215
      Left            =   120
      TabIndex        =   8
      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        =   17
         Top             =   480
         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        =   15
         Top             =   240
         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        =   18
         Top             =   750
         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            =   120
         TabIndex        =   16
         Top             =   480
         Width           =   975
      End
   End
   Begin VB.Frame Frame6 
      Height          =   855
      Left            =   6360
      TabIndex        =   33
      Top             =   6000
      Width           =   4815
      Begin VB.CommandButton Command1 
         Caption         =   "Generar Reporte"
         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          =   495
         Left            =   120
         TabIndex        =   36
         Top             =   240
         Width           =   1455
      End
      Begin VB.CommandButton Command2 
         Caption         =   "Limpiar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   1680
         TabIndex        =   35
         Top             =   240
         Width           =   1455
      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          =   495
         Left            =   3240
         TabIndex        =   34
         Top             =   240
         Width           =   1455
      End
   End
   Begin VB.Frame Frame7 
      Height          =   855
      Left            =   120
      TabIndex        =   37
      Top             =   6000
      Width           =   6135
      Begin MSComctlLib.ProgressBar PBar 
         Height          =   495
         Left            =   120
         TabIndex        =   38
         Top             =   240
         Width           =   5895
         _ExtentX        =   10398
         _ExtentY        =   873
         _Version        =   393216
         Appearance      =   1
         Max             =   1
         Scrolling       =   1
      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          =   1215
      Left            =   3360
      TabIndex        =   0
      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
         TabIndex        =   13
         Top             =   360
         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        =   12
         Top             =   360
         Width           =   1095
      End
      Begin MSComctlLib.ImageCombo IC_Ensenanza 
         Height          =   345
         Left            =   1320
         TabIndex        =   1
         Top             =   600
         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        =   2
         Top             =   600
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   609
         _Version        =   393216
         ForeColor       =   0
         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        =   3
         Top             =   600
         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        =   4
         Top             =   600
         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 
         Alignment       =   2  'Center
         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        =   7
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         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        =   6
         Top             =   360
         Width           =   2895
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         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        =   5
         Top             =   360
         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          =   1215
      Left            =   3360
      TabIndex        =   11
      Top             =   120
      Width           =   7815
      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
         TabIndex        =   23
         Top             =   360
         Width           =   735
      End
      Begin VB.TextBox Text2 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   5520
         TabIndex        =   20
         Text            =   "Text2"
         Top             =   360
         Width           =   1335
      End
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   720
         TabIndex        =   19
         Text            =   "Text1"
         Top             =   360
         Width           =   4335
      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            =   5160
         TabIndex        =   22
         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            =   120
         TabIndex        =   21
         Top             =   360
         Width           =   615
      End
   End
   Begin VB.Frame Frame5 
      Caption         =   "Selección 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          =   1215
      Left            =   3360
      TabIndex        =   14
      Top             =   120
      Width           =   7815
      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
         TabIndex        =   28
         Top             =   360
         Width           =   735
      End
      Begin VB.TextBox Text4 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   5520
         TabIndex        =   25
         Text            =   "Text4"
         Top             =   360
         Width           =   1335
      End
      Begin VB.TextBox Text3 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   720
         TabIndex        =   24
         Text            =   "Text3"
         Top             =   360
         Width           =   4335
      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            =   5160
         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            =   120
         TabIndex        =   26
         Top             =   360
         Width           =   615
      End
   End
   Begin VB.Frame Frame8 
      Height          =   3855
      Left            =   2280
      TabIndex        =   39
      Top             =   1800
      Visible         =   0   'False
      Width           =   5535
      Begin VB.Frame Frame_contado 
         Caption         =   "Si Forma de  Pago es Contado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   615
         Left            =   120
         TabIndex        =   68
         Top             =   2520
         Width           =   5295
         Begin VB.OptionButton opt_transferencia 
            Caption         =   "Transferencia"
            Height          =   255
            Left            =   3360
            TabIndex        =   70
            Top             =   240
            Width           =   1575
         End
         Begin VB.OptionButton opt_cheques 
            Caption         =   "Cheques"
            Height          =   255
            Left            =   1200
            TabIndex        =   69
            Top             =   240
            Width           =   975
         End
      End
      Begin VB.CommandButton Command4 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   3240
         TabIndex        =   56
         Top             =   3240
         Width           =   1575
      End
      Begin VB.CommandButton Btn_Guardar_Cambios 
         Caption         =   "Guardar Cambios"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   600
         TabIndex        =   55
         Top             =   3240
         Width           =   1575
      End
      Begin VB.TextBox Text7 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3360
         Locked          =   -1  'True
         TabIndex        =   53
         Text            =   "00 / 00 / 0000"
         Top             =   600
         Width           =   1095
      End
      Begin VB.Frame Frame10 
         Caption         =   "Forma de Pago"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   855
         Left            =   120
         TabIndex        =   48
         Top             =   1560
         Width           =   5295
         Begin VB.OptionButton Option3 
            Caption         =   "Cheque"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   3
            Left            =   2520
            TabIndex        =   54
            Top             =   240
            Width           =   975
         End
         Begin VB.OptionButton Option3 
            Caption         =   "Contado"
            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            =   3960
            TabIndex        =   51
            Top             =   240
            Width           =   975
         End
         Begin VB.OptionButton Option3 
            Caption         =   "Cuponera"
            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        =   50
            Top             =   240
            Width           =   1095
         End
         Begin VB.OptionButton Option3 
            Caption         =   "No Paga"
            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            =   120
            TabIndex        =   49
            Top             =   360
            Width           =   975
         End
         Begin VB.Label Label14 
            Caption         =   "(0% Descuento)"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   1080
            TabIndex        =   60
            Top             =   480
            Width           =   1215
         End
         Begin VB.Label Label13 
            Caption         =   "(6% Descuento)"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   3840
            TabIndex        =   59
            Top             =   480
            Width           =   1335
         End
         Begin VB.Label Label12 
            Caption         =   "(0% Descuento)"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   2400
            TabIndex        =   58
            Top             =   480
            Width           =   1335
         End
      End
      Begin VB.Frame Frame9 
         Caption         =   "Beca"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   615
         Left            =   120
         TabIndex        =   44
         Top             =   840
         Width           =   5295
         Begin VB.OptionButton Option2 
            Caption         =   "Beca 100%"
            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            =   3720
            TabIndex        =   47
            Top             =   240
            Width           =   1335
         End
         Begin VB.OptionButton Option2 
            Caption         =   "Beca 50%"
            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            =   2040
            TabIndex        =   46
            Top             =   240
            Width           =   1095
         End
         Begin VB.OptionButton Option2 
            Caption         =   "Sin Beca"
            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            =   360
            TabIndex        =   45
            Top             =   240
            Width           =   1095
         End
      End
      Begin VB.TextBox Text6 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   840
         Locked          =   -1  'True
         TabIndex        =   41
         Text            =   "00000000-0"
         Top             =   600
         Width           =   1095
      End
      Begin VB.TextBox Text5 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   720
         Locked          =   -1  'True
         TabIndex        =   40
         Text            =   "Text5"
         Top             =   240
         Width           =   4575
      End
      Begin VB.Label Lbl_Anno_Mat 
         Caption         =   "anno_mat"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2400
         TabIndex        =   57
         Top             =   3360
         Visible         =   0   'False
         Width           =   735
      End
      Begin VB.Label Label11 
         Caption         =   "Fecha Matricula:"
         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        =   52
         Top             =   600
         Width           =   1215
      End
      Begin VB.Label Label10 
         Alignment       =   1  'Right Justify
         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            =   120
         TabIndex        =   43
         Top             =   600
         Width           =   615
      End
      Begin VB.Label Label9 
         Alignment       =   1  'Right Justify
         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            =   120
         TabIndex        =   42
         Top             =   240
         Width           =   615
      End
   End
   Begin VB.Frame Frame3 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   4575
      Left            =   120
      TabIndex        =   9
      Top             =   1440
      Width           =   11055
      Begin VB.Frame frm_Descuentos 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   3255
         Left            =   2160
         TabIndex        =   62
         Top             =   960
         Visible         =   0   'False
         Width           =   5535
         Begin VB.ComboBox cbx_cuota_incorporacion 
            Height          =   315
            Left            =   120
            TabIndex        =   67
            Text            =   "Combo1"
            Top             =   240
            Width           =   5295
         End
         Begin VB.CommandButton cmd_grabar 
            Caption         =   "Grabar descuentos"
            Height          =   555
            Left            =   3960
            TabIndex        =   66
            Top             =   2520
            Width           =   1455
         End
         Begin VB.ListBox lst_descuentos_nombre 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   1740
            ItemData        =   "Form_Tipos_de_Pago.frx":2A8B2
            Left            =   120
            List            =   "Form_Tipos_de_Pago.frx":2A8B9
            Style           =   1  'Checkbox
            TabIndex        =   64
            Top             =   720
            Width           =   5295
         End
         Begin VB.ListBox lst_descuentos_conflicto 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   270
            Left            =   120
            TabIndex        =   63
            Top             =   720
            Visible         =   0   'False
            Width           =   2655
         End
         Begin VB.Label Label16 
            Caption         =   "Presionar CTRL para seleccionar multiples descuentos"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   435
            Left            =   120
            TabIndex        =   65
            Top             =   2640
            Width           =   2655
         End
      End
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid1 
         Height          =   4215
         Left            =   120
         TabIndex        =   10
         Top             =   240
         Width           =   10815
         _ExtentX        =   19076
         _ExtentY        =   7435
         _Version        =   393216
         FocusRect       =   0
         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
      Begin VB.Label Label15 
         Caption         =   "Presionar CTRL para seleccionar multiples descuentos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   435
         Left            =   6600
         TabIndex        =   61
         Top             =   3240
         Width           =   2655
      End
   End
End
Attribute VB_Name = "Form_Tipos_de_Pago"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Variables Globales del Formulario.
    Dim ErrorStatus As Boolean
    Dim Flag_sub As Boolean

Private Sub Btn_Guardar_Cambios_Click()
    ' Validar y Guardar Cambios
    Dim Ind_Beca As Integer
    Dim Ind_MBeca As Integer
    Dim Ind_Cupo As Integer
    Dim Ind_Cont As Integer
    Dim Ind_Cheq As Integer
    Dim QRY As String
    Dim CMD As ADODB.Command
    Dim Affected As Long
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim tipo_anterior As String
    Dim tipo_nuevo As String
    Dim indice_media_beca As Integer
    Dim indice_beca As Integer
    Dim accion_realizada As String
    Dim var_sql As String
    Dim log As Boolean
        
    If Not ((Option2(0).Value Or Option2(1).Value Or Option2(2).Value) And (Option3(0).Value Or Option3(1).Value Or Option3(2).Value Or Option3(3).Value)) Then
        MsgBox "Debe seleccionar una forma de pago", vbInformation, "Edición de Tipos de Pago"
        Exit Sub
    End If
    
    'Verifico que el apoderado no haya tenido ningun protesto
    If Option3(3).Value = True Then
    deuda = valida_protestos(Trim(Text6.Text))
        If deuda Then
            MsgBox "El apoderado no puede tener tipo de pago cheques, porque ha tenido cheques protestados", vbExclamation, "Edición de Tipos de Pago"
            Exit Sub
        End If
    End If
    
    Ind_MBeca = IIf(Option2(1).Value, 1, 0)
    Ind_Beca = IIf(Option2(2).Value, 1, 0)
    Ind_Cupo = IIf(Option3(1).Value, 1, 0)
    Ind_Cont = IIf(Option3(2).Value, 1, 0)
    Ind_Cheq = IIf(Option3(3).Value, 1, 0)
    
    If Option3(2).Value = True And opt_cheques.Value = False And opt_transferencia = False Then
        MsgBox "Si la Forma de pago es Contado, debe seleccionar Cheques o Transferencia"
        Exit Sub
    End If
    
    If Option3(2).Value = True Then
        Ind_cont_cheq = IIf(opt_cheques.Value, 1, 0)
        Ind_cont_tran = IIf(opt_transferencia.Value, 1, 0)
    Else
        Ind_cont_cheq = 0
        Ind_cont_tran = 0
    End If
        
    'Obtengo datos para log
    var_sql = "select ind_cup,ind_cheq,ind_cont,ind_beca,ind_mbeca from matriculas WHERE " & _
            "ci_alu='" & Trim(Text6.Text) & "' AND " & _
            "fec_mat='" & Format(Text7.Text, "yyyy-mm-dd") & "' AND " & _
            "anno_mat='" & Lbl_Anno_Mat.Caption & "' LIMIT 1;"
    objRS.Open var_sql, conn
    
    If objRS("ind_cup") = 1 Then tipo_anterior = "cuponera"
    If objRS("ind_cheq") = 1 Then tipo_anterior = "cheque"
    If objRS("ind_cont") = 1 Then tipo_anterior = "contado"
    If objRS("ind_beca") = 1 Then tipo_anterior = "100% beca"
   
    indice_media_beca = IIf(IsNull(objRS("ind_mbeca")), 0, objRS("ind_mbeca"))
    indice_beca = IIf(IsNull(objRS("ind_beca")), 0, objRS("ind_beca"))
    
    objRS.Close
    'Fin obtengo
    
    QRY = "UPDATE matriculas SET " & _
            "ind_beca=" & Ind_Beca & ", " & _
            "ind_mbeca=" & Ind_MBeca & ", " & _
            "ind_cup=" & Ind_Cupo & ", " & _
            "ind_cont=" & Ind_Cont & ", " & _
            "ind_cheq=" & Ind_Cheq & ", " & _
            "ind_cont_cheq=" & Ind_cont_cheq & ", " & _
            "ind_cont_tran=" & Ind_cont_tran & ", " & _
            "ind_pac=0 WHERE " & _
            "ci_alu='" & Trim(Text6.Text) & "' AND " & _
            "fec_mat='" & Format(Text7.Text, "yyyy-mm-dd") & "' AND " & _
            "anno_mat='" & Lbl_Anno_Mat.Caption & "' LIMIT 1;"
    Set CMD = New ADODB.Command
    CMD.ActiveConnection = conn
    CMD.CommandType = adCmdText
    CMD.CommandText = QRY
    CMD.Execute Affected
    
    If (Ind_Beca Or Ind_MBeca) Then
        QRY = "REPLACE becas(run_alu,agno,tipo_beca,monto_excencion) VALUES ('" & Trim(Text6.Text) & "','" & Lbl_Anno_Mat.Caption & "','2','" & IIf(Ind_Beca > 0, 100, 50) & "');"
    Else
        QRY = "DELETE FROM becas WHERE run_alu='" & Trim(Text6.Text) & "' and agno='" & Lbl_Anno_Mat.Caption & "';"
    End If
    CMD.CommandText = QRY
    CMD.Execute
    
    'Inserto log
        
    If Ind_MBeca <> indice_media_beca Then
        If Ind_MBeca = 1 Then
            accion_realizada = "Al alumno se le a otorgado el beneficio de media beca, para el año " & Lbl_Anno_Mat.Caption
        Else
            accion_realizada = "Al alumno se le ha quitado el beneficio de media beca, para el año " & Lbl_Anno_Mat.Caption
        End If
        log = Inserta_Vitacora_Alumno(Trim(Text6.Text), accion_realizada)
    End If
    
    If Ind_Beca <> indice_beca Then
        If Ind_Beca = 1 Then
            accion_realizada = "Al alumno se le a otorgado 100% de beca, para el año " & Lbl_Anno_Mat.Caption
        Else
            accion_realizada = "Al alumno se le ha quitado el 100% beca, para el año " & Lbl_Anno_Mat.Caption
        End If
        log = Inserta_Vitacora_Alumno(Trim(Text6.Text), accion_realizada)
    End If
    
    If Ind_Cupo = 1 Then tipo_nuevo = "cuponera"
    If Ind_Cheq = 1 Then tipo_nuevo = "cheque"
    If Ind_Cont = 1 Then tipo_nuevo = "contado"
    If Ind_Beca = 1 Then tipo_nuevo = "100% beca"
    
    If tipo_anterior <> tipo_nuevo And Option3(0).Value = False Then
        accion_realizada = "El tipo de pago anterior del alumno era " & tipo_anterior _
                         & ", el nuevo tipo de pago es " & tipo_nuevo & ", para el año " & Lbl_Anno_Mat.Caption
        log = Inserta_Vitacora_Alumno(Trim(Text6.Text), accion_realizada)
    End If
        
    'Fin de log
    
    Command4.Enabled = False
    If Affected > 0 Then
        ' Insertar Log de modificación de tipo de pago de Alumno.
        QRY = "CREATE TABLE IF NOT EXISTS `fnza_log_edicion_tpagos` (`FOLIO_REGEDIT` bigint(20) NOT NULL auto_increment,`LOGIN_USUARIO` varchar(100) NOT NULL default '',`NOMBRE_USUARIO` varchar(100) NOT NULL default '',`RUN_ALU` varchar(10) NOT NULL default '',`FEC_MAT` date NOT NULL default '0000-00-00',`ANNO_MAT` int(11) NOT NULL default '0',`IND_BECA` decimal(10,0) NOT NULL default '0',`IND_MBECA` decimal(10,0) NOT NULL default '0',`IND_CUP` decimal(10,0) NOT NULL default '0',`IND_CONT` decimal(10,0) NOT NULL default '0',`IND_CHEQ` decimal(10,0) NOT NULL default '0',`FECHA_MODIFICACION` datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY  (`FOLIO_REGEDIT`),UNIQUE KEY `fnza_log_tpagos_sec_key` (`FECHA_MODIFICACION`,`LOGIN_USUARIO`),KEY `fnza_log_tpagos_index_one` (`RUN_ALU`,`FEC_MAT`,`ANNO_MAT`)) ENGINE=MyISAM;"
        CMD.CommandText = QRY
        CMD.Execute
        QRY = "INSERT INTO FNZA_LOG_EDICION_TPAGOS(LOGIN_USUARIO,NOMBRE_USUARIO,RUN_ALU,FEC_MAT,ANNO_MAT,IND_BECA,IND_MBECA,IND_CUP,IND_CONT,IND_CHEQ,FECHA_MODIFICACION) VALUES ('" & Nom_usu_ses & "','" & Nom_com_usu_ses & "','" & Trim(Text6.Text) & "','" & Format(Text7.Text, "yyyy-mm-dd") & "','" & Lbl_Anno_Mat.Caption & "','" & Ind_Beca & "','" & Ind_MBeca & "','" & Ind_Cupo & "','" & Ind_Cont & "','" & Ind_Cheq & "',concat(current_date,' ',current_time));"
        CMD.CommandText = QRY
        CMD.Execute
        ' Fin Log de cambio modificación de tipo de pago de Alumno.
        Grid1.TextMatrix(Grid1.Row, 7) = IIf((Ind_Beca = 1), "100", IIf((Ind_MBeca = 1), "50", "0"))
        Grid1.TextMatrix(Grid1.Row, 8) = IIf((Ind_Cupo = 1), "cuponera", IIf((Ind_Cont = 1), "contado", IIf((Ind_Cheq = 1), "cheque", "ninguna")))
    End If
    ' Recalculamos las Mensualidades
    RecalculaCuota_Alu Trim(Text6.Text), val(Lbl_Anno_Mat.Caption), conn
    Command4.Enabled = True
    ' cerramos y listo
    
       
    Call Command4_Click
    
End Sub

Private Sub Btn_Ver_Alumno_Click()
    Dim InfoAlu As Variant
    Dim agno As Integer
    Dim Item As Integer
    Frame6.Enabled = False
    ' Seteo de barra de progreso
    PBar.Min = 0
    PBar.Value = 0
    PBar.Max = 1
    ' fin seteo barra progreso
    agno = IIf(Year(Date) < 2005, 2005, Year(Date))
    Item = 0
    SeteaVistaAlumno
    Frame3.Caption = Text1.Text & " " & text2.Text
    For Y = agno + 1 To 2005 Step -1
        InfoAlu = InfoPagoAlu(text2.Text, Y, conn)
        If Not (InfoAlu(2, 1) = "") Then  'Run distinto de vacio
            PBar.Max = PBar.Value + UBound(InfoAlu, 2)
            For I = 1 To UBound(InfoAlu, 2)
                Item = Item + 1
                'Grid1.AddItem Item & Chr(9) & InfoAlu(5, i) & Chr(9) & InfoAlu(10, i) & Chr(9) & InfoAlu(8, i) & Chr(9) & InfoAlu(9, i) & Chr(9) & InfoAlu(3, i) & Chr(9) & InfoAlu(4, i) & Chr(9) & InfoAlu(6, i) & Chr(9) & InfoAlu(7, i), Item
                Grid1.AddItem Item & Chr(9) & InfoAlu(1, I) & Chr(9) & InfoAlu(2, I) & Chr(9) & InfoAlu(5, I) & Chr(9) & InfoAlu(10, I) & Chr(9) & InfoAlu(8, I) & Chr(9) & InfoAlu(9, I) & Chr(9) & InfoAlu(3, I) & Chr(9) & InfoAlu(4, I) & Chr(9) & InfoAlu(6, I) & Chr(9) & InfoAlu(7, I), Item
                Grid1.Row = Item
                Grid1.Col = 7
                Grid1.CellBackColor = &HC0FFFF
                Grid1.Col = 8
                Grid1.CellBackColor = &HFFFFC0
                PBar.Value = Item
            Next I
        End If
    Next Y
   Frame6.Enabled = True
   Frame_contado.Visible = False
End Sub

Private Sub Btn_Ver_Apoderado_Click()
    Dim InfoAlu As Variant
    Dim agno As Integer
    Dim Item As Integer
    Dim rec As ADODB.Recordset
    Dim QRY As String
    
    Frame6.Enabled = False
    ' Seteo de barra de progreso
    PBar.Min = 0
    PBar.Value = 0
    PBar.Max = 1
    ' fin seteo barra progreso
    agno = IIf(Year(Date) < 2005, 2005, Year(Date))
    Item = 0
    SeteaVistaApoderado
    Frame3.Caption = "APODERADO: " & Text3.Text & " " & Text4.Text
    Set rec = New ADODB.Recordset
    For Y = agno + 1 To 2005 Step -1
        QRY = "SELECT DISTINCT axa.ci_alu, m.anno_mat, ce.ord_ens, m.num_gra FROM apo_x_alu as axa, matriculas as m, codigos_ensenanza as ce WHERE rut_apo='" & Text4.Text & "' AND anno_mat='" & Y & "' AND axa.ci_alu=m.ci_alu AND ce.cod_ens=m.cod_ens AND m.anno_mat = axa.agno ORDER BY ce.ord_ens DESC, m.num_gra DESC, axa.ci_alu;"
        rec.Open QRY, conn
        If rec.RecordCount > 0 Then
            PBar.Max = PBar.Value + rec.RecordCount
            rec.MoveFirst
            For alu = 1 To rec.RecordCount
                InfoAlu = InfoPagoAlu(rec!ci_alu, Y, conn)
                PBar.Max = PBar.Max + UBound(InfoAlu, 2) - 1
                If Not (InfoAlu(2, 1) = "") Then  'Run distinto de vacio
                    For I = 1 To UBound(InfoAlu, 2)
                        Item = Item + 1
                        Grid1.AddItem Item & Chr(9) & InfoAlu(1, I) & Chr(9) & InfoAlu(2, I) & Chr(9) & InfoAlu(5, I) & Chr(9) & InfoAlu(10, I) & Chr(9) & InfoAlu(8, I) & Chr(9) & InfoAlu(9, I) & Chr(9) & InfoAlu(3, I) & Chr(9) & InfoAlu(4, I) & Chr(9) & InfoAlu(6, I) & Chr(9) & InfoAlu(7, I), Item
                        Grid1.Row = Item
                        Grid1.Col = 7
                        Grid1.CellBackColor = &HC0FFFF
                        Grid1.Col = 8
                        Grid1.CellBackColor = &HFFFFC0
                    Next I
                End If
                rec.MoveNext
                PBar.Value = Item
            Next alu
        End If
        rec.Close
    Next Y
   Frame6.Enabled = True
   Frame_contado.Visible = False
   
End Sub

Private Sub Btn_Ver_Lista_Click()
    Dim rec As ADODB.Recordset
    Dim QRY As String
    Dim InfoAlu As Variant
    Dim Item As Integer
    
    ' Nada si hay estatus de error
    If ErrorStatus Then Exit Sub
    ' Seteo de barra de progreso
    PBar.Min = 0
    PBar.Value = 0
    PBar.Max = 1
    ' fin seteo barra progreso
    Frame6.Enabled = False
    SeteaVistaCurso
    Set rec = New ADODB.Recordset
    Item = 0
    If Check_Letra.Value = 1 Then
        QRY = "SELECT axc.ci_alu FROM alu_x_cur as axc, postulantes as p WHERE axc.agno='" & Trim(IC_Agno.SelectedItem.Text) & "' AND axc.cod_ens='" & Mid(IC_Ensenanza.SelectedItem.Key, 2) & "' AND axc.num_gra=" & Trim(IC_Nivel.SelectedItem.Text) & " AND axc.let_cur='" & Trim(IC_Letra.SelectedItem.Text) & "' AND axc.activo_alu='SI' AND axc.ci_alu=p.ci_alu ORDER BY p.ape_pat_alu, p.ape_mat_alu, p.nom_alu, axc.ci_alu;"
        Frame3.Caption = "AÑO " & IC_Agno.SelectedItem.Text & ", " & IC_Ensenanza.SelectedItem.Text & " Nivel:" & IC_Nivel.SelectedItem.Text & " LETRA: " & IC_Letra.SelectedItem.Text
    Else
        QRY = "SELECT  m.ci_alu FROM matriculas as m, postulantes as p WHERE m.anno_mat='" & Trim(IC_Agno.SelectedItem.Text) & "' AND m.cod_ens='" & Mid(IC_Ensenanza.SelectedItem.Key, 2) & "' AND m.num_gra=" & Trim(IC_Nivel.SelectedItem.Text) & " AND m.activo_alu='SI' AND m.ci_alu=p.ci_alu ORDER BY p.ape_pat_alu, p.ape_mat_alu, p.nom_alu, m.ci_alu;"
        Frame3.Caption = "AÑO " & IC_Agno.SelectedItem.Text & ", " & IC_Ensenanza.SelectedItem.Text & " Nivel:" & IC_Nivel.SelectedItem.Text
    End If
    rec.Open QRY, conn
    If rec.RecordCount > 0 Then
        PBar.Max = rec.RecordCount
        rec.MoveFirst
        For al = 1 To rec.RecordCount
            ' Sacar y mostrar info de alumnos
            InfoAlu = InfoPagoAlu(rec!ci_alu, val(IC_Agno.SelectedItem.Text), conn, True)
            If Not (InfoAlu(2, 1) = "") Then  'Run distinto de vacio
                For I = 1 To UBound(InfoAlu, 2)
                    Item = Item + 1
                    Grid1.AddItem Item & Chr(9) & InfoAlu(1, I) & Chr(9) & InfoAlu(2, I) & Chr(9) & InfoAlu(5, I) & Chr(9) & InfoAlu(10, I) & Chr(9) & InfoAlu(8, I) & Chr(9) & InfoAlu(9, I) & Chr(9) & InfoAlu(3, I) & Chr(9) & InfoAlu(4, I) & Chr(9) & InfoAlu(6, I) & Chr(9) & InfoAlu(7, I), Item
                    Grid1.Row = Item
                    Grid1.Col = 7
                    Grid1.CellBackColor = &HC0FFFF
                    Grid1.Col = 8
                    Grid1.CellBackColor = &HFFFFC0
                Next I
            End If
            rec.MoveNext
            PBar.Value = al
        Next al
    End If
    'MsgBox "Conteo: " & Item & " de " & REC.RecordCount & " listados.", vbInformation + vbOKOnly, "Debug"
    rec.Close
    Frame6.Enabled = True
    Frame_contado.Visible = False
End Sub

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

Private Sub cmd_Grabar_Click()
    'INICIO ACTUALIZACION HUECHURABA
'--------------------------------------------------------------------------------------------------
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset

    Dim mat As Boolean
    Dim log_mensaje As String
    Dim accion_detalle As String
    Dim var_sql As String
    
    MyRow = Grid1.Row
    If Grid1.TextMatrix(MyRow, 0) = "" Then Exit Sub
        
    Text5.Text = Grid1.TextMatrix(MyRow, 1)
    Text6.Text = Grid1.TextMatrix(MyRow, 2)
    Text7.Text = Grid1.TextMatrix(MyRow, 3)
    Lbl_Anno_Mat.Caption = Trim(Grid1.TextMatrix(MyRow, 4))
    Beca = val(Grid1.TextMatrix(MyRow, 7))
    FormaPag = Trim(Grid1.TextMatrix(MyRow, 8))
        
    Rut_ALu = Trim(Text6.Text)
    AnhoPos = Lbl_Anno_Mat.Caption
      
    ' Recalculamos las Mensualidades
    
    StrSql = "update fnza_detalle_mensualidad set monto_exen_desc = 0 where run_alu = '" & Rut_ALu & "' and agno = " & AnhoPos
    conn.Execute StrSql
    
    ' No corre para recalculo en UF
    'RecalculaCuota_Alu Trim(Rut_ALu), val(AnhoPos), conn
      
    ' traemos el rut del apoderado
    StrSql = "select rut_apo from apo_x_alu where ci_alu = '" & Rut_ALu & "' limit 1"
    Set Rst = conn.Execute(StrSql)
    Do While Not Rst.EOF
        rut_apo = Rst("rut_apo")
        Rst.MoveNext
    Loop
   
    ' trae el valor de la cuota de incorporacion
    StrSql = "select concat(cod_ens,num_gra) from matriculas where ci_alu='" & Rut_ALu & "' order by anno_mat desc limit 1"
    StrSql = "select * from fnza_descuento where agno=" & AnhoPos & " and curso = (" & StrSql & ")"
    Set Rst = conn.Execute(StrSql)
    Do While Not Rst.EOF
        cuota_inco = Rst("cuota_incorporacion")
        Rst.MoveNext
    Loop
       
    'strsql = "SELECT * FROM fnza_detalle_mensualidad WHERE agno = 2013 AND run_alu = '21281890-9' AND mes = 1 AND monto_abono < 0"
    
    StrSql = "delete FROM fnza_detalle_mensualidad WHERE agno = '" & AnhoPos & "' AND run_alu = '" & Rut_ALu & "' AND mes = 1 AND monto_abono <= 0"
    conn.Execute StrSql
    
    StrSql = "delete FROM fnza_mensualidad WHERE agno = " & AnhoPos & " AND run_apo = '" & rut_apo & "' AND mes = 1 AND abono_mens <= 0"
    conn.Execute StrSql
    
       
    StrSql = "SELECT mes FROM fnza_detalle_mensualidad WHERE agno = '" & AnhoPos & "' AND run_alu = '" & Rut_ALu & "' AND mes = 1"
    objRS.Open StrSql, conn
    If objRS.RecordCount > 0 Then
        mat = True
    Else
        mat = False
    End If
    objRS.Close
    
    ' Inserta la cuota de incoporacion si esta especificado en el combobox
    If cbx_cuota_incorporacion.Text <> "NO" And mat = False Then
        cuota_inco = cbx_cuota_incorporacion.Text
        
        StrSql = "insert into fnza_detalle_mensualidad (" & _
                    "FOLIO_MENS,RUN_ALU, COLEGIO, CONCEPTO," & _
                    "FECH_VENC, MONTO_TOTAL, MONTO_EXEN_HNO, MONTO_EXEN_BCA," & _
                    "MONTO_EXEN_DESC, MONTO_EXEN_CONV, MONTO_EXEN_TIPO_PAGO, MONTO_TOT_CUOTA," & _
                    "MONTO_ABONO, FECH_PAGO, ESTADO_DTLL, COD_CONVENIO," & _
                    "Mes , agno, Tercio )" & _
                 "Select" & _
                    "'0' as FOLIO_MENS,RUN_ALU, COLEGIO, 'inco' as CONCEPTO, concat(year(FECH_VENC),'01',day(FECH_VENC)) as FECH_VENC, '" & cuota_inco & "' as MONTO_TOTAL, MONTO_EXEN_HNO, MONTO_EXEN_BCA, MONTO_EXEN_DESC, MONTO_EXEN_CONV, MONTO_EXEN_TIPO_PAGO, '" & cuota_inco & "' as MONTO_TOT_CUOTA, MONTO_ABONO, FECH_PAGO, ESTADO_DTLL, COD_CONVENIO, '1' as MES, AGNO, TERCIO " & _
                    "from fnza_detalle_mensualidad where agno='" & AnhoPos & "' and run_alu = '" & Rut_ALu & "' and mes <> '3' limit 1"
        conn.Execute (StrSql)
        
        'Comprobar si existe fnza_mensualidad
        StrSql = "select count(*) as cuantos from fnza_mensualidad where run_apo = '" & rut_apo & "' and mes = 1"
        Set Rst = conn.Execute(StrSql)
        If Rst("cuantos") > 0 Then
            'strsql = "update fnza_mensualidad set " & _
            strsql = strsql & " update fnza_mensualidad set    monto_mens = monto_mens+" & cuota_inco
            StrSql = " update fnza_mensualidad set monto_mens = monto_mens+" & cuota_inco & " where run_apo = '" & rut_apo & "' and agno=" & AnhoPos & " and mes = 1"
            conn.Execute (StrSql)
        Else
            'si no existe
            StrSql = "insert into fnza_mensualidad (" & _
                "    colegio , run_apo, FECH_VENC, " & _
                "    MONTO_MENS , ABONO_MENS, FECH_PAGO, ESTADO_MENS, " & _
                "    MES,AGNO )" & _
                "select" & _
                "    COLEGIO,RUN_APO,concat('" & AnhoPos & "-01-10') as FECH_VENC," & _
                "    (select monto_total from fnza_detalle_mensualidad where run_alu  ='" & Rut_ALu & "' and concepto= 'inco') as MONTO_MENS," & _
                "    ABONO_MENS , FECH_PAGO, ESTADO_MENS, " & _
                "    '1' as MES,AGNO " & _
                " from fnza_mensualidad where agno=" & AnhoPos & " and run_apo = '" & rut_apo & "' and mes <> 3 limit 1"
            conn.Execute (StrSql)
        End If
            StrSql = "select folio_mens from fnza_mensualidad where run_apo = '" & rut_apo & "' and agno=" & AnhoPos & " and mes =1"
            StrSql = "update fnza_detalle_mensualidad set folio_mens = (" & StrSql & ") where agno =" & AnhoPos & " and run_alu='" & Rut_ALu & "' and concepto='inco'"
            conn.Execute (StrSql)
    End If ' Si cbx_cuota_incorporacion = "SI"
    
    
        ' Obtengo valor UF mensualidades
    If AnhoPos > 2021 Then
        var_sql = "SELECT arancel_base_UF FROM fnza_descuento WHERE agno = " & AnhoPos _
                & " AND curso = (SELECT CONCAT(cod_ens,num_gra) FROM matriculas WHERE anno_mat = " & AnhoPos & " AND ci_alu = '" & Rut_ALu & "')"
        objRS.Open var_sql, conn
        If objRS.RecordCount > 0 Then monto_total_uf = objRS("arancel_base_UF")
        objRS.Close
        StrSql = "update fnza_detalle_mensualidad set " & _
                            " monto_total_UF = " & Replace(monto_total_uf, ",", ".") & _
                            ",monto_tot_cuota_UF = " & Replace(monto_total_uf, ",", ".") & _
                            ", MONTO_EXEN_UF = 0 where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='esco'"
        conn.Execute (StrSql)
    End If
    
    
    'Calculo los descuentos para actualizar las tablas
    StrSql = "select * from descuentos "
    log_mensaje = ""
    For I = 0 To Me.lst_descuentos_nombre.ListCount - 1
        If Me.lst_descuentos_nombre.Selected(I) = True Then
            StrSql = "select * from descuentos where id_descuento='" & Me.lst_descuentos_nombre.ItemData(I) & "'"
            Set Rst = conn.Execute(StrSql)
            If Not Rst.EOF Then
                x100_matricula = Rst("porciento_matricula")
                x100_mensualidad = Rst("porciento_mensualidad")
                x100_incorporacion = Rst("porciento_cuota_incorporacion")
                
                If log_mensaje = "" Then
                    log_mensaje = Rst("descuento")
                Else
                    log_mensaje = log_mensaje & ", " & Rst("descuento")
                End If
                
                ' matricula
                If x100_matricula > 0 Then
'                   strsql = "update fnza_detalle_mensualidad set " & _
'                            " MONTO_EXEN_DESC = MONTO_EXEN_DESC + (MONTO_TOT_CUOTA*(" & x100_matricula & "/100))," & _
'                            " MONTO_TOT_CUOTA = MONTO_TOTAL - ( MONTO_EXEN_DESC + ((MONTO_TOT_CUOTA*" & x100_matricula & "/100)) )" & _
'                            " where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='ct00'"
                    StrSql = "update fnza_detalle_mensualidad set " & _
                            " MONTO_EXEN_DESC = MONTO_EXEN_DESC + (MONTO_TOT_CUOTA*(" & x100_matricula & "/100))," & _
                            " MONTO_TOT_CUOTA = MONTO_TOTAL - ( MONTO_EXEN_DESC )" & _
                            " where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='ct00'"
                    conn.Execute (StrSql)
                End If
                ' mensualidad
                If x100_mensualidad > 0 Then
'                    strsql = "update fnza_detalle_mensualidad set " & _
'                            " MONTO_EXEN_DESC = MONTO_EXEN_DESC + ((MONTO_TOT_CUOTA*" & x100_mensualidad & "/100))," & _
'                            " MONTO_TOT_CUOTA = MONTO_TOTAL - ( MONTO_EXEN_DESC + ((MONTO_TOT_CUOTA*" & x100_mensualidad & "/100)) )" & _
'                            " where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='esco'"
                    
                    If AnhoPos > 2021 Then
                        StrSql = "update fnza_detalle_mensualidad set " & _
                                " MONTO_EXEN_UF = MONTO_EXEN_UF + ((MONTO_TOT_CUOTA_UF*" & x100_mensualidad & "/100))," & _
                                " MONTO_TOT_CUOTA_UF = MONTO_TOTAL_UF - ( MONTO_EXEN_UF )" & _
                                " where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='esco' and estado_dtll <> 'clda' and estado_dtll <> 'cred'"
                        conn.Execute (StrSql)
                    End If

                    StrSql = "update fnza_detalle_mensualidad set " & _
                            " MONTO_EXEN_DESC = MONTO_EXEN_DESC + ((MONTO_TOT_CUOTA*" & x100_mensualidad & "/100))," & _
                            " MONTO_TOT_CUOTA = MONTO_TOTAL - ( MONTO_EXEN_DESC )" & _
                            " where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='esco' and estado_dtll <> 'clda' and estado_dtll <> 'cred'"
                    conn.Execute (StrSql)
                End If
                'incorporacion
                ' matricula
                If x100_incorporacion > 0 Then
                                            
                
'''''''''
                                
'                    strsql = "update fnza_detalle_mensualidad set " & _
'                            " MONTO_EXEN_DESC = MONTO_EXEN_DESC + (MONTO_TOT_CUOTA*(" & x100_matricula & "/100))," & _
'                            " MONTO_TOT_CUOTA = MONTO_TOTAL - ( MONTO_EXEN_DESC + ((MONTO_TOT_CUOTA*" & x100_matricula & "/100)) )" & _
'                            " where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='ct00'"
                    StrSql = "update fnza_detalle_mensualidad set " & _
                            " MONTO_EXEN_DESC = MONTO_EXEN_DESC + (MONTO_TOT_CUOTA*(" & x100_incorporacion & "/100))," & _
                            " MONTO_TOT_CUOTA = MONTO_TOTAL - ( MONTO_EXEN_DESC )" & _
                            " where run_alu = '" & Rut_ALu & "' and agno = '" & AnhoPos & "' and concepto='inco'"
                    conn.Execute (StrSql)
                End If
                
            End If
        End If
    Next I
    
    StrSql = "update "
    StrSql = StrSql & "    fnza_mensualidad as U,"
    StrSql = StrSql & "    (select D.mes,sum(D.monto_tot_cuota) as suma from fnza_mensualidad M"
    StrSql = StrSql & "    inner join fnza_detalle_mensualidad D"
    StrSql = StrSql & "    on M.folio_mens = D.folio_mens"
    StrSql = StrSql & "    where M.agno= " & AnhoPos & " and M.run_apo = '" & rut_apo & "' and estado_dtll <> 'clda' and estado_dtll <> 'cred'"
    StrSql = StrSql & "    group by D.mes) as T"
    StrSql = StrSql & " set"
    StrSql = StrSql & "    U.monto_mens = t.suma"
    StrSql = StrSql & " Where"
    StrSql = StrSql & "    U.agno = " & AnhoPos & " and"
    StrSql = StrSql & "    U.run_apo = '" & rut_apo & "' and"
    StrSql = StrSql & "    U.mes = T.mes"
    conn.Execute (StrSql)
    
    ' Log finanza
          accion_detalle = "El usuario selecciono para el año " & AnhoPos & " los siguientes descuentos: "
          accion_detalle = accion_detalle & log_mensaje
          Call Inserta_Vitacora_Finanza(CStr(Rut_ALu), CStr(rut_apo), "Descuentos", accion_detalle, 0, 0)
   ' Fin Log
    
    
    MsgBox "Los cambios en los descuentos del alumno se efectuaron satisfactoriamente", vbInformation
    
    frm_Descuentos.Visible = False
    
        '2015
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'clda' WHERE agno >= 2015 AND monto_tot_cuota = monto_abono AND estado_dtll = 'prot' and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'abon' WHERE agno >= 2015 AND monto_tot_cuota > monto_abono AND monto_abono > 0 AND estado_dtll = 'prot' and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'impg' WHERE agno >= 2015 AND monto_tot_cuota > monto_abono AND monto_abono = 0 AND estado_dtll = 'prot' and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'cred' WHERE agno >= 2015 AND monto_tot_cuota < monto_abono AND estado_dtll = 'prot' and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql
    
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'clda' WHERE agno >= 2015 AND monto_tot_cuota = monto_abono and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'abon' WHERE agno >= 2015 AND monto_tot_cuota > monto_abono AND monto_abono > 0 and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'impg' WHERE agno >= 2015 AND monto_tot_cuota > monto_abono AND monto_abono = 0 and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_detalle_mensualidad SET estado_dtll = 'cred' WHERE agno >= 2015 AND monto_tot_cuota < monto_abono and run_alu = '" & Rut_ALu & "';"
    conn.Execute var_sql

    var_sql = "UPDATE fnza_mensualidad SET estado_mens = 'clda' WHERE agno >= 2015 AND monto_mens = abono_mens and run_apo = '" & rut_apo & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_mensualidad SET estado_mens = 'abon' WHERE agno >= 2015 AND monto_mens > abono_mens AND abono_mens > 0 and run_apo = '" & rut_apo & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_mensualidad SET estado_mens = 'impg' WHERE agno >= 2015 AND monto_mens > abono_mens AND abono_mens = 0 and run_apo = '" & rut_apo & "';"
    conn.Execute var_sql
    var_sql = "UPDATE fnza_mensualidad SET estado_mens = 'cred' WHERE agno >= 2015 AND monto_mens < abono_mens and run_apo = '" & rut_apo & "';"
    conn.Execute var_sql
    
    
'FIN ACTUALIZACION HUECHURABA
'--------------------------------------------------------------------------------------------------
End Sub

Private Sub Command2_Click()
    Text1.Text = ""
    text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    List1.Visible = False
    List2.Visible = False
    List3.Visible = False
    List4.Visible = False
    If Option1(0).Value Then
        MuestraFrame ("curso")
    ElseIf Option1(1).Value Then
        MuestraFrame ("apoderado")
    ElseIf Option1(2).Value Then
        MuestraFrame ("alumno")
    End If
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub

Private Sub Command4_Click()
    Frame1.Enabled = True
    Frame2.Enabled = True
    Frame3.Enabled = True
    Frame6.Enabled = True
    Frame7.Enabled = True
    Frame8.Visible = False
End Sub

Private Sub Form_Load()
    Dim colegio As String
    
    ' Setear el combo años.
    Me.Top = 0
    Me.Left = 0
    IC_Letra.Text = ""
    IC_Letra.ComboItems.Clear
    Call Set_IC_Agno
    ' Limpiar textos
    Text1.Text = ""
    text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    'Mostrar opcion de curso al iniciar
    Option1(0).Value = True
    MuestraFrame ("curso")
    ErrorStatus = False
        
    colegio = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
     
    cbx_cuota_incorporacion.AddItem "NO"
    cbx_cuota_incorporacion.Text = "NO"
    If colegio = "HUE001" Then
          
        cbx_cuota_incorporacion.AddItem 271000
        cbx_cuota_incorporacion.AddItem 170000
        cbx_cuota_incorporacion.AddItem 250000
        cbx_cuota_incorporacion.AddItem 150000
        cbx_cuota_incorporacion.AddItem 125000
        cbx_cuota_incorporacion.AddItem 75000
    End If
    If colegio = "ALT001" Then
     
        cbx_cuota_incorporacion.AddItem 208000
        cbx_cuota_incorporacion.AddItem 150000
        cbx_cuota_incorporacion.AddItem 120000
        cbx_cuota_incorporacion.AddItem 90000
        cbx_cuota_incorporacion.AddItem 190000
        cbx_cuota_incorporacion.AddItem 130000
        cbx_cuota_incorporacion.AddItem 100000
        cbx_cuota_incorporacion.AddItem 70000
    End If
         
    If colegio = "HUE001" Or colegio = "ALT001" Then
    
    '   Cargar descuentos
    Dim Rst As ADODB.Recordset
    
    Set Rst = New ADODB.Recordset
    Query = "select * from descuentos"
    Rst.Open Query, conn
    
    Me.lst_descuentos_nombre.Clear
    Do While Not Rst.EOF
        Me.lst_descuentos_nombre.AddItem Rst("descuento")
        Me.lst_descuentos_nombre.ItemData(Me.lst_descuentos_nombre.ListCount - 1) = Rst("id_descuento")
        Me.lst_descuentos_conflicto.AddItem Rst("conflicto")
        Rst.MoveNext
    Loop
    Rst.Close
    Set Rst = Nothing
'   Fin carga descuentos
    
    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 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 Grid1_DblClick()
    Dim ddd As Integer
    Dim MyRow As Integer
    Dim Beca As Integer
    Dim FormaPag As String
    Dim colegio As String
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    
    colegio = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    
    
    If colegio <> "HUE001" And colegio <> "ALT001" Then
    
    ' solo autorizados pueden modificar tipo de pago
    If Not (CodPerfil = "#ADM#" Or CodPerfil = "#BCA#" Or CodPerfil = "#BEC#" Or CorPerfil = "#SBD#") Then Exit Sub
        
    
            
    MyRow = Grid1.Row
    If Grid1.TextMatrix(MyRow, 0) = "" Then Exit Sub
        If (Option1(0).Value) Or (Option1(1).Value) Or (Option1(2).Value) Then
         ' Dejar sólo modificar año actual o proximo
         If val(Grid1.TextMatrix(MyRow, 4)) < Year(Date) Then Exit Sub
         ' #########################################
         Text5.Text = Grid1.TextMatrix(MyRow, 1)
         Text6.Text = Grid1.TextMatrix(MyRow, 2)
         Text7.Text = Grid1.TextMatrix(MyRow, 3)
         Lbl_Anno_Mat.Caption = Trim(Grid1.TextMatrix(MyRow, 4))
         Beca = val(Grid1.TextMatrix(MyRow, 7))
         FormaPag = Trim(Grid1.TextMatrix(MyRow, 8))
         If Beca = 0 Then
            Option2(0).Value = True
            Frame9.Enabled = True
         ElseIf Beca = 50 Then
            Option2(1).Value = True
            'solo autorizados
            Frame9.Enabled = False
         ElseIf Beca = 100 Then
            Option2(2).Value = True
            'solo autorizados
            Frame9.Enabled = False
         Else
            Option2(0).Value = False
            Option2(1).Value = False
            Option2(2).Value = False
            Frame9.Enabled = True
         End If
         'Solo autorizados pueden modificar becas asignadas
         If (CodPerfil = "#ADM#" Or CodPerfil = "#BEC#" Or CorPerfil = "#SBD#") Then
            Frame9.Enabled = True
         End If
         
         If FormaPag = "ninguna" Then
            Option3(0).Value = True
         ElseIf FormaPag = "cuponera" Then
            Option3(1).Value = True
         ElseIf FormaPag = "contado" Then
            Option3(2).Value = True
         ElseIf FormaPag = "cheque" Then
            Option3(3).Value = True
         Else
            Option3(0).Value = False
            Option3(1).Value = False
            Option3(2).Value = False
            Option3(3).Value = False
         End If
    End If
    Frame1.Enabled = False
    Frame2.Enabled = False
    Frame3.Enabled = False
    Frame6.Enabled = False
    Frame7.Enabled = False
    Frame8.Visible = True
    Else
        MyRow = Grid1.Row
        Text6.Text = Grid1.TextMatrix(MyRow, 2)
        Rut_ALu = Trim(Text6.Text)

        ' traemos el rut del apoderado
        StrSql = "select rut_apo from apo_x_alu where ci_alu = '" & Rut_ALu & "' limit 1"
        Set Rst = conn.Execute(StrSql)
        Do While Not Rst.EOF
            rut_apo = Rst("rut_apo")
            Rst.MoveNext
        Loop
    
        'Rescata si el apoderado tiene convenio Caja
        caja = False
        StrSql = "SELECT * FROM apoderados WHERE rut_apo = '" & rut_apo & "' AND (cod_conv = '1' or cod_conv = ' 1')"
        objRS.Open StrSql, conn
        If objRS.RecordCount > 0 Then
            caja = True
        End If
        objRS.Close
        
        If caja = True Then
            StrSql = "SELECT id_descuento FROM descuentos WHERE descuento = 'Caja de compensación Los Andes'"
            objRS.Open StrSql, conn
            If objRS.RecordCount > 0 Then
                ddd = objRS("id_descuento")
                lst_descuentos_nombre.Selected(ddd - 1) = True
            End If
            objRS.Close
        End If
    
        frm_Descuentos.Enabled = True
        frm_Descuentos.Visible = True
    End If
End Sub

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

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

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

Private Sub 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 List1_DblClick()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    Text1.Text = List1.Text
    List1.Visible = False
    List2.Visible = False
    RC.Open "SELECT ci_alu FROM postulantes WHERE left(CONCAT(ape_Pat_alu,' ',ape_Mat_alu,' ',nom_alu)," & Len(Text1.Text) & ")='" & Text1.Text & "' ORDER BY ape_pat_alu, ape_mat_alu, nom_alu;", conn
    RC.MoveFirst
    Flag_sub = True
    text2.Text = RC("ci_alu")
    RC.Close
    Flag_sub = False
    Btn_Ver_Alumno.Enabled = True
End Sub

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

Private Sub List3_DblClick()
    Dim RC As ADODB.Recordset
    Text3.Text = List3.Text
    List3.Visible = False
    List4.Visible = False
    Set RC = New ADODB.Recordset
    RC.Open "SELECT rut_apo FROM `apoderados` where left(CONCAT(ape1_apo,' ',ape2_apo,' ',noms_apo)," & Len(Text3.Text) & ")='" & Text3.Text & "' ORDER BY ape1_apo, ape2_apo, noms_apo;", conn
    RC.MoveFirst
    Flag_sub = True
    Text4.Text = RC("rut_apo")
    Flag_sub = False
    Btn_Ver_Apoderado.Enabled = True
    RC.Close
    
End Sub

Private Sub List4_DblClick()
    Dim RC As ADODB.Recordset
    Text4.Text = List4.Text
    List4.Visible = False
    List3.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='" & Text4.Text & "' ORDER BY rut_apo;", conn
    RC.MoveFirst
    Flag_sub = True
    Text3.Text = RC("nombre_apo")
    Flag_sub = False
    Btn_Ver_Apoderado.Enabled = True
    RC.Close
End Sub

Private Sub Option1_Click(Index As Integer)
    Text1.Text = ""
    text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    List1.Visible = False
    List2.Visible = False
    List3.Visible = False
    List4.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 Option2_Click(Index As Integer)
    If Index = 2 Then
        Option3(0).Enabled = True
        Option3(0).Value = True
        Frame10.Enabled = False
    Else
        Option3(0) = False
        Option3(0).Enabled = False
        Frame10.Enabled = True
    End If
End Sub

Private Sub Option3_Click(Index As Integer)
    If Option3(2).Value = True Then
        Frame_contado.Visible = True
    Else
        Frame_contado.Visible = False
    End If
End Sub


Private Sub Text1_Change()
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If Text1.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
    
    RC.Open "SELECT DISTINCT a.ape_pat_alu, a.ape_mat_alu, a.nom_alu FROM postulantes a, matriculas m WHERE left(CONCAT(a.ape_pat_alu,' ',a.ape_mat_alu,' ',a.nom_alu)," & Len(Text1.Text) & ")='" & Text1.Text & "' AND a.ci_alu=m.ci_alu ORDER BY a.ape_pat_alu, a.ape_mat_alu, a.nom_alu;", conn
    List1.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            List1.AddItem RC("ape_pat_alu") & " " & RC("ape_mat_alu") & " " & RC("nom_alu")
            RC.MoveNext
        Wend
        List1.Visible = True
        List2.Visible = False
    End If
    RC.Close
    Btn_Ver_Alumno.Enabled = False
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub Text2_Change()
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If text2.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
    
    RC.Open "SELECT DISTINCT a.ci_alu FROM postulantes a, matriculas m WHERE left(a.ci_alu," & Len(text2.Text) & ")='" & text2.Text & "' AND a.ci_alu=m.ci_alu ORDER BY a.ci_alu;", conn
    List2.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            List2.AddItem RC("ci_alu")
            RC.MoveNext
        Wend
        List1.Visible = False
        List2.Visible = True
    End If
    RC.Close
    Btn_Ver_Alumno.Enabled = False
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub Text3_Change()
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If Text3.Text = "" Then Exit Sub
    Set RC = New ADODB.Recordset
        
    RC.Open "SELECT DISTINCT a.ape1_apo, a.ape2_apo, a.noms_apo FROM apoderados a, fnza_mensualidad fm where left(CONCAT(a.ape1_apo,' ',a.ape2_apo,' ',a.noms_apo)," & Len(Text3.Text) & ")='" & Text3.Text & "' and a.rut_apo=fm.run_apo ORDER BY a.ape1_apo, a.ape2_apo, a.noms_apo;", conn
    List3.Clear
    While Not (RC.EOF)
        List3.AddItem RC("ape1_apo") & " " & RC("ape2_apo") & " " & RC("noms_apo")
        RC.MoveNext
    Wend
    RC.Close
    Btn_Ver_Apoderado.Enabled = False
    List3.Visible = True
    List4.Visible = False
    
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub Text4_Change()
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If Text4.Text = "" Then Exit Sub
    Dim Str_Query As String
    Dim RC As ADODB.Recordset
    
    Set RC = New ADODB.Recordset
    Str_Query = "SELECT DISTINCT fm.run_apo FROM apoderados a, fnza_mensualidad fm WHERE left(a.rut_apo," & Len(Text4.Text) & ")='" & Text4.Text & "' AND a.rut_apo=fm.run_apo ORDER BY a.rut_apo;"
    RC.Open Str_Query, conn
    List4.Clear
    While Not (RC.EOF)
        List4.AddItem RC("run_apo")
        RC.MoveNext
    Wend
    RC.Close
    Btn_Ver_Apoderado.Enabled = False
    List4.Visible = True
    List3.Visible = False
    
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Function InfoPagoAlu(ByVal RunAlu As String, ByVal agno As Integer, CNX As ADODB.Connection, Optional ByVal SoloActivo As Boolean = False) As Variant
    Dim Resp() As Variant
    Dim QRY As String
    Dim rec As ADODB.Recordset
    
    ReDim Resp(1 To 10, 1 To 1)
    Resp(1, 1) = "" 'Nombre
    Resp(2, 1) = "" 'Run Alumno
    Resp(3, 1) = 0 'Porcentaje de Beca
    Resp(4, 1) = "" 'Forma de Pago
    Resp(5, 1) = "" 'Fecha de Matricula
    Resp(6, 1) = "" 'Nombre Apoderado
    Resp(7, 1) = "" 'Run Apoderado
    Resp(8, 1) = "" 'Enseñanza
    Resp(9, 1) = "" 'grado
    Resp(10, 1) = 0 'Año de Matricula
    
    If SoloActivo Then
        QRY = "SELECT concat(p.ape_pat_alu,' ', p.ape_mat_alu,' ',p.nom_alu) as nombre_alu, axa.ci_alu, if(m.ind_beca=1,100,if(m.ind_mbeca=1,50,0)) as beca_porc, if(m.ind_cup=1,'cuponera',if(m.ind_cont=1,'contado',if(m.ind_cheq=1,'cheque','ninguna'))) as forma_pago_alu, m.fec_mat, concat(a.ape1_apo,' ',a.ape2_apo,' ',a.noms_apo) as nombre_apo, axa.rut_apo, m.cod_ens, m.num_gra, m.anno_mat " & _
                  "FROM matriculas as m, postulantes as p, apoderados as a, apo_x_alu as axa WHERE axa.ci_alu='" & RunAlu & "' AND m.anno_mat='" & agno & "' AND m.activo_alu='SI' AND axa.ci_alu=p.ci_alu AND axa.rut_apo=a.rut_apo AND axa.ci_alu=m.ci_alu and m.anno_mat = axa.agno ORDER BY m.fec_mat;"
    Else
        QRY = "SELECT concat(p.ape_pat_alu,' ', p.ape_mat_alu,' ',p.nom_alu) as nombre_alu, axa.ci_alu, if(m.ind_beca=1,100,if(m.ind_mbeca=1,50,0)) as beca_porc, if(m.ind_cup=1,'cuponera',if(m.ind_cont=1,'contado',if(m.ind_cheq=1,'cheque','ninguna'))) as forma_pago_alu, m.fec_mat, concat(a.ape1_apo,' ',a.ape2_apo,' ',a.noms_apo) as nombre_apo, axa.rut_apo, m.cod_ens, m.num_gra, m.anno_mat " & _
                  "FROM matriculas as m, postulantes as p, apoderados as a, apo_x_alu as axa WHERE axa.ci_alu='" & RunAlu & "' AND m.anno_mat='" & agno & "' AND axa.ci_alu=p.ci_alu AND axa.rut_apo=a.rut_apo AND axa.ci_alu=m.ci_alu and m.anno_mat = axa.agno ORDER BY m.fec_mat;"
    End If
    
    Set rec = New ADODB.Recordset
    rec.Open QRY, CNX
    If rec.RecordCount > 0 Then
        rec.MoveFirst
        ReDim Preserve Resp(1 To 10, 1 To rec.RecordCount)
        For I = 1 To rec.RecordCount
            Resp(1, I) = rec!nombre_alu
            Resp(2, I) = rec!ci_alu
            Resp(3, I) = rec!beca_porc
            Resp(4, I) = rec!forma_pago_alu
            Resp(5, I) = rec!fec_mat
            Resp(6, I) = rec!nombre_apo
            Resp(7, I) = rec!rut_apo
            Resp(8, I) = rec!Cod_Ens
            Resp(9, I) = rec!Num_Gra
            Resp(10, I) = val(rec!anno_mat)
            rec.MoveNext
        Next I
    End If
    rec.Close
    InfoPagoAlu = Resp
End Function

Private Sub SeteaVistaAlumno()
    ' Vaciar la vista de Alumno.
    Frame3.Caption = ""
    Grid1.Clear
    Grid1.Rows = 2
    Grid1.FixedCols = 1
    Grid1.FormatString = "^Nº|>Nombre Alumno|>Rut Alumno|^Fecha Matricula|^Año Mat.|>Enseñanza|^Nivel|>Beca(%)|>Forma de Pago|<Nombre Apoderado|<Rut Apoderado"
    Grid1.ColWidth(1) = 0
    Grid1.ColWidth(2) = 0
    Grid1.ColWidth(9) = 3900
    
End Sub

Private Sub SeteaVistaApoderado()
    ' Vaciar la vista de Alumno.
    Frame3.Caption = ""
    Grid1.Clear
    Grid1.Rows = 2
    Grid1.FixedCols = 1
    Grid1.FormatString = "^Nº|<Nombre Alumno|^Rut Alumno|^Fecha Matricula|^Año Mat.|>Enseñanza|^Nivel|>Beca(%)|<Forma de Pago|>Nombre Apoderado|>Rut Apoderado"
    Grid1.ColWidth(1) = 4000
    Grid1.ColWidth(2) = 1000
    Grid1.ColWidth(9) = 0
    Grid1.ColWidth(10) = 0
End Sub

Private Sub SeteaVistaCurso()
    'Vaciar la vista de Curso
    Frame3.Caption = ""
    Grid1.Clear
    Grid1.Rows = 2
    Grid1.FormatString = "^Nº|<Nombre Alumno|^Rut Alumno|^Fecha Matricula|>Año Mat.|>Enseñanza|>Nivel|>Beca(%)|>Forma de Pago|<Nombre Apoderado|<Rut Apoderado"
    Grid1.FixedCols = 3
    Grid1.ColWidth(0) = 350
    Grid1.ColWidth(1) = 3000
    Grid1.ColWidth(2) = 1000
    Grid1.ColWidth(4) = 0
    Grid1.ColWidth(5) = 0
    Grid1.ColWidth(6) = 0
    Grid1.ColWidth(9) = 3000
End Sub
