VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Object = "{00025600-0000-0000-C000-000000000046}#4.6#0"; "crystl32.ocx"
Begin VB.Form frmActaFinal 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   6795
   ClientLeft      =   45
   ClientTop       =   300
   ClientWidth     =   11655
   Icon            =   "frmActaFinal.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6795
   ScaleWidth      =   11655
   Visible         =   0   'False
   Begin VB.Frame fraNomLic 
      Enabled         =   0   'False
      Height          =   6255
      Left            =   120
      TabIndex        =   67
      Top             =   6960
      Visible         =   0   'False
      Width           =   11535
      Begin VB.CommandButton Command1 
         Caption         =   "Exportar Excel"
         Height          =   375
         Left            =   4920
         TabIndex        =   108
         Top             =   5640
         Width           =   1695
      End
      Begin VB.CommandButton cmdNomLic 
         Caption         =   "&Generar"
         Height          =   375
         Index           =   0
         Left            =   1200
         TabIndex        =   70
         Top             =   5640
         Width           =   1695
      End
      Begin VB.CommandButton cmdNomLic 
         Caption         =   "Cancelar"
         Height          =   375
         Index           =   1
         Left            =   8640
         TabIndex        =   69
         Top             =   5640
         Width           =   1695
      End
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid grDatAlu 
         Height          =   5175
         Left            =   120
         TabIndex        =   68
         Top             =   240
         Width           =   11295
         _ExtentX        =   19923
         _ExtentY        =   9128
         _Version        =   393216
         Cols            =   12
         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
         _NumberOfBands  =   1
         _Band(0).Cols   =   12
      End
   End
   Begin Crystal.CrystalReport CrystalReport1 
      Left            =   12000
      Top             =   1920
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   262150
   End
   Begin VB.Frame fraConeccion 
      BorderStyle     =   0  'None
      Height          =   300
      Left            =   4800
      TabIndex        =   11
      Top             =   9960
      Visible         =   0   'False
      Width           =   3255
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   22
         Left            =   2880
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   0
         Left            =   240
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   1
         Left            =   360
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   2
         Left            =   480
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   3
         Left            =   600
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   4
         Left            =   720
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   5
         Left            =   840
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00C0FFC0&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   6
         Left            =   960
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderStyle     =   0  'Transparent
         FillColor       =   &H0080FF80&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   7
         Left            =   1080
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H0000FF00&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   8
         Left            =   1200
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H0000C000&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   9
         Left            =   1320
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00C0FFC0&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   10
         Left            =   1440
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   11
         Left            =   1560
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   12
         Left            =   1680
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   13
         Left            =   1800
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   14
         Left            =   1920
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   15
         Left            =   2040
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   16
         Left            =   2160
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   17
         Left            =   2280
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   18
         Left            =   2400
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   19
         Left            =   2520
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   20
         Left            =   2640
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape2 
         BorderColor     =   &H00FFFFFF&
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   135
         Index           =   21
         Left            =   2760
         Shape           =   1  'Square
         Top             =   120
         Width           =   135
      End
      Begin VB.Shape Shape1 
         FillColor       =   &H00FFFFFF&
         FillStyle       =   0  'Solid
         Height          =   165
         Left            =   120
         Shape           =   4  'Rounded Rectangle
         Top             =   100
         Width           =   3015
      End
   End
   Begin MSComDlg.CommonDialog CD 
      Left            =   12000
      Top             =   1080
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Timer tmConeccion 
      Enabled         =   0   'False
      Interval        =   50
      Left            =   3960
      Top             =   8040
   End
   Begin VB.Frame fraPrincipal 
      Height          =   6495
      Left            =   120
      TabIndex        =   9
      Top             =   120
      Visible         =   0   'False
      Width           =   11415
      Begin VB.TextBox txtActaCurso 
         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
         Index           =   12
         Left            =   4080
         TabIndex        =   58
         Top             =   240
         Width           =   3870
      End
      Begin VB.TextBox txtActaCurso 
         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
         Index           =   11
         Left            =   2400
         TabIndex        =   57
         Top             =   240
         Width           =   1620
      End
      Begin VB.Frame fraBotPro 
         Height          =   855
         Left            =   2520
         TabIndex        =   10
         Top             =   5520
         Visible         =   0   'False
         Width           =   6015
         Begin VB.CommandButton cmdActaRech 
            BackColor       =   &H00E0E0E0&
            Caption         =   "&Nomina Licenciados"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   495
            Index           =   3
            Left            =   4440
            TabIndex        =   3
            Top             =   240
            Width           =   1455
         End
         Begin VB.CommandButton cmdActaRech 
            BackColor       =   &H00E0E0E0&
            Caption         =   "&TXT Actas"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   495
            Index           =   2
            Left            =   3000
            TabIndex        =   2
            Top             =   240
            Width           =   1455
         End
         Begin VB.CommandButton cmdActaRech 
            BackColor       =   &H00FFFFFF&
            Caption         =   "&Actas"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   495
            Index           =   1
            Left            =   1560
            TabIndex        =   1
            Top             =   240
            Width           =   1455
         End
         Begin VB.CommandButton cmdActaRech 
            Caption         =   "&Certificados"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   495
            Index           =   0
            Left            =   120
            TabIndex        =   0
            Top             =   240
            Width           =   1455
         End
      End
      Begin VB.Frame fraCurso 
         Height          =   4935
         Left            =   120
         TabIndex        =   12
         Top             =   600
         Visible         =   0   'False
         Width           =   3615
         Begin VB.CommandButton cmdElBoton 
            Caption         =   "Profes y sub sec"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   555
            Left            =   2400
            TabIndex        =   107
            Top             =   2160
            Visible         =   0   'False
            Width           =   1095
         End
         Begin VB.ComboBox cmbSelAgno 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   330
            ItemData        =   "frmActaFinal.frx":2A8B2
            Left            =   120
            List            =   "frmActaFinal.frx":2A8B4
            Style           =   2  'Dropdown List
            TabIndex        =   88
            Top             =   480
            Width           =   1335
         End
         Begin VB.CommandButton cmdVerActa 
            Caption         =   "Comple&to"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Index           =   2
            Left            =   2400
            TabIndex        =   83
            Top             =   4440
            Visible         =   0   'False
            Width           =   1095
         End
         Begin VB.CommandButton cmdVerActa 
            Caption         =   "&Siguiente >>"
            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          =   375
            Index           =   0
            Left            =   2400
            TabIndex        =   16
            Top             =   3480
            Width           =   1095
         End
         Begin VB.ListBox lstLetra 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   2370
            Left            =   960
            TabIndex        =   15
            Top             =   2400
            Width           =   615
         End
         Begin VB.ListBox lstNivel 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   2370
            Left            =   120
            TabIndex        =   14
            Top             =   2400
            Width           =   615
         End
         Begin VB.ListBox lstModalidad 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   690
            Left            =   120
            TabIndex        =   13
            Top             =   1200
            Width           =   3255
         End
         Begin VB.CommandButton cmdVerActa 
            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
            Index           =   1
            Left            =   2400
            TabIndex        =   17
            Top             =   3960
            Width           =   1095
         End
         Begin VB.Label lblAgno 
            Caption         =   "Seleccion el 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            =   120
            TabIndex        =   87
            Top             =   240
            Width           =   1455
         End
         Begin VB.Label lblCurso 
            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
            Index           =   0
            Left            =   120
            TabIndex        =   29
            Top             =   960
            Width           =   1695
         End
         Begin VB.Label lblCurso 
            Caption         =   "Grado"
            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            =   120
            TabIndex        =   28
            Top             =   2160
            Width           =   615
         End
         Begin VB.Label lblCurso 
            Caption         =   "Letra"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   2
            Left            =   960
            TabIndex        =   18
            Top             =   2160
            Width           =   615
         End
      End
      Begin VB.Frame fraCert 
         Height          =   4935
         Left            =   3720
         TabIndex        =   62
         Top             =   600
         Visible         =   0   'False
         Width           =   7575
         Begin VB.OptionButton optAls 
            Caption         =   "Curso completo"
            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            =   120
            TabIndex        =   76
            Top             =   720
            Width           =   1935
         End
         Begin VB.OptionButton optAls 
            Caption         =   "Por Alumno"
            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            =   2280
            TabIndex        =   75
            Top             =   720
            Width           =   1935
         End
         Begin VB.Frame fraDesCert 
            Height          =   3615
            Left            =   5520
            TabIndex        =   74
            Top             =   1200
            Width           =   1935
            Begin VB.Frame Frame2 
               Height          =   1095
               Left            =   120
               TabIndex        =   79
               Top             =   120
               Width           =   1695
               Begin VB.OptionButton optDesCert 
                  Caption         =   "Impresora"
                  BeginProperty Font 
                     Name            =   "Arial"
                     Size            =   8.25
                     Charset         =   0
                     Weight          =   400
                     Underline       =   0   'False
                     Italic          =   0   'False
                     Strikethrough   =   0   'False
                  EndProperty
                  Height          =   195
                  Index           =   0
                  Left            =   240
                  TabIndex        =   81
                  Top             =   240
                  Width           =   1335
               End
               Begin VB.OptionButton optDesCert 
                  Caption         =   "Pantalla"
                  BeginProperty Font 
                     Name            =   "Arial"
                     Size            =   8.25
                     Charset         =   0
                     Weight          =   400
                     Underline       =   0   'False
                     Italic          =   0   'False
                     Strikethrough   =   0   'False
                  EndProperty
                  Height          =   195
                  Index           =   1
                  Left            =   240
                  TabIndex        =   80
                  Top             =   600
                  Width           =   1215
               End
            End
            Begin VB.CommandButton cmdEmiCert 
               Caption         =   "Imprimir"
               BeginProperty Font 
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   375
               Index           =   0
               Left            =   360
               TabIndex        =   78
               Top             =   2640
               Width           =   1335
            End
            Begin VB.CommandButton cmdEmiCert 
               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
               Index           =   1
               Left            =   360
               TabIndex        =   77
               Top             =   3120
               Width           =   1335
            End
         End
         Begin VB.ListBox lstNomAls 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   3180
            Left            =   120
            Style           =   1  'Checkbox
            TabIndex        =   73
            Top             =   1440
            Width           =   5295
         End
         Begin VB.Label lblCertif 
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   12
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Index           =   2
            Left            =   5520
            TabIndex        =   82
            Top             =   825
            Width           =   1935
         End
         Begin VB.Label lblCertif 
            Caption         =   "Nombre del Alumno"
            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            =   120
            TabIndex        =   72
            Top             =   1200
            Width           =   2415
         End
         Begin VB.Label lblCertif 
            Caption         =   "Certificado Anual de Estudios"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   12
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Index           =   0
            Left            =   120
            TabIndex        =   71
            Top             =   240
            Width           =   3615
         End
      End
      Begin VB.Frame fraResumen 
         Enabled         =   0   'False
         Height          =   4935
         Left            =   3720
         TabIndex        =   30
         Top             =   600
         Visible         =   0   'False
         Width           =   7575
         Begin VB.TextBox txtActaCurso 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   525
            Index           =   13
            Left            =   120
            MultiLine       =   -1  'True
            ScrollBars      =   2  'Vertical
            TabIndex        =   24
            Top             =   4320
            Width           =   7275
         End
         Begin VB.TextBox txtActaCurso 
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   285
            Index           =   10
            Left            =   120
            TabIndex        =   23
            Top             =   3720
            Width           =   4755
         End
         Begin VB.TextBox txtActaCurso 
            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
            Index           =   0
            Left            =   3840
            TabIndex        =   60
            Top             =   240
            Width           =   3645
         End
         Begin VB.CommandButton cmdDetalle 
            Caption         =   "···"
            Height          =   195
            Index           =   1
            Left            =   4680
            TabIndex        =   46
            Top             =   1155
            Width           =   375
         End
         Begin VB.CommandButton cmdDetalle 
            Caption         =   "···"
            Height          =   195
            Index           =   6
            Left            =   4680
            TabIndex        =   45
            Top             =   2895
            Width           =   375
         End
         Begin VB.CommandButton cmdDetalle 
            Caption         =   "···"
            Height          =   195
            Index           =   5
            Left            =   4680
            TabIndex        =   44
            Top             =   2610
            Width           =   375
         End
         Begin VB.CommandButton cmdDetalle 
            Caption         =   "···"
            Height          =   195
            Index           =   4
            Left            =   4680
            TabIndex        =   43
            Top             =   2025
            Width           =   375
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   7
            Left            =   3840
            TabIndex        =   42
            Top             =   2610
            Width           =   645
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   6
            Left            =   3840
            TabIndex        =   41
            Top             =   2025
            Width           =   645
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   5
            Left            =   3840
            TabIndex        =   40
            Top             =   1740
            Width           =   645
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   4
            Left            =   3840
            TabIndex        =   39
            Top             =   1440
            Width           =   645
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   3
            Left            =   3840
            TabIndex        =   38
            Top             =   1155
            Width           =   645
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   2
            Left            =   3840
            TabIndex        =   37
            Top             =   840
            Width           =   645
         End
         Begin VB.TextBox txtActaCurso 
            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
            Index           =   1
            Left            =   3840
            TabIndex        =   36
            Top             =   570
            Width           =   1365
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   8
            Left            =   3840
            TabIndex        =   35
            Top             =   2895
            Width           =   645
         End
         Begin VB.TextBox txtActaCurso 
            Alignment       =   1  'Right Justify
            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
            Index           =   9
            Left            =   3840
            TabIndex        =   34
            Top             =   3165
            Width           =   645
         End
         Begin VB.CommandButton cmdDetalle 
            Caption         =   "···"
            Height          =   195
            Index           =   0
            Left            =   4680
            TabIndex        =   33
            Top             =   840
            Width           =   375
         End
         Begin VB.CommandButton cmdDetalle 
            Caption         =   "···"
            Height          =   195
            Index           =   2
            Left            =   4680
            TabIndex        =   32
            Top             =   1440
            Width           =   375
         End
         Begin VB.CommandButton cmdDetalle 
            Caption         =   "···"
            Height          =   195
            Index           =   3
            Left            =   4680
            TabIndex        =   31
            Top             =   1740
            Width           =   375
         End
         Begin VB.Frame fraActa 
            Height          =   3615
            Left            =   5280
            TabIndex        =   64
            Top             =   600
            Width           =   2175
            Begin VB.CommandButton cmdActCurs 
               Caption         =   "&Imprimir Acta"
               BeginProperty Font 
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   375
               Index           =   0
               Left            =   480
               TabIndex        =   26
               Top             =   2400
               Width           =   1335
            End
            Begin VB.Frame Frame1 
               Caption         =   "Destino"
               BeginProperty Font 
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   700
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               ForeColor       =   &H00C00000&
               Height          =   1695
               Left            =   120
               TabIndex        =   65
               Top             =   120
               Width           =   1935
               Begin MSComCtl2.UpDown UpDown 
                  Height          =   285
                  Left            =   1320
                  TabIndex        =   85
                  Top             =   840
                  Visible         =   0   'False
                  Width           =   240
                  _ExtentX        =   423
                  _ExtentY        =   503
                  _Version        =   393216
                  Value           =   3
                  AutoBuddy       =   -1  'True
                  BuddyControl    =   "txtCopias"
                  BuddyDispid     =   196642
                  OrigLeft        =   1200
                  OrigTop         =   960
                  OrigRight       =   1440
                  OrigBottom      =   1215
                  Max             =   4
                  Min             =   1
                  SyncBuddy       =   -1  'True
                  BuddyProperty   =   65547
                  Enabled         =   -1  'True
               End
               Begin VB.TextBox txtCopias 
                  BeginProperty Font 
                     Name            =   "Arial"
                     Size            =   8.25
                     Charset         =   0
                     Weight          =   400
                     Underline       =   0   'False
                     Italic          =   0   'False
                     Strikethrough   =   0   'False
                  EndProperty
                  Height          =   285
                  Left            =   1080
                  TabIndex        =   84
                  Text            =   "3"
                  Top             =   840
                  Visible         =   0   'False
                  Width           =   255
               End
               Begin VB.CheckBox chkH2 
                  Caption         =   "hoja 2"
                  BeginProperty Font 
                     Name            =   "Arial"
                     Size            =   8.25
                     Charset         =   0
                     Weight          =   400
                     Underline       =   0   'False
                     Italic          =   0   'False
                     Strikethrough   =   0   'False
                  EndProperty
                  Height          =   195
                  Left            =   1080
                  TabIndex        =   22
                  Top             =   1320
                  Width           =   735
               End
               Begin VB.CheckBox chkH1 
                  Caption         =   "hoja1"
                  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        =   21
                  Top             =   1320
                  Width           =   735
               End
               Begin VB.OptionButton OptDestino 
                  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           =   1
                  Left            =   360
                  TabIndex        =   20
                  Top             =   480
                  Width           =   1215
               End
               Begin VB.OptionButton OptDestino 
                  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           =   0
                  Left            =   360
                  TabIndex        =   19
                  Top             =   240
                  Width           =   1455
               End
               Begin VB.Label lblcopia 
                  Caption         =   "Copias"
                  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        =   86
                  Top             =   840
                  Visible         =   0   'False
                  Width           =   735
               End
            End
            Begin VB.CommandButton cmdActCurs 
               Caption         =   "Bloquear Acta"
               BeginProperty Font 
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   375
               Index           =   1
               Left            =   480
               TabIndex        =   27
               Top             =   3120
               Width           =   1335
            End
            Begin VB.CommandButton cmdActCurs 
               Caption         =   "&Profesores"
               BeginProperty Font 
                  Name            =   "Arial"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Height          =   375
               Index           =   2
               Left            =   480
               TabIndex        =   25
               Top             =   1920
               Width           =   1335
            End
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Observaciones"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   13
            Left            =   120
            TabIndex        =   66
            Top             =   4080
            Width           =   3015
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Encargado de Confeccion del Acta"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   11
            Left            =   120
            TabIndex        =   63
            Top             =   3480
            Width           =   3015
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Modalidad 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
            Index           =   10
            Left            =   120
            TabIndex        =   61
            Top             =   240
            Width           =   3615
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Total de Reprobados"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   8
            Left            =   480
            TabIndex        =   56
            Top             =   3165
            Width           =   2055
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Rendimiento"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   7
            Left            =   480
            TabIndex        =   55
            Top             =   2895
            Width           =   3015
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Inasistencia"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   6
            Left            =   480
            TabIndex        =   54
            Top             =   2610
            Width           =   3135
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Reprobados por:"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   5
            Left            =   120
            TabIndex        =   53
            Top             =   2310
            Width           =   4095
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Promovidos"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   4
            Left            =   120
            TabIndex        =   52
            Top             =   2025
            Width           =   3615
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Matrícula 30 de noviembre (final)"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   3
            Left            =   120
            TabIndex        =   51
            Top             =   1740
            Width           =   3615
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Retirados entre 1º de Mayo y 29 de Noviembre"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   2
            Left            =   120
            TabIndex        =   50
            Top             =   1440
            Width           =   3615
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Ingresos entre el 1º de Mayo y el 29 de Noviembre"
            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            =   120
            TabIndex        =   49
            Top             =   1155
            Width           =   3615
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Matricula al 30 de Abril"
            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            =   120
            TabIndex        =   48
            Top             =   870
            Width           =   3615
         End
         Begin VB.Label lblActaCurso 
            Caption         =   "Curso"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   9
            Left            =   120
            TabIndex        =   47
            Top             =   570
            Width           =   3615
         End
      End
      Begin VB.Frame fraWork 
         Height          =   4935
         Left            =   2400
         TabIndex        =   89
         Top             =   600
         Visible         =   0   'False
         Width           =   8895
         Begin VB.CommandButton cmdOk 
            Caption         =   "&Aceptar"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   3840
            TabIndex        =   106
            Top             =   4440
            Width           =   1335
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   7
            Left            =   1700
            TabIndex        =   105
            Top             =   3960
            Width           =   6800
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   6
            Left            =   1700
            TabIndex        =   104
            Top             =   3480
            Width           =   6800
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   5
            Left            =   1700
            TabIndex        =   103
            Top             =   3000
            Width           =   6800
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   4
            Left            =   1700
            TabIndex        =   102
            Top             =   2520
            Width           =   6800
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   3
            Left            =   1700
            TabIndex        =   101
            Top             =   2040
            Width           =   6800
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   2
            Left            =   1700
            TabIndex        =   100
            Top             =   1560
            Width           =   6800
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            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            =   1700
            TabIndex        =   99
            Top             =   1080
            Width           =   6800
         End
         Begin VB.Label lblNomArch 
            BorderStyle     =   1  'Fixed Single
            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            =   1700
            TabIndex        =   98
            Top             =   600
            Width           =   6800
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 8"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   7
            Left            =   400
            TabIndex        =   97
            Top             =   3960
            Width           =   1215
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 7"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   6
            Left            =   400
            TabIndex        =   96
            Top             =   3480
            Width           =   1215
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 6"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   5
            Left            =   400
            TabIndex        =   95
            Top             =   3000
            Width           =   1215
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 5"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   4
            Left            =   400
            TabIndex        =   94
            Top             =   2520
            Width           =   1215
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 4"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   3
            Left            =   400
            TabIndex        =   93
            Top             =   2040
            Width           =   1215
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 3"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   2
            Left            =   400
            TabIndex        =   92
            Top             =   1560
            Width           =   1215
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 2"
            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            =   400
            TabIndex        =   91
            Top             =   1080
            Width           =   1215
         End
         Begin VB.Label lblNombAr 
            BackColor       =   &H00C0FFC0&
            BorderStyle     =   1  'Fixed Single
            Caption         =   "Archivo Nº 1"
            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            =   400
            TabIndex        =   90
            Top             =   600
            Width           =   1215
         End
      End
      Begin VB.Label lblActaCurso 
         Caption         =   "Establecimiento"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   12
         Left            =   120
         TabIndex        =   59
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.Frame fraLista 
      BackColor       =   &H00E0E0E0&
      Enabled         =   0   'False
      Height          =   5175
      Left            =   120
      TabIndex        =   4
      Top             =   120
      Visible         =   0   'False
      Width           =   9135
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid grillaDatos 
         Height          =   3975
         Left            =   120
         TabIndex        =   8
         Top             =   600
         Width           =   8895
         _ExtentX        =   15690
         _ExtentY        =   7011
         _Version        =   393216
         GridLinesUnpopulated=   5
         MergeCells      =   2
         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
         _NumberOfBands  =   1
         _Band(0).Cols   =   2
      End
      Begin VB.CommandButton Command2 
         BackColor       =   &H00E0E0E0&
         Caption         =   "&Volver"
         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          =   375
         Left            =   6240
         TabIndex        =   7
         Top             =   4680
         Width           =   1335
      End
      Begin VB.CommandButton Command3 
         BackColor       =   &H00E0E0E0&
         Caption         =   "&Imprimir"
         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          =   375
         Left            =   7680
         TabIndex        =   6
         Top             =   4680
         Width           =   1335
      End
      Begin VB.TextBox Text1 
         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            =   120
         TabIndex        =   5
         Text            =   "Text1"
         Top             =   240
         Width           =   3015
      End
   End
