VERSION 5.00
Object = "{B68EC213-82B3-11D5-85C7-000083628378}#3.3#0"; "CoolFlex.ocx"
Begin VB.Form Form_Captura 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Captura de datos"
   ClientHeight    =   6570
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11340
   Icon            =   "Form_Captura.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   6570
   ScaleWidth      =   11340
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Btn_Sal_Cap 
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   9960
      TabIndex        =   6
      Top             =   6000
      Width           =   1215
   End
   Begin VB.CommandButton Btn_Gra_cap 
      Caption         =   "Grabar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   8640
      TabIndex        =   5
      Top             =   6000
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "Seleccione un curso"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   855
      Left            =   120
      TabIndex        =   7
      Top             =   100
      Width           =   11115
      Begin VB.ComboBox Cmb_Cod_ens 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   2100
         Style           =   2  'Dropdown List
         TabIndex        =   0
         Top             =   360
         Width           =   2475
      End
      Begin VB.ComboBox Cmb_Grado 
         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          =   330
         Left            =   6360
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   360
         Width           =   615
      End
      Begin VB.ComboBox Cmb_Let_Cur 
         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          =   330
         Left            =   9840
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   360
         Width           =   615
      End
      Begin VB.Line Line4 
         BorderColor     =   &H00FFFFFF&
         X1              =   7935
         X2              =   7935
         Y1              =   240
         Y2              =   720
      End
      Begin VB.Line Line3 
         BorderColor     =   &H80000003&
         X1              =   7920
         X2              =   7920
         Y1              =   240
         Y2              =   720
      End
      Begin VB.Line Line2 
         BorderColor     =   &H00FFFFFF&
         X1              =   4935
         X2              =   4935
         Y1              =   240
         Y2              =   720
      End
      Begin VB.Line Line1 
         BorderColor     =   &H80000003&
         X1              =   4920
         X2              =   4920
         Y1              =   240
         Y2              =   720
      End
      Begin VB.Label Label2 
         Caption         =   "Letra Curso"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   8640
         TabIndex        =   10
         Top             =   420
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "Grado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   5640
         TabIndex        =   9
         Top             =   420
         Width           =   615
      End
      Begin VB.Label Tipo 
         Caption         =   "Tipo de Enseñanza"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   360
         TabIndex        =   8
         Top             =   360
         Width           =   1455
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   7080
      TabIndex        =   3
      Top             =   6000
      Visible         =   0   'False
      Width           =   1455
   End
   Begin CoolFlexGrid.CoolFlex CoolFlex1 
      Height          =   4815
      Left            =   120
      TabIndex        =   4
      Top             =   1100
      Width           =   11115
      _ExtentX        =   19606
      _ExtentY        =   8493
   End
   Begin VB.Label lbl_Num_Alu 
      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        =   11
      Top             =   6000
      Width           =   2655
   End
End
Attribute VB_Name = "Form_Captura"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Btn_Gra_cap_Click()
On Error GoTo controler
Cod_Ens = devuelvecampo("CODIGOS_ENSENANZA", "", "COD_ENS", "DES_ENS ='" & Me.Cmb_Cod_ens & "'", conn)
'conn.BeginTrans
For i = 1 To CoolFlex1.Rows - 1
       
    With CoolFlex1
                If .TextMatrix(i, 2) = "C" Then
                    C2 = "1"
                Else
                    C2 = "2"
                End If
                
                If .TextMatrix(i, 3) = "C" Then
                    C3 = "1"
                Else
                    C3 = "2"
                End If
                
                If .TextMatrix(i, 4) = "C" Then
                    C4 = "1"
                Else
                    C4 = "2"
                End If
                
                If .TextMatrix(i, 5) = "C" Then
                    C5 = "1"
                Else
                    C5 = "2"
                End If
                
                If .TextMatrix(i, 6) = "C" Then
                    C6 = "1"
                Else
                    C6 = "2"
                End If
                
                If .TextMatrix(i, 7) = "C" Then
                    C7 = "1"
                Else
                    C7 = "2"
                End If
                
                If .TextMatrix(i, 8) = "C" Then
                    C8 = "1"
                Else
                    C8 = "2"
                End If
                
                conn.Execute "UPDATE ALU_X_CUR Set IND_BEN_JUNAEB ='" & C2 & "', IND_BEN_CHI_SOL ='" & C3 & "', IND_ALU_INT ='" & C4 & "', IND_GRU_DIF ='" & C5 & "', IND_REP ='" & C7 & "' WHERE CI_ALU ='" & .TextMatrix(i, 0) & "' AND COD_ENS ='" & Cod_Ens & "' AND ACTIVO_ALU ='SI' AND NUM_GRA ='" & Me.Cmb_Grado & "' AND LET_CUR ='" & Me.Cmb_let_cur & "'"
                conn.Execute "UPDATE POSTULANTES Set INDIGENA ='" & C6 & "', IND_EMBARAZO ='" & C8 & "' WHERE CI_ALU ='" & .TextMatrix(i, 0) & "'"
                
    End With
