VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form_proc_Cursos 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Matriculas de Alumnos"
   ClientHeight    =   7185
   ClientLeft      =   1605
   ClientTop       =   1785
   ClientWidth     =   9330
   Icon            =   "Form_proc_curso.frx":0000
   LinkTopic       =   "Form3"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   7185
   ScaleWidth      =   9330
   Begin VB.Frame Frame_Mat 
      Caption         =   "Matricular Alumno Nuevo"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3675
      Left            =   120
      TabIndex        =   18
      Top             =   120
      Width           =   7095
      Begin VB.ComboBox cmb_contado_con 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   4800
         TabIndex        =   56
         Top             =   1920
         Width           =   2055
      End
      Begin VB.CommandButton btnRechazar 
         Caption         =   "&Renunciar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   5520
         Picture         =   "Form_proc_curso.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   55
         Top             =   2640
         Width           =   1215
      End
      Begin VB.ListBox Lst_nom_alu_mat 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1110
         Left            =   1560
         TabIndex        =   1
         Top             =   600
         Visible         =   0   'False
         Width           =   5295
      End
      Begin VB.ComboBox cmb_AnhoPos 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   5880
         TabIndex        =   54
         Text            =   "2006"
         Top             =   720
         Width           =   975
      End
      Begin VB.TextBox txt_mod 
         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          =   285
         Left            =   2400
         MaxLength       =   21
         TabIndex        =   35
         Top             =   1080
         Width           =   2295
      End
      Begin VB.TextBox txt_mod_nivel 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1560
         MaxLength       =   21
         TabIndex        =   34
         Top             =   1080
         Width           =   735
      End
      Begin VB.TextBox txt_fec_pos 
         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          =   285
         Left            =   3795
         MaxLength       =   10
         TabIndex        =   32
         Top             =   720
         Width           =   975
      End
      Begin VB.ComboBox cmb_tipo_pago 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         ItemData        =   "Form_proc_curso.frx":2AF2F
         Left            =   1560
         List            =   "Form_proc_curso.frx":2AF31
         TabIndex        =   29
         Top             =   1920
         Width           =   1815
      End
      Begin VB.ComboBox Cmb_Jor_mat 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         ItemData        =   "Form_proc_curso.frx":2AF33
         Left            =   4800
         List            =   "Form_proc_curso.frx":2AF35
         TabIndex        =   5
         Top             =   1440
         Width           =   2055
      End
      Begin VB.TextBox Txt_jor_alu 
         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          =   285
         Left            =   4800
         MaxLength       =   21
         TabIndex        =   4
         Top             =   1080
         Width           =   2055
      End
      Begin MSComCtl2.DTPicker DTP_fec_mat 
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   3000
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   661
         _Version        =   393216
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         CustomFormat    =   "dd/MM/yyyy"
         Format          =   17104899
         CurrentDate     =   37666
      End
      Begin VB.TextBox Txt_num_Mat 
         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          =   285
         Left            =   1560
         MaxLength       =   5
         TabIndex        =   6
         Top             =   1440
         Width           =   1815
      End
      Begin VB.TextBox Txt_rut_alu_mat 
         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          =   285
         Left            =   1560
         MaxLength       =   8
         TabIndex        =   2
         Top             =   720
         Width           =   975
      End
      Begin VB.CommandButton Btn_Can_Mat 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   4200
         Picture         =   "Form_proc_curso.frx":2AF37
         Style           =   1  'Graphical
         TabIndex        =   17
         Top             =   2640
         Width           =   1215
      End
      Begin VB.CommandButton Btn_Ace_Mat 
         Caption         =   "Matricular"
         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          =   855
         Left            =   2880
         Picture         =   "Form_proc_curso.frx":2B29F
         Style           =   1  'Graphical
         TabIndex        =   16
         Top             =   2640
         Width           =   1215
      End
      Begin VB.TextBox Txt_Dig_alu_mat 
         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          =   285
         Left            =   2640
         MaxLength       =   1
         TabIndex        =   19
         Top             =   720
         Width           =   255
      End
      Begin VB.TextBox Txt_nom_alu_mat 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1560
         MaxLength       =   95
         TabIndex        =   0
         Top             =   360
         Width           =   5295
      End
      Begin VB.Label lbl_contado_con 
         Caption         =   "Contado con"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3600
         TabIndex        =   57
         Top             =   1920
         Width           =   975
      End
      Begin VB.Label Label19 
         Caption         =   "Para el año"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   4920
         TabIndex        =   33
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label18 
         Caption         =   "Postuló el"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3000
         TabIndex        =   31
         Top             =   720
         Width           =   855
      End
      Begin VB.Line Line1 
         BorderColor     =   &H8000000C&
         X1              =   240
         X2              =   6810
         Y1              =   2400
         Y2              =   2400
      End
      Begin VB.Label Label17 
         Caption         =   "Tipo de pago"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   30
         Top             =   1920
         Width           =   975
      End
      Begin VB.Label Label11 
         Caption         =   "Matricular en"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3600
         TabIndex        =   28
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label Label9 
         Caption         =   "Postula a"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   27
         Top             =   1080
         Width           =   1695
      End
      Begin VB.Label Label10 
         Caption         =   "Nro. de matrícula"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   23
         Top             =   1440
         Width           =   1335
      End
      Begin VB.Label Label15 
         Caption         =   "Rut"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   22
         Top             =   720
         Width           =   1215
      End
      Begin VB.Label Label13 
         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            =   240
         TabIndex        =   21
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label12 
         Caption         =   "Fecha de matrícula"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   20
         Top             =   2640
         Width           =   1935
      End
   End
   Begin VB.Frame Frame_Mat_OK 
      Caption         =   "No es posible continuar con la matricula"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3975
      Left            =   120
      TabIndex        =   24
      Top             =   120
      Visible         =   0   'False
      Width           =   6855
      Begin VB.Frame Frame_Mat_Ok_Conducta 
         Caption         =   "Problemas de conducta"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   2055
         Left            =   120
         TabIndex        =   26
         Top             =   1080
         Visible         =   0   'False
         Width           =   6615
         Begin VB.TextBox Txt_obs 
            Height          =   1695
            Left            =   120
            TabIndex        =   10
            Top             =   240
            Width           =   6375
         End
      End
      Begin VB.CommandButton Cmb_Docs_REc 
         Caption         =   "Recibir Documentos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   435
         Left            =   2400
         TabIndex        =   15
         Top             =   3360
         Visible         =   0   'False
         Width           =   2115
      End
      Begin VB.Frame Frame_Mat_Ok_Doc 
         Caption         =   "Faltan  documentos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   2055
         Left            =   1800
         TabIndex        =   25
         Top             =   1080
         Visible         =   0   'False
         Width           =   3375
         Begin VB.CheckBox Chk_Doc_4 
            Caption         =   "Fotos"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   14
            Top             =   1560
            Value           =   1  'Checked
            Width           =   855
         End
         Begin VB.CheckBox Chk_Doc_3 
            Caption         =   "Cert. de estudi - Ultimo año cursado"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   13
            Top             =   1200
            Value           =   1  'Checked
            Width           =   2895
         End
         Begin VB.CheckBox Chk_Doc_2 
            Caption         =   "Informe de notas parciales"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   12
            Top             =   840
            Value           =   1  'Checked
            Width           =   2295
         End
         Begin VB.CheckBox Chk_Doc_1 
            Caption         =   "Cert.de nacimiento"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   11
            Top             =   480
            Value           =   1  'Checked
            Width           =   1695
         End
      End
      Begin VB.CommandButton Btn_show_Morosidad 
         Caption         =   "Morosidad"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   4680
         TabIndex        =   9
         Top             =   360
         Width           =   1935
      End
      Begin VB.CommandButton Btn_show_Conducta 
         Caption         =   "Conducta"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2400
         TabIndex        =   8
         Top             =   360
         Width           =   2055
      End
      Begin VB.CommandButton Btn_show_Doc 
         Caption         =   "Faltan documentos"
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   7
         Top             =   360
         Width           =   1935
      End
   End
   Begin VB.Frame fra_des_alu 
      Caption         =   "Desmatricular Alumnos sin 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          =   6615
      Left            =   120
      TabIndex        =   36
      Top             =   120
      Width           =   9015
      Begin VB.Frame frm_inf_con 
         Caption         =   "Información Consultada"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   4695
         Left            =   120
         TabIndex        =   37
         Top             =   1800
         Width           =   8775
         Begin VB.TextBox Txt_jor 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   3600
            TabIndex        =   42
            Text            =   "Text1"
            Top             =   4200
            Visible         =   0   'False
            Width           =   1575
         End
         Begin VB.TextBox Txt_Alu 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   1800
            TabIndex        =   41
            Top             =   4200
            Width           =   495
         End
         Begin VB.CommandButton com_des 
            Caption         =   "Desmatricular"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   5880
            TabIndex        =   40
            Top             =   4200
            Width           =   1335
         End
         Begin VB.CommandButton btn_car 
            Caption         =   "Cargar Alumnos"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   3720
            TabIndex        =   39
            Top             =   1920
            Visible         =   0   'False
            Width           =   1455
         End
         Begin VB.CommandButton com_salir 
            Caption         =   "Salir"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   7320
            TabIndex        =   38
            Top             =   4200
            Width           =   1335
         End
         Begin MSFlexGridLib.MSFlexGrid grd_alu 
            Height          =   3855
            Left            =   120
            TabIndex        =   53
            Top             =   240
            Width           =   8535
            _ExtentX        =   15055
            _ExtentY        =   6800
            _Version        =   393216
            Cols            =   5
            FixedCols       =   0
            FormatString    =   "Apellido paterno     | Apellido materno     | Nombres                                 | R.U.N         | Fecha Matrícula"
            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
         End
         Begin VB.Label lbl_alu 
            Caption         =   "Total Alumnos"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   43
            Top             =   4200
            Width           =   1215
         End
      End
      Begin VB.Frame frm_dat_alu 
         Caption         =   "Datos a Buscar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   1335
         Left            =   120
         TabIndex        =   44
         Top             =   360
         Width           =   8775
         Begin VB.ComboBox cmb_jor_alu 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Left            =   5280
            Style           =   2  'Dropdown List
            TabIndex        =   48
            Top             =   840
            Width           =   2055
         End
         Begin VB.ComboBox cmb_niv 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Left            =   5280
            Style           =   2  'Dropdown List
            TabIndex        =   47
            Top             =   480
            Width           =   855
         End
         Begin VB.ComboBox cmb_mod 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Left            =   1320
            Style           =   2  'Dropdown List
            TabIndex        =   46
            Top             =   480
            Width           =   2535
         End
         Begin VB.ComboBox cmb_ano 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            Left            =   1320
            Style           =   2  'Dropdown List
            TabIndex        =   45
            Top             =   840
            Width           =   1455
         End
         Begin VB.Label Label21 
            Caption         =   "Jornada"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   4200
            TabIndex        =   52
            Top             =   840
            Width           =   975
         End
         Begin VB.Label lbl_niv 
            Caption         =   "Nivel"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   4200
            TabIndex        =   51
            Top             =   480
            Width           =   975
         End
         Begin VB.Label lbl_mod 
            Caption         =   "Modalidad"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   50
            Top             =   480
            Width           =   975
         End
         Begin VB.Label lbl_ano 
            Caption         =   "Año"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   240
            TabIndex        =   49
            Top             =   840
            Width           =   975
         End
      End
   End