End
Attribute VB_Name = "frmActaFinal"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnHistorico As ADODB.Connection
Dim Puntero As Integer
Dim Reporte As Integer ' 0 Ninguno, 1 Certificados, 2 Actas
Dim bActaOk As Boolean
Dim nAgno As String

Private Const gesCartola As Integer = 1
Private Const gesNominaActa As Integer = 2
Private Const gesMatInicialActa As Integer = 3
Private Const gesMatFinalActa As Integer = 4
Private Const gesAltasAgno As Integer = 5
Private Const gesBajasAgno As Integer = 6
Private Const gesSitFinalActa  As Integer = 7
Private Const hisNomMatInicial As Integer = 20
Private Const hisNomAlt As Integer = 21
Private Const hisNomBaj As Integer = 22
Private Const hisNomMatFinal As Integer = 23

Private Function GeneraTXT()
    Dim btnCancelar As Boolean
    Dim cnHist As ADODB.Connection
    Dim rsHist As ADODB.Recordset
    Dim nfile1 As String
    Dim nfile2 As String
    Dim nfile3 As String
    Dim nfile4 As String
    Dim nfile5 As String
    Dim nfile6 As String
    Dim nfile7 As String
    Dim nfile8 As String
    Dim RBD As String
    Dim linea As String
    nAgno = InputBox("Ingrese el año para el que desea crear los registros:", "Año a Generar", str(Year(Date)))
    nAgno = Trim(nAgno)
    Me.cmdActaRech.Item(0).Enabled = False
    Me.cmdActaRech.Item(1).Enabled = False
    Me.cmdActaRech.Item(2).Enabled = False
    Me.cmdActaRech.Item(3).Enabled = False
    Me.fraCurso.Visible = False
    Me.fraResumen.Visible = False
    Me.fraWork.Visible = True
    Set cnHist = NueConn(Servidor, Base, "kripplefight", "groot")
    cnHist.Open
    Set rsHist = New ADODB.Recordset
    rsHist.LockType = adLockReadOnly
    rsHist.CursorLocation = adUseClient
    Set rsHist = cnHist.Execute("SELECT RDB FROM ESTABLECIMIENTOS")
    RBD = rsHist("RDB")
    rsHist.Close
    Me.cd.FileName = "a" & RBD
    Me.cd.DefaultExt = "TXT"
    Me.cd.DialogTitle = "Seleccione destino archivos TXT"
    Me.cd.CancelError = True
    On Error GoTo Problemas
    
    Me.cd.ShowSave
    If Not btnCancelar Then
        nfile1 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_1.txt"
        nfile2 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_2.txt"
        nfile3 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_3.txt"
        nfile4 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_4.txt"
        nfile5 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_5.txt"
        nfile6 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_6.txt"
        nfile7 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_7.txt"
        nfile8 = Left(Me.cd.FileName, Len(Me.cd.FileName) - 6) & "_8.txt"
        Open nfile1 For Output As 1
        Open nfile2 For Output As 2
        Open nfile3 For Output As 3
        Open nfile4 For Output As 4
        Open nfile5 For Output As 5
        Open nfile6 For Output As 6
        Open nfile7 For Output As 7
        Open nfile8 For Output As 8
        Set rsHist = cnHist.Execute("SELECT 1 as  C, left(n.rbd,length(n.rbd)-2) as rbd, right(n.rbd,1) as d, left(n.run_alu,length(n.run_alu)-2) as run_est, right(n.run_alu,1) as cod_run, h.ape_pat, h.ape_mat, h.nombres, h.cod_sex, h.fec_nac, n.ind_ext FROM acta_nomina n, hist_alumno h WHERE n.run_alu=h.run_alu and n.agno='" & nAgno & "'")
        Me.lblNomArch(0).Caption = "Trabajando...."
        While Not rsHist.EOF
            DoEvents
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                If I = 9 Then
                    linea = linea & Format(Day(rsHist.Fields(I).Value), "00") & "/" & Format(Month(rsHist.Fields(I).Value), "00") & "/" & Format(Year(rsHist.Fields(I).Value), "0000") & Chr(9)
                Else
                    linea = linea & rsHist.Fields(I).Value & Chr(9)
                End If
            Next
            Print #1, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(0).Caption = nfile1
        Set rsHist = cnHist.Execute("SELECT 2 AS C , LEFT(RBD,LENGTH(RBD)-2) AS RBD, RIGHT(RBD,1) AS D, cod_ens, cod_gra, let_cur, agno, cod_dev, cod_ppp, cod_pla, LEFT(run_doc,LENGTH(run_doc)-2) AS run_doc, RIGHT(run_doc,1) AS cod_run FROM Acta_Inf_Cur WHERE agno='" & nAgno & "'")
        Me.lblNomArch(1).Caption = "Trabajando..."
        While Not rsHist.EOF
            DoEvents
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                linea = linea & rsHist.Fields(I).Value & Chr(9)
            Next
            Print #2, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(1).Caption = nfile2
        Set rsHist = cnHist.Execute("SELECT 3 AS C , LEFT(n.rbd,LENGTH(n.rbd)-2) AS RBD, RIGHT(n.rbd,1) AS D, s.cod_ens, s.cod_gra, s.let_cur, n.agno, LEFT(n.run_alu,LENGTH(n.run_alu)-2) AS run_est, RIGHT(n.run_alu,1) AS cod_run, n.cod_com FROM Acta_Nomina n LEFT JOIN  Hist_Alumno h ON n.run_alu=h.run_alu LEFT JOIN Acta_Sit_Pro s ON n.run_alu=s.run_alu AND n.agno=s.agno WHERE n.agno='" & nAgno & "'")
        Me.lblNomArch(2).Caption = "Trabajando..."
        While Not rsHist.EOF
            DoEvents
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                linea = linea & rsHist.Fields(I).Value & Chr(9)
            Next
            Print #3, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(2).Caption = nfile3
        Set rsHist = cnHist.Execute("SELECT 4 AS C , LEFT(a.rbd,LENGTH(a.rbd)-2) AS RBD, RIGHT(a.rbd,1) AS D, a.cod_ens, a.cod_gra, a.let_cur, a.agno, LEFT(a.run_alu,LENGTH(a.run_alu)-2) AS run_est, RIGHT(a.run_alu,1) AS cod_run, a.cod_ppp, a.cod_pla, a.cod_asi, a.nota, a.conce, a.al_exi FROM Acta_ant_Aca a WHERE a.agno='" & nAgno & "'")
        Me.lblNomArch(3).Caption = "Trabajando..."
        While Not rsHist.EOF
            DoEvents
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                If UCase(rsHist.Fields(I).Name) = "NOTA" Then
                    linea = linea & Left(Format(rsHist.Fields(I).Value, "0.0"), 1) & "." & Right(Format(rsHist.Fields(I).Value, "0.0"), 1) & Chr(9)
                Else
                    linea = linea & rsHist.Fields(I).Value & Chr(9)
                End If
            Next
            Print #4, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(3).Caption = nfile4
        Set rsHist = cnHist.Execute("SELECT 5 AS C , LEFT(s.rbd,LENGTH(s.rbd)-2) AS RBD, RIGHT(s.rbd,1) AS D, s.cod_ens, s.cod_gra, s.let_cur, s.agno, LEFT(s.run_alu,LENGTH(s.run_alu)-2) AS run_est, RIGHT(s.run_alu,1) AS cod_run, s.pro_gen, s.por_asi, s.observa, s.sit_fin, s.tip_pro FROM Acta_Sit_Pro s WHERE s.agno='" & nAgno & "'")
        Me.lblNomArch(4).Caption = "Trabajando..."
        While Not rsHist.EOF
            DoEvents
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                If UCase(rsHist.Fields(I).Name) = "PRO_GEN" Then
                    linea = linea & Left(Format(rsHist.Fields(I).Value, "0.0"), 1) & "." & Right(Format(rsHist.Fields(I).Value, "0.0"), 1) & Chr(9)
                Else
                    linea = linea & rsHist.Fields(I).Value & Chr(9)
                End If
            Next
            Print #5, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(4).Caption = nfile5
        Set rsHist = cnHist.Execute("SELECT 6 AS C , LEFT(d.rbd,LENGTH(d.rbd)-2) AS RBD, RIGHT(d.rbd,1) AS D, d.cod_ens, d.cod_gra, d.let_cur, d.agno, d.cod_ppp, d.cod_pla, d.cod_asi, LEFT(d.run_doc,LENGTH(d.run_doc)-2) AS run_doc, RIGHT(d.run_doc,1) AS cod_run, d.ape_pat, d.ape_mat, d.nombres  FROM Acta_Doc_Sub d WHERE d.agno='" & nAgno & "'")
        Me.lblNomArch(5).Caption = "Trabajando..."
        While Not rsHist.EOF
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                linea = linea & rsHist.Fields(I).Value & Chr(9)
            Next
            Print #6, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(5).Caption = nfile6
        Set rsHist = cnHist.Execute("SELECT 7 AS C , LEFT(a.rbd,LENGTH(a.rbd)-2) AS RBD, RIGHT(a.rbd,1) AS D, a.cod_ens, a.cod_gra, a.let_cur, a.agno, a.mat_abr, a.mat_nov, a.est_pro, a.rep_ina, a.rep_ren, a.est_ing, a.est_ret, a.enc_acta, a.fec_act, a.dir_est, a.pro_jef FROM Acta_Act_Cur a WHERE a.agno='" & nAgno & "'")
        Me.lblNomArch(6).Caption = "Trabajando..."
        While Not rsHist.EOF
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                If UCase(rsHist.Fields(I).Name) = "FEC_ACT" Then
                    linea = linea & Day(rsHist.Fields(I).Value) & "/" & Month(rsHist.Fields(I).Value) & "/" & Year(rsHist.Fields(I).Value) & Chr(9)
                Else
                    linea = linea & rsHist.Fields(I).Value & Chr(9)
                End If
            Next
            Print #7, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(6).Caption = nfile7
        Set rsHist = cnHist.Execute("SELECT DISTINCT 8 AS C , LEFT(rbd,LENGTH(rbd)-2) AS RBD, RIGHT(rbd,1) AS D, agno, cod_asi, des_asi FROM Acta_Sub_Sec WHERE agno='" & nAgno & "'")
        Me.lblNomArch(7).Caption = "Trabajando..."
        While Not rsHist.EOF
            linea = ""
            For I = 0 To rsHist.Fields.count - 1
                linea = linea & rsHist.Fields(I).Value & Chr(9)
            Next
            Print #8, Left(linea, Len(linea) - 1)
            rsHist.MoveNext
        Wend
        rsHist.Close
        Me.lblNomArch(7).Caption = nfile8
        Close 1: Close 2: Close 3: Close 4: Close 5: Close 6: Close 7: Close 8
    Else
        Me.cmdActaRech.Item(0).Enabled = True
        Me.cmdActaRech.Item(1).Enabled = True
        Me.cmdActaRech.Item(2).Enabled = True
        Me.cmdActaRech.Item(3).Enabled = True
        Me.fraWork.Visible = False
    End If
    cnHist.Close
    Set rsHist = Nothing
    Exit Function
Problemas:
    Select Case Err.Number
        Case Is = 32755
            btnCancelar = True
            Resume Next
        Case Else
            MsgBox "Problemas para generar archivos TXT" & vbCrLf & Err.Number & ": " & Err.Description & vbCrLf & Err.Source, vbOKOnly + vbExclamation, "Error de Sistema"
            Resume Next
            Resume
    End Select
End Function
Private Function GeneraNomina()
    Dim cnBase As ADODB.Connection
    Dim rsBase As ADODB.Recordset
    Dim I As Integer
    Dim NuReg As Integer
    Dim strLinea As String
    Set cnBase = NueConn(Servidor, Base, "kripplefight", "groot")
    cnBase.Open
    Set rsBase = cnBase.Execute("SELECT act_ok FROM acta_act_cur WHERE AGNO='" & nAgno & "' AND COD_ENS='310' AND COD_GRA='4'")
    If rsBase.EOF Then
        MsgBox "No posee 4to Medio listo para este proceso"
    Else
        rsBase.Close
        Set rsBase = cnBase.Execute("SELECT 9 as C, LEFT(sp.rbd,LENGTH(sp.rbd)-2) AS rbd, RIGHT(sp.rbd,1) AS D, 0 AS esp, agno, 0 as Num_Reg, h.APE_PAT, h.APE_MAT, h.NOMBRES, LEFT(h.run_alu,8) AS run_lic, RIGHT(h.run_alu,1) AS Cod_run, 2 as cod_lic FROM hist_alumno h, acta_sit_pro sp WHERE h.run_alu=sp.run_alu AND sp.cod_ens='310' AND sp.cod_gra='4' AND agno = " & nAgno)
        If Not rsBase.EOF Then
            NuReg = 1
            Me.grDatAlu.FormatString = "^|^|^RBD|^D|^Especialidad|^Año|>Nº Reg|<Ap Paterno|<Ap Materno|<Nombres|^Nº RUN|^D|^Tipo"
            Me.grDatAlu.RowHeight(0) = 300
            Me.grDatAlu.ColWidth(0) = 150
            Me.grDatAlu.ColWidth(1) = 250
            Me.grDatAlu.ColWidth(2) = 800
            Me.grDatAlu.ColWidth(3) = 250
            Me.grDatAlu.ColWidth(4) = 1000
            Me.grDatAlu.ColWidth(5) = 700
            Me.grDatAlu.ColWidth(6) = 600
            Me.grDatAlu.ColWidth(7) = 1500
            Me.grDatAlu.ColWidth(8) = 1500
            Me.grDatAlu.ColWidth(9) = 2400
            Me.grDatAlu.ColWidth(10) = 900
            Me.grDatAlu.ColWidth(11) = 250
            Me.grDatAlu.ColWidth(12) = 400
            Me.grDatAlu.Rows = 2
            While Not rsBase.EOF
                strLinea = " " & Chr(9) & rsBase(0) & Chr(9) & rsBase(1) & Chr(9) & rsBase(2) & Chr(9) & rsBase(3) & Chr(9) & rsBase(4) & Chr(9) & NuReg & Chr(9) & rsBase(6) & Chr(9) & rsBase(7) & Chr(9) & rsBase(8) & Chr(9) & rsBase(9) & Chr(9) & rsBase(10) & Chr(9) & rsBase(11)
                Me.grDatAlu.AddItem strLinea
                NuReg = NuReg + 1
                rsBase.MoveNext
            Wend
            Me.grDatAlu.RemoveItem 1
        End If
        Me.fraNomLic.Visible = True
        Me.fraNomLic.Enabled = True
        Me.fraNomLic.Top = 120
    End If
    rsBase.Close
    cnBase.Close
End Function

Private Function ProfesorJefe(cnServi As ADODB.Connection, Rut_o_Nombre As String, strModal As String, strGrado As String, strLetra As String, agno As Integer) As String
    Dim Resultado As String
    Dim rsServ As ADODB.Recordset
    Set rsServ = cnServi.Execute("select p.ape1_prof, p.ape2_prof, p.noms_prof, p.rut_prof from profesores p, cursos c where p.rut_prof = c.rut_prof and c.cod_ens='" & strModal & "' and c.num_gra ='" & strGrado & "' and c.let_cur ='" & strLetra & "' and c.agno=" & agno)
    If UCase(Rut_o_Nombre) = "N" Then
        If Not rsServ.EOF Then
            Resultado = Trim(rsServ("NOMS_PROF")) & " " & Trim(rsServ("APE1_PROF")) & " " & rsServ("APE2_PROF")
        Else
            Resultado = "Sin Profesor Informado"
        End If
    Else
        If Not rsServ.EOF Then
            Resultado = rsServ("RUT_PROF")
        Else
            Resultado = "xxxxxxxx-x"
        End If
    End If
    ProfesorJefe = Resultado
    rsServ.Close
