VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form_valida_curso 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Validar Asignaturas para Actas Finales"
   ClientHeight    =   8175
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9885
   Icon            =   "Form_valida_curso.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   8175
   ScaleWidth      =   9885
   Begin VB.Frame Frame1 
      Caption         =   "Listado de Asignaturas"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   5415
      Left            =   120
      TabIndex        =   8
      Top             =   2640
      Width           =   9615
      Begin VB.CommandButton Btn_Limpiar 
         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
         Index           =   3
         Left            =   8040
         TabIndex        =   21
         Top             =   4920
         Width           =   1455
      End
      Begin VB.CommandButton Btn_Limpiar 
         Caption         =   "Guardar Cambios"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   2
         Left            =   6120
         TabIndex        =   20
         Top             =   4920
         Width           =   1815
      End
      Begin MSFlexGridLib.MSFlexGrid grd_asignaturas 
         Height          =   4335
         Left            =   120
         TabIndex        =   9
         Top             =   360
         Width           =   9375
         _ExtentX        =   16536
         _ExtentY        =   7646
         _Version        =   393216
         Cols            =   4
         FixedCols       =   0
         BackColor       =   16777215
         FocusRect       =   0
         SelectionMode   =   1
         FormatString    =   $"Form_valida_curso.frx":2A8B2
         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.Shape Shape1 
         BackColor       =   &H00FFFFFF&
         BackStyle       =   1  'Opaque
         FillColor       =   &H000000FF&
         Height          =   255
         Index           =   1
         Left            =   360
         Shape           =   1  'Square
         Top             =   4920
         Width           =   255
      End
      Begin VB.Label Label10 
         Caption         =   "Asignatura a eliminar"
         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        =   23
         Top             =   4920
         Width           =   2415
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H000000FF&
         BackStyle       =   1  'Opaque
         FillColor       =   &H000000FF&
         Height          =   255
         Index           =   0
         Left            =   3000
         Shape           =   1  'Square
         Top             =   4920
         Width           =   255
      End
      Begin VB.Label Label10 
         Caption         =   "Asignatura sin problemas"
         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            =   720
         TabIndex        =   22
         Top             =   4920
         Width           =   2055
      End
   End
   Begin VB.Frame Frame_Sub_Nuevos 
      Caption         =   "Seleccione 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          =   2415
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   9615
      Begin VB.CommandButton Btn_Limpiar 
         Caption         =   "Buscar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   1
         Left            =   3240
         TabIndex        =   19
         Top             =   1320
         Width           =   1215
      End
      Begin VB.ComboBox cmb_anho_letras 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1560
         Style           =   2  'Dropdown List
         TabIndex        =   13
         Top             =   360
         Width           =   1335
      End
      Begin VB.Frame Frame2 
         Caption         =   "Información del 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          =   1455
         Left            =   4800
         TabIndex        =   10
         Top             =   240
         Width           =   4695
         Begin VB.Label lb_validado 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H00000000&
            Height          =   255
            Left            =   1200
            TabIndex        =   18
            Top             =   1080
            Width           =   3360
         End
         Begin VB.Label lb_count 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   1680
            TabIndex        =   17
            Top             =   720
            Width           =   2880
         End
         Begin VB.Label lb_prof 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   1560
            TabIndex        =   16
            Top             =   360
            Width           =   2880
         End
         Begin VB.Label Label4 
            Caption         =   "Validado :"
            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        =   15
            Top             =   1080
            Width           =   1575
         End
         Begin VB.Label Label2 
            Caption         =   "Cantidad 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        =   12
            Top             =   720
            Width           =   1575
         End
         Begin VB.Label Label1 
            Caption         =   "Profesor Jefe :"
            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             =   360
            Width           =   1215
         End
      End
      Begin VB.ComboBox Cmb_NumGra_LEtras 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1560
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   1320
         Width           =   1335
      End
      Begin VB.ComboBox Cmb_CodEns_Letras 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1560
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   840
         Width           =   2895
      End
      Begin VB.ComboBox Cmb_LetCur_Ant 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1560
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   1800
         Width           =   1335
      End
      Begin VB.CommandButton Btn_Limpiar 
         Caption         =   "Limpiar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   0
         Left            =   3240
         TabIndex        =   1
         Top             =   1800
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "Año Escolar"
         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             =   360
         Width           =   975
      End
      Begin VB.Label Label6 
         Caption         =   "Tipo 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
         Index           =   0
         Left            =   240
         TabIndex        =   7
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label6 
         Caption         =   "Grado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   6
         Top             =   1320
         Width           =   1095
      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
         Index           =   2
         Left            =   240
         TabIndex        =   5
         Top             =   1800
         Width           =   735
      End
   End