End
Attribute VB_Name = "Form_proc_Cursos"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim jornada, Cod_Ens, Num_Gra As String

Private Sub Btn_Ace_Mat_Click()
Dim objRS As ADODB.Recordset
Set objRS = New ADODB.Recordset
Dim rec As ADODB.Recordset
Set rec = New ADODB.Recordset
Dim var_sql As String
Dim apoderado As String
Dim conecta As Boolean

Dim cole As String
Dim colegio As String
Dim mat_con_deuda As Integer

On Error GoTo SaltoError:
Dim apo As String
'Dim cole As String
Dim repactacion As String
Dim log As Boolean
Dim R As Integer
Dim grado, curso, accion_realizada As String
Dim AnhoPos As String
Dim pagos As String
Dim Num_MAT As Long
If Cmb_Jor_mat = "" Then MsgBox "Debe seleccionar una jornada", vbExclamation + vbOKOnly, Ges - Col, , "": Cmb_Jor_mat.SetFocus:   Exit Sub
If Me.cmb_tipo_pago = "" Then MsgBox "Debe seleccionar un tipo de pago":  Me.cmb_tipo_pago.SetFocus: Exit Sub
If Cmb_Jor_mat <> "" Then Joralu = DevuelveCampo("jornadas", "", "cod_jor", "des_jor = '" & Me.Cmb_Jor_mat & "'", conn)
repactacion = ""

If cmb_tipo_pago.Text = "Contado" And cmb_contado_con.Text = "" Then MsgBox "Si la forma de pago es Contado, debe seleccionar Cheques o Transferencia", vbInformation:    Exit Sub

'Dim rut, descripcion As String
AnhoPos = Me.cmb_AnhoPos.Text

If val(AnhoPos) < Year(Date) Then
    Err.Raise vbObjectError + 800, "From_proc_Cursos.Btn_Ace_Mat_Click", "Imposible matricular a un alumno en el año " & AnhoPos & "."
    Exit Sub
End If

var_sql = "SELECT RIGHT(rut_apo,9) AS rut_cero,rut_apo,COUNT(RIGHT(rut_apo,9))" _
        & " From apoderados" _
        & " GROUP BY RIGHT(rut_apo,9)" _
        & " HAVING COUNT(rut_apo) > 1"
objRS.Open var_sql, conn
While Not objRS.EOF
    var_sql = "delete FROM apoderados WHERE rut_apo = '" & objRS("rut_apo") & "'"
    conn.Execute var_sql
    objRS.MoveNext
Wend
objRS.Close

var_sql = "SELECT * From apo_x_alu where LENGTH(rut_apo) = 9"
objRS.Open var_sql, conn
While Not objRS.EOF
    rut_borrar = "0" & objRS("rut_apo")
    var_sql = "delete FROM apo_x_alu WHERE rut_apo = '" & rut_borrar & "' and agno = " & objRS("agno") & " and ci_alu = '" & objRS("ci_alu") & "' and parent_apo = '" & objRS("parent_apo") & "'"
    conn.Execute var_sql
    objRS.MoveNext
Wend
objRS.Close



var_sql = "update apo_x_alu set rut_apo = concat('0',rut_apo) where length(rut_apo) = 9 and mid(rut_apo,9,1) <> '-'"
conn.Execute var_sql
var_sql = "update apoderados set rut_apo = concat('0',rut_apo) where length(rut_apo) = 9 and mid(rut_apo,9,1) <> '-'"
conn.Execute var_sql
var_sql = "update fnza_mensualidad set run_apo = concat('0',run_apo) where length(run_apo) = 9 and mid(run_apo,9,1) <> '-'"
conn.Execute var_sql
var_sql = "update fnza_cuponeras set rut_apo = concat('0',rut_apo) where length(rut_apo) = 9 and mid(rut_apo,9,1) <> '-'"
conn.Execute var_sql
var_sql = "update fnza_cheques_recibidos set run_apo = concat('0',run_apo) where length(run_apo) = 9 and mid(run_apo,9,1) <> '-'"
conn.Execute var_sql
var_sql = "update fnza_boletas set run_apo = concat('0',run_apo) where length(run_apo) = 9 and mid(run_apo,9,1) <> '-'"
conn.Execute var_sql

Select Case Me.cmb_tipo_pago.ListIndex
    Case 0: pagos = ", '1', '0', '0', '0'"
    Case 1: pagos = ", '0', '1', '0', '0'"
    Case 2: pagos = ", '0', '0', '1', '0'"
    Case 3: pagos = ", '0', '0', '0', '1'"
End Select
Rut_ALu = Me.Txt_rut_alu_mat & "-" & Me.Txt_Dig_alu_mat

If Not ExistReg("MATRICULAS", "CI_ALU ='" & Rut_ALu & "' AND ACTIVO_ALU ='SI' AND ANNO_MAT='" & cmb_AnhoPos & "'", conn) Then 'Anno cmb_AnhoPos
    If Not (CompruebaValoresParaMatricula(Cod_Ens, Num_Gra, val(AnhoPos), conn)) Then
        MsgBox "EL ALUMNO RUT " & Rut_ALu & " NO PUEDE SER MATRICULADO PUES NO ESTA DEFINIDO EL ARANCEL DEL AÑO " & AnhoPos & ".", vbCritical + vbOKOnly, "Definir Aranceles para el Año " & AnhoPos & ""
        Exit Sub
    End If
    
    conn.Execute "REPLACE INTO apo_x_alu(ci_alu,rut_apo,parent_apo,agno) SELECT ci_alu,rut_apo,parent_apo," & Trim(cmb_AnhoPos.Text) & " as agno FROM apo_x_ins where ci_alu='" & Rut_ALu & "';"
        
        
