VERSION 5.00
Begin VB.Form Form_NFicha_Inscripcion 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Inscribir Alumno"
   ClientHeight    =   5100
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   10635
   Icon            =   "Form_NFicha_Inscripcion.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5100
   ScaleWidth      =   10635
   Begin VB.Frame Frame2 
      Caption         =   "Alumno Actual"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   4815
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   3015
      Begin VB.CommandButton Command2 
         Caption         =   "Ver Ficha Postulación"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   720
         Picture         =   "Form_NFicha_Inscripcion.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   2520
         Width           =   1695
      End
      Begin VB.Frame Frame3 
         Caption         =   "Estado Inscrito"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   975
         Left            =   120
         TabIndex        =   12
         Top             =   3720
         Width           =   2775
         Begin VB.Label Label2 
            Alignment       =   2  'Center
            BeginProperty Font 
               Name            =   "Verdana"
               Size            =   12
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H0000C000&
            Height          =   615
            Left            =   120
            TabIndex        =   13
            Top             =   240
            Width           =   2535
         End
      End
      Begin VB.CommandButton Command1 
         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
         Left            =   720
         TabIndex        =   10
         Top             =   3360
         Visible         =   0   'False
         Width           =   1695
      End
      Begin VB.TextBox cl_Nombre 
         Alignment       =   2  'Center
         BackColor       =   &H00FFFFFF&
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   975
         Left            =   120
         Locked          =   -1  'True
         MultiLine       =   -1  'True
         TabIndex        =   9
         Top             =   1320
         Width           =   2775
      End
      Begin VB.TextBox ALU_RUN 
         Alignment       =   2  'Center
         BackColor       =   &H00FFFFFF&
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   120
         MaxLength       =   10
         TabIndex        =   7
         Top             =   600
         Width           =   2775
      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
         ForeColor       =   &H00000000&
         Height          =   255
         Index           =   1
         Left            =   120
         TabIndex        =   8
         Top             =   1080
         Width           =   1815
      End
      Begin VB.Label Label1 
         Caption         =   "Buscar por RUN:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   6
         Top             =   360
         Width           =   1695
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Proceso de Inscripció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          =   4815
      Left            =   3240
      TabIndex        =   0
      Top             =   120
      Width           =   7215
      Begin VB.CommandButton btnRenunciar 
         Caption         =   "&Renunciar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   735
         Left            =   5520
         Picture         =   "Form_NFicha_Inscripcion.frx":2AE82
         Style           =   1  'Graphical
         TabIndex        =   15
         Top             =   3840
         Width           =   1455
      End
      Begin VB.TextBox Doc_Estado 
         Alignment       =   2  'Center
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   405
         Left            =   360
         TabIndex        =   11
         Text            =   "Desconocido"
         Top             =   4200
         Visible         =   0   'False
         Width           =   1815
      End
      Begin VB.CommandButton btnDocumentos 
         Enabled         =   0   'False
         Height          =   855
         Left            =   360
         Picture         =   "Form_NFicha_Inscripcion.frx":2B4FF
         Style           =   1  'Graphical
         TabIndex        =   4
         Top             =   3120
         Width           =   1815
      End
      Begin VB.CommandButton btnApo 
         Enabled         =   0   'False
         Height          =   855
         Left            =   4080
         Picture         =   "Form_NFicha_Inscripcion.frx":2CB66
         Style           =   1  'Graphical
         TabIndex        =   3
         Top             =   2280
         Width           =   1815
      End
      Begin VB.CommandButton btnAlu 
         Height          =   855
         Left            =   360
         Picture         =   "Form_NFicha_Inscripcion.frx":2E1DE
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   360
         Width           =   1815
      End
      Begin VB.CommandButton btnPad 
         Enabled         =   0   'False
         Height          =   855
         Left            =   2280
         Picture         =   "Form_NFicha_Inscripcion.frx":2F86B
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   1320
         Width           =   1815
      End
      Begin VB.Image Image4 
         Height          =   1005
         Left            =   2880
         Picture         =   "Form_NFicha_Inscripcion.frx":30EE0
         Top             =   3000
         Width           =   1050
      End
      Begin VB.Line lnDoc 
         BorderColor     =   &H0000C000&
         BorderWidth     =   5
         Index           =   1
         Visible         =   0   'False
         X1              =   1920
         X2              =   5040
         Y1              =   3600
         Y2              =   3600
      End
      Begin VB.Line lnDoc 
         BorderColor     =   &H0000C000&
         BorderWidth     =   5
         Index           =   0
         Visible         =   0   'False
         X1              =   5040
         X2              =   5040
         Y1              =   2880
         Y2              =   3600
      End
      Begin VB.Line lnApo 
         BorderColor     =   &H0000C000&
         BorderWidth     =   5
         Index           =   1
         Visible         =   0   'False
         X1              =   3360
         X2              =   4440
         Y1              =   2760
         Y2              =   2760
      End
      Begin VB.Line lnApo 
         BorderColor     =   &H0000C000&
         BorderWidth     =   5
         Index           =   0
         Visible         =   0   'False
         X1              =   3360
         X2              =   3360
         Y1              =   2160
         Y2              =   2760
      End
      Begin VB.Line lnPad1 
         BorderColor     =   &H0000C000&
         BorderWidth     =   5
         Index           =   1
         Visible         =   0   'False
         X1              =   1320
         X2              =   2400
         Y1              =   1800
         Y2              =   1800
      End
      Begin VB.Line lnPad1 
         BorderColor     =   &H0000C000&
         BorderWidth     =   5
         Index           =   0
         Visible         =   0   'False
         X1              =   1320
         X2              =   1320
         Y1              =   1200
         Y2              =   1800
      End
      Begin VB.Image Image3 
         Height          =   1050
         Left            =   6120
         Picture         =   "Form_NFicha_Inscripcion.frx":31DEF
         Top             =   2040
         Width           =   885
      End
      Begin VB.Image Image2 
         Height          =   900
         Left            =   4560
         Picture         =   "Form_NFicha_Inscripcion.frx":32846
         Top             =   1200
         Width           =   1125
      End
      Begin VB.Image Image1 
         Height          =   1005
         Left            =   2640
         Picture         =   "Form_NFicha_Inscripcion.frx":334D0
         Top             =   240
         Width           =   900
      End
   End