End
Attribute VB_Name = "Form_valida_curso"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ACodens() As Variant
Dim Aagno() As Variant

Private Sub Btn_Limpiar_Click(Index As Integer)
    Select Case Index
        Case 0: grd_asignaturas.Rows = 1
                Cmb_LetCur_Ant.Enabled = True
                Cmb_NumGra_LEtras.Enabled = True
                Cmb_CodEns_Letras.Enabled = True
                cmb_anho_letras.Enabled = True
                lb_count.Caption = ""
                lb_validado.Caption = ""
                lb_prof.Caption = ""
        Case 1: Llena_Tabla
                Cmb_LetCur_Ant.Enabled = False
                Cmb_NumGra_LEtras.Enabled = False
                Cmb_CodEns_Letras.Enabled = False
                cmb_anho_letras.Enabled = False
        Case 2: Cambia_Cursos
        Case 3: Unload Me
        End Select
End Sub

Private Sub Cmb_CodEns_Letras_Click()
    Dim t As Integer, nivel As Integer
    If Me.Cmb_CodEns_Letras <> "" Then
            nivel = devuelvecampo("codigos_ensenanza", "", "num_gra_max", "cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "'", conn)
            Me.Cmb_NumGra_LEtras.Clear
            For t = 1 To Val(nivel)
                Me.Cmb_NumGra_LEtras.AddItem t
            Next t
    End If
End Sub

Private Sub Cmb_NumGra_LEtras_Click()
    If cmb_anho_letras.Text = "" Then MsgBox "Debe ingresar el año de proceso": Cmb_NumGra_LEtras.Text = "": Exit Sub
    Me.Cmb_LetCur_Ant.Clear
    Ngrado = Me.Cmb_NumGra_LEtras.Text
    CodModalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.Cmb_CodEns_Letras.Text & "'", conn)
    Call llenacombo(Me.Cmb_LetCur_Ant, "cursos", "let_cur", "where cod_ens = '" & CodModalidad & "' and num_gra = '" & Ngrado & "' and agno = " & cmb_anho_letras.Text, conn)
End Sub

Private Sub Form_Load()
    grd_asignaturas.TextMatrix(0, 0) = "Subsector"
    grd_asignaturas.TextMatrix(0, 1) = "Profesor"
    grd_asignaturas.TextMatrix(0, 2) = "Aprobada"
    grd_asignaturas.Cols = 5
    grd_asignaturas.ColWidth(0) = 4000
    grd_asignaturas.ColWidth(1) = 4000
    grd_asignaturas.ColWidth(2) = 1000
    grd_asignaturas.ColWidth(3) = 0
    grd_asignaturas.ColWidth(4) = 0
    
    Call llenacomboconarreglo(Me.Cmb_CodEns_Letras, "codigos_ensenanza order by ord_ens", "des_ens", "cod_ens", ACodens(), conn)
    Call llenacomboconarreglo(Me.cmb_anho_letras, "cursos group by agno", "agno", "agno", Aagno(), conn)

End Sub

