VERSION 5.00
Object = "{F39CBE5C-2D1B-11D6-8D4A-0050043A2E60}#2.0#0"; "ProgBarProzent.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Form_asistencia 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Registrar Atrasos"
   ClientHeight    =   7980
   ClientLeft      =   -15
   ClientTop       =   270
   ClientWidth     =   15030
   Icon            =   "Form_asistencia.frx":0000
   LinkTopic       =   "Form3"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Picture         =   "Form_asistencia.frx":2A8B2
   ScaleHeight     =   7980
   ScaleWidth      =   15030
   Begin VB.Frame fraEscogeModal 
      Height          =   1695
      Left            =   120
      TabIndex        =   61
      Top             =   120
      Visible         =   0   'False
      Width           =   5775
      Begin VB.CommandButton cmdVer 
         Caption         =   "&Ver Calendario"
         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            =   2160
         TabIndex        =   3
         Top             =   1200
         Width           =   1695
      End
      Begin VB.ComboBox cmbLetra 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   4560
         TabIndex        =   2
         Top             =   600
         Width           =   1095
      End
      Begin VB.ComboBox cmbModalidad 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1680
         TabIndex        =   0
         Top             =   240
         Width           =   3975
      End
      Begin VB.ComboBox cmbNivel 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1680
         TabIndex        =   1
         Top             =   600
         Width           =   1095
      End
      Begin VB.Label Label28 
         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
         Left            =   3960
         TabIndex        =   64
         Top             =   600
         Width           =   495
      End
      Begin VB.Label Label26 
         Caption         =   "Tipo de Enseñanza"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   63
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label30 
         Caption         =   "Nivel"
         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        =   62
         Top             =   720
         Width           =   1575
      End
   End
   Begin VB.Frame fraCalendario 
      Enabled         =   0   'False
      Height          =   4215
      Left            =   3360
      TabIndex        =   50
      Top             =   2040
      Visible         =   0   'False
      Width           =   5775
      Begin VB.ComboBox cmbMuestraMes 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1800
         TabIndex        =   4
         Text            =   "Combo1"
         Top             =   240
         Width           =   2655
      End
      Begin VB.CommandButton Command3 
         Caption         =   "&Cancelar"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   1
         Left            =   3120
         TabIndex        =   49
         Top             =   3720
         Width           =   1335
      End
      Begin VB.CommandButton Command3 
         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
         Index           =   0
         Left            =   840
         TabIndex        =   48
         Top             =   3720
         Width           =   1335
      End
      Begin VB.Frame Frame5 
         Height          =   2655
         Left            =   360
         TabIndex        =   51
         Top             =   720
         Width           =   4935
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000FF&
            Height          =   255
            Index           =   41
            Left            =   3960
            Style           =   1  'Graphical
            TabIndex        =   46
            Top             =   1755
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   40
            Left            =   3360
            Style           =   1  'Graphical
            TabIndex        =   45
            Top             =   1755
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   39
            Left            =   2760
            Style           =   1  'Graphical
            TabIndex        =   44
            Top             =   1755
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   38
            Left            =   2160
            Style           =   1  'Graphical
            TabIndex        =   43
            Top             =   1755
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   37
            Left            =   1560
            Style           =   1  'Graphical
            TabIndex        =   42
            Top             =   1755
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   36
            Left            =   960
            Style           =   1  'Graphical
            TabIndex        =   41
            Top             =   1755
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   35
            Left            =   360
            Style           =   1  'Graphical
            TabIndex        =   40
            Top             =   1755
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000FF&
            Height          =   255
            Index           =   34
            Left            =   3960
            Style           =   1  'Graphical
            TabIndex        =   39
            Top             =   1500
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   33
            Left            =   3360
            Style           =   1  'Graphical
            TabIndex        =   38
            Top             =   1500
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   32
            Left            =   2760
            Style           =   1  'Graphical
            TabIndex        =   37
            Top             =   1500
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   31
            Left            =   2160
            Style           =   1  'Graphical
            TabIndex        =   36
            Top             =   1500
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   30
            Left            =   1560
            Style           =   1  'Graphical
            TabIndex        =   35
            Top             =   1500
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   29
            Left            =   960
            Style           =   1  'Graphical
            TabIndex        =   34
            Top             =   1500
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   28
            Left            =   360
            Style           =   1  'Graphical
            TabIndex        =   33
            Top             =   1500
            Width           =   495
         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            =   4200
            TabIndex        =   47
            Top             =   2160
            Width           =   375
         End
         Begin VB.CheckBox Check1 
            Caption         =   "01"
            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
            Style           =   1  'Graphical
            TabIndex        =   5
            Top             =   480
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "08"
            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            =   960
            Style           =   1  'Graphical
            TabIndex        =   6
            Top             =   480
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "15"
            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            =   1560
            Style           =   1  'Graphical
            TabIndex        =   7
            Top             =   480
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "22"
            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            =   2160
            Style           =   1  'Graphical
            TabIndex        =   8
            Top             =   480
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "29"
            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            =   2760
            Style           =   1  'Graphical
            TabIndex        =   9
            Top             =   480
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "02"
            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            =   3360
            Style           =   1  'Graphical
            TabIndex        =   10
            Top             =   480
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "09"
            ForeColor       =   &H000000FF&
            Height          =   255
            Index           =   6
            Left            =   3960
            Style           =   1  'Graphical
            TabIndex        =   11
            Top             =   480
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "16"
            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            =   360
            Style           =   1  'Graphical
            TabIndex        =   12
            Top             =   735
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "23"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   8
            Left            =   960
            Style           =   1  'Graphical
            TabIndex        =   13
            Top             =   735
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "30"
            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            =   1560
            Style           =   1  'Graphical
            TabIndex        =   14
            Top             =   735
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            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            =   2160
            Style           =   1  'Graphical
            TabIndex        =   15
            Top             =   735
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            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            =   2760
            Style           =   1  'Graphical
            TabIndex        =   16
            Top             =   735
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            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            =   3360
            Style           =   1  'Graphical
            TabIndex        =   17
            Top             =   735
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000FF&
            Height          =   255
            Index           =   13
            Left            =   3960
            Style           =   1  'Graphical
            TabIndex        =   18
            Top             =   735
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   14
            Left            =   360
            Style           =   1  'Graphical
            TabIndex        =   19
            Top             =   990
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "30"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   15
            Left            =   960
            Style           =   1  'Graphical
            TabIndex        =   20
            Top             =   990
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "23"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   16
            Left            =   1560
            Style           =   1  'Graphical
            TabIndex        =   21
            Top             =   990
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "16"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   17
            Left            =   2160
            Style           =   1  'Graphical
            TabIndex        =   22
            Top             =   990
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   18
            Left            =   2760
            Style           =   1  'Graphical
            TabIndex        =   23
            Top             =   990
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   19
            Left            =   3360
            Style           =   1  'Graphical
            TabIndex        =   24
            Top             =   990
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000FF&
            Height          =   255
            Index           =   20
            Left            =   3960
            Style           =   1  'Graphical
            TabIndex        =   25
            Top             =   990
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   21
            Left            =   360
            Style           =   1  'Graphical
            TabIndex        =   26
            Top             =   1245
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   22
            Left            =   960
            Style           =   1  'Graphical
            TabIndex        =   27
            Top             =   1245
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   23
            Left            =   1560
            Style           =   1  'Graphical
            TabIndex        =   28
            Top             =   1245
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   24
            Left            =   2160
            Style           =   1  'Graphical
            TabIndex        =   29
            Top             =   1245
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   25
            Left            =   2760
            Style           =   1  'Graphical
            TabIndex        =   30
            Top             =   1245
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Index           =   26
            Left            =   3360
            Style           =   1  'Graphical
            TabIndex        =   31
            Top             =   1245
            Width           =   495
         End
         Begin VB.CheckBox Check1 
            Caption         =   "03"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000FF&
            Height          =   255
            Index           =   27
            Left            =   3960
            Style           =   1  'Graphical
            TabIndex        =   32
            Top             =   1245
            Width           =   495
         End
         Begin VB.Label Días 
            Caption         =   "Días hábiles"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   3120
            TabIndex        =   59
            Top             =   2160
            Width           =   975
         End
         Begin VB.Label Label1 
            Caption         =   "Label1"
            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        =   58
            Top             =   240
            Width           =   495
         End
         Begin VB.Label Label1 
            Caption         =   "Label1"
            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            =   960
            TabIndex        =   57
            Top             =   240
            Width           =   495
         End
         Begin VB.Label Label1 
            Caption         =   "Label1"
            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            =   1560
            TabIndex        =   56
            Top             =   240
            Width           =   495
         End
         Begin VB.Label Label1 
            Caption         =   "Label1"
            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            =   2160
            TabIndex        =   55
            Top             =   240
            Width           =   495
         End
         Begin VB.Label Label1 
            Caption         =   "Label1"
            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            =   2760
            TabIndex        =   54
            Top             =   240
            Width           =   495
         End
         Begin VB.Label Label1 
            Caption         =   "Label1"
            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            =   3360
            TabIndex        =   53
            Top             =   240
            Width           =   495
         End
         Begin VB.Label Label1 
            Caption         =   "Label1"
            BeginProperty Font 
               Name            =   "Arial"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ForeColor       =   &H000000FF&
            Height          =   255
            Index           =   6
            Left            =   3960
            TabIndex        =   52
            Top             =   240
            Width           =   495
         End
      End
      Begin VB.Label Label2 
         Caption         =   "Mes:"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   1320
         TabIndex        =   65
         Top             =   240
         Width           =   615
      End
      Begin VB.Label MesCalendario 
         Alignment       =   2  'Center
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   13.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   60
         Top             =   720
         Width           =   5415
      End
   End
   Begin VB.Frame fraAsiAlum 
      Caption         =   "Frame2"
      Height          =   375
      Left            =   120
      TabIndex        =   104
      Top             =   12720
      Width           =   1215
   End
   Begin VB.Frame fraLeyendo 
      BackColor       =   &H80000018&
      BorderStyle     =   0  'None
      Caption         =   "Frame2"
      Height          =   1575
      Left            =   5040
      TabIndex        =   102
      Top             =   1560
      Visible         =   0   'False
      Width           =   5175
      Begin VB.Label lblLeyendo 
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Caption         =   "Leyendo"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   14.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1335
         Left            =   120
         TabIndex        =   103
         Top             =   120
         Visible         =   0   'False
         Width           =   4935
      End
   End
   Begin VB.CommandButton Command4 
      Caption         =   "&Guardar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   100
      Top             =   5880
      Width           =   1335
   End
   Begin VB.CommandButton Command5 
      Caption         =   "&Cancelar"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1800
      TabIndex        =   99
      Top             =   5880
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Valores anuales"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1080
      TabIndex        =   98
      Top             =   5400
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.CommandButton cmdFull 
      Caption         =   "<"
      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          =   2655
      Left            =   4680
      TabIndex        =   96
      ToolTipText     =   "haga Click para mover la persina"
      Top             =   6720
      Visible         =   0   'False
      Width           =   145
   End
   Begin VB.Frame frmFormaLista 
      Height          =   4815
      Left            =   120
      TabIndex        =   79
      Top             =   480
      Width           =   3075
      Begin VB.OptionButton optFormaGrilla 
         Caption         =   "Por &Semana"
         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          =   255
         Index           =   1
         Left            =   120
         TabIndex        =   89
         Top             =   2880
         Width           =   1575
      End
      Begin VB.OptionButton optFormaGrilla 
         Caption         =   "Todo el &Mes"
         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          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   88
         Top             =   2640
         Width           =   1575
      End
      Begin VB.ComboBox cmbListaMeses 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   120
         TabIndex        =   87
         Top             =   360
         Width           =   2655
      End
      Begin VB.ComboBox cmbListaNiveles 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   120
         TabIndex        =   86
         Top             =   4320
         Width           =   735
      End
      Begin VB.ComboBox cmbListaModal 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   120
         TabIndex        =   85
         Top             =   3720
         Width           =   2895
      End
      Begin VB.ComboBox cmbListaLetras 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   960
         TabIndex        =   84
         Top             =   4320
         Width           =   735
      End
      Begin VB.CommandButton Command7 
         Caption         =   "&Ver"
         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          =   615
         Left            =   2040
         Picture         =   "Form_asistencia.frx":67701
         Style           =   1  'Graphical
         TabIndex        =   82
         Top             =   4080
         Width           =   855
      End
      Begin VB.OptionButton optFormaGrilla 
         Caption         =   "Por &dia"
         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          =   255
         Index           =   2
         Left            =   120
         TabIndex        =   81
         Top             =   3120
         Width           =   1575
      End
      Begin VB.Frame Frame1 
         Caption         =   "Frame1"
         Height          =   2535
         Left            =   3600
         TabIndex        =   80
         Top             =   0
         Width           =   15
      End
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid gridCalend 
         Height          =   1815
         Left            =   120
         TabIndex        =   83
         ToolTipText     =   "Marque el dia que desea ver"
         Top             =   720
         Width           =   2895
         _ExtentX        =   5106
         _ExtentY        =   3201
         _Version        =   393216
         AllowBigSelection=   0   'False
         GridLines       =   0
         GridLinesUnpopulated=   1
         ScrollBars      =   0
         BorderStyle     =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Arial"
            Size            =   6.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _NumberOfBands  =   1
         _Band(0).Cols   =   2
      End
      Begin VB.Label Label5 
         Caption         =   "Mes"
         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        =   93
         Top             =   120
         Width           =   615
      End
      Begin VB.Label Label6 
         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
         Left            =   960
         TabIndex        =   92
         Top             =   4080
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "Nivel"
         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        =   91
         Top             =   4080
         Width           =   495
      End
      Begin VB.Label Label3 
         Caption         =   "Tipo de Enseñanza"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   90
         Top             =   3480
         Width           =   1575
      End
   End
   Begin VB.ComboBox cmb_agno 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   1320
      TabIndex        =   78
      Top             =   120
      Width           =   1815
   End
   Begin VB.Frame fraTotalAsistencia 
      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          =   255
      Left            =   10440
      TabIndex        =   66
      Top             =   120
      Visible         =   0   'False
      Width           =   1215
      Begin VB.TextBox Text2 
         Height          =   285
         Left            =   7200
         TabIndex        =   77
         Top             =   600
         Width           =   735
      End
      Begin VB.ComboBox cmbLetratot 
         Height          =   315
         Left            =   6000
         TabIndex        =   75
         Text            =   "Combo3"
         Top             =   600
         Width           =   735
      End
      Begin VB.ComboBox cmbNiveltot 
         Height          =   315
         Left            =   5040
         TabIndex        =   74
         Text            =   "Combo2"
         Top             =   600
         Width           =   735
      End
      Begin VB.ComboBox cmbTipoEtot 
         Height          =   315
         Left            =   240
         TabIndex        =   73
         Text            =   "Combo1"
         Top             =   600
         Width           =   4455
      End
      Begin VB.CommandButton cmdTotAsis 
         Caption         =   "Command1"
         Height          =   375
         Index           =   1
         Left            =   5880
         TabIndex        =   69
         Top             =   5760
         Width           =   1575
      End
      Begin VB.CommandButton cmdTotAsis 
         Caption         =   "Command1"
         Enabled         =   0   'False
         Height          =   375
         Index           =   0
         Left            =   2160
         TabIndex        =   68
         Top             =   5760
         Width           =   1575
      End
      Begin MSHierarchicalFlexGridLib.MSHFlexGrid msfGTotal 
         Height          =   4095
         Left            =   120
         TabIndex        =   67
         Top             =   1200
         Width           =   8775
         _ExtentX        =   15478
         _ExtentY        =   7223
         _Version        =   393216
         AllowBigSelection=   0   'False
         _NumberOfBands  =   1
         _Band(0).Cols   =   2
         _Band(0).GridLinesBand=   1
         _Band(0).TextStyleBand=   0
         _Band(0).TextStyleHeader=   0
      End
      Begin VB.Label lblTotAsist 
         Caption         =   "Asis Total"
         Height          =   255
         Index           =   3
         Left            =   7200
         TabIndex        =   76
         Top             =   360
         Width           =   855
      End
      Begin VB.Label lblTotAsist 
         Caption         =   "Letra"
         Height          =   255
         Index           =   2
         Left            =   6000
         TabIndex        =   72
         Top             =   360
         Width           =   615
      End
      Begin VB.Label lblTotAsist 
         Caption         =   "Nivel"
         Height          =   255
         Index           =   1
         Left            =   5040
         TabIndex        =   71
         Top             =   360
         Width           =   855
      End
      Begin VB.Label lblTotAsist 
         Caption         =   "Tipo de Enseñanza"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   70
         Top             =   360
         Width           =   1815
      End
   End
   Begin ProgBarProzent.ProgBar ProgBar 
      Height          =   375
      Left            =   120
      TabIndex        =   97
      Top             =   6600
      Width           =   3015
      _ExtentX        =   5318
      _ExtentY        =   661
      Appearance      =   0
   End
   Begin MSHierarchicalFlexGridLib.MSHFlexGrid grAlumnos 
      Height          =   6135
      Left            =   3240
      TabIndex        =   101
      Top             =   480
      Width           =   8175
      _ExtentX        =   14420
      _ExtentY        =   10821
      _Version        =   393216
      AllowBigSelection=   0   'False
      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
      _Band(0).GridLinesBand=   1
      _Band(0).TextStyleBand=   0
      _Band(0).TextStyleHeader=   0
   End
   Begin VB.Label lblCursoMes 
      BackStyle       =   0  'Transparent
      Caption         =   "Label7"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3360
      TabIndex        =   95
      Top             =   120
      Width           =   7695
   End
   Begin VB.Label labelc 
      BackStyle       =   0  'Transparent
      Caption         =   "Año a Revisar"
      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        =   94
      Top             =   120
      Width           =   1095
   End
