VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form_NFicha_PRoceso 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Proceso de Inscripción, Postulación y Matrícula"
   ClientHeight    =   5925
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9780
   Icon            =   "Form_NFicha_Proceso.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5925
   ScaleWidth      =   9780
   Begin VB.Frame frmFecEval 
      Caption         =   "Fechas de Evaluación"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3135
      Left            =   3480
      TabIndex        =   15
      Top             =   720
      Visible         =   0   'False
      Width           =   3855
      Begin VB.CommandButton btn_Cerrar 
         Caption         =   "Cerrar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1080
         TabIndex        =   16
         Top             =   2520
         Width           =   1695
      End
      Begin MSFlexGridLib.MSFlexGrid msfeceval 
         Height          =   2055
         Left            =   240
         TabIndex        =   17
         ToolTipText     =   "Presione Para Enviar"
         Top             =   360
         Width           =   3375
         _ExtentX        =   5953
         _ExtentY        =   3625
         _Version        =   393216
         Cols            =   3
         FixedCols       =   0
         BackColorSel    =   16761024
         ForeColorSel    =   -2147483640
         FillStyle       =   1
         ScrollBars      =   2
         SelectionMode   =   1
         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
   End
   Begin VB.Frame modo 
      Caption         =   "Anular Renunciados"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   120
      TabIndex        =   36
      Top             =   4560
      Width           =   3855
      Begin VB.TextBox txtRun 
         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            =   840
         MaxLength       =   10
         TabIndex        =   38
         Top             =   240
         Width           =   2775
      End
      Begin VB.CommandButton txtAnularRenuncia 
         Caption         =   "Anular Renuncia"
         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        =   37
         Top             =   720
         Width           =   1695
      End
      Begin VB.Label Label8 
         Caption         =   "RUN:"
         Height          =   255
         Left            =   240
         TabIndex        =   39
         Top             =   360
         Width           =   495
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "Postulación"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   4215
      Left            =   1440
      TabIndex        =   10
      Top             =   120
      Visible         =   0   'False
      Width           =   6735
      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            =   5160
         Picture         =   "Form_NFicha_Proceso.frx":2A8B2
         Style           =   1  'Graphical
         TabIndex        =   35
         Top             =   2880
         Width           =   1455
      End
      Begin VB.CheckBox checkrep 
         Alignment       =   1  'Right Justify
         Caption         =   "¿El Alumno es Repitente?"
         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
         Left            =   360
         TabIndex        =   32
         Top             =   2160
         Width           =   3255
      End
      Begin VB.ComboBox cmb_jornada 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         ItemData        =   "Form_NFicha_Proceso.frx":2AF2F
         Left            =   5040
         List            =   "Form_NFicha_Proceso.frx":2AF31
         Style           =   2  'Dropdown List
         TabIndex        =   30
         Top             =   720
         Width           =   1455
      End
      Begin VB.TextBox edad 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   5880
         TabIndex        =   29
         Text            =   "0"
         Top             =   2160
         Visible         =   0   'False
         Width           =   255
      End
      Begin VB.ComboBox cmb_numgra 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   3360
         Style           =   2  'Dropdown List
         TabIndex        =   28
         Top             =   720
         Width           =   1575
      End
      Begin VB.ComboBox cmb_ens 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         ItemData        =   "Form_NFicha_Proceso.frx":2AF33
         Left            =   360
         List            =   "Form_NFicha_Proceso.frx":2AF35
         Style           =   2  'Dropdown List
         TabIndex        =   27
         Top             =   720
         Width           =   2895
      End
      Begin VB.CommandButton Command2 
         Caption         =   "Cerrar y Postular"
         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          =   495
         Left            =   840
         Picture         =   "Form_NFicha_Proceso.frx":2AF37
         TabIndex        =   25
         Top             =   2880
         Width           =   1935
      End
      Begin VB.ComboBox cm_agno_pos 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   360
         ItemData        =   "Form_NFicha_Proceso.frx":2B8BF
         Left            =   3360
         List            =   "Form_NFicha_Proceso.frx":2B8C1
         Style           =   2  'Dropdown List
         TabIndex        =   18
         Top             =   240
         Width           =   2055
      End
      Begin VB.CommandButton Command3 
         Caption         =   "Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   3360
         Picture         =   "Form_NFicha_Proceso.frx":2B8C3
         TabIndex        =   26
         Top             =   2880
         Width           =   1695
      End
      Begin VB.CommandButton Command1 
         Caption         =   "Ver Calendario"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   975
         Left            =   5520
         Picture         =   "Form_NFicha_Proceso.frx":2BDE5
         Style           =   1  'Graphical
         TabIndex        =   24
         ToolTipText     =   "Ver y Seleccionar Prueba"
         Top             =   1080
         Width           =   975
      End
      Begin VB.TextBox Fec_hora 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3360
         Locked          =   -1  'True
         TabIndex        =   22
         Top             =   1920
         Width           =   1935
      End
      Begin VB.TextBox fec_prueba 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   3360
         Locked          =   -1  'True
         TabIndex        =   21
         Top             =   1560
         Width           =   1935
      End
      Begin VB.TextBox Fec_Ins 
         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          =   285
         Left            =   3360
         Locked          =   -1  'True
         TabIndex        =   20
         Top             =   1200
         Width           =   1935
      End
      Begin VB.TextBox txt_enc_alu 
         BackColor       =   &H00FFFFFF&
         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          =   285
         Left            =   3360
         Locked          =   -1  'True
         MaxLength       =   30
         TabIndex        =   23
         TabStop         =   0   'False
         Top             =   2520
         Width           =   3135
      End
      Begin VB.Label Label7 
         Caption         =   "Año a Postular"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   375
         Left            =   1680
         TabIndex        =   19
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label6 
         Caption         =   "Responsable Postulación:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   255
         Left            =   360
         TabIndex        =   14
         Top             =   2520
         Width           =   2895
      End
      Begin VB.Label Label5 
         Caption         =   "Hora de Evaluacion Diagnóstica"
         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
         Left            =   360
         TabIndex        =   13
         Top             =   1920
         Width           =   3015
      End
      Begin VB.Label lbl_fec_ins_alu 
         Caption         =   "Fecha de Postulación"
         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
         Left            =   360
         TabIndex        =   12
         Top             =   1200
         Width           =   3015
      End
      Begin VB.Label lbl_eva_alu 
         Caption         =   "Fecha  de Evaluacion Diagnóstica"
         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
         Left            =   360
         TabIndex        =   11
         Top             =   1560
         Width           =   3015
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Alumno Postulante"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   1215
      Left            =   120
      TabIndex        =   3
      Top             =   3120
      Width           =   9495
      Begin VB.TextBox cl_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            =   1200
         Locked          =   -1  'True
         TabIndex        =   5
         Top             =   720
         Width           =   8175
      End
      Begin VB.TextBox ci_alu 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   1200
         Locked          =   -1  'True
         MaxLength       =   11
         TabIndex        =   4
         Top             =   360
         Width           =   1335
      End
      Begin VB.Label Label3 
         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            =   240
         TabIndex        =   7
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "Alumno:"
         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        =   6
         Top             =   720
         Width           =   975
      End
   End
   Begin VB.CommandButton Command5 
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   7680
      Picture         =   "Form_NFicha_Proceso.frx":2C484
      Style           =   1  'Graphical
      TabIndex        =   34
      Top             =   480
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Caption         =   "Postulació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          =   2895
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   9495
      Begin VB.CommandButton Command4 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   855
         Left            =   5400
         Picture         =   "Form_NFicha_Proceso.frx":2DAC3
         Style           =   1  'Graphical
         TabIndex        =   33
         Top             =   1440
         Width           =   1695
      End
      Begin VB.TextBox clEstado 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   285
         Left            =   120
         Locked          =   -1  'True
         TabIndex        =   31
         Top             =   2520
         Width           =   9255
      End
      Begin VB.CommandButton btn_post 
         Enabled         =   0   'False
         Height          =   855
         Left            =   2280
         Picture         =   "Form_NFicha_Proceso.frx":2F15A
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   1440
         Width           =   1815
      End
      Begin VB.CommandButton btnProcIns 
         Height          =   855
         Left            =   240
         Picture         =   "Form_NFicha_Proceso.frx":3459A
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   360
         Width           =   1815
      End
      Begin VB.Line lnPPos 
         BorderColor     =   &H0000C000&
         BorderWidth     =   10
         Index           =   6
         X1              =   7080
         X2              =   8400
         Y1              =   1920
         Y2              =   1920
      End
      Begin VB.Line lnPPos 
         BorderColor     =   &H0000C000&
         BorderWidth     =   10
         Index           =   5
         X1              =   4080
         X2              =   5400
         Y1              =   1920
         Y2              =   1920
      End
      Begin VB.Line lnPPos 
         BorderColor     =   &H0000C000&
         BorderWidth     =   10
         Index           =   4
         X1              =   8400
         X2              =   8400
         Y1              =   1080
         Y2              =   1920
      End
      Begin VB.Label Label1 
         Caption         =   "Para postular, todos los datos del inscripto deben ser válidos.  "
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   975
         Left            =   2400
         TabIndex        =   8
         Top             =   240
         Width           =   2415
      End
      Begin VB.Line lnPPos 
         BorderColor     =   &H0000C000&
         BorderWidth     =   10
         Index           =   1
         X1              =   1080
         X2              =   2400
         Y1              =   1920
         Y2              =   1920
      End
      Begin VB.Line lnPPos 
         BorderColor     =   &H0000C000&
         BorderWidth     =   10
         Index           =   0
         X1              =   1080
         X2              =   1080
         Y1              =   1080
         Y2              =   1920
      End
      Begin VB.Label Label4 
         Caption         =   "Debe haber una fecha de prueba definida antes de postular."
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1095
         Left            =   4920
         TabIndex        =   9
         Top             =   240
         Width           =   2415
      End
   End
   Begin VB.Line lnPPos 
      BorderColor     =   &H0000FF00&
      BorderWidth     =   10
      Index           =   3
      X1              =   7800
      X2              =   9120
      Y1              =   2640
      Y2              =   2640
   End
   Begin VB.Line linea3 
      BorderColor     =   &H0000FF00&
      BorderWidth     =   10
      Index           =   0
      X1              =   7200
      X2              =   8520
      Y1              =   2040
      Y2              =   2040
   End
   Begin VB.Line lnPPos 
      BorderColor     =   &H0000FF00&
      BorderWidth     =   10
      Index           =   2
      X1              =   4200
      X2              =   5520
      Y1              =   2040
      Y2              =   2040
   End
