VERSION 5.00
Begin VB.Form Form_InformeBecas 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   3870
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5655
   Icon            =   "Form_InformeBecas.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3870
   ScaleWidth      =   5655
   Begin VB.Frame Frame_cursos_becados 
      Caption         =   "Listado Resevado de Alumnos Becados"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   3615
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5415
      Begin VB.Frame Frame_Tipo_informe 
         Caption         =   "Tipo de Listado"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C00000&
         Height          =   2055
         Left            =   120
         TabIndex        =   13
         Top             =   1440
         Width           =   1815
         Begin VB.OptionButton Option_vulnerable 
            Caption         =   "Vulnerables"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   120
            TabIndex        =   17
            Top             =   1200
            Width           =   1575
         End
         Begin VB.OptionButton Option_todas 
            Caption         =   "Todas"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   195
            Left            =   120
            TabIndex        =   16
            Top             =   1680
            Width           =   1335
         End
         Begin VB.OptionButton Option_Libre 
            Caption         =   "Libre Disponibilidad"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   120
            TabIndex        =   15
            Top             =   720
            Width           =   1575
         End
         Begin VB.OptionButton Option_Economica 
            Caption         =   "Socio-Economica"
            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        =   14
            Top             =   360
            Value           =   -1  'True
            Width           =   1575
         End
      End
      Begin VB.ComboBox Cmb_anho_Becados 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   2040
         TabIndex        =   11
         Top             =   360
         Width           =   1095
      End
      Begin VB.ComboBox cmb_modalidad_becados 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   2040
         TabIndex        =   8
         Top             =   720
         Width           =   3255
      End
      Begin VB.ListBox lst_cursos_becados 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1980
         Left            =   2040
         Style           =   1  'Checkbox
         TabIndex        =   7
         Top             =   1080
         Width           =   1455
      End
      Begin VB.CheckBox chk_todos_cursos_becados 
         Caption         =   "Todos los cursos"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2040
         TabIndex        =   6
         Top             =   3240
         Width           =   1575
      End
      Begin VB.Frame Frame5 
         Height          =   2055
         Left            =   3600
         TabIndex        =   1
         Top             =   1080
         Width           =   1695
         Begin VB.CommandButton btn_can_cursos 
            Caption         =   "Cancelar"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   120
            TabIndex        =   5
            Top             =   1440
            Width           =   1455
         End
         Begin VB.CommandButton btn_rep_cursos 
            Caption         =   "Generar Reporte"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   120
            TabIndex        =   4
            Top             =   960
            Width           =   1455
         End
         Begin VB.OptionButton opt_destino_cartola 
            Caption         =   "Pantalla"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   0
            Left            =   360
            TabIndex        =   3
            Top             =   240
            Width           =   1095
         End
         Begin VB.OptionButton opt_destino_cartola 
            Caption         =   "Impresora"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   1
            Left            =   360
            TabIndex        =   2
            Top             =   600
            Width           =   1095
         End
      End
      Begin VB.Label Label1 
         Caption         =   "Año"
         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        =   12
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label3 
         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          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   720
         Width           =   1695
      End
      Begin VB.Label Label4 
         Caption         =   "Cursos"
         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        =   9
         Top             =   1080
         Width           =   855
      End
   End
End
Attribute VB_Name = "Form_InformeBecas"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btn_can_cursos_Click()
Unload Me
End Sub