End
Attribute VB_Name = "Form_asistencia"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Aact As Integer
Dim Guardado As Boolean
Dim Edicion As Boolean
Dim rsCale As ADODB.Recordset
Dim rsAsis As ADODB.Recordset

Private Sub GuardaAsistencia()
    Dim rsBase As ADODB.Recordset
    Dim strAsistencia As String
    Dim Existe As Boolean
    Dim Criterio As String
    Dim strAsiDia As String
    Dim i As Integer
    Dim j As Integer
    Dim log As Variant
    Dim responsable As String
    Set rsBase = New ADODB.Recordset
    rsBase.LockType = adLockOptimistic
    rsBase.CursorLocation = adUseClient
    rsBase.CursorType = adOpenDynamic
    Me.ProgBar.MaxValue = Me.grAlumnos.Rows - 5
    Me.ProgBar.MinValue = 2
    Me.ProgBar.Visible = True
    For i = 2 To Me.grAlumnos.Rows - 5
        strAsistencia = ""
        Criterio = "CI_ALU='" & Me.grAlumnos.TextMatrix(i, 0) & "' AND ACTIVO_ALU = '" & Me.grAlumnos.TextMatrix(i, 6) & "' AND COD_ENS = '" & Left(Me.cmbListaModal.Text, 3) & "' AND NUM_GRA ='" & Me.cmbListaNiveles.Text & "' AND LET_CUR ='" & Me.cmbListaLetras.Text & "' AND FEC_MAT = '" & InvierteFecha(Me.grAlumnos.TextMatrix(i, 3), "R") & "' AND MES_ASIS = '" & Left(UCase(Me.cmbListaMeses.Text), 3) & "' and agno = " & Aact
        For j = 7 To 38
            strAsiDia = Me.grAlumnos.TextMatrix(i, j) 'IIf(Len(Trim(Me.grAlumnos.TextMatrix(i, j))) > 0, Me.grAlumnos.TextMatrix(i, j), " ")
            If Len(Trim(Me.grAlumnos.TextMatrix(i, j))) > 0 Then
                If Len(strAsiDia) > 1 Then
                    strAsiDia = Left(strAsiDia, 1)
                End If
            Else
                strAsiDia = " "
            End If
            strAsistencia = strAsistencia + strAsiDia
        Next
        If ExistReg("atrasos", Criterio, conn) Then
            conn.Execute "UPDATE ATRASOS SET ASIS = '" & strAsistencia & "', ASI_R='" & Me.grAlumnos.TextMatrix(i, 39) & "', ASI_T=" & Me.grAlumnos.TextMatrix(i, 41) & " WHERE " & Criterio
        Else
            conn.Execute "INSERT INTO ATRASOS(CI_ALU,ACTIVO_ALU,COD_ENS,NUM_GRA,LET_CUR,MES_ASIS,ASIS,FEC_MAT, ASI_R, ASI_T, AGNO) VALUES ('" & Me.grAlumnos.TextMatrix(i, 0) & "','" & Me.grAlumnos.TextMatrix(i, 6) & "','" & Left(Me.cmbListaModal.Text, 3) & "','" & Me.cmbListaNiveles.Text & "','" & Me.cmbListaLetras.Text & "','" & Left(UCase(Me.cmbListaMeses.Text), 3) & "','" & strAsistencia & "','" & InvierteFecha(Me.grAlumnos.TextMatrix(i, 3), "R") & "','" & Me.grAlumnos.TextMatrix(i, 39) & "','" & Me.grAlumnos.TextMatrix(i, 41) & "'," & Aact & ");"
        End If
        Me.ProgBar.ShowProgress i
    Next
    'Log de ingreso de asistencia
    Select Case Left(Me.cmbListaModal.Text, 3)
        Case "996"
            grado = "PK"
        Case "010"
            grado = "K"
        Case "110"
            grado = "EB"
        Case "310"
            grado = "EM"
    End Select
    
'    var_sql = "SELECT rut_prof FROM cursos" _
'        & " where cod_ens = '" & ACodens(Me.Cmb_CodEns_Letras.ListIndex) & "' and num_gra = " & Cmb_NumGra_LEtras.Text _
'        & " and let_cur = '" & Cmb_LetCur_Ant.Text & "' and agno = " & cmb_anho_letras.Text
'    objRS.Open var_sql, conn
'    RutProfe = objRS("rut_prof")
'    objRS.Close
    
    curso = Me.cmbListaNiveles.Text & "º " & Me.cmbListaLetras.Text & " " & grado
    accion_realizada = "Se ha modificado la asistencia al curso " & curso _
                     & " para el año " & Aact
              
    responsable = DevuelveCampo("usuarios", "", "rut_usu", "aut_nombre_usuario = '" & Nom_usu_ses & "'", conn)
                   
    'log = Inserta_Vitacora_Asistencia(responsable, "Ingreso de asistencia", Trim(accion_realizada))
    'Fin de log
    
    Me.ProgBar.Visible = False
    Guardado = True
    Me.cmbListaLetras.Text = ""
    Me.grAlumnos.Rows = 2
    lblCursoMes.Caption = ""
    Me.Command7.Enabled = False
    Me.Command4.Enabled = False
End Sub

'Private Sub btn_anterior_1_Click(Index As Integer)
'    Dim MesTr As String
'    Dim Mes As ADODB.Recordset
'    Select Case Index
'        Case Is = 0
'            For i = 0 To Me.Check1.Count - 1
'                If Me.Check1.Item(i).Caption <> "" Then
'                    MesTr = MesTr & Me.Check1.Item(i).Value
'                End If
'            Next
'            MsgBox MesTr
'        Case Is = 1
'        Case Is = 2
'    End Select
'End Sub