'    'Verifica cheques y PAT
'    conecta = ConectarBDSiempre(connLN, "192.168.7.91", "comunes_gescol", "groot", "kripplefight", True)
'
'    var_sql = "SELECT rut_apo FROM apo_x_ins WHERE ci_alu = '" & Rut_ALu & "'"
'    objRS.Open var_sql, conn
'    b_rut_apo = objRS("rut_apo")
'    objRS.Close
'
'    var_sql = "SELECT motivo FROM `fnza_lista_negra_apoderados` where ci_apo = '" & b_rut_apo & "' and autorizado = 0"
'    objRS.Open var_sql, connLN
'    If objRS.RecordCount > 0 Then
'        MsgBox "El apoderado apoderado no puede ser matriculado por " & objRS("motivo"), vbInformation _
'        & ", si lo desea matricular de todas formas debe comunicarse con ", vbInformation
'        Exit Sub
'    End If
'    objRS.Close
'
'    var_sql = "SELECT motivo FROM `fnza_lista_negra_alumnos` where ci_alu = '" & Rut_ALu & "' and autorizado = 0"
'    objRS.Open var_sql, connLN
'    If objRS.RecordCount > 0 Then
'        MsgBox "El apoderado alumno no puede ser matriculado por " & objRS("motivo") _
'                & ", si lo desea matricular de todas formas debe comunicarse con ", vbInformation
'        Exit Sub
'    End If
'    objRS.Close
'    connLN.Close
    
        
    'Verifica cheques y PAT
    conecta = ConectarBDSiempre(connLN, "192.168.7.91", "comunes_gescol", "groot", "kripplefight", True)
    
    var_sql = "SELECT rut_apo FROM apo_x_ins WHERE ci_alu = '" & Rut_ALu & "'"
    rec.Open var_sql, conn
    b_rut_apo = rec("rut_apo")
    rec.Close
    
    ' Validación de correo e email
    var_sql = "SELECT cel_apo,email FROM apoderados WHERE rut_apo = '" & b_rut_apo & "'"
    rec.Open var_sql, conn
        celular = rec("cel_apo")
        email = rec("email")
    rec.Close
    celular = val(celular)
    If Len(celular) < 8 Then
        MsgBox "Alumno no puede ser matriculado si no se ha ingresado el celular"
        Exit Sub
    End If
    
    If Len(email) < 8 Or InStr(email, "@") = 0 Or InStr(email, ".") = 0 Then
        MsgBox "Alumno no puede ser matriculado si no se ha ingresado el email"
        Exit Sub
    End If
    
    
    var_sql = "SELECT motivo,c.nombre FROM `fnza_lista_negra_apoderados` f,colegios c where f.colegio = c.colegio and ci_apo = '" & b_rut_apo & "' and bloqueado = 1"
    rec.Open var_sql, connLN
    If rec.RecordCount > 0 Then
        If rec("motivo") = "Apoderado con cheque(s) protestado(s) sin regularizar" Or rec("motivo") = "Apoderado con cheque(s) en cartera vencido(s) y sin regularizar" Then
    
            MsgBox "El apoderado no puede matricular por " & rec("motivo") & " en " & rec("nombre") _
            & ", si desea matricular necesita autorizacion de Sra. Katherine Cortes, comunicarse al fono 6319500", vbInformation
        
        Else
            MsgBox "El apoderado no puede matricular por " & rec("motivo") & " en " & rec("nombre") _
            & ", si desea matricular necesita autorizacion de Sra. Katherine Cortes, comunicarse al fono 6319500", vbInformation
            
        End If
        Exit Sub
    End If
    rec.Close
    
    var_sql = "SELECT motivo FROM `fnza_lista_negra_alumnos` where ci_alu = '" & Rut_ALu & "' and bloqueado = 1"
    rec.Open var_sql, connLN
    If rec.RecordCount > 0 Then
        If rec("motivo") = "Apoderado con cheque(s) protestado(s) sin regularizar" Or rec("motivo") = "Apoderado con cheque(s) en cartera vencido(s) y sin regularizar" Then
            MsgBox "El alumno no puede ser matriculado porque el " & rec("motivo") & " en " & rec("nombre") _
                & ", si desea matricular necesita autorizacion de Sr. Francisco Valdivieso o Sra. Jazmin Silva, comunicarse al fono 6319500", vbInformation
        Else
            MsgBox "El alumno no puede ser matriculado porque el " & rec("motivo") & " en " & rec("nombre") _
                & ", si desea matricular necesita autorizacion de Sr. Francisco Valdivieso o Sra. Jazmin Silva, comunicarse al fono 6319500", vbInformation
        End If
        Exit Sub
    End If
    rec.Close
    connLN.Close
                
    
    'Verifica deuda 2011 gescol y exage
    mat_con_deuda = DevuelveCampo("usuarios", "", "matricular_con_deuda", "AUT_NOMBRE_USUARIO ='" & Nom_usu_ses & "'", conn)
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    colegio = IIf(cole = "FAR001", "Farfana_2005", IIf(cole = "LON001", "Maipu_2005", IIf(cole = "SNB001", "Sanbernardo_2005", "otro")))
    
    'If verifica_deuda(Grid1.TextMatrix(Grid1.Row, 2)) = True Or deuda_exage("20187452-1", colegio) = True Then
    'If verifica_deuda(Trim(Rut_ALu)) = True Or deuda_exage(Trim(Rut_ALu), colegio) = True Then
    '''If verifica_deuda(Trim(Rut_ALu), college) = True Or deuda_exage(Trim(Rut_ALu), colegio) = True Then
    If verifica_deuda(Trim(Rut_ALu), college) = True Then
        If mat_con_deuda = 0 Then
                    'MsgBox "Alumno No puede ser matriculado porque tiene deuda, si desea matricularlo debe comunicarse con el Departamento de Operaciones." & vbCrLf & vbCrLf & "Telefono: 6319515", vbCritical
                    If arr_deuda(4) = "cheques protestados" Then
                        If arr_deuda(3) = "titular" Then
                            MsgBox "Alumno No puede ser matriculado porque el Titular tiene cheques protestados, en " & arr_deuda(2), vbCritical
                        Else
                            MsgBox "Alumno No puede ser matriculado porque el apoderado tiene cheques protestados, en " & arr_deuda(2), vbCritical
                        End If
                        'MsgBox "Alumno No puede ser matriculado porque el apoderado tiene cheques protestados, en " & arr_deuda(2), vbCritical
                    Else
                        MsgBox "Alumno No puede ser matriculado porque el " & arr_deuda(3) & " tiene deuda, en " & arr_deuda(2), vbCritical
                    End If
'                   Form_Matr_Alu_Act_Prox_Agno.Enabled = False
'                   Form_main.Enabled = False
                    'Check_confirma.Value = 0
                    conn.Execute "DELETE FROM apo_x_alu WHERE ci_alu='" & Rut_ALu & "' and agno=" & Trim(cmb_AnhoPos.Text) & ";"
                    Exit Sub
                    
        Else
                If MsgBox("Alumno con deuda, ¿El alumno realizó repactación?", vbYesNo, "Atención") = vbNo Then
                                
                    'Check_confirma.Value = 0
                    conn.Execute "DELETE FROM apo_x_alu WHERE ci_alu='" & Rut_ALu & "' and agno=" & Trim(cmb_AnhoPos.Text) & ";"
                    Exit Sub
                End If
                ''' deudda cordinadoras su equipo
                equipo_mat = DevuelveCampo("usuario_desbloqueo_matricula", "", "equipo", "usuario ='" & Nom_usu_ses & "'", conn)
                If equipo_mat <> "TODOS" Then
                    If equipo_mat <> ComputerName Then
                        MsgBox "No puede matricular con deuda de otro equipo que no sea el suyo", vbInformation
                        '' Check_confirma.Value = 0
                        conn.Execute "DELETE FROM apo_x_alu WHERE ci_alu='" & Rut_ALu & "' and agno=" & Trim(cmb_AnhoPos.Text) & ";"
                        Exit Sub
                    End If
                End If
        End If
    End If
    
