VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#4.6#0"; "crystl32.ocx"
Begin VB.Form Form_logs 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Historico de eventos"
   ClientHeight    =   2970
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7245
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2970
   ScaleWidth      =   7245
   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            =   4320
      TabIndex        =   0
      Top             =   600
      Visible         =   0   'False
      Width           =   1335
   End
   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           =   2895
   End
   Begin Crystal.CrystalReport CrystalReport1 
      Left            =   3720
      Top             =   960
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   262150
   End
   Begin VB.Frame Frame1 
      Caption         =   "Tipo de eventos"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1095
      Left            =   120
      TabIndex        =   9
      Top             =   1680
      Width           =   5655
      Begin VB.CommandButton Command1 
         Caption         =   "Imprimir eventos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   3960
         TabIndex        =   12
         Top             =   360
         Width           =   1455
      End
      Begin VB.OptionButton Option2 
         Caption         =   "Financieros"
         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             =   600
         Width           =   1575
      End
      Begin VB.OptionButton Option1 
         Caption         =   "Academicos"
         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        =   10
         Top             =   360
         Value           =   -1  'True
         Width           =   1935
      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            =   5880
      Picture         =   "Form_logs.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            =   5880
      Picture         =   "Form_logs.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           =   5775
      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            =   4320
         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           =   2895
      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            =   3840
         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_logs"
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
    lst_Rut.Visible = False
    lst_Alumnos.Visible = False
End Sub

'Private Sub cmd_ingresar_Click()
'    Dim objRS As ADODB.Recordset
'    Set objRS = New ADODB.Recordset
'    Dim tipo_anterior As String
'    Dim tipo_nuevo As String
'    Dim indice_media_beca As Integer
'    Dim indice_beca As Integer
'    Dim accion_realizada As String
'    Dim var_sql As String
'    Dim log As Boolean
'    Dim descuento_hermano As Long
'    Dim porcentaje As Integer
'    Dim sw As Boolean
'
'    If Option1.Value = False And Option2.Value = False Then
'        MsgBox "Debe seleccionar un tipo de Beca", vbInformation
'        Exit Sub
'    End If
'
'' If txt_porcentaje.Text = "" And Option3.Value <> True Then
''    MsgBox "Debe ingresar porcentaje de beca Beca", vbInformation
''    Exit Sub
'' End If
'
'
'    'Obtengo datos para log
'    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("ind_cup") = 1 Then tipo_anterior = "cuponera"
'    If objRS("ind_cheq") = 1 Then tipo_anterior = "cheque"
'    If objRS("ind_cont") = 1 Then tipo_anterior = "contado"
'    If objRS("ind_beca") = 1 Then tipo_anterior = "100% beca"
'    If objRS("ind_mbeca") = 1 Then tipo_anterior = "50% beca"
'    If objRS("ind_beca") = 1 Then porcentaje = 100
'    If objRS("ind_mbeca") = 1 Then porcentaje = 50
'
'    indice_media_beca = IIf(IsNull(objRS("ind_mbeca")), 0, objRS("ind_mbeca"))
'    indice_beca = IIf(IsNull(objRS("ind_beca")), 0, objRS("ind_beca"))
'
'    If Not (objRS("ind_beca") = 1 Or objRS("ind_mbeca") = 1) Then
'        objRS.Close
'        MsgBox "No se puede cambiar la beca, porque el alumno no cuenta con este beneficio", vbInformation
'        Exit Sub
'    End If
'    objRS.Close
'    'Fin obtengo log
'
''    ' Obtengo descuento hermano
''    var_sql = "SELECT monto_exen_hno" _
''            & " FROM fnza_detalle_mensualidad" _
''            & " where run_alu = '" & Trim(txt_RutBusqueda.Text) _
''            & "' and agno = " & Anno & " and mes = 4"
''    objRS.Open var_sql, conn
''    descuento_hermano = objRS("monto_exen_hno")
''    objRS.Close
''    ' Fin obtengo hermano
'
'    'If Option1.Value = True And (txt_porcentaje.Text = 100 Or txt_porcentaje.Text = 50) Then
'
'
'
'    If Option1.Value = True Then
'        var_sql = "update matriculas set tercio = 'NO'," _
'                & "tercio_por = 0" _
'                & " where ci_alu = '" & txt_RutBusqueda.Text & "' and anno_mat = 2011"
'        conn.Execute var_sql
'        var_sql = "update fnza_detalle_mensualidad set tercio = 'NO'" _
'                & " where run_alu = '" & txt_RutBusqueda.Text & "' and agno = 2011"
'        conn.Execute var_sql
'    Else
'        var_sql = "update matriculas set tercio = 'SI'," _
'                & "tercio_por = " & porcentaje _
'                & " where ci_alu = '" & txt_RutBusqueda.Text & "' and anno_mat = 2011"
'        conn.Execute var_sql
'        var_sql = "update fnza_detalle_mensualidad set tercio = 'SI'" _
'                & " where run_alu = '" & txt_RutBusqueda.Text & "' and agno = 2011"
'        conn.Execute var_sql
'    End If
'
'
'    Option1.Value = False
'    Option2.Value = False
''    Option3.Value = False
''    lbl_porcentaje.Visible = False
''    txt_porcentaje.Text = ""
''    txt_porcentaje.Visible = False
'    MsgBox "La Beca fue cambiada satisfactoriamente", vbInformation
'
'End Sub