End Function

Private Function CalifProf(strModalidad As String, strGrado As String, strCodAsi As String, strRutProfe As String) As String
    Dim rsCP As ADODB.Recordset
    Dim sqlCalifP As String
    Dim Calificacion  As String
    Set rsCP = New ADODB.Recordset
    rsCP.CursorLocation = adUseClient
    rsCP.CursorType = adOpenDynamic
    rsCP.LockType = adLockReadOnly
    sqlCalifP = "SELECT CS.DES_SIT_PROF FROM SITPROF_X_ASI SP, SIT_PROF CS WHERE SP.COD_SIT_PROF = CS.COD_SIT_PROF AND COD_ENS ='" & strModalidad & "' AND NUM_GRA='" & strGrado & "' AND COD_ASI='" & strCodAsi & "' "
    rsCP.Open sqlCalifP, conn
    If rsCP.RecordCount > 0 Then
        Calificacion = rsCP("DES_SIT_PROF")
    Else
        Calificacion = "Titulado"
    End If
    CalifProf = Calificacion
End Function


Private Function MuestraDetalle(strConsulta As String, nCols As Integer, nRows As Integer, Strcampos As String)
    Dim cnHist As ADODB.Connection
    Dim rsHist As ADODB.Recordset
    Dim frmLista As Form
    Dim nCol(0 To 90) As Integer
    timerScroll True
    Set frmLista = New frmActaFinal
    Set cnHist = New ADODB.Connection
    Set rsHist = New ADODB.Recordset
    cnHist = NueConn(Servidor, Base, "kripplefight", "groot")
    cnHist.Open
    Set rsHist = cnHist.Execute(strConsulta)
    Load frmLista
    frmLista.grillaDatos.Cols = nCols
    frmLista.grillaDatos.Rows = 1
    frmLista.Height = frmLista.fraLista.Height + 360
    frmLista.Width = frmLista.fraLista.Width + 140
    frmLista.fraLista.Top = 0
    frmLista.fraLista.Left = 0
    frmLista.Caption = "Matricula Inicial"
    nRow = 1
    While Not rsHist.EOF
        frmLista.grillaDatos.AddItem nRow & Chr(9) & rsHist("run_alu") & Chr(9) & rsHist("Ape_pat") & Chr(9) & rsHist("ape_mat") & Chr(9) & rsHist("nombres") & Chr(9) & rsHist("cod_sex") & Chr(9) & rsHist("fec_nac") & Chr(9) & rsHist("fec_mat")
        nRow = nRow + 1
        rsHist.MoveNext
    Wend
    cnHist.Close
    For I = 0 To nCols - 1
        For j = 1 To frmLista.grillaDatos.Rows - 1
            If nCol(I) < Len(frmLista.grillaDatos.TextMatrix(j, I)) Then
                nCol(I) = Len(frmLista.grillaDatos.TextMatrix(j, I))
            End If
        Next
    Next
    For I = 0 To nCols
        frmLista.grillaDatos.ColWidth(I) = nCol(I) * 132
    Next
    
    timerScroll False
    frmLista.fraLista.Visible = True
    frmLista.fraLista.Enabled = True
    frmLista.Command2.Enabled = True
    frmLista.Command3.Enabled = True
    If frmLista.grillaDatos.Rows > 1 Then
        frmLista.grillaDatos.FixedRows = 1
        frmLista.Show
    Else
        MsgBox "No existe infomacion para mostrar", vbOKOnly + vbInformation, "Sin Datos"
        Unload frmLista
    End If
End Function

Private Function timerScroll(OnOff As Boolean, Optional nTop As Integer = 0, Optional nIzq As Integer = 0)
    Dim Onn As Boolean
    Onn = True
    If OnOff = Onn Then
        fraConeccion.Left = nIzq
        fraConeccion.Top = nTop
        fraConeccion.Visible = True
        tmConeccion.Enabled = True
        Me.Refresh
    Else
        fraConeccion.Visible = False
        tmConeccion.Enabled = False
        Me.Refresh
    End If
End Function

