VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form_aut_inasis 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Autorizar Inasistencias"
   ClientHeight    =   5685
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11055
   Icon            =   "Form_aut_inasis.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5685
   ScaleWidth      =   11055
   Begin VB.Frame frm_justifica 
      Caption         =   "Justifica Inasistencias"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   2535
      Left            =   3480
      TabIndex        =   2
      Top             =   1440
      Visible         =   0   'False
      Width           =   4095
      Begin VB.CommandButton cmb_cancelaina 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   2160
         TabIndex        =   7
         Top             =   1800
         Width           =   1215
      End
      Begin VB.CommandButton cmb_aceptaina 
         Caption         =   "Aceptar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   720
         TabIndex        =   6
         Top             =   1800
         Width           =   1215
      End
      Begin VB.TextBox txt_numdecreto 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1440
         TabIndex        =   5
         Top             =   1200
         Width           =   2295
      End
      Begin VB.OptionButton opt_decreto 
         Caption         =   "Decreto Nº"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   240
         TabIndex        =   4
         Top             =   1200
         Width           =   1935
      End
      Begin VB.OptionButton opt_certificados 
         Caption         =   "Certificados Médicos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   240
         TabIndex        =   3
         Top             =   840
         Value           =   -1  'True
         Width           =   2295
      End
      Begin VB.Label lbl_justifica 
         Caption         =   "Label5"
         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             =   480
         Width           =   3135
      End
   End
   Begin VB.Frame fraAsiAlum 
      Height          =   5415
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   10815
      Begin VB.ListBox list_rut 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1530
         Left            =   8880
         TabIndex        =   22
         Top             =   2040
         Visible         =   0   'False
         Width           =   1455
      End
      Begin VB.ListBox list_nombre 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1530
         Left            =   4320
         TabIndex        =   21
         Top             =   840
         Visible         =   0   'False
         Width           =   4455
      End
      Begin VB.CommandButton cmb_calir 
         Caption         =   "Salir"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   780
         Left            =   9240
         Picture         =   "Form_aut_inasis.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   4440
         Width           =   1335
      End
      Begin VB.Frame frmFormaLista 
         Height          =   1815
         Left            =   120
         TabIndex        =   1
         Top             =   120
         Width           =   10575
         Begin VB.CommandButton cmb_cambia 
            Caption         =   "Otro Alumno"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   780
            Left            =   9000
            Picture         =   "Form_aut_inasis.frx":2AED8
            Style           =   1  'Graphical
            TabIndex        =   23
            Top             =   840
            Width           =   1335
         End
         Begin VB.Frame Frame1 
            Height          =   1575
            Left            =   120
            TabIndex        =   13
            Top             =   120
            Width           =   3855
            Begin VB.CheckBox chkcurso 
               Caption         =   "Buscar por Curso"
               BeginProperty Font 
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   375
               Left            =   1920
               TabIndex        =   20
               Top             =   1080
               Width           =   1695
            End
            Begin VB.ComboBox cmbListaLetras 
               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          =   330
               Left            =   1080
               TabIndex        =   16
               Top             =   1080
               Width           =   735
            End
            Begin VB.ComboBox cmbListaModal 
               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          =   330
               Left            =   240
               TabIndex        =   15
               Top             =   480
               Width           =   2895
            End
            Begin VB.ComboBox cmbListaNiveles 
               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          =   330
               Left            =   240
               TabIndex        =   14
               Top             =   1080
               Width           =   735
            End
            Begin VB.Label Label3 
               Caption         =   "Tipo de Enseñanza"
               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        =   19
               Top             =   240
               Width           =   1575
            End
            Begin VB.Label Label4 
               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            =   240
               TabIndex        =   18
               Top             =   840
               Width           =   495
            End
            Begin VB.Label Label6 
               Caption         =   "Letra"
               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        =   17
               Top             =   840
               Width           =   615
            End
         End
         Begin VB.TextBox txt_rut 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   8880
            TabIndex        =   10
            Top             =   480
            Width           =   1455
         End
         Begin VB.TextBox txt_nombre 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Left            =   4200
            TabIndex        =   9
            Top             =   480
            Width           =   4455
         End
         Begin VB.Label Label2 
            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            =   8880
            TabIndex        =   12
            Top             =   240
            Width           =   495
         End
         Begin VB.Label Label1 
            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            =   4200
            TabIndex        =   11
            Top             =   240
            Width           =   735
         End
      End
      Begin MSFlexGridLib.MSFlexGrid grd_alumnos 
         Height          =   2295
         Left            =   120
         TabIndex        =   24
         Top             =   2040
         Width           =   10605
         _ExtentX        =   18706
         _ExtentY        =   4048
         _Version        =   393216
         Cols            =   10
         FixedCols       =   0
         BackColor       =   16777215
         SelectionMode   =   1
         FormatString    =   "^Nombre Alumno|^Rut|^Curso|^Dias Asistidos|^Dias Inasistidos|^Dias para 100% |^% Asistido|^Justifica|^Nº Decreto|>sw"
         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 Label5 
         Caption         =   "Para agregar o eliminar la justificación de la asistencia debe hacer doble click sobre el nombre del 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          =   375
         Left            =   240
         TabIndex        =   28
         Top             =   4920
         Width           =   9015
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H00C0FFFF&
         BackStyle       =   1  'Opaque
         FillColor       =   &H000000FF&
         Height          =   255
         Index           =   1
         Left            =   240
         Shape           =   1  'Square
         Top             =   4440
         Width           =   255
      End
      Begin VB.Label Label10 
         Caption         =   "No cumple el 100% de asistencia"
         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            =   3360
         TabIndex        =   26
         Top             =   4440
         Width           =   2415
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H00FFC0C0&
         BackStyle       =   1  'Opaque
         FillColor       =   &H000000FF&
         Height          =   255
         Index           =   0
         Left            =   3000
         Shape           =   1  'Square
         Top             =   4440
         Width           =   255
      End
      Begin VB.Label Label10 
         Caption         =   "Alumno Justificado"
         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            =   600
         TabIndex        =   25
         Top             =   4440
         Width           =   2295
      End
   End