Private Sub Command1_Click()
    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    
    var_sql = "SELECT if(nombre='Boston College Huechuraba','Huechuraba',nombre) as nombre,colegio" _
            & " From hist_cod_colegio" _
            & " where colegio = (select valor from cfg where param = 'codbc')"
    objRS.Open var_sql, conn
    colegio = objRS("colegio")
    nombre = objRS("nombre")
    objRS.Close
    
    
'''    CrystalReport1.ReportFileName = App.Path & "\rpt\inscritos_y_matriculados.rpt"
'''
'''    CrystalReport1.WindowState = crptMaximized
'''   'cr_perso.WindowTitle = "Informe De Desarrollo Personal y Social"
''''    cr_pre.ReplaceSelectionFormula ("")
'''    CrystalReport1.Formulas(1) = "establo = '" & nombre & "'"
''''    cr_perso.Formulas(1) = "fecha = '" & Format(Now, "dd/mm/yyyy") & "'"
''''    cr_perso.Formulas(2) = "hora = '" & Format(Now, "hh:mm AM/PM") & "'"
'''    'cr_perso.ReplaceSelectionFormula ("{pre_eval_cab.cod_ens}='" & xcod & "' and {pre_eval_cab.num_gra}='" & CInt(xnum_gra) & "' and {pre_eval_cab.let_cur}='" & xletra & "' and {pre_eval_cab.agno}=" & str(xagno)) & Per
'''    CrystalReport1.Destination = crptToWindow
'''
'''    CrystalReport1.ReplaceSelectionFormula ("")
'''    CrystalReport1.ReplaceSelectionFormula ("{alu_x_cur.ens}= '" & Codens & "'")
    
'''    CrystalReport1.Action = 1
    If Option1.Value = True Then
        CrystalReport1.ReportFileName = App.Path & "\rpt\log_alu.rpt"
        CrystalReport1.WindowState = crptMaximized
        CrystalReport1.Formulas(1) = "establo = '" & nombre & "'"
        CrystalReport1.Formulas(2) = "alumno = '" & txt_NombreCompleto.Text & "'"
        CrystalReport1.Destination = crptToWindow
        CrystalReport1.ReplaceSelectionFormula ("")
        CrystalReport1.ReplaceSelectionFormula ("{hist_vitacora_alumno.ci_alu}= '" & txt_RutBusqueda & "'")
        CrystalReport1.Action = 1
    Else
        CrystalReport1.ReportFileName = App.Path & "\rpt\log_fnza.rpt"
        CrystalReport1.WindowState = crptMaximized
        CrystalReport1.Formulas(1) = "establo = '" & nombre & "'"
        CrystalReport1.Formulas(2) = "alumno = '" & txt_NombreCompleto.Text & "'"
        CrystalReport1.Destination = crptToWindow
        CrystalReport1.ReplaceSelectionFormula ("")
        CrystalReport1.ReplaceSelectionFormula ("{fnza_historico_log.ci_alu}= '" & txt_RutBusqueda & "'")
        CrystalReport1.Action = 1
    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,alu_x_cur as c where concat(ape_pat_alu,' ',ape_mat_alu,' ',nom_alu) = '" _
           & lst_Alumnos.Text & "' and p.ci_alu = c.ci_alu and c.agno = " & 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
    

    
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_Rut_Click()
    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 "

    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 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" _
           & " 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"
    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