'
'    EstadoPago = verifica_deuda_apoderado(Trim(Rut_ALu), CInt(cmb_AnhoPos.Text), CLng(5000))
'    'EstadoPago = devuelvecampo("fnza_detalle_mensualidad", "", "estado_dtll", " run_alu='" & Trim(MSHFlexGrid1.TextMatrix(MyRow, 0)) & "' AND fech_venc<'" & Format(Date, "yyyy-mm-dd") & "' ORDER BY agno DESC, mes DESC LIMIT 1;", conn)
'    If EstadoPago = False Then
'        MsgBox "Alumno no puede ser matriculado. Verificar deuda en el sistema.", vbExclamation, "Verificar"
'        R = MsgBox("¿El apoderado realizó repactación?", _
'        vbQuestion + vbYesNo, "Mensaje de confirmación")
'        If R <> 6 Then
'            conn.Execute "DELETE FROM apo_x_alu WHERE ci_alu='" & Rut_ALu & "' and agno=" & Trim(cmb_AnhoPos.Text) & ";"
'            MsgBox "El alumno no fue matriculado", vbExclamation
'            Exit Sub
'        End If
'        repactacion = ", con deuda pero realizó repactación"
'    End If
    
    'Si el alumno tiene cheques protestados devuelve verdadero
'    If verifica_cheques_protestados(Trim(Rut_ALu)) Then
'        MsgBox "El alumno tiene cheques protestados.", vbCritical, "Alumno no puede ser matriculado"
'        conn.Execute "DELETE FROM apo_x_alu WHERE ci_alu='" & Rut_ALu & "' and agno=" & Trim(cmb_AnhoPos.Text) & ";"
'        Exit Sub
'    End If
'
'    If verifica_alumno_protestados(Trim(Rut_ALu)) Then
'        MsgBox "El alumno tiene cheques protestados.", vbCritical, "Alumno no puede ser matriculado"
'        conn.Execute "DELETE FROM apo_x_alu WHERE ci_alu='" & Rut_ALu & "' and agno=" & Trim(cmb_AnhoPos.Text) & ";"
'        Exit Sub
'    End If
    
    
    'Verifico que el apoderado no haya tenido ningun protesto
'    If Me.cmb_tipo_pago.ListIndex = 1 Then
'    deuda = valida_protestos(Trim(Rut_ALu))
'        If deuda Then
'            MsgBox "El apoderado no puede tener tipo de pago cheques, porque ha tenido cheques protestados", vbExclamation, "Matricula de Alumnos Activos para el proximo año"
'            conn.Execute "DELETE FROM apo_x_alu WHERE ci_alu='" & Rut_ALu & "' and agno=" & Trim(cmb_AnhoPos.Text) & ";"
'            Exit Sub
'        End If
'    End If
    
    'SI
    'SI
                     'DTP_fec_mat
            If Format(DTP_fec_mat, "mm-dd") = "12-31" Then
                fecha_real = DevuelveCampo("establecimientos", "", "DATE_FORMAT(NOW(),'%Y-%m-%d')", "1=1", conn)
            Else
                fecha_real = Format(DTP_fec_mat, "yyyy-mm-dd")
            End If
    
    cont_cheq = IIf(cmb_contado_con.Text = "Cheques", 1, 0)
    cont_tran = IIf(cmb_contado_con.Text = "Transferencia", 1, 0)
    
    conn.Execute "INSERT INTO MATRICULAS(usuario_ingreso,fec_mat_r,CI_ALU, ACTIVO_ALU, NUM_MAT, FEC_MAT, COD_ENS, cod_jor, anno_mat, ind_cup, ind_cheq, ind_pac, ind_cont, Num_gra, ind_beca, ind_mbeca, fec_retiro,confirmado,ind_cont_cheq,ind_cont_tran) values('" & Nom_com_usu_ses & "','" & fecha_real & "','" & Rut_ALu & "', 'SI', '00000', '" & Format(DTP_fec_mat, "yyyy-mm-dd") & "', '" & Cod_Ens & "', '" & Joralu & "', '" & AnhoPos & "'" & pagos & ",'" & Num_Gra & "', 0, 0, '1111-11-11', 'SI','" & cont_cheq & "','" & cont_tran & "')"
    conn.Execute "UPDATE postulantes Set MATRICULADO_ALU ='1'  where CI_ALU = '" & Rut_ALu & "'"
    conn.Execute "UPDATE vac_x_nivel Set ocu_vac =ocu_vac + 1, DIS_VAC =TOTAL_VAC - OCU_VAC where COD_ENS = '" & Cod_Ens & "' AND NUM_GRA ='" & Num_Gra & "' AND cod_jor ='" & Joralu & "' and agno = " & AnhoPos
    'conn.Execute "UPDATE vac_x_nivel Set ocu_vac =ocu_vac + 1, DIS_VAC =TOTAL_VAC - OCU_VAC where COD_ENS = '" & Cod_Ens & "' AND NUM_GRA ='" & Num_Gra & "' AND cod_jor ='" & Joralu & "' and agno = " & AnhoPos
    conn.Execute "UPDATE postulaciones SET anno_pos_alu='" & AnhoPos & "' WHERE ci_alu='" & Rut_ALu & "' AND Fec_pos='" & Format(Me.txt_fec_pos.Text, "yyyy-mm-dd") & "';"
    conn.Execute "DELETE FROM apo_x_ins WHERE ci_alu='" & Rut_ALu & "';"
    
    Form_proc_Cursos.DTP_fec_mat.Enabled = False
    Form_proc_Cursos.Cmb_Jor_mat.Enabled = False
    Me.Txt_nom_alu_mat.Enabled = True
    Me.Txt_nom_alu_mat.SetFocus
    
    ' Insertar Log de insercion de matricula.
                Select Case Cod_Ens
                    Case "996"
                        grado = "PK"
                    Case "010"
                        grado = "K"
                    Case "110"
                        grado = "EB"
                    Case "310"
                        grado = "EM"
                End Select
                curso = CStr(Num_Gra) & "º " & grado
                accion_realizada = "El alumno fue matriculado en " & curso _
                                & ", para el período " & AnhoPos & repactacion
                log = Inserta_Vitacora_Alumno(CStr(Rut_ALu), accion_realizada)
    ' Fin Log.
    
    '********** Registro de operaciones ***********
     Call RegOpe("MAT", Trim(Left("MATRICULAS@" & Rut_ALu & "@" & Me.Txt_nom_alu_mat & String(100, " "), 100)), conn)
    '********** FIN Registro de operaciones ***********
    ' #######################
    ' Aqui se realiza la llamada al procedimiento
    ' para recalcular y regenerar la cuotas en fnza_detalle_mensualidad y fnza_mensualidad.
    RecalculaCuota_Alu Rut_ALu, val(AnhoPos), conn
    CorrigeValorNuevo Rut_ALu, val(AnhoPos), Anno, conn
    ' #######################
    
    ' IF es Lincoln
    var_sql = "select valor as c from cfg where param = 'CODBC'"
    objRS.Open var_sql, conn
    cole = objRS("c")
    objRS.Close
    If cole = "LIN001" And Cod_Ens = "996" Then
        var_sql = "SELECT rut_apo as r" _
                & " FROM apo_x_alu where ci_alu = '" & Rut_ALu & "' and agno = 2009"
        objRS.Open var_sql, conn
        apoderado = objRS("r")
        objRS.Close
                
        var_sql = "delete FROM fnza_detalle_mensualidad" _
                & " where run_alu = '" & Rut_ALu & "' and agno = 2009 and mes = 2"
        conn.Execute var_sql
        var_sql = "delete FROM fnza_mensualidad" _
                & " where run_apo = '" & apoderado & "' and agno = 2009 and mes = 2"
        conn.Execute var_sql
        
    End If
    
    'MsgBox "El proceso de matricula fue realizado exitosamente", vbInformation
    
    If Form_NFicha_PRoceso.proceso <> 0 And Form_NFicha_PRoceso.run_actual <> "" Then
        MsgBox "El proceso de matricula fue realizado exitosamente", vbInformation
        Unload Me
    Else
        MsgBox "El proceso de matricula fue realizado exitosamente", vbInformation
    End If
    
     '''' Duplicamos registro de apo_x_alu matriculas y fnza_detalle_mensualidad opara Contabilidad
    If AnhoPos >= 2023 Then
        var_sql = "replace INTO apo_x_alu_contabilidad" _
                 & " SELECT * FROM apo_x_alu WHERE agno = " & AnhoPos & " AND ci_alu = '" & Rut_ALu & "'"
        conn.Execute var_sql
         
        var_sql = "replace INTO matriculas_contabilidad" _
                 & " SELECT * FROM matriculas WHERE anno_mat = " & AnhoPos & " AND ci_alu = '" & Rut_ALu & "'"
        conn.Execute var_sql
 
        var_sql = "replace INTO fnza_detalle_mensualidad_contabilidad" _
                 & " SELECT * FROM fnza_detalle_mensualidad WHERE agno = " & AnhoPos & " AND run_alu = '" & Rut_ALu & "'"
        conn.Execute var_sql
    End If
    '''' Fin duplicación
    