End
Attribute VB_Name = "Form_aut_inasis"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Flag_sub As Boolean

Private Sub chkcurso_Click()
    If chkcurso.Value Then
        Flag_sub = True
        txt_nombre.Enabled = False
        txt_nombre.Text = ""
        txt_rut.Enabled = False
        txt_rut.Text = ""
        cmb_cambia.Enabled = False
        cmbListaModal.Enabled = True
        Flag_sub = False
    Else
        Flag_sub = True
        txt_nombre.Enabled = True
        txt_nombre.Text = ""
        txt_rut.Enabled = True
        txt_rut.Text = ""
        cmb_cambia.Enabled = True
        cmbListaModal.Enabled = True
        cmbListaNiveles.Enabled = False
        cmbListaLetras.Enabled = False
        cmbListaModal.Text = ""
        cmbListaNiveles.Clear
        cmbListaLetras.Clear
        Flag_sub = False
    End If
    grd_alumnos.Rows = 1
End Sub

Private Sub cmb_aceptaina_Click()
    Dim Concepto As String
    Dim NumDecreto As String

    If MsgBox("¿Está seguro de justificar estas inasistencias?", vbQuestion + vbYesNo, "GesCol") = vbNo Then GoTo TerminaSub
    If opt_certificados.Value Then
        Concepto = " "
        NumDecreto = "0"
    Else
        Concepto = "Decreto " & txt_numdecreto.Text
        If txt_numdecreto.Text = "" Then
            MsgBox "Debe ingresar el número del decreto", vbExclamation, "Atención"
            Exit Sub
        End If
        NumDecreto = "0"
    End If
    sql = "REPLACE INTO elimina_asistencia_actas (ci_alu,agno,curso,porcentaje_inasistencias, concepto,numero_decreto) VALUES (" & _
          "'" & grd_alumnos.TextMatrix(grd_alumnos.Row, 1) & "'," & Anno & ",'" & grd_alumnos.TextMatrix(grd_alumnos.Row, 2) & "'," & _
          "'" & grd_alumnos.TextMatrix(grd_alumnos.Row, 6) & "','" & Concepto & "'," & Val(NumDecreto) & ")"
    conn.Execute sql
    
    'Boton cancelar
    If Len(Me.cmbListaModal) <> 0 Then
        cmbListaNiveles.Enabled = True
        cmbListaNiveles.Clear
        If Len(Me.cmbListaModal.Text) <> 0 Then
            nivel = devuelvecampo("codigos_ensenanza", "des_ens", "num_gra_max", "des_ens = " & "'" & Me.cmbListaModal.Text & "'", conn)
            For t = 1 To Val(nivel)
                Me.cmbListaNiveles.AddItem t
            Next t
        End If
        cmbListaLetras.Clear
        cmbListaNiveles.ListIndex = 0
        cmbListaNiveles_Click
    End If
    
    MsgBox "Las inasistencias del alumnos han sido justificadas", vbInformation, "GesCol"
    Call cmb_cancelaina_Click
    