Private Sub Check1_Click(Index As Integer)
    Dim CuentaDias As Integer
    Guardado = False
    CuentaDias = 0
    For i = 0 To Me.Check1.count - 1
        If Me.Check1.Item(i).Visible Then
            If Me.Check1.Item(i).Value Then
                CuentaDias = CuentaDias + 1
            End If
        End If
    Next
    Me.Text1.Text = CuentaDias
End Sub

Private Sub Check1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Select Case Button
        Case Is = 2
    End Select
End Sub



Private Sub cmb_agno_Click()
    IniciaIngreso Me, cmb_agno.Text
    Aact = cmb_agno.Text
End Sub

Private Sub cmbLetratot_Click()
    Dim rsTotAsi As ADODB.Recordset
    Dim bIngre As Boolean
    Set rsTotAsi = New ADODB.Recordset
    If Len(Me.Text2.Text) = 0 Then
        If MsgBox("Falta ingresar el ideal de asistencia para el año" & vbCrLf & "¿Desea incorporar la informacion ahora?", vbQuestion + vbYesNo, "Falta informacion") = vbYes Then
            Me.Text2.Text = InputBox("Ingrese la sistencia ideal del año", "Asistencia", 1)
            bIngre = True
        Else
            bIngre = False
        End If
    Else
        bIngre = True
    End If
    If bIngre Then
        rsTotAsi.CursorType = adOpenDynamic
        rsTotAsi.LockType = adLockOptimistic
        rsTotAsi.CursorLocation = adUseClient
        rsTotAsi.Open "SELECT * FROM ASISTENCIA_TEMP WHERE COD_ENS = '" & Left(Me.cmbTipoEtot.Text, 3) & "' AND NUM_GRA = '" & Me.cmbNiveltot.Text & "' AND LET_CUR = '" & Me.cmbLetratot.Text & "'", conn
        Me.msfGTotal.Clear
        Me.msfGTotal.Rows = 1
        Me.msfGTotal.Cols = 9
        Me.msfGTotal.ColWidth(0) = 250
        Me.msfGTotal.ColWidth(1) = 1
        Me.msfGTotal.ColWidth(2) = 4000
        Me.msfGTotal.ColWidth(3) = 1000
        Me.msfGTotal.ColWidth(4) = 1000
        Me.msfGTotal.ColWidth(5) = 1000
        Me.msfGTotal.ColWidth(6) = 1000
        Me.msfGTotal.ColWidth(7) = 1
        Me.msfGTotal.ColWidth(8) = 1
        Me.msfGTotal.TextMatrix(0, 3) = "Ideal"
        Me.msfGTotal.TextMatrix(0, 4) = "Inasistencia"
        Me.msfGTotal.TextMatrix(0, 5) = "Asistencia"
        Me.msfGTotal.TextMatrix(0, 6) = "Porcentaje"
        
        If rsTotAsi.RecordCount > 0 Then
            Edicion = True
            rsTotAsi.Close
            rsTotAsi.Open "SELECT ASI.CI_ALU, AL.NOM_ALU, AL.APE_PAT_ALU, AL.APE_MAT_ALU, MAT.ACTIVO_ALU, MAT.FEC_RETIRO, MAT.FEC_MAT, ASI.ASI_I, ASI.ASI_R, ASI.ASI_P " & _
                            "FROM MATRICULAS MAT, ASISTENCIA_TEMP ASI, POSTULANTES AL, ALU_X_CUR AXC  " & _
                            "WHERE ASI.CI_ALU = MAT.CI_ALU AND ASI.CI_ALU =AL.CI_ALU AND AL.CI_ALU = AXC.CI_ALU AND ASI.COD_ENS = '" & Left(Me.cmbTipoEtot.Text, 3) & "' AND ASI.NUM_GRA = '" & Me.cmbNiveltot.Text & "' AND ASI.LET_CUR = '" & Me.cmbLetratot.Text & "' AND IF(ISNULL(MAT.ANNO_MAT),'2003',ANNO_MAT)='" & Aact & "'  " & _
                            "ORDER BY AXC.FEC_MAT, AL.APE_PAT_ALU, AL.APE_MAT_ALU, AL.NOM_ALU", conn
            While Not rsTotAsi.EOF
                Me.msfGTotal.AddItem rsTotAsi.AbsolutePosition
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 1) = rsTotAsi("CI_ALU")
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 2) = Trim(rsTotAsi("NOM_ALU")) + " " + Trim(rsTotAsi("APE_PAT_ALU")) + " " + rsTotAsi("APE_MAT_ALU")
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 7) = rsTotAsi("ACTIVO_ALU")
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 8) = rsTotAsi("FEC_MAT")
                If rsTotAsi("ACTIVO_ALU") = "NO" Then
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 3) = 0
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 4) = 0
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 5) = 0
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 6) = 0
                Else
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 3) = rsTotAsi("ASI_I") + rsTotAsi("ASI_R")
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 4) = rsTotAsi("ASI_I")
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 5) = rsTotAsi("ASI_R")
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 6) = rsTotAsi("ASI_P")
                End If
                rsTotAsi.MoveNext
            Wend
        Else
            Edicion = False
            rsTotAsi.Close
            rsTotAsi.Open "SELECT AL.CI_ALU, AL.NOM_ALU, AL.APE_PAT_ALU, AL.APE_MAT_ALU, MAT.ACTIVO_ALU, MAT.FEC_RETIRO, MAT.FEC_MAT " & _
                            "FROM POSTULANTES AL, ALU_X_CUR AXC, MATRICULAS MAT " & _
                            "WHERE AL.CI_ALU = AXC.CI_ALU AND AXC.COD_ENS = '" & Left(Me.cmbTipoEtot.Text, 3) & "' AND AXC.NUM_GRA = '" & Me.cmbNiveltot.Text & "' AND AXC.LET_CUR = '" & Me.cmbLetratot.Text & "' AND AL.CI_ALU = MAT.CI_ALU " & _
                            "ORDER BY AXC.FEC_MAT, AL.APE_PAT_ALU, AL.APE_MAT_ALU, AL.NOM_ALU", conn
            While Not rsTotAsi.EOF
                Me.msfGTotal.AddItem rsTotAsi.AbsolutePosition
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 1) = rsTotAsi("CI_ALU")
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 2) = Trim(rsTotAsi("NOM_ALU")) + " " + Trim(rsTotAsi("APE_PAT_ALU")) + " " + rsTotAsi("APE_MAT_ALU")
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 7) = rsTotAsi("ACTIVO_ALU")
                Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 8) = rsTotAsi("FEC_MAT")
                If rsTotAsi("ACTIVO_ALU") = "NO" Then
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 3) = 0
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 4) = 0
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 5) = 0
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 6) = 0
                Else
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 3) = IIf(Me.Text2.Text = "", 1, Me.Text2.Text)
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 4) = 0
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 5) = Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 3)
                    Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 6) = Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 5) * 100 / Me.msfGTotal.TextMatrix(Me.msfGTotal.Rows - 1, 3)
                End If
                rsTotAsi.MoveNext
            Wend
        End If
        Me.msfGTotal.FixedRows = 1
        Me.msfGTotal.FixedCols = 3
        rsTotAsi.Close
        Me.msfGTotal.Visible = True
        Me.cmdTotAsis.Item(0).Enabled = True
    End If
End Sub

Private Sub cmbListaLetras_Click()
    Dim i As Integer
    Dim j As Integer
    Dim p As Integer
    Dim rsCAL As ADODB.Recordset
    Set rsCAL = New ADODB.Recordset
    rsCAL.CursorLocation = adUseClient
    rsCAL.CursorType = adOpenDynamic
    rsCAL.LockType = adLockReadOnly
    rsCAL.Open GeneraConsulta(gesCalendarioCurso, val(Aact), Left(Me.cmbListaModal.Text, 3), Me.cmbListaNiveles.Text, Me.cmbListaLetras.Text, , Left(UCase(Me.cmbListaMeses.Text), 3)), conn
    If Not rsCAL.EOF Then
        rsCAL.MoveFirst
        p = 1
        For i = 0 To 6
            For j = 1 To 6
                Me.gridCalend.Col = i
                Me.gridCalend.Row = j
                If val(Me.gridCalend.Text) <> 0 Then
                    Select Case Mid(rsCAL("DIAS"), val(Me.gridCalend.Text), 1)
                        Case Is = 0
                            Me.gridCalend.CellFontBold = False
                            Me.gridCalend.CellFontItalic = False
                            Me.gridCalend.CellForeColor = &H80000008
                            Me.gridCalend.CellBackColor = &H80000005
                        Case Is = 1
                            Me.gridCalend.CellFontBold = True
                            Me.gridCalend.CellFontItalic = False
                            Me.gridCalend.CellForeColor = &H80000008
                            Me.gridCalend.CellBackColor = &H80000005
                        Case Is = 2
                            Me.gridCalend.CellFontBold = True
                            Me.gridCalend.CellFontItalic = False
                            Me.gridCalend.CellForeColor = &H80000008
                            Me.gridCalend.CellBackColor = &HE0E0E0
                        Case Is = 4
                            Me.gridCalend.CellFontBold = True
                            Me.gridCalend.CellFontItalic = True
                            Me.gridCalend.CellForeColor = &HFF&
                            Me.gridCalend.CellBackColor = &HE0E0E0
                    End Select
                    'Me.gridCalend.CellFontBold = IIf(Mid(rsCAL("DIAS"), Val(Me.gridCalend.Text), 1) >= 1, True, False)
                End If
            Next
        Next
    End If
    rsCAL.Close
    Command7.Enabled = True
End Sub

Private Sub cmbListaMeses_click()
    Dim i As Integer
    Dim nRow As Integer, nCol As Integer
    Dim rsCale As ADODB.Recordset
    Me.optFormaGrilla.Item(0).Enabled = False
    Me.optFormaGrilla.Item(1).Enabled = False
    Me.optFormaGrilla.Item(2).Enabled = False

    Me.grAlumnos.Rows = 57
    Me.grAlumnos.Cols = 43
    Me.grAlumnos.RowHeight(0) = 0
    Me.grAlumnos.FixedRows = 2
    
    For i = 1 To FinMes(MesToNumber(Me.cmbListaMeses.Text), Aact)
        Me.grAlumnos.ColWidth(i + 6) = 400
        Me.grAlumnos.TextMatrix(1, i + 6) = Format(i, "00")
    Next
    Me.grAlumnos.TextMatrix(1, 39) = "Ideal"
    Me.grAlumnos.TextMatrix(1, 40) = "Inasist."
    Me.grAlumnos.TextMatrix(1, 41) = "Asist."
    Me.grAlumnos.ColWidth(42) = 1
    nRow = 2
    nCol = 0
    Me.grAlumnos.ColWidth(nCol) = 1
    Me.grAlumnos.ColWidth(nCol + 1) = 4000
    Me.grAlumnos.ColWidth(nCol + 2) = 1
    Me.grAlumnos.ColWidth(nCol + 3) = 1
    Me.grAlumnos.ColWidth(nCol + 4) = 1
    Me.grAlumnos.ColWidth(nCol + 5) = 1
    Me.grAlumnos.ColWidth(nCol + 6) = 1
    Me.grAlumnos.FixedCols = 6
    Me.grAlumnos.FixedRows = 2
    Me.grAlumnos.ColWidth(42) = 1
    CargaModalMes Me.cmbListaModal, Me.cmbListaMeses.Text, val(Aact)
    LlenaCalendario Me.gridCalend, Me.cmbListaMeses.Text, Aact
    LimpiaGrilla
    Me.cmbListaModal.Enabled = True
    Me.Command7.Enabled = False