Next i
        'conn.CommitTrans
        MsgBox "Los datos han sido grabados satisfactoriamente", vbInformation + vbOKOnly, "Mensaje de Gescol"
Exit Sub
controler:
MsgBox Err.Description, vbCritical + vbOKOnly, "Error número :" & Err.Number
'conn.RollbackTrans
MsgBox "Los datos no fueron grabados.", vbInformation + vbOKOnly, "Mensaje de Gescol"
End Sub

Private Sub Btn_Sal_Cap_Click()
Unload Me
End Sub

Private Sub Cmb_Cod_ens_Click()
If Len(Me.Cmb_Cod_ens) <> 0 Then
 nivel = devuelvecampo("codigos_ensenanza", "des_ens", "num_gra_max", "des_ens = " & "'" & Me.Cmb_Cod_ens.Text & "'", conn)
 Cmb_Grado.Enabled = True
 Cmb_Grado.Clear
 For t = 1 To Val(nivel)
    Cmb_Grado.AddItem t
 Next t
End If

End Sub

Private Sub Cmb_Grado_Click()
CodModalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.Cmb_Cod_ens.Text & "'", conn)
Ngrado = Me.Cmb_Grado.Text
Cmb_let_cur.Clear
Call llenacombo(Cmb_let_cur, "cursos", "let_cur", "where cod_ens = '" & CodModalidad & "' and num_gra = '" & Ngrado & "'", conn)
'btn_carga_asignaturas_Click
Me.Cmb_let_cur.Enabled = True

End Sub

Private Sub Cmb_let_cur_Click()

Call Command1_Click

End Sub

Private Sub Command1_Click()
CoolFlex1.Clear
CoolFlex1.EditEnable = True
'******** Encabezado **********
CoolFlex1.Row = 0
With CoolFlex1
    .Col = 0: .Text = "RUN"
    .Col = 1: .Text = "Nombre Alumno"
    .Col = 2: .Text = "Junaeb": .ColType 2, eCheckbox
    .Col = 3: .Text = "Chile Solidario": .ColType 3, eCheckbox
    .Col = 4: .Text = "Integrado": .ColType 4, eCheckbox
    .Col = 5: .Text = "En grupo diferencial": .ColType 5, eCheckbox
    .Col = 6: .Text = "Indígena": .ColType 6, eCheckbox
    .Col = 7: .Text = "Repitente": .ColType 7, eCheckbox
    .Col = 8: .Text = "Embarazada": .ColType 8, eCheckbox
End With
'******** FIN Encabezado **********

CodModalidad = devuelvecampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.Cmb_Cod_ens.Text & "'", conn)



Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
a = "SELECT P.CI_ALU, P.NOM_ALU, P.APE_PAT_ALU, P.APE_MAT_ALU, P.INDIGENA, P.IND_EMBARAZO, AC.IND_BEN_JUNAEB, " & _
    "AC.IND_BEN_CHI_SOL, AC.IND_ALU_INT, AC.IND_GRU_DIF, AC.IND_REP, AC.FEC_MAT " & _
    "FROM POSTULANTES P, ALU_X_CUR AC " & _
    "WHERE P.CI_ALU = AC.CI_ALU AND AC.COD_ENS ='" & CodModalidad & "' AND " & _
    "AC.NUM_GRA ='" & Me.Cmb_Grado & "' AND " & _
    "AC.ACTIVO_ALU ='SI' AND " & _
    "AC.fec_cam ='1111-11-11' AND " & _
    "AC.LET_CUR ='" & Me.Cmb_let_cur & "' " & _
    "ORDER BY APE_PAT_ALU ASC, APE_MAT_ALU ASC, NOM_ALU ASC"