TerminaSub:
End Sub

Private Sub cmb_calir_Click()
    Unload Me
End Sub

Private Sub cmb_cambia_Click()
    Flag_sub = True
    txt_nombre.Text = ""
    txt_rut.Text = ""
    txt_nombre.Locked = False
    txt_rut.Locked = False
    list_rut.Visible = False
    list_nombre.Visible = False
    grd_alumnos.Rows = 1
    Flag_sub = False
    
End Sub

Private Sub cmb_cancelaina_Click()
    frm_justifica.Visible = False
    llena_info_adicional
End Sub

Private Sub cmbListaLetras_Click()
    llena_info_adicional
End Sub

Private Sub cmbListaModal_Click()
    If Len(Me.cmbListaModal) <> 0 Then
        cmbListaNiveles.Enabled = True
        cmbListaNiveles.Clear
        If Len(Me.cmbListaModal.Text) <> 0 Then
            nivel = devuelvecampo("codigos_ensenanza", "des_ens", "num_gra_max", "des_ens = " & "'" & Me.cmbListaModal.Text & "'", conn)
            For t = 1 To Val(nivel)
                Me.cmbListaNiveles.AddItem t
            Next t
        End If
        cmbListaLetras.Clear
        cmbListaNiveles.ListIndex = 0
        cmbListaNiveles_Click
    End If
End Sub

Private Sub cmbListaNiveles_Click()
    cmbListaLetras.Clear
    Ngrado = Me.cmbListaNiveles.Text
    CodModalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.cmbListaModal.Text & "'", conn)
    Call llenacombo(Me.cmbListaLetras, "cursos", "let_cur", "where cod_ens = '" & CodModalidad & "' and num_gra = '" & Ngrado & "' and agno=" & Anno, conn)
    Me.cmbListaLetras.Enabled = True
    On Error GoTo continua
    cmbListaLetras.ListIndex = 0
    Me.grd_alumnos.Rows = 1
    cmbListaLetras_Click
continua:
End Sub

Private Sub Form_Load()
    Flag_sub = False
    grd_alumnos.ColAlignment(0) = 1
    grd_alumnos.ColWidth(0) = 3500
    grd_alumnos.ColWidth(1) = 1000
    grd_alumnos.ColWidth(2) = 800
    grd_alumnos.ColWidth(7) = 2000
    grd_alumnos.ColWidth(9) = 0
    Call llenacombo(Me.cmbListaModal, "codigos_ensenanza ce", "distinct ce.des_ens", "order by ce.ord_ens", conn)
    sql = "CREATE TABLE IF NOT EXISTS `elimina_asistencia_actas` ( " & _
          " `ci_alu` varchar(100) NOT NULL default ''," & _
          " `agno` int(11) NOT NULL default '0'," & _
          " `curso` varchar(100) NOT NULL default ''," & _
          " `porcentaje_inasistencias` varchar(100) NOT NULL default ''," & _
          " `concepto` varchar(100) NOT NULL default ''," & _
          " `numero_decreto` double NOT NULL default '0'," & _
          " PRIMARY KEY  (`ci_alu`,`agno`)" & _
          " ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"
    conn.Execute sql
End Sub