End Sub

Private Sub cmbListaModal_Click()
    CargaNivelMes Me.cmbListaNiveles, Left(Me.cmbListaModal.Text, 3), Me.cmbListaMeses.Text, val(Aact)
    Me.cmbListaNiveles.Enabled = True
    Me.cmbListaLetras.Clear
    LimpiaGrilla
    Me.Command7.Enabled = False
End Sub

Private Sub cmbListaNiveles_Click()
    Dim rsGESCOL As ADODB.Recordset
    Set rsGESCOL = New ADODB.Recordset
    rsGESCOL.CursorLocation = adUseClient
    rsGESCOL.LockType = adLockReadOnly
    rsGESCOL.CursorType = adOpenDynamic
    rsGESCOL.Open GeneraConsulta(gesLetraXmes, val(Aact), Left(Me.cmbListaModal.Text, 3), Me.cmbListaNiveles.Text, , , UCase(Left(Me.cmbListaMeses.Text, 3))), conn
    'rsGESCOL.Open "SELECT LET_CUR FROM CAL_X_CUR WHERE COD_ENS ='" & Left(Me.cmbListaModal.Text, 3) & "' AND NUM_GRA = '" & Me.cmbListaNiveles.Text & "' AND MES = '" & UCase(Left(Me.cmbListaMeses.Text, 3)) & "'", conn
    Me.cmbListaLetras.Clear
    Me.ProgBar.MinValue = 0
    Me.ProgBar.MaxValue = rsGESCOL.RecordCount
    Me.ProgBar.ShowProgress 0
    Me.ProgBar.Visible = True
    While Not rsGESCOL.EOF
        Me.ProgBar.ShowProgress rsGESCOL.AbsolutePosition
        Me.cmbListaLetras.AddItem rsGESCOL("LET_CUR")
        rsGESCOL.MoveNext
    Wend
    rsGESCOL.Close
    Me.cmbListaLetras.Enabled = True
    LimpiaGrilla
    Me.ProgBar.Visible = False
    Me.Command7.Enabled = False
End Sub

Private Sub cmbModalidad_Click()
    Dim cNivel As String
    Dim i As Integer
    If Len(Me.cmbModalidad) <> 0 Then
        cNivel = DevuelveCampo("codigos_ensenanza", "des_ens", "num_gra_max", "des_ens = " & "'" & Me.cmbModalidad.Text & "'", conn)
        Me.cmbNivel.Enabled = True
        Me.cmbNivel.Clear
        For i = 1 To val(cNivel)
            Me.cmbNivel.AddItem i
        Next
        Me.cmbNivel.AddItem "<Todos>"
        Me.cmbNivel.Text = Me.cmbNivel.List(Me.cmbNivel.ListCount - 1)
        cmbNivel_Click
    End If
End Sub

Private Sub cmbMuestraMes_Click()
    Dim Consulta As String
    Dim cDiasMes As String
    Dim i As Integer
    Dim nDiaIni As Integer
    Dim nDiaMes As Integer
    Dim sCodEnse As String
    Edicion = False
    LimpiaCalendario Me
    sCodEnse = RegresaCodigo(Me.cmbModalidad.Text, "cod_ens", "des_ens", "codigos_ensenanza")
    Consulta = GeneraConsulta(gesCalendarioCurso, Anno, sCodEnse, Me.cmbNivel.Text, Me.cmbLetra.Text, , UCase(Left(Me.cmbMuestraMes.List(Me.cmbMuestraMes.ListIndex), 3)))
    'Consulta = "SELECT * FROM CAL_X_CUR where COD_ENS = '" & sCodEnse & "' AND  NUM_GRA = '" & Me.cmbNivel.Text & "' AND LET_CUR = '" & Me.cmbLetra.Text & "' AND MES = '" & UCase(Left(Me.cmbMuestraMes.List(Me.cmbMuestraMes.ListIndex), 3)) & "'"
    rsCale.Open Consulta, conn
    If Not rsCale.EOF Then
        Me.MesCalendario = Me.cmbMuestraMes.List(Me.cmbMuestraMes.ListIndex)
        VerFormMes Me.cmbMuestraMes.ListIndex + 1, Aact, Me, 31
        cDiasMes = rsCale("dias")
        For i = 0 To Me.Check1.count - 1
            If Me.Check1.Item(i).Visible Then
                nDiaIni = i
                Exit For
            End If
        Next
        nDiaMes = nDiaIni
        For i = 1 To Len(cDiasMes)
            Me.Check1.Item(nDiaMes).Value = IIf(val(Mid(cDiasMes, i, 1)) > 0, 1, 0)
            nDiaMes = nDiaMes + 1
        Next
        Edicion = True
    Else
        Me.MesCalendario = Me.cmbMuestraMes.List(Me.cmbMuestraMes.ListIndex)
        VerFormMes Me.cmbMuestraMes.ListIndex + 1, Aact, Me, 31
        Me.fraCalendario.Visible = True
        Edicion = False
    End If
    rsCale.Close
    Me.Command3.Item(0).Enabled = True
End Sub

Private Sub cmbNiveltot_Click()
    Dim rsGESCOL As ADODB.Recordset
    Set rsGESCOL = New ADODB.Recordset
    rsGESCOL.CursorLocation = adUseClient
    rsGESCOL.LockType = adLockReadOnly
    rsGESCOL.CursorType = adOpenDynamic
    rsGESCOL.Open "SELECT LET_CUR FROM CURSOS WHERE COD_ENS ='" & Left(Me.cmbTipoEtot, 3) & "' AND NUM_GRA = '" & Me.cmbNiveltot.Text & "'", conn
    Me.cmbLetratot.Clear
    Load Form_Progress
    Form_Progress.ProgBar1.MaxValue = rsGESCOL.RecordCount
    Form_Progress.ProgBar1.MaxValue = 0
    Form_Progress.ProgBar1.ShowProgress 0
    Form_Progress.Show
    While Not rsGESCOL.EOF
        Form_Progress.ProgBar1.ShowProgress rsGESCOL.AbsolutePosition
        Form_Progress.Refresh
        Me.cmbLetratot.AddItem rsGESCOL("LET_CUR")
        rsGESCOL.MoveNext
    Wend
    rsGESCOL.Close
    Me.cmbLetratot.Enabled = True
    Me.msfGTotal.Visible = False
    Unload Form_Progress
End Sub


'Private Sub cmbSelDia_Click()
'    Dim nDia As Integer
'    Dim i As Integer
'    Dim j As Integer
'    Dim Dia As String
'    If Len(Me.cmbListaNiveles.Text) > 0 And Len(Me.cmbListaLetras.Text) > 0 Then
'        Select Case Me.grAlumnos.TextMatrix(0, Val(Right(Me.cmbSelDia.Text, 2)) + 7)
'            Case Is = 0
'                MsgBox "Este no es un dia de trabajo para este curso" + vbCrLf + "Seleccione otro día", vbOKOnly, "Dia no Valido..."
'                For i = 7 To 38
'                    Me.grAlumnos.ColWidth(i) = 1
'                Next
'                Exit Sub
'            Case Is = 2
'                MsgBox "Este día ya fue revisado y no puede ser modificado", vbOKOnly, "Dia Terminado"
'        End Select
'    End If
'    If UCase(Me.cmbSelDia.Text) = "TODOS" Then
'        For i = 7 To 38
'            Me.grAlumnos.ColWidth(i) = 400
'        Next
'    Else
'        Dia = Right(Me.cmbSelDia, 2)
'        For i = 7 To 38
'            If Me.grAlumnos.TextMatrix(1, i) = Dia Then
'                Me.grAlumnos.ColWidth(i) = 400
'            Else
'                Me.grAlumnos.ColWidth(i) = 1
'            End If
'        Next
'    End If
'    Me.cmbListaModal.Enabled = True
'End Sub

Private Sub cmbTipoEtot_Click()
    Dim rsGESCOL As ADODB.Recordset
    Set rsGESCOL = New ADODB.Recordset
    Me.cmbNiveltot.Enabled = True
    Me.cmbLetratot.Enabled = False
    Me.msfGTotal.Visible = False
    rsGESCOL.LockType = adLockReadOnly
    rsGESCOL.CursorLocation = adUseClient
    rsGESCOL.CursorType = adOpenDynamic
    rsGESCOL.Open "SELECT DISTINCT NUM_GRA FROM CURSOS WHERE COD_ENS = '" & Left(Me.cmbTipoEtot, 3) & "'", conn
    Me.cmbNiveltot.Clear
    Load Form_Progress
    Form_Progress.ProgBar1.MinValue = 0
    Form_Progress.ProgBar1.MaxValue = rsGESCOL.RecordCount
    Form_Progress.Show
    While Not rsGESCOL.EOF
        Form_Progress.ProgBar1.ShowProgress rsGESCOL.AbsolutePosition
        Form_Progress.Refresh
        Me.cmbNiveltot.AddItem rsGESCOL("NUM_GRA")
        rsGESCOL.MoveNext
    Wend
    rsGESCOL.Close
    Unload Form_Progress
End Sub

Private Sub cmdFull_Click()
    Dim PosFinal As Long
    Dim PosBot As Long
    Dim PosAct As Long
    If Me.cmdFull.Caption = "<" Then
        PosFinal = Me.frmFormaLista.Left - 5
        PosAct = Me.cmdFull.Left
        'For PosBot = PosAct To PosFinal Step -100
        '    Me.cmdFull.Left = PosBot
        '    Me.grAlumnos.Left = PosBot + Me.cmdFull.Width + 5
        '    Me.grAlumnos.Width = Me.grAlumnos.Width + 100
        '    Me.lblCursoMes.Left = Me.grAlumnos.Left
        '    Me.lblCursoMes.Width = Me.grAlumnos.Width
        'Next
        Me.cmdFull.Left = PosFinal
        Me.grAlumnos.Left = PosFinal + Me.cmdFull.Width + 5
        Me.grAlumnos.Width = Me.fraAsiAlum.Width - (Me.cmdFull.Width + Me.cmdFull.Left + 110)
        Me.lblCursoMes.Width = Me.grAlumnos.Width
        Me.lblCursoMes.Left = Me.grAlumnos.Left
        Me.cmdFull.Caption = ">"
    Else
        PosFinal = Me.frmFormaLista.Width + Me.cmdFull.Width + 10
        PosAct = Me.cmdFull.Left
        'For PosBot = PosAct To PosFinal Step 100
            Me.cmdFull.Left = PosFinal
            Me.grAlumnos.Left = PosFinal + Me.cmdFull
            Me.grAlumnos.Width = Me.fraAsiAlum.Width - (PosFinal + Me.cmdFull.Width)
            Me.lblCursoMes.Left = Me.grAlumnos.Left
            Me.lblCursoMes.Width = Me.grAlumnos.Width
        'Next
        Me.cmdFull.Caption = "<"
    End If
    Me.grAlumnos.SetFocus
    Me.Refresh
End Sub