Private Sub btn_rep_cursos_Click()
    Dim Ngrado As String
    Dim Letra As String
    Dim SelCursos As String
    Dim modalidad As String
    Dim Con As Integer
    Dim Prueba As String
    Dim PrUeBa2 As Long
    
    Con = 0
    SelCursos = ""
    
    'cambiar el '> 2005' por >= variable de año de trabajo (>= Anno)
    If (val(Cmb_anho_Becados.Text) >= Anno And Option_Libre.Value = True) Then
        CalculaTercio val(Cmb_anho_Becados.Text), conn
    End If
    
    conn.Execute "DELETE FROM becas WHERE agno='" & Cmb_anho_Becados.Text & "';"
    
    conn.Execute "INSERT INTO becas(run_alu,agno,fec_mat,tipo_beca,monto_excencion,observaciones) " & _
                 "SELECT ci_alu as 'run_alu', anno_mat as 'agno', fec_mat, 2 as 'tipo_beca',if(ind_beca=1,100,If(ind_mbeca=1,50,if(tercio='SI',tercio_por,0))) as 'monto_excencion', if((fec_retiro='1111-11-11'),'',concat('Retirado el día ',date_format(fec_retiro,'%d-%m-%Y'),'.') ) as 'observaciones' " & _
                 "FROM matriculas " & _
                 "WHERE anno_mat='" & Cmb_anho_Becados.Text & "' AND (ind_beca=1 or ind_mbeca=1 or tercio='SI' or tercio = 'VU') AND confirmado='SI'"
    
    If Me.lst_cursos_becados.SelCount > 0 And Me.cmb_modalidad_becados.Text <> "" Then
        modalidad = DevuelveCampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.cmb_modalidad_becados.Text & "'", conn)
        For t = 0 To Me.lst_cursos_becados.ListCount - 1
            If Me.lst_cursos_becados.Selected(t) Then
                Con = t
            End If
        Next t
        For t = 0 To Me.lst_cursos_becados.ListCount - 1
            If Me.lst_cursos_becados.Selected(t) Then
                Ngrado = Anuevocurso(t, 1)
                Letra = Anuevocurso(t, 2)
                If t = Con Then
                    SelCursos = SelCursos & "({alu_x_cur.num_gra}  = '" & Ngrado & "' and {alu_x_cur.let_cur} = '" & Letra & "' and {alu_x_cur.cod_ens} ='" & modalidad & "')"
                Else
                    SelCursos = SelCursos & "({alu_x_cur.num_gra}  = '" & Ngrado & "' and {alu_x_cur.let_cur} = '" & Letra & "' and {alu_x_cur.cod_ens} ='" & modalidad & "')" & " or "
                End If
            End If
        Next
        
        SelCursos = "(" & SelCursos & ") and {alu_x_cur.agno} = " & Me.Cmb_anho_Becados.Text & " and {alu_x_cur.num_cam} = '00' and {becas.agno} = " & Me.Cmb_anho_Becados.Text
        
        If Option_Economica Then
            SelCursos = SelCursos & " and {matriculas.TERCIO}<>'SI' and {matriculas.TERCIO}<>'VU'"
        ElseIf Option_Libre Then
            SelCursos = SelCursos & " and {matriculas.TERCIO}='SI' and {matriculas.ACTIVO_ALU}='SI'"
        ElseIf Option_vulnerable Then
            SelCursos = SelCursos & " and {matriculas.TERCIO}='VU' and {matriculas.ACTIVO_ALU}='SI'"
        End If
        
        Set rs = New ADODB.Recordset
        rs.CursorLocation = adUseClient
        rs.Open "select nom_est, dir_est, localidad_est from establecimientos", conn
        If rs.RecordCount > 0 Then
            Nombrecol = rs("Nom_est")
            Direccol = rs("Dir_est")
            ComunaCol = rs("Localidad_est")
        End If
        rs.Close
        Set rs = Nothing
        Titulo = "LISTADO RESERVADO DE ALUMNOS BECADOS AÑO " & Me.Cmb_anho_Becados
        Form_main.CrystalReport.ReportFileName = DirAplicacion & "\rpt\becados.rpt"
        'Form_main.CrystalReport. = "maipu_01"
        Form_main.CrystalReport.Formulas(0) = "nombrecolegio = '" & Nombrecol & "'"
        Form_main.CrystalReport.Formulas(1) = "direccioncolegio = '" & Direccol & "'"
        Form_main.CrystalReport.Formulas(2) = "comunacolegio = '" & ComunaCol & "'"
        Form_main.CrystalReport.Formulas(3) = "titulo= '" & Titulo & "'"
        Form_main.CrystalReport.Formulas(4) = "hora = '" & Time & "'"
        Form_main.CrystalReport.Formulas(5) = "anhoescolar = '" & Me.Cmb_anho_Becados & "'"
        Form_main.CrystalReport.WindowTitle = Titulo
        Form_main.CrystalReport.ReplaceSelectionFormula ("")
        Form_main.CrystalReport.ReplaceSelectionFormula (SelCursos)
        Form_main.CrystalReport.WindowState = crptMaximized
        Form_main.CrystalReport.Action = 1
        Form_main.CrystalReport.ReplaceSelectionFormula ("")
        Call LimpiaFormulas(Form_main.CrystalReport, 30)
    Else
        MsgBox ("Faltan opciones por seleccionar")
    End If
End Sub

Private Sub chk_todos_cursos_becados_Click()
    If Me.chk_todos_cursos_becados.Value Then
        For t = 0 To Me.lst_cursos_becados.ListCount - 1
            Me.lst_cursos_becados.Selected(t) = True
        Next t
    Else
        For t = 0 To Me.lst_cursos_becados.ListCount - 1
            Me.lst_cursos_becados.Selected(t) = False
            Me.lst_cursos_becados.ListIndex = 0
        Next t
    End If
End Sub

Private Sub Cmb_anho_Beca_Change()

End Sub

Private Sub cmb_modalidad_becados_Click()
modalidad = DevuelveCampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & cmb_modalidad_becados.Text & "'", conn)
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "SELECT num_gra, let_cur FROM CURSOS where cod_ens ='" & modalidad & "' AND AGNO='" & Cmb_anho_Becados.Text & "' ORDER BY NUM_GRA,let_cur", conn
If rs.RecordCount > 0 Then
    ReDim Anuevocurso(rs.RecordCount, 2)
    Me.lst_cursos_becados.Clear
    Me.chk_todos_cursos_becados.Value = 0
    c = 0
    While Not rs.EOF
        lst_cursos_becados.AddItem rs("num_gra") + " " + rs("LET_CUR")
        Anuevocurso(c, 1) = rs("num_gra")
        Anuevocurso(c, 2) = rs("let_cur")
        rs.MoveNext
        c = c + 1
    Wend
    End If
rs.Close
Set rs = Nothing
End Sub

Private Sub Form_Load()
If MenuInformesBeca = "becados" Then
    '***** Listado de Becados *****
    Me.Caption = "Listado Reservado de Alumnos Becados"
    Me.Height = 4290
    Me.Width = 5740
    Call HideFrameBecados
    Me.Frame_cursos_becados.Top = 120
    Me.Frame_cursos_becados.Left = 120
    Me.Frame_cursos_becados.Visible = True
    Call LlenaCombo(cmb_modalidad_becados, "codigos_ensenanza", "des_ens", "order by ord_ens", conn)
    For i = 2005 To Year(Date)
        Me.Cmb_anho_Becados.AddItem i
    Next i
    Me.Cmb_anho_Becados.Text = Year(Date)
    Me.opt_destino_cartola(0).Value = True
    CentrarForma Me
End If
End Sub

Private Sub lst_cursos_Click()

End Sub
Sub HideFrameBecados()
Me.Frame_cursos_becados.Visible = False
End Sub

