VERSION 5.00
Begin VB.Form Form_observacion_registro 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Observación de registro de matriculas"
   ClientHeight    =   2490
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   9645
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2490
   ScaleWidth      =   9645
   Begin VB.ListBox lst_Alumnos 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   900
      Left            =   720
      TabIndex        =   1
      Top             =   600
      Visible         =   0   'False
      Width           =   4695
   End
   Begin VB.ListBox lst_Rut 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   900
      Left            =   6480
      TabIndex        =   0
      Top             =   600
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "Asignar observación"
      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            =   0
      TabIndex        =   9
      Top             =   960
      Width           =   8055
      Begin VB.ComboBox cb_ubicacion 
         Height          =   315
         Left            =   1320
         TabIndex        =   14
         Top             =   840
         Width           =   5415
      End
      Begin VB.CommandButton Command1 
         Caption         =   "Asignar"
         Height          =   495
         Left            =   6840
         TabIndex        =   13
         Top             =   360
         Width           =   1095
      End
      Begin VB.TextBox txt_observacion 
         Height          =   285
         Left            =   1320
         MaxLength       =   50
         MultiLine       =   -1  'True
         TabIndex        =   10
         Top             =   360
         Width           =   5415
      End
      Begin VB.Label Label3 
         Caption         =   "Ubicación"
         Height          =   375
         Left            =   120
         TabIndex        =   12
         Top             =   840
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "Observación"
         Height          =   375
         Left            =   120
         TabIndex        =   11
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.CommandButton btnOtroProfesor 
      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          =   855
      Left            =   8280
      Picture         =   "Form_observacion_registro.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   120
      Width           =   1215
   End
   Begin VB.CommandButton btn_Cancelar 
      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            =   8280
      Picture         =   "Form_observacion_registro.frx":0576
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Frame Frame_Apo_Caja 
      Caption         =   "Datos 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          =   735
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   8055
      Begin VB.TextBox txt_RutBusqueda 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   6480
         TabIndex        =   4
         Top             =   360
         Width           =   1335
      End
      Begin VB.TextBox txt_NombreCompleto 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   720
         TabIndex        =   3
         Top             =   360
         Width           =   4695
      End
      Begin VB.Label Label2 
         Caption         =   "R.u.t."
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5880
         TabIndex        =   6
         Top             =   360
         Width           =   615
      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            =   120
         TabIndex        =   5
         Top             =   360
         Width           =   735
      End
   End
End
Attribute VB_Name = "Form_observacion_registro"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Btn_Cancelar_Click()
    Unload Me
End Sub

Private Sub btnOtroProfesor_Click()
    txt_RutBusqueda.Locked = False
    txt_NombreCompleto.Locked = False
    txt_RutBusqueda.Text = ""
    txt_NombreCompleto.Text = ""
   ' Option1.Value = False
   ' Option2.Value = False
   cb_ubicacion.Text = ""
   txt_observacion.Text = ""
   lst_Rut.Visible = False
   lst_Alumnos.Visible = False
End Sub



Private Sub Command1_Click()
    var_sql = "UPDATE matriculas SET local_escolar = '" & cb_ubicacion & "' WHERE anno_mat = " & Anno & " AND ci_alu = '" & txt_RutBusqueda & "'"
    conn.Execute var_sql
    var_sql = "UPDATE alu_x_cur SET observaciones = '" & txt_observacion & "' WHERE agno = " & Anno & " AND ci_alu = '" & txt_RutBusqueda & "'"
    conn.Execute var_sql
    MsgBox "La observación fue agregada satisfactoriamente.", vbInformation
End Sub

Private Sub Form_Load()
    cb_ubicacion.AddItem "PRINCIPAL"
    cb_ubicacion.AddItem "ANEXO"
    
    CODBC = devuelvecampo("cfg", "", "valor", "param = 'CODBC'", conn)
    
    If CODBC <> "LON001" And CODBC <> "LIN001" Then
        cb_ubicacion.Visible = False
        Label3.Visible = False
    End If
    
End Sub