Private Sub cmdTotAsis_Click(Index As Integer)
    Dim rsGuarda As ADODB.Recordset
    Dim ctaRow As Integer
    
    Select Case Index
        
        Case Is = 0
            
            If Me.msfGTotal.Visible Then
                If Edicion Then
                    For ctaRow = 1 To Me.msfGTotal.Rows - 1
                        conn.Execute "UPDATE asistencia_temp  " & _
                        "SET ASI_P='" & IIf(Me.msfGTotal.TextMatrix(ctaRow, 6) > 0, Me.msfGTotal.TextMatrix(ctaRow, 6), 0) & "', ASI_I='" & Me.msfGTotal.TextMatrix(ctaRow, 4) & "', ASI_R='" & Me.msfGTotal.TextMatrix(ctaRow, 5) & "' " & _
                        "WHERE CI_ALU='" & Me.msfGTotal.TextMatrix(ctaRow, 1) & "' AND COD_ENS='" & Left(Me.cmbTipoEtot, 3) & "' AND NUM_GRA='" & Me.cmbNiveltot & "' AND LET_CUR='" & Me.cmbLetratot & "' "
                    Next
                Else
                    Set rsGuarda = New ADODB.Recordset
                    rsGuarda.CursorType = adOpenStatic
                    rsGuarda.CursorLocation = adUseClient
                    rsGuarda.LockType = adLockOptimistic
                    rsGuarda.Open "SELECT * FROM ASISTENCIA_TEMP", conn
                    For ctaRow = 1 To Me.msfGTotal.Rows - 1
                        rsGuarda.AddNew
                        rsGuarda("CI_ALU") = Me.msfGTotal.TextMatrix(ctaRow, 1)
                        rsGuarda("ACTIVO_ALU") = Me.msfGTotal.TextMatrix(ctaRow, 7)
                        rsGuarda("COD_ENS") = Left(Me.cmbTipoEtot, 3)
                        rsGuarda("NUM_GRA") = Me.cmbNiveltot
                        rsGuarda("LET_CUR") = Me.cmbLetratot
                        rsGuarda("FEC_MAT") = Me.msfGTotal.TextMatrix(ctaRow, 8)
                        rsGuarda("ASI_I") = IIf(Len(Me.msfGTotal.TextMatrix(ctaRow, 4)) > 0, Me.msfGTotal.TextMatrix(ctaRow, 4), 0)
                        rsGuarda("ASI_R") = IIf(Len(Me.msfGTotal.TextMatrix(ctaRow, 5)) > 0, Me.msfGTotal.TextMatrix(ctaRow, 5), 0)
                        rsGuarda("ASI_P") = IIf(Len(Me.msfGTotal.TextMatrix(ctaRow, 6)) > 0, Me.msfGTotal.TextMatrix(ctaRow, 6), 0)
                        rsGuarda.Update
                    Next
                    rsGuarda.Close
                    Close
                End If
            End If
            Me.msfGTotal.Clear
            Me.msfGTotal.Visible = False
            Me.cmbLetratot.Text = ""
            Me.cmbNiveltot.SetFocus
            
        Case Is = 1
        
            Unload Me
    
    End Select
End Sub

Private Sub cmdVer_Click()
    Me.Height = Me.fraEscogeModal.Height + Me.fraCalendario.Height + 630
    Me.fraCalendario.Visible = True
    LimpiaCalendario Me
    Me.fraCalendario.Left = 80
    Me.fraCalendario.Top = 1700
    Me.cmbMuestraMes.Text = ""
    Me.cmbMuestraMes.Clear
    Me.cmbMuestraMes.AddItem "Enero"
    Me.cmbMuestraMes.AddItem "Febrero"
    Me.cmbMuestraMes.AddItem "Marzo"
    Me.cmbMuestraMes.AddItem "Abril"
    Me.cmbMuestraMes.AddItem "Mayo"
    Me.cmbMuestraMes.AddItem "Junio"
    Me.cmbMuestraMes.AddItem "Julio"
    Me.cmbMuestraMes.AddItem "Agosto"
    Me.cmbMuestraMes.AddItem "Septiembre"
    Me.cmbMuestraMes.AddItem "Octubre"
    Me.cmbMuestraMes.AddItem "Noviembre"
    Me.cmbMuestraMes.AddItem "Diciembre"
    Me.cmdVer.Enabled = False
    Me.cmbNivel.Enabled = False
    Me.cmbLetra.Enabled = False
    Me.cmbModalidad.Enabled = False
    Me.Command3.Item(0).Enabled = False
    CentrarForma Me
    Form_asistencia.Height = 6550
End Sub

Private Sub cmbLetra_Click()
    Me.cmdVer.Enabled = True
End Sub

Private Sub cmbNivel_Change()
    If Me.cmbNivel = "<Todos>" Then
        Me.cmbLetra.Enabled = False
    End If
End Sub

Private Sub cmbNivel_Click()
    CodModalidad = DevuelveCampo("codigos_ensenanza", "", "cod_ens", "des_ens = '" & Me.cmbModalidad.Text & "'", conn)
    If Me.cmbNivel.Text = "<Todos>" Then
        Me.cmbLetra.Clear
        Me.cmbLetra.AddItem "<Todos>"
        Me.cmbLetra.Enabled = True
    Else
        nGrado = Me.cmbNivel.Text
        Me.cmbLetra.Clear
        LlenaCombo Me.cmbLetra, "cursos", "let_cur", "where cod_ens = '" & CodModalidad & "' and num_gra = '" & nGrado & "' and agno = " & Anno, conn
        Me.cmbLetra.AddItem "<Todos>"
        Me.cmbLetra.Enabled = True
    End If
End Sub


Private Sub Command2_Click()
    Dim frmTotal As Form_asistencia
    Dim rsTipoE As ADODB.Recordset
    Set frmTotal = New Form_asistencia
    Set rsTipoE = New ADODB.Recordset
    rsTipoE.CursorType = adOpenDynamic
    rsTipoE.CursorLocation = adUseClient
    rsTipoE.LockType = adLockReadOnly
    Load frmTotal
    frmTotal.Width = frmTotal.fraTotalAsistencia.Width + 150
    frmTotal.fraTotalAsistencia.Enabled = True
    frmTotal.fraTotalAsistencia.Visible = True
    frmTotal.Height = frmTotal.fraTotalAsistencia.Height + 250
    frmTotal.fraTotalAsistencia.Top = 0
    frmTotal.fraTotalAsistencia.Left = 0
    frmTotal.cmbTipoEtot.Enabled = True
    frmTotal.cmbNiveltot.Enabled = False
    frmTotal.cmbLetratot.Enabled = False
    frmTotal.cmbTipoEtot.Text = ""
    frmTotal.cmbNiveltot.Text = ""
    frmTotal.cmbLetratot.Text = ""
    frmTotal.Show
    rsTipoE.Open "SELECT COD_ENS, DES_ENS FROM CODIGOS_ENSENANZA ORDER BY ORD_ENS", conn
    frmTotal.cmbTipoEtot.Clear
    frmTotal.msfGTotal.Visible = False
    While Not rsTipoE.EOF
        frmTotal.cmbTipoEtot.AddItem rsTipoE("COD_ENS") & " - " & rsTipoE("DES_ENS")
        rsTipoE.MoveNext
    Wend
    rsTipoE.Close
    frmTotal.cmdTotAsis.Item(0).Caption = "&Aceptar"
    frmTotal.cmdTotAsis.Item(1).Caption = "&Cancelar"
End Sub

Private Sub Command3_Click(Index As Integer)
    Select Case Index
        Case Is = 0
            GuardaCalendario
            Unload Me
        Case Is = 1
            Unload Me
    End Select
    Me.cmdVer.Enabled = True
    Me.cmbNivel.Enabled = True
    Me.cmbLetra.Enabled = True
    Me.cmbModalidad.Enabled = True
End Sub

Private Sub Command4_Click()
    If Len(Me.cmbListaMeses.Text) > 0 Then
        If Len(Me.cmbListaModal.Text) > 0 Then
            If Len(Me.cmbListaNiveles.Text) > 0 Then
                If Len(Me.cmbListaLetras.Text) > 0 Then
                    If Me.cmb_agno.Text = Anno Then
                        GuardaAsistencia
                    End If
                End If
            End If
        End If
    Else
        Unload Me
    End If
End Sub

Private Sub Command5_Click()
    Unload Me
End Sub