Private Sub grd_alumnos_DblClick()
    Dim var_sql As String
    If grd_alumnos.TextMatrix(grd_alumnos.Row, 9) = 1 Then
        frm_justifica.Visible = True
        dias = (grd_alumnos.TextMatrix(grd_alumnos.Row, 5) * 85) / 100
        dias = dias - grd_alumnos.TextMatrix(grd_alumnos.Row, 3)
        If dias < 1 Then
            dias = 1
        End If
        lbl_justifica.Caption = "Dias a justificar " & FormatNumber(dias, 0)
    Else
        If grd_alumnos.TextMatrix(grd_alumnos.Row, 9) = 2 Then
            If MsgBox("La inasistencia del alumno ya ha sido justificada ¿Desea eliminar esta justificación?", vbQuestion + vbYesNo, "GesCol") = vbYes Then
                'grd_alumnos.TextMatrix(grd_alumnos.Row, 1) & "'," & Anno & ",'" & grd_alumnos.TextMatrix(grd_alumnos.Row, 2) & "
                var_sql = "delete from elimina_asistencia_actas where ci_alu = '" & grd_alumnos.TextMatrix(grd_alumnos.Row, 1) & "' and agno = " & Anno & " and curso = '" & grd_alumnos.TextMatrix(grd_alumnos.Row, 2) & "'"
                conn.Execute var_sql
                MsgBox "La justificación de inasistencia del alumno fue eliminada", vbInformation, "GesCol"
                cmb_cambia_Click
            End If
        Else
            MsgBox "Alumno no necesita justificar inasistencias", vbInformation, "GesCol"
        End If
    End If
End Sub

Private Sub list_nombre_Click()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    txt_nombre.Text = list_nombre.Text
    list_nombre.Visible = False
    list_rut.Visible = False
    RC.Open "SELECT ci_alu FROM postulantes WHERE left(CONCAT(ape_Pat_alu,' ',ape_Mat_alu,' ',nom_alu)," & Len(txt_nombre.Text) & ")='" & txt_nombre.Text & "' ORDER BY ape_pat_alu, ape_mat_alu, nom_alu;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_rut.Text = RC("ci_alu")
    RC.Close
    Flag_sub = False
    txt_rut.Locked = True
    txt_nombre.Locked = True
    llena_info_adicional
End Sub

Private Sub list_rut_Click()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    
    txt_rut.Text = list_rut.Text
    list_nombre.Visible = False
    list_rut.Visible = False
    RC.Open "SELECT CONCAT(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) as nombre_alu FROM postulantes WHERE ci_alu='" & txt_rut.Text & "' ORDER BY ci_alu;", conn
    RC.MoveFirst
    Flag_sub = True
    txt_nombre.Text = RC("nombre_alu")
    RC.Close
    Flag_sub = False
    txt_nombre.Locked = True
    txt_rut.Locked = True
    llena_info_adicional
End Sub

Private Sub txt_nombre_Change()
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If txt_nombre.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(txt_nombre.Text) & ")='" & txt_nombre.Text & "' AND a.ci_alu=m.ci_alu ORDER BY a.ape_pat_alu, a.ape_mat_alu, a.nom_alu;", conn
    list_nombre.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            list_nombre.AddItem RC("ape_pat_alu") & " " & RC("ape_mat_alu") & " " & RC("nom_alu")
            RC.MoveNext
        Wend
        list_nombre.Visible = True
        list_rut.Visible = False
    End If
    RC.Close
End Sub

Private Sub txt_rut_Change()
    Dim RC As ADODB.Recordset
    ' Si el cambio lo hace un Sub no hacer nada
    If Flag_sub Then Exit Sub
    If txt_rut.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(txt_rut.Text) & ")='" & txt_rut.Text & "' AND a.ci_alu=m.ci_alu ORDER BY a.ci_alu;", conn
    list_rut.Clear
    If RC.RecordCount > 0 Then
        While Not (RC.EOF)
            list_rut.AddItem RC("ci_alu")
            RC.MoveNext
        Wend
        list_nombre.Visible = False
        list_rut.Visible = True
    End If
    RC.Close
End Sub