End
Attribute VB_Name = "Form_NFicha_Inscripcion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public ci_aluaca As String
Dim var_sql, rechazado
Dim objRS As ADODB.Recordset

Private Sub imgAlu_Click()

End Sub

Private Sub imgPad_Click()

End Sub

Private Sub ALU_RUN_Change()
Set objRS = New ADODB.Recordset

If Len(Me.ALU_RUN.Text) > 9 Then
    If Trim(ALU_RUN.Text) <> "" Then
         Command1_Click
         
            var_sql = "SELECT count(DISTINCT ci_alumno)AS valor FROM form_renuncias WHERE ci_alumno = '" & Me.ALU_RUN.Text & "'"
            conn.Execute var_sql
            
            objRS.Open var_sql, conn
            rechazado = objRS("valor")
            objRS.Close
            
            If rechazado = 1 Then

            
            Form_NFicha_PRoceso.btn_post.Enabled = False
            Me.ALU_RUN.Text = ""
            Unload Me
            End If
    End If
  
Else
        lnApo(0).Visible = False
        lnApo(1).Visible = False
        Me.lnPad1(0).Visible = False
        Me.lnPad1(1).Visible = False
        Me.btnApo.Enabled = False
        Me.btnPad.Enabled = False
        Me.ci_aluaca = ""
        Me.cl_nombre.Text = ""
        lnDoc(0).Visible = False
        lnDoc(1).Visible = False
        Me.btnDocumentos.Enabled = False
        Me.Doc_Estado.Visible = False
        Me.Doc_Estado.Text = "Desconocido"
             Form_NFicha_PRoceso.ci_alu.Text = ""
        Form_NFicha_PRoceso.cl_nombre.Text = ""