End
Attribute VB_Name = "Form_NFicha_PRoceso"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim STOPCLICK As Boolean
'''''run!!!!
Public run_actual As String
Public proceso As Integer


Private Sub btn_cerrar_Click()
    Me.frmFecEval.Visible = False
    Me.frmFecEval.Enabled = False
    
    If Me.Fec_Ins.Text <> "" And Me.fec_prueba.Text <> "" And Me.Fec_hora.Text <> "" Then
        Me.Command2.Enabled = True
    Else
        Me.Command2.Enabled = False
    End If
    
End Sub

Private Sub btn_post_Click()
    renuncia_proceso = "Postulacion"

    
    
    Me.Frame3.Enabled = True
    Me.btnProcIns.Enabled = False
    Me.Command4.Enabled = False
    Me.Command5.Enabled = False
    lnPPos(4).Visible = False
    lnPPos(6).Visible = False
    
    Me.Fec_Ins.Text = Format(Date, "MM-DD-YYYY")
    Me.txt_enc_alu.Text = Nom_usu_ses
    
    
    Dim calcurpos As ADODB.Recordset
    Set calcurpos = New ADODB.Recordset
     
    calcurpos.Open "Select fec_nacalu from postulantes where ci_alu='" & Me.ci_alu.Text & "'", conn
    STOPCLICK = True
    cm_agno_pos.Text = Anno + 1
    STOPCLICK = False
    AgnoCal = Trim(cm_agno_pos.Text) + "0631"
    FechaNa = Format(calcurpos!fec_nacalu, "YYYYMMDD")
    calcurpos.Close
    
    annos = Int((val(AgnoCal) - val(FechaNa)) / 10000)
    If annos < 3 Then
        MsgBox "Edad (" & annos & " años al " & cm_agno_pos.Text & ") no valida para postulaciones.", vbInformation, "ERROR DE VALIDACIÓN"
        Command3_Click
        Exit Sub
    End If
    
    llenarcombo Me.cmb_ens, "Select distinct c.des_ens as lab, c.cod_ens as ind from conf_edad as ce, codigos_ensenanza as c where ce.cod_ens=c.cod_ens and  ce.edad_minima <=" & str(annos) & " group by ce.cod_ens order by ord_ens"
    Me.edad.Text = annos
    Me.cmb_jornada.ListIndex = 0
    cmb_ens_Click
    
    calcurpos.Open "Select * from postulaciones where ci_alu='" & Me.ci_alu.Text & "'", conn
    If calcurpos.RecordCount > 0 Then
        Me.Fec_hora.Text = Format(calcurpos!vii_hor_eval, "HH:MM")
        Me.fec_prueba.Text = Format(calcurpos!vii_hor_eval, "DD-MM-YYYY")
        Me.Fec_Ins.Text = Format(calcurpos!fec_pos, "DD-MM-YYYY")
        buscacombo RetornaCampo("jornadas", "DES_JOR", "COD_JOR='" & calcurpos!cod_jor & "'", conn), cmb_jornada
        buscacombo calcurpos!anno_pos_alu, Me.cm_agno_pos
        calcurpos.Close
        
        calcurpos.Open "Select cod_ens,num_gra from postulantes where ci_alu='" & Me.ci_alu.Text & "'", conn
        buscacombo RetornaCampo("codigos_ensenanza", "DES_ENS", "cod_ens='" & calcurpos!Cod_Ens & "'", conn), Me.cmb_ens
        
        If (Num_Gra = "") Then
            buscacombo 1, Me.cmb_numgra
        Else
            buscacombo val(calcurpos!Num_Gra), Me.cmb_numgra
        End If
        
        
        
        
    End If
    calcurpos.Close
    
    calcurpos.Open "Select * from repitentes where ci_alu='" & Me.ci_alu.Text & "' and anno_rep='" & Me.cm_agno_pos.Text & "'"
    If calcurpos.RecordCount > 0 Then
        Me.checkrep.Value = 1
    Else
        Me.checkrep.Value = 0
    End If
    
    calcurpos.Close
    
    If Me.Fec_Ins.Text <> "" And Me.fec_prueba.Text <> "" And Me.Fec_hora.Text <> "" Then
        Me.Command2.Enabled = True
    Else
        Me.Command2.Enabled = False
    End If
    Me.Frame3.Visible = True
    
End Sub

Private Sub btnProcIns_Click()
    Form_NFicha_Inscripcion.Show
End Sub


Private Sub btnRenunciar_Click()
    Form_NFicha_Rechazar.Show
  
End Sub

Private Sub ci_alu_Change()
If Me.ci_alu.Text <> "" Then
    Me.btn_post.Enabled = True
Else
    Me.btn_post.Enabled = False
    Me.clEstado.Text = verEstado(Me.ci_alu.Text)
End If
End Sub

Private Sub ci_alu_LostFocus()
If Me.ci_alu.Text <> "" Then
    Me.btn_post.Enabled = True
Else
    Me.btn_post.Enabled = False
    Me.clEstado.Text = verEstado(Me.ci_alu.Text)
End If
End Sub

Private Sub cm_agno_pos_Click()
    Dim annos As String
    Dim AgnoCal As String
    Dim FechaNa As String
    If STOPCLICK Then Exit Sub
    AgnoCal = Trim(cm_agno_pos.Text) & "0631"
    FechaNa = Format(RetornaCampo("postulantes", "fec_nacalu", "ci_alu='" & Me.ci_alu.Text & "'", conn), "YYYYMMDD")
    annos = str(Int((val(AgnoCal) - val(FechaNa)) / 10000))
    llenarcombo Me.cmb_ens, "Select distinct c.des_ens as lab, c.cod_ens as ind from conf_edad as ce, codigos_ensenanza as c where ce.cod_ens=c.cod_ens and  ce.edad_minima <=" & str(annos) & " group by ce.cod_ens order by ord_ens"
    Me.edad.Text = annos
    cmb_ens_Click
End Sub

Private Sub cmb_ens_Click()
Me.cmb_numgra.Clear
If cmb_ens.ItemData(cmb_ens.ListIndex) = 10 Then
    llenarcombo Me.cmb_numgra, "Select ce.num_gra as lab , ce.num_gra as Ind from conf_edad as ce, codigos_ensenanza as c where ce.cod_ens=c.cod_ens and ce.cod_ens=010 and ce.edad_minima <=" & Me.edad.Text & " order by ce.num_gra"
Else
    llenarcombo Me.cmb_numgra, "Select ce.num_gra as lab , ce.num_gra as Ind from conf_edad as ce, codigos_ensenanza as c where ce.cod_ens=c.cod_ens and ce.cod_ens=" & Me.cmb_ens.ItemData(Me.cmb_ens.ListIndex) & " and ce.edad_minima <=" & Me.edad.Text & " order by ce.num_gra"
End If
End Sub

Private Sub Command1_Click()
    Me.frmFecEval.Visible = True
    Me.frmFecEval.Enabled = True
    Dim llenarfecha As ADODB.Recordset
    Dim xind As Integer
    
    Set llenarfecha = New ADODB.Recordset
    
    llenarfecha.Open "select date_format(eval_fechora,'%d-%m-%Y') as fechac, date_format(eval_fechora,'%H:%i') as hora from fechasevaluacion where agno_postulacion=" & Me.cm_agno_pos.Text, conn
    
    If llenarfecha.RecordCount < 1 Then
        MsgBox "No Existen Fechas de Evaluación Asignadas", , "Sin Evaluaciones"
        pasoonoal = False
        Load Form_Ficha_DefEval
        llenarfecha.Close
        Exit Sub
    End If
    pasoonoal = True
    xind = 1
    With Me.msfeceval
    .Rows = llenarfecha.RecordCount + 1
    .Row = 0
    .ColWidth(1) = 1500
    .Col = 1
    .CellFontBold = True
    .Text = "Fecha"
    
    .ColWidth(2) = 1200
    .Col = 2
    .CellFontBold = True
    .Text = "Hora"
    
    .ColWidth(0) = 0
    
    While Not llenarfecha.EOF
        .Row = xind
        .Col = 1
        .Text = llenarfecha!fechac
        .Col = 2
        .Text = llenarfecha!hora
        llenarfecha.MoveNext
        xind = xind + 1
    Wend
        
    llenarfecha.Close
    End With

End Sub


Private Sub Command2_Click()
Dim sqlIns As String
Dim sqlUp As String
Dim cod_ns As String
Dim agnorep As Long
Dim registraIns As ADODB.Recordset

Set registraIns = New ADODB.Recordset

sqldel = "delete from postulaciones where ci_alu='" & Me.ci_alu.Text & "'"
sqlIns = "insert into postulaciones set ci_alu='" & Me.ci_alu.Text & "' , VII_FEC_EVAL='" & Format(Me.fec_prueba.Text, "YYYY-MM-DD") & "',  VII_HOR_EVAL='" & Format(Me.fec_prueba.Text, "YYYY-MM-DD") & " " & Me.Fec_hora.Text & "', anno_pos_alu=" & Me.cm_agno_pos.Text & ", cod_jor='" & RetornaCampo("jornadas", "cod_jor", "des_jor='" & cmb_jornada.Text & "'", conn) & "', fec_pos='" & Format(Me.Fec_Ins.Text, "YYYY-MM-DD") & "'"

cod_ns = Trim(str(Me.cmb_ens.ItemData(cmb_ens.ListIndex)))
If cod_ns = "10" Then
    cod_ns = "010"
End If

sqlUp = "update postulantes set cod_ens='" & cod_ns & "', num_gra='" & Trim(Me.cmb_numgra.Text) & "', matriculado_alu=0 where ci_alu='" & Me.ci_alu.Text & "' limit 1"
registraIns.Open sqldel, conn
registraIns.Open sqlIns, conn
registraIns.Open sqlUp, conn

If Me.checkrep.Value = 1 Then
    sqlRep = "Replace into repitentes set cod_ens='" & cod_ns & "', num_gra='" & Trim(Me.cmb_numgra.Text) & "',ci_alu='" & Me.ci_alu.Text & "',anno_rep=" & Me.cm_agno_pos.Text
Else
    sqlRep = "Delete from repitentes where ci_alu='" & Me.ci_alu.Text & "' and anno_rep=" & Me.cm_agno_pos.Text
End If

registraIns.Open sqlRep, conn

'Me.Frame3.Visible = False
'Me.Frame3.Enabled = False
Me.btnProcIns.Enabled = True

'Me.Command4.Enabled = True
'Me.Command5.Enabled = True
'lnPPos(5).Visible = True

Call Command3_Click
End Sub

Private Sub Command3_Click()

Dim calcurpos As ADODB.Recordset
Set calcurpos = New ADODB.Recordset
     
    calcurpos.Open "Select * from postulaciones where ci_alu='" & Me.ci_alu.Text & "'", conn
    If calcurpos.RecordCount > 0 Then
        Me.Fec_hora.Text = Format(calcurpos!vii_hor_eval, "HH:MM")
        Me.fec_prueba.Text = Format(calcurpos!vii_hor_eval, "DD-MM-YYYY")
        Me.Fec_Ins.Text = Format(calcurpos!fec_pos, "DD-MM-YYYY")
    Else
        Me.fec_prueba.Text = ""
        Me.Fec_hora.Text = ""
    End If
    
    
    If Me.Fec_Ins.Text <> "" And Me.fec_prueba.Text <> "" And Me.Fec_hora.Text <> "" Then
        Me.Command4.Enabled = True
        lnPPos(5).Visible = True
        
        Nota = (calcurpos!viii_res_eval)
        If Nota <= 70 And Nota >= 10 Then
            Me.Command5.Enabled = True
            lnPPos(4).Visible = True
            lnPPos(6).Visible = True
        End If
    Else
        Me.Command4.Enabled = False
        lnPPos(5).Visible = False
    End If
    
    Me.Frame3.Visible = False
    Me.Frame3.Enabled = False
    Me.btnProcIns.Enabled = True
    
calcurpos.Close
End Sub

Private Sub Command4_Click()
'rechazar_proceso = "Asignacion de Notas"
renuncia_proceso = "Asignacion de Notas"
run_actual = Form_NFicha_PRoceso.ci_alu.Text
Form_NFicha_PRoceso.Enabled = False
    'Call menuhabilitado(False)
    ManTab = "res_pos"
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    If cole = "HUE001" Or cole = "ALT001" Then
        Form_Res_Pos.Txt_res_eval.MaxLength = 3
        Form_Res_Pos.lbl_porcentaje = "%"
    Else
        Form_Res_Pos.Txt_res_eval.MaxLength = 2
        Form_Res_Pos.lbl_porcentaje = ""
    End If
    Load Form_Res_Pos
End Sub

Private Sub Command5_Click()
renuncia_proceso = "Matricular"

Form_NFicha_PRoceso.Enabled = False
run_actual = Form_NFicha_PRoceso.ci_alu.Text
'    Call menuhabilitado(False)
'    MenuInformes = "matnuevos"
'    Load FormFechas
    
    'preguntar si permiso corresponde
    'Me.Enabled = False
    'If Me.Opt_mat_nuevos(0) Then
    ManTab = "mat"

    Dim objRS As ADODB.Recordset
    Set objRS = New ADODB.Recordset
    Dim var_sql As String
    var_sql = "select valor from cfg where param = 'CODBC'"
    objRS.Open var_sql, conn
        var_sql = objRS("valor")
    objRS.Close
    If var_sql = "HUE001" Or var_sql = "ALT001" Then
        Load Form_proc_Cursos_hue
    Else
        Load Form_proc_Cursos
    End If


    'Else
    'Load Form_MatriReserv2
    'End If
End Sub

Private Sub Fec_Ins_Change()
If Fec_Ins.Text = "" Then
Fec_Ins.Text = Date
End If

End Sub

Private Sub Form_Activate()

If Me.ci_alu.Text <> "" Then
    Me.btn_post.Enabled = True
    lnPPos(0).Visible = True
    lnPPos(1).Visible = True
    Me.clEstado.Text = verEstado(Me.ci_alu.Text)
    
    Dim calcurpos As ADODB.Recordset
    Set calcurpos = New ADODB.Recordset
     
    calcurpos.Open "Select * from postulaciones where ci_alu='" & Me.ci_alu.Text & "'", conn
    If calcurpos.RecordCount > 0 Then
        Me.Fec_hora.Text = Format(calcurpos!vii_hor_eval, "HH:MM")
        Me.fec_prueba.Text = Format(calcurpos!vii_hor_eval, "DD-MM-YYYY")
        Me.Fec_Ins.Text = Format(calcurpos!fec_pos, "DD-MM-YYYY")
    Else
        Me.fec_prueba.Text = ""
        Me.Fec_hora.Text = ""
    End If
    
    
    If Me.Fec_Ins.Text <> "" And Me.fec_prueba.Text <> "" And Me.Fec_hora.Text <> "" Then
        Me.Command4.Enabled = True
        lnPPos(5).Visible = True
        
        Nota = (calcurpos!viii_res_eval)
        If Nota <= 70 And Nota >= 10 Then
            Me.Command5.Enabled = True
            lnPPos(4).Visible = True
            lnPPos(6).Visible = True
        End If
        
    Else
        Me.Command4.Enabled = False
        lnPPos(5).Visible = False
    End If
    
    calcurpos.Close
Else
    Me.btn_post.Enabled = False
    lnPPos(0).Visible = False
    lnPPos(1).Visible = False
End If
    
End Sub

Private Sub Form_GotFocus()
If Me.ci_alu.Text <> "" Then
    Me.btn_post.Enabled = True
Else
    Me.btn_post.Enabled = False
    Me.clEstado.Text = verEstado(Me.ci_alu.Text)
End If
End Sub

Private Sub Form_Load()
Dim agno_pos As Integer
Dim c As Integer

proceso = 1

c = 0
agno_pos = str(Anno)
STOPCLICK = False

For j = agno_pos To agno_pos + 1
    Me.cm_agno_pos.AddItem j, c
    Me.cm_agno_pos.ItemData(c) = j
    c = c + 1
Next

If Month(Date) < 8 Then
   Me.cm_agno_pos.ListIndex = 0
Else
   Me.cm_agno_pos.ListIndex = 1
End If

lnPPos(0).Visible = False
lnPPos(1).Visible = False
lnPPos(5).Visible = False
lnPPos(6).Visible = False
lnPPos(4).Visible = False

LlenaCombo cmb_jornada, "jornadas", "des_jor", "ORDER BY cod_jor", conn

End Sub

Private Sub msfeceval_Click()
Dim pasarfecha As String
    Me.msfeceval.Col = 1
    Me.fec_prueba.Text = Me.msfeceval.Text
    Me.msfeceval.Col = 2
    Me.Fec_hora.Text = Me.msfeceval.Text
    Me.msfeceval.Col = 0
    Me.msfeceval.ColSel = Me.msfeceval.Cols - 1
    
    'If Me.Fec_Ins.Text <> "" And Me.fec_prueba.Text <> "" And Me.Fec_hora.Text <> "" Then
        'Me.Command2.Enabled = True
    'Else
        'Me.Command2.Enabled = False
    'End If
    
End Sub

Private Sub llenarcombo(objeto As ComboBox, sqlstring As String)

    Dim Registros As ADODB.Recordset
    Set Registros = New ADODB.Recordset
    Dim id As Integer
    
    Registros.Open sqlstring, conn
    c = 0
    objeto.Clear
    While Not Registros.EOF
        id = val(Registros!Ind)
        objeto.AddItem Registros!lab
        objeto.ItemData(c) = id
        c = c + 1
        Registros.MoveNext
    Wend
    Registros.Close
    objeto.ListIndex = c - 1
End Sub
Function verifdato(objeto As Object) As Boolean
verifdato = True
If Trim(objeto.Text) = "" Then
    MsgBox "Faltan Datos", vbCritical, "Datos Faltantes"
    objeto.SetFocus
    verifdato = False
End If

End Function

Private Sub buscacombo(clx As Variant, nox As ComboBox)
If IsNull(clx) Then
    nox.ListIndex = 0
    Exit Sub
End If
For i = 0 To nox.ListCount - 1

    If nox.List(i) = clx Then
        nox.ListIndex = i
        Exit Sub
    End If
Next
    nox.ListIndex = 0
End Sub

Function verEstado(Rutalu As String) As String


If Len(Trim(Rutalu)) = 0 Then
    Exit Function
Else

    Dim verdo As ADODB.Recordset
    Set verdo = New ADODB.Recordset
    verdo.Open "Select * from postulaciones where ci_alu='" & Trim(Rutalu) & "'", conn
    
    If verdo.RecordCount < 1 Then
        verEstado = "El Alumno nunca ha postulado anteriormente"
        verdo.Close
    Else
        If verdo!anno_pos_alu > Anno Then
            verEstado = "El alumno esta postulando para el " & verdo!anno_pos_alu
        Else
            verEstado = "El alumno postuló para el " & Anno
        End If
        
        If verdo!viii_sit_fin_alu = "A" Then
            verEstado = verEstado & " y fue ACEPTADO"
        ElseIf verdo!viii_sit_fin_alu = "R" Then
            verEstado = verEstado & " y fue RECHAZADO"
        ElseIf verdo!viii_sit_fin_alu = "P" Then
            verEstado = verEstado & " y esta PENDIENTE"
        ElseIf verdo!viii_sit_fin_alu = "F" Then
            verEstado = verEstado & " y faltó a la Prueba"
        Else
            verEstado = verEstado & " y su resultado es Incierto"
        End If
        
        If val(Format(verdo!vii_hor_eval, "YYYYMMDD")) >= val(Format(Date, "YYYYMMDD")) Then
            verEstado = verEstado & ". Dará la prueba en " & str(val(Format(verdo!vii_hor_eval, "YYYYMMDD")) - val(Format(Date, "YYYYMMDD"))) & " días más"
        Else
           verEstado = verEstado & ". Dió la prueba hace " & str(val(Format(Date, "YYYYMMDD")) - val(Format(verdo!vii_hor_eval, "YYYYMMDD"))) & " días."
        End If
        
        
    End If
End If

End Function

Private Sub Form_Unload(Cancel As Integer)
    Me.proceso = 0
End Sub

Private Sub txtAnularRenuncia_Click()
Dim var_sql, rechazado, ci
Dim objRS As ADODB.Recordset
Set objRS = New ADODB.Recordset


var_sql = "SELECT COUNT(DISTINCT ci_alumno) AS valor FROM form_renuncias WHERE ci_alumno = '" & Me.txtRun.Text & "' "
conn.Execute var_sql

objRS.Open var_sql, conn
rechazado = objRS("valor")
objRS.Close



If Len(Me.txtRun.Text) > 9 Then
    If Trim(txtRun.Text) <> "" Then
                  
            If rechazado = 1 Then
            
                
                var_sql = "select ci_alumno from form_renuncias where ci_Alumno = '" & Me.txtRun.Text & "' "
                conn.Execute var_sql
                
                                
                objRS.Open var_sql, conn
                ci = objRS("ci_alumno")
                objRS.Close
                
                var_sql = "DELETE FROM form_renuncias WHERE ci_alumno = '" & ci & "'"
                conn.Execute var_sql
                MsgBox "Postulante Activado Satisfactoriamente" & rechazado
            
            End If
    End If
Else
       
    MsgBox "Rut Mal Ingresado"
End If
End Sub