rs.Open a, conn
If rs.RecordCount > 0 Then

     While Not rs.EOF
       i = i + 1
       CoolFlex1.Rows = i + 1
       CoolFlex1.Row = i
       CoolFlex1.Col = 0: CoolFlex1.Text = rs("CI_ALU")
       CoolFlex1.Col = 1: CoolFlex1.Text = rs("APE_PAT_ALU") & " , " & rs("APE_MAT_ALU") & " , " & rs("NOM_ALU")
       
       CoolFlex1.Col = 2
       If IsNull(rs("IND_BEN_JUNAEB")) Or rs("IND_BEN_JUNAEB") <> "1" Then
            CoolFlex1.Text = "U"
            Else
            CoolFlex1.Text = "C"
       End If
       
       CoolFlex1.Col = 3
       If IsNull(rs("IND_BEN_CHI_SOL")) Or rs("IND_BEN_CHI_SOL") <> "1" Then
            CoolFlex1.Text = "U"
            Else
            CoolFlex1.Text = "C"
       End If
       
       CoolFlex1.Col = 4
       If IsNull(rs("IND_ALU_INT")) Or rs("IND_ALU_INT") <> "1" Then
            CoolFlex1.Text = "U"
            Else
            CoolFlex1.Text = "C"
       End If
       
       CoolFlex1.Col = 5
       If IsNull(rs("IND_GRU_DIF")) Or rs("IND_GRU_DIF") <> "1" Then
            CoolFlex1.Text = "U"
            Else
            CoolFlex1.Text = "C"
       End If
       
       CoolFlex1.Col = 6
       If IsNull(rs("INDIGENA")) Or rs("INDIGENA") <> "1" Then
            CoolFlex1.Text = "U"
            Else
            CoolFlex1.Text = "C"
       End If
       
       CoolFlex1.Col = 7
       If IsNull(rs("IND_REP")) Or rs("IND_REP") <> "1" Then
            CoolFlex1.Text = "U"
            Else
            CoolFlex1.Text = "C"
       End If
       
       CoolFlex1.Col = 8
       If IsNull(rs("IND_EMBARAZO")) Or rs("IND_EMBARAZO") <> "1" Then
            CoolFlex1.Text = "U"
            Else
            CoolFlex1.Text = "C"
       End If

       'CoolFlex1.Col = 3 ': CoolFlex1.Text = rs("IND_BEN_CHI_SOL")
       'CoolFlex1.Col = 4 ': CoolFlex1.Text = rs("IND_ALU_INT")
       'CoolFlex1.Col = 5 ': CoolFlex1.Text = rs("IND_GRU_DIF")
       'CoolFlex1.Col = 6 ': CoolFlex1.Text = rs("INDIGENA")
       'CoolFlex1.Col = 7 ': CoolFlex1.Text = rs("IND_REP")
       'CoolFlex1.Col = 8 ': CoolFlex1.Text = rs("IND_EMBARAZO")

             
       
       rs.MoveNext
    Wend

End If
Me.lbl_Num_Alu.Caption = "Alumnos en el curso :" & i
rs.Close

End Sub

Private Sub Form_Load()
With CoolFlex1

.Cols = 9
.Rows = 2
.FixedCols = 2
.FixedRows = 1
.ColWidth(0) = 1000
.ColWidth(1) = 4000
.ColWidth(2) = 700
.ColWidth(3) = 1100
.ColWidth(4) = 850
.ColWidth(5) = 1550
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 1000
End With
CentrarForma Me
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
'********* Llena combos ****************
Call llenacombo(Form_Captura.Cmb_Cod_ens, "codigos_ensenanza", "des_ens", "order by ord_ens", conn)
End Sub