Else
    MsgBox "El alumno ya se encuentra matriculado para el año seleccionado. NO es posible matricularlo nuevamente.", vbExclamation + vbOKOnly, "Mensaje de GesCol"
End If

Busqueda = 1
Me.Txt_rut_alu_mat = ""
Me.Txt_Dig_alu_mat = ""
Me.DTP_fec_mat.Value = Date
Me.Txt_nom_alu_mat.Text = ""
Me.Txt_jor_alu.Text = ""
Me.Txt_num_Mat.Text = ""
Me.txt_fec_pos.Text = ""
Me.cmb_AnhoPos.Text = ""
Me.Cmb_Jor_mat.Text = ""
Me.cmb_tipo_pago.Text = ""

'Me.Label25.Caption = "Seleccione un registrtro ..."
    Exit Sub
SaltoError:

    If Err.Number = (vbObjectError + 800) Then
        MsgBox Err.Description, vbCritical, "ALERTA DE VALIDACIÓN"
        Exit Sub
    Else
        If Err.Number = -2147217900 Then
            MsgBox "Ya se ha ingresado una matricula con los mismos datos, cambie la fecha de matricula para continuar.", vbCritical, "Matrícula Duplicada"
            Exit Sub
        Else
            MsgBox Err.Number & vbCrLf & vbCrLf & Err.Description & vbCrLf & vbCrLf & Err.Source, vbExclamation, "ALERTA DE ANOMALÍA"
            Resume
        End If
    End If
   
End Sub

Private Sub Btn_Can_Mat_Click()
Unload Me
End Sub

Private Sub btn_car_Click()

If Me.cmb_ano.Text <> "" And Me.cmb_jor_alu.Text <> "" And Me.cmb_mod <> "" And Me.cmb_niv <> "" Then
    Me.Txt_Alu.Text = 0
    Me.grd_alu.Clear
    Me.grd_alu.FormatString = "Apellido paterno     | Apellido materno     | Nombres                                 | R.U.N              | Fecha Matricula"
    CodModalidad = DevuelveCampo("codigos_ensenanza", "des_ens", "cod_ens", "des_ens = '" & Me.cmb_mod.Text & "'", conn)
    Ngrado = Me.cmb_niv.Text
    jornada = DevuelveCampo("jornadas", "", "cod_jor", "des_jor = '" & Me.cmb_jor_alu.Text & "'", conn)
    Set rssin = New ADODB.Recordset
    rssin.CursorLocation = adUseClient
    a = "select p.ape_pat_alu, p.ape_mat_alu, p.nom_alu, p.ci_alu,m.cod_jor,m.fec_mat " & _
    "from  postulantes p, matriculas m " & _
    "LEFT OUTER JOIN alu_x_cur ax ON m.ci_alu=ax.ci_alu AND ax.activo_alu='SI' AND ax.agno=m.anno_mat AND ax.agno = " & val(Me.cmb_ano) & " " & _
    "WHERE p.ci_alu = m.ci_alu and m.activo_alu = 'SI' and m.cod_ens = '" & CodModalidad & " ' and m.num_gra = '" & Ngrado & "' and m.cod_jor = '" & jornada & "' and m.anno_mat = " & val(Me.cmb_ano) & " AND ISNULL(ax.ci_alu) " & _
    "ORDER BY ape_pat_alu, ape_mat_alu, nom_alu, ci_alu,fec_mat ASC"
    
    rssin.Open a, conn
    c = 1
    Me.grd_alu.Rows = 2
    Me.grd_alu.Enabled = False
    If rssin.RecordCount > 0 Then
        ReDim alusin(rssin.RecordCount, 4)
        While Not rssin.EOF
                Me.grd_alu.Row = c
                Me.grd_alu.Col = 0
                Me.grd_alu.Text = rssin("ape_pat_alu")
                Me.grd_alu.Col = 1
                Me.grd_alu.Text = rssin("ape_mat_alu")
                Me.grd_alu.Col = 2
                Me.grd_alu.Text = rssin("nom_alu")
                Me.grd_alu.Col = 3
                Me.grd_alu.Text = rssin("ci_alu")
                Me.grd_alu.Col = 4
                Me.grd_alu.Text = rssin("fec_mat")
                alusin(c, 0) = rssin("ape_pat_alu")
                alusin(c, 1) = rssin("ape_mat_alu")
                alusin(c, 2) = rssin("nom_alu")
                alusin(c, 3) = rssin("ci_alu")
                alusin(c, 4) = rssin("fec_mat")
                c = c + 1

              Me.grd_alu.Rows = Me.grd_alu.Rows + 1
                Me.grd_alu.Enabled = True
            rssin.MoveNext
        Wend
        Me.Txt_Alu.Text = c - 1
      If Me.grd_alu.Rows > 2 Then
            Me.grd_alu.RemoveItem (Me.grd_alu.Rows)
       End If
    End If
    rssin.Close
    Set rssin = Nothing
Else
    MsgBox ("Faltan opciones por seleccionar")
End If
End Sub




Private Sub Btn_show_Conducta_Click()
Frame_Mat_Ok_Doc.Visible = False
Frame_Mat_Ok_Conducta.Visible = True
End Sub

Private Sub Btn_show_Doc_Click()
Frame_Mat_Ok_Doc.Visible = True
Cmb_Docs_REc.Visible = True
Frame_Mat_Ok_Conducta.Visible = False
End Sub



Private Sub btnRechazar_Click()
 Form_NFicha_Rechazar.Show
End Sub

Private Sub Chk_Doc_1_Click()
If Me.Chk_Doc_1.Value = 0 Or Me.Chk_Doc_2.Value = 0 Or Me.Chk_Doc_3.Value = 0 Or Me.Chk_Doc_4.Value = 0 Then
    Me.Cmb_Docs_REc.Enabled = False
Else
    Me.Cmb_Docs_REc.Enabled = True
End If

End Sub

Private Sub Chk_Doc_2_Click()
If Me.Chk_Doc_1.Value = 0 Or Me.Chk_Doc_2.Value = 0 Or Me.Chk_Doc_3.Value = 0 Or Me.Chk_Doc_4.Value = 0 Then
    Me.Cmb_Docs_REc.Enabled = False
Else
    Me.Cmb_Docs_REc.Enabled = True
End If

End Sub

Private Sub Chk_Doc_3_Click()
If Me.Chk_Doc_1.Value = 0 Or Me.Chk_Doc_2.Value = 0 Or Me.Chk_Doc_3.Value = 0 Or Me.Chk_Doc_4.Value = 0 Then
    Me.Cmb_Docs_REc.Enabled = False
Else
    Me.Cmb_Docs_REc.Enabled = True
End If

End Sub

Private Sub Chk_Doc_4_Click()
If Me.Chk_Doc_1.Value = 0 Or Me.Chk_Doc_2.Value = 0 Or Me.Chk_Doc_3.Value = 0 Or Me.Chk_Doc_4.Value = 0 Then
    Me.Cmb_Docs_REc.Enabled = False
Else
    Me.Cmb_Docs_REc.Enabled = True
End If
End Sub

Private Sub cmb_ano_Click()
Call limpia_form_proc_cursos1
End Sub