Private Sub Command7_Click()
'var polette
cosa = 1

    Dim Nomina As String
    Dim rsNomina As ADODB.Recordset
    Dim rsDatos As ADODB.Recordset
    Dim rsCale As ADODB.Recordset
    Dim strModal As String
    Dim strGrado As String
    Dim strLetra As String
    Dim nCol As Integer, nRow As Integer
    Dim i As Integer, nDia As Integer, j As Integer, strAsiDia As String
    Dim nCtaL As Integer
    Dim Criterio As String
    strModal = Left(Me.cmbListaModal.Text, 3)
    strGrado = Me.cmbListaNiveles
    strLetra = Me.cmbListaLetras
    LimpiaGrilla
    Me.fraLeyendo.Visible = True
    Me.lblLeyendo.Visible = True
    Me.lblLeyendo.Caption = "Cargando ... " & vbCrLf & strModal & " - " & strGrado & " - " & strLetra
    '
    ' Preparo el calendario del curso
    '
    Me.grAlumnos.Visible = False
    Set rsCale = New ADODB.Recordset
    rsCale.LockType = adLockReadOnly
    rsCale.CursorType = adOpenDynamic
    rsCale.CursorLocation = adUseClient
    rsCale.Open GeneraConsulta(gesCalendarioCurso, val(Aact), strModal, strGrado, strLetra, , UCase(Left(Me.cmbListaMeses.Text, 3))), conn
    If Not rsCale.EOF Then
        rsCale.MoveLast
        rsCale.MoveFirst
    End If
    While Not rsCale.EOF
        j = 7
        For i = 1 To 31
            Me.grAlumnos.TextMatrix(0, j) = Mid(rsCale("DIAS"), i, 1)
            j = j + 1
        Next
        rsCale.MoveNext
    Wend
    rsCale.Close
    '
    'Cargo la Nomina del curso
    '
    Set rsDatos = New ADODB.Recordset
    rsDatos.LockType = adLockReadOnly
    rsDatos.CursorType = adOpenDynamic
    rsDatos.CursorLocation = adUseClient
    Nomina = GeneraConsulta(gesCartola, val(Aact), strModal, strGrado, strLetra, "")
    
    Set rsNomina = New ADODB.Recordset
    rsNomina.LockType = adLockReadOnly
    rsNomina.CursorLocation = adUseClient
    rsNomina.CursorType = adOpenDynamic
    rsNomina.Open Nomina, conn
    If Not rsNomina.RecordCount > 0 Then
        MsgBox "El Curso que selecciono NO tiene alumnos", vbExclamation + vbOKOnly, "Curso sin alumnos..."
        rsNomina.Close
    Else
        rsNomina.MoveFirst
        nRow = 2
        nCol = 0
        Me.grAlumnos.ColWidth(nCol + 1) = 4000
        
        Me.grAlumnos.ColWidth(39) = 800
        Me.grAlumnos.ColWidth(40) = 800
        Me.grAlumnos.ColWidth(41) = 800
        nCtaL = 1
        Me.ProgBar.MinValue = 0
        Me.ProgBar.MaxValue = rsNomina.RecordCount
        Me.ProgBar.ShowProgress 0
        Me.ProgBar.Visible = True
        While Not rsNomina.EOF
            Me.grAlumnos.AddItem rsNomina("ci_alu")
            Me.grAlumnos.TextMatrix(nRow, nCol + 1) = Format(nCtaL, "00") + " " + Trim(rsNomina("APE_PAT_ALU")) + " " + Trim(rsNomina("APE_MAT_ALU")) + " " + Trim(rsNomina("NOM_ALU"))
            Me.grAlumnos.ColAlignment(nCol + 1) = 1
            Me.grAlumnos.ColAlignmentFixed(nCol + 1) = 1
            Me.grAlumnos.TextMatrix(nRow, nCol + 2) = rsNomina("SEX_ALU")
            Me.grAlumnos.TextMatrix(nRow, nCol + 3) = IIf(IsNull(rsNomina("FEC_MAT")), "11/11/1111", rsNomina("FEC_MAT"))
            Me.grAlumnos.TextMatrix(nRow, nCol + 4) = IIf(IsNull(rsNomina("FEC_RETIRO")), "11/11/1111", rsNomina("FEC_RETIRO"))
            Me.grAlumnos.TextMatrix(nRow, nCol + 5) = IIf(IsNull(rsNomina("FEC_CAM")), "11/11/1111", rsNomina("FEC_CAM"))
            Me.grAlumnos.TextMatrix(nRow, nCol + 6) = IIf(IsNull(rsNomina("ACTIVO_ALU")), "11/11/1111", rsNomina("ACTIVO_ALU"))
            Me.grAlumnos.TextMatrix(nRow, 42) = IIf(IsNull(rsNomina("FEC_ING_CURSO")), "11/11/1111", rsNomina("FEC_ING_CURSO"))
            nRow = nRow + 1
            nCtaL = nCtaL + 1
            Me.ProgBar.ShowProgress rsNomina.AbsolutePosition
            rsNomina.MoveNext
        Wend
        rsNomina.Close
        For j = 7 To 37
            Me.grAlumnos.ColAlignment(j) = 5
        Next
        Me.ProgBar.Visible = False
        Me.grAlumnos.Rows = nRow + 4
        Me.grAlumnos.TextMatrix(nRow + 1, 1) = "Asistencias"
        Me.grAlumnos.TextMatrix(nRow + 2, 1) = "Inasistencias"
        Me.grAlumnos.TextMatrix(nRow + 3, 1) = "Matrícula"
        Me.grAlumnos.FixedCols = 7
        Me.grAlumnos.FixedRows = 2
        
        nCol = 0
        Me.grAlumnos.ColWidth(nCol) = 1
        Me.grAlumnos.ColWidth(nCol + 2) = 1
        Me.grAlumnos.ColWidth(nCol + 3) = 1
        Me.grAlumnos.ColWidth(nCol + 4) = 1
        Me.grAlumnos.ColWidth(nCol + 5) = 1
        Me.grAlumnos.ColWidth(nCol + 6) = 1
        Me.grAlumnos.ColWidth(38) = 350
        Me.grAlumnos.ColWidth(42) = 1
        '
        'Cargo la asistencia del Curso
        '
        Me.grAlumnos.Enabled = False
        Me.ProgBar.ShowProgress 0
        Me.ProgBar.MaxValue = Me.grAlumnos.Rows - 5
        Me.ProgBar.Visible = True
        For i = 2 To Me.grAlumnos.Rows - 5
            Criterio = "CI_ALU='" & Me.grAlumnos.TextMatrix(i, 0) & "' AND COD_ENS = '" & Left(Me.cmbListaModal.Text, 3) & "' AND NUM_GRA ='" & Me.cmbListaNiveles.Text & "' AND LET_CUR ='" & Me.cmbListaLetras.Text & "' AND FEC_MAT = '" & InvierteFecha(Me.grAlumnos.TextMatrix(i, 3), "R") & "' AND MES_ASIS='" & UCase(Left(Me.cmbListaMeses.Text, 3)) & "' and agno = " & Aact
            rsDatos.Open "SELECT * FROM atrasos WHERE " & Criterio, conn
            While Not rsDatos.EOF
                nDia = 1
                For j = 7 To 37
                    strAsiDia = Mid(rsDatos("ASIS"), nDia, 1)
                    If UCase(strAsiDia) = "C" Then strAsiDia = "Cc"
                    Me.grAlumnos.TextMatrix(i, j) = strAsiDia
                    nDia = nDia + 1
                Next
                rsDatos.MoveNext
            Wend
            rsDatos.Close
            Me.ProgBar.ShowProgress i
        Next
        Me.ProgBar.Visible = False
        Me.grAlumnos.Enabled = True
        '
        'Revisa los Puntos y Fechas de Matricula
        '
        Me.ProgBar.MaxValue = FinMes(MesToNumber(Me.cmbListaMeses.Text), Aact) + 6
        Me.ProgBar.MinValue = 7
        Me.ProgBar.ShowProgress 7
        Me.ProgBar.Visible = True
        For i = 7 To FinMes(MesToNumber(Me.cmbListaMeses.Text), Aact) + 6
            DoEvents
            RevisaPuntos i
            Me.ProgBar.ShowProgress i
        Next
        Me.grAlumnos.Visible = True
        Me.lblCursoMes = "Modalidad: " + Left(Me.cmbListaModal.Text, 3) + "   Nivel: " + Me.cmbListaNiveles + "   Letra: " + Me.cmbListaLetras
        Me.lblCursoMes.Visible = True
        Me.ProgBar.Visible = False
        Me.Command4.Enabled = True
        Me.optFormaGrilla.Item(0).Enabled = True
        Me.optFormaGrilla.Item(1).Enabled = True
        Me.optFormaGrilla.Item(2).Enabled = True
    End If
    Me.lblLeyendo.Visible = False
    Me.fraLeyendo.Visible = False

End Sub

Private Sub Form_Load()
            
    Set rsCale = New ADODB.Recordset
    Set rsAsis = New ADODB.Recordset
    Set rs = New ADODB.Recordset
    Aact = Anno
    'Conecta conn, strServ, strBase, strPass
    Guardado = True
    Me.lblCursoMes = ""
    For i = 2005 To Year(Date)
        cmb_agno.AddItem i
    Next i
End Sub

Private Sub Form_Resize()
    If Me.fraAsiAlum.Enabled And Me.fraAsiAlum.Visible Then
        If Me.WindowState = vbMinimized Then
        Else
            If Me.Height < 2350 Then
                Me.Height = 2350
            End If
            If Me.Width < 6150 Then
                Me.Width = 6150
            End If
            Me.fraAsiAlum.Height = Me.Height - 500
            Me.fraAsiAlum.Width = Me.Width - 200
            Me.grAlumnos.Height = Me.fraAsiAlum.Height - 600
            Me.cmdFull.Height = Me.grAlumnos.Height
            Me.grAlumnos.Width = Me.fraAsiAlum.Width - Me.grAlumnos.Left - 200
            Me.Command4.Top = Me.fraAsiAlum.Height - 1215
            Me.Command5.Top = Me.Command4.Top
            Me.ProgBar.Top = Me.Command4.Top + Me.Command4.Height + 150
        End If
        cmb_agno.Text = Anno
    ElseIf Me.fraTotalAsistencia.Enabled And Me.fraTotalAsistencia.Visible Then
        Me.fraTotalAsistencia.Width = Me.Width - 200
        Me.fraTotalAsistencia.Height = Me.Height - 500
        Me.cmdTotAsis(0).Left = (Me.fraTotalAsistencia.Width / 2) / 2 - ((Me.cmdTotAsis(0).Width / 2))
        Me.cmdTotAsis(1).Left = (Me.fraTotalAsistencia.Width / 2 + (Me.fraTotalAsistencia.Width / 4)) - ((Me.cmdTotAsis(1).Width / 2))
        Me.cmdTotAsis(0).Top = Me.fraTotalAsistencia.Height - Me.cmdTotAsis(0).Height - 150
        Me.cmdTotAsis(1).Top = Me.fraTotalAsistencia.Height - Me.cmdTotAsis(1).Height - 150
    End If
End Sub


Private Sub Form_Unload(Cancel As Integer)
    If Me.Caption = "Asistencia" Then
        'Call menuhabilitado(True)
    End If
    
    'preg polette
If cosa = 1 Then
    
    If MsgBox("¿Desea guardar antes de salir?", vbQuestion + vbYesNo) = vbYes Then
        If Len(Me.cmbListaMeses.Text) > 0 Then
        If Len(Me.cmbListaModal.Text) > 0 Then
            If Len(Me.cmbListaNiveles.Text) > 0 Then
                If Len(Me.cmbListaLetras.Text) > 0 Then
                    If Me.cmb_agno.Text = Anno Then
                        GuardaAsistencia
                    End If
                End If
            End If
        End If
    Else
        Unload Me
    End If
    Else
        Unload Me
    End If

End If

End Sub

Private Sub VerFormMes(Mes As Integer, agno As Integer, Form As Form, diaMes As String)
    Dim Dia As Integer, nDia As Integer
    Dim i As Integer
    Dia = PrimerDia(Mes, Aact)
    nDia = 1
    
    For i = Dia - 1 To Dia + (FinMes(Mes, agno) - 2)
        Form.Check1.Item(i).Caption = nDia
        Form.Check1.Item(i).Visible = True
        Select Case i
            Case Is = 0, 7, 14, 21, 28, 35
                Form.Check1.Item(i).Value = 1
            Case Is = 1, 8, 15, 22, 29, 36
                Form.Check1.Item(i).Value = 1
            Case Is = 2, 9, 16, 23, 30, 37
                Form.Check1.Item(i).Value = 1
            Case Is = 3, 10, 17, 24, 31, 38
                Form.Check1.Item(i).Value = 1
            Case Is = 4, 11, 18, 25, 32, 39
                Form.Check1.Item(i).Value = 1
        End Select
        nDia = nDia + 1
    Next
End Sub

Private Sub LimpiaCalendario(Formulario As Form)
    Formulario.fraCalendario.Enabled = True
    Formulario.Label1.Item(0).Caption = "Lun"
    Formulario.Label1.Item(1).Caption = "Mar"
    Formulario.Label1.Item(2).Caption = "Mie"
    Formulario.Label1.Item(3).Caption = "Jue"
    Formulario.Label1.Item(4).Caption = "Vie"
    Formulario.Label1.Item(5).Caption = "Sab"
    Formulario.Label1.Item(6).Caption = "Dom"
    For i = 0 To Formulario.Check1.count - 1
        Formulario.Check1.Item(i).Visible = False
        Formulario.Check1.Item(i).Caption = ""
        Formulario.Check1.Item(i).Value = 0
    Next
    Text1.Text = 0
End Sub