Private Sub lst_Alumnos_dblClick()
    'Dim dig As String
    'dig = digito(lst_Alumnos.ItemData(lst_Alumnos.ListIndex))
    'Dim Rut As String
    Dim varsql As String
    
    'Rut = lst_Alumnos.ItemData(lst_Alumnos.ListIndex) & "-" & dig
    
    Dim objRS As ADODB.Recordset
    varsql = "SELECT p.ci_alu" _
           & " FROM postulantes as p,matriculas as c where concat(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) = '" _
           & lst_Alumnos.Text & "' and p.ci_alu = c.ci_alu and c.anno_mat = " & Anno

    Set objRS = New ADODB.Recordset
    objRS.Open varsql, conn
    If Not objRS.EOF Then
        txt_NombreCompleto.Text = lst_Alumnos.Text
        txt_RutBusqueda.Text = objRS("ci_alu")
    End If
    objRS.Close
    lst_Rut.Clear
    lst_Rut.Visible = False
    If txt_RutBusqueda.Text <> "" And txt_NombreCompleto.Text <> "" Then
        txt_RutBusqueda.Locked = True
        txt_NombreCompleto.Locked = True
    End If
  '  Option1.Value = False
  '  Option2.Value = False
   ' Option3.Value = False
   ' lbl_porcentaje.Visible = False
   ' txt_porcentaje.Text = ""
    'txt_porcentaje.Visible = False
    
    CODBC = devuelvecampo("cfg", "", "valor", "param = 'CODBC'", conn)
    
    If CODBC = "LON001" Or CODBC = "LIN001" Then
        varsql = "SELECT local_escolar FROM matriculas WHERE anno_mat = " & Anno & " AND ci_alu = '" & txt_RutBusqueda.Text & "'"
        objRS.Open varsql, conn
        cb_ubicacion.Text = objRS("local_escolar")
        objRS.Close
    End If
    
    varsql = "SELECT observaciones FROM alu_x_cur WHERE agno = " & Anno & " AND ci_alu = '" & txt_RutBusqueda.Text & "'"
    objRS.Open varsql, conn
    If Not objRS.EOF Then
    txt_observacion.Text = objRS("observaciones")
    End If
    objRS.Close
    

    
End Sub

'Private Sub lst_Alumnos_LostFocus()
'    Dim objRS As ADODB.Recordset
'    Set objRS = New ADODB.Recordset
'
'    var_sql = "select * from matriculas WHERE " & _
'            "ci_alu='" & Trim(txt_RutBusqueda.Text) & "' AND " & _
'            " anno_mat='" & Anno & "' order by fec_mat desc LIMIT 1;"
'    objRS.Open var_sql, conn
'
'    If objRS("tercio") = "SI" Then
'        Option1.Value = False
'        Option2.Value = True
'    Else
'        Option1.Value = True
'        Option2.Value = False
'    End If
'
'    objRS.Close
'End Sub

Private Sub lst_Alumnos_LostFocus()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim varsql As String
    
    CODBC = devuelvecampo("cfg", "", "valor", "param = 'CODBC'", conn)
    
    If CODBC = "LON001" Or CODBC = "LIN001" Then
        varsql = "SELECT local_escolar FROM matriculas WHERE anno_mat = " & Anno & " AND ci_alu = '" & txt_RutBusqueda.Text & "'"
        objRS.Open varsql, conn
        cb_ubicacion.Text = objRS("local_escolar")
        objRS.Close
    End If
    
    varsql = "SELECT observaciones FROM alu_x_cur WHERE agno = " & Anno & " AND ci_alu = '" & txt_RutBusqueda.Text & "'"
    objRS.Open varsql, conn
    If Not objRS.EOF Then
    txt_observacion.Text = objRS("observaciones")
    End If
    objRS.Close
    
End Sub

Private Sub lst_Rut_DblClick()
    txt_RutBusqueda.Text = lst_Rut.Text
    lst_Rut.Visible = False
    Dim objRS As ADODB.Recordset
    Dim varsql As String
    varsql = "SELECT ape_pat_alu,ape_mat_alu,nom_alu" _
           & " FROM postulantes p,matriculas m where" _
           & " m.ci_alu='" & txt_RutBusqueda.Text & "' and " _
           & " p.ci_alu = m.ci_alu and anno_mat = " & Anno

    Set objRS = New ADODB.Recordset
        objRS.Open varsql, conn
    If Not objRS.EOF Then
        txt_NombreCompleto.Text = objRS("ape_pat_alu") & " " & objRS("ape_mat_alu") & " " & objRS("nom_alu")
    End If
    objRS.Close
    lst_Alumnos.Visible = False
    lst_Rut.Clear
    If txt_RutBusqueda.Text <> "" And txt_NombreCompleto.Text <> "" Then
        txt_RutBusqueda.Locked = True
        txt_NombreCompleto.Locked = True
    End If
    'Option1.Value = False
    'Option2.Value = False