Private Sub Cmb_Docs_REc_Click()
Rut_ALu = Me.Txt_rut_alu_mat & "-" & Me.Txt_Dig_alu_mat
a = "UPDATE POSTULANTES Set V_CER_NAC = " & Chk_Doc_1 & ", V_INF_NOT_PAR = " & Chk_Doc_2 & ", V_CER_EST_ULT_CUR = " & Chk_Doc_3 & ", V_FOTOS = " & Chk_Doc_4 & " where CI_ALU=" & "'" & Rut_ALu & "'"
conn.Execute a
MsgBox ("El o los documentos fueron recibidos exitosamente")
a = DocsOk(Me.Txt_rut_alu_mat & "-" & Me.Txt_Dig_alu_mat)
If a = True Then
    Btn_Ace_Mat.Enabled = True
    Frame_Mat_OK.Visible = False
    Form_proc_Cursos.Height = 3650
    Form_proc_Cursos.Width = 7230
End If

End Sub

Private Sub cmb_jor_alu_Click()
Dim AF As String
CodModalidad = DevuelveCampo("codigos_ensenanza", "des_ens", "cod_ens", "des_ens = '" & Me.cmb_mod.Text & "'", conn)
Ngrado = Me.cmb_niv.Text
jornada = Me.cmb_jor_alu.Text
AF = "where cod_ens = '" & CodModalidad & "' and num_gra = '" & Ngrado & "'"
Call btn_car_Click
End Sub

Private Sub Cmb_Jor_mat_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub

Private Sub Cmb_Jor_mat_LostFocus()
If Cmb_Jor_mat <> "" Then Joralu = DevuelveCampo("jornadas", "", "cod_jor", "des_jor = '" & Me.cmb_jor_alu.Text & "'", conn)
End Sub

Private Sub cmb_mod_Click()
Dim t As Integer
Call limpia_form_proc_cursos1
If Len(Me.cmb_mod.Text) <> 0 Then
 nivel = DevuelveCampo("codigos_ensenanza", "des_ens", "num_gra_max", "des_ens = " & "'" & Me.cmb_mod.Text & "'", conn)
 Me.cmb_niv.Enabled = True
 Me.cmb_niv.Clear
 For t = 1 To val(nivel)
    Me.cmb_niv.AddItem t
 Next t
End If
End Sub

Private Sub cmb_mod_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Len(Me.cmb_mod.Text) <> 0 Then
    Me.cmb_niv.Enabled = True
    Me.cmb_niv.SetFocus
End If
End Sub

Private Sub cmb_niv_Click()
Call limpia_form_proc_cursos1
End Sub

Private Sub cmb_tipo_pago_Click()
    If cmb_tipo_pago.Text = "Contado" Then
        lbl_contado_con.Visible = True
        cmb_contado_con.Visible = True
    Else
        lbl_contado_con.Visible = False
        cmb_contado_con.Visible = False
        cmb_contado_con.Text = ""
    End If
End Sub

Private Sub cmb_tipo_pago_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub


Private Sub com_des_Click()
Dim t, iniCiclo, finCiclo As Integer
Dim rutalumno, StrSql As String
Dim Beca, annno As String
Dim CodJornada As String
Dim fechas As Date
Dim fechamat As String
Dim accion_realizada As String
Dim log As Boolean

If MsgBox("¿ Está seguro que Desea Desmatricular?", vbYesNo + vbQuestion) = vbYes Then
    If Me.Txt_jor <> "" Then
        CodModalidad = DevuelveCampo("codigos_ensenanza", "des_ens", "cod_ens", "des_ens = '" & Me.cmb_mod.Text & "'", conn)
        Ngrado = Me.cmb_niv.Text
        If Me.grd_alu.Row > Me.grd_alu.RowSel Then
            iniCiclo = Me.grd_alu.Row
            finCiclo = Me.grd_alu.RowSel
        ElseIf Me.grd_alu.RowSel > Me.grd_alu.Row Then
            iniCiclo = Me.grd_alu.RowSel
            finCiclo = Me.grd_alu.Row
        Else
            iniCiclo = Me.grd_alu.Row
            finCiclo = Me.grd_alu.RowSel
        End If
        
        For t = iniCiclo To finCiclo Step -1
            'RutAlumno = alusin(t, 3)
            rutalumno = Me.grd_alu.TextMatrix(t, 3)
            fechamat = Format(Me.grd_alu.TextMatrix(t, 4), "yyyy-mm-dd")
            If t <= 2 And Me.grd_alu.Rows = 2 Then
                Me.grd_alu.Clear
                Me.grd_alu.FormatString = "Apellido paterno     | Apellido materno     | Nombres                                 | R.U.N              | Fecha Matricula"
            Else
                Me.grd_alu.RemoveItem (t)
            End If
            StrSql = "DELETE FROM matriculas where ci_alu ='" & rutalumno & "' and anno_mat=" & Trim(cmb_ano.Text) & " and activo_alu='SI' and fec_mat='" & Format(fechamat, "yyyy-mm-dd") & "';"
            conn.Execute StrSql
            StrSql = "UPDATE  postulantes SET matriculado_alu ='0'  where ci_alu='" & rutalumno & "'"
            conn.Execute StrSql
            
            'Insertar log
                accion_realizada = "La matricula del alumno para el periodo " & cmb_ano.Text _
                                 & " fue anulada"
                log = Inserta_Vitacora_Alumno(CStr(rutalumno), accion_realizada)
            'Fin de log
            
         ' If ExistReg("becas", "run_alu= '" & RutSinCurso & "' and tipo_beca = '" & beca & "' and agno_escolar = '" & annno & "'  and fecha = '" & fechas & "'", conn) Then
          Set rs = New ADODB.Recordset
          rs.CursorLocation = adUseClient
          rs.Open "select * from becas where run_alu= '" & rutalumno & "' and agno =" & val(Me.cmb_ano), conn
          ' Si encontró registro en tabla de becados
          If rs.RecordCount > 0 Then
              conn.Execute "INSERT INTO BECAS_REASIGNAR(tipo_beca, agno_escolar,monto_excencion, fecha, run_alu) values('" & rs!tipo_beca & "' , " & rs!agno & " ,  " & rs!monto_excencion & " , '" & Format(Date, "yyyy-mm-dd") & "' , '" & rutalumno & "')"
              MsgBox "Alumno Selecionado Tenia Beca Se guardara para ser Reasignada", vbCritical, "ALERTA DE VALIDACIÓN"
              StrSql = "DELETE FROM BECAS where RUN_ALU ='" & rutalumno & "' and agno =" & val(Me.cmb_ano)
              conn.Execute StrSql
          Else
              'MsgBox "Alumno Selecionado no Tiene Beca", vbCritical, "ALERTA DE VALIDACIÓN"
          End If
          
          Set rs = New ADODB.Recordset
          rs.CursorLocation = adUseClient
          rs.Open "select fm.run_apo, fd.folio_dtll, fd.mes, fd.monto_tot_cuota from fnza_detalle_mensualidad fd, fnza_mensualidad fm where fd.folio_mens=fm.folio_mens and fd.run_alu= '" & rutalumno & "' and fd.agno = " & val(Me.cmb_ano) & " and ucase(fd.concepto)='CT00' order by fd.mes asc limit 1", conn
          'Si Encontró Cuota 00
          If rs.RecordCount > 0 Then '
            ' Si Pagó cuota 00
            If Not dtll_impago(rs!folio_dtll, conn) Then
                MsgBox "Alumno Desmatriculado Canceló Cuota 00. Se debe realizar una devolución de dinero", vbInformation, "ATENCIÓN"
            End If
          End If
            ' desmatricular en tablas de finanzas
            Call RecalculaCuota_Alu_Retiro(rutalumno, CDate(fechamat), conn, val(cmb_ano.Text))
            
          'End If
          rs.Close: Set rs = Nothing
        
        Next t
        btn_car_Click
    Else
        MsgBox "Alumno Selecionado Tiene Beca", vbCritical, "ALERTA DE VALIDACIÓN"
    End If
End If
End Sub

Private Sub com_salir_Click()
    Call menuhabilitado(True)
    Unload Me
End Sub

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

Private Sub Form_Load()

Me.DTP_fec_mat.Value = Date
Busqueda = 1
Form_proc_Cursos.KeyPreview = True

Set rs = New ADODB.Recordset
Set rsSinCurso = New ADODB.Recordset
Set rsConCurso = New ADODB.Recordset