Private Sub GuardaCalendario()
    Dim log As Variant
    Dim CalendarioLineal As String
    Dim i As Integer
    Dim rsCursos As ADODB.Recordset
    Dim sCodigoNivel As String
    Dim sConsultaCursos As String
    Dim sRecuperaCursos As String
    Dim sMensaje As String
    Dim Botones As Integer
    Dim strConsulta As String
    On Error GoTo ErrorGuardando
    sCodigoNivel = RegresaCodigo(Me.cmbModalidad.Text, "COD_ENS", "DES_ENS", "CODIGOS_ENSENANZA")
    For i = 0 To Me.Check1.count - 1
        If Me.Check1.Item(i).Visible Then
            CalendarioLineal = CalendarioLineal + Format(IIf(Me.Check1.Item(i).Value, 1, 0), "0")
        End If
    Next
    rsCale.CursorType = adOpenDynamic
    rsCale.LockType = adLockOptimistic
    rsCale.Open "CAL_X_CUR", conn, , , adCmdTable
    If UCase(Me.cmbNivel.Text) = "<TODOS>" Then
        sConsultaCursos = ""
        GoSub Todo
    ElseIf UCase(Me.cmbLetra.Text) = "<TODOS>" Then
        sConsultaCursos = " AND NUM_GRA = '" & LTrim(RTrim(Me.cmbNivel.Text)) & "'"
        GoSub Todo
    Else
        If Edicion Then
            conn.Execute "UPDATE cal_x_cur SET DIAS= '" & CalendarioLineal & "' " _
                & " WHERE COD_ENS='" & sCodigoNivel & "' AND NUM_GRA='" & LTrim(RTrim(Me.cmbNivel.Text)) & "' AND LET_CUR='" & LTrim(RTrim(Me.cmbLetra.Text)) & "' AND MES='" & Left(LTrim(RTrim(UCase(Me.MesCalendario))), 3) & "' and agno = " & Anno
                
            'Log de ingreso de asistencia
                                Select Case sCodigoNivel
                                    Case "996"
                                        grado = "PK"
                                    Case "010"
                                        grado = "K"
                                    Case "110"
                                        grado = "EB"
                                    Case "310"
                                        grado = "EM"
                                End Select
    
                                curso = LTrim(RTrim(Me.cmbNivel.Text)) & "º " & LTrim(RTrim(Me.cmbLetra.Text)) & " " & grado
                                accion_realizada = "Se ha modificado los dias inhabiles al curso " & curso _
                                & " para el año " & Anno
                                 
                                log = Inserta_Vitacora_Asistencia(rut_prof, "Modificación de feriados", Trim(accion_realizada))
            'Fin de log
                
                
        Else
            rsCale.AddNew
            rsCale("COD_ENS") = sCodigoNivel
            rsCale("NUM_GRA") = LTrim(RTrim(Me.cmbNivel.Text))
            rsCale("LET_CUR") = LTrim(RTrim(Me.cmbLetra.Text))
            rsCale("MES") = Left(LTrim(RTrim(UCase(Me.MesCalendario))), 3)
            rsCale("DIAS") = CalendarioLineal
            rsCale("AGNO") = Anno
            rsCale.Update
            
                        'Log de ingreso de asistencia
                                Select Case sCodigoNivel
                                    Case "996"
                                        grado = "PK"
                                    Case "010"
                                        grado = "K"
                                    Case "110"
                                        grado = "EB"
                                    Case "310"
                                        grado = "EM"
                                End Select
    
                                curso = LTrim(RTrim(Me.cmbNivel.Text)) & "º " & LTrim(RTrim(Me.cmbLetra.Text)) & " " & grado
                                accion_realizada = "Se ha generado el calendario al curso " & curso _
                                & " para el año " & Anno
                                 
                                log = Inserta_Vitacora_Asistencia(rut_prof, "Ingreso de calendario", Trim(accion_realizada))
                        'Fin de log
            
        End If
    End If
    rsCale.Close
Exit Sub
Todo:
    Set rsCursos = New ADODB.Recordset
    rsCursos.LockType = adLockOptimistic
    rsCursos.CursorType = adOpenDynamic
    sRecuperaCursos = "SELECT * FROM CURSOS WHERE COD_ENS = '" & sCodigoNivel & "' " & sConsultaCursos & " AND agno = " & Anno & " ORDER BY NUM_GRA, LET_CUR"
    conn.BeginTrans
    rsCursos.Open sRecuperaCursos, conn
    Do While Not rsCursos.EOF
        strConsulta = "COD_ENS='" & sCodigoNivel & "' AND NUM_GRA='" & rsCursos("NUM_GRA") & "' AND LET_CUR='" & rsCursos("LET_CUR") & "' AND MES='" & Left(LTrim(RTrim(UCase(Me.MesCalendario))), 3) & "' and agno = " & Anno
        If ExistReg("CAL_X_CUR", strConsulta, conn) Then
            Select Case MsgBox("El calendario de " & rsCursos("NUM_GRA") & " " & rsCursos("LET_CUR") & " para el mes de " & Me.MesCalendario.Caption & " ya existe " & vbCrLf & "¿Desea sobre escribirlo con esta nueva informacion?", vbQuestion + vbYesNoCancel, "Calendario duplicado")
                Case Is = vbYes
                    Select Case MsgBox("Si cambia el calendario de un curso debera ingresar nuvamente la asistencia de este curso", vbQuestion + vbYesNoCancel)
                        Case Is = vbYes
                            conn.Execute "UPDATE CAL_X_CUR SET DIAS='" & CalendarioLineal & "' WHERE " & strConsulta
                            
                            'Log de ingreso de asistencia
                                Select Case sCodigoNivel
                                    Case "996"
                                        grado = "PK"
                                    Case "010"
                                        grado = "K"
                                    Case "110"
                                        grado = "EB"
                                    Case "310"
                                        grado = "EM"
                                End Select
    

    
                                curso = rsCursos("NUM_GRA") & "º " & rsCursos("LET_CUR") & " " & grado
                                accion_realizada = "Se han modificado los dias inhabiles al curso " & curso _
                                & " para el año " & Anno
                                 
                                log = Inserta_Vitacora_Asistencia(rut_prof, "Modificación de feriados", Trim(accion_realizada))
                            'Fin de log
                            
                            
                        Case Is = vbCancel
                            Exit Do
                    End Select
                Case Is = vbNo
                Case Is = vbCancel
                    Exit Do
            End Select
        Else
            rsCale.AddNew
            rsCale("COD_ENS") = sCodigoNivel
            rsCale("NUM_GRA") = rsCursos("NUM_GRA")
            rsCale("LET_CUR") = rsCursos("LET_CUR")
            rsCale("MES") = Left(LTrim(RTrim(UCase(Me.MesCalendario))), 3)
            rsCale("DIAS") = CalendarioLineal
            rsCale("AGNO") = Anno
            rsCale.Update
            'Log de ingreso de asistencia
                                Select Case sCodigoNivel
                                    Case "996"
                                        grado = "PK"
                                    Case "010"
                                        grado = "K"
                                    Case "110"
                                        grado = "EB"
                                    Case "310"
                                        grado = "EM"
                                End Select

    
                                curso = rsCursos("NUM_GRA") & "º " & rsCursos("LET_CUR") & " " & grado
                                accion_realizada = "Se ha definido el calendario al curso " & curso _
                                & " para el año " & Anno
                                 
                                log = Inserta_Vitacora_Asistencia(rut_prof, "Creación de calendario", Trim(accion_realizada))
            'Fin de log
            
            
        End If
        rsCursos.MoveNext
    Loop
    conn.CommitTrans
Return
ErrorGuardando:
    Select Case Err.Number
        Case Is = -2147467259
            sMensaje = "Duplicacion de Informacion"
            Botones = 0
        Case Else
            sMensaje = "Ocurrio un error: " & Err.Number & vbCrLf & "Descripcion :" & Err.Description
            Botones = vbQuestion + vbRetryCancel
    End Select
    If Botones = 0 Then
        Resume Next
    Else
        Select Case MsgBox(sMensaje, Botones, "Falla de Grabacion")
            Case Is = vbRetry
                Resume
            Case Is = vbCancel
                rsCale.CancelUpdate
                Resume Next
        End Select
    End If
Return
End Sub

Private Function RegresaCodigo(TextoBuscado As String, CampoCodigo As String, CampoDescripcion As String, tabla As String)
    Dim sPreg As String
    Dim rsFunci As ADODB.Recordset
    Set rsFunci = New ADODB.Recordset
    rsFunci.LockType = adLockOptimistic
    rsFunci.CursorType = adOpenDynamic
    sPreg = "SELECT " & CampoCodigo & ", " & CampoDescripcion & " FROM " & tabla & " WHERE " & CampoDescripcion & " = '" & TextoBuscado & "'"
    rsFunci.Open sPreg, conn
    If Not rsFunci.EOF Then
        RegresaCodigo = rsFunci(CampoCodigo)
    Else
        RegresaCodigo = "9999"
    End If
    rsFunci.Close
End Function



Private Sub grAlumnos_Click()
    Me.grAlumnos.SetFocus
    Call grAlumnos_KeyPress(32)

End Sub


Private Sub grAlumnos_KeyPress(KeyAscii As Integer)
    Dim Cambios As Boolean
    Dim MaxRow As Integer
    Dim Colum As Integer
    Dim StatusDia As Integer
    MaxRow = Me.grAlumnos.Rows - 3
    Colum = Me.grAlumnos.Col
    If Aact <> Anno Then
        Exit Sub
    End If
    If Me.grAlumnos.Col > 6 And Me.grAlumnos.Col < 39 And Me.grAlumnos.Row < MaxRow Then
        Select Case Me.grAlumnos.CellBackColor
            Case Is = &H80000004
                If MsgBox("Alumno " & Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 1) & " no esta vigente el día seleccionado " & vbCrLf & "¿Desea ver detalle de fechas para este alumno?", vbYesNo + vbDefaultButton2 + vbQuestion) = vbYes Then
                    MsgBox "Alumno " & Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 1) & " no esta vigente el día seleccionado " & vbCrLf & _
                        "Fecha  Matrícula: " & Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 3) & vbCrLf & _
                        "Fecha Inc Curso : " & Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 42) & vbCrLf & _
                        "Fecha de Retiro : " & IIf(Year(Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 4)) = 1111, " Sin Retiro", Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 4)) & vbCrLf & _
                        "Fecha de Cambio : " & IIf(Year(Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 5)) = 1111, " Sin Cambio ", Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 5)), vbOKOnly + vbInformation
                End If
            Case Is = 12648384
                MsgBox "El curso no tiene clases el " & Me.grAlumnos.TextMatrix(1, Me.grAlumnos.Col) & " de " & Me.cmbListaMeses.Text & " de " & Aact
            Case Else
                If Len(Trim(Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, 1))) > 0 Then
                    If val(Me.grAlumnos.TextMatrix(0, Me.grAlumnos.Col)) = 0 Then
                        Cambios = True
                        Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, Me.grAlumnos.Col) = ""
                    ElseIf Me.grAlumnos.TextMatrix(0, Me.grAlumnos.Col) = 1 Then
                        Select Case KeyAscii
                            Case Is = 32
                                Cambios = True
                                Me.grAlumnos.CellBackColor = &HC0C0FF
                                If Me.grAlumnos.Text = "·" Then
                                    Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, Me.grAlumnos.Col) = "X"
                                Else
                                    Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, Me.grAlumnos.Col) = "·"
                                End If
                            Case Is = 120, Is = 88
                                Cambios = True
                                Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, Me.grAlumnos.Col) = "X"
                            Case Is = 183
                                Cambios = True
                                Me.grAlumnos.TextMatrix(Me.grAlumnos.Row, Me.grAlumnos.Col) = "·"
                            Case Else
                                KeyAscii = 0
                        End Select
                    Else
                        MsgBox "Este día no esta disponible para modificaciones," & vbCrLf & "si desea modificarlo comuniquese con la persona encargada de revisar", vbInformation + vbOKOnly, "Dia Cerrado"
                    End If
                End If
        End Select
    End If
    If Cambios Then
        Guardado = False
        CuentaPuntos Me.grAlumnos.Col
        asistencia Me.grAlumnos.Row
    End If
    
End Sub

Private Sub gridCalend_Click()
    Dim i As Integer
    Dim CalDelDia As ADODB.Recordset
    If Me.gridCalend.SelectionMode <> 0 Then
        If val(Me.gridCalend.Text) <> 0 Then
            Set CalDelDia = New ADODB.Recordset
            CalDelDia.CursorLocation = adUseClient
            CalDelDia.CursorType = adOpenDynamic
            CalDelDia.LockType = adLockReadOnly
            'CalDelDia.Open "SELECT * FROM CAL_X_CUR WHERE COD_ENS = '" & Left(Me.cmbListaModal.Text, 3) & "' AND NUM_GRA = '" & Me.cmbListaNiveles.Text & "' AND LET_CUR ='" & Me.cmbListaLetras.Text & "' AND MES = '" & Left(UCase(Me.cmbListaMeses.Text), 3) & "'", conn
            CalDelDia.Open GeneraConsulta(gesCalendarioCurso, Left(Me.cmbListaModal.Text, 3), Me.cmbListaNiveles.Text, Me.cmbListaLetras.Text, , Left(UCase(Me.cmbListaMeses.Text), 3)), conn
            If Not CalDelDia.EOF Then
                CalDelDia.MoveFirst
                If val(Mid(CalDelDia("DIAS"), val(Me.gridCalend.Text), 1)) <> 0 Then
                    For i = 7 To 37
                        If val(Me.grAlumnos.TextMatrix(1, i)) = val(Me.gridCalend.Text) Then
                            Me.grAlumnos.ColWidth(i) = 400
                        Else
                            Me.grAlumnos.ColWidth(i) = 0
                        End If
                    Next
                Else
                    MsgBox "Marcaste el Dia " & Me.gridCalend.Text & " que no es un dia de trabajo ", vbOKOnly + vbExclamation
                End If
            End If
            CalDelDia.Close
        End If
    End If