Private Sub Llena_Tabla()
    Dim RC As ADODB.Recordset
    Set RC = New ADODB.Recordset
    Dim i As Integer
    
    lb_count.Caption = devuelvecampo("alu_x_cur", "", "count(ci_alu)", "  cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and let_cur = '" & Cmb_LetCur_Ant.Text & "'  and activo_alu = 'SI' and fec_cam = '1111-11-11' and agno = " & cmb_anho_letras.Text, conn)
    lb_validado.Caption = IIf(IsNull(devuelvecampo("cursos", "", "valida", "  cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and let_cur = '" & Cmb_LetCur_Ant.Text & "'  and agno = " & cmb_anho_letras.Text, conn)), "NO", devuelvecampo("cursos", "", "valida", " cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and let_cur = '" & Cmb_LetCur_Ant.Text & "'  and agno = " & cmb_anho_letras.Text, conn))
    lb_prof.Caption = devuelvecampo("cursos axc, profesores p", "", "p.noms_prof", "  cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and let_cur = '" & Cmb_LetCur_Ant.Text & "' and axc.rut_prof = p.rut_prof  and agno = " & cmb_anho_letras.Text, conn)
    If lb_validado.Caption = "SI" Then
        lb_validado.ForeColor = &H0&
    Else
        lb_validado.ForeColor = &HFF&
    End If
    sql = "select distinct n.cod_ens, n.num_gra, n.letra_curso, n.cod_sec, n.cod_asi, ss.nom_asi, ss.ord_asi from notas n, subsectores ss  where n.cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and n.num_gra = '" & Cmb_NumGra_LEtras.Text & "' and n.letra_curso = '" & Cmb_LetCur_Ant.Text & "' and n.cod_sec = ss.cod_sec and n.cod_asi = ss.cod_asi and n.cod_ens = ss.cod_ens and n.num_gra = ss.num_gra and n.agno =  " & cmb_anho_letras.Text & " order by ss.ord_asi;"
    RC.Open sql, conn
    i = 1
    While Not RC.EOF
        grd_asignaturas.Rows = i + 1
        grd_asignaturas.TextMatrix(i, 0) = RC("nom_asi")
        grd_asignaturas.TextMatrix(i, 4) = RC("cod_asi")
        grd_asignaturas.TextMatrix(i, 3) = RC("cod_sec")
        grd_asignaturas.TextMatrix(i, 1) = devuelvecampo("asi_x_cur_prof axc, profesores p", "", "concat(p.noms_prof,' ',p.ape1_prof,' ',p.ape2_prof) as noms_prof", "  cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and let_cur = '" & Cmb_LetCur_Ant.Text & "' and cod_sec = '" & RC("cod_sec") & "' and cod_asi = '" & RC("cod_asi") & "' and axc.rut_prof = p.rut_prof and axc.agno = " & cmb_anho_letras.Text, conn)
        grd_asignaturas.Row = i
        If lb_validado.Caption = "SI" Then
            grd_asignaturas.TextMatrix(i, 2) = "SI"
            For j = 0 To 4
                grd_asignaturas.Col = j
                grd_asignaturas.CellBackColor = &HFFFFFF
            Next j
        Else
            grd_asignaturas.TextMatrix(i, 2) = "NO"
            For j = 0 To 4
                grd_asignaturas.Col = j
                grd_asignaturas.CellBackColor = &HFF&
            Next j
        End If

        RC.MoveNext
        i = i + 1
    Wend
    RC.Close
End Sub


Private Sub grd_asignaturas_DblClick()
    If grd_asignaturas.TextMatrix(grd_asignaturas.Row, 2) = "SI" Then
        grd_asignaturas.TextMatrix(grd_asignaturas.Row, 2) = "NO"
        For i = 0 To 4
            grd_asignaturas.Col = i
            grd_asignaturas.CellBackColor = &HFF&
        Next i
        
    Else
        grd_asignaturas.TextMatrix(grd_asignaturas.Row, 2) = "SI"
        For i = 0 To 4
            grd_asignaturas.Col = i
            grd_asignaturas.CellBackColor = &HFFFFFF
        Next i
    End If
End Sub