Private Function Traspasa()

    Dim p_descres_plan As String
    Dim p_agno_decres As String
    Dim p_plan_est As String
    Dim p_agno_pan As String
    Dim cont_bio As Double
    Dim suma_bio As Double
    Dim bio As Double
        
    Dim situa As String
    Dim cnBase As ADODB.Connection
    Dim cnHist As ADODB.Connection
    Dim rsBase As ADODB.Recordset
    Dim rsBas2 As ADODB.Recordset
    Dim RsBas3 As ADODB.Recordset
    Dim rsHist As ADODB.Recordset
    Dim rsHis2 As ADODB.Recordset
    Dim RsAux2 As ADODB.Recordset
    Set RsAux2 = New ADODB.Recordset
    
    Dim strModal As String
    Dim strGrado As String
    Dim strLetra As String
    Dim strRBD As String
    Dim nNotas As Single
    Dim sConce As String
    Dim sExim As String
    Dim sDecEva As String
    Dim I As Integer
    Dim strNomDir As String
    Dim bProcesa As Boolean
    
    On Error GoTo probConeccion
    
    timerScroll True, Me.fraResumen.Top - 100, 3960
    
    cole = DevuelveCampo("cfg", "", "valor", "param = 'codbc'", conn)
    
    For I = 2 To 9
        Me.txtActaCurso.Item(I).Text = ""
    Next
    For I = 0 To Me.cmdDetalle.count - 1
        Me.cmdDetalle.Item(I).Enabled = False
    Next
    
    Set cnBase = New ADODB.Connection
    Set cnHist = New ADODB.Connection
    
    Set rsBase = New ADODB.Recordset
    Set rsHist = New ADODB.Recordset
    
    strModal = Left(Me.txtActaCurso.Item(0).Text, 3)
    strGrado = Left(Me.txtActaCurso.Item(1).Text, 1)
    strLetra = Right(Me.txtActaCurso.Item(1).Text, 1)
    
    cnBase.CursorLocation = adUseClient
    cnHist.CursorLocation = adUseClient
    
    cnBase = NueConn(Servidor, Base, "kripplefight", "groot")
    cnHist = NueConn(Servidor, Base, "kripplefight", "groot")
    cnBase.Open
    cnHist.Open
    
    Set rsBase = cnBase.Execute("SELECT RUT_DIRECTOR_ESt, RDB, NUM_RES_REC_OFI_EST, NOM_ESt, LOCALIDAD_EST, FEC_RES_REC_OFI_EST, FEC_DEC_COOP, DIR_EST, DEC_COOP,APE_PAT_DIR, APE_MAT_DIR, NOM_DIR FROM establecimientos")
    strRBD = rsBase("RDB")
    strNomDir = rsBase("APE_PAT_DIR") & " " & rsBase("APE_MAT_DIR") & " " & rsBase("NOM_DIR")
    Me.txtActaCurso.Item(11) = strRBD
    Me.txtActaCurso.Item(12) = rsBase("NOM_EST")
    rsBase.Close
    Set rsBase = cnBase.Execute("SELECT act_ok FROM acta_act_cur WHERE RBD='" & strRBD & "' AND AGNO='" & Me.cmbSelAgno.Text & "' AND COD_ENS='" & strModal & "' AND cod_GRA='" & strGrado & "' AND LET_CUR='" & strLetra & "'")
    If rsBase.EOF Then
        bProcesa = True
    Else
        If rsBase("act_ok") = 1 Then
            bProcesa = False
        Else
            bProcesa = True
        End If
    End If
    rsBase.Close
    
    If bProcesa Then
        Dim nCta As Integer
        ' Borro Profesores y Promedios para el curso.
        ' Los que luego serán actualizados, por los que esten en el sistema
        ' mientras no cierren.
        cnHist.Execute "DELETE FROM acta_ant_aca WHERE agno=" & nAgno & " and cod_ens='" & strModal & "' and cod_gra=" & strGrado & " and let_cur='" & strLetra & "'"
        cnHist.Execute "DELETE FROM acta_doc_sub WHERE agno=" & nAgno & " and cod_ens='" & strModal & "' and cod_gra=" & strGrado & " and let_cur='" & strLetra & "'"
        '####################
        Select Case strGrado
            Case Is = 1
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,4,2)='11' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Is = 2
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c  WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,6,2)='21' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Is = 3
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c  WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,8,2)='31' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Is = 4
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c  WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,10,2)='41' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Is = 5
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c  WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,12,2)='51' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Is = 6
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c  WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,14,2)='61' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Is = 7
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c  WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,16,2)='71' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Is = 8
                Set rsBase = cnBase.Execute("SELECT LEFT(b.cod_dec,4) AS dec_eval, c.agno_dec from criterios a, decretos_crit b, decretos_eva c  WHERE a.cod_crit=b.cod_crit AND LEFT(b.cod_dec,4)=c.cod_dec AND MID(b.cod_dec,5,2)='SI' AND mid(niveles_crit,18,2)='81' AND LEFT(a.niveles_crit,3)='" & strModal & "'")
            Case Else
                MsgBox "Ocurrio un error al recuperar el decreto de Evaluacion"
        End Select
        sDecEva = rsBase("Dec_Eval") & rsBase("Agno_Dec")
        rsBase.Close

        Set rsBase = cnBase.Execute(GeneraConsulta(gesNominaActa, strModal, strGrado, strLetra, , , , , nAgno))
        While Not rsBase.EOF
            DoEvents
            If (rsBase("CI_ALU") = "19643773-8" Or rsBase("CI_ALU") = "19185099-8") And nAgno = 2004 Then
                '#####################################
                ' ¿Hacerles Nada?
                ' ¿Tendrán termino anticipado de año?
                ' 19564627-9 hizo termino anticipado de año 2004 en Florida.
                ' estos son alumnos de San Martín
                '#####################################
            Else
                cnHist.Execute "REPLACE INTO hist_alumno (run_alu, APE_PAT, APE_MAT, NOMBRES, COD_SEX, FEC_NAC) " & _
                                    "VALUES ('" & rsBase("CI_ALU") & "','" & rsBase("APE_PAT_ALU") & "','" & rsBase("APE_MAT_ALU") & "','" & rsBase("NOM_ALU") & "','" & rsBase("SEXO") & "','" & InvierteFecha(rsBase("FEC_NACALU"), "R") & "' )"
                cnHist.Execute "REPLACE INTO acta_nomina (RBD, AGNO, run_alu, FEC_MAT, FEC_RET, IND_EXT, COD_COM) " & _
                                    "VALUES ('" & strRBD & "','" & nAgno & "','" & rsBase("CI_ALU") & "','" & InvierteFecha(rsBase("FMAT"), "R") & "','" & IIf(rsBase("FCAN") = #11/11/1111#, Null, InvierteFecha(rsBase("FCAN"), "R")) & "','" & rsBase("ind_ext_alu") & "','" & rsBase("cod_geo") & "');"
                
                Set rsBas2 = cnBase.Execute(GeneraConsulta(gesSitFinalActa, strModal, strGrado, strLetra, rsBase("ci_alu"), , , , nAgno))
                ' linea de revision
                'If rsBase!ci_alu = "21119711-0" Then MsgBox "OK"
                ' *********************
                des_obs_fin = " "
                If rsBas2.RecordCount < 1 Then
                    asi_p = 0
                    des_obs_fin = " "
                    cod_sit = "x"
                Else
                    asi_p = IIf(IsNull(rsBas2("asi_p")), 0, rsBas2("asi_p"))
                    If asi_p < 85 Then
                        RsAux2.Open "SELECT * FROM `elimina_asistencia_actas` WHERE ci_alu = '" & rsBase("ci_alu") & "' AND agno = '" & nAgno & "'", conn
                        If RsAux2.RecordCount > 0 Then
                            'asi_p = 85
                            'asi_p = RsAux2!porcentaje_inasistencias
                            texto = Replace(texto, "á", "a")
                             If CStr(Mid(RsAux2("concepto"), 1, 7)) = "Decreto" Then
                                asi_p = CDbl(Mid(RsAux2("porcentaje_inasistencias"), 1, 3))
                             Else
                                asi_p = 85
                             End If
                            
                            des_obs_fin = Replace(RsAux2!Concepto, "letra C", "")
                        End If
                        RsAux2.Close
                    End If
                    des_obs_fin = Trim(des_obs_fin & " " & IIf(IsNull(rsBas2("des_obs_fin")), " ", rsBas2("des_obs_fin"))) & " "
                    cod_sit = IIf(IsNull(rsBas2("COD_SIT")), "x", rsBas2("COD_SIT"))
                End If
                rsBas2.Close
                
                '############################################################
                If (Format(rsBase("FCAN"), "dd-mm-yyyy") = "11-11-1111") Or ((rsBase("CI_ALU") = "14648379-8" Or rsBase("CI_ALU") = "19793874-9" Or rsBase("CI_ALU") = "19802495-3") And nAgno = 2004) Then
                'seran estos afortunados cabros los termino anticipado de año?
                'se cambiaron de curso o no, entraran al acta igual en el curso actual.
                
                    Set rsBas2 = cnBase.Execute("SELECT ss.cod_sec,ss.ord_asi, ss.cod_asi, if(p.nf is null,0,p.nf) as 'nf', pe.decres_plan, pe.agno_decres, pe.plan_est, pe.agno_plan FROM (SELECT * FROM asi_x_cur_prof WHERE cod_ens='" & strModal & "' and num_gra='" & strGrado & "' and let_cur='" & strLetra & "' and agno=" & nAgno & ") as axc LEFT JOIN (SELECT * FROM promedios WHERE ci_alu='" & rsBase("ci_alu") & "' and agno=" & nAgno & ") as p ON axc.agno=p.agno and axc.cod_sec=p.cod_Sec and axc.cod_asi=p.cod_asi and axc.cod_ens=p.cod_ens and axc.num_gra=p.num_gra and axc.let_cur=p.letra_curso LEFT JOIN subsectores as ss ON axc.cod_ens=ss.cod_ens and axc.num_gra=ss.num_gra and axc.cod_sec=ss.cod_sec and axc.cod_asi=ss.cod_asi LEFT JOIN plan_estudio as pe ON axc.cod_ens=pe.cod_ens and axc.num_gra=pe.num_gra and axc.agno=pe.agno WHERE ss.cod_asi IS NOT NULL order by ss.ord_asi;")
                    'Set rsBas2 = cnBase.Execute("SELECT ss.ord_asi, ss.cod_asi, p.nf, pe.decres_plan, pe.agno_decres, pe.plan_est, pe.agno_plan from promedios p, subsectores ss, plan_estudio pe where p.cod_ens=ss.cod_ens and p.num_gra=ss.num_gra and p.cod_sec=ss.cod_sec and p.cod_asi=ss.cod_asi and p.cod_ens=pe.cod_ens AND p.num_gra=pe.num_gra AND pe.agno='" & nAgno & "' AND p.cod_ens='" & strModal & "' and p.num_gra='" & strGrado & "' and p.letra_curso='" & strLetra & "' AND p.ci_alu='" & rsBase("ci_alu") & "' AND p.agno = " & cmbSelAgno.Text & " ORDER BY ord_asi")
                    suma = 0
                    nunotas = 0
                    Promedio = 0
                    cont_bio = 0
                    suma_bio = 0
                    bio = 0
                    While Not rsBas2.EOF
                        nNotas = rsBas2("nf")
                        sConce = " "
                        sExim = " "
                        Set RsBas3 = cnBase.Execute("SELECT * FROM acta_AlumExi WHERE agno='" & nAgno & "' AND run_alu='" & rsBase("ci_alu") & "' AND cod_asi='" & rsBas2("COD_ASI") & "'")
                        If RsBas3.EOF Then
                            Select Case rsBas2("COD_ASI")
                                Case 13, 22
                                    Select Case nNotas
                                        Case Is < 4
                                            sConce = "I"
                                        Case Is < 5
                                            sConce = "S"
                                        Case Is < 6
                                            sConce = "B"
                                        Case Else
                                            sConce = "MB"
                                    End Select
                                    nNotas = 0
                                    sExim = " "
                                Case Else
                                    sConce = " "
                                    sExim = " "
                                    If nNotas > 0 Then
                                         '(cod_asi = 3 or cod_asi = 5 or cod_asi = 6 or cod_asi = 7 or cod_asi = 8) and (cod_sec = 3 or cod_sec = 16)
                                         'Es distinto huechuraba
                                        If cole <> "HUE001" And cole <> "ALT001" And cole <> "PUD001" And cole <> "SNB001" Then
                                            If (rsBas2("cod_asi") = 3 Or rsBas2("cod_asi") = 7 Or rsBas2("cod_asi") = 8 Or rsBas2("cod_asi") = 3 Or rsBas2("cod_asi") = 7) _
                                            And (rsBas2("cod_sec") = "0011" Or rsBas2("cod_sec") = "0011") And strModal = "310" And (strGrado = 1 Or strGrado = 2) Then
                                                cont_bio = cont_bio + 1
                                                suma_bio = suma_bio + nNotas
                                            Else
                                                nunotas = nunotas + 1
                                                suma = nNotas + suma
                                            End If
                                        Else
                                            nunotas = nunotas + 1
                                            suma = nNotas + suma
                                        End If
                                    End If
                            End Select
                        Else
                            nNotas = 0
                            sConce = " "
                            sExim = "EX"
                            des_obs_fin = Trim(des_obs_fin & " " & RsBas3("razon_exim"))
                        End If
                            If cole <> "HUE001" And cole <> "ALT001" And cole <> "PUD001" And cole <> "SNB001" Then
                                If (rsBas2("cod_asi") = 3 Or rsBas2("cod_asi") = 7 Or rsBas2("cod_asi") = 8 Or rsBas2("cod_asi") = 7 Or rsBas2("cod_asi") = 3) _
                                        And (rsBas2("cod_sec") = "0011" Or rsBas2("cod_sec") = "0011") And strModal = "310" And (strGrado = 1 Or strGrado = 2) Then
                                    p_decres_plan = rsBas2("decres_plaN")
                                    p_agno_decres = rsBas2("agno_decres")
                                    p_plan_est = rsBas2("plan_est")
                                    p_agno_plan = rsBas2("agno_plan")
                                Else
                                    cnHist.Execute "REPLACE INTO acta_ant_aca (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, COD_PPP, COD_PLA, run_alu, COD_ASI, NOTA, CONCE, AL_EXI) " & _
                                    "VALUES ('" & strRBD & "','" & nAgno & "', '" & strModal & "','" & strGrado & "','" & strLetra & "','" & rsBas2("DECRES_PLAN") & rsBas2("AGNO_DECRES") & "','" & rsBas2("PLAN_EST") & rsBas2("AGNO_PLAN") & "','" & rsBase("CI_ALU") & "'," & rsBas2("COD_ASI") & "," & (nNotas * 10) & " / 10 ,'" & sConce & "','" & sExim & "')"
                                End If
                            Else
                                cnHist.Execute "REPLACE INTO acta_ant_aca (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, COD_PPP, COD_PLA, run_alu, COD_ASI, NOTA, CONCE, AL_EXI) " & _
                                "VALUES ('" & strRBD & "','" & nAgno & "', '" & strModal & "','" & strGrado & "','" & strLetra & "','" & rsBas2("DECRES_PLAN") & rsBas2("AGNO_DECRES") & "','" & rsBas2("PLAN_EST") & rsBas2("AGNO_PLAN") & "','" & rsBase("CI_ALU") & "'," & rsBas2("COD_ASI") & "," & (nNotas * 10) & " / 10 ,'" & sConce & "','" & sExim & "')"
                            End If
                        rsBas2.MoveNext
                        RsBas3.Close
                    Wend
                    '(cod_asi = 3 or cod_asi = 5 or cod_asi = 6 or cod_asi = 7 or cod_asi = 8) and (cod_sec = 3 or cod_sec = 16)
                    'bio = IIf(cont_bio = 0, 0, (suma_bio / cont_bio))
                    
'''                    If rsBase("CI_ALU") = "19819472-7" Then
'''                        MsgBox "here"
'''                    End If
                    
                    If cole <> "HUE001" And cole <> "ALT001" And cole <> "PUD001" And cole <> "SNB001" And strModal = "310" And (strGrado = 1 Or strGrado = 2) Then
                    
                        If cont_bio = 0 Then
                            bio = 0
                        Else
                            ' revisar ciencias naturales
                            bio = (suma_bio / cont_bio)
                        End If
                    
                        cnHist.Execute "REPLACE INTO acta_ant_aca (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, COD_PPP, COD_PLA, run_alu, COD_ASI, NOTA, CONCE, AL_EXI) " & _
                        "VALUES ('" & strRBD & "','" & nAgno & "', '" & strModal & "','" & strGrado & "','" & strLetra & "','" & p_decres_plan & p_agno_decres & "','" & p_plan_est & p_agno_plan & "','" & rsBase("CI_ALU") & "'," & "6" & "," & (Round(bio, 1) * 10) & " / 10 ,'" & " " & "','" & sExim & "')"
                        suma = suma + Round(bio, 1)
                        nunotas = nunotas + 1
                                        
                    End If
                                                            
                    rsBas2.Close
                    If nunotas = 0 Then
                        Promedio = 0
                    Else
                        If Me.txtActaCurso.Item(11).Text = "9782-9" Then
                            Promedio = Left(Format((((suma / nunotas) * 100)) / 100, "0.0000"), 3)
                        Else
                            Promedio = Left(Format((((suma / nunotas) * 100) + 5) / 100, "0.0000"), 3)
                        End If
                    End If
                    cnHist.Execute "REPLACE INTO acta_sit_pro (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, run_alu, PRO_GEN, POR_ASI, OBSERVA, SIT_FIN, TIP_PRO) " & _
                            "VALUES ('" & strRBD & "','" & nAgno & "', '" & strModal & "','" & strGrado & "','" & strLetra & "','" & rsBase("CI_ALU") & "'," & (Promedio * 10) & "/10,'" & asi_p & "','" & des_obs_fin & "','" & cod_sit & "',1)"
                Else
                    cnHist.Execute "REPLACE INTO acta_sit_pro (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, run_alu, PRO_GEN, POR_ASI, OBSERVA, SIT_FIN, TIP_PRO) " & _
                            "VALUES ('" & strRBD & "','" & nAgno & "', '" & strModal & "','" & strGrado & "','" & strLetra & "','" & rsBase("CI_ALU") & "',0,0,'Retirado(a) " & rsBase("fcan") & "','Y',1)"
                End If
            End If
            rsBase.MoveNext
        Wend
        rsBase.Close
        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s WHERE n.run_alu=s.run_alu AND s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND MONTH(n.fec_mat) <= 4 AND n.AGNO ='" & nAgno & "' AND n.rbd ='" & strRBD & "' AND n.AGNO=s.AGNO AND n.RBD = s.RBD")
        Me.txtActaCurso.Item(2).Text = rsHist(0)
        Me.cmdDetalle.Item(0).Enabled = True
        rsHist.Close
        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s where n.run_alu=s.run_alu and s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND MONTH(n.fec_mat) > 4 AND MONTH(n.fec_mat) < 12 AND n.AGNO='" & nAgno & "' AND n.rbd='" & strRBD & "' AND n.agno = s.agno AND n.rbd=s.rbd")
        Me.txtActaCurso.Item(3).Text = rsHist(0)
        Me.cmdDetalle.Item(1).Enabled = True
        rsHist.Close
        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s where n.run_alu=s.run_alu and s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND MONTH(n.fec_ret) > 4 AND MONTH(n.fec_ret) <= 11 AND n.AGNO='" & nAgno & "' AND n.rbd='" & strRBD & "' AND n.AGNO=s.agno AND n.RBD = s.RBD")
        Me.txtActaCurso.Item(4).Text = rsHist(0)
        Me.cmdDetalle.Item(2).Enabled = True
        rsHist.Close
        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s where n.run_alu=s.run_alu and s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND MONTH(n.fec_ret) = 0 AND n.agno='" & nAgno & "' AND n.rbd='" & strRBD & "' AND n.AGNO=s.agno AND n.RBD = s.RBD")
        Me.txtActaCurso.Item(5).Text = rsHist(0)
        rsHist.Close
        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s WHERE n.run_alu=s.run_alu and s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND n.AGNO ='" & nAgno & "' AND n.rbd='" & strRBD & "' AND n.AGNO=s.agno AND n.RBD = s.RBD AND s.sit_fin = 'P'")
        Me.txtActaCurso.Item(6).Text = rsHist(0)
        rsHist.Close
        
        'Aqui probando
        
        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s,matriculas m WHERE n.run_alu=s.run_alu and s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND n.AGNO ='" & nAgno & "' AND n.rbd='" & strRBD & "' AND n.AGNO=s.agno AND n.RBD = s.RBD AND s.sit_fin = 'R' AND n.run_alu=m.ci_alu and s.cod_ens=m.cod_ens AND s.cod_gra=m.num_gra AND n.AGNO = m.anno_mat and reprueva_nota = 'SI'")
        Me.txtActaCurso.Item(8).Text = rsHist(0)
        rsHist.Close
        
        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s WHERE n.run_alu=s.run_alu and s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND n.AGNO ='" & nAgno & "' AND n.rbd='" & strRBD & "' AND n.AGNO=s.agno AND n.RBD = s.RBD AND s.sit_fin = 'R'")
        Me.txtActaCurso.Item(7).Text = IIf((Me.txtActaCurso.Item(8).Text - rsHist(0)) < 0, (Me.txtActaCurso.Item(8).Text - rsHist(0)) * -1, (Me.txtActaCurso.Item(8).Text - rsHist(0)))
        rsHist.Close
'        Set rsHist = cnHist.Execute("SELECT COUNT(*) AS Num FROM acta_nomina n, acta_sit_pro s WHERE n.run_alu=s.run_alu and s.cod_ens='" & strModal & "' AND s.cod_gra='" & strGrado & "' AND s.let_cur='" & strLetra & "' AND n.AGNO ='" & nAgno & "' AND n.rbd='" & strRBD & "' AND n.AGNO=s.agno AND n.RBD = s.RBD AND s.sit_fin = 'R' AND if(ISNULL(por_asi),0,por_asi)>=85")
'        Me.txtActaCurso.Item(8).Text = rsHist(0)
'        rsHist.Close
        Me.txtActaCurso.Item(9).Text = val(Me.txtActaCurso.Item(7).Text) + val(Me.txtActaCurso.Item(8).Text)
        
        Set rsBase = cnBase.Execute("SELECT pe.decres_plan, agno_decres, pe.plan_est, pe.agno_plan, ss.ord_asi, a.cod_sec, a.cod_asi,  s.nom_sec, ss.NOM_ASI, a.RUT_PROF, p.NOMS_PROF, p.APE1_PROF, p.APE2_PROF, cs.DES_SIT_PROF FROM asi_x_cur_prof a, profesores p, sectores s, subsectores ss, plan_estudio pe, SITPROF_X_ASI sp, SIT_PROF cs WHERE a.RUT_PROF=p.RUT_PROF and a.cod_ens = ss.cod_ens and a.num_gra = ss.num_gra and a.cod_asi = ss.cod_asi AND ss.cod_sec=s.cod_sec AND a.agno=pe.agno AND a.cod_ens=pe.cod_ens and a.num_gra=pe.num_gra AND a.cod_ens=sp.cod_ens AND a.num_gra=sp.num_gra and a.cod_Asi=sp.cod_asi and a.rut_prof=sp.rut_prof and sp.COD_SIT_PROF = cs.COD_SIT_PROF AND a.agno=sp.agno AND a.agno='" & nAgno & "' and a.cod_ens='" & strModal & "' and a.num_gra = '" & strGrado & "' and  a.let_cur='" & strLetra & "' order by ord_asi")
                                    
        If rsBase.EOF Then
            MsgBox "No es posible continuar con el proceso de este curso, falta ingresar información relativa a" & vbCrLf & "Planes de Estudio y SubSectores para el Grado y la Modalidad", vbExclamation + vbOKOnly, "Falta Informacion"
            rsBase.Close
            cnBase.Close
            cnHist.Close
            timerScroll False
            Exit Function
        End If
        
        While Not rsBase.EOF
'        situa = IIf(CStr(rsBase("RUT_PROF")) = CStr("13497535-0"), rsBase("DES_SIT_PROF") & " Nº Reg. Nº 22296", rsBase("DES_SIT_PROF"))
'        situa = IIf(CStr(rsBase("RUT_PROF")) = CStr("10437660-6"), rsBase("DES_SIT_PROF") & " Nº Reg. Nº 24711", rsBase("DES_SIT_PROF"))
        
        
        If CStr(rsBase("RUT_PROF")) = CStr("13497535-0") Then
            situa = rsBase("DES_SIT_PROF") & " Nº Reg. Nº 22296"
        Else
            If CStr(rsBase("RUT_PROF")) = CStr("10437660-6") Then
                situa = rsBase("DES_SIT_PROF") & " Nº Reg. Nº 24711"
            Else
                situa = rsBase("DES_SIT_PROF")
            End If
        End If
        
        situa = rsBase("DES_SIT_PROF")
               
            cnHist.Execute "REPLACE INTO acta_sub_sec(RBD,AGNO,NUM_GRA,ORD_ASI,COD_SEC,COD_ASI,DES_SEC,DES_ASI) " & _
                "VALUES ('" & strRBD & "','" & nAgno & "','" & strGrado & "'," & rsBase("ORD_ASI") & "," & rsBase("COD_SEC") & "," & rsBase("COD_ASI") & ",'" & rsBase("NOM_SEC") & "','" & rsBase("NOM_ASI") & "')"
            cnHist.Execute "REPLACE INTO acta_doc_sub (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, COD_PPP, COD_PLA, COD_ASI, RUN_DOC, APE_PAT, APE_MAT, NOMBRES, COD_SIT) " & _
                "VALUES ('" & strRBD & "','" & nAgno & "','" & strModal & "','" & strGrado & "','" & strLetra & "','" & rsBase("decres_plan") & rsBase("agno_decres") & "','" & rsBase("plan_est") & rsBase("agno_plan") & "','" & rsBase("COD_ASI") & "','" & rsBase("RUT_PROF") & "','" & rsBase("APE1_PROF") & "','" & rsBase("APE2_PROF") & "','" & rsBase("NOMS_PROF") & "','" & situa & "')"
            
            rsBase.MoveNext
        Wend
        
        rsBase.Close
        Set rsHist = cnHist.Execute("SELECT * FROM acta_act_cur WHERE rbd='" & strRBD & "' AND agno='" & nAgno & "' AND COD_ENS='" & strModal & "' AND cod_gra ='" & strGrado & "' AND let_cur='" & strLetra & "'")
        If Not rsHist.EOF Then
            Me.txtActaCurso(10) = IIf(IsNull(rsHist("enc_acta")), " ", rsHist("enc_acta"))
            Me.txtActaCurso(13) = IIf(IsNull(rsHist("obs_Act")), " ", rsHist("obs_Act"))
        End If
        Set rsBase = cnBase.Execute("SELECT decres_plan, agno_decres, plan_est, agno_plan FROM PLAN_ESTUDIO WHERE agno='" & nAgno & "' AND cod_ens='" & strModal & "' AND num_gra='" & strGrado & "'")
        cnHist.Execute "REPLACE INTO acta_inf_cur (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, COD_DEV, COD_PPP, COD_PLA, RUN_DOC) " & _
            "VALUES ('" & strRBD & "','" & nAgno & "' ,'" & strModal & "','" & strGrado & "','" & strLetra & "','" & sDecEva & "','" & rsBase("decres_plan") & rsBase("agno_decres") & "','" & rsBase("plan_est") & rsBase("agno_plan") & "','" & ProfesorJefe(cnBase, "R", strModal, strGrado, strLetra, val(nAgno)) & "')"
        cnHist.Execute "REPLACE INTO acta_act_cur (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, MAT_ABR, MAT_NOV, EST_PRO, REP_INA, REP_REN, EST_ING, EST_RET, DIR_EST, PRO_JEF, ACT_OK, ENC_ACTA, OBS_ACT) " & _
            "VALUES ('" & strRBD & "','" & nAgno & "','" & strModal & "','" & strGrado & "','" & strLetra & "','" & Me.txtActaCurso(2).Text & "','" & Me.txtActaCurso(5).Text & "','" & Me.txtActaCurso(6).Text & "','" & Me.txtActaCurso(7).Text & "','" & Me.txtActaCurso(8).Text & "','" & Me.txtActaCurso(3).Text & "','" & Me.txtActaCurso(4).Text & "','" & strNomDir & "','" & ProfesorJefe(cnBase, "N", strModal, strGrado, strLetra, val(nAgno)) & "',0,'" & Me.txtActaCurso(10).Text & "','" & Me.txtActaCurso(13).Text & "')"
        rsBase.Close
        cnBase.Close
        rsHist.Close
        bActaOk = False
    Else
        Set rsHist = cnHist.Execute("SELECT * FROM acta_act_cur WHERE rbd='" & strRBD & "' AND agno='" & nAgno & "' AND COD_ENS='" & strModal & "' AND cod_gra ='" & strGrado & "' AND let_cur='" & strLetra & "'")
        Me.txtActaCurso(2).Text = IIf(IsNull(rsHist("mat_abr")), 0, rsHist("mat_abr"))
        Me.txtActaCurso(3).Text = IIf(IsNull(rsHist("est_ing")), 0, rsHist("est_ing"))
        Me.txtActaCurso(4).Text = IIf(IsNull(rsHist("est_ret")), 0, rsHist("est_ret"))
        Me.txtActaCurso(5).Text = IIf(IsNull(rsHist("mat_nov")), 0, rsHist("mat_nov"))
        Me.txtActaCurso(6).Text = IIf(IsNull(rsHist("est_pro")), 0, rsHist("est_pro"))
        Me.txtActaCurso(7).Text = IIf(IsNull(rsHist("rep_ina")), 0, rsHist("rep_ina"))
        Me.txtActaCurso(8).Text = IIf(IsNull(rsHist("rep_ren")), 0, rsHist("rep_ren"))
        Me.txtActaCurso(9).Text = val(Me.txtActaCurso(7).Text) + val(Me.txtActaCurso(8).Text)
        Me.txtActaCurso(13).Text = IIf(IsNull(rsHist("obs_act")), " ", rsHist("obs_act"))
        Me.txtActaCurso(10).Text = IIf(IsNull(rsHist("enc_acta")), " ", rsHist("enc_acta"))
        bActaOk = True
    End If
    cnHist.Close
    timerScroll False

Exit Function
probConeccion:

    MsgBox Err.Number & " " & Err.Description
    If MsgBox("¿Desea Reintentarlo?", vbExclamation + vbYesNo, "Error!") = vbYes Then
        Resume
    End If
    
End Function

Private Function NueConn(strServ As String, strBase As String, strClave As String, strUser As String) As ADODB.Connection
    Dim cn As ADODB.Connection
    Set cn = New ADODB.Connection
    cn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
        "SERVER=" & strServ & "; " & _
        "DATABASE=" & strBase & "; " & _
        "UID=" & strUser & ";" & _
        "PWD=" & strClave & ";" & _
        "OPTION=" & "35"
    Set NueConn = cn
End Function

Private Function GeneraConsulta(nOpcion As Integer, Optional strModal As String = "", _
        Optional strGrado As String = "", Optional strLetra As String = "", _
        Optional strRunAlumno As String = "", Optional strMes As String, _
        Optional strDias As String, Optional nJornada As Integer, _
        Optional strAgno As String, Optional strRBD As String) As String
     
    Dim strResp As String
    Dim nModal As Integer, Ngrado As Integer, nLetra As Integer, nRunAl As Integer, nMeses As Integer, nDias As Integer
    Dim I As Integer
    Dim strCP As String
    nModal = Len(strModal)
    Ngrado = Len(strGrado)
    nLetra = Len(strLetra)
    nMeses = Len(strMes)
    nRunAl = Len(strRunAlumno)
    nDias = Len(strDias)
    Select Case nOpcion
    
        ' Consulta Basica para obtener cartolas completas
        Case Is = gesCartola
            
            If nModal > 0 And Ngrado > 0 And nLetra > 0 Then
                strResp = "SELECT A.CI_ALU, M.NUM_MAT,  P.APE_PAT_ALU, P.APE_MAT_ALU, P.NOM_ALU, P.SEX_ALU, a.FEC_alta, M.FEC_RETIRO, A.FEC_CAM, A.FEC_ING_CURSO, A.ACTIVO_ALU " & _
                    "FROM ALU_X_CUR A, MATRICULAS M, POSTULANTES P " & _
                    "WHERE A.CI_ALU = M.CI_ALU AND  A.CI_ALU=P.CI_ALU AND ((A.ACTIVO_ALU=M.ACTIVO_ALU) OR (A.ACTIVO_ALU='NO' AND M.FEC_RETIRO='1111-11-11')) AND A.FEC_MAT=M.FEC_MAT AND A.AGNO = M.ANNO_MAT AND A.COD_ENS='" & strModal & "' AND A.NUM_GRA='" & strGrado & "' AND A.LET_CUR='" & strLetra & "' " & _
                    "ORDER BY A.FEC_ING_CURSO, P.APE_PAT_ALU, P.APE_MAT_ALU, P.NOM_ALU"
            Else
                GoSub FallaAutoSel
            End If
            
        ' Consulta para obtener Nominas de Alumnos para el Acta
        Case Is = gesNominaActa
        
            strResp = "SELECT p.ape_pat_alu, p.ape_mat_alu, p.nom_alu, p.ci_alu, p.sex_alu as Sexo, p.fec_nacalu, c.Cod_Geo, c.comuna, a.Fec_alta as FMAT, m.fec_retiro as fcan, a.fec_cam, p.ind_ext_alu FROM postulantes p, alu_x_cur a, codigos__geograficos c, matriculas m WHERE p.ci_alu = a.ci_alu and  a.cod_ens = '" & strModal & "' and a.num_gra = '" & strGrado & "' and a.let_cur ='" & strLetra & "' and p.cod_geo = c.cod_geo and p.ci_alu = m.ci_alu and a.fec_cam = '1111-11-11' and (isnull(m.fec_retiro) or month(m.fec_retiro)>4) and m.anno_mat='" & strAgno & "'  and a.activo_alu =m.activo_alu and a.agno = m.anno_mat ORDER BY ape_pat_alu, ape_mat_alu, nom_alu, fec_ing_curso"
            
        Case Is = gesMatInicialActa
        
            strResp = "SELECT p.ape_pat_alu, p.ape_mat_alu, p.nom_alu, p.ci_alu, p.sex_alu as Sexo, p.fec_nacalu, c.Cod_Geo, c.comuna, a.Fec_alta as FMAT, m.fec_retiro as fcan, a.fec_cam FROM postulantes p, alu_x_cur a, codigos__geograficos c, matriculas m WHERE p.ci_alu = a.ci_alu and  a.cod_ens = '" & strModal & "' and a.num_gra = '" & strGrado & "' and a.let_cur ='" & strLetra & "' and p.cod_geo = c.cod_geo and p.ci_alu = m.ci_alu and a.fec_cam = '1111-11-11' and (isnull(m.fec_retiro) or month(m.fec_retiro)>4) and m.anno_mat='" & strAgno & "' and a.activo_alu =m.activo_alu AND month(m.Fec_mat) <= 4 AND a.agno = m.anno_mat"
            
        Case Is = gesAltasAgno
        
            strResp = "FROM postulantes p, alu_x_cur a, codigos__geograficos c, matriculas m WHERE p.ci_alu = a.ci_alu and  a.cod_ens = '" & strModal & "' and a.num_gra = '" & strGrado & "' and a.let_cur ='" & strLetra & "' and p.cod_geo = c.cod_geo and p.ci_alu = m.ci_alu and a.fec_cam = '1111-11-11' and (isnull(m.fec_retiro) or month(m.fec_retiro)>4) and m.anno_mat='" & strAgno & "' and a.activo_alu =m.activo_alu and month(m.fec_mat)>4 and m.anno_mat = a.agno"
            
        Case Is = gesBajasAgno
        
            strResp = "FROM postulantes p, alu_x_cur a, codigos__geograficos c, matriculas m WHERE p.ci_alu = a.ci_alu and  a.cod_ens = '" & strModal & "' and a.num_gra = '" & strGrado & "' and a.let_cur ='" & strLetra & "' and p.cod_geo = c.cod_geo and p.ci_alu = m.ci_alu and a.fec_cam = '1111-11-11' and (isnull(m.fec_retiro) or month(m.fec_retiro)>4) and m.anno_mat='" & strAgno & "' and a.activo_alu =m.activo_alu and (month(m.fec_retiro)>4 and m.fec_retiro<> '1111-11-11' and m.anno_mat = a.agno )"
        
        Case Is = gesMatFinalActa
        
            strResp = "FROM postulantes p, alu_x_cur a, codigos__geograficos c, matriculas m WHERE p.ci_alu = a.ci_alu and  a.cod_ens = '" & strModal & "' and a.num_gra = '" & strGrado & "' and a.let_cur ='" & strLetra & "' and p.cod_geo = c.cod_geo and p.ci_alu = m.ci_alu and a.fec_cam = '1111-11-11' and (isnull(m.fec_retiro) or month(m.fec_retiro)>4) and m.anno_mat='" & strAgno & "' and a.activo_alu =m.activo_alu and m.fec_retiro='1111-11-11' and m.anno_mat = a.agno "
            
        Case Is = gesSitFinalActa
            
            strResp = "select m.ci_alu, m.cod_sit, o.des_obs_fin, (sum(a.asi_t) * 100 / sum(a.asi_r))  as asi_p from alu_x_cur ax, matriculas m left join obserbaciones_fin o on m.cod_obs_fin =o.cod_obs_fin left join asistencia a on  m.ci_alu=a.ci_alu and a.agno = m.anno_mat where m.activo_alu='SI' and m.activo_alu=ax.activo_alu AND m.ci_alu = ax.ci_alu and ax.cod_ens ='" & strModal & " ' and ax.num_gra = '" & strGrado & "' and ax.let_cur ='" & strLetra & "' and if(isnull(m.anno_mat),'2003',if(m.anno_mat='1111','2003',m.anno_mat))='" & strAgno & "' and m.ci_alu='" & strRunAlumno & "'  and m.anno_mat = ax.agno GROUP BY m.ci_alu ORDER BY fec_ing_curso desc"
            
        Case Is = hisNomMatInicial
        
            strResp = "select n.run_alu, n.ape_pat, n.ape_mat, n.nombres, n.cod_sex, n.fec_nac, n.fec_mat from acta_nomina n, acta_sit_pro s  where n.run_alu=s.run_alu and s.cod_curso = '" & strModal & "#" & strGrado & "#" & strLetra & "' and n.agno_rbd ='" & strAgno & "#" & strRBD & "' and n.agno_rbd = s.agno_rbd and month(fec_mat)<= 4 order by ape_pat, ape_mat, nombres"
            
            
    End Select
    
    GeneraConsulta = strResp

Exit Function

FallaAutoSel:
    MsgBox "Error Interno: Problemas con los parametros para generar las Listas" & vbCrLf & "El programa se detendra." & vbCrLf & "Notifique el problema para establecer soluciones", vbCritical + vbOKOnly, "Error de Seleccion"
    GeneraConsulta = ""

End Function



Private Sub cmbSelAgno_Click()
    Dim rsModal As New ADODB.Recordset
    Set rsModal = conn.Execute("SELECT * FROM codigos_ensenanza WHERE cod_ens >='110' AND cod_ens<'996'")
    Me.lstModalidad.Clear
    While Not rsModal.EOF
        Me.lstModalidad.AddItem rsModal("cod_ens") & " - " & rsModal("des_ens")
        rsModal.MoveNext
    Wend
    rsModal.Close
    Set rsModal = Nothing
    Me.cmdVerActa(0).Enabled = False
    Me.lstNivel.Clear
    Me.lstLetra.Clear
    nAgno = Me.cmbSelAgno.Text
End Sub

Private Sub cmdActaRech_Click(Index As Integer)
    Dim I As Integer
    Dim rsModal As ADODB.Recordset
    
    Me.fraResumen.Visible = False
    Me.fraCert.Visible = False
    Me.cmdVerActa(2).Visible = False
    Me.lstModalidad.Clear
    Me.lstNivel.Clear
    Me.lstLetra.Clear
    
    Select Case Index
    
        Case Is = 0
        
            Reporte = 1
            Me.fraCurso.Visible = True
            Me.fraCurso.Enabled = True
            Me.Caption = "Certificado Anual de Estudios"
            GoSub CargaComboModal
            
        
        Case Is = 1
        
            Reporte = 2
            Me.Caption = "Actas de Registro de Calificaciones Anuales"
            Me.fraCurso.Visible = True
            Me.fraCurso.Enabled = True
            GoSub CargaComboModal
            Me.cmdVerActa(2).Visible = True
            
        Case Is = 2
    
            GeneraTXT
            
        Case Is = 3
            GeneraNomina
            
    End Select

Exit Sub
CargaComboModal:
    
    Me.cmbSelAgno.Clear
    If Anno >= 2004 Then
        For agnoacta = 2004 To Anno
            Me.cmbSelAgno.AddItem agnoacta
        Next agnoacta
    Else
        Set rsModal = conn.Execute("SELECT DISTINCT agno FROM acta_act_cur")
        If Not rsModal.EOF Then
            While Not rsModal.EOF
                Me.cmbSelAgno.AddItem rsModal(0).Value
                rsModal.MoveNext
            Wend
        Else
            Me.cmbSelAgno.AddItem Anno
        End If
        rsModal.Close
        Set rsModal = Nothing
    End If
    Return
    
DesactivaBotones:
    For I = 0 To Me.cmdActaRech.count - 1
        Me.cmdActaRech.Item(I).Enabled = False
    Next
Return

End Sub


Private Sub cmdActCurs_Click(Index As Integer)
    Dim FaltaU As Boolean
    Dim I As Integer
    
    Select Case Index
        
        Case Is = 0
        
            If Len(Trim(Me.txtActaCurso.Item(10).Text)) = 0 Then
                MsgBox "Falta ingresar el nombre del Encargado de Confeccion del Acta", vbOKOnly
                Me.txtActaCurso.Item(10).SetFocus
                FaltaU = True
            End If

            If Not FaltaU Then
                If Not bActaOk Then
                    conn.Execute "UPDATE acta_act_cur SET fec_act='" & Format(Date, "yyyy-mm-dd") & "',OBS_ACT='" & Me.txtActaCurso(13).Text & "', enc_acta='" & Me.txtActaCurso(10).Text & "'  WHERE AGNO='" & nAgno & "' AND RBD='" & Me.txtActaCurso(11).Text & "' AND COD_ENS='" & Left(Me.txtActaCurso(0).Text, 3) & "' AND COD_GRA='" & Me.lstNivel.Text & "' AND LET_CUR='" & Me.lstLetra.Text & "'"
                End If
                ImprimeActaCurso
            End If
        
        Case Is = 1
            
            If MsgBox("Esta accion dara por terminado el proceso de Actas para este curso, no se podran realizar modificaciones a Futuro en el Acta de este curso" & vbCrLf & "¿Desea dar por terminado el proceso de notas en este curso?", vbQuestion + vbYesNo, "Confirma Cierre") = vbYes Then
                conn.Execute "UPDATE acta_act_cur SET fec_act='" & Format(Date, "yyyy-mm-dd") & "',OBS_ACT='" & Me.txtActaCurso(13).Text & "', enc_acta='" & Me.txtActaCurso(10).Text & "'  WHERE AGNO='" & nAgno & "' AND RBD='" & Me.txtActaCurso(11).Text & "' AND COD_ENS='" & Left(Me.txtActaCurso(0).Text, 3) & "' AND COD_GRA='" & Me.lstNivel.Text & "' AND LET_CUR='" & Me.lstLetra.Text & "'"
                conn.Execute "UPDATE acta_act_cur SET ACT_OK=1 WHERE AGNO='" & nAgno & "' AND RBD='" & Me.txtActaCurso(11).Text & "' AND COD_ENS='" & Left(Me.txtActaCurso(0).Text, 3) & "' AND COD_GRA='" & Me.lstNivel.Text & "' AND LET_CUR='" & Me.lstLetra.Text & "'"
            End If
    
        Case Is = 2
        
            MsgBox "Lista de Profes"
            
        
    End Select

End Sub

Private Sub cmdDetalle_Click(Index As Integer)
    Dim strModal As String
    Dim strGrado As String
    Dim strLetra As String
    Dim nRow As Integer
    Dim strRBD As String
    strModal = Left(Me.txtActaCurso.Item(0).Text, 3)
    strGrado = Left(Me.txtActaCurso.Item(1).Text, 1)
    strLetra = Right(Me.txtActaCurso.Item(1).Text, 1)
    strRBD = Me.txtActaCurso.Item(11).Text
    Select Case Index
        Case Is = 0     '30 de Abril
            
            MsgBox "En Desarrollo"
        
        Case Is = 1
        
            MsgBox "En Desarrollo"
            
        Case Is = 2
        
            MsgBox "En Desarrollo"
            
        Case Is = 3
        
            MsgBox "En Desarrollo"
            
        Case Is = 4
        
            MsgBox "En Desarrollo"
            
        Case Is = 5
        
            MsgBox "En Desarrollo"
            
        Case Is = 6
        
            MsgBox "En Desarrollo"
            
    End Select
End Sub

Private Sub cmdElBoton_Click()
    Dim cnBase As ADODB.Connection
    Dim cnHist As ADODB.Connection
    Dim rsBase As ADODB.Recordset
    Dim rsBas2 As ADODB.Recordset
    Dim RsBas3 As ADODB.Recordset
    Dim rsHist As ADODB.Recordset
    Dim rsHis2 As ADODB.Recordset
    
    Dim strModal As String
    Dim strGrado As String
    Dim strLetra As String
    Dim strRBD As String
    Dim nNotas As Single
    Dim sConce As String
    Dim sExim As String
    Dim sDecEva As String
    Dim I As Integer
    Dim strNomDir As String
    Dim bProcesa As Boolean
    
    Dim nMod As Integer
    Dim nGra As Integer
    Dim nLet As Integer
    
    Set cnBase = New ADODB.Connection
    Set cnHist = New ADODB.Connection
    
    Set rsBase = New ADODB.Recordset
    Set rsHist = New ADODB.Recordset
    
    cnBase = NueConn(Servidor, Base, "kripplefight", "groot")
    cnHist = NueConn(Servidor, Base, "kripplefight", "groot")
    cnBase.Open
    cnHist.Open
    
    Set rsBase = cnBase.Execute("SELECT * FROM establecimientos")
    strRBD = rsBase("rdb")
    rsBase.Close
    
    For nMod = 0 To Me.lstModalidad.ListCount - 1
        Me.lstModalidad.Text = Me.lstModalidad.List(nMod)
        lstModalidad_Click
        For nGra = 0 To Me.lstNivel.ListCount - 1
            Me.lstNivel.Text = Me.lstNivel.List(nGra)
            lstNivel_Click
            For nLet = 0 To Me.lstLetra.ListCount - 1
                DoEvents
                Me.lstLetra.Text = Me.lstLetra.List(nLet)
                
                strModal = Left(Me.lstModalidad.Text, 3)
                strGrado = Left(Me.lstNivel.Text, 1)
                strLetra = Right(Me.lstLetra.Text, 1)
                
                
                Set rsBase = cnBase.Execute("SELECT pe.decres_plan, agno_decres, pe.plan_est, pe.agno_plan, ss.ord_asi, a.cod_sec, a.cod_asi,  s.nom_sec, ss.NOM_ASI, a.RUT_PROF, p.NOMS_PROF, p.APE1_PROF, p.APE2_PROF, cs.DES_SIT_PROF FROM asi_x_cur_prof a, profesores p, sectores s, subsectores ss, plan_estudio pe, SITPROF_X_ASI sp, SIT_PROF cs WHERE a.RUT_PROF=p.RUT_PROF and a.cod_ens = ss.cod_ens and a.num_gra = ss.num_gra and a.cod_asi = ss.cod_asi and  ss.cod_sec=s.cod_sec AND a.cod_ens=pe.cod_ens and a.num_gra=pe.num_gra and a.cod_ens=sp.cod_ens AND a.num_gra=sp.num_gra and a.cod_Asi=sp.cod_asi and a.rut_prof=sp.rut_prof and sp.COD_SIT_PROF = cs.COD_SIT_PROF AND pe.agno='" & nAgno & "' and a.cod_ens='" & strModal & "' and a.num_gra = '" & strGrado & "' and  a.let_cur='" & strLetra & "' order by ord_asi")
                                            
                If rsBase.EOF Then
                    MsgBox "No es posible continuar con el proceso de este curso, falta ingresar información relativa a" & vbCrLf & "Planes de Estudio y SubSectores para el Grado y la Modalidad", vbExclamation + vbOKOnly, "Falta Informacion"
                    rsBase.Close
                    cnBase.Close
                    cnHist.Close
                    timerScroll False
                    Exit Sub
                End If
                
                While Not rsBase.EOF
                    cnHist.Execute "REPLACE INTO acta_sub_sec (RBD,AGNO,NUM_GRA,ORD_ASI,COD_SEC,COD_ASI,DES_SEC,DES_ASI) " & _
                        "VALUES ('" & strRBD & "','" & nAgno & "','" & strGrado & "'," & rsBase("ORD_ASI") & "," & rsBase("COD_SEC") & "," & rsBase("COD_ASI") & ",'" & rsBase("NOM_SEC") & "','" & rsBase("NOM_ASI") & "')"
                    cnHist.Execute "REPLACE INTO acta_doc_sub (RBD, AGNO, COD_ENS, COD_GRA, LET_CUR, COD_PPP, COD_PLA, COD_ASI, RUN_DOC, APE_PAT, APE_MAT, NOMBRES, COD_SIT) " & _
                        "VALUES ('" & strRBD & "','" & nAgno & "','" & strModal & "','" & strGrado & "','" & strLetra & "','" & rsBase("decres_plan") & rsBase("agno_decres") & "','" & rsBase("plan_est") & rsBase("agno_plan") & "','" & rsBase("COD_ASI") & "','" & rsBase("RUT_PROF") & "','" & rsBase("APE1_PROF") & "','" & rsBase("APE2_PROF") & "','" & rsBase("NOMS_PROF") & "','" & rsBase("DES_SIT_PROF") & "')"
                    rsBase.MoveNext
                Wend
                
                rsBase.Close
                        
                'Me.cmdVerActa(0).Value = True
            Next nLet
        Next nGra
    
    Next nMod

End Sub

Private Sub cmdEmiCert_Click(Index As Integer)
    Dim I As Integer
    Select Case Index
        Case Is = 0
            For I = 0 To Me.lstNomAls.ListCount - 1
                If Me.lstNomAls.Selected(I) Then
                    ImprimeCertif Left(Me.lstNomAls.List(I), 10), Mid(Me.lstNomAls.List(I), 14)
                End If
            Next
        Case Is = 1
            Me.fraCert.Visible = False
            Me.fraCurso.Visible = False
            Me.fraResumen.Visible = False
    End Select
End Sub

Private Sub cmdNomLic_Click(Index As Integer)
    Dim btnCancel As Boolean
    Dim sLinea As String
    On Error GoTo QuePaso
    Dim I As Integer
    Dim j As Integer
    Select Case Index
        Case Is = 0
            btnCancel = False
            Me.cd.CancelError = True
            Me.cd.FileName = "a" & Me.grDatAlu.TextMatrix(2, 2) & "_9.txt"
            Me.cd.DefaultExt = "txt"
            Me.cd.Filter = "txt"
            Me.cd.ShowSave
            If Not btnCancel Then
                Open Me.cd.FileName For Output As 1
                For I = 1 To Me.grDatAlu.Rows - 1
                    sLinea = ""
                    For j = 1 To Me.grDatAlu.Cols - 1
                        sLinea = sLinea & Me.grDatAlu.TextMatrix(I, j) & Chr(9)
                    Next
                    Print #1, Left(sLinea, Len(sLinea) - 1)
                Next
                Close 1
            End If
        Case Is = 1
            Me.fraNomLic.Visible = False
            Me.fraNomLic.Enabled = False
            Me.fraNomLic.Top = Me.Height
    End Select
    Exit Sub
QuePaso:
    If Err.Number = 32755 Then
        btnCancel = True
        Resume Next
    End If
End Sub

Private Sub cmdOK_Click()
    Me.fraWork.Visible = False
    Me.cmdActaRech.Item(0).Enabled = True
    Me.cmdActaRech.Item(1).Enabled = True
    Me.cmdActaRech.Item(2).Enabled = True
    Me.cmdActaRech.Item(3).Enabled = True
End Sub

Private Sub cmdVerActa_Click(Index As Integer)
    Select Case Index
        Case Is = 0
            If Left(Me.lstModalidad.Text, 3) = "010" Or Left(Me.lstModalidad.Text, 3) = "10" Or Left(Me.lstModalidad.Text, 3) = "996" Then
                MsgBox "La Modalidad seleccionada no posee Calificaciones" & vbCrLf & "seleccione otra modalidad para continuar", vbInformation + vbOKOnly, "No Existen Calificaciones"
                Me.lstModalidad.SetFocus
            Else
                Select Case Reporte
                    Case Is = 1         'Certificado Anual de estudios
                        Me.fraCert.Visible = True
                        Me.optAls(0).Value = False
                        Me.optAls(1).Value = False
                        Me.optAls(0).Enabled = False
                        Me.optAls(1).Enabled = False
                        Me.lstNomAls.Enabled = False
                        Me.lstNomAls.Text = ""
                        Me.lstNomAls.Clear
                        Me.fraCert.Enabled = True
                        Me.optDesCert(0).Value = False
                        Me.optDesCert(1).Value = False
                        Me.optDesCert(0).Enabled = False
                        Me.optDesCert(1).Enabled = False
                        Me.cmdEmiCert(0).Enabled = False
                        Me.lblCertif(2).Caption = Me.lstNivel.Text & "º " & Me.lstLetra.Text
                        Me.txtActaCurso.Item(0) = Me.lstModalidad.Text
                        Me.txtActaCurso.Item(1) = Me.lstNivel.Text & "º " & Me.lstLetra.Text
                        Traspasa
                        Me.optDesCert(0).Enabled = True
                        Me.optDesCert(1).Enabled = True
                        Me.optAls(0).Enabled = True
                        Me.optAls(1).Enabled = True
                    Case Is = 2         'Acta de Calificaciones anuales
                        Me.fraResumen.Visible = True
                        Me.fraResumen.Enabled = True
                        Me.txtActaCurso.Item(0) = Me.lstModalidad.Text
                        Me.txtActaCurso.Item(1) = Me.lstNivel.Text & "º " & Me.lstLetra.Text
                        For I = 0 To Me.cmdDetalle.count - 1
                            Me.cmdDetalle.Item(I).Enabled = False
                        Next
                        Me.cmdActCurs.Item(0).Enabled = False
                        Me.cmdActCurs.Item(1).Enabled = False
                        Me.cmdActCurs.Item(2).Enabled = False
                        Me.OptDestino.Item(0).Enabled = False
                        Me.OptDestino.Item(1).Enabled = False
                        Me.OptDestino.Item(0).Value = False
                        Me.OptDestino.Item(1).Value = False
                        Me.chkH1.Visible = False
                        Me.chkH2.Visible = False
                        Traspasa
                        Me.OptDestino.Item(0).Enabled = True
                        Me.OptDestino.Item(1).Enabled = True
                End Select
            End If
        Case Is = 1
            Me.fraCurso.Visible = False
        Case Is = 2
            If MsgBox("Esta accion producira que su computador procese la informacion de todo el colegio" & vbCrLf & "¿Decea ralizar esta accion?", vbQuestion + vbYesNo, "Seguro...") = vbYes Then
                Dim nMod As Integer
                Dim nGra As Integer
                Dim nLet As Integer
                For nMod = 0 To Me.lstModalidad.ListCount - 1
                    Me.lstModalidad.Text = Me.lstModalidad.List(nMod)
                    lstModalidad_Click
                    For nGra = 0 To Me.lstNivel.ListCount - 1
                        Me.lstNivel.Text = Me.lstNivel.List(nGra)
                        lstNivel_Click
                        For nLet = 0 To Me.lstLetra.ListCount - 1
                            Me.lstLetra.Text = Me.lstLetra.List(nLet)
                            lstLetra_Click
                            Me.cmdVerActa(0).Value = True
                        Next nLet
                    Next nGra
                Next nMod
            End If
    End Select
End Sub



Private Sub Command1_Click()
    Dim ApExcel As Variant
    Set ApExcel = CreateObject("Excel.application")
    ApExcel.Workbooks.Add
          
    For I = 1 To Me.grDatAlu.Cols - 1
        ApExcel.Cells(1, I).Font.Size = 12
        ApExcel.Cells(1, I).Font.Bold = True
        ApExcel.Cells(1, I).Formula = Me.grDatAlu.TextMatrix(0, I)
    Next I
    'pgbar.Min = 1
    'pgbar.Max = grDatAlu.Rows
    'pgbar.Value = pgbar.Min
    For I = 1 To grDatAlu.Rows - 1

         For j = 1 To grDatAlu.Cols - 1
            ApExcel.Cells((I + 1), j).Formula = IIf(grDatAlu.TextMatrix(I, j) = "Null", "", grDatAlu.TextMatrix(I, j))
        
        'pgbar.Value = i
        Next j
    Next I
            
    ApExcel.Visible = True
    'ApExcel.Range("a1:x1").Borders.color = RGB(255, 0, 0)
    Set ApExcel = Nothing
End Sub

Private Sub Form_Load()
    Puntero = 10
    Reporte = 0
    bActaOk = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If Me.fraBotPro.Visible Then
        Call menuhabilitado(True)
    End If
    If Me.tmConeccion.Enabled = True Then Me.tmConeccion.Enabled = False
End Sub

Private Sub lblActaCurso_Click(Index As Integer)
    Select Case Index
        Case Is = 12
            MsgBox "Modifica datos del Colegio", vbQuestion + vbYesNo, "Datos..."
    End Select
End Sub

Private Sub lstLetra_Click()
    Me.cmdVerActa.Item(0).Enabled = True
    Me.fraResumen.Visible = False
    Me.fraCert.Visible = False
End Sub

Private Sub lstModalidad_Click()
    Dim modal As String
    Dim Niveles As ADODB.Recordset
    Dim I As Integer
    Me.lstNivel.Clear
    Me.lstLetra.Clear
    Me.lstNivel.Enabled = False
    Me.lstLetra.Enabled = False
    Set Niveles = New ADODB.Recordset
    Niveles.CursorType = adOpenDynamic
    Niveles.LockType = adLockReadOnly
    Niveles.CursorLocation = adUseClient
    modal = Left(lstModalidad.Text, 3)
    If nAgno = Anno Then
        Niveles.Open "SELECT DISTINCT NUM_GRA FROM CURSOS WHERE COD_ENS = '" & modal & "' AND AGNO=" & nAgno & ";", conn
    Else
        Niveles.Open "SELECT DISTINCT COD_GRA as 'num_gra' FROM acta_act_cur WHERE COD_ENS = '" & modal & "' AND AGNO=" & nAgno & ";", conn
    End If
    Me.lstNivel.Clear
    Me.cmdVerActa.Item(0).Enabled = False
    While Not Niveles.EOF
        Me.lstNivel.AddItem Niveles("NUM_GRA")
        Niveles.MoveNext
    Wend
    Niveles.Close
    Me.lstNivel.Enabled = True
    Me.fraResumen.Visible = False
End Sub

Private Sub lstNivel_Click()
    Dim rsLetCur As ADODB.Recordset
    Dim strModal As String
    Dim strNivel As String
    Me.lstLetra.Clear
    Me.lstLetra.Enabled = False
    Set rsLetCur = New ADODB.Recordset
    rsLetCur.CursorType = adOpenDynamic
    rsLetCur.LockType = adLockOptimistic
    strModal = Left(Me.lstModalidad.Text, 3)
    strNivel = LTrim(RTrim(Me.lstNivel.Text))
    If nAgno = Anno Then
        rsLetCur.Open "SELECT LET_CUR FROM CURSOS WHERE COD_ENS = '" & strModal & "' AND NUM_GRA = '" & strNivel & "' AND AGNO=" & nAgno & ";", conn
    Else
        rsLetCur.Open "SELECT LET_CUR FROM acta_act_cur WHERE COD_ENS = '" & strModal & "' AND COD_GRA = '" & strNivel & "' AND AGNO=" & nAgno & ";", conn
    End If
    Me.lstLetra.Clear
    Me.cmdVerActa.Item(0).Enabled = False
    While Not rsLetCur.EOF
        Me.lstLetra.AddItem rsLetCur.Fields("LET_CUR")
        rsLetCur.MoveNext
    Wend
    rsLetCur.Close
    Me.lstLetra.Enabled = True
    Me.fraResumen.Visible = False
End Sub

Private Sub lstNomAls_Click()
    Me.optDesCert(0).Enabled = True
    Me.optDesCert(1).Enabled = True
End Sub

Private Sub lstNomAls_DblClick()
    Me.optDesCert(0).Enabled = True
    Me.optDesCert(1).Enabled = True
    Me.optDesCert(0).Value = True
    Me.cmdEmiCert(0).Value = True
End Sub

Private Sub optAls_Click(Index As Integer)
    Dim rsHist As ADODB.Recordset
    Me.lstNomAls.Clear
    Set rsHist = conn.Execute("SELECT RDB AS RBD, nom_est FROM ESTABLECIMIENTOS")
    If Not rsHist.EOF Then
        Me.txtActaCurso(11).Text = rsHist(0)
        Me.txtActaCurso(12).Text = rsHist(1)
        Me.cmdEmiCert(0).Enabled = False
        Me.cmdEmiCert(1).Enabled = False
        rsHist.Close
        Set rsHist = conn.Execute("SELECT h.run_alu, h.ape_pat, h.ape_mat, h.nombres from hist_alumno h, acta_sit_pro sp, acta_nomina an WHERE h.run_alu=sp.run_alu AND h.run_alu=an.run_alu AND sp.rbd='" & Me.txtActaCurso(11).Text & "' AND sp.AGNO='" & nAgno & "' AND sp.COD_ENS='" & Me.lstModalidad.Text & "' AND sp.cod_gra='" & Me.lstNivel.Text & "' AND sp.let_cur='" & Me.lstLetra.Text & "' and sp.agno = an.agno ORDER BY APE_PAT, APE_MAT, NOMBRES")
        While Not rsHist.EOF
            Me.lstNomAls.AddItem IIf(Len(rsHist("RUN_ALU")) < 9, Format(Left(rsHist("RUN_ALU"), Len(rsHist("RUN_ALU")) - 3), "00000000") & Right(rsHist("RUN_ALU"), 3), rsHist("RUN_ALU")) & " - " & rsHist("ape_pat") & " " & rsHist("ape_mat") & " " & rsHist("nombres")
            rsHist.MoveNext
        Wend
        rsHist.Close
        Select Case Index
            Case Is = 0
                Set rsHist = Nothing
                Me.lstNomAls.Enabled = True
                Me.optDesCert(0).Enabled = False
                Me.optDesCert(1).Enabled = False
            Case Is = 1
                Me.lstNomAls.Enabled = False
                Me.optDesCert(0).Enabled = True
                Me.optDesCert(1).Enabled = True
                For I = 0 To Me.lstNomAls.ListCount - 1
                    Me.lstNomAls.Selected(I) = True
                Next
                
        End Select
    Else
        rsHist.Close
        Set rsHist = Nothing
    End If
End Sub

Private Sub optDesCert_Click(Index As Integer)
    Me.cmdEmiCert(0).Enabled = True
    Me.cmdEmiCert(1).Enabled = True
End Sub

Private Sub OptDestino_Click(Index As Integer)
    Me.cmdActCurs.Item(0).Enabled = True
    Me.cmdActCurs.Item(2).Enabled = True
    Select Case Index
        Case Is = 0
            Me.chkH1.Visible = True
            Me.chkH1.Value = 1
            Me.chkH2.Visible = True
            Me.chkH2.Value = 1
            Me.lblcopia.Visible = True
            Me.txtCopias.Visible = True
            Me.UpDown.Visible = True
        Case Is = 1
            Me.chkH1.Visible = False
            Me.chkH1.Value = 0
            Me.chkH2.Visible = False
            Me.chkH2.Value = 0
            Me.lblcopia.Visible = False
            Me.txtCopias.Visible = False
            Me.UpDown.Visible = False
    End Select
    If bActaOk Then
        Me.cmdActCurs.Item(1).Enabled = False
    Else
        Me.cmdActCurs.Item(1).Enabled = True
    End If
End Sub

Private Sub tmConeccion_Timer()
    DoEvents
    Puntero = Puntero + 1
    If Puntero > Me.Shape2.count - 1 Then
        Puntero = 0
    End If
    If Puntero < 6 Then
        Select Case Puntero
            Case Is = 0
                Me.Shape2.Item(0).FillColor = Me.Shape2.Item(Me.Shape2.count - 1 - I).FillColor
                Me.Shape2.Item(0).FillStyle = 0
                For I = Me.Shape2.count - 1 To Me.Shape2.count - (5 - Puntero) Step -1
                    Me.Shape2.Item(I).FillColor = Me.Shape2.Item(I - 1).FillColor
                Next
            Case Else
                For I = Puntero To 1 Step -1
                    Me.Shape2.Item(I).FillColor = Me.Shape2.Item(I - 1).FillColor
                    Me.Shape2.Item(I).FillStyle = 0
                Next
                Me.Shape2.Item(0).FillColor = Me.Shape2.Item(Me.Shape2.count - 1).FillColor
                For I = Me.Shape2.count - 1 To Me.Shape2.count - (5 - Puntero) Step -1
                    Me.Shape2.Item(I).FillColor = Me.Shape2.Item(I - 1).FillColor
                Next
        End Select
    Else
        For I = Puntero To Puntero - 5 Step -1
            Me.Shape2.Item(I).FillColor = Me.Shape2.Item(I - 1).FillColor
            Me.Shape2.Item(I).FillStyle = 0
        Next
        If I <> 0 Then
            Me.Shape2.Item(I - 1).FillStyle = 0
        End If
    End If
End Sub

Private Function CreaLocal() As String
    Dim I As Integer
    Dim NombreLocal As String
    'se modifica 10-11-2022
    Dim Variable As Long
    
    Dim BaseLocal As Database
    For I = 1 To 6000
        NombreLocal = App.Path + "\datatemp" + Format(I, "0000") + ".mdb"
        If dir(NombreLocal) = "" Then
            Exit For
        End If
    Next
    
    If Me.lstNivel.Text = "3" Or Me.lstNivel.Text = "4" Then
        Variable = 32
    Else
        Variable = 21
    End If
    
    'estaba en 21 y se cambia por 30
    Set BaseLocal = Workspaces(0).CreateDatabase(NombreLocal, dbLangGeneral)
    strComando = "CREATE TABLE DETALLE (ORDEN INTEGER, NOMALU TEXT(60), RUNALU TEXT(10), SEXALU TEXT(1), FECALU TEXT(12), COMUNA TEXT(30)"
    For I = 1 To Variable:  strComando = strComando + ", NotALU" + Trim(Format(I, "##")) + " TEXT(5)": Next
    strComando = strComando + ",PROMEDIO TEXT(5),ORIENTACION TEXT(5) ,RELIGION TEXT(5), PORASIS TEXT(4),SITFIN TEXT(2), OBS TEXT(50), MATRICULA TEXT(12),RETIRO TEXT(12), APE1ALU TEXT(40), APE2ALU TEXT(40), NOMBALU TEXT(40))"
    BaseLocal.Execute strComando
    BaseLocal.Execute "CREATE TABLE COLUMNA(CODIGO TEXT(6), ASIGNATURA TEXT (60), COLUMNA TEXT (5), RUN_DOCENTE TEXT(10), APE1DOC TEXT(40), APE2DOC TEXT(40), NOMDOC TEXT(40), CALIF TEXT(30))"
    BaseLocal.Execute "CREATE TABLE RESUMEN( M30A INTEGER, ALDA INTEGER, BADA INTEGER, MA30NO INTEGER, PROMO INTEGER, REPINA INTEGER, REPREN INTEGER)"
    BaseLocal.Execute "CREATE INDEX RUNALU ON DETALLE (RUNALU)"
    BaseLocal.Execute "CREATE UNIQUE INDEX CODIGO ON COLUMNA (CODIGO)"
    BaseLocal.Close
    CreaLocal = NombreLocal
End Function

Private Sub ImprimeActaCurso()
    Dim cnBase As ADODB.Connection
    Dim cnHist As ADODB.Connection
    Dim rsHist As ADODB.Recordset
    Dim rsBase As ADODB.Recordset
    Dim rsServ As ADODB.Recordset
    Dim BaseLocal As Database
    Dim rsLocal As Recordset
    Dim rsColum As Recordset
    Dim strCodEns As String
    Dim strNumGra As String
    Dim strLetCur As String
    Dim strRBDcol As String
    Dim nOrden As Integer
    Dim sRutAc As String
    Dim nColAc As Integer
    Dim bCiclo As Boolean
    Dim ctaFormulas As Integer
    Dim asistencia As Double
   
    'se agrega 10-11-2022
    Dim Variable As Long
    
    Dim RsAux2 As ADODB.Recordset
    Set RsAux2 = New ADODB.Recordset
    
    
    strCodEns = Left(Me.txtActaCurso.Item(0).Text, 3)
    strNumGra = Left(Me.txtActaCurso.Item(1).Text, 1)
    strLetCur = Right(Me.txtActaCurso.Item(1).Text, 1)
    strRBDcol = Me.txtActaCurso.Item(11).Text
   
    timerScroll True, Me.fraResumen.Top - 100, 3960
    
    NombreLocal = CreaLocal()
    Set cnBase = NueConn(Servidor, Base, "kripplefight", "groot")
    Set cnHist = NueConn(Servidor, Base, "kripplefight", "groot")
    Set BaseLocal = Workspaces(0).OpenDatabase(NombreLocal)
    cnBase.Open
    cnHist.Open
    Set rsHist = cnHist.Execute("SELECT sp.run_alu , h.ape_pat, h.ape_mat, h.nombres, h.cod_sex, h.fec_nac, cg.comuna, ss.cod_asi,ss.des_asi,aa.nota,aa.conce,aa.al_exi,sp.pro_gen,sp.por_asi,sp.observa,sp.sit_fin,sp.tip_pro, ss.ord_asi FROM acta_sit_pro sp LEFT JOIN acta_nomina an ON sp.rbd=an.rbd AND sp.run_alu=an.run_alu AND sp.agno=an.agno LEFT JOIN acta_ant_aca aa  ON sp.rbd=aa.rbd AND sp.agno=aa.agno AND sp.run_alu=aa.run_alu LEFT JOIN hist_alumno h ON sp.run_alu=h.run_alu, codigos__geograficos cg  LEFT JOIN acta_sub_sec ss ON sp.cod_gra=ss.num_gra and aa.cod_asi=ss.cod_asi and aa.agno=ss.agno WHERE an.cod_com=cg.cod_geo AND sp.rbd='" & strRBDcol & "' AND sp.cod_ens='" & strCodEns & "'  AND sp.cod_gra='" & strNumGra & "' AND sp.let_cur='" & strLetCur & "' AND sp.agno='" & nAgno & "' ORDER BY h.ape_pat, h.ape_mat, h.nombres, ss.ord_asi")
    '
    'Carga de Alumnos y notas
    '
    nOrden = 1
    nColAc = 0
    While Not rsHist.EOF
        If rsHist("por_asi") < 85 Then
            RsAux2.Open "SELECT * FROM `elimina_asistencia_actas` WHERE ci_alu = '" & rsHist("run_alu") & "' AND agno = '" & nAgno & "'", conn
            If RsAux2.RecordCount > 0 Then
                If Mid(RsAux2("concepto"), 1, 7) = "Decreto" Then
                    asistencia = CDbl(Mid(RsAux2("porcentaje_inasistencias"), 1, 3))
                Else
                    asistencia = 85
                End If
                'Asistencia = 85
            Else
                asistencia = IIf(rsHist("por_asi") = 0, 100, rsHist("por_asi"))
            End If
            RsAux2.Close
        Else
            asistencia = IIf(rsHist("por_asi") = 0, 100, rsHist("por_asi"))
        End If
        BaseLocal.Execute "INSERT INTO DETALLE (ORDEN,NOMALU,RUNALU,SEXALU,FECALU,COMUNA,PROMEDIO,PORASIS,SITFIN,OBS,MATRICULA,RETIRO,APE1ALU,APE2ALU,NOMBALU) VALUES ('" & nOrden & "','" & Trim(rsHist("ape_pat")) & " " & Trim(rsHist("ape_mat")) & " " & Trim(rsHist("nombres")) & "','" & rsHist("run_alu") & "','" & rsHist("cod_sex") & "','" & rsHist("fec_nac") & "','" & rsHist("comuna") & "','" & IIf(rsHist("pro_gen") = 0, " ", Format(rsHist("pro_gen"), "0.0")) & "','" & IIf(Trim(UCase(rsHist("sit_fin"))) = "Y", " ", asistencia) & "','" & rsHist("sit_fin") & "','" & rsHist("observa") & "','" & "m" & "','" & "R" & "','a1','a2','n' )"
        sRutAc = rsHist("run_alu")
        bCiclo = True
        While bCiclo
            DoEvents
            Set rsLocal = BaseLocal.OpenRecordset("SELECT * FROM columna WHERE CODIGO='" & rsHist("cod_asi") & "'")
            If rsLocal.EOF Then
                If rsHist("cod_asi") = 13 Or rsHist("cod_asi") = 22 Then
                    If rsHist("cod_asi") = 13 Then
                        BaseLocal.Execute ("INSERT INTO COLUMNA (codigo,asignatura,columna) VALUES ('" & rsHist("cod_asi") & "','" & rsHist("des_asi") & "','" & 23 & "')")
                    Else
                        BaseLocal.Execute ("INSERT INTO COLUMNA (codigo,asignatura,columna) VALUES ('" & rsHist("cod_asi") & "','" & rsHist("des_asi") & "','" & rsHist("ord_asi") & "')")
                    End If
                Else
                    BaseLocal.Execute ("INSERT INTO COLUMNA (codigo,asignatura,columna) VALUES ('" & rsHist("cod_asi") & "','" & rsHist("des_asi") & "','" & rsHist("ord_asi") & "')")
                End If
            End If
            rsLocal.Close
            If rsHist("cod_asi") = 13 Or rsHist("cod_asi") = 22 Then
                If rsHist("cod_asi") = 13 Then
                    If Len(Trim(rsHist("al_exi"))) = 0 Then
                        BaseLocal.Execute ("UPDATE detalle SET RELIGION='" & rsHist("conce") & "' WHERE RUNALU='" & rsHist("run_alu") & "'")
                    Else
                        BaseLocal.Execute ("UPDATE detalle SET RELIGION='" & rsHist("al_exi") & "' WHERE RUNALU='" & rsHist("run_alu") & "'")
                    End If
                Else
                    If Len(Trim(rsHist("al_exi"))) = 0 Then
                        BaseLocal.Execute ("UPDATE detalle SET ORIENTACION='" & rsHist("conce") & "' WHERE RUNALU='" & rsHist("run_alu") & "'")
                    Else
                        BaseLocal.Execute ("UPDATE detalle SET ORIENTACION='" & rsHist("al_exi") & "' WHERE RUNALU='" & rsHist("run_alu") & "'")
                    End If
                End If
            Else
                If rsHist("nota") = 0 Then
                    If UCase(rsHist("al_exi")) = "EX" Then
                        BaseLocal.Execute ("UPDATE detalle SET NotAlu" + LTrim(RTrim(Format(rsHist("ord_asi"), "##"))) & "='" & rsHist("al_exi") & "' WHERE RUNALU='" & rsHist("run_alu") & "'")
                    Else
                        If Not IsNull(rsHist("ord_asi")) Then
                            BaseLocal.Execute ("UPDATE detalle SET NotAlu" + LTrim(RTrim(Format(rsHist("ord_asi"), "##"))) & "='" & rsHist("conce") & "' WHERE RUNALU='" & rsHist("run_alu") & "'")
                        End If
                    End If
                Else
                    If Not IsNull(rsHist("Nota")) And Not IsNull(rsHist("ord_asi")) Then
                        BaseLocal.Execute ("UPDATE detalle SET NotAlu" + LTrim(RTrim(Format(rsHist("ord_asi"), "##"))) & "='" & Format(rsHist("nota"), "0.0") & "' WHERE RUNALU='" & rsHist("run_alu") & "'")
                    End If
                End If
            End If
            rsHist.MoveNext
            If rsHist.EOF Then
                bCiclo = False
            Else
                If rsHist("run_alu") <> sRutAc Then
                    bCiclo = False
                End If
            End If
        Wend
        nOrden = nOrden + 1
    Wend
    If BaseLocal.TableDefs("DETALLE").RecordCount < 54 Then
        For I = BaseLocal.TableDefs("DETALLE").RecordCount + 1 To 54
            BaseLocal.Execute "INSERT INTO DETALLE ( ORDEN ) VALUES ( " & I & ")"
        Next
    End If
    rsHist.Close
    'se modifica 10-11-2022
    If strNumGra = 3 Or strNumGra = 4 Then
        Me.CrystalReport1.ReportFileName = App.Path + "\RPT\acta3y4medios.rpt"
        ''Me.CrystalReport1.ReportFileName = App.Path + "\RPT\ACTA1.RPT"
    Else
        Me.CrystalReport1.ReportFileName = App.Path + "\RPT\ACTA1.RPT"
    End If
    Me.CrystalReport1.DataFiles(0) = NombreLocal
    Me.CrystalReport1.Formulas(0) = "NumeroRegistro = {DETALLE.ORDEN}"
    Me.CrystalReport1.Formulas(1) = "NombreAlumno = {DETALLE.NOMALU}"
    Me.CrystalReport1.Formulas(2) = "RUN = {DETALLE.RUNALU}"
    Me.CrystalReport1.Formulas(3) = "Sexo = {DETALLE.SEXALU}"
    Me.CrystalReport1.Formulas(4) = "Fechanacimiento ={DETALLE.FECALU}"
    Me.CrystalReport1.Formulas(5) = "Comuna ={DETALLE.COMUNA}"
    ctaFormulas = 8
    Set rsColum = BaseLocal.OpenRecordset("COLUMNA")
    rsColum.MoveLast
    rsColum.MoveFirst
    'i = 1
    While Not rsColum.EOF
        DoEvents
        If Not (rsColum("CODigo") = "13" Or rsColum("CODigo") = "22") Then
            If Len(Trim((rsColum("CODIGO")))) > 0 Then
                Me.CrystalReport1.Formulas(ctaFormulas) = "CodAs" + Format(rsColum("Columna"), "##") + "= '" + rsColum("CODIGO") + "'"
                ctaFormulas = ctaFormulas + 1
                Me.CrystalReport1.Formulas(ctaFormulas) = "SubSector" + Format(rsColum("Columna"), "##") + "= '" + rsColum("asignatura") + "'"
                ctaFormulas = ctaFormulas + 1
                'i = i + 1
            End If
        Else
            If rsColum("CODigo") = "13" Then
                Me.CrystalReport1.Formulas(ctaFormulas) = "CodRel = '13'"
                ctaFormulas = ctaFormulas + 1
                Me.CrystalReport1.Formulas(ctaFormulas) = "SubSectorR = 'RELIGION'"
                ctaFormulas = ctaFormulas + 1
            End If
            If rsColum("CODigo") = "22" Then
                Me.CrystalReport1.Formulas(ctaFormulas) = "CodOri = '22'"
                ctaFormulas = ctaFormulas + 1
                Me.CrystalReport1.Formulas(ctaFormulas) = "SubSectorO = 'ORIENTACION'"
                ctaFormulas = ctaFormulas + 1
            End If
        End If
        rsColum.MoveNext
    Wend
    
    'Formulas para la generacion de las Columnas de Notas
    
    'se modifica 10-11-2022
    If strNumGra = 3 Or strNumGra = 4 Then
        Variable = 32
        'Variable = rsColum.RecordCount
    Else
        Variable = 21
        'Variable = rsColum.RecordCount
    End If
    For I = 1 To Variable
    'For i = 1 To 30  'SE CAMBIA A 30
        Me.CrystalReport1.Formulas(ctaFormulas) = "NOTA" + Format(I, "##") + "={DETALLE.NOTALU" + Format(I, "##") + "}"
        ctaFormulas = ctaFormulas + 1
    Next
    Me.CrystalReport1.Formulas(ctaFormulas) = "ORIE={DETALLE.ORIENTACION}"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "RELIG={DETALLE.RELIGION}"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "PROMFINAL={DETALLE.PROMEDIO}"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "PORASIST={DETALLE.PORASIS}"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "SITFINAL={DETALLE.SITFIN}"
    ctaFormulas = ctaFormulas + 1
    If strNumGra = 3 Or strNumGra = 4 Then
    Else
        Me.CrystalReport1.Formulas(ctaFormulas) = "Observaciones ={DETALLE.OBS}"
        ctaFormulas = ctaFormulas + 1
    End If
    '
    ' Carga de Profesores y sus datos
    '
    Set rsHist = cnHist.Execute("SELECT ass.cod_asi, ass.cod_sec, ads.run_doc, ads.ape_pat, ads.ape_mat, ads.nombres, ads.cod_sit FROM acta_sub_sec ass, acta_doc_sub ads WHERE ass.rbd=ads.rbd AND ass.agno=ads.agno AND ass.cod_asi=ads.cod_asi AND ads.rbd='" & strRBDcol & "' AND ass.agno='" & nAgno & "' AND ads.cod_ens='" & strCodEns & "' AND ads.cod_gra='" & strNumGra & "' AND ads.let_cur='" & strLetCur & "' order BY ORD_aSI")
    rsColum.Index = "codigo"
    While Not rsHist.EOF
        DoEvents
        rsColum.Seek "=", LTrim(str(rsHist("COD_ASI")))
        If Not rsColum.NoMatch Then
            If rsHist("COD_ASI") = 13 Or rsHist("COD_ASI") = 22 Then
                If rsHist("COD_ASI") = 13 Then
                    rsColum.Edit
                    rsColum("RUN_DOCENTE") = rsHist("RUN_DOC")
                    rsColum("APE1DOC") = rsHist("APE_PAT")
                    rsColum("APE2DOC") = rsHist("APE_MAT")
                    rsColum("NOMDOC") = rsHist("NOMBRES")
                    rsColum.Update
                    Me.CrystalReport1.Formulas(ctaFormulas) = "NombreProfeR='" + Trim(rsHist("NOMBRES")) + " " + Trim(rsHist("APE_PAT")) + " " + Trim(rsHist("APE_mat")) + "'"
                    ctaFormulas = ctaFormulas + 1
                    Me.CrystalReport1.Formulas(ctaFormulas) = "RUNREL='" + Trim(rsHist("RUN_DOC")) + "'"
                    ctaFormulas = ctaFormulas + 1
                    Me.CrystalReport1.Formulas(ctaFormulas) = "Sit_AcaREL='" + rsHist("COD_SIT") + "'"
                    ctaFormulas = ctaFormulas + 1
                Else
                    rsColum.Edit
                    rsColum("RUN_DOCENTE") = rsHist("RUN_DOC")
                    rsColum("APE1DOC") = rsHist("APE_PAT")
                    rsColum("APE2DOC") = rsHist("APE_MAT")
                    rsColum("NOMDOC") = rsHist("NOMBRES")
                    rsColum.Update
                    Me.CrystalReport1.Formulas(ctaFormulas) = "NombreProfeO='" + Trim(rsHist("NOMBRES")) + " " + Trim(rsHist("APE_PAT")) + " " + Trim(rsHist("APE_mat")) + "'"
                    ctaFormulas = ctaFormulas + 1
                    Me.CrystalReport1.Formulas(ctaFormulas) = "RUNORI='" + Trim(rsHist("RUN_DOC")) + "'"
                    ctaFormulas = ctaFormulas + 1
                    Me.CrystalReport1.Formulas(ctaFormulas) = "Sit_AcaORI='" + rsHist("COD_SIT") + "'"
                    ctaFormulas = ctaFormulas + 1

                End If
            Else
                rsColum.Edit
                rsColum("RUN_DOCENTE") = rsHist("RUN_DOC")
                rsColum("APE1DOC") = rsHist("APE_PAT")
                rsColum("APE2DOC") = rsHist("APE_MAT")
                rsColum("NOMDOC") = rsHist("NOMBRES")
                rsColum.Update
                Me.CrystalReport1.Formulas(ctaFormulas) = "NombreProfe" + Format(rsColum("COLUMNA"), "##") + "='" + Trim(rsHist("NOMBRES")) + " " + Trim(rsHist("APE_PAT")) + " " + Trim(rsHist("APE_MAT")) + "'"
                ctaFormulas = ctaFormulas + 1
                Me.CrystalReport1.Formulas(ctaFormulas) = "RUNProfe" + Format(rsColum("COLUMNA"), "##") + "='" + Trim(rsHist("RUN_DOC")) + "'"
                ctaFormulas = ctaFormulas + 1
                Me.CrystalReport1.Formulas(ctaFormulas) = "Sit_Aca" + Format(rsColum("COLUMNA"), "00") + "= '" + rsHist("COD_SIT") + "'"
                ctaFormulas = ctaFormulas + 1
            End If
        Else
            If strCodEns = "310" And (strNumGra = 1 Or strNumGra = 2) Then
            Else
                MsgBox "Problema con Sub Sector " & rsHist("cod_asi"), vbOKOnly + vbInformation
            End If
        End If
        rsHist.MoveNext
    Wend
    
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    
    Set rsBase = cnBase.Execute("SELECT * FROM ESTABLECIMIENTOS")
    Me.CrystalReport1.Formulas(ctaFormulas) = "NombreColegio='" + rsBase("NOM_EST") + "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "TipoRec='RESOLUCIÓN EXENTA'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "NumeroReconocimiento='" + rsBase("NUM_RES_REC_OFI_EST") + "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "YearRecCon='" + Format(Year(IIf(IsNull(rsBase("FEC_RES_REC_OFI_EST")), #9/9/9999#, rsBase("FEC_RES_REC_OFI_EST"))), "0000") + "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "RBD='" + rsBase("RDB") + "'"
    ctaFormulas = ctaFormulas + 1
    If cole = "PUD001" Then
        Me.CrystalReport1.Formulas(ctaFormulas) = "dir_sub='" + "Directora Subrogante" + "'"
        ctaFormulas = ctaFormulas + 1
        Me.CrystalReport1.Formulas(ctaFormulas) = "NombreDirector='" + Trim(rsBase("NOM_DIR_SUB")) + " " + Trim(rsBase("APE_PAT_DIR_SUB")) + " " + rsBase("APE_MAT_DIR_SUB") + "'"
    Else
        Me.CrystalReport1.Formulas(ctaFormulas) = "dir_sub='" + "Director/Directora" + "'"
        ctaFormulas = ctaFormulas + 1
        Me.CrystalReport1.Formulas(ctaFormulas) = "NombreDirector='" + Trim(rsBase("NOM_DIR")) + " " + Trim(rsBase("APE_PAT_DIR")) + " " + rsBase("APE_MAT_DIR") + "'"
    End If
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "ComunaColegio=' " + rsBase("LOCALIDAD_EST") + "'"
    ctaFormulas = ctaFormulas + 1
    Set rsBase = cnBase.Execute("SELECT * FROM codigos__geograficos WHERE comuna='" & rsBase("LOCALIDAD_EST") & "'")
    Me.CrystalReport1.Formulas(ctaFormulas) = "Region='" & rsBase("REGION") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "Provincia='" & rsBase("PROVINCIA") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "Year='" & nAgno & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "Curso='" + Me.txtActaCurso.Item(1).Text + " '"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "TipoEnsenanza='" + Mid$(Me.txtActaCurso.Item(0).Text, 7) + "'"
    ctaFormulas = ctaFormulas + 1
       

    Set rsBase = cnBase.Execute("SELECT * FROM acta_inf_cur WHERE COD_ENS='" & strCodEns & "' AND COD_GRA='" & strNumGra & "' AND let_cur='" & strLetCur & "' AND agno=" & nAgno & ";")
    DecEva = LTrim(Left(rsBase("cod_dev"), Len(rsBase("cod_dev")) - 4))
    anDecEva = Right(rsBase("cod_dev"), 4)

    If Len(Trim(rsBase("cod_pla"))) < 5 Then
        DecPlanYpro = 0
        anplanypro = 0
    Else
        DecPlanYpro = IIf(rsBase("cod_pla") = 0, "0", Trim(Left(rsBase("cod_pla"), Len(rsBase("cod_pla")) - 4)))
        anplanypro = IIf(rsBase("cod_pla") = 0, "0", Right(rsBase("cod_pla"), 4))
    End If

    If Me.txtActaCurso.Item(11).Text = "9782-9" Then
        Me.CrystalReport1.Formulas(ctaFormulas) = "TipoPlan='DECRETO'"
    Else
        Select Case Left(Me.txtActaCurso.Item(1).Text, 1)
            Case Is = 1, Is = 2, Is = 3, Is = 4
                If Left(Me.txtActaCurso.Item(0).Text, 3) = 110 Then
                    Me.CrystalReport1.Formulas(ctaFormulas) = "TipoPlan='R. Ex.'"
                Else
                    Me.CrystalReport1.Formulas(ctaFormulas) = "TipoPlan='DECRETO'"
                End If
            Case Else
                Me.CrystalReport1.Formulas(ctaFormulas) = "TipoPlan='DECRETO'"
        End Select
    End If
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "NumeroPlan='" & DecPlanYpro & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "YearPlan='" & anplanypro & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "NumeroReglamento='" & DecEva & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "YearReglamento='" & anDecEva & "'"
    ctaFormulas = ctaFormulas + 1
    
  '   Cuadro de Resumen
    
    Me.CrystalReport1.Formulas(ctaFormulas) = "Mat30Abril='" & Format(Me.txtActaCurso.Item(2).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "IngresosEntre='" & Format(Me.txtActaCurso.Item(3).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "RetiradosEntre='" & Format(Me.txtActaCurso.Item(4).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "Mat30Noviembre='" & Format(Me.txtActaCurso.Item(5).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "Promovidos='" & Format(Me.txtActaCurso.Item(6).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "ReprobInas='" & Format(Me.txtActaCurso.Item(7).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "ReprobRend='" & Format(Me.txtActaCurso.Item(8).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "TotalReprobados='" & Format(Me.txtActaCurso.Item(9).Text, "#0") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "FechaHoy='" & Format(Date, "Long Date") & "'"
    ctaFormulas = ctaFormulas + 1
    Set rsBase = cnBase.Execute("SELECT * FROM acta_act_cur WHERE COD_ENS='" & strCodEns & "' AND COD_GRA='" & strNumGra & "' AND let_cur='" & strLetCur & "' and agno = " & nAgno)
    Me.CrystalReport1.Formulas(ctaFormulas) = "NomproProJefe='" & rsBase("pro_jef") & "'"
    ctaFormulas = ctaFormulas + 1
    Me.CrystalReport1.Formulas(ctaFormulas) = "NombreEncargado='" & Me.txtActaCurso.Item(10).Text & "'"
    ctaFormulas = ctaFormulas + 1
    'If strNumGra = 3 Or strNumGra = 4 Then
    '    ctaFormulas = ctaFormulas - 1
    'Else
        Me.CrystalReport1.Formulas(ctaFormulas) = "ObsActa='" & Me.txtActaCurso.Item(13).Text & "'"
        ctaFormulas = ctaFormulas + 1
    'End If
    
    rsColum.Close
    BaseLocal.Close

    'Me.CrystalReport1.PrintReport

    If Me.OptDestino.Item(0).Value Then
            Printer.PaperSize = vbPRPSLegal
            Printer.Orientation = vbPRORLandscape
            Me.CrystalReport1.PrinterName = Printer.DeviceName
            Me.CrystalReport1.CopiesToPrinter = Me.txtCopias.Text
            Me.CrystalReport1.Destination = crptToPrinter
            If Me.chkH1.Value Then
                Me.CrystalReport1.PrinterStartPage = 1
                Me.CrystalReport1.PrinterStopPage = 1
                Me.CrystalReport1.Action = 1
            End If
            If Me.chkH2.Value Then
                If MsgBox("De vuelta la Hoja y oprima Aceptar para contnuar", vbOKCancel) = vbOK Then
                    Me.CrystalReport1.PrinterStartPage = 2
                    Me.CrystalReport1.PrinterStopPage = 2
                    Me.CrystalReport1.Action = 1
                End If
            End If
    Else
        Me.CrystalReport1.Destination = crptToWindow
        Me.CrystalReport1.Action = 1
   End If
    
    timerScroll False, Me.fraResumen.Top - 100, 3960
    
    Kill NombreLocal

    For I = 0 To ctaFormulas
        Me.CrystalReport1.Formulas(I) = ""
    Next

End Sub

Private Sub txtActaCurso_KeyPress(Index As Integer, KeyAscii As Integer)
    Select Case Index
        Case Is = 10
            KeyAscii = Asc(UCase(Chr(KeyAscii)))
        Case Is = 13
            If KeyAscii = 13 Then
                KeyAscii = 0
                Exit Sub
            End If
            KeyAscii = Asc(UCase(Chr(KeyAscii)))
        Case Else
            ' nada
    End Select
End Sub

Private Function ImprimeCertif(RunEst As String, NomAlumno As String)
    Dim rsBase As ADODB.Recordset
    Dim rsBas2 As ADODB.Recordset
    Dim asistencia As Double
   
    Dim RsAux2 As ADODB.Recordset
    Set RsAux2 = New ADODB.Recordset
    
    If Me.optDesCert(0).Value Then
        Me.CrystalReport1.Destination = crptToPrinter
    Else
        Me.CrystalReport1.Destination = crptToWindow
    End If
    
    timerScroll True, Me.fraCert.Top - 100, 3960
    Me.CrystalReport1.Formulas(0) = "modalidad='" & Mid(Me.lstModalidad.Text, 7) & "'"
    Set rsBase = conn.Execute("SELECT * FROM ESTABLECIMIENTOS")
    Set rsBas2 = conn.Execute("SELECT REGION, PROVINCIA, COMUNA FROM CODIGOS__GEOGRAFICOS WHERE COMUNA='" & rsBase("LOCALIDAD_EST") & "'")
    Me.CrystalReport1.ReportFileName = App.Path & "\rpt\cert_alu.rpt"
    Me.CrystalReport1.Formulas(1) = "fecha='" & rsBas2("comuna") & ", " & Format(Date, "d") & " de " & Format(Date, "mmmm") & " de " & Format(Date, "yyyy") & "'"
    Me.CrystalReport1.Formulas(2) = "regin='" & rsBas2("REGION") & "'"
    Me.CrystalReport1.Formulas(3) = "provincia='" & rsBas2("provincia") & "'"
    Me.CrystalReport1.Formulas(4) = "comunacol='" & rsBas2("comuna") & "'"
    Me.CrystalReport1.Formulas(5) = "annoescolar='" & nAgno & "'"
    rsBas2.Close
    
    cole = DevuelveCampo("cfg", "", "valor", "param = 'CODBC'", conn)
    
    Me.CrystalReport1.Formulas(6) = "nomcol='" & Me.txtActaCurso.Item(12).Text & "'"
    Me.CrystalReport1.Formulas(7) = "numres='" & rsBase("num_res_rec_ofi_est") & " de " & Year(rsBase("fec_res_rec_ofi_est")) & "'"
    Me.CrystalReport1.Formulas(8) = "rbd='" & rsBase("rdb") & "'"
    If cole = "PUD001" Then
        Me.CrystalReport1.Formulas(9) = "nomdir='" & rsBase("nom_dir_sub") & " " & rsBase("ape_pat_dir_sub") & " " & rsBase("ape_mat_dir_sub") & "'"
    Else
        Me.CrystalReport1.Formulas(9) = "nomdir='" & rsBase("nom_dir") & " " & rsBase("ape_pat_dir") & " " & rsBase("ape_mat_dir") & "'"
    End If
    rsBase.Close
    Me.CrystalReport1.Formulas(10) = "curso='" & Me.lstNivel.Text & "º " & Me.lstLetra.Text & " de " & Mid(Me.lstModalidad.Text, 7) & "'"
    Set rsBase = conn.Execute("SELECT COD_DEV, COD_PPP, COD_PLA, RUN_DOC FROM acta_inf_cur WHERE RBD='" & Me.txtActaCurso.Item(11).Text & "' AND AGNO='" & nAgno & "' AND cod_ens='" & Left(Me.lstModalidad.Text, 3) & "' AND cod_gra='" & Me.lstNivel.Text & "' AND let_cur='" & Me.lstLetra.Text & "'")
    If rsBase.EOF Then
        MsgBox "Problemas con los parametros, falta informacion del Planes de Estudio", vbExclamation + vbOKOnly
        rsBase.Close
        Set rsBase = Nothing
        Set rsBas2 = Nothing
        Exit Function
    End If
    If IsNull(rsBase("cod_ppp")) Or IsNull(rsBase("cod_pla")) Then
        MsgBox "Problemas con los parametros, falta informacion del Planes de Estudio", vbExclamation + vbOKOnly
        rsBase.Close
        Set rsBase = Nothing
        Set rsBas2 = Nothing
        Exit Function
    Else
        If Len(Trim(rsBase("cod_ppp"))) = 0 Or Len(Trim(rsBase("cod_pla"))) = 0 Then
            Me.CrystalReport1.Formulas(11) = "TipoplanEst='de acuerdo al  Plan de Estudios aprobado por Quien Sabe Nº'"
            Me.CrystalReport1.Formulas(12) = "decreto='Falta que lo ingresen'"
        Else
            If Me.txtActaCurso.Item(11).Text = "9782-9" Then
                Me.CrystalReport1.Formulas(11) = "TipoplanEst='de acuerdo al  Plan de Estudios aprobado por Decreto Nº'"
            Else
                Select Case Left(Me.lblCertif(2).Caption, 1)
                    Case Is = 1, Is = 2, Is = 3, Is = 4
                        If Left(Me.txtActaCurso.Item(1).Text, 3) = 110 Then
                            Me.CrystalReport1.Formulas(11) = "TipoplanEst='de acuerdo al  Plan de Estudios aprobado por R. Ex. Nº'"
                        Else
                            Me.CrystalReport1.Formulas(11) = "TipoplanEst='de acuerdo al  Plan de Estudios aprobado por Decreto Nº'"
                        End If
                    Case Else
                        Me.CrystalReport1.Formulas(11) = "TipoplanEst='de acuerdo al  Plan de Estudios aprobado por Decreto Nº'"
                End Select
            End If
            If rsBase("COD_PPP") <> rsBase("COD_PLA") Then
                Me.CrystalReport1.Formulas(12) = "decreto='" & Left(rsBase("cod_pla"), Len(rsBase("cod_pla")) - 4) & " de " & Right(rsBase("cod_pla"), 4) & " " & IIf(rsBase("cod_ppp") = rsBase("cod_pla"), " ", "REX " & Left(rsBase("cod_ppp"), Len(rsBase("cod_ppp")) - 4) & "/" & Right(rsBase("cod_ppp"), 4)) & "'"
            Else
                Me.CrystalReport1.Formulas(12) = "decreto='" & Left(rsBase("cod_pla"), Len(rsBase("cod_pla")) - 4) & " de " & Right(rsBase("cod_pla"), 4) & "'"
            End If
        End If
    End If
    Me.CrystalReport1.Formulas(13) = "deceva='" & Left(rsBase("cod_dev"), Len(rsBase("cod_dev")) - 4) & " de " & Right(rsBase("cod_dev"), 4) & "'"
    rsBase.Close
    Set rsBase = conn.Execute("SELECT pro_gen, por_asi,observa,sit_fin FROM acta_sit_pro WHERE rbd='" & Me.txtActaCurso.Item(11).Text & "' AND agno='" & nAgno & "' AND cod_ens='" & Left(Me.lstModalidad.Text, 3) & "' AND cod_gra='" & Left(Me.lblCertif(2).Caption, 1) & "' AND let_cur='" & Right(Me.lblCertif(2).Caption, 1) & "' AND run_ALU='" & RunEst & "'")
        If rsBase("por_asi") < 85 Then
            RsAux2.Open "SELECT * FROM `elimina_asistencia_actas` WHERE ci_alu = '" & RunEst & "' AND agno = '" & nAgno & "'", conn
            asistencia = rsBase("por_asi")
            If RsAux2.RecordCount > 0 Then
                If Mid(RsAux2("concepto"), 1, 7) = "Decreto" Then
                    asistencia = CDbl(Mid(RsAux2("porcentaje_inasistencias"), 1, 3))
                Else
                    asistencia = 85
                End If
                
            End If
            RsAux2.Close
        Else
            asistencia = IIf(rsBase("por_asi") = 0, " ", rsBase("por_asi"))
        End If
        
    Me.CrystalReport1.Formulas(14) = "Asis = '" & asistencia & "'"
    Me.CrystalReport1.Formulas(15) = "sitFin = '" & AB(rsBase("sit_fin"), Me.lstNivel.Text, Left(Me.lstModalidad.Text, 3)) & "'"
    Me.CrystalReport1.Formulas(16) = "Observacionessit = '" & rsBase("observa") & "'"
    Me.CrystalReport1.Formulas(17) = "pganual = '" & Format(rsBase("pro_gen"), "0.0") & "'"
    Me.CrystalReport1.Formulas(18) = "pganualpalabras ='" & EnPalabras(Format(rsBase("pro_gen"), "0.0")) & "'"
    Me.CrystalReport1.Formulas(19) = "NomAlu='" & NomAlumno & "'"
    Me.CrystalReport1.Formulas(20) = "runalu='" & RunEst & "'"
    rsBase.Close
    Call CreaBD(DirAplicacion & "\GesTemp.mdb")
    Call CreaTabla(DirAplicacion & "\GesTemp.mdb", "cert_alu", "5,10")
    Dim dbsTemp As Database
    Dim rsTemp As Recordset
    Dim CamposInsert, ValoresInsert As String
    Set dbsTemp = OpenDatabase(DirAplicacion & "\GesTemp.mdb")
    'Set rsTemp = dbsTemp.OpenRecordset("cert_alu", dbOpenDynaset)
    Set rsBase = conn.Execute("select distinct s.cod_asi, s.des_sec, s.des_asi, n.nota, n.conce, n.al_exi FROM acta_ant_aca n, acta_sub_sec s WHERE n.cod_asi=s.cod_asi AND n.run_alu='" & RunEst & "' AND s.num_gra=n.cod_gra AND n.agno=s.agno AND n.agno=" & nAgno & " and not (n.nota = '0.0' and n.al_exi = ' ' and n.conce = ' ') ORDER BY s.ord_asi")
    While Not rsBase.EOF
        If rsBase("cod_asi") = 13 Or rsBase("cod_asi") = 22 Then
            If rsBase("cod_asi") = 13 Then
                If Len(Trim(rsBase("al_exi"))) = 0 Then
                    Me.CrystalReport1.Formulas(23) = "pgrel='" & rsBase("conce") & "'"
                Else
                    Me.CrystalReport1.Formulas(23) = "pgrel='" & rsBase("al_exi") & "'"
                End If
                Me.CrystalReport1.Formulas(22) = "pgrelpalabras='" & EnPalabras(rsBase("conce")) & "'"
            Else
                If Len(Trim(rsBase("al_exi"))) = 0 Then
                    Me.CrystalReport1.Formulas(28) = "pgori='" & rsBase("conce") & "'"
                Else
                    Me.CrystalReport1.Formulas(28) = "pgori='" & rsBase("al_exi") & "'"
                End If
                Me.CrystalReport1.Formulas(29) = "pgoripalabras='" & EnPalabras(rsBase("conce")) & "'"
            End If
        Else
            'dbsTemp.Execute "INSERT INTO cert_alu (C2,C3,C4,C5) VALUES ('" & rsBase("des_sec") & "','" & rsBase("des_asi") & "','" & IIf(rsBase("nota") = 0, "Ex", Format(rsBase("nota"), "0.0")) & "','" & IIf((rsBase("nota") > 0), EnPalabras(Format(rsBase("nota"),"    ")) & "')"
            dbsTemp.Execute "INSERT INTO cert_alu (C2,C3,C4,C5) VALUES ('" & rsBase("des_sec") & "','" & rsBase("des_asi") & "','" & IIf(rsBase("nota") = 0, "Ex", Format(rsBase("nota"), "0.0")) & "','" & IIf((rsBase("nota") > 0), EnPalabras(Format(rsBase("nota"), "0.0")), "Eximido") & "')"
        End If
        rsBase.MoveNext
    Wend
    rsBase.Close
    dbsTemp.Close
    
    Set rsBase = conn.Execute("SELECT pro_jef FROM acta_act_cur WHERE rbd='" & Me.txtActaCurso.Item(11).Text & "' AND agno='" & nAgno & "' AND cod_ens='" & Left(Me.lstModalidad.Text, 3) & "' AND cod_gra='" & Left(Me.lblCertif(2).Caption, 1) & "' AND let_cur='" & Right(Me.lblCertif(2).Caption, 1) & "'")
    If rsBase.RecordCount > 0 Then
        rsBase.MoveFirst
        Me.CrystalReport1.Formulas(23) = "NomProf='" & Trim(rsBase!pro_jef) & "'"
    Else
        Me.CrystalReport1.Formulas(23) = "NomProf='" & ProfesorJefe(conn, "N", Left(Me.lstModalidad.Text, 3), Left(Me.lblCertif(2).Caption, 1), Right(Me.lblCertif(2).Caption, 1), val(nAgno)) & "'"
    End If
    rsBase.Close
    If cole = "PUD001" Then
        Me.CrystalReport1.Formulas(24) = "dir_sub='" & "Directora Subrogante Establecimiento" & "'"
    Else
        Me.CrystalReport1.Formulas(24) = "dir_sub='" & "Director (a) Establecimiento" & "'"
        
    End If
    
    Me.CrystalReport1.DataFiles(0) = App.Path & "\gestemp.mdb"
    Me.CrystalReport1.Action = 1
    Set rsBas2 = Nothing
    Set rsBase = Nothing
    Kill App.Path & "\gestemp.mdb"
    timerScroll False
    For I = 0 To 22
        Me.CrystalReport1.Formulas(I) = ""
    Next
End Function


Private Function AB(Sit_F As String, NumGra As String, CodDes As String)
    Dim Result As String
    Dim frase1 As String
    Dim frase2 As String
    Dim lblCurso As String
    frase2 = Mid(Me.lstModalidad.Text, 7)
    Select Case Sit_F
        Case "P"
            frase1 = "Es Promovido (a) a"
            Select Case CodDes
                Case Is = 110
                    Select Case NumGra
                        Case "1"
                            lblCurso = "Segundo Año de "
                        Case "2"
                            lblCurso = "Tercer Año de "
                        Case "3"
                            lblCurso = "Cuarto Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                        Case "4"
                            lblCurso = "Quinto Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                        Case "5"
                            lblCurso = "Sexto Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                        Case "6"
                            lblCurso = "Séptimo Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                        Case "7"
                            lblCurso = "Octavo Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                        Case "8"
                            lblCurso = "Primer Año de " '"1" & " " & LetCur & " de"
                            frase2 = "Educacion Media"
                    End Select
                Case Is = 310
                    Select Case NumGra
                        Case "1"
                            lblCurso = "Segundo Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                            'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EM'", conn)
                        Case "2"
                            lblCurso = "Tercer Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                            'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EM'", conn)
                        Case "3"
                            lblCurso = "Cuarto Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                            'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EM'", conn)
                        Case "4"
                            frase1 = "Obtiene"
                            lblCurso = ""
                            frase2 = "Licencia de Enseñanza Media Humanístico-Científica"
                    End Select
            End Select
        Case "R"
            frase1 = "Reprueba el"
            Select Case NumGra
                Case "1"
                    lblCurso = "Primer Año de " '"1" & " " & LetCur & " de"
                    'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EM'")
                Case "2"
                    lblCurso = "Segundo Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                    'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EB'")
                Case "3"
                    lblCurso = "Tercer Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                    'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EB'")
                Case "4"
                    lblCurso = "Cuarto Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                    'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EB'")
                Case "5"
                    lblCurso = "Quinto Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                    'Me.LblModalidad = devuelvecampo("codigos_ensenanza", "", "des_ens", "cod_des = 'EB'")
                Case "6"
                    lblCurso = "Sexto Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                Case "7"
                    lblCurso = "Séptimo Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
                Case "8"
                    lblCurso = "Octavo Año de " 'str(Val(numgra) + 1) & " " & LetCur & " de"
            End Select
    End Select
    Result = frase1 & " " & lblCurso & " " & frase2
    AB = Result
End Function

Public Function EnPalabras(Nota As String) As String
        'notas con palabras
    Select Case UCase(Nota)
        Case Is = "I"
            EnPalabras = "Insuficiente"
            Exit Function
        Case Is = "S"
            EnPalabras = "Suficiente"
            Exit Function
        Case Is = "B"
            EnPalabras = "Bueno"
            Exit Function
        Case Is = "MB"
            EnPalabras = "Muy Bueno"
            Exit Function
        Case Is = "EX"
            EnPalabras = "Eximidos"
            Exit Function
    End Select

    d1 = ""
    d2 = ""
    Select Case Left(Nota, 1)
        Case "1"
            d1 = "Uno"
        Case "2"
            d1 = "Dos"
        Case "3"
            d1 = "Tres"
        Case "4"
            d1 = "Cuatro"
        Case "5"
            d1 = "Cinco"
        Case "6"
            d1 = "Seis"
        Case "7"
            d1 = "Siete"
    End Select
        
    Select Case Right(Nota, 1)
        Case "0"
            d2 = "Cero"
        Case "1"
            d2 = "Uno"
        Case "2"
            d2 = "Dos"
        Case "3"
            d2 = "Tres"
        Case "4"
            d2 = "Cuatro"
        Case "5"
            d2 = "Cinco"
        Case "6"
            d2 = "Seis"
        Case "7"
            d2 = "Siete"
        Case "8"
            d2 = "Ocho"
        Case "9"
            d2 = "Nueve"
    End Select
    
    EnPalabras = d1 & ", " & d2
    '******************
End Function