Private Sub llena_info_adicional()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    Dim RC2 As ADODB.Recordset
    Set RC2 = New ADODB.Recordset
    Dim I As Integer
    If chkcurso.Value Then
        Ngrado = Me.cmbListaNiveles.Text
        CodModalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.cmbListaModal.Text & "'", conn)
        sql = "SELECT ac.ci_alu, ac.let_cur, ac.cod_ens, ac.num_gra, ce.cod_des, concat(p.ape_pat_alu,' ',p.ape_mat_alu,' ',p.nom_alu) as nombre FROM alu_x_cur as ac, postulantes as p, codigos_ensenanza as ce WHERE ac.cod_ens = " & CodModalidad & " AND ac.num_gra = " & Ngrado & " AND ac.let_cur = '" & cmbListaLetras.Text & "' AND p.ci_alu = ac.ci_alu AND ac.activo_alu = 'SI' AND fec_cam = '1111-11-11' AND ce.cod_ens = ac.cod_ens AND ac.agno = " & Anno
    Else
        sql = "SELECT ac.ci_alu, ac.let_cur, ac.cod_ens, ac.num_gra, ce.cod_des, concat(p.ape_pat_alu,' ',p.ape_mat_alu,' ',p.nom_alu) as nombre FROM alu_x_cur as ac, postulantes as p, codigos_ensenanza as ce WHERE ac.ci_alu = '" & txt_rut.Text & "' AND p.ci_alu = ac.ci_alu AND ac.activo_alu = 'SI' AND fec_cam = '1111-11-11' AND ce.cod_ens = ac.cod_ens AND ac.agno = " & Anno
    End If
    RC.Open sql, conn
    grd_alumnos.Rows = 1
    I = 1
    While Not RC.EOF
        grd_alumnos.Rows = I + 1
        grd_alumnos.TextMatrix(I, 0) = RC("nombre")
        grd_alumnos.TextMatrix(I, 1) = RC("ci_alu")
        grd_alumnos.TextMatrix(I, 2) = RC("num_gra") & RC("let_cur") & " " & RC("cod_des")
        RC2.Open "SELECT sum(asi_r) as ideal, sum(asi_t) as reales  FROM `asistencia`  where ci_alu =  '" & RC("ci_alu") & "' and agno=" & Anno, conn
        If IsNull(RC2("ideal")) Then
            grd_alumnos.TextMatrix(I, 3) = 0
            grd_alumnos.TextMatrix(I, 4) = 0
            grd_alumnos.TextMatrix(I, 5) = 0
            grd_alumnos.TextMatrix(I, 9) = 0
            grd_alumnos.TextMatrix(I, 6) = "100%"
        Else
            grd_alumnos.TextMatrix(I, 3) = RC2("reales")
            grd_alumnos.TextMatrix(I, 4) = RC2("ideal") - RC2("reales")
            grd_alumnos.TextMatrix(I, 5) = RC2("ideal")
            grd_alumnos.TextMatrix(I, 9) = 0
            dias = (RC2("reales") * 100) / RC2("ideal")
            grd_alumnos.TextMatrix(I, 6) = FormatNumber(dias, 1) & "%"
            If dias < 85 Then
                grd_alumnos.Row = I
                grd_alumnos.TextMatrix(I, 9) = 1
                For k = 0 To 8
                    grd_alumnos.Col = k
                    grd_alumnos.CellBackColor = &HFFC0C0
                Next k
            End If
        End If
        RC2.Close
        RC2.Open "SELECT * FROM elimina_asistencia_actas WHERE ci_alu = '" & RC("ci_alu") & "' and agno = " & Anno, conn
        If RC2.RecordCount > 0 Then
            grd_alumnos.TextMatrix(I, 7) = RC2("concepto")
            grd_alumnos.TextMatrix(I, 8) = RC2("numero_decreto")
            grd_alumnos.Row = I
            grd_alumnos.TextMatrix(I, 9) = 2
            For k = 0 To 8
                grd_alumnos.Col = k
                grd_alumnos.CellBackColor = &HC0FFFF
            Next k
        End If
        RC2.Close
        I = I + 1
        RC.MoveNext
    Wend
    grd_alumnos.Row = 0

End Sub