Private Sub Cambia_Cursos()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim RutProfe As String
    Dim var_sql As String
    Dim grado As String
    Dim curso As String
    Dim accion_realizada As String
    Dim log As Boolean
    Dim accion As String
    Dim linea As String
    linea = "______________________________________________________________________________________________________________________"
    If MsgBox("Con esta accion usted eliminara los cursos que no se encuentran validados " & vbCrLf & vbLf & " Desea Continuar", vbQuestion + vbYesNo) = vbNo Then Exit Sub
    If MsgBox("Esta seguro que Desea eliminar las asignaturas seleccionadas? " & vbCrLf & vbLf & " Desea Continuar", vbQuestion + vbYesNo) = vbNo Then Exit Sub
    Dim i, count As Integer
    count = 0
    accion = ""
    For i = 1 To grd_asignaturas.Rows - 1
        If grd_asignaturas.TextMatrix(i, 2) = "NO" Then
            sql = "DELETE FROM notas WHERE cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and letra_curso = '" & Cmb_LetCur_Ant.Text & "' and cod_sec = '" & grd_asignaturas.TextMatrix(i, 3) & "' and cod_asi = '" & grd_asignaturas.TextMatrix(i, 4) & "' and agno = " & cmb_anho_letras.Text
            conn.Execute sql, Affected
            accion = accion & "SQL : " & sql & vbCrLf & vbLf & "Modificados :" & Affected & vbCrLf & vbLf & linea & vbCrLf & vbLf
            count = count + 1
            sql = "DELETE FROM promedios WHERE cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and letra_curso = '" & Cmb_LetCur_Ant.Text & "' and cod_sec = '" & grd_asignaturas.TextMatrix(i, 3) & "' and cod_asi = '" & grd_asignaturas.TextMatrix(i, 4) & "' and agno = " & cmb_anho_letras.Text
            conn.Execute sql, Affected
            accion = accion & "SQL : " & sql & vbCrLf & vbLf & "Modificados :" & Affected & vbCrLf & vbLf & linea & vbCrLf & vbLf
            sql = "DELETE FROM asi_x_cur_prof WHERE cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and let_cur = '" & Cmb_LetCur_Ant.Text & "' and cod_sec = '" & grd_asignaturas.TextMatrix(i, 3) & "' and cod_asi = '" & grd_asignaturas.TextMatrix(i, 4) & "' and agno = " & cmb_anho_letras.Text
            conn.Execute sql, Affected
            accion = accion & "SQL : " & sql & vbCrLf & vbLf & "Modificados :" & Affected & vbCrLf & vbLf & linea & vbCrLf & vbLf
        End If
    Next i
    MsgBox "Un total de " & count & " Asignaturas fueron eliminadas del curso " & Cmb_NumGra_LEtras.Text & " " & Cmb_LetCur_Ant.Text, vbCritical
    sql = "UPDATE cursos SET valida = 'SI' WHERE cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = '" & Cmb_NumGra_LEtras.Text & "' and let_cur = '" & Cmb_LetCur_Ant.Text & "' and agno = " & cmb_anho_letras.Text
    conn.Execute sql, Affected
    accion = accion & "SQL : " & sql & vbCrLf & vbLf & "Modificados :" & Affected & vbCrLf & vbLf & linea & vbCrLf & vbLf
    accion = accion & "Un total de " & count & " Asignaturas fueron eliminadas del curso " & Cmb_NumGra_LEtras.Text & " " & Cmb_LetCur_Ant.Text & vbCrLf & vbLf & linea & vbCrLf & vbLf
    
    'Log de validación de curso
    Select Case ACodens(Me.Cmb_CodEns_Letras.ListIndex)
        Case "996"
            grado = "PK"
        Case "010"
            grado = "K"
        Case "110"
            grado = "EB"
        Case "310"
            grado = "EM"
    End Select
    
    var_sql = "SELECT rut_prof FROM cursos" _
        & " where cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = " & Cmb_NumGra_LEtras.Text _
        & " and let_cur = '" & Cmb_LetCur_Ant.Text & "' and agno = " & cmb_anho_letras.Text
    objRS.Open var_sql, conn
    RutProfe = objRS("rut_prof")
    objRS.Close
    
    curso = CStr(Cmb_NumGra_LEtras.Text) & "º " & Cmb_LetCur_Ant.Text & " " & grado
    accion_realizada = "Se a validado el curso " & curso _
                     & " para el año " & cmb_anho_letras.Text _
                     & " con profesor jefe " & lb_prof
                     
    log = Inserta_Vitacora_Profesores(Trim(RutProfe), "Validación de curso", Trim(accion_realizada))
    'Fin de log
    
    genera_log accion
    Llena_Tabla
End Sub

Private Sub genera_log(accion As Variant)
    sql = "CREATE TABLE IF NOT EXISTS `asignaturas_log`(`id` bigint(20) NOT NULL auto_increment,`LOGIN_USUARIO` varchar(100) NOT NULL default '',`NOMBRE_USUARIO` varchar(100) NOT NULL default '',`agno` int(11) NOT NULL default '0',`ACCION` text NOT NULL default '',`FECHA_MODIFICACION` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY  (`id`),UNIQUE KEY `asignaturas_log_sec_key` (`FECHA_MODIFICACION`,`LOGIN_USUARIO`)) ENGINE=MyISAM;"
    conn.Execute sql
    sql = "INSERT INTO asignaturas_log (LOGIN_USUARIO,NOMBRE_USUARIO,AGNO,FECHA_MODIFICACION,ACCION) values ('" & Nom_usu_ses & "','" & Nom_com_usu_ses & "',year(current_date),concat(current_date,' ',current_time),'" & Replace(accion, "'", "\'") & "')"
    conn.Execute sql
End Sub