End Sub

'Private Sub gridCalend_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'    Dim i As Integer
'    Select Case Button
'        Case Is = 2
'            For i = 7 To 37
'                Me.grAlumnos.ColWidth(i) = 350
'            Next
'    End Select
'
'End Sub

Private Sub msfGTotal_KeyPress(KeyAscii As Integer)
    Dim ColM As Integer
    Dim RowM As Integer
    Dim Ideal As Long
    Dim Real As Long
    Dim Porcentaje As Long
    RowM = Me.msfGTotal.Row
    ColM = Me.msfGTotal.Col
    Select Case KeyAscii
        Case 48 To 57
            If Trim(Me.msfGTotal.TextMatrix(RowM, ColM)) = "0" Then
                Me.msfGTotal.TextMatrix(RowM, ColM) = ""
            End If
            Me.msfGTotal.TextMatrix(RowM, ColM) = Me.msfGTotal.TextMatrix(RowM, ColM) + Chr(KeyAscii)
        Case Is = 8
            If Len(Me.msfGTotal.TextMatrix(RowM, ColM)) > 0 Then
                Me.msfGTotal.TextMatrix(RowM, ColM) = Left(Me.msfGTotal.TextMatrix(RowM, ColM), Len(Me.msfGTotal.TextMatrix(RowM, ColM)) - 1)
            End If
    End Select
    Select Case Me.msfGTotal.Col
        Case 3 To 5
            If Me.msfGTotal.TextMatrix(RowM, 3) <> "" Then
                If Me.msfGTotal.TextMatrix(RowM, 4) <> "" Then
                    Real = Me.msfGTotal.TextMatrix(RowM, 3) - Me.msfGTotal.TextMatrix(RowM, 4)
                Else
                    Real = 0
                End If
            Else
                Real = 0
            End If
            If Me.msfGTotal.TextMatrix(RowM, 3) <> "" Then
                Ideal = Me.msfGTotal.TextMatrix(RowM, 3)
            Else
                Ideal = 0
            End If
            If Real <> 0 And Ideal <> 0 Then
                Porcentaje = Int((Real * 100) / Ideal)
                Me.msfGTotal.TextMatrix(RowM, 5) = IIf(Real < 0, 0, Real)
                Me.msfGTotal.TextMatrix(RowM, 6) = IIf(Porcentaje < 0, 0, Porcentaje)
            End If
    End Select
End Sub


Private Sub RevisaPuntos(Columna As Integer)
    Dim i As Integer
    Dim TextCel As String
    Dim Retiro As String
    Dim Ingreso As String
    Dim Cambio As String
    Dim matric As String
    Dim nombre As String
    Dim sexo As String
    Dim IniMes As Date
    Dim FinMes As Date
    Dim hoy As Date
    Dim NuevoValor As String
    Dim Vacio As Boolean
    Me.grAlumnos.Col = Columna
    For i = 2 To Me.grAlumnos.Rows - 5
        
        Me.grAlumnos.Row = i
        nombre = Me.grAlumnos.TextMatrix(i, 1)
        TextCel = Me.grAlumnos.Text
        matric = CDate(Me.grAlumnos.TextMatrix(i, 3))
        Retiro = CDate(Me.grAlumnos.TextMatrix(i, 4))
        Cambio = CDate(Me.grAlumnos.TextMatrix(i, 5))
        Ingreso = CDate(Me.grAlumnos.TextMatrix(i, 42))
        hoy = CDate(Me.grAlumnos.TextMatrix(1, Columna) + "/" + Format(MesToNumber(Me.cmbListaMeses.Text)) + "/" + Format(Aact, "0000"))
        Vacio = IIf(Len(Trim(TextCel)) = 0, True, False)
        
        If Len(Trim(nombre)) > 1 Then
            Select Case val(Me.grAlumnos.TextMatrix(0, Columna))
                Case Is = 0
                    Me.grAlumnos.CellBackColor = &HFFC0C0    '&HC0FFC0
                    Me.grAlumnos.Text = ""
                Case Else
                    If hoy >= matric Then
                        If hoy >= Ingreso Then
                            If Retiro = #11/11/1111# Then
                                If Cambio = #11/11/1111# Then
                                    If Vacio Then
                                        NuevoValor = "·"
                                    End If
                                Else
                                    If Cambio > hoy Then
                                        If Vacio Then
                                            NuevoValor = "·"
                                        End If
                                    Else
                                        Me.grAlumnos.CellBackColor = &H80000004
                                        NuevoValor = "Cc"
                                    End If
                                End If
                            Else
                                If Retiro > hoy Then
                                    If Vacio Then
                                        NuevoValor = "·"
                                    End If
                                Else
                                    Me.grAlumnos.CellBackColor = &H80000004
                                    NuevoValor = "R"
                                End If
                            End If
                        Else
                            Me.grAlumnos.CellBackColor = &H80000004
                            NuevoValor = "_"
                        End If
                    Else
                        Me.grAlumnos.CellBackColor = &H80000004
                        NuevoValor = "_"
                    End If
            End Select
        End If
        If Len(Trim(NuevoValor)) > 0 Then
            Select Case NuevoValor
                Case Is = "_"
                    Me.grAlumnos.Text = " "
                Case Else
                    Me.grAlumnos.Text = NuevoValor
            End Select
            NuevoValor = ""
        End If
        asistencia i
    Next
    CuentaPuntos Columna
End Sub
        
Private Function CuentaPuntos(Columna As Integer)
    Dim Tot_X As Integer
    Dim Tot_P As Integer
    Dim Total As Integer
    Dim Celda As String
    Dim i As Integer
    If val(Me.grAlumnos.TextMatrix(0, Columna)) = 0 Then
        Me.grAlumnos.TextMatrix(Me.grAlumnos.Rows - 3, Columna) = ""
        Me.grAlumnos.TextMatrix(Me.grAlumnos.Rows - 2, Columna) = ""
        Me.grAlumnos.TextMatrix(Me.grAlumnos.Rows - 1, Columna) = ""
    Else
        Tot_X = 0
        Tot_P = 0
        For i = 2 To Me.grAlumnos.Rows - 3
            Celda = Me.grAlumnos.TextMatrix(i, Columna)
            Select Case Celda
                Case Is = "X"
                    Tot_X = Tot_X + 1
                Case Is = "·"
                    Tot_P = Tot_P + 1
            End Select
        Next
        Me.grAlumnos.TextMatrix(Me.grAlumnos.Rows - 3, Columna) = Tot_P
        Me.grAlumnos.TextMatrix(Me.grAlumnos.Rows - 2, Columna) = Tot_X
        Me.grAlumnos.TextMatrix(Me.grAlumnos.Rows - 1, Columna) = Tot_X + Tot_P
    End If
End Function

Private Sub asistencia(linea As Integer)
    Dim Asis As Integer
    Dim Ideal As Integer
    Dim Real As Integer
    Dim Falto As Integer
    Dim i As Integer
    Dim Celda As String
    If Len(Trim(Me.grAlumnos.TextMatrix(linea, 0))) > 0 Then
        For i = 7 To 37
            Celda = Me.grAlumnos.TextMatrix(linea, i)
            If Celda = "X" Then
                Falto = Falto + 1
            ElseIf Celda = "·" Then
                Asis = Asis + 1
            End If
        Next
        Ideal = Asis + Falto
        Me.grAlumnos.TextMatrix(linea, 39) = Ideal
        Me.grAlumnos.TextMatrix(linea, 40) = Falto
        Me.grAlumnos.TextMatrix(linea, 41) = Asis
    Else
        Me.grAlumnos.TextMatrix(linea, 39) = ""
        Me.grAlumnos.TextMatrix(linea, 40) = ""
        Me.grAlumnos.TextMatrix(linea, 41) = ""
    End If
End Sub

Private Sub LimpiaGrilla()
    Dim lgMensaje As String
    Dim lgTitulo As String
    Dim lgBotones As Integer
    If Not Guardado And Aact = Anno Then
        lgMensaje = "La informacion se modifico y no se ha guardado" & vbCrLf & "¿Desea hacerlo ahora?"
        lgTitulo = "No Guardado"
        lgBotones = vbYesNo + vbDefaultButton2 + vbQuestion
        If MsgBox(lgMensaje, lgBotones, lgTitulo) = vbYes Then
            
        End If
        Guardado = True
    End If
    Me.grAlumnos.FixedRows = 1
    Me.grAlumnos.Rows = 2
    Me.lblCursoMes.Caption = ""
End Sub

Private Sub Grid_Print(grid As Control)
    Dim tppx As Integer
    Dim tppy As Integer
    Printer.FontSize = 8
    tppx = Printer.TwipsPerPixelX
    tppy = Printer.TwipsPerPixelY
    Dim Col As Integer
    Dim Row As Integer
    Dim x0 As Single
    Dim y0 As Single
    Dim x1 As Single
    Dim y1  As Single
    Dim x2  As Single
    Dim y2  As Single
    x0 = Printer.CurrentX
    y0 = Printer.CurrentY
    x1 = x0
    For Col = 0 To grid.Cols - 1
        If grid.ColWidth(Col) <> 0 Then
            y1 = y0
            For Row = 0 To grid.Rows - 1
            
                Printer.CurrentX = x1 + tppx * 2
                Printer.CurrentY = y1 + tppy
                grid.Col = Col
                grid.Row = Row
                Printer.Print grid.Text
                y1 = y1 + grid.RowHeight(Row)
                If grid.Gridlines Then
                    y1 = y1 + tppy
                End If
            
            Next
            x1 = x1 + grid.ColWidth(Col)
            If grid.Gridlines Then
                x1 = x1 + tppx
            End If
        End If
    Next
    If grid.Gridlines Then
        x2 = x0
        y2 = y0
        For Col = 0 To grid.Cols - 1
            If Col >= grid.FixedCols And Col < grid.LeftCol Then
                Col = grid.LeftCol
            End If
            x2 = x2 + grid.ColWidth(Col)
            If x2 >= grid.Width Then Exit For
            If grid.ColWidth(Col) > 1 Then Printer.Line (x2, y0)-Step(0, y1 - tppy)
            x2 = x2 + tppx
        Next
        For Row = 0 To grid.Rows - 1
            If Row >= grid.FixedRows And Row < grid.TopRow Then
                Row = grid.TopRow
            End If
            y2 = y2 + grid.RowHeight(Row)
            If y2 >= grid.Height Then Exit For
            Printer.Line (x0, y2)-Step(x1 - tppx, 0)
            y2 = y2 + tppy
        Next
    End If
    MsgBox "OK"
    Printer.EndDoc
End Sub

Private Sub optFormaGrilla_Click(Index As Integer)
    Select Case Index
        Case Is = 0
            Me.gridCalend.SelectionMode = flexSelectionFree
        Case Is = 1
            Me.grAlumnos.SelectionMode = flexSelectionByRow
        Case Is = 2
            Me.grAlumnos.SelectionMode = flexSelectionFree
    End Select
End Sub