If ManTab = "mat" Then
    Form_proc_Cursos.Height = 4350 '3360
    Form_proc_Cursos.Width = 7400
    Call Form_main.HideFRameProcCursos
    Call LlenaCombo(Form_proc_Cursos.Cmb_Jor_mat, "jornadas", "des_jor", "order by des_jor", conn)
    Me.cmb_tipo_pago.AddItem "Cuponera"
    Me.cmb_tipo_pago.AddItem "Cheques"
    Me.cmb_tipo_pago.AddItem "P.A.C."
    Me.cmb_tipo_pago.AddItem "Contado"
    Me.cmb_contado_con.AddItem "Cheques"
    Me.cmb_contado_con.AddItem "Transferencia"
    cmb_AnhoPos.AddItem Anno
    cmb_AnhoPos.AddItem Anno + 1
    Form_proc_Cursos.Frame_Mat.Visible = True
    Form_proc_Cursos.DTP_fec_mat.Enabled = False
    Form_proc_Cursos.Cmb_Jor_mat.Enabled = False
    CentrarForma Me
    Form_proc_Cursos.Show

If Form_NFicha_PRoceso.proceso <> 0 And Form_NFicha_PRoceso.run_actual <> "" Then

Dim rsmat As ADODB.Recordset
Set rsmat = New ADODB.Recordset
rsmat.Open "Select ps.*, p.APE_PAT_ALU, p.APE_MAT_ALU, p.NOM_ALU, p.CI_ALU, p.COD_ENS, p.NUM_GRA " _
& " from postulaciones ps, postulantes p where p.ci_alu = '" & Form_NFicha_PRoceso.run_actual & "' and ps.ci_alu = p.ci_alu", conn

Indi = 0
Busqueda = 0
Apellido1 = rsmat("APE_PAT_ALU")
Apellido2 = rsmat("APE_MAT_ALU")
nombre = rsmat("NOM_ALU")
rut$ = rsmat("CI_ALU")

jornada = DevuelveCampo("jornadas", "", "des_jor", "cod_jor = '" & rsmat("COD_JOR") & "'", conn)
Cod_Ens = rsmat("COD_ENS")
Num_Gra = rsmat("NUM_GRA")

Fecpos = rsmat("FEC_POS")
AnhoPostu = rsmat("ANNO_POS_ALU")
modalidad = DevuelveCampo("codigos_ensenanza", "", "des_ens", "cod_ens ='" & Cod_Ens & "'", conn)

Me.Txt_rut_alu_mat.Text = separarut(rut$)
Me.Txt_Dig_alu_mat.Text = separadigito(rut$)
Me.Txt_nom_alu_mat.Text = Trim(Apellido1) + " " + Trim(Apellido2) + " " + Trim(nombre)
Me.txt_fec_pos.Text = Fecpos
Me.cmb_AnhoPos.Text = AnhoPostu
Me.txt_mod_nivel.Text = Num_Gra
Me.txt_mod.Text = modalidad
Txt_jor_alu = jornada

    If jornada <> "" Then
        Cmb_Jor_mat.Text = jornada
    End If

Txt_nom_alu_mat.Enabled = False
Txt_rut_alu_mat.Enabled = False
Txt_Dig_alu_mat.Enabled = False
Lst_nom_alu_mat.Visible = False
DTP_fec_mat.Enabled = True
Cmb_Jor_mat.Enabled = True
Txt_num_Mat.Enabled = False

Btn_Ace_Mat.Enabled = True
NumMat = DevuelveCampo("matriculas", "", "max(num_mat)", "cod_ens ='" & Cod_Ens & "'", conn)
Txt_num_Mat = FillconCero(Trim(str(val(NumMat) + 1)), 5)

a = MatriculaOK(rsmat("CI_ALU"))
If a = False Then Exit Sub

rsmat.Close
End If


ElseIf ManTab = "proc_desmat" Then
    Me.cmb_ano.AddItem val(Anno)
    Me.cmb_ano.AddItem val(Anno) + 1
    Form_proc_Cursos.Height = 7250
    Form_proc_Cursos.Width = 9300
    Call Form_main.HideFRameProcCursos
    Form_proc_Cursos.fra_des_alu.Height = 6600
    Form_proc_Cursos.fra_des_alu.Width = 9000
    Form_proc_Cursos.fra_des_alu.Visible = True
    Call LlenaCombo(Form_proc_Cursos.cmb_mod, "codigos_ensenanza", "des_ens", "order by ord_ens", conn)
    Call LlenaCombo(Form_proc_Cursos.cmb_jor_alu, "jornadas", "des_jor", "order by des_jor", conn)
        CentrarForma Me
        Form_proc_Cursos.Show
    Me.Txt_Alu.Locked = True
    Me.cmb_niv.Enabled = False
    Me.grd_alu.Enabled = False
    Me.Txt_Alu.Enabled = False
End If

lbl_contado_con.Visible = False
cmb_contado_con.Visible = False

End Sub

'Private Sub Form_Unload(Cancel As Integer)
'If ManTab = "mat" Then
'    FormFechas.Enabled = True
'Else
'    Call menuhabilitado(True)
'End If
'End Sub


Private Sub Form_Unload(Cancel As Integer)
    If Form_NFicha_PRoceso.proceso = 1 Then
    Form_NFicha_PRoceso.Enabled = True
    End If
    Call menuhabilitado(True)
End Sub





Private Sub grdproc_cursos_Click()

End Sub

Private Sub Lst_nom_alu_mat_DblClick()
Indi = 0
Busqueda = 0
Apellido1 = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 0)
Apellido2 = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 1)
nombre = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 2)
rut$ = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 3)
jornada = DevuelveCampo("jornadas", "", "des_jor", "cod_jor = '" & alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 4) & "'", conn)
Cod_Ens = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 5)
Num_Gra = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 6)
Fecpos = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 7)
AnhoPostu = alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 8)
modalidad = DevuelveCampo("codigos_ensenanza", "", "des_ens", "cod_ens ='" & Cod_Ens & "'", conn)
Me.Txt_rut_alu_mat.Text = separarut(rut$)
Me.Txt_Dig_alu_mat.Text = separadigito(rut$)
Me.Txt_nom_alu_mat.Text = Trim(Apellido1) + " " + Trim(Apellido2) + " " + Trim(nombre)
Me.txt_fec_pos.Text = Fecpos
Me.cmb_AnhoPos.Text = AnhoPostu
Me.txt_mod_nivel.Text = Num_Gra
Me.txt_mod.Text = modalidad
Txt_jor_alu = jornada
If jornada <> "" Then
    Cmb_Jor_mat.Text = jornada
End If
Txt_nom_alu_mat.Enabled = False
Txt_rut_alu_mat.Enabled = False
Txt_Dig_alu_mat.Enabled = False
Lst_nom_alu_mat.Visible = False
DTP_fec_mat.Enabled = True
Cmb_Jor_mat.Enabled = True
Txt_num_Mat.Enabled = False

Btn_Ace_Mat.Enabled = True
NumMat = DevuelveCampo("matriculas", "", "max(num_mat)", "cod_ens ='" & Cod_Ens & "'", conn)
Txt_num_Mat = FillconCero(Trim(str(val(NumMat) + 1)), 5)

a = MatriculaOK(alumnossincurso(Me.Lst_nom_alu_mat.ListIndex, 3))
If a = False Then Exit Sub



End Sub

Private Sub Lst_nom_alu_mat_GotFocus()
Me.Btn_Ace_Mat.Enabled = False
End Sub
Private Sub Lst_nom_alu_mat_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call Lst_nom_alu_mat_DblClick


End Sub

Private Sub Lst_nom_alu_mat_LostFocus()
'Me.Btn_Ace_Mat.Enabled = True
End Sub

Private Sub Txt_nom_alu_mat_Change()
If Trim(Txt_rut_alu_mat) = "" Then
    Me.Btn_Ace_Mat.Enabled = False
Else
    Me.Btn_Ace_Mat.Enabled = True
End If

If Busqueda = 1 Then
  rs.CursorLocation = adUseClient