End If






End Sub

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

Private Sub btnAlu_Click()
    Form_NFicha_Alumno.Show
End Sub

Private Sub btnApo_Click()
    Form_NFicha_Apoderado.Show
End Sub

Private Sub btnDocumentos_Click()
    Form_Nficha_Docu.Show
End Sub

Private Sub btnPad_Click()
Form_NFicha_Padres.Show
End Sub

Private Sub btnRenunciar_Click()
    Form_NFicha_Rechazar.Show
End Sub



Public Sub Command1_Click()
   
    Dim buscar As ADODB.Recordset
    Dim ci_p As String
    Dim ci_m As String
    Dim ci_a As String
    ci_a = Trim(Me.ALU_RUN.Text)
    Set buscar = New ADODB.Recordset
    
    If InStr(ALU_RUN.Text, "'") Then
        MsgBox "Rut no válido"
        Exit Sub
    End If
    
    buscar.Open "Select ci_alu,rut_mad_alu as ci_madre, rut_pad_alu as ci_padre, concat(nom_alu,' ',ape_pat_alu,' ',ape_mat_alu) as clnombre from postulantes where ci_alu='" & ci_a & "' and length(nom_alu)>0 and length(ape_pat_alu)>0 and length(ape_mat_alu)>0 " & _
    "and length(cod_geo)>0 and length(dire_alu)>0 and length(sex_alu)>0 and length(ind_ext_alu)>0 and length(fec_nacalu)>0", conn
    
    If buscar.RecordCount > 0 Then
        If Trim(buscar!ci_alu) = ci_a Then  'REDUNDANCIA PARA VERIFICACION
            Me.cl_nombre.Text = buscar!clnombre
            Me.lnPad1(0).Visible = True
            Me.lnPad1(1).Visible = True
            Me.btnPad.Enabled = True
            Me.ci_aluaca = buscar!ci_alu
            If IsNull(buscar!ci_padre) Then
                ci_p = ""
            Else
                ci_p = buscar!ci_padre
            End If
            If IsNull(buscar!ci_madre) Then
                ci_m = ""
            Else
                ci_m = buscar!ci_madre
            End If
        
        If ci_m = "" And ci_p = "" Then
            Exit Sub
        End If
    Else
        lnApo(0).Visible = False
        lnApo(1).Visible = False
        Me.lnPad1(0).Visible = False
        Me.lnPad1(1).Visible = False
        Me.btnApo.Enabled = False
        Me.btnPad.Enabled = False
        lnDoc(0).Visible = False
        lnDoc(1).Visible = False
        Label2.Caption = "FALTAN DATOS"
        Form_NFicha_PRoceso.ci_alu.Text = ""
        Form_NFicha_PRoceso.cl_nombre.Text = ""
        buscar.Close
        Exit Sub
    End If
    
    buscar.Close
    
    buscar.Open "Select count(*) as cuantos from apoderados where rut_apo='" & ci_m & "' or rut_apo='" & ci_p & "'", conn
    
    lnApo(1).Visible = True
    lnApo(0).Visible = True
    Me.btnApo.Enabled = True
    lnDoc(0).Visible = False
    lnDoc(1).Visible = False
    Label2.Caption = "FALTAN DATOS"
    If buscar!cuantos > 0 Then
       
    Else
        buscar.Close
        Form_NFicha_PRoceso.ci_alu.Text = ""
        Form_NFicha_PRoceso.cl_nombre.Text = ""
        Exit Sub
    End If
    
       buscar.Close
    buscar.Open "Select * from apo_x_ins where ci_alu='" & ci_a & "'", conn
    
    If buscar.RecordCount > 0 Then
        lnDoc(0).Visible = True
        lnDoc(1).Visible = True
        Me.btnDocumentos.Enabled = True
        Label2.Caption = "LISTO"
    Else
        buscar.Close
        Exit Sub
    End If
    
    buscar.Close
    buscar.Open "Select ci_alu from postulantes where  (V_CER_NAC is null or V_INF_NOT_PAR is Null or  V_CER_EST_ULT_CUR is Null or V_FOTOS is null or  V_CER_NAC=0 or V_INF_NOT_PAR=0 or  V_CER_EST_ULT_CUR=0 or V_FOTOS=0) AND CI_ALU='" & ALU_RUN.Text & "'", conn
    
    If buscar.RecordCount > 0 Then
        Me.Doc_Estado.Text = "FALTAN"
        Me.Doc_Estado.ForeColor = &HFF&
        lnDoc(0).BorderColor = &HC0C0&
        lnDoc(1).BorderColor = &HC0C0&
        Me.Doc_Estado.Visible = True
    Else
            

        renuncia_run = Me.ALU_RUN.Text
        renuncia_proceso = "Inscripcion"
            
        MsgBox renuncia_run & renuncia_proceso
        
        Me.Doc_Estado.Text = "TODOS OK"
        Me.btnRenunciar.Visible = True
        Me.Doc_Estado.ForeColor = &H8000&
        lnDoc(0).BorderColor = &HC000&
        lnDoc(1).BorderColor = &HC000&
        Me.Doc_Estado.Visible = True
    End If
    buscar.Close
    Form_NFicha_PRoceso.ci_alu.Text = ALU_RUN.Text
    Form_NFicha_PRoceso.cl_nombre.Text = Me.cl_nombre.Text