End Sub

'Private Sub lst_Rut_LostFocus()
'    Dim objRS As ADODB.Recordset
'    Set objRS = New ADODB.Recordset
'
'    var_sql = "select * from matriculas WHERE " & _
'            "ci_alu='" & Trim(txt_RutBusqueda.Text) & "' AND " & _
'            " anno_mat='" & Anno & "' order by fec_mat desc LIMIT 1;"
'    objRS.Open var_sql, conn
'
'    If objRS("tercio") = "SI" Then
'        Option1.Value = False
'        Option2.Value = True
'    Else
'        Option1.Value = True
'        Option2.Value = False
'    End If
'
'    objRS.Close
'End Sub

Private Sub lst_Rut_LostFocus()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim varsql As String
    
    CODBC = devuelvecampo("cfg", "", "valor", "param = 'CODBC'", conn)
    
    If CODBC = "LON001" Or CODBC = "LIN001" Then
        varsql = "SELECT local_escolar FROM matriculas WHERE anno_mat = " & Anno & " AND ci_alu = '" & txt_RutBusqueda.Text & "'"
        objRS.Open varsql, conn
        cb_ubicacion.Text = objRS("local_escolar")
        objRS.Close
    End If
    
    varsql = "SELECT observaciones FROM alu_x_cur WHERE agno = " & Anno & " AND ci_alu = '" & txt_RutBusqueda.Text & "'"
    objRS.Open varsql, conn
    If Not objRS.EOF Then
        txt_observacion.Text = objRS("observaciones")
    End If
    objRS.Close
End Sub

'Private Sub Option1_Click()
'    lbl_porcentaje.Visible = True
'    txt_porcentaje.Visible = True
'End Sub

'Private Sub Option2_Click()
'    lbl_porcentaje.Visible = True
'    txt_porcentaje.Visible = True
'End Sub

'Private Sub Option3_Click()
'    lbl_porcentaje.Visible = False
'    txt_porcentaje.Visible = False
'End Sub

Private Sub txt_NombreCompleto_Change()
    If txt_NombreCompleto.Text <> "" Then
    Dim varsql As String
    'lst_Rut.Visible = False
    Dim objRC As ADODB.Recordset
    Dim rut As Long
    Set objRS = New ADODB.Recordset
    varsql = "SELECT distinct p.CI_ALU,APE_PAT_ALU,APE_MAT_ALU,NOM_ALU" _
           & " FROM postulantes p,matriculas m" _
           & " where concat(APE_PAT_ALU,' ',ape_mat_alu,' ',nom_alu) LIKE '" & txt_NombreCompleto.Text & "%'" _
           & " and p.ci_alu = m.ci_alu and anno_mat = " & Anno _
           & " order by ape_pat_alu,ape_mat_alu,nom_alu"
    objRS.Open varsql, conn
    lst_Alumnos.Clear
    If Not objRS.EOF Then
        lst_Alumnos.Visible = True
    End If
    While Not objRS.EOF
        lst_Alumnos.AddItem objRS("APE_PAT_ALU") & " " & objRS("APE_MAT_ALU") & " " & objRS("NOM_ALU")
        rut = Mid(objRS("CI_ALU"), 1, 8)
        lst_Alumnos.ItemData(lst_Alumnos.NewIndex) = rut
        objRS.MoveNext
    Wend
    objRS.Close
    End If
End Sub

Private Sub txt_RutBusqueda_Change()
    If txt_RutBusqueda.Text <> "" Then
    Dim varsql As String
    lst_Rut.Visible = False
    lst_Alumnos.Visible = False
    Dim objRC As ADODB.Recordset
    Dim rut As Long
    Set objRS = New ADODB.Recordset
    varsql = "SELECT distinct m.CI_ALU" _
           & " FROM postulantes p,matriculas m" _
           & " where p.CI_ALU LIKE '" & txt_RutBusqueda & "%'" _
           & " and p.ci_alu = m.ci_alu and m.anno_mat = " & Anno
    objRS.Open varsql, conn
    lst_Rut.Clear
    If Not objRS.EOF Then
        lst_Rut.Visible = True
    End If
    While Not objRS.EOF
        lst_Rut.AddItem objRS("CI_ALU")
        objRS.MoveNext
    Wend
    objRS.Close
    End If
End Sub

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