Lst_nom_alu_mat.Clear
If Not ((Chr(KeyAscii) >= "A" And Chr(KeyAscii) <= "Z") Or (Chr(KeyAscii) >= "a" And Chr(KeyAscii) <= "z")) Then
    KeyAscii = 0
    If Me.Txt_nom_alu_mat.Text <> "" Then
      Criterio = "'" + Me.Txt_nom_alu_mat.Text + Consulta + "%'"
      rs.Open "SELECT ape_pat_alu, ape_mat_alu, nom_alu, P.ci_alu, VIII_SIT_FIN_ALU, PS.cod_jor, PS.fec_pos, PS.anno_pos_alu, cod_ens, num_gra FROM postulantes P, POSTULACIONES PS where P.CI_ALU = PS.CI_ALU AND ape_pat_alu like " & Criterio & " AND VIII_SIT_FIN_ALU ='A' and MATRICULADO_ALU <> '1' order by ape_pat_alu, ape_mat_alu", conn
      'rs.FindFirst "des_pre like " + Criterio
            'rs.MoveFirst
        Lst_nom_alu_mat.Visible = False
        'Me.Txt_cod_mod.Text = ""
        If rs.RecordCount > 0 Then
            Indi = 0
            ReDim alumnossincurso(rs.RecordCount, 9)
            c = 0
            While Not rs.EOF
                Lst_nom_alu_mat.AddItem rs("ape_pat_alu") + " " + rs("ape_mat_alu") + " " + rs("nom_alu")
                alumnossincurso(c, 0) = rs("ape_pat_alu")
                alumnossincurso(c, 1) = rs("ape_mat_alu")
                alumnossincurso(c, 2) = rs("nom_alu")
                alumnossincurso(c, 3) = rs("ci_alu")
                alumnossincurso(c, 4) = rs("cod_jor")
                alumnossincurso(c, 5) = rs("cod_ens")
                alumnossincurso(c, 6) = rs("num_gra")
                alumnossincurso(c, 7) = rs("fec_pos")
                alumnossincurso(c, 8) = rs("anno_pos_alu")
                Lst_nom_alu_mat.Visible = True
                rs.MoveNext
                c = c + 1
            Wend
        Else
            
            Indi = 0
        End If
        rs.Close
    Else
    Lst_nom_alu_mat.Visible = False
    Me.Txt_nom_alu_mat.Enabled = True
    Me.Txt_rut_alu_mat.Text = ""
    Me.Txt_Dig_alu_mat.Enabled = True
    Me.Txt_Dig_alu_mat.Text = ""

    End If
    
End If
End If

End Sub

Private Sub Txt_nom_alu_mat_KeyPress(KeyAscii As Integer)

'Busqueda = 1
If KeyAscii = 27 Then
    Txt_nom_alu_mat.Text = ""
    Lst_nom_alu_mat.Visible = False
    KeyAscii = 0
ElseIf KeyAscii = 13 And Len(Trim(Me.Txt_nom_alu_mat.Text)) <> 0 Then
        'Call Btn_Ace_res_pos_Click
ElseIf ((Chr(KeyAscii) >= "A" And Chr(KeyAscii) <= "Z") Or (Chr(KeyAscii) >= "a" And Chr(KeyAscii) <= "z")) Then Exit Sub
ElseIf (Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Then Exit Sub
ElseIf KeyAscii = 8 Then Exit Sub
ElseIf KeyAscii = 32 Then Exit Sub
ElseIf Me.Txt_nom_alu_mat.Text = "" Then
        If KeyAscii = 37 Then Exit Sub
End If
    KeyAscii = 0: Exit Sub

End Sub
Public Function MatriculaOK(ci_alu As String) As Boolean
MatriculaOK = True 'Inicializa por defecto Matrícula
'revisa Si Es un alumno matriculado
If ExistReg("MATRICULAS", "CI_ALU ='" & ci_alu & "' AND ACTIVO_ALU ='SI'", conn) Then
  'Si Es un alumno matriculado hace lo siguiente:
    'revisa Si existe orden para cancelar la matricula
    If ExistReg("matriculas", "CI_ALU ='" & ci_alu & "' AND CANCELADO", conn) Then
        MatriculaOK = False
        Form_proc_Cursos.Btn_show_Conducta.Enabled = True
        a$ = "ACTIVO_ALU ='si' AND CANCELADO =1 AND CI_ALU ='" & ci_alu & "'"
        Txt_obs = DevuelveCampo("MATRICULAS", "", "OBS_CANCELADO", a$, conn)
               
    Else
        MatriculaOK = True
    End If
    'FIN revisa Si existe orden para cancelar la matricula
    a = DocsOk(ci_alu) 'revisa Si faltan documentos
'FIN revisa Si Es un alumno matriculado
Else
'Si Es un Postulante
a = DocsOk(ci_alu) 'revisa Si faltan documentos
End If



If MatriculaOK = False Or a = False Then
            MatriculaOK = False
            Form_proc_Cursos.Height = 7455
            Form_proc_Cursos.Width = 7230
            Form_proc_Cursos.Frame_Mat_OK.Left = 120
            Form_proc_Cursos.Frame_Mat_OK.Top = 3000
            Form_proc_Cursos.Frame_Mat_OK.Height = 3970
            Form_proc_Cursos.Frame_Mat_OK.Width = 6855
            Form_proc_Cursos.Frame_Mat_OK.Visible = True
            CentrarForma Me
End If



End Function

Public Function DocsOk(Rut_ALu As String) As Boolean
rs.CursorLocation = adUseClient
    Sql = "SELECT V_CER_NAC, V_INF_NOT_PAR, V_CER_EST_ULT_CUR, V_FOTOS, VIII_SIT_FIN_ALU FROM POSTULANTES P, POSTULACIONES PS where P.CI_ALU = PS.CI_ALU AND PS.CI_ALU ='" & Rut_ALu & "' AND VIII_SIT_FIN_ALU ='A' ORDER BY FEC_POS DESC"
    rs.Open Sql, conn, adOpenKeyset
    
    If rs.RecordCount > 0 Then
        Form_proc_Cursos.Chk_Doc_1.Value = rs(0)
        Form_proc_Cursos.Chk_Doc_2.Value = rs(1)
        Form_proc_Cursos.Chk_Doc_3.Value = rs(2)
        Form_proc_Cursos.Chk_Doc_4.Value = rs(3)
   
        If rs(0) = 1 Then Form_proc_Cursos.Chk_Doc_1.Enabled = False
        If rs(1) = 1 Then Form_proc_Cursos.Chk_Doc_2.Enabled = False
        If rs(2) = 1 Then Form_proc_Cursos.Chk_Doc_3.Enabled = False
        If rs(3) = 1 Then Form_proc_Cursos.Chk_Doc_4.Enabled = False
   
        If rs(0) = 1 Then
            Form_proc_Cursos.Btn_show_Doc.Enabled = True
            DocsOk = True
        Else
            Form_proc_Cursos.Btn_show_Doc.Enabled = True
            Btn_Ace_Mat.Enabled = False
            DocsOk = False
        End If
        'For i = 0 To 3
        '    If rs(i) = 0 Then
        '        Form_proc_Cursos.Btn_show_Doc.Enabled = True
        '        Btn_Ace_Mat.Enabled = False
        '
        '        DocsOk = False
        '        Exit For
        '    Else
        '        DocsOk = True
        '    End If
        'Next i
    End If
    rs.Close
End Function

Sub limpia_form_proc_cursos1()
    Me.Txt_Alu.Text = 0
    Me.grd_alu.Rows = 2
    Me.grd_alu.Clear
    Me.grd_alu.FormatString = "Apellido paterno     | Apellido materno     | Nombres                                 | R.U.N              | Fecha Matricula"
    Me.cmb_jor_alu.ListIndex = -1
    Me.grd_alu.Enabled = False
End Sub

Private Function verifica_cheques_protestados(ci_alu As String) As Boolean
    'Si el alumno tiene cheques protestados devuelve verdadero
    Dim var_sql As String
    Dim rut_apo As String
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    var_sql = "select rut_apo from apo_x_alu where ci_alu = '" & ci_alu & "' and agno = '" & cmb_AnhoPos.Text & "'limit 1"
    objRS.Open var_sql, conn
    rut_apo = objRS("rut_apo")
    objRS.Close
    var_sql = "select distinct concat(rut,'-',digito) as rut from fnza_protestados" _
            & " where concat(rut,'-',digito) = '" & rut_apo & "'"
    objRS.Open var_sql, conn
    If Not objRS.EOF Then
        verifica_cheques_protestados = True
    Else
        verifica_cheques_protestados = False
    End If
    objRS.Close
End Function