Else
    lnApo(0).Visible = False
    lnApo(1).Visible = False
    Me.lnPad1(0).Visible = False
    Me.lnPad1(1).Visible = False
    Me.btnApo.Enabled = False
    Me.btnPad.Enabled = False
    lnDoc(0).Visible = False
    lnDoc(1).Visible = False
    Me.btnDocumentos.Enabled = False
    Label2.Caption = "FALTAN DATOS"
    Form_NFicha_PRoceso.ci_alu.Text = ""
    Form_NFicha_PRoceso.cl_nombre.Text = ""
    Exit Sub
    
End If

End Sub

Private Sub Command2_Click()
Dim REC As ADODB.Recordset
Set REC = New ADODB.Recordset

REC.Open "SELECT ci_alu FROM apo_x_ins WHERE ci_alu='" & Trim(ALU_RUN.Text) & "';", conn

If REC.RecordCount > 0 Then
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    If cole <> "ALT001" And cole <> "HUE001" Then
        Form_main.CrystalReport.ReportFileName = App.Path & "\rpt\fichapos_sub" & IIf((Mid(RetornaCampo("CFG", "valor", "param='CODBC'", conn), 1, 6) = "LIN001"), "lin", "") & ".rpt"
    Else
        Form_main.CrystalReport.ReportFileName = App.Path & "\rpt\fichapos" & IIf((Mid(RetornaCampo("CFG", "valor", "param='CODBC'", conn), 1, 6) = "LIN001"), "lin", "") & ".rpt"
    End If
    
    Form_main.CrystalReport.WindowState = crptMaximized
    Form_main.CrystalReport.WindowTitle = "Ficha Postulación de Alumno"
    Form_main.CrystalReport.ReplaceSelectionFormula ("")
    Form_main.CrystalReport.ReplaceSelectionFormula ("{postulantes.ci_alu}='" & Me.ALU_RUN.Text & "'")
    Form_main.CrystalReport.Destination = crptToWindow
    Form_main.CrystalReport.Action = 1
Else
    MsgBox "No se encontro la ultima ficha de postulacion.", vbInformation, "Alumno no disponible."
End If
REC.Close
End Sub






Private Sub Form_Load()
btnRenunciar.Visible = False

If Form_NFicha_PRoceso.ci_alu <> "" Then
    ALU_RUN.Text = Form_NFicha_PRoceso.ci_alu
    Call ALU_RUN_Change
Else
    Me.ci_aluaca = ""
    Form_NFicha_PRoceso.Enabled = False
End If

End Sub


Private Sub Form_Unload(Cancel As Integer)
Form_NFicha_PRoceso.Enabled = True
Form_NFicha_PRoceso.SetFocus
End Sub



