199
Universidad Técnica de Manabí Facultad de Ciencias Informáticas TESIS DE GRADO Previa a la Obtención del Título de: ANALISTA EN SISTEMASTEMA: DESARROLLO DE UN SISTEMA INFORMATICO ADMINISTRATIVO PARA LA ESCUELA FISCAL MIXTA “21 DE MAYO” DEL CANTÓN PORTOVIEJO, PROVINCIA DE MANABÍ”. AUTORAS: Ligia Elena Escobar Domínguez. Maryuri Johana Solórzano Tuàrez. DIRECTORA DE TESIS Ing. Maricela Pinargote Portoviejo - Manabí - Ecuador 2010

Tesis Sistema Informatico de La Escuela 21 de Mayo

Embed Size (px)

Citation preview

Page 1: Tesis Sistema Informatico de La Escuela 21 de Mayo

Universidad Técnica de Manabí Facultad de Ciencias Informáticas

TESIS DE GRADO

Previa a la Obtención del Título de:

“ANALISTA EN SISTEMAS”

TEMA:

“DESARROLLO DE UN SISTEMA INFORMATICO ADMINISTRATIVO

PARA LA ESCUELA FISCAL MIXTA “21 DE MAYO” DEL CANTÓN

PORTOVIEJO, PROVINCIA DE MANABÍ”.

AUTORAS:

Ligia Elena Escobar Domínguez.

Maryuri Johana Solórzano Tuàrez.

DIRECTORA DE TESIS

Ing. Maricela Pinargote

Portoviejo - Manabí - Ecuador

2010

Page 2: Tesis Sistema Informatico de La Escuela 21 de Mayo

CERTIFICACION

Ing. Maricela Pinargote, certifica que la presente tesis ha sido elaborada por las

Srta. Ligia Elena Escobar Domínguez y Maryuri Johana Solórzano Tuárez, bajo

mi dirección, control y seguimiento. El presente trabajo reúne los requisitos de

una investigación y programación concluida mediante el esfuerzo, dedicación y

constancia, tanto en parte teorice, investigativa y practica, lo que permite otorgar

su originalidad.

Para constancia y validez, firmo el documento.

Atentamente,

Maricela Pinargote

DIRECTORA DE TESIS

Page 3: Tesis Sistema Informatico de La Escuela 21 de Mayo

UNIVERSIDAD TÉCNICA DE MANABÍ

FACULTAD DE CIENCIAS INFORMÁTICAS

ESCUELA DE COMPUTACIÓN

TEMA:

“DESARROLLO DE UN SISTEMA INFORMÁTICO ADMINISTRATIVO

PARA LA ESCUELA FISCAL MIXTA “21 DE MAYO” DEL CANTÓN

PORTOVIEJO, PROVINCIA DE MANABÍ”.

TESIS DE GRADO

Sometida a consideración de los Miembros del Tribunal de Revisión y

Sustentación, legalizada por el Honorable Consejo Directivo como requisito

previo a la obtención del título de: ANALISTA EN SISTEMAS aprobado por:

DIRECTORA DE TESIS ____________________

Ing. Maricela Pinargote

PRESIDENTE DEL TRIBUNAL ____________________

Ing. Lenin Rivera

DOCENTE DE AREA _________________

Ing. Javier Cuzco

DOCENTE MIEMBRO DE COMISION _________________

Ing. Jimmy Zambrano

Page 4: Tesis Sistema Informatico de La Escuela 21 de Mayo

DERECHO DEL AUTOR

Las presentes: Ligia Elena Escobar Domínguez y Maryuri Johana Solórzano

Tuarez, declararan que la tesis es de total creación de las antes mencionadas;

teniendo como directora de tesis a la Ing. Maricela Pinargote.

Este proyecto está protegido por las Leyes del Autor y otros Tratados

Internacionales. La reproducción o distribución no autorizadas de este trabajo o de

cualquier parte del mismo, pueden dar lugar a responsabilidades civiles y penales

que serán perseguidas por las autoridades competentes.

Su análisis, diseño y codificación son de exclusividad de los autores.

Para constancia firman.

____________________ ____________________ Ligia Escobar Domínguez Maryuri Solórzano Tuarez

AUTORA AUTORA

Page 5: Tesis Sistema Informatico de La Escuela 21 de Mayo

AGRADECIMIENTO

Agradezco primeramente a Dios por hacer posible el sueño que toda

estudiante anhela en la vida: ser una Profesional.

A mis queridos profesores quienes con sus conocimientos y

enseñanzas me inculcaron todos los valores morales, éticos y

profesionales los cuales los pondré en práctica durante toda mi vida.

A la Ing. Maricela Pinargote, mi Directora de Tesis, quien ha sido

parte fundamental de este proyecto guiándome en los análisis y

comentarios suscitados en el transcurso de la misma.

Así mismo a todas las personas que han colocado su granito de arena

colaborando de la manera más humilde y desinteresada que me han

llevado a obtener un gran éxito.

LIGIA ESCOBAR DOMÍNGUEZ

Page 6: Tesis Sistema Informatico de La Escuela 21 de Mayo

AGRADECIMIENTO

Con especial afecto agradezco a los directivos de esta importante

Institución Educativa como es la Universidad Técnica de Manabí

como son la Ing. Maricela Pinargote, Ing. Lenin Rivera, Ing. Javier

Cusco y Ing. Jimmy Zambrano, por su confianza y apoyo para la

culminación de esta etapa importante de mi vida.

A mi madre que me inculcó valores de responsabilidad y dedicación

hacia la superación y el esfuerzo continuo para cumplir toda meta

anhelada.

Muchas gracias.

MARYURI SOLÓRZANO TUAREZ

Page 7: Tesis Sistema Informatico de La Escuela 21 de Mayo

DEDICATORIA

A Dios por ser él quien me ha iluminado desde el cielo despejando

cualquier duda y regalándome un poquito de sabiduría para poder

terminar con éxito este proyecto.

A mis padres Sr. Jorge Escobar y Sra. Jacqueline Domínguez, quienes

con esfuerzo y sacrificio han sabido compartir mis momentos más

difíciles dándome el apoyo incondicional en todos los aspectos.

A mi hija Camila Sánchez quien es mi fuente de inspiración y mi

motivo de seguir siempre adelante.

A mis hermanos Jacqueline, Jorge Luis y Kassandra quienes me

brindan toda la confianza para poder seguir adelante.

A mí querido esposo por su motivación y su apoyo incondicional.

LIGIA ESCOBAR DOMÍNGUEZ

Page 8: Tesis Sistema Informatico de La Escuela 21 de Mayo

DEDICATORIA

Dedico este trabajo primeramente a Dios por guiarnos y darnos

fuerzas para seguir adelante. A nuestros progenitores por brindarnos

su apoyo incondicional y llevarnos por la senda del bien.

También dedico en especial a mi hijo Kendru Steven Moreira

Solórzano, por darme las fuerzas y motivación para el proceso de esta

investigación.

A mi madre Dolores Tuárez, que con sus sabios consejos he podido

conseguir mis metas anheladas.

MARYURI SOLÓRZANO TUAREZ

Page 9: Tesis Sistema Informatico de La Escuela 21 de Mayo

RESUMEN EJECUTIVO

El desarrollo de un programa computarizado optimiza el tiempo, sistematizar la

labor del usuario, especialmente desarrollado para un análisis rápido y eficaz.

Se ofrece una herramienta de trabajo a la Escuela Fiscal Mixta “21 de Mayo” que

consiste en un sistema de información más exacta y rápida para el personal que

allí labora matriculando una cantidad de alumnos en un corto período de tiempo

para dar inicio a las actividades del plantel de manera eficiente e integra.

Presenta una interfaz amigable capaz de realizar: las operaciones básicas de

mantenimiento de archivos que proporcione una mejor manera de proveer

información actualizada para la toma de decisiones, registro y control de todos los

procesos inherentes del sistema de inscripción, ofrecer reportes de acuerdo a la

necesidad del usuario.

El objetivo central del proyecto “Desarrollo de un Sistema Informático

Administrativo para la Escuela Fiscal Mixta “21 de Mayo” del Cantón Portoviejo,

provincia de Manabí”, es automatizar el proceso de inscripción de esta institución

educativa y todos los procesos inherentes al mismo que genere información

oportuna, precisa y confiable mediante el uso de los sistemas de información,

herramienta que contribuye a los diferentes sectores productivos de la sociedad en

llevar las tareas administrativas rutinarias, tediosa y de gran volumen de

información al computador, teoría que afianza la propuesta de sistema de

información para el proceso de inscripción del plantel como nueva forma de

trabajo que sustituya la metodología hasta ahora utilizada en los sistemas

administrativos escolares.

Page 10: Tesis Sistema Informatico de La Escuela 21 de Mayo

EXECUTIVE SUMMARY

The development of a program computarizado optimize the time, systematize the

labor of the user, specially developed for a rapid and effective analysis.

A tool of work offers to the Fiscal Mixed School " May 21 " that consists of a

system of more exact and rapid information for the personnel that there works

registering a pupils' quantity in a short period efficient of time to give beginning

to the activities of the nursery of an way and it integrates.

He presents an amicable interface capable of realizing: the basic operations of

maintenance of files that provides a better way of providing information updated

for the capture of decisions, record and control of all the inherent processes of the

system of inscription, offering reports of agreement to the need of the user.

The central aim of the project " Development of an IT Administrative System for

the Fiscal Mixed School " On May 21 " from the Canton Portoviejo, Manabí's

province ", is to automate the process of inscription of this educational institution

and all the processes inherent in the same one that generates opportune, precise

and reliable information by means of the use of the information systems, tool that

he contributes to the different productive sectors of the company in taking the

administrative routine tasks, tedious and of great volume of information to the

computer, theory that guarantees the offer of information system for the process of

inscription of the nursery as new form of work that replaces the methodology till

now used in the administrative school systems.

Page 11: Tesis Sistema Informatico de La Escuela 21 de Mayo

ÍNDICE

CERTIFICACION II

APROBACION III

DERECHO DEL AUTOR IV

AGRADECIMIENTO VI

DEDICATORIA VIII

RESUMEN EJECUTIVO IX

SUMARY X

TEMA

INTRODUCCIÓN

CAPITULO I

1.1. JUSTIFICACIÓN 1

2.1 PLANTEAMIENTO DEL PROBLEMA 2

2.2 OBJETIVOS 3

2.3 OBJETIVO GENERAL 3

2.4 OBJETIVOS ESPECÍFICOS 3

CAPITULO II

2. MARCO REFERENCIAL 5

2.1 MARCO TEÓRICO 6

2.1.1 DISEÑO DEL SISTEMA 7

2.1.2 OBJETIVOS DEL DISEÑO DE SQL. SERVER 8

2.1.3 VISUAL BASIC 11

CAPITULO III

3. DISEÑO METODOLÓGICO 13

3.1 METODOLOGÍA 13

3.2 TÉCNICAS 13

3.3 RESULTADOS OBTENIDO 14

3.3 PRESUPUESTO 15

Page 12: Tesis Sistema Informatico de La Escuela 21 de Mayo

CAPITULO IV

4.1 CONCLUSIONES Y RECOMENDACIONES 16

4.1.1 CONCLUSIONES 16

4.1.2 RECOMENDACIONES 17

CAPITULO V

5. PROPUESTA 18

5.1 DESCRIPCION GENERAL DEL SISTEMA 18

5.2 DETERMINACION DE REQUERIMIENTO 18

5.3 RELACIONES DE LAS BASES DE DATOS 19

5.4 CRONOGRAMA VALORADO 20

5.6 BIBLIOGRAFIA 21

ANEXOS

MANUAL DEL PROGRAMADOR

MANUAL DEL USUARIO

CD DE INSTALACION

Page 13: Tesis Sistema Informatico de La Escuela 21 de Mayo

TEMA:

“DESARROLLO DE UN SISTEMA INFORMÁTICO ADMINISTRATIVO

PARA LA ESCUELA FISCAL MIXTA “21 DE MAYO” DEL CANTÓN

PORTOVIEJO, PROVINCIA DE MANABÍ”.

Page 14: Tesis Sistema Informatico de La Escuela 21 de Mayo

Introducción

Los Sistemas Informáticos en la actualidad son muy importantes ya que gracias a

ellos la mayoría de las instituciones por no decir todas, manejan las Bases de

Datos de una forma más cómoda y sencilla, sin la necesidad de archivar los

registros en papeles u otros documentos, ya que la teneduría de libros se pasa a

computadora sin un sistema informático, lo que no permite obtener una

información rápida de los registros diarios y mensuales que se necesitan en su

debido momento.

Con los Sistemas Informáticos esta tarea resulta más fácil de manejar para los

empleados que laboran en dichas instituciones, ya sean públicas o privadas.

Institución escogida para aplicar este sistema informático es la Escuela Nacional

Mixta “21 de Mayo” por el prestigio que tiene y por las facilidades que brindaron

desde un principio para la obtención de datos y materiales de apoyo para la

culminación de este proyecto.

Este trabajo tuvo como meta final la realización de un Sistema Informático creado

en lenguaje de programación Visual Basic 6.0, ya que es el más utilizado en la

actualidad y es muy fácil de manejarlo y cualquier persona capacitada podrá

manejarlo.

Estos datos e instrucciones se codificaran en dicho lenguaje de programación para

que puedan ser convertidos en lenguajes de computadoras y así poder ejecutar el

programa.

Page 15: Tesis Sistema Informatico de La Escuela 21 de Mayo

1

CAPITULO I

1.1 Justificación.

Este Sistema informático es trascendental por la importancia que presenta el

control de datos en la entidad Educativa “21 de Mayo”, permitiendo innumerables

beneficios que va a recibir los mismos con la realización de un Sistema

Informático que ayude como controlar de una mejor manera los reportes e

informes que a diario en ella se elaboran.

Para contribuir a la solución de la problemática se puso énfasis en la información

que ofreció la Escuela a la interesada para la realización de este sistema.

En esta justificación se expresan las razones experimentales y las posibles

ventajas que se derivarían de los resultados de la realización de este proyecto. Y

es evidente que la labor debe coordinar un buen número de campos para poder

resolver el propósito planteado.

Un sistema de información es un conjunto de elementos que interactúan entre sí

con el fin de apoyar las actividades de las instituciones educativas.

Page 16: Tesis Sistema Informatico de La Escuela 21 de Mayo

2

1.2 Planteamiento del problema.

La Informática es la ciencia que sirve para que muchos procesos aumenten su

eficiencia, y si una organización, institución o empresa requiere ofrecer a sus

clientes la calidad en el servicio que otorga, se hace emergente la búsqueda de

soluciones que faciliten los procesos para servir mejor.

La Escuela Fiscal Mixta “21 de Mayo”, institución que ayuda a la comunidad con

su educación y prestigio, utiliza procesos manuales para recabar toda la

información concerniente al alumnado y profesores como son las matriculas, notas

trimestrales y asistencia del personal docente que surge durante el año lectivo, lo

que entorpece la agilidad y veracidad del procesamiento de datos, disminuyendo

por consiguiente la efectividad de los servicios, lo que provoca insatisfacción

tanto para los alumnos como para la Institución.

La manipulación del Sistema Administrativo con recursos materiales como papel,

plumas, borrador y calculadora es muy complicado para quien lo maneja, por esta

razón el problema queda planteado de la siguiente manera:

¿Cómo influye el desarrollo de un Sistema Informático de registros de

Matriculación, control de Notas y Asistencia del personal Docente, en la Escuela

Fiscal Mixta “21 de Mayo” de la ciudad de Portoviejo?

Page 17: Tesis Sistema Informatico de La Escuela 21 de Mayo

3

1.3 Objetivos.

1.3.1 Objetivo General.

Solucionar con la implementación de un sistema informático administrativo las

dificultades que ocasiona a las autoridades de la Escuela “21 de Mayo” el control

de sus procesos de administración mediante registros manuales.

1.3.2 Objetivos Específicos.

Facilitar al personal de la Escuela el proceso de registros de matriculación,

notas y asistencia del personal docente.

Permitir un manejo simple del control de asistencia y otros datos de los

docentes de la Escuela.

Permitir la obtención inmediata de reportes de matriculas, notas,

asistencia, etc.

Proporcionar a través del sistema el acceso a una información ordenada y

actualizada del proceso administrativo de la institución.

Page 18: Tesis Sistema Informatico de La Escuela 21 de Mayo

4

1.4 BENEFICIARIOS

1.4.1. DIRECTOS

Las principales personas que se beneficiaran con la implementación del Sistema

Informático es el área de Colecturía de la Escuela Fiscal Mixta “21 de Mayo” de

la ciudad de Portoviejo Provincia de Manabí.

1.4.2. INDIRECTOS

Usuarios en general.

Page 19: Tesis Sistema Informatico de La Escuela 21 de Mayo

5

CAPITULO II

2. Marco Referencial.

Como consecuencia de fuertes invierno ocurridos entre los años 1982 - 1983

hubieron muchos damnificados, los que fueron ubicados en lo que hoy es la

ciudadela San Alejo.

Viendo las necesidades de está nueva Ciudadela y ante gestiones de sus

moradores se crea la escuela “21 de Mayo”, la que toma el nombre este plantel de

la fecha en que fue creada el 21 de Mayo de 1984.1

Funcionaba en un terreno prestado, en un canchón de caña sin piso totalmente

antipedagógico con 200 alumnos aproximadamente y como único profesor el Sr.

Jorge Bello Saltos.

Por el número elevado de alumnos, las autoridades educativas creyeron

conveniente reajustar la escuela Cristóbal Colón, pasando la Sra. Estrella

Zambrano Macías a laborar en esta escuela; además colaboraban varios jóvenes.

Con el pasar del tiempo se fue incrementando el número de profesores y en la

actualidad la Institución cuenta con 11 profesores titulares, 2 contratos, 1 conserje

y la Directora es la Lcda. Carlota Andrade.

1 Manual de la Escuela “21 de Mayo”

Page 20: Tesis Sistema Informatico de La Escuela 21 de Mayo

6

2.1 Marco Teórico.

La investigación se basa en la problemática que tiene la Escuela Fiscal Mixta “21

de Mayo” siendo uno de estos problemas la falta de un Sistema Informático

adecuado a sus necesidades y que sus computadoras no son actualizadas y por

ende no cumplen eficientemente en el correcto trabajo del mismo.

Por medio de un Sistema Informático que se basa en un Software que Controle los

Registros como son: matriculación, control de notas y asistencia del personal

docente. La Directora ha decidido que; para el mejor desarrollo y progreso de la

Institución, que se actualice sus computadoras con un software que proporcione

los registros ya mencionados y va hacer en el lenguaje de programación llamado

Visual Basic, es el lenguaje más utilizado y el más fácil que encuentre un

programador, ya que contiene muchas herramientas necesarias para construir

programas para Windows de forma sencilla, eficiente y lograr hacer accesible a

los programadores de Basic la posibilidad de programar para Windows.

Una serie de herramientas ha permitido, que con algunos pocos de clic sea posible

crear ventanas de Windows, colocarle botones de comando, menús, cuadros de

textos, listas, etc.

Esto es para que exista una mejor distribución de entrega de reportes, ya que con

este Software será de mucha ayuda y facilitará de manera más rápida los registros

que dispone la Escuela Fiscal Mixta “21 de Mayo”.

Page 21: Tesis Sistema Informatico de La Escuela 21 de Mayo

7

LA CONSTRUCCIÓN DE UNA APLICACIÓN EN WINDOWS CON

VISUAL BASIC IMPLICA TRES PASOS DE PROGRAMACIÓN.

Crear la interfaz de usuario mediante los controles de VISUAL BASIC.

Establecer las características o propiedades de los elementos de dicha

interfaz de usuario, medida que sea necesaria.

Escribir el código del programa para uno o más elementos de la interfaz

del usuario, a medida que sean necesarios.

2.1.1 Diseño del Sistema.

Se llevara a cabo el análisis de requisitos del programa que es una base de datos

que registra la información que tiene en la Escuela Fiscal Mixta “21 de Mayo”.

Para esto es necesario que el programa tenga la capacidad de acceder y crear una

base de datos, las cuales se usarán para mantener guardados los datos en el disco

aun después de terminar la ejecución del programa deberá contar también con

funciones que sean necesarios, el programa debe validar los diversos datos que se

ingresaran, estos deben estar acompañados con un respectivo mensaje que ayude a

comprender su correcta utilización.

El desempeño de Software se ha centrado en facilitar el ingreso, de acceder y

manipular los datos de la Escuela, en desarrollar el Software de manera que lleve

el control de la información haciendo que se envié un mensaje de alerta cuando un

Page 22: Tesis Sistema Informatico de La Escuela 21 de Mayo

8

registro es incorrecto y por último el programa debe hacer que el reporte sea el

correcto.

2.1.2 Objetivos del Diseño de SQL Server

Los clientes están buscando soluciones para sus problemas de negocios. 2La

mayoría de las "soluciones" de bases de datos solamente traen múltiples niveles

de costos y complejidad. La estrategia de Microsoft es la de hacer que SQL Server

sea la base de datos más fácil de utilizar para construir, administrar e implementar

aplicaciones de negocios. Esto significa tener que poner a disposición un modelo

de programación rápido y sencillo para desarrolladores, eliminando la

administración de base de datos para operaciones estándar, y suministrando

herramientas sofisticadas para operaciones más complejas.

SQL Server disminuye el costo total de propiedad a través de características como

administración multi-servidor y con una sola consola; ejecución y alerta de

trabajos basadas en eventos; seguridad integrada; y scripting administrativo. Esta

versión también libera al administrador de base de datos para aspectos más

sofisticados del trabajo al automatizar las tareas de rutina. Al combinar estos

poderosos servicios de administración con las nuevas características de

configuración automática, Microsoft SQL Server es la elección ideal de

automatización de sucursales y aplicaciones de base de datos insertadas.

2 www. Monografías.com/trabajos14/sqlserver/sqlserver.shtml

Page 23: Tesis Sistema Informatico de La Escuela 21 de Mayo

9

Los clientes invierten en sistemas de administración de bases de datos, en forma

de aplicaciones escritas para esa base de datos y la educación que implica para la

implementación y administración. Esa inversión debe protegerse: a medida que el

negocio crece, la base de datos deberá crecer y manejar más datos, transacciones y

usuarios. Los clientes también desean proteger las inversiones a medida que

escalan aplicaciones de base de datos hacia equipos portátiles y sucursales.

Para cumplir con estas necesidades, Microsoft ofrece un motor de base datos

único que escala desde una computadora portátil que ejecuta Windows® 95 o

Windows 98, hasta clusters de procesadores múltiples simétricos de terabyte que

ejecutan Windows NT Server Enterprise Edition. Todos estos sistemas mantienen

la seguridad y confiabilidad que exigen los sistemas de negocios de misión crítica.

Nueva para el lanzamiento de 7.0 es una versión de rastro de baja memoria con

capacidades de replicación de multi-sitio. Se ajusta muy bien a las necesidades

cada vez mayores del mercado de la computación móvil. Las otras características

tales como bloqueo a nivel de línea dinámico, el paralelismo intra-query, query

distribuido, y mejoras para las bases de datos muy grandes (VLDB) hacen que el

SQL Server 7.0 sea la elección ideal para sistemas OLTP de alta tecnología y

sistemas de data warehousing.

Mientras los sistemas de procesamiento siguen siendo un componente clave para

las infraestructuras de bases de datos corporativas, las compañías también están

invirtiendo bastante en mejorar la comprensión que tienen de sus datos. La

estrategia de Microsoft consiste en reducir el costo y la complejidad del data

Page 24: Tesis Sistema Informatico de La Escuela 21 de Mayo

10

warehousing mientras hace que la tecnología sea más accesible a una mayor

cantidad de público.

Microsoft ha establecido un enfoque total a todo el proceso de data warehousing

(almacenamiento de datos). El objetivo es facilitar la construcción y diseño de

soluciones de data warehousing costo efectivas a través de una combinación de

tecnologías, servicios y alianzas con los proveedores.

La Microsoft Alliance for Data Warehousing es una coalición que une a los

líderes en la industria de almacenamiento de datos y aplicaciones. El Microsoft

Data Warehousing Framework constituye un conjunto de interfaces de

programación diseñadas para simplificar la integración y administración de

soluciones de data warehousing.

Las innovaciones del producto en SQL Server 7.0 mejoran el proceso de data

warehousing: Servicios de Transformación de Datos; manejo mejorado de las

consultas complejas y bases de datos muy grandes; procesamiento analítico en

línea e integrado; y el Microsoft Repository. Otro componente esencial es el

soporte extenso para integración de terceros.

Page 25: Tesis Sistema Informatico de La Escuela 21 de Mayo

11

2.1.3 Visual Basic

3Este lenguaje de programación es desarrollado por Alan Cooper para Microsoft.

El lenguaje de programación es un dialecto de BASIC, con importantes añadidos.

Su primera versión fue presentada en 1991 con la intención de simplificar la

programación utilizando un ambiente de desarrollo completamente gráfico que

facilitara la creación de interfaces gráficas y en cierta medida también la

programación misma. Desde el 2001 Microsoft ha propuesto abandonar el

desarrollo basado en la API Win32 y pasar a trabajar sobre un framework o marco

común de librerías independiente de la version del sistema operativo, .NET

Framework, a través de Visual Basic .NET (y otros lenguajes como C Sharp (C#)

de fácil transición de código entre ellos) que presenta serias incompatibilidades

con el código Visual Basic existente.

Visual Basic constituye un IDE (entorno de desarrollo integrado o en inglés

Integrated Development Enviroment) que ha sido empaquetado como un

programa de aplicación, es decir, consiste en un editor de código (programa donde

3 http://es. wikipedia.org/wiki/Visual_Basic

Page 26: Tesis Sistema Informatico de La Escuela 21 de Mayo

12

se escribe el código fuente), un depurador (programa que corrige errores en el

código fuente para que pueda ser bien compilado), un compilador (programa que

traduce el código fuente a lenguaje de máquina), y un constructor de interfaz

gráfica o GUI (es una forma de programar en la que no es necesario escribir el

código para la parte gráfica del programa, sino que se puede hacer de forma

visual).

Page 27: Tesis Sistema Informatico de La Escuela 21 de Mayo

13

CAPITULO III

3. Diseño Metodológico.

Para realizar la investigación se consideraron los siguientes aspectos: Metodología

y Técnicas

3.1 Metodología.

La metodología que se aplicará son dos, de campo y el bibliográfico.

Campo.- son un conjunto de métodos, técnicas y procedimientos sistemáticos

que se utilizarán para obtener respuestas al problema planteado.

Bibliográfico.- esta es de tipo bibliográfico por cuánto el desarrollo de la

investigación se apoya en información de libros, Internet y en folletos, etc.

3.2 Técnicas.

Se aplicó la siguiente técnica:

Técnicas de entrevista.- Permitirá recopilar información en forma verbal, a

través de preguntas previamente elaboradas. Se entrevistarán de forma

individual al personal de la Escuela Fiscal “21 de Mayo”, quienes serán los

principales beneficiados del proyecto.

Page 28: Tesis Sistema Informatico de La Escuela 21 de Mayo

14

3.3 Resultados Obtenidos

Con el desarrollo del sistema informático para la Escuela “21 de Mayo” se

logró solucionar las dificultades que se originaban al momento de realizar

los procesos de matriculación, reporte de notas y asistencia del personal.

El sistema desarrollado permite un manejo fácil y eficiente del control de

asistencia del personal, así como también datos de los alumnos de la

Escuela.

Se logro realizar un sistema cuyos resultados obtenidos sean fiables al

momento de generar reportes de matriculas, notas, asistencias, entre otros.

Proporcionar a través del sistema el acceso a una información ordenada y

actualizada del proceso administrativo de la institución

Page 29: Tesis Sistema Informatico de La Escuela 21 de Mayo

15

3.3 Presupuesto.

Nro Descripción Cantidad Costo

Unitario

Sub.

Total

1 Material de escritorio y oficina 1 30.00 $ 30.00

2 Copias 2334 0.03 $ 70.00

3 Transporte 1 30.00 $ 30.00

4 Tinta para impresora 3 25.00 $ 75.00

5 Impresión 1 65.00 $ 65.00

6 Empastadas de Tesis 9 7.00 $ 63.00

7 Alquiler de Internet y Computadora 1 60.00 $ 60.00

8 Material bibliográfico 1 50.00 $ 50.00

9 Remas de Hojas 7 4.00 $ 28.00

SUMAN $ 471.00

IMPREVISTOS 10% $ 47.10

TOTAL $ 518.10

SON: QUINIENTOS DIECIOCHO 10

/100 DOLARES.

Page 30: Tesis Sistema Informatico de La Escuela 21 de Mayo

16

CAPITULO IV

4.1 CONCLUSIONES Y RECOMENDACIONES

4.1.1 CONCLUSIONES

Después de concluir con nuestro proyecto “DESARROLLO DE UN SISTEMA

INFORMATICO ADMINISTRATIVO PARA LA ESCUELA FISCAL

MIXTA 21 DE MAYO DEL CANTÓN PORTOVIEJO, PROVINCIA DE

MANABÍ”, se llegó a las siguientes conclusiones:

Se logró cumplir con el desarrollo de un sistema que permita optimizar el

trabajo de matriculación, reporte de notas, asistencia del personal docente

y demás procesos que se realizan en la Escuela.

El sistema cuenta con varias funcionabilidades que facilitan al usuario la

comprensión y manejo del mismo.

El desarrollo del sistema cuenta con un manual de usuario que tiene la

documentación necesaria que servirá a la persona encargada de

administrar el sistema.

Page 31: Tesis Sistema Informatico de La Escuela 21 de Mayo

17

4.1.2 RECOMENDACIONES

Para la debida utilización del sistema es recomendable tener en cuenta las

siguientes recomendaciones:

Que el Administrador de sistema tenga conocimientos básicos en

Informática y una previa capacitación a la utilización del mismo.

Para cualquier ayuda utilizar el manual de usuario.

El administrador debe ser el único responsable de la información que se

ingresa al sistema para que no hayan confusiones.

Para que la implementación del sistema sea efectiva es recomendable que

la información se maneje con gran seguridad.

Page 32: Tesis Sistema Informatico de La Escuela 21 de Mayo

18

CAPITULO V

5. PROPUESTA

5.1. DESCRIPCION GENERAL DEL SISTEMA

El programa llamado Ejecutable.exe es un sistema informático que sirve para

llevar registros de matriculación, reporte de notas y asistencia del personal

docente de la Escuela Fiscal Mixta “21 de Mayo” de la ciudad de Portoviejo

Provincia de Manabí.

El presente sistema informático lo conforman los siguientes módulos:

Formularios de Matriculación: Este modulo nos permite registrar los datos

del estudiante, representante y matriculas que hubiesen en ese periodo.

Formularios de Ingresos de Notas: Nos permite ingresar notas y tener un

reporte confiable de las mismas.

Formularios de Control de Asistencia del Docente: Permite llevar el

control diario de asistencia del docente.

5.2. DETERMINACION DE REQUERIMIENTO

Se requiere de un sistema informático basado en computadoras, para ingresar

matriculas, reporte de notas y asistencia del personal docente para la Escuela

Fiscal Mixta “21 de Mayo” de la ciudad de Portoviejo Provincia de Manabí.

Los principales requerimientos del equipo de computación que se necesitan para

un óptimo funcionamiento son:

Marca Mainborad: Intel

Tipo de Procesador: Dual Core de 2.0 GHz o Superior

Tamaño de Disco Duro: 160 GB de Espacio Inicial o Superior

Memoria RAM: 1 GB o Superior

Monitor: VGA o SVGA

Unidad de CD: DVD-Rom

Impresora: Opcional

Page 33: Tesis Sistema Informatico de La Escuela 21 de Mayo

19

5.3 RELACIONES DE LAS BASES DE DATOS

Page 34: Tesis Sistema Informatico de La Escuela 21 de Mayo

5.4 CRONOGRAMA VALORADO

Page 35: Tesis Sistema Informatico de La Escuela 21 de Mayo

21

SISTEMA

Matriculación

Notas

Asistencias

Configuración

Registros

Estudiantes Representantes

Matricula

Informes

Informe De Alumnos

Matriculados

Registros

Notas de Estudiante

Informes

Informe de Notas x

Alumno Resumido

Informe de Notas x

Alumno

Informe de Notas x

Trimestre Resumido

Informe de Notas x

Trimestre

Informe Resumido de

notas x Materias y

trimestres

Registros

Asistencias de

Profesores

Informes

Informe de Asistencias

de Profesores

Registros

Periodos

Lectivos Grados

Materias

Paralelos

Profesores

Parciales

Paralelos

Profesores

Usuarios

Establecer Periodo Activo

Bloquear

Establecer Configuraciones

Establecer materias a Profesor

Establecer Permisos de

Usuarios

Page 36: Tesis Sistema Informatico de La Escuela 21 de Mayo

15

5.5 Bibliografía.

BATINI, CERI Y NAVATHE. Diseño Conceptual de Bases de Datos.

Adisson – Wesley. 1994.

Internet de la página www.Google.com

MICROSOFT PRESS. "Manual de Programador Visual Basic

6.0" EDITORIAL MC. Graw-Hill. 2003.

MSDN. MICROSOFT "Ayuda de Visual Basic 6.0". Microsoft Coorpor.

2003.

TIZNADO Santana Marco Antonio. Visual Basic. McGraww-Hill. 1997.

VAQUERO, Antonio. Microsoft Visual BASIC 6.0. Referencias de

Controles. Primera Edición McGraw Hill. España. 1993.

21

Page 37: Tesis Sistema Informatico de La Escuela 21 de Mayo

ANEXOS

Page 38: Tesis Sistema Informatico de La Escuela 21 de Mayo

MANUAL

DEL

PROGRAMADOR

Page 39: Tesis Sistema Informatico de La Escuela 21 de Mayo

ÍNDICE

PÁG.

1. CODIFICACIÓN DEL PROGRAMA 1

1.1 FORMULARIO DE ESTUDIANTE 1

1.2 FORMULARIO PRINCIPAL 2

1.3 FORMULARIO REGISTRO DE ESTUDIANTES 4

1.5 FORMULARIO REGISTRO SISTENCIAS DE PROFESORES 12

1.6 FORMULARIO BLOQUEO DE SISTEMA 22

1.7 FORMULARIO DE CONF. DE MATERIAS A GRADO 23

1.8 FORMULARIO DE REGISTRO DE MATERIAS 25

1.9 FORMULARIOS CONFIGURACION MATERIAS PROFESOR 27

1.10 FORMULARIOS REGISTRO DE MATRICULAS 40

1.11 FORMULARIO REGISTRO DE GRADOS 49

1.12 FORMULARIO REGISTRO DE NOTAS 51

1.13 FORMULARIO INFORME DE NOTAS RESUMIDO X

MATERIAS Y TRIMESTRES 70

1.14 FORMULARIO REGISTRO DE PARALELOS 78

1.15 FORMULARIO REGISTRO DE TRIMESTRES O PARCIALES 83

1.16 FORMULARIO ESTABLCER PERIODO ACTIVO 85

1.17 FORMULARIO REGISTRO DE PERIODOS 85

1.18 FORMULARIO PERMISOS DE USUARIOS 88

1.19 FORMULARIO REGISTRO DE PROFESORES 89

1.20 FORMULARIO INFORME ASISTENCIAS DE PROFESORES 91

1.21 FORMULARIO INFORME DE NOTAS X TRIMESTRE 94

1.22 FORMULARIO INFORME AUMNOS MATRICULADOS 96

1.23 FORMULARIO INFORME DE NOTAS X ALUMNO RESUMIDO 99

1.24 FORMULARIO INFORME DE NOTAS DE ALUMNOS X 101

TRIMESTRE

1.25 FORMULARIO INFORME DE NOTAS X TRIMESTRE 104

RESUMIDO

1.26 FORMULARIO INFORME DE NOTAS X TRIMESTRE 107

1.27 FORMULARIO REGISTRO DE REPRESENTANTES 109

1.28 FORMULARIO REGISTRO DE USUARIOS 112

1.29 FORMULARIO ESTABLECER CONFIGURACIONES 114

1.30 FORMULARIO DE BUSQUEDA 117

1.31 VARIABLE GLOBALES 121

1.32 FUNCIONES GLOBALES 123

Page 40: Tesis Sistema Informatico de La Escuela 21 de Mayo

1

1. CODIFICACION DEL PROGRAMA

1.1 FORMULARIO DE INGRESO AL SISTEMA

Dim aux As Boolean

Private Sub cmb_usuarios_Click()

Cod_usuario = ExtraeIDCombo(cmb_usuarios)

End Sub

Private Sub cmdCancel_Click()

If base.State = 1 Then

base.Close

End If

End

End Sub

Private Sub cmdOK_Click()

Dim STRSQL As String

If cmb_usuarios.ListIndex = -1 Then Exit Sub

STRSQL = "SELECT COUNT(*) as total FROM USUARIOS WHERE

codigo='" & ExtraeIDCombo(cmb_usuarios) & "' and upper(clave) = '" &

UCase(txt_clave.TEXT) & "'"

Set tabla = base.Execute(STRSQL)

If tabla.Fields(0).Value > 0 Then

aux = True

tabla.Close

Set tabla = Nothing

Load MDIForm1

MDIForm1.Show

frm_fondo.Show

Unload Me

Exit Sub

End If

txt_clave.TEXT = ""

MsgBox ("datos Incorrectos")

tabla.Close

Set tabla = Nothing

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then SendKeys vbTab

End Sub

Private Sub Form_Load()

'cod_usu = Leer_Ini(ruta_ini, "usuario", "")

aux = False

LLENACOMBO cmb_usuarios, "select codigo,nombre from usuarios"

End Sub

Private Sub Form_Unload(Cancel As Integer)

If base.State = 1 And aux = False Then

Page 41: Tesis Sistema Informatico de La Escuela 21 de Mayo

2

base.Close

End If

End Sub

1.2 FORMULARIO PRINCIPAL

Private Sub m_a_i_inf_asis_alumno_Click()

abrir_form form_rep_asistencias_alumno, "form_rep_asistencias_alumno"

End Sub

Private Sub m_a_i_inf_asis_profe_Click()

abrir_form form_rep_asistencias_profesores, "form_rep_asistencias_profesores"

End Sub

Private Sub m_a_r_asis_estudiante_Click()

abrir_form Form_asistencias_alumnos, "Form_asistencias_alumnos"

End Sub

Private Sub m_a_r_asis_profesores_Click()

abrir_form Form_asistencias_profesores, "Form_asistencias_profesores"

End Sub

Private Sub m_bloquear_Click()

Load form_Login2

form_Login2.Show vbModal

End Sub

Private Sub m_c_config_Click()

abrir_form frm_config, "frm_config"

End Sub

Private Sub m_c_mater_grados_Click()

abrir_form form_materia_grado, "form_materia_grado"

End Sub

Private Sub m_c_materia_profe_Click()

abrir_form Form_materias_profe, "Form_materias_profe"

End Sub

Private Sub m_c_periodoactivo_Click()

abrir_form form_periodo_activo, "form_periodo_activo"

End Sub

Private Sub m_c_r_areas_Click()

abrir_form form_permisos2, "form_permisos2"

End Sub

Private Sub m_c_r_materias_Click()

abrir_form Form_materias, "Form_materias"

End Sub

Private Sub m_c_r_niveles_Click()

abrir_form Form_niveles, "Form_niveles"

End Sub

Private Sub m_c_r_paralelos_Click()

abrir_form Form_paralelos, "Form_paralelos"

Page 42: Tesis Sistema Informatico de La Escuela 21 de Mayo

3

End Sub

Private Sub m_c_r_parciales_Click()

abrir_form Form_parciales, "Form_parciales"

End Sub

Private Sub m_c_r_periodos_Click()

abrir_form Form_periodos, "Form_periodos"

End Sub

Private Sub m_c_r_profesores_Click()

abrir_form Form_profesores, "Form_profesores"

End Sub

Private Sub m_c_r_uauarios_Click()

abrir_form Form_Usuarios, "Form_Usuarios"

End Sub

Private Sub m_m_i_inf_matri_Click()

abrir_form form_rep_estudiantes_matriculados,

"form_rep_estudiantes_matriculados"

End Sub

Private Sub m_m_r_estudiantes_Click()

abrir_form Form_estudiante, "Form_estudiante"

End Sub

Private Sub m_m_r_matricual_otros_Click()

abrir_form Form_matricula2, "Form_matricula2"

End Sub

Private Sub m_m_r_matricula_Click()

abrir_form Form_matricula, "Form_matricula"

End Sub

Private Sub m_m_r_representantes_Click()

abrir_form Form_representante, "Form_representante"

End Sub

Private Sub m_n_i_inf_concentrado_Click()

abrir_form form_rep_notas_concentrado, "form_rep_notas_concentrado"

End Sub

Private Sub m_n_i_inf_notas_x_estudiante_Click()

abrir_form form_rep_notas_alumno_x_trimestre,

"form_rep_notas_alumno_x_trimestre"

End Sub

Private Sub m_n_i_inf_notas_x_materias_trimestre_Click()

abrir_form Form_notas_materias, "Form_notas_materias"

End Sub

Private Sub m_n_i_inf_notas_x_trimestre_Click()

abrir_form form_rep_notas_x_trimestre, "form_rep_notas_x_trimestre"

End Sub

Private Sub m_n_i_notas_estu_concentrado_Click()

abrir_form form_rep_notas_alumno_concentrado,

"form_rep_notas_alumno_concentrado"

End Sub

Private Sub m_n_notas_estudiante_Click()

abrir_form Form_notas, "Form_notas"

Page 43: Tesis Sistema Informatico de La Escuela 21 de Mayo

4

End Sub

Private Sub m_salir_Click()

Unload Me

End Sub

Private Sub MDIForm_Load()

'Set apli = New Application

Crae_aplicacion_excel

NOMBRE_ESCUELA = Extrae_config("8")

Set tabla = base.Execute("SELECT NOMBRE FROM PERIODO WHERE

CODIGO='" & Gperiodo & "'")

If tabla.EOF = False Then

NOMBRE_PERIODO = tabla.Fields(0).Value

End If

tabla.Close

Set tabla = Nothing

Me.Caption = "Systema de Control Escolar - " & NOMBRE_PERIODO

End Sub

Private Sub Crae_aplicacion_excel()

Set Apli = New Excel.Application

End Sub

Private Sub MDIForm_Unload(Cancel As Integer)

If base.State = 1 Then

base.Close

End If

Shell "TASKKILL /F /IM EXCEL.exe", vbMinimizedNoFocus

End Sub

1.3 FORMULARIO REGISTRO DE ESTUDIANTES

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim opcion_foto As String

Option Explicit

Dim DataFile As Integer

Dim Chunk() As Byte

Const conChunkSize As Integer = 16384

Dim ar As Field

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Page 44: Tesis Sistema Informatico de La Escuela 21 de Mayo

5

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_busca_madre_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,nombre,cedula,direccion FROM representante

where sexo='2'"

Busqueda_where " and codigo+NOMBRE+cedula "

Busqueda_orden "2"

Busqueda_Ncampos 4

Busqueda_campos 0, "Codigo", 5

Busqueda_campos 1, "Nombre", 40

Busqueda_campos 2, "Cedula", 20

Busqueda_campos 3, "Direccion", 60

Busqueda_indice 0

Busqueda.boton = True

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

If Busqueda.retorna <> "Abrir" Then txt_madre.TEXT = Busqueda.retorna

If Busqueda.retorna = "Abrir" Then

Load Form_representante

Form_representante.Show

End If

Page 45: Tesis Sistema Informatico de La Escuela 21 de Mayo

6

End If

Exit Sub

SALIR:

End Sub

Private Sub cmd_busca_padre_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,nombre,Cedula,direccion FROM representante

where sexo='1'"

Busqueda_where " and codigo+NOMBRE+cedula "

Busqueda_orden "2"

Busqueda_Ncampos 4

Busqueda_campos 0, "Codigo", 5

Busqueda_campos 1, "Nombre", 40

Busqueda_campos 2, "Cedula", 20

Busqueda_campos 3, "Direccion", 60

Busqueda_indice 0

Busqueda.boton = True

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

If Busqueda.retorna <> "Abrir" Then

txt_padre.TEXT = Busqueda.retorna

End If

If Busqueda.retorna = "Abrir" Then

Load Form_representante

Form_representante.Show

End If

End If

Exit Sub

SALIR:

End Sub

Private Sub cmd_busca_repre_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,nombre,cedula,direccion FROM representante "

Busqueda_where "Where codigo+NOMBRE+cedula "

Busqueda_orden "2"

Busqueda_Ncampos 4

Busqueda_campos 0, "Codigo", 5

Busqueda_campos 1, "Nombre", 40

Busqueda_campos 2, "Cedula", 20

Busqueda_campos 3, "Direccion", 60

Busqueda_indice 0

Busqueda.boton = True

Load frmbusqueda

frmbusqueda.Show vbModal

Page 46: Tesis Sistema Informatico de La Escuela 21 de Mayo

7

If Busqueda.retorna <> "" Then

If Busqueda.retorna <> "Abrir" Then txt_repre.TEXT = Busqueda.retorna

If Busqueda.retorna = "Abrir" Then

Load Form_representante

Form_representante.Show

End If

End If

Exit Sub

SALIR:

End Sub

Private Sub cmd_buscar_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,NOMBREs,telefono,direccion FROM estudiante

"

Busqueda_where " WHERE codigo+NOMBREs "

Busqueda_orden "2"

Busqueda_Ncampos 4

Busqueda_campos 0, "Codigo", 5

Busqueda_campos 1, "Nombre", 40

Busqueda_campos 2, "Telefono", 15

Busqueda_campos 3, "Direccion", 40

Busqueda_indice 0

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

LLenaDatosForm 0, Busqueda.retorna

End If

Exit Sub

SALIR:

ERRORES

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Elimna_reg

End Sub

Private Sub cmd_guarda_img_Click()

Dim SQL12 As String

Dim cade As String

Guardar

cade = Verificar

If cade <> "" Then Exit Sub

If opcion_foto = "0" Then

Page 47: Tesis Sistema Informatico de La Escuela 21 de Mayo

8

SQL12 = "select * from imagenes where estudiante='" & eti_codigo.Caption &

"' and periodo='" & Gperiodo & "'"

Else

SQL12 = "select * from imagenes where estudiante='" & eti_codigo.Caption &

"'"

End If

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = True Then

SQL12 = "INSERT INTO IMAGENES(ESTUDIANTE,periodo) VALUES('"

& eti_codigo.Caption & "','" & Gperiodo & "' )"

base.Execute (SQL12)

End If

tabla_aux.Close

Set tabla_aux = Nothing

If opcion_foto = "0" Then

SQL12 = "select foto from imagenes where estudiante='" & eti_codigo.Caption

& "' and periodo='" & Gperiodo & "'"

Else

SQL12 = "select foto from imagenes where estudiante='" & eti_codigo.Caption

& "'"

End If

tabla_aux.Open SQL12, base, adOpenDynamic, adLockOptimistic

GuardarBinary tabla_aux, foto, 0

tabla_aux.update

tabla_aux.Close

Set tabla_aux = Nothing

End Sub

Private Sub cmd_guardar_Click()

Guardar

End Sub

Private Sub cmd_img_Click()

On Error Resume Next

If eti_codigo.Caption = "" Then Exit Sub

cdl.CancelError = True

cdl.Filter = "imagenes de mapa de Bit *.bmp|*.bmp|imagenes *.jpg|*.jpg"

'cdl.FileName = "NOTAS " & cmb_materia.Text & " " &

ExtraeIDCombo(cmb_grado) & cmb_paralelo.Text & " " &

ExtraeIDCombo(cmb_parcial) & "º TRIMESTRE"

cdl.ShowOpen

txt_foto.TEXT = cdl.FileTitle

foto.Picture = LoadPicture(cdl.FileName)

End Sub

Private Sub cmd_nuevo_Click()

Page 48: Tesis Sistema Informatico de La Escuela 21 de Mayo

9

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub eti_codigo_Change()

Dim SQL12 As String

If eti_codigo.Caption <> "" Then

If opcion_foto = "0" Then

SQL12 = "SELECT top 1 FOTO FROM IMAGENES WHERE

ESTUDIANTE='" & eti_codigo.Caption & "' and periodo='" & Gperiodo & "'"

Else

SQL12 = "SELECT top 1 FOTO FROM IMAGENES WHERE

ESTUDIANTE='" & eti_codigo.Caption & "'"

End If

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

LeerBinary tabla_aux, foto, 0

tabla_aux.MoveNext

Else

Set foto.Picture = Nothing

End If

tabla_aux.Close

Set tabla_aux = Nothing

Else

Set foto.Picture = Nothing

End If

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then SendKeys vbTab

End Sub

Private Sub Form_Load()

Page 49: Tesis Sistema Informatico de La Escuela 21 de Mayo

10

Dim ruta As String

ruta = App.Path & "\iconos\listo.gif"

img_listo.Picture = LoadPicture(ruta)

filtro = ""

opcion_foto = Extrae_config("17")

strtabla = "estudiante"

camposKP = "|codigo|"

nuevo_reg = "codigo"

LLENACOMBO cmb_sexo, "select codigo,nombre from tsexo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNombre(KeyAscii)

End Sub

Private Sub Text2_Change()

If Cedula(Text2) = False Then

img_listo.Visible = False

Else

img_listo.Visible = True

End If

End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)

KeyAscii = SoloCedula(KeyAscii)

End Sub

Private Sub txt_foto_Change()

Dim SQL12 As String

If eti_codigo.Caption <> "" Then

If opcion_foto = "0" Then

SQL12 = "SELECT top 1 FOTO FROM IMAGENES WHERE

ESTUDIANTE='" & eti_codigo.Caption & "' and periodo='" & Gperiodo & "'"

Else

SQL12 = "SELECT top 1 FOTO FROM IMAGENES WHERE

ESTUDIANTE='" & eti_codigo.Caption & "'"

End If

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

LeerBinary tabla_aux, foto, 0

tabla_aux.MoveNext

Else

Set foto.Picture = Nothing

End If

tabla_aux.Close

Set tabla_aux = Nothing

Else

Set foto.Picture = Nothing

Page 50: Tesis Sistema Informatico de La Escuela 21 de Mayo

11

End If

End Sub

Private Sub txt_madre_Change()

Dim SQL12 As String

SQL12 = "select nombre from representante where codigo='" & txt_madre.TEXT

& "' "

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

eti_madre.Caption = tabla_aux.Fields(0).Value

Else

eti_madre.Caption = ""

End If

tabla_aux.Close

Set tabla_aux = Nothing

End Sub

Private Sub txt_padre_Change()

Dim SQL12 As String

SQL12 = "select nombre from representante where codigo='" & txt_padre.TEXT

& "' "

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

eti_padre.Caption = tabla_aux.Fields(0).Value

Else

eti_padre.Caption = ""

End If

tabla_aux.Close

Set tabla_aux = Nothing

End Sub

Private Sub txt_repre_Change()

Dim SQL12 As String

SQL12 = "select nombre from representante where codigo='" & txt_repre.TEXT

& "' "

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

eti_repre.Caption = tabla_aux.Fields(0).Value

Else

eti_repre.Caption = ""

End If

tabla_aux.Close

Set tabla_aux = Nothing

End Sub

Private Sub txtdireccion_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Page 51: Tesis Sistema Informatico de La Escuela 21 de Mayo

12

Private Sub txtnombres_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNombre(KeyAscii)

End Sub

Private Sub txttelefono_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

1.5 FORMULARIO REGISTRO SISTENCIAS DE PROFESORES

Dim d_grid(100) As DATOS_GRID

Dim Libro As Excel.Workbook

Dim strtabla As String

Dim HOJA As Excel.Worksheet

Dim a_col As Integer

Dim a_fil As Integer

Private Sub CARGA_GRID(nombre As String, FILA As Integer, valor As

Variant)

Dim I As Integer

For I = 0 To GRID.Cols - 1

If UCase(d_grid(I).campo_col) = UCase(nombre) Then

GRID.TextMatrix(FILA, d_grid(I).n_col) = valor

If d_grid(I).revisar = True Then

GRID.Row = FILA

GRID.col = col_nombre(d_grid(I).cabecera_col)

If valor = "S" Then

Set GRID.CellPicture = LoadPicture(App.Path &

"\iconos\chksi.bmp")

Else

Set GRID.CellPicture = LoadPicture(App.Path &

"\iconos\chkno.bmp")

End If

GRID.CellPictureAlignment = 3

End If

End If

Next

End Sub

Private Sub LIMPIA_GRID()

Dim I, c As Integer

GRID.Rows = 2

For c = 0 To GRID.Cols - 1

GRID.TextMatrix(1, c) = ""

Next

End Sub

Private Function col_nombre(nombre As String) As Integer

Dim I As Integer

Page 52: Tesis Sistema Informatico de La Escuela 21 de Mayo

13

For I = 0 To GRID.Cols - 1

If UCase(d_grid(I).campo_col) = UCase(nombre) Then

col_nombre = d_grid(I).n_col

Exit Function

End If

Next

End Function

Private Function row_valor(valor As String, c As Integer) As Integer

Dim I As Integer

For I = 0 To GRID.Rows - 1

If GRID.TextMatrix(I, c) = UCase(valor) Then

row_valor = I

Exit Function

End If

Next

End Function

Private Function EXITE_ASISTENCIA(FILA As Integer) As Boolean

Dim SQL1, strand As String

strand = " "

EXITE_ASISTENCIA = False

SQL1 = "select count(*) as UNOS from " & strtabla & " where "

For I = 0 To GRID.Cols - 1

If d_grid(I).clave = True Then

SQL1 = SQL1 & strand & d_grid(I).campo_col & " = '" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

Set tabla = base.Execute(SQL1)

If tabla.Fields(0).Value <> 0 Then

EXITE_ASISTENCIA = True

End If

tabla.Close

Set tabla = Nothing

End Function

Private Function genera_INSERT(FILA As Integer) As String

Dim SQL1, SQL2, strCOMA As String

strCOMA = " "

SQL1 = "INSERT INTO " & strtabla & "("

SQL2 = " VALUES ("

For I = 0 To GRID.Cols - 1

If d_grid(I).insertable = True Then

SQL1 = SQL1 & strCOMA & d_grid(I).campo_col

SQL2 = SQL2 & strCOMA & "'" & GRID.TextMatrix(FILA,

d_grid(I).n_col) & "'"

strCOMA = ","

End If

Page 53: Tesis Sistema Informatico de La Escuela 21 de Mayo

14

Next

SQL1 = SQL1 & ") "

SQL2 = SQL2 & ") "

SQL1 = SQL1 & SQL2

genera_INSERT = SQL1

End Function

Private Function genera_UPDATE(FILA As Integer) As String

Dim SQL1, SQL2, strCOMA, strand As String

strCOMA = " "

strand = " "

SQL1 = "UPDATE " & strtabla & " set "

SQL2 = " WHERE "

For I = 0 To GRID.Cols - 1

If d_grid(I).insertable = True And d_grid(I).clave = False Then

SQL1 = SQL1 & strCOMA & d_grid(I).campo_col & "='" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strCOMA = ","

End If

If d_grid(I).clave = True Then

SQL2 = SQL2 & strand & d_grid(I).campo_col & " = '" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

SQL1 = SQL1 & " "

SQL2 = SQL2 & " "

SQL1 = SQL1 & SQL2

genera_UPDATE = SQL1

End Function

Private Sub cmd_entrada_Click()

GRID.TextMatrix(a_fil, col_nombre("hora_e")) = lbl_hora.Caption

cmd_entrada.Enabled = False

End Sub

Private Sub cmd_guardar_Click()

Dim SQL1, SQL2, SQL3 As String

Dim FILA, I As Integer

If GRID.TextMatrix(1, col_nombre("periodo")) <> "" And GRID.TextMatrix(1,

col_nombre("profesor")) <> "" And GRID.TextMatrix(1, col_nombre("fecha"))

<> "" Then

If EXITE_ASISTENCIA(1) = True Then

If Permiso("M", Me.Name) = False Then Exit Sub

End If

End If

For I = 1 To GRID.Rows - 1

Page 54: Tesis Sistema Informatico de La Escuela 21 de Mayo

15

If GRID.TextMatrix(I, col_nombre("periodo")) <> "" And GRID.TextMatrix(I,

col_nombre("profesor")) <> "" And GRID.TextMatrix(I, col_nombre("fecha"))

<> "" Then

If EXITE_ASISTENCIA(I) = True Then

SQL1 = genera_UPDATE(I)

Else

SQL1 = genera_INSERT(I)

End If

base.Execute (SQL1)

End If

Next

End Sub

Private Sub cmd_procesar_Click()

procesar

End Sub

Private Sub procesar()

Dim SQL1, SQL2 As String

Dim FILA As Integer

txt.Visible = False

LIMPIA_GRID

'If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Then Exit Sub

'SQL1 = "select P.codigo as profesor,P.nombre,A.periodo as periodo,A.fecha as

fecha,isnull(A.estado,'S') as estado,isnull(A.justificada,'N') as

justificada,isnull(A.atraso,'N')as atraso,isnull(A.observacion,'') as

observacion,isnull(A.hora_e,'00:00:00') as hora_e,isnull(A.hora_s,'00:00:00') as

hora_s from profesor P left outer join asistencias_P A on P.codigo=A.profesor

where A.fecha='" & dtp_fecha.Value & "' and A.periodo='" & Gperiodo & "'

order by P.nombre"

SQL1 = "select p.codigo as profesor,p.nombre,periodo='" & Gperiodo &

"',fecha='" & dtp_fecha.Value & "',estado=isnull((select estado from asistencias_p

where profesor=p.codigo and periodo='" & Gperiodo & "' and fecha='" &

dtp_fecha.Value & "'),'S'),justificada=isnull((select justificada from asistencias_p

where profesor=p.codigo and periodo='" & Gperiodo & "' and fecha='" &

dtp_fecha.Value & "'),'N'),atraso=isnull((select atraso from asistencias_p where

profesor=p.codigo and periodo='" & Gperiodo & "' and fecha='" &

dtp_fecha.Value & "'),'N') "

SQL1 = SQL1 & ",observacion=isnull((select observacion from asistencias_p

where profesor=p.codigo and periodo='" & Gperiodo & "' and fecha='" &

dtp_fecha.Value & "'),''),hora_e=isnull((select hora_e from asistencias_p where

profesor=p.codigo and periodo='" & Gperiodo & "' and fecha='" &

dtp_fecha.Value & "'),'00:00:00'),hora_s=isnull((select hora_s from asistencias_p

where profesor=p.codigo and periodo='" & Gperiodo & "' and fecha='" &

dtp_fecha.Value & "'),'00:00:00') from profesor P"

SQL2 = "select P.codigo as profesor,P.nombre,'" & Gperiodo & "' as periodo,'" &

dtp_fecha.Value & "' as fecha,'S' as estado,'N' as justificada,'N' as atraso,'' as

observacion,'00:00:00' as hora_e ,'00:00:00' as hora_s from profesor P order by

P.nombre"

Page 55: Tesis Sistema Informatico de La Escuela 21 de Mayo

16

Set tabla = base.Execute(SQL1)

If tabla.EOF = True Then

tabla.Close

Set tabla = Nothing

Set tabla = base.Execute(SQL2)

If tabla.EOF = True Then

tabla.Close

Set tabla = Nothing

MsgBox "No existen Estudiantes Matriculados", vbInformation, "SISTEMA"

Exit Sub

End If

End If

FILA = 1

Do Until tabla.EOF = True

For I = 0 To tabla.Fields.Count - 1

CARGA_GRID tabla.Fields.Item(I).Name, FILA, tabla.Fields(I).Value

Next

GRID.TextMatrix(FILA, col_nombre("N_lista")) = FILA

tabla.MoveNext

If tabla.EOF = False Then

FILA = FILA + 1

GRID.Rows = GRID.Rows + 1

End If

Loop

tabla.Close

Set tabla = Nothing

End Sub

Private Sub cmd_salida_Click()

GRID.TextMatrix(a_fil, col_nombre("hora_s")) = lbl_hora.Caption

cmd_salida.Enabled = False

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Public Sub SALIR()

Unload Me

End Sub

Private Sub dtp_Change()

On Error Resume Next

GRID.TextMatrix(a_fil, a_col) = dtp.Value

End Sub

Page 56: Tesis Sistema Informatico de La Escuela 21 de Mayo

17

Private Sub dtp_fecha_Change()

procesar

End Sub

Private Sub dtp_fecha_Click()

cmd_entrada.Enabled = False

cmd_salida.Enabled = False

procesar

End Sub

Private Sub Form_Load()

Me.Top = 0

Me.Left = 10

coloca_tolti Me

strtabla = "Asistencias_P"

DAT_grid

CONF_GRID

dtp_fecha.Value = Date

procesar

lbl_hora.Caption = Time

End Sub

Private Sub DAT_grid()

GRID.Cols = 14

d_grid(0).n_col = 0

d_grid(0).ancho_col = 0

d_grid(0).cabecera_col = ""

d_grid(0).campo_col = "periodo"

d_grid(0).campo_col2 = ""

d_grid(0).revisar = False

d_grid(0).clave = True

d_grid(0).insertable = True

d_grid(0).Obligatorio = False

d_grid(0).editable = False

d_grid(1).n_col = 1

d_grid(1).ancho_col = 0

d_grid(1).cabecera_col = ""

d_grid(1).campo_col = "profesor"

d_grid(1).campo_col2 = ""

d_grid(1).revisar = False

d_grid(1).clave = True

d_grid(1).insertable = True

d_grid(1).editable = False

d_grid(1).Obligatorio = False

d_grid(2).n_col = 2

d_grid(2).ancho_col = 0

d_grid(2).cabecera_col = ""

Page 57: Tesis Sistema Informatico de La Escuela 21 de Mayo

18

d_grid(2).campo_col = "fecha"

d_grid(2).campo_col2 = ""

d_grid(2).revisar = False

d_grid(2).clave = True

d_grid(2).insertable = True

d_grid(2).editable = False

d_grid(2).Obligatorio = False

d_grid(3).n_col = 3

d_grid(3).ancho_col = 600

d_grid(3).cabecera_col = "Nº"

d_grid(3).campo_col = "N_lista"

d_grid(3).campo_col2 = ""

d_grid(3).revisar = False

d_grid(3).clave = False

d_grid(3).insertable = False

d_grid(3).editable = False

d_grid(3).Obligatorio = False

d_grid(4).n_col = 4

d_grid(4).ancho_col = 3000

d_grid(4).cabecera_col = "Nomina"

d_grid(4).campo_col = "nombre"

d_grid(4).campo_col2 = ""

d_grid(4).revisar = False

d_grid(4).clave = False

d_grid(4).insertable = False

d_grid(4).editable = False

d_grid(4).Obligatorio = False

d_grid(5).n_col = 5

d_grid(5).ancho_col = 300

d_grid(5).cabecera_col = "A"

d_grid(5).campo_col = "estado2"

d_grid(5).campo_col2 = "estado"

d_grid(5).revisar = True

d_grid(5).clave = False

d_grid(5).insertable = False

d_grid(5).editable = True

d_grid(5).Obligatorio = False

d_grid(6).n_col = 6

d_grid(6).ancho_col = 300

d_grid(6).cabecera_col = "J"

d_grid(6).campo_col = "justificada2"

d_grid(6).campo_col2 = "justificada"

d_grid(6).revisar = True

d_grid(6).clave = False

d_grid(6).insertable = False

d_grid(6).editable = True

d_grid(6).Obligatorio = False

d_grid(7).n_col = 7

Page 58: Tesis Sistema Informatico de La Escuela 21 de Mayo

19

d_grid(7).ancho_col = 300

d_grid(7).cabecera_col = "AT"

d_grid(7).campo_col = "atraso2"

d_grid(7).campo_col2 = "atraso"

d_grid(7).revisar = True

d_grid(7).clave = False

d_grid(7).insertable = False

d_grid(7).editable = True

d_grid(7).Obligatorio = False

d_grid(8).n_col = 8

d_grid(8).ancho_col = 800

d_grid(8).cabecera_col = "H entrada"

d_grid(8).campo_col = "hora_e"

d_grid(8).campo_col2 = ""

d_grid(8).revisar = flase

d_grid(8).clave = False

d_grid(8).insertable = True

d_grid(8).editable = True

d_grid(8).Obligatorio = True

d_grid(9).n_col = 9

d_grid(9).ancho_col = 800

d_grid(9).cabecera_col = "H Salida"

d_grid(9).campo_col = "hora_s"

d_grid(9).campo_col2 = ""

d_grid(9).revisar = False

d_grid(9).clave = False

d_grid(9).insertable = True

d_grid(9).editable = True

d_grid(9).Obligatorio = True

d_grid(10).n_col = 10

d_grid(10).ancho_col = 4000

d_grid(10).cabecera_col = "Observacion"

d_grid(10).campo_col = "Observacion"

d_grid(10).campo_col2 = ""

d_grid(10).revisar = False

d_grid(10).clave = False

d_grid(10).insertable = True

d_grid(10).editable = True

d_grid(10).Obligatorio = False

d_grid(11).n_col = 11

d_grid(11).ancho_col = 0

d_grid(11).cabecera_col = "estado2"

d_grid(11).campo_col = "estado"

d_grid(11).campo_col2 = ""

d_grid(11).revisar = True

d_grid(11).clave = False

d_grid(11).insertable = True

d_grid(11).editable = False

Page 59: Tesis Sistema Informatico de La Escuela 21 de Mayo

20

d_grid(11).Obligatorio = False

d_grid(12).n_col = 12

d_grid(12).ancho_col = 0

d_grid(12).cabecera_col = "justificada2"

d_grid(12).campo_col = "justificada"

d_grid(12).campo_col2 = ""

d_grid(12).revisar = True

d_grid(12).clave = False

d_grid(12).insertable = True

d_grid(12).editable = False

d_grid(12).Obligatorio = False

d_grid(13).n_col = 13

d_grid(13).ancho_col = 0

d_grid(13).cabecera_col = "atraso2"

d_grid(13).campo_col = "atraso"

d_grid(13).campo_col2 = ""

d_grid(13).revisar = True

d_grid(13).clave = False

d_grid(13).insertable = True

d_grid(13).editable = False

d_grid(13).Obligatorio = False

End Sub

Private Sub CONF_GRID()

Dim I As Integer

GRID.Rows = 2

For I = 0 To GRID.Cols - 1

GRID.ColWidth(I) = d_grid(I).ancho_col

GRID.TextMatrix(0, I) = d_grid(I).cabecera_col

Next

GRID.FixedCols = col_nombre("N_lista") + 1

End Sub

Private Sub GRID_Click()

Dim a_tex As String

txt.Visible = False

txt2.Visible = False

a_col = GRID.col

a_fil = GRID.Row

cmd_entrada.Enabled = False

cmd_salida.Enabled = False

If d_grid(GRID.col).editable = False Then

lbl_nombre.Caption = GRID.TextMatrix(a_fil, col_nombre("nombre"))

If GRID.TextMatrix(a_fil, col_nombre("hora_e")) = "00:00:00" Then

cmd_entrada.Enabled = True

ElseIf GRID.TextMatrix(a_fil, col_nombre("hora_s")) = "00:00:00" Then

cmd_salida.Enabled = True

End If

Else

Page 60: Tesis Sistema Informatico de La Escuela 21 de Mayo

21

a_col = GRID.col

a_fil = GRID.Row

If d_grid(GRID.col).revisar = False Then

a_tex = ""

txt.Visible = False

txt2.Visible = False

If d_grid(GRID.col).Obligatorio = False Then

txt.Top = GRID.Top + GRID.CellTop

txt.Left = GRID.Left + GRID.CellLeft

txt.Width = GRID.CellWidth - 10

txt.Height = GRID.CellHeight - 10

txt.TEXT = GRID.TextMatrix(a_fil, a_col)

txt.Visible = True

txt.SetFocus

txt.SelLength = Len(txt.TEXT)

End If

'Else

' txt2.Top = GRID.Top + GRID.CellTop

' txt2.Left = GRID.Left + GRID.CellLeft

' txt2.Width = GRID.CellWidth - 10

' txt2.Height = GRID.CellHeight - 10

' txt2.TEXT = GRID.TextMatrix(a_fil, a_col)

' txt2.Visible = True

' txt2.SetFocus

' txt2.SelLength = Len(txt.TEXT)

'End If

Else

If GRID.TextMatrix(a_fil, col_nombre(d_grid(GRID.col).campo_col2)) =

"S" Then

GRID.TextMatrix(a_fil, col_nombre(d_grid(GRID.col).campo_col2)) =

"N"

Set GRID.CellPicture = LoadPicture(App.Path & "\iconos\chkno.bmp")

Else

GRID.TextMatrix(a_fil, col_nombre(d_grid(GRID.col).campo_col2)) =

"S"

Set GRID.CellPicture = LoadPicture(App.Path & "\iconos\chksi.bmp")

End If

End If

End If

End Sub

Private Sub GRID_KeyPress(KeyAscii As Integer)

If KeyAscii = vbKeySpace Then

GRID_Click

End If

Page 61: Tesis Sistema Informatico de La Escuela 21 de Mayo

22

End Sub

Private Sub MaskEdBox1_Change()

End Sub

Private Sub Timer1_Timer()

lbl_hora.Caption = Time

End Sub

Private Sub txt_Change()

On Error Resume Next

GRID.TextMatrix(a_fil, a_col) = txt.TEXT

End Sub

Private Sub txt_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txt2_Change()

On Error Resume Next

GRID.TextMatrix(a_fil, a_col) = txt2.TEXT

End Sub

Private Sub txt2_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.6 FORMULARIO BLOQUEO DE SISTEMA

Private Sub cmb_usuarios_Click()

Cod_usuario = ExtraeIDCombo(cmb_usuarios)

End Sub

Private Sub cmdCancel_Click()

If base.State = 1 Then

base.Close

End If

End

End Sub

Private Sub cmdOK_Click()

Dim STRSQL As String

If cmb_usuarios.ListIndex = -1 Then Exit Sub

Page 62: Tesis Sistema Informatico de La Escuela 21 de Mayo

23

STRSQL = "SELECT COUNT(*) as total FROM USUARIOS WHERE

codigo='" & ExtraeIDCombo(cmb_usuarios) & "' and upper(clave) = '" &

UCase(txt_clave.TEXT) & "'"

Set tabla = base.Execute(STRSQL)

If tabla.Fields(0).Value > 0 Then

tabla.Close

Set tabla = Nothing

Unload Me

Exit Sub

End If

txt_clave.TEXT = ""

MsgBox ("datos Incorrectos")

tabla.Close

Set tabla = Nothing

End Sub

Private Sub Form_Load()

'cod_usu = Leer_Ini(ruta_ini, "usuario", "")

LLENACOMBO cmb_usuarios, "select codigo,nombre from usuarios"

End Sub

1.7 FORMULARIO DE CONFIGURACION DE MATERIAS A GRADO

Private Sub cmb_grado_Click()

If cmb_grado.ListIndex = -1 Then Exit Sub

LLENACOMBO List_materi_grado, "select codigo,nombre from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_GRADO WHERE

periodo='" & Gperiodo & "' and grado='" & ExtraeIDCombo(cmb_grado) & "')"

End Sub

Private Sub EjecutaSQL(cade As String)

On Error GoTo SALIR2

base.Execute (cade)

Exit Sub

SALIR2:

ERRORES

End Sub

Private Sub cmd_guardar_Click()

Dim SQL1 As String

Dim SQL2 As String

Dim MAX_COD As Integer

If cmb_grado.ListIndex = -1 Then Exit Sub

If list_aux.ListCount > 0 Then

For I = 0 To list_aux.ListCount - 1

list_aux.ListIndex = I

Page 63: Tesis Sistema Informatico de La Escuela 21 de Mayo

24

SQL1 = "DELETE FROM MATERIA_GRADO WHERE PERIODO='" &

Gperiodo & "' AND materia='" & ExtraeIDCombo(list_aux) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "'"

EjecutaSQL SQL1

Next

list_aux.Clear

End If

If List_materi_grado.ListCount > 0 Then

For I = 0 To List_materi_grado.ListCount - 1

List_materi_grado.ListIndex = I

SQL1 = "SELECT COUNT(*) AS UNOS FROM MATERIA_GRADO

WHERE PERIODO='" & Gperiodo & "' AND materia='" &

ExtraeIDCombo(List_materi_grado) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "'"

Set tabla = base.Execute(SQL1)

If tabla.Fields(0).Value = 0 Then 'NO EXISTE

SQL2 = "INSERT INTO

MATERIA_GRADO(PERIODO,GRADO,MATERIA) VALUES('" & Gperiodo

& "','" & ExtraeIDCombo(cmb_grado) & "','" &

ExtraeIDCombo(List_materi_grado) & "')"

EjecutaSQL SQL2

End If

tabla.Close

Set tabla = Nothing

Next

End If

End Sub

Private Sub cmd_pasauno_Click()

If cmb_grado.ListIndex = -1 Then Exit Sub

If list_materias.ListIndex = -1 Then Exit Sub

If EXISTE_ITEM(List_materi_grado, CLng(ExtraeIDCombo(list_materias))) =

True Then Exit Sub

List_materi_grado.AddItem list_materias.TEXT

List_materi_grado.ItemData(List_materi_grado.NewIndex) =

ExtraeIDCombo(list_materias)

'list_materias.RemoveItem (list_materias.ListIndex)

End Sub

Private Sub cmd_quitatodo_Click()

For I = 0 To List_materi_grado.ListCount - 1

List_materi_grado.ListIndex = I

list_aux.AddItem List_materi_grado.TEXT

list_aux.ItemData(list_aux.NewIndex) = ExtraeIDCombo(List_materi_grado)

Next

List_materi_grado.Clear

End Sub

Page 64: Tesis Sistema Informatico de La Escuela 21 de Mayo

25

Private Sub cmd_quitauno_Click()

If List_materi_grado.ListIndex = -1 Then Exit Sub

list_aux.AddItem List_materi_grado.TEXT

list_aux.ItemData(list_aux.NewIndex) = ExtraeIDCombo(List_materi_grado)

List_materi_grado.RemoveItem (List_materi_grado.ListIndex)

End Sub

Private Sub Form_Load()

Me.Top = 0

Me.Left = 10

coloca_tolti Me

LLENACOMBO cmb_grado, "select codigo,nombre from grados"

LLENACOMBO list_materias, "select codigo,nombre from materias" ' order by

nombre"

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Public Sub SALIR()

Unload Me

End Sub

Private Sub list_materias_Click()

list_materias.ToolTipText = ExtraeIDCombo(list_materias)

End Sub

1.8 FORMULARIO DE REGISTRO DE MATERIAS

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim retorna As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Public Sub Set_Retorna(valor As String)

retorna = valor

End Sub

Page 65: Tesis Sistema Informatico de La Escuela 21 de Mayo

26

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_buscar_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,NOMBRE FROM materias "

Busqueda_where " WHERE codigo+NOMBRE "

Busqueda_orden "2"

Busqueda_Ncampos 2

Busqueda_campos 0, "Codigo", 20

Busqueda_campos 1, "Nombre de Materia", 80

Busqueda_indice 0

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

LLenaDatosForm 0, Busqueda.retorna

End If

Exit Sub

SALIR:

ERRORES

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Elimna_reg

Page 66: Tesis Sistema Informatico de La Escuela 21 de Mayo

27

End Sub

Private Sub cmd_guardar_Click()

Guardar

End Sub

Private Sub cmd_nuevo_Click()

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_Load()

filtro = ""

'LLENACOMBO cmb_area, "Select codigo,nombre from areas order by nombre"

strtabla = "materias"

camposKP = "|codigo|"

nuevo_reg = "codigo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub txtnombre_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.9 FORMULARIOS CONFIGURACION MATERIAS PROFESOR

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim d_grid(100) As DATOS_GRID

Dim a_col As Integer

Dim a_fil As Integer

Public Function Get_filtro() As String

Page 67: Tesis Sistema Informatico de La Escuela 21 de Mayo

28

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmb_grado_Click()

If cmb_grado.ListIndex = -1 Then Exit Sub

If GRID.TextMatrix(a_fil, col_nombre("grado")) <>

ExtraeIDCombo(cmb_grado) Then

GRID.TextMatrix(a_fil, col_nombre("grado")) = ExtraeIDCombo(cmb_grado)

GRID.TextMatrix(a_fil, col_nombre("Ngrado")) = cmb_grado.TEXT

GRID.TextMatrix(a_fil, col_nombre("materia")) = ""

GRID.TextMatrix(a_fil, col_nombre("Nmateria")) = ""

GRID.TextMatrix(a_fil, col_nombre("paralelo")) = ""

GRID.TextMatrix(a_fil, col_nombre("Nparalelo")) = ""

End If

End Sub

Private Sub cmb_materias_Click()

If cmb_materias.ListIndex = -1 Then Exit Sub

GRID.TextMatrix(a_fil, col_nombre("materia")) =

ExtraeIDCombo(cmb_materias)

GRID.TextMatrix(a_fil, col_nombre("Nmateria")) = cmb_materias.TEXT

End Sub

Private Sub cmb_paralelo_Click()

If cmb_paralelo.ListIndex = -1 Then Exit Sub

GRID.TextMatrix(a_fil, col_nombre("paralelo")) =

ExtraeIDCombo(cmb_paralelo)

GRID.TextMatrix(a_fil, col_nombre("Nparalelo")) = cmb_paralelo.TEXT

End Sub

Page 68: Tesis Sistema Informatico de La Escuela 21 de Mayo

29

Private Sub cmb_profesor_Click()

procesar

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_cancelar_Click()

'LLenaDatosForm

End Sub

Private Sub cmd_eliminar_Click()

cmb_grado.Visible = False

cmb_materias.Visible = False

cmb_paralelo.Visible = False

ELIMINA_ITEM_GRID GRID.Row

End Sub

Private Sub cmd_guardar_Click()

Dim SQL1 As String

Dim FILA, I As Integer

If cmb_profesor.ListIndex = -1 Then Exit Sub

cmb_grado.Visible = False

cmb_materias.Visible = False

cmb_paralelo.Visible = False

For I = 1 To GRID_RES.Rows - 1

If VALIDAR_ELIMINAR(I) = True Then

SQL1 = genera_DELETE(I)

EjecutaSQL SQL1

End If

Next

LIMPIA_GRID_RES

I = 1

If GRID.TextMatrix(I, col_nombre("grado")) <> "" And GRID.TextMatrix(I,

col_nombre("paralelo")) <> "" And GRID.TextMatrix(I, col_nombre("materia"))

<> "" Then

If GRID.TextMatrix(I, col_nombre("periodo")) = "" And GRID.TextMatrix(I,

col_nombre("profesor")) = "" Then

GRID.TextMatrix(I, col_nombre("periodo")) = Gperiodo

GRID.TextMatrix(I, col_nombre("profesor")) =

ExtraeIDCombo(cmb_profesor)

End If

End If

For I = 1 To GRID.Rows - 1

If VALIDAR(I) = True Then

If EXITE_NOTA(I) = False And MODIFICADO(I) = False Then

Page 69: Tesis Sistema Informatico de La Escuela 21 de Mayo

30

SQL1 = genera_INSERT(I)

Else

SQL1 = genera_UPDATE(I)

End If

EjecutaSQL SQL1

End If

Next

End Sub

Private Sub EjecutaSQL(cade As String)

On Error GoTo SALIR2

base.Execute (cade)

Exit Sub

SALIR2:

ERRORES

End Sub

Private Function MODIFICADO(FILA As Integer) As Boolean

MODIFICADO = False

Dim I As Integer

For I = 0 To GRID.Cols - 1

If d_grid(I).revisar = True Then

If GRID.TextMatrix(FILA, col_nombre(d_grid(I).campo_col)) = "" Then

Exit Function

End If

Next

For I = 0 To GRID.Cols - 1

If d_grid(I).revisar = True Then

If GRID.TextMatrix(FILA, col_nombre(d_grid(I).cabecera_col)) <>

GRID.TextMatrix(FILA, col_nombre(d_grid(I).campo_col)) Then

MODIFICADO = True

Exit Function

End If

End If

Next

End Function

Private Function ELIMINABLE(FILA As Integer) As Boolean

ELIMINABLE = False

Dim I As Integer

For I = 0 To GRID.Cols - 1

If d_grid(I).revisar = True Then

If GRID.TextMatrix(FILA, col_nombre(d_grid(I).cabecera_col)) = ""

Then Exit Function

End If

Next

ELIMINABLE = True

End Function

Private Function VALIDAR_ELIMINAR(FILA As Integer) As Boolean

VALIDAR_ELIMINAR = False

Dim I As Integer

Page 70: Tesis Sistema Informatico de La Escuela 21 de Mayo

31

For I = 0 To GRID_RES.Cols - 1

If d_grid(I).revisar = True Then

If GRID_RES.TextMatrix(FILA, I) = "" Then Exit Function

End If

Next

VALIDAR_ELIMINAR = True

End Function

Private Function VALIDAR(FILA As Integer) As Boolean

VALIDAR = False

Dim I As Integer

For I = 0 To GRID.Cols - 1

If d_grid(I).Obligatorio = True Then

If GRID.TextMatrix(FILA, I) = "" Then Exit Function

End If

Next

VALIDAR = True

End Function

Private Sub cmd_nuevo_Click()

'Nuevo

If cmb_profesor.ListIndex = -1 Then Exit Sub

cmb_grado.Visible = False

cmb_materias.Visible = False

cmb_paralelo.Visible = False

GRID.Rows = GRID.Rows + 1

GRID.TextMatrix(GRID.Rows - 1, col_nombre("profesor")) =

ExtraeIDCombo(cmb_profesor)

GRID.TextMatrix(GRID.Rows - 1, col_nombre("periodo")) = Gperiodo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Form_Load()

Me.Top = 0

Me.Left = 10

coloca_tolti Me

LLENACOMBO cmb_profesor, "select codigo,nombre from profesor"

LLENACOMBO cmb_grado, "select codigo,nombre from grados"

strtabla = "materia_profesor"

Page 71: Tesis Sistema Informatico de La Escuela 21 de Mayo

32

DAT_grid

CONF_GRID

'If cmb_cursos.ListCount > 0 Then cmb_cursos.ListIndex = 0

'Set FRM = Me

'LLenaDatosForm

End Sub

Private Sub DAT_grid()

GRID.Cols = 11

GRID_RES.Cols = 11

d_grid(0).n_col = 0

d_grid(0).ancho_col = 0

d_grid(0).cabecera_col = "profesor"

d_grid(0).campo_col = "profesor"

d_grid(0).editable = False

d_grid(0).clave = True

d_grid(0).insertable = True

d_grid(0).revisar = True

d_grid(0).Obligatorio = True

d_grid(1).n_col = 1

d_grid(1).ancho_col = 0

d_grid(1).cabecera_col = ""

d_grid(1).campo_col = "grado"

d_grid(1).editable = False

d_grid(1).clave = True

d_grid(1).insertable = True

d_grid(1).revisar = False

d_grid(1).Obligatorio = True

d_grid(2).n_col = 2

d_grid(2).ancho_col = 0

d_grid(2).cabecera_col = ""

d_grid(2).campo_col = "paralelo"

d_grid(2).editable = False

d_grid(2).clave = True

d_grid(2).insertable = True

d_grid(2).revisar = False

d_grid(2).Obligatorio = True

d_grid(3).n_col = 3

d_grid(3).ancho_col = 0

d_grid(3).cabecera_col = ""

d_grid(3).campo_col = "materia"

d_grid(3).editable = False

d_grid(3).clave = True

d_grid(3).insertable = True

d_grid(3).revisar = False

d_grid(3).Obligatorio = True

d_grid(4).n_col = 4

d_grid(4).ancho_col = 2000

Page 72: Tesis Sistema Informatico de La Escuela 21 de Mayo

33

d_grid(4).cabecera_col = "Grado"

d_grid(4).campo_col = "Ngrado"

d_grid(4).editable = True

d_grid(4).clave = False

d_grid(4).insertable = False

d_grid(4).revisar = False

d_grid(4).Obligatorio = False

d_grid(5).n_col = 5

d_grid(5).ancho_col = 4000

d_grid(5).cabecera_col = "Materia"

d_grid(5).campo_col = "Nmateria"

d_grid(5).editable = True

d_grid(5).clave = False

d_grid(5).insertable = False

d_grid(5).revisar = False

d_grid(5).Obligatorio = False

d_grid(6).n_col = 6

d_grid(6).ancho_col = 1000

d_grid(6).cabecera_col = "Paralelo"

d_grid(6).campo_col = "Nparalelo"

d_grid(6).editable = True

d_grid(6).clave = False

d_grid(6).insertable = False

d_grid(6).revisar = False

d_grid(6).Obligatorio = False

d_grid(7).n_col = 7

d_grid(7).ancho_col = 0

d_grid(7).cabecera_col = "periodo"

d_grid(7).campo_col = "periodo"

d_grid(7).editable = True

d_grid(7).clave = True

d_grid(7).insertable = True

d_grid(7).revisar = True

d_grid(7).Obligatorio = True

d_grid(8).n_col = 8

d_grid(8).ancho_col = 0

d_grid(8).cabecera_col = "grado"

d_grid(8).campo_col = "grado2"

d_grid(8).editable = False

d_grid(8).clave = False

d_grid(8).insertable = False

d_grid(8).revisar = True

d_grid(8).Obligatorio = False

d_grid(9).n_col = 9

d_grid(9).ancho_col = 0

d_grid(9).cabecera_col = "paralelo"

d_grid(9).campo_col = "paralelo2"

d_grid(9).editable = False

Page 73: Tesis Sistema Informatico de La Escuela 21 de Mayo

34

d_grid(9).clave = False

d_grid(9).insertable = False

d_grid(9).revisar = True

d_grid(9).Obligatorio = False

d_grid(10).n_col = 10

d_grid(10).ancho_col = 0

d_grid(10).cabecera_col = "materia"

d_grid(10).campo_col = "materia2"

d_grid(10).editable = False

d_grid(10).clave = False

d_grid(10).insertable = False

d_grid(10).revisar = True

d_grid(10).Obligatorio = False

End Sub

Private Sub CONF_GRID()

Dim I As Integer

GRID.Rows = 2

For I = 0 To GRID.Cols - 1

GRID.ColWidth(I) = d_grid(I).ancho_col

GRID.TextMatrix(0, I) = d_grid(I).cabecera_col

Next

End Sub

Private Sub GRID_Click()

Dim a_tex As String

'On Error Resume Next

If cmb_profesor.ListIndex = -1 Then Exit Sub

If d_grid(GRID.col).editable = False Then Exit Sub

a_col = GRID.col

a_fil = GRID.Row

If GRID.col = col_nombre("Ngrado") Then

cmb_materias.Visible = False

cmb_paralelo.Visible = False

cmb_grado.Visible = False

cmb_grado.Top = GRID.Top + GRID.CellTop

cmb_grado.Left = GRID.Left + GRID.CellLeft

cmb_grado.Width = GRID.CellWidth - 10

'cmb_grado.Height = GRID.CellHeight - 10

cmb_grado.ListIndex = IndexList(cmb_grado, CLng(valor_celda(a_fil,

"grado")))

cmb_grado.Visible = True

Exit Sub

End If

If GRID.col = col_nombre("Nmateria") And valor_celda(a_fil, "grado") <> 0

Then

LLENACOMBO cmb_materias, "select codigo,nombre from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_GRADO WHERE

periodo='" & Gperiodo & "' and grado='" & valor_celda(a_fil, "grado") & "')"

Page 74: Tesis Sistema Informatico de La Escuela 21 de Mayo

35

cmb_materias.Visible = False

cmb_paralelo.Visible = False

cmb_grado.Visible = False

cmb_materias.Top = GRID.Top + GRID.CellTop

cmb_materias.Left = GRID.Left + GRID.CellLeft

cmb_materias.Width = GRID.CellWidth - 10

cmb_materias.ListIndex = IndexList(cmb_materias, CLng(valor_celda(a_fil,

"materia")))

cmb_materias.Visible = True

Exit Sub

End If

If GRID.col = col_nombre("Nparalelo") And valor_celda(a_fil, "grado") <> 0

Then

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & valor_celda(a_fil, "grado") & "' and periodo='" & Gperiodo & "'"

cmb_materias.Visible = False

cmb_paralelo.Visible = False

cmb_grado.Visible = False

cmb_paralelo.Top = GRID.Top + GRID.CellTop

cmb_paralelo.Left = GRID.Left + GRID.CellLeft

cmb_paralelo.Width = GRID.CellWidth - 10

cmb_paralelo.ListIndex = IndexList(cmb_paralelo, CLng(valor_celda(a_fil,

"paralelo")))

cmb_paralelo.Visible = True

End If

End Sub

Private Sub txt_Change()

GRID.TextMatrix(a_fil, a_col) = txt.TEXT

End Sub

Private Sub GUARDA_GRID()

Dim I, mayor As Integer

Dim SQLSTR As String

Set tabla = base.Execute("select isnull(max(cast(" & nuevo_reg & " as integer)),0)

+ 1 as nuevo from " & strtabla)

mayor = tabla.Fields(0).Value

tabla.Close

Set tabla = Nothing

For I = 1 To GRID.Rows - 1

If GRID.TextMatrix(I, 0) = "" Then 'hay que insertar

SQLSTR = "INSERT INTO " & strtabla & "(codigo,grado,periodo,nombre)

Values ('" & mayor & "','" & GRID.TextMatrix(I, 1) & "','" &

GRID.TextMatrix(I, 2) & "','" & GRID.TextMatrix(I, 3) & "')"

GRID.TextMatrix(I, 0) = mayor

mayor = mayor + 1

Else ' hay que actualizar

SQLSTR = "UPDATE " & strtabla & " set nombre='" & GRID.TextMatrix(I,

3) & "' where codigo='" & GRID.TextMatrix(I, 0) & "'"

Page 75: Tesis Sistema Informatico de La Escuela 21 de Mayo

36

End If

base.Execute (SQLSTR)

Next

End Sub

Private Sub BORRA_DATOS_GRID()

Dim I, c As Integer

Dim SQLSTR As String

For I = 1 To GRID_RES.Rows - 1

If GRID_RES.TextMatrix(I, 0) <> "" Then

SQLSTR = "DELETE FROM " & strtabla & " WHERE codigo='" &

GRID_RES.TextMatrix(I, 0) & "'"

base.Execute (SQLSTR)

End If

Next

GRID_RES.Rows = 2

For c = 0 To GRID_RES.Cols - 1

GRID_RES.TextMatrix(1, c) = ""

Next

End Sub

Private Sub CARGA_GRID(nombre As String, FILA As Integer, valor As

Variant)

Dim I As Integer

For I = 0 To GRID.Cols - 1

If d_grid(I).campo_col = nombre Then

GRID.TextMatrix(FILA, d_grid(I).n_col) = valor

End If

Next

End Sub

Private Sub ELIMINA_ITEM_GRID(FILA As Integer)

Dim c, f As Integer

If ELIMINABLE(FILA) = True Then

If GRID_RES.TextMatrix(GRID_RES.Rows - 1, 0) <> "" Then

GRID_RES.Rows = GRID_RES.Rows + 1

End If

f = GRID_RES.Rows - 1

For c = 0 To GRID.Cols - 1

GRID_RES.TextMatrix(f, c) = GRID.TextMatrix(FILA, c)

Next

End If

If GRID.Rows > 2 Then

For f = FILA To GRID.Rows - 2

For c = 0 To GRID.Cols - 1

GRID.TextMatrix(f, c) = GRID.TextMatrix(f + 1, c)

Next

Next

GRID.Rows = GRID.Rows - 1

Else

LIMPIA_GRID

Page 76: Tesis Sistema Informatico de La Escuela 21 de Mayo

37

End If

End Sub

Private Function EXITE_NOTA(FILA As Integer) As Boolean

Dim SQL1, strand As String

strand = " "

EXITE_NOTA = False

SQL1 = "select count(*) as UNOS from " & strtabla & " where "

For I = 0 To GRID.Cols - 1

If d_grid(I).clave = True Then

SQL1 = SQL1 & strand & d_grid(I).campo_col & " = '" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

Set tabla = base.Execute(SQL1)

If tabla.Fields(0).Value <> 0 Then

EXITE_NOTA = True

End If

tabla.Close

Set tabla = Nothing

End Function

Private Function genera_INSERT(FILA As Integer) As String

Dim SQL1, SQL2, strCOMA As String

strCOMA = " "

SQL1 = "INSERT INTO " & strtabla & "("

SQL2 = " VALUES ("

For I = 0 To GRID.Cols - 1

If d_grid(I).insertable = True Then

SQL1 = SQL1 & strCOMA & d_grid(I).campo_col

SQL2 = SQL2 & strCOMA & "'" & GRID.TextMatrix(FILA,

d_grid(I).n_col) & "'"

strCOMA = ","

End If

Next

SQL1 = SQL1 & ") "

SQL2 = SQL2 & ") "

SQL1 = SQL1 & SQL2

genera_INSERT = SQL1

End Function

Private Function genera_UPDATE(FILA As Integer) As String

Dim SQL1, SQL2, strCOMA, strand As String

strCOMA = " "

strand = " "

SQL1 = "UPDATE " & strtabla & " set "

SQL2 = " WHERE "

For I = 0 To GRID.Cols - 1

If d_grid(I).insertable = True And d_grid(I).revisar = False Then

Page 77: Tesis Sistema Informatico de La Escuela 21 de Mayo

38

SQL1 = SQL1 & strCOMA & d_grid(I).campo_col & "='" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strCOMA = ","

End If

If d_grid(I).revisar = True Then

SQL2 = SQL2 & strand & d_grid(I).cabecera_col & " = '" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

SQL1 = SQL1 & " "

SQL2 = SQL2 & " "

SQL1 = SQL1 & SQL2

genera_UPDATE = SQL1

End Function

Private Function genera_DELETE(FILA As Integer) As String

Dim SQL1, SQL2, strCOMA, strand As String

strCOMA = " "

strand = " "

SQL2 = "DELETE FROM " & strtabla & " WHERE "

For I = 0 To GRID_RES.Cols - 1

If d_grid(I).revisar = True Then

SQL2 = SQL2 & strand & d_grid(I).cabecera_col & " = '" &

GRID_RES.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

genera_DELETE = SQL2

End Function

Private Function valor_celda(FILA As Integer, nombre As String) As Integer

Dim I As Integer

valor_celda = -1

For I = 0 To GRID.Cols - 1

If UCase(d_grid(I).campo_col) = UCase(nombre) Then

valor_celda = Val(GRID.TextMatrix(FILA, d_grid(I).n_col))

Exit Function

End If

Next

End Function

Private Function col_nombre(nombre As String) As Integer

Dim I As Integer

For I = 0 To GRID.Cols - 1

If UCase(d_grid(I).campo_col) = UCase(nombre) Then

col_nombre = d_grid(I).n_col

Exit Function

End If

Next

Page 78: Tesis Sistema Informatico de La Escuela 21 de Mayo

39

End Function

Private Sub procesar()

Dim SQL1, SQL2 As String

Dim FILA As Integer

LIMPIA_GRID

LIMPIA_GRID_RES

cmb_grado.Visible = False

cmb_materias.Visible = False

cmb_paralelo.Visible = False

If cmb_profesor.ListIndex = -1 Then Exit Sub

SQL1 = "select

MP.materia,MP.profesor,MP.paralelo,MP.grado,MP.periodo,(select nombre from

materias where codigo=MP.materia ) as Nmateria,(select nombre from grados

where codigo=MP.grado) as Ngrado,(select nombre from paralelo where

codigo=MP.paralelo ) as Nparalelo,MP.materia as materia2,MP.paralelo as

paralelo2,MP.grado as grado2 FROM MATERIA_profesor MP where periodo='"

& Gperiodo & "' and profesor='" & ExtraeIDCombo(cmb_profesor) & "'"

Set tabla = base.Execute(SQL1)

If tabla.EOF = True Then

tabla.Close

Set tabla = Nothing

Exit Sub

End If

FILA = 1

Do Until tabla.EOF = True

For I = 0 To tabla.Fields.Count - 1

CARGA_GRID tabla.Fields.Item(I).Name, FILA, tabla.Fields(I).Value

Next

tabla.MoveNext

If tabla.EOF = False Then

FILA = FILA + 1

GRID.Rows = GRID.Rows + 1

End If

Loop

tabla.Close

Set tabla = Nothing

End Sub

Private Sub LIMPIA_GRID()

Dim I, c As Integer

GRID.Rows = 2

For c = 0 To GRID.Cols - 1

GRID.TextMatrix(1, c) = ""

Next

End Sub

Private Sub LIMPIA_GRID_RES()

Dim I, c As Integer

GRID_RES.Rows = 2

Page 79: Tesis Sistema Informatico de La Escuela 21 de Mayo

40

For c = 0 To GRID_RES.Cols - 1

GRID_RES.TextMatrix(1, c) = ""

Next

End Sub

1.10 FORMULARIOS REGISTRO DE MATRICULAS

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim opcion_foto As String

Dim filtro As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmb_grado_Click()

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" & Gperiodo & "'"

End Sub

Private Sub cmd_anterior_Click()

Page 80: Tesis Sistema Informatico de La Escuela 21 de Mayo

41

'cmb_grado.Locked = False

LLenaDatosForm 3

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

End Sub

Private Sub cmd_busca_estudiante_Click()

On Error GoTo SALIR

If eti_matricula.Caption = "" Then Exit Sub

Busqueda_sql "SELECT codigo,NOMBREs,telefono,direccion FROM estudiante

"

Busqueda_where " WHERE codigo+NOMBREs "

Busqueda_orden "2"

Busqueda_Ncampos 4

Busqueda_campos 0, "Codigo", 5

Busqueda_campos 1, "Nombre", 40

Busqueda_campos 2, "Telefono", 15

Busqueda_campos 3, "Direccion", 40

Busqueda_indice 0

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

If ALUMN_MATRICULADO(Busqueda.retorna) = False Then

txt_estudiante.TEXT = Busqueda.retorna

GRAGO_SIGUIENTE

End If

End If

Exit Sub

SALIR:

ERRORES

End Sub

Private Function ALUMN_MATRICULADO(estu As String) As Boolean

Dim matri As String

Dim SQL12 As String

ALUMN_MATRICULADO = False

SQL12 = "select codigo from matricula where periodo='" & Gperiodo & "' and

estudiante='" & estu & "'"

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

matri = tabla_aux.Fields(0).Value

MsgBox "El Alumno ya esta Matriculado en la Matricula Nº: " & matri,

vbInformation, "SISTEMA"

ALUMN_MATRICULADO = True

End If

tabla_aux.Close

Set tabla_aux = Nothing

End Function

Page 81: Tesis Sistema Informatico de La Escuela 21 de Mayo

42

Private Function EXISTE_MATRICULA(MATRICU As String) As Boolean

Dim matri As String

Dim SQL12 As String

EXISTE_MATRICULA = False

SQL12 = "select codigo from matricula where periodo='" & Gperiodo & "' and

CODIGO='" & MATRICU & "'"

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

matri = tabla_aux.Fields(0).Value

EXISTE_MATRICULA = True

End If

tabla_aux.Close

Set tabla_aux = Nothing

End Function

Private Sub GRAGO_SIGUIENTE()

Dim tabla_rep As New ADODB.Recordset

Dim SQL12 As String

Dim I As Integer

Dim matri, grado, periodo, para, estado As String

SQL12 = "select top 1 codigo,grado,periodo,paralelo,estado from matricula where

estudiante='" & txt_estudiante.TEXT & "' order by grado desc"

Set tabla_aux = base.Execute(SQL12)

'cmb_grado.Locked = False

If tabla_aux.EOF = False Then

matri = tabla_aux.Fields(0).Value

grado = tabla_aux.Fields(1).Value

periodo = tabla_aux.Fields(2).Value

para = tabla_aux.Fields(3).Value

estado = tabla_aux.Fields(4).Value

If estado = "N" Then 'avansa al siguiente grado

grado = CLng(grado) + 1

cmb_grado.ListIndex = IndexList(cmb_grado, CLng(grado))

tabla_aux.Close

Set tabla_aux = Nothing

'cmb_grado.Locked = True

Exit Sub

End If

LLENACOMBO cmb_materia, "select codigo,abreviatura from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_GRADO WHERE

periodo='" & periodo & "' and grado='" & grado & "')"

For I = 0 To cmb_materia.ListCount - 1

cmb_materia.ListIndex = I

SQL1 = "select M2.codigo as

matricula,total=M2.promedio1+M2.promedio2+M2.promedio3 from (SELECT

promedio1=isnull((select promedio2 from notas where periodo=M.periodo and

matricula=M.codigo and trimestre='1' and materia='" &

Page 82: Tesis Sistema Informatico de La Escuela 21 de Mayo

43

ExtraeIDCombo(cmb_materia) & "'),0),promedio2=isnull((select promedio2 from

notas where periodo=M.periodo and matricula=M.codigo and trimestre='2' and

materia='" & ExtraeIDCombo(cmb_materia) & "'),0),promedio3=isnull((select

promedio2 from notas where periodo=M.periodo and matricula=M.codigo and

trimestre='3' and materia='" & ExtraeIDCombo(cmb_materia) & "'),0),M.codigo

as Codigo,M.periodo as periodo,M.grado as grado,M.paralelo as paralelo FROM

MATRICULA M) M2 "

SQL1 = SQL1 & " where M2.codigo='" & matri & "' and M2.periodo='" &

periodo & "' and M2.grado='" & grado & "' and M2.paralelo='" & para & "' "

Set tabla_rep = base.Execute(SQL1)

Do Until tabla_rep.EOF = True

If tabla_rep.Fields(1).Value < CInt(NOTA_APRUEBA) Then

cmb_grado.ListIndex = IndexList(cmb_grado, CLng(grado))

tabla_rep.Close

Set tabla_rep = Nothing

tabla_aux.Close

Set tabla_aux = Nothing

'cmb_grado.Locked = True

Exit Sub

End If

tabla_rep.MoveNext

Loop

tabla_rep.Close

Set tabla_rep = Nothing

Next

cmb_grado.ListIndex = IndexList(cmb_grado, (CLng(grado) + 1))

Else

cmb_grado.ListIndex = IndexList(cmb_grado, 1)

End If

tabla_aux.Close

Set tabla_aux = Nothing

'cmb_grado.Locked = True

End Sub

Private Sub cmd_buscar_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT M.CODIGO,M.NOMBRE,M.FECHA FROM (SELECT

codigo as codigo,nombre=(select nombres from estudiante where

matricula.estudiante=codigo),fecha as fecha FROM matricula where periodo='" &

Gperiodo & "' and estado='S') M "

Busqueda_where "WHERE M.codigo + M.NOMBRE "

Busqueda_orden "2"

Busqueda_Ncampos 3

Busqueda_campos 0, "Codigo", 10

Busqueda_campos 1, "Nombre", 60

Busqueda_campos 2, "Fecha", 30

Busqueda_indice 0

Load frmbusqueda

Page 83: Tesis Sistema Informatico de La Escuela 21 de Mayo

44

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

'cmb_grado.Locked = False

LLenaDatosForm 0, Busqueda.retorna

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

End If

Exit Sub

SALIR:

ERRORES

End Sub

Private Sub cmd_cancelar_Click()

'cmb_grado.Locked = False

Cancelar

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

End Sub

Private Sub cmd_eliminar_Click()

'cmb_grado.Locked = False

Elimna_reg

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

End Sub

Private Sub cmd_guarda_img_Click()

Dim SQL12 As String

Guardar

If EXISTE_MATRICULA(eti_matricula.Caption) = False Then Exit Sub

'If ALUMN_MATRICULADO(txt_estudiante.TEXT) = False Then Exit Sub

If opcion_foto = "0" Then

SQL12 = "select * from imagenes where estudiante='" & txt_estudiante.TEXT

& "' and periodo='" & Gperiodo & "'"

Else

SQL12 = "select * from imagenes where estudiante='" & txt_estudiante.TEXT

& "'"

End If

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = True Then

SQL12 = "INSERT INTO IMAGENES(ESTUDIANTE,periodo) VALUES('"

& txt_estudiante.TEXT & "','" & Gperiodo & "' )"

base.Execute (SQL12)

End If

tabla_aux.Close

Page 84: Tesis Sistema Informatico de La Escuela 21 de Mayo

45

Set tabla_aux = Nothing

If opcion_foto = "0" Then

SQL12 = "select foto from imagenes where estudiante='" &

txt_estudiante.TEXT & "' and periodo='" & Gperiodo & "'"

Else

SQL12 = "select foto from imagenes where estudiante='" &

txt_estudiante.TEXT & "'"

End If

tabla_aux.Open SQL12, base, adOpenDynamic, adLockOptimistic

If tabla_aux.State = 0 Then MsgBox "No se registro la Imagen", vbInformation,

"SISTEMA": Set tabla_aux = Nothing: Exit Sub

GuardarBinary tabla_aux, foto, 0

'MsgBox tabla_aux.Fields.Count

tabla_aux.update

tabla_aux.Close

Set tabla_aux = Nothing

End Sub

Private Sub cmd_guardar_Click()

'cmb_grado.Locked = False

Guardar

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

End Sub

Private Sub cmd_img_Click()

On Error Resume Next

If txt_estudiante.TEXT = "" Then Exit Sub

'If EXISTE_MATRICULA(eti_matricula.Caption) = False Then Exit Sub

'If ALUMN_MATRICULADO(txt_estudiante.TEXT) = False Then Exit Sub

cdl.CancelError = True

cdl.Filter = "imagenes de mapa de Bit *.bmp|*.bmp|imagenes *.jpg|*.jpg"

'cdl.FileName = "NOTAS " & cmb_materia.Text & " " &

ExtraeIDCombo(cmb_grado) & cmb_paralelo.Text & " " &

ExtraeIDCombo(cmb_parcial) & "º TRIMESTRE"

cdl.ShowOpen

txt_foto.TEXT = cdl.FileTitle

foto.Picture = LoadPicture(cdl.FileName)

End Sub

Private Sub cmd_imprimir_Click()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

numero = 1

Page 85: Tesis Sistema Informatico de La Escuela 21 de Mayo

46

dtr_matricula.Visible = False

If eti_matricula.Caption = "" Then Exit Sub

SQL1 = "select M.codigo as N_matricula,M.fecha as fecha,alumno=(select

nombres from estudiante where codigo=M.estudiante),padre=(select nombre from

representante where codigo=(select padre from estudiante where

codigo=M.estudiante)),Madre=(select nombre from representante where

codigo=(select madre from estudiante where

codigo=M.estudiante)),repres=(select nombre from representante where

codigo=(select repres1 from estudiante where codigo=M.estudiante)),sexo=(select

nombre from tsexo where codigo=(select sexo from estudiante where

codigo=M.estudiante)),fecha_nac=(select fecha_nac from estudiante where

codigo=M.estudiante),edad=datediff(year,(select fecha_nac from estudiante where

codigo=M.estudiante),M.fecha),grado=(select nombre from grados where

codigo=M.grado),paralelo=(select nombre from paralelo where

codigo=M.paralelo),observacion=M.descripcion from matricula M where

M.codigo='" & eti_matricula.Caption & "' and M.periodo='" & Gperiodo & "'"

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

dtr_matricula.Sections("S4").Controls("eti_periodo").Caption =

NOMBRE_PERIODO

dtr_matricula.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_matricula.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Set dtr_matricula.DataSource = tabla_rep

Set dtr_matricula.Sections("S1").Controls("foto").Picture = foto.Picture

'Imprimir = True

dtr_matricula.PrintReport

Unload dtr_matricula

tabla_rep.Close

Set tabla_rep = Nothing

End Sub

Private Sub cmd_nuevo_Click()

'cmb_grado.Locked = False

Nuevo2

txtperiodo.TEXT = Gperiodo

txtestado = "S"

cmd_busca_estudiante.Visible = True

'cmb_grado.Locked = True

End Sub

Public Sub Nuevo2()

Dim STRSQL As String

Dim nuevo_reg As Integer

'strtabla = CallByName(FRM, "get_tabla", VbMethod)

campoPK = CallByName(FRM, "get_nuevo", VbMethod)

STRSQL = "select isnull(max(cast(CODIGO as integer)),0) + 1 as nuevo from "

& strtabla & " WHERE PERIODO='" & Gperiodo & "'"

Page 86: Tesis Sistema Informatico de La Escuela 21 de Mayo

47

If VerificaCambiosContenedor = True Then

If MsgBox("Se ha realizado cambios, Desea Grabarlos......?", vbYesNo +

vbInformation, "SISTEMA") = vbYes Then

Guardar

End If

End If

Limpiar

Set tabla = base.Execute(STRSQL)

nuevo_reg = tabla.Fields(0).Value

tabla.Close

Set tabla = Nothing

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I Is Label

Then

If I.Container.Name = FRM.Name And I.DataField <> "" Then

If campoPK = I.DataField Then

If TypeOf I Is TextBox Then I.TEXT = nuevo_reg: I.tag =

nuevo_reg

If TypeOf I Is Label Then I.Caption = nuevo_reg: I.tag =

nuevo_reg

End If

End If

End If

Next I

End With

habilitaContenedor True

Activa_nuevo

End Sub

Private Sub cmd_primero_Click()

'cmb_grado.Locked = False

LLenaDatosForm 1

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

'cmb_grado.Locked = False

LLenaDatosForm 4

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

Page 87: Tesis Sistema Informatico de La Escuela 21 de Mayo

48

End Sub

Private Sub cmd_ultimo_Click()

'cmb_grado.Locked = False

LLenaDatosForm 2

'cmb_grado.Locked = True

cmd_busca_estudiante.Visible = Not

EXISTE_MATRICULA(eti_matricula.Caption)

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then SendKeys vbTab

End Sub

Private Sub Form_Load()

filtro = " periodo='" & Gperiodo & "' and estado='S' "

strtabla = "matricula"

camposKP = "|codigo|periodo|"

nuevo_reg = "codigo"

opcion_foto = Extrae_config("17")

NOTA_APRUEBA = Extrae_config("14")

'cmb_grado.Locked = False

LLENACOMBO cmb_grado, "select codigo,nombre from grados"

Set FRM = Me

LLenaDatosForm

'cmb_grado.Locked = True

End Sub

Private Sub Label2_Click()

End Sub

Private Sub LaVolpeButton1_Click()

End Sub

Private Sub txt_estudiante_Change()

Dim SQL12 As String

SQL12 = "select nombres from estudiante where codigo='" &

txt_estudiante.TEXT & "' "

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

eti_estu.Caption = tabla_aux.Fields(0).Value

Else

Page 88: Tesis Sistema Informatico de La Escuela 21 de Mayo

49

eti_estu.Caption = ""

End If

tabla_aux.Close

Set tabla_aux = Nothing

cambio_foto

End Sub

Private Sub cambio_foto()

Dim SQL12 As String

If txt_estudiante.TEXT <> "" Then

If opcion_foto = "0" Then

SQL12 = "SELECT FOTO FROM IMAGENES WHERE ESTUDIANTE='"

& txt_estudiante.TEXT & "' and periodo='" & Gperiodo & "'"

Else

SQL12 = "SELECT top 1 FOTO FROM IMAGENES WHERE

ESTUDIANTE='" & txt_estudiante.TEXT & "'"

End If

Set tabla_aux = base.Execute(SQL12)

If tabla_aux.EOF = False Then

LeerBinary tabla_aux, foto, 0

tabla_aux.MoveNext

Else

Set foto.Picture = Nothing

End If

tabla_aux.Close

Set tabla_aux = Nothing

Else

Set foto.Picture = Nothing

End If

End Sub

Private Sub txtdescripcion_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txtfolio_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.11 FORMULARIO REGISTRO DE GRADOS

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Page 89: Tesis Sistema Informatico de La Escuela 21 de Mayo

50

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Elimna_reg

End Sub

Private Sub cmd_guardar_Click()

Guardar

End Sub

Private Sub cmd_nuevo_Click()

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

Page 90: Tesis Sistema Informatico de La Escuela 21 de Mayo

51

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Command1_Click()

CallByName FRM, "Set_Reg_actual", VbMethod, "hola"

End Sub

Private Sub Command2_Click()

MsgBox reg_actual

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_Load()

filtro = ""

strtabla = "grados"

camposKP = "|codigo|"

nuevo_reg = "codigo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub txtnombre_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.12 FORMULARIO REGISTRO DE NOTAS

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim d_grid(100) As DATOS_GRID

Dim a_col As Integer

Dim a_fil As Integer

Dim accion As String

Dim Libro As Excel.Workbook

Dim HOJA As Excel.Worksheet

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmb_grado_Click()

cmb_paralelo.Clear

cmb_materia.Clear

If cmb_grado.ListIndex = -1 Then Exit Sub

Page 91: Tesis Sistema Informatico de La Escuela 21 de Mayo

52

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" & Gperiodo & "'"

End Sub

Private Sub cmb_paralelo_Click()

cmb_materia.Clear

If cmb_paralelo.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_materia, "select codigo,nombre from materias WHERE

CODIGO IN(SELECT MATERIA from MATERIA_PROFESOR WHERE

PERIODO='" & Gperiodo & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "' and paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' )"

End Sub

Private Sub cmb_profesor_Click()

cmb_paralelo.Clear

cmb_grado.Clear

cmb_materia.Clear

If cmb_profesor.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_grado, "select codigo,nombre from grados WHERE

CODIGO IN(SELECT grado from MATERIA_PROFESOR WHERE

PERIODO='" & Gperiodo & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' )"

End Sub

Private Sub cmd_eliminar_Click()

Dim SQL1, SQL2, SQL3 As String

Dim FILA, I As Integer

If cmb_grado.ListIndex = -1 Or cmb_materia.ListIndex = -1 Or

cmb_paralelo.ListIndex = -1 Or cmb_parcial.ListIndex = -1 Or

cmb_profesor.ListIndex = -1 Then Exit Sub

If GRID.Rows > 2 Or GRID.TextMatrix(1, 0) <> "" Then

If MsgBox("Esta seguro de Borrar Las Notas ..........?", vbYesNo +

vbInformation, "SISTEMA") <> vbYes Then Exit Sub

End If

For I = 1 To GRID.Rows - 1

If GRID.TextMatrix(I, 0) <> "" And GRID.TextMatrix(I, 1) <> "" And

GRID.TextMatrix(I, 2) <> "" And GRID.TextMatrix(I, 3) <> "" And

GRID.TextMatrix(I, 4) <> "" And GRID.TextMatrix(I, 5) <> "" Then

SQL1 = genera_DELETE(I)

base.Execute (SQL1)

End If

Next

If GRID.Rows > 2 Or GRID.TextMatrix(1, 0) <> "" Then

Form_msg.Timer1.Enabled = False

Page 92: Tesis Sistema Informatico de La Escuela 21 de Mayo

53

Form_msg.Timer2.Enabled = True

Form_msg.cmd_aceptar.Visible = False

Form_msg.ProgressBar1.Visible = True

Mensage "Borrando Notas........ "

End If

LIMPIA_GRID

End Sub

Private Sub cmd_generaexel_Click()

Dim I, j As Integer

On Error GoTo SALIR

If GRID.TextMatrix(1, 0) = "" And GRID.TextMatrix(1, 1) = "" Then Exit Sub

If Permiso("EX", Me.Name) = False Then Exit Sub

If Apli.Workbooks.Count > 0 Then Apli.Workbooks(1).Close False

Set Libro = Apli.Workbooks.Add

Libro.Worksheets(3).Delete

Libro.Worksheets(2).Delete

Set HOJA = Libro.Worksheets(1)

HOJA.Rows("1:1").RowHeight = 18

Apli.Range("G1:R1").Select

With Apli.Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("G1:R1").Select

Apli.ActiveCell.FormulaR1C1 = NOMBRE_ESCUELA

Apli.Range("G2:R2").Select

With Apli.Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("G2:R2").Select

Page 93: Tesis Sistema Informatico de La Escuela 21 de Mayo

54

Apli.ActiveCell.FormulaR1C1 = NOMBRE_PERIODO

HOJA.Columns("A:F").Hidden = True

HOJA.Columns("S:S").Hidden = True

HOJA.Columns("G:G").ColumnWidth = 2.71

HOJA.Columns("H:H").ColumnWidth = 30

HOJA.Columns("I:Q").ColumnWidth = 9

HOJA.Columns("R:R").ColumnWidth = 16

HOJA.Name = "NOTAS"

HOJA.Cells(5, 7) = "Nº"

HOJA.Cells(5, 8) = "Nomina"

HOJA.Cells(5, 9) = "Conducta"

HOJA.Cells(5, 10) = "Deberes"

HOJA.Cells(5, 11) = "Lecciones"

HOJA.Cells(5, 12) = "Trabajo"

HOJA.Cells(5, 13) = "Aportes"

HOJA.Cells(5, 14) = "Examenes"

HOJA.Cells(5, 15) = "Actuacion"

HOJA.Cells(5, 16) = "Total"

HOJA.Cells(5, 17) = "Promedio"

HOJA.Cells(5, 18) = "Observacion"

'colocar los datos de las notas

HOJA.Cells(3, 8) = "PROFESOR:"

HOJA.Cells(4, 8) = "MATERIA:"

Apli.Range("H3:H4").Select

Apli.Selection.HorizontalAlignment = xlRight

Apli.Range("L3:L3").Select

Apli.Selection.HorizontalAlignment = xlRight

Apli.ActiveCell.FormulaR1C1 = "GRADO:"

Apli.Range("I3:K3").Select

With Apli.Selection

.HorizontalAlignment = xlLeft

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("I3:K3").Select

Apli.ActiveCell.FormulaR1C1 = cmb_profesor.TEXT

Apli.Range("I4:K4").Select

With Apli.Selection

.HorizontalAlignment = xlLeft

.VerticalAlignment = xlBottom

.WrapText = False

Page 94: Tesis Sistema Informatico de La Escuela 21 de Mayo

55

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("I4:K4").Select

Apli.ActiveCell.FormulaR1C1 = cmb_materia.TEXT

Apli.Range("M3:N3").Select

With Apli.Selection

.HorizontalAlignment = xlLeft

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("M3:N3").Select

Apli.ActiveCell.FormulaR1C1 = cmb_grado.TEXT

Apli.Range("O3:P3").Select

With Apli.Selection

.HorizontalAlignment = xlRight

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("O3:P3").Select

Apli.ActiveCell.FormulaR1C1 = "PARALELO:"

Apli.Range("Q3").Select

Apli.Selection.HorizontalAlignment = xlRight

Apli.ActiveCell.FormulaR1C1 = cmb_paralelo.TEXT

Apli.Range("L4:M4").Select

With Apli.Selection

.HorizontalAlignment = xlRight

.VerticalAlignment = xlBottom

.WrapText = False

Page 95: Tesis Sistema Informatico de La Escuela 21 de Mayo

56

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("L4:O4").Select

With Apli.Selection

.HorizontalAlignment = xlLeft

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("L4:O4").Select

Apli.ActiveCell.FormulaR1C1 = cmb_parcial.TEXT & " TRIMESTRE"

I = GRID.Rows - 1

Apli.Range("I6:O" & I + 6).Select

With Apli.Selection.Validation

.Delete

.Add Type:=xlValidateDecimal, AlertStyle:=xlValidAlertStop,

Operator:=xlBetween, Formula1:="0", Formula2:="20"

.IgnoreBlank = True

.InCellDropdown = True

.InputTitle = ""

.ErrorTitle = "SISTEMA"

.InputMessage = ""

.ErrorMessage = "VALORES PERMITIDOS (0 a 20)"

.ShowInput = True

.ShowError = True

End With

' COMENSAMOS A LLENAR LA HOJA

Dim A As XlEditionType

For I = 1 To GRID.Rows - 1

HOJA.Cells(I + 5, 1) = GRID.TextMatrix(I, 0)

HOJA.Cells(I + 5, 2) = GRID.TextMatrix(I, 1)

HOJA.Cells(I + 5, 3) = GRID.TextMatrix(I, 2)

HOJA.Cells(I + 5, 4) = GRID.TextMatrix(I, 3)

HOJA.Cells(I + 5, 5) = GRID.TextMatrix(I, 4)

HOJA.Cells(I + 5, 6) = GRID.TextMatrix(I, 5)

Page 96: Tesis Sistema Informatico de La Escuela 21 de Mayo

57

HOJA.Cells(I + 5, 7) = GRID.TextMatrix(I, 6)

HOJA.Cells(I + 5, 8) = GRID.TextMatrix(I, 7)

HOJA.Cells(I + 5, 9) = GRID.TextMatrix(I, 8)

HOJA.Cells(I + 5, 10) = GRID.TextMatrix(I, 9)

HOJA.Cells(I + 5, 11) = GRID.TextMatrix(I, 10)

HOJA.Cells(I + 5, 12) = GRID.TextMatrix(I, 11)

HOJA.Cells(I + 5, 13) = GRID.TextMatrix(I, 12)

HOJA.Cells(I + 5, 14) = GRID.TextMatrix(I, 13)

HOJA.Cells(I + 5, 15) = GRID.TextMatrix(I, 14)

HOJA.Cells(I + 5, 16).Formula = "=SUM(RC[-6]:RC[-1])"

HOJA.Cells(I + 5, 17).Formula = "=ROUND(RC[-1]/6,0)"

HOJA.Cells(I + 5, 18).Formula = "=IF(RC[-1]>=" &

NOTA_SOBRESALIENTE & ",""SOBRESALIENTE"",IF(RC[-1]>=" &

NOTA_MUYBUENO & ",""MUY BUENO"",IF(RC[-1]>=" & NOTA_BUENO

& ",""BUENO"",IF(RC[-1]>=" & NOTA_REGULAR &

",""REGULAR"",""INSUFICIENTE""))))"

HOJA.Cells(I + 5, 19) = GRID.TextMatrix(I, 18)

'Hoja.Cells.AllowEdit

Next

HOJA.Protection.AllowEditRanges.Add Title:="Notas", Range:=Range("I6:O" &

I + 4)

HOJA.Protect "LigiaMayu", DrawingObjects:=True, Contents:=True,

Scenarios:=True

cdl.CancelError = True

cdl.Filter = "Archivos de Excel|*.xls"

cdl.FileName = "NOTAS " & cmb_materia.TEXT & " " &

ExtraeIDCombo(cmb_grado) & cmb_paralelo.TEXT & " " &

ExtraeIDCombo(cmb_parcial) & "º TRIMESTRE"

cdl.ShowSave

nombre = cdl.FileName ' InputBox("Guardar como")

Libro.SaveAs nombre '"C:\" & nombre & ".xls"

'SALIR2:

'Set Hoja = Nothing

'Set Libro = Nothing

'Set Apli = Nothing

'Apli.Visible = True

SALIR:

End Sub

Private Sub cmd_guardar_Click()

Dim SQL1, SQL2, SQL3 As String

Dim aux As Boolean

Dim FILA, I As Integer

aux = False

On Error GoTo SALIR2

If Permiso("G", Me.Name) = False Then Exit Sub

Page 97: Tesis Sistema Informatico de La Escuela 21 de Mayo

58

If EXITE_NOTA(1) = True Then

If Permiso("M", Me.Name) = False Then Exit Sub

End If

If cmb_grado.ListIndex = -1 Or cmb_materia.ListIndex = -1 Or

cmb_paralelo.ListIndex = -1 Or cmb_parcial.ListIndex = -1 Or

cmb_profesor.ListIndex = -1 Then Exit Sub

For I = 1 To GRID.Rows - 1

If GRID.TextMatrix(I, 0) <> "" And GRID.TextMatrix(I, 1) <> "" And

GRID.TextMatrix(I, 2) <> "" And GRID.TextMatrix(I, 3) <> "" And

GRID.TextMatrix(I, 4) <> "" And GRID.TextMatrix(I, 5) <> "" Then

If EXITE_NOTA(I) = True Then

SQL1 = genera_UPDATE(I)

Else

SQL1 = genera_INSERT(I)

End If

base.Execute (SQL1)

End If

Next

If GRID.Rows > 2 Or GRID.TextMatrix(1, 0) <> "" Then

aux = True

Form_msg.Timer1.Enabled = False

Form_msg.Timer2.Enabled = True

Form_msg.cmd_aceptar.Visible = False

Form_msg.ProgressBar1.Visible = True

Mensage "Guardando o Modificando Notas "

aux = False

Exit Sub

SALIR2:

If aux = True Then

Unload Form_msg

End If

ERRORES

End If

End Sub

Private Sub procesar()

Dim SQL1, SQL2 As String

Dim FILA As Integer

LIMPIA_GRID

txt.TEXT = ""

txt.Visible = False

If cmb_grado.ListIndex = -1 Or cmb_materia.ListIndex = -1 Or

cmb_paralelo.ListIndex = -1 Or cmb_parcial.ListIndex = -1 Or

cmb_profesor.ListIndex = -1 Then Exit Sub

SQL1 = "select (select nombres from estudiante where codigo=M.estudiante) as

estudiante,M.codigo as matricula ,isnull(N.trimestre,'') as trimestre

,isnull(N.materia,'')as materia,isnull(N.periodo,'') as periodo,isnull(N.conducta,0)

Page 98: Tesis Sistema Informatico de La Escuela 21 de Mayo

59

as conducta,isnull(N.deber," & CStr(NOTA_MIN) & ") as

deber,isnull(N.leccion," & CStr(NOTA_MIN) & ") as leccion,isnull(N.actuacion,"

& CStr(NOTA_MIN) & ") as actuacion,isnull(N.trabajo," & CStr(NOTA_MIN)

& ") as trabajo,isnull(N.aporte," & CStr(NOTA_MIN) & ") as

aporte,isnull(N.examen," & CStr(NOTA_MIN) & ") as

examen,isnull(N.actuacion," & CStr(NOTA_MIN) & ") as actuacion,M.GRADO

AS grado,M.paralelo as paralelo,M.periodo as periodo from matricula M join

Notas N on N.matricula=M.codigo where M.estado='S' and M.grado='" &

ExtraeIDCombo(cmb_grado) & "' and M.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' and M.periodo='" & Gperiodo & "' and

N.materia='" & ExtraeIDCombo(cmb_materia) & "' and N.trimestre='" &

ExtraeIDCombo(cmb_parcial) & "' order by estudiante"

SQL2 = "select (select nombres from estudiante where codigo=M.estudiante) as

estudiante,M.codigo as matricula ,'" & ExtraeIDCombo(cmb_parcial) & "' as

trimestre ,'" & ExtraeIDCombo(cmb_materia) & "'as materia,'" & Gperiodo & "'

as periodo," & CStr(NOTA_MIN) & " as conducta," & CStr(NOTA_MIN) & " as

deber," & CStr(NOTA_MIN) & " as leccion," & CStr(NOTA_MIN) & " as

actuacion," & CStr(NOTA_MIN) & " as trabajo," & CStr(NOTA_MIN) & " as

aporte," & CStr(NOTA_MIN) & " as examen," & CStr(NOTA_MIN) & " as

actuacion,M.GRADO AS grado,M.paralelo as paralelo,M.periodo as periodo from

matricula M where estado='S' and grado='" & ExtraeIDCombo(cmb_grado) & "'

and paralelo='" & ExtraeIDCombo(cmb_paralelo) & "' and M.periodo='" &

Gperiodo & "' order by estudiante"

Set tabla = base.Execute(SQL1)

If tabla.EOF = True Then

tabla.Close

accion = "M"

Set tabla = Nothing

If MsgBox("No existen notas registradas todabia, Desea generarlas ...............?

", vbYesNo + vbInformation, "SISTEMA") <> vbYes Then Exit Sub

Set tabla = base.Execute(SQL2)

If tabla.EOF = True Then

accion = "N"

tabla.Close

Set tabla = Nothing

MsgBox "No existen Estudiantes Matriculados", vbInformation, "SISTEMA"

Exit Sub

End If

End If

FILA = 1

Do Until tabla.EOF = True

For I = 0 To tabla.Fields.Count - 1

CARGA_GRID tabla.Fields.Item(I).Name, FILA, tabla.Fields(I).Value

Next

GRID.TextMatrix(FILA, col_nombre("Nº")) = FILA

GRID.TextMatrix(FILA, col_nombre("profesor")) =

ExtraeIDCombo(cmb_profesor)

CALCULAR FILA

Page 99: Tesis Sistema Informatico de La Escuela 21 de Mayo

60

tabla.MoveNext

If tabla.EOF = False Then

FILA = FILA + 1

GRID.Rows = GRID.Rows + 1

End If

Loop

tabla.Close

Set tabla = Nothing

End Sub

Private Sub CALCULAR(FILA As Integer)

GRID.TextMatrix(FILA, col_nombre("Total")) = valor_celda(FILA, "deber") +

valor_celda(FILA, "leccion") + valor_celda(FILA, "trabajo") + valor_celda(FILA,

"aporte") + valor_celda(FILA, "examen") + valor_celda(FILA, "actuacion")

GRID.TextMatrix(FILA, col_nombre("Promedio")) =

Round(valor_celda(FILA, "Total") / 6, 3)

GRID.TextMatrix(FILA, col_nombre("Promedio2")) =

Round(valor_celda(FILA, "Total") / 6, 0)

GRID.TextMatrix(FILA, col_nombre("Observacion")) =

VAL_OBSER(CStr(valor_celda(FILA, "Promedio")))

End Sub

Private Function valor_celda(FILA As Integer, nombre As String) As Double

Dim I As Integer

For I = 0 To GRID.Cols - 1

If UCase(d_grid(I).campo_col) = UCase(nombre) Then

valor_celda = Val(GRID.TextMatrix(FILA, d_grid(I).n_col))

Exit Function

End If

Next

End Function

Private Function col_nombre(nombre As String) As Integer

Dim I As Integer

For I = 0 To GRID.Cols - 1

If UCase(d_grid(I).campo_col) = UCase(nombre) Then

col_nombre = d_grid(I).n_col

Exit Function

End If

Next

End Function

Private Function VAL_OBSER(NOTA As String) As String

Dim N As Double

N = Val(NOTA)

VAL_OBSER = ""

If N >= NOTA_SOBRESALIENTE Then VAL_OBSER =

"SOBRESALIENTE": Exit Function

If N >= NOTA_MUYBUENO Then VAL_OBSER = "MUY BUENO": Exit

Function

Page 100: Tesis Sistema Informatico de La Escuela 21 de Mayo

61

If N >= NOTA_BUENO Then VAL_OBSER = "BUENO": Exit Function

If N >= NOTA_REGULAR Then VAL_OBSER = "REGULAR": Exit

Function

If N < NOTA_INSUFICIENTE Then VAL_OBSER = "INSUFICIENTE": Exit

Function

End Function

Private Sub cmd_procesar_Click()

procesar

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_subirexel_Click()

Dim I, j As Integer

'Public Apli2 As Excel.Application

On Error GoTo SALIR2

'If GRID.TextMatrix(1, 0) = "" And GRID.TextMatrix(1, 1) = "" Then Exit Sub

cdl.CancelError = True

cdl.Filter = "Archivos de Excel|*.xls"

'cdl.FileName = "NOTAS " & cmb_materia.Text & " " &

ExtraeIDCombo(cmb_grado) & cmb_paralelo.Text & " " &

ExtraeIDCombo(cmb_parcial) & "º TRIMESTRE"

cdl.ShowOpen

If Apli.Workbooks.Count > 0 Then Apli.Workbooks(1).Close False

Apli.Workbooks.Open FileName:=cdl.FileName

If cdl.FileName = "" Then Exit Sub

'Set Apli2 = New Application

Set Libro = Apli.Workbooks(1)

Set HOJA = Libro.Worksheets(1)

'HOJA.Unprotect "LigiaMayu"

LIMPIA_GRID

I = 6

If HOJA.Cells(I, 1) <> "" Then

cmb_profesor.ListIndex = IndexList(cmb_profesor, CLng(HOJA.Cells(I, 19)))

cmb_grado.ListIndex = IndexList(cmb_grado, CLng(HOJA.Cells(I, 2)))

cmb_paralelo.ListIndex = IndexList(cmb_paralelo, CLng(HOJA.Cells(I, 3)))

cmb_parcial.ListIndex = IndexList(cmb_parcial, CLng(HOJA.Cells(I, 5)))

cmb_materia.ListIndex = IndexList(cmb_materia, CLng(HOJA.Cells(I, 6)))

End If

Do Until HOJA.Cells(I, 1) = ""

If GRID.TextMatrix(I - 6, 0) <> "" Then GRID.Rows = GRID.Rows + 1

GRID.TextMatrix(I - 5, 0) = HOJA.Cells(I, 1)

Page 101: Tesis Sistema Informatico de La Escuela 21 de Mayo

62

GRID.TextMatrix(I - 5, 1) = HOJA.Cells(I, 2)

GRID.TextMatrix(I - 5, 2) = HOJA.Cells(I, 3)

GRID.TextMatrix(I - 5, 3) = HOJA.Cells(I, 4)

GRID.TextMatrix(I - 5, 4) = HOJA.Cells(I, 5)

GRID.TextMatrix(I - 5, 5) = HOJA.Cells(I, 6)

GRID.TextMatrix(I - 5, 6) = HOJA.Cells(I, 7)

GRID.TextMatrix(I - 5, 7) = HOJA.Cells(I, 8)

GRID.TextMatrix(I - 5, 8) = HOJA.Cells(I, 9)

GRID.TextMatrix(I - 5, 9) = HOJA.Cells(I, 10)

GRID.TextMatrix(I - 5, 10) = HOJA.Cells(I, 11)

GRID.TextMatrix(I - 5, 11) = HOJA.Cells(I, 12)

GRID.TextMatrix(I - 5, 12) = HOJA.Cells(I, 13)

GRID.TextMatrix(I - 5, 13) = HOJA.Cells(I, 14)

GRID.TextMatrix(I - 5, 14) = HOJA.Cells(I, 15)

GRID.TextMatrix(I - 5, 18) = HOJA.Cells(I, 19)

CALCULAR I - 5

I = I + 1

DoEvents

Loop

If Apli.Workbooks.Count > 0 Then Apli.Workbooks(1).Close False

'accion = ""

'Libro.Close

Exit Sub

SALIR2:

If Apli.Workbooks.Count > 0 Then Apli.Workbooks(1).Close False

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Form_Load()

filtro = ""

coloca_tolti Me

txtperiodo.TEXT = Gperiodo

Me.Top = 0

Me.Left = 10

LLENACOMBO cmb_profesor, "select codigo,nombre from profesor"

LLENACOMBO cmb_parcial, "select codigo,nombre from trimestres"

strtabla = "notas"

camposKP = "|codigo|"

nuevo_reg = "codigo"

DAT_grid

CONF_GRID

NOTA_MAX = Val(Extrae_config("1"))

NOTA_MIN = Val(Extrae_config("2"))

NOTA_SOBRESALIENTE = Val(Extrae_config("3"))

NOTA_MUYBUENO = Val(Extrae_config("4"))

Page 102: Tesis Sistema Informatico de La Escuela 21 de Mayo

63

NOTA_BUENO = Val(Extrae_config("5"))

NOTA_REGULAR = Val(Extrae_config("6"))

NOTA_INSUFICIENTE = Val(Extrae_config("7"))

'Libro.Worksheets(1).Delete

End Sub

Private Function EXITE_NOTA(FILA As Integer) As Boolean

Dim SQL1, strand As String

strand = " "

EXITE_NOTA = False

SQL1 = "select count(*) as UNOS from " & strtabla & " where "

For I = 0 To GRID.Cols - 1

If d_grid(I).clave = True Then

SQL1 = SQL1 & strand & d_grid(I).campo_col & " = '" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

Set tabla = base.Execute(SQL1)

If tabla.Fields(0).Value <> 0 Then

EXITE_NOTA = True

End If

tabla.Close

Set tabla = Nothing

End Function

Private Function genera_INSERT(FILA As Integer) As String

Dim SQL1, SQL2, strCOMA As String

strCOMA = " "

SQL1 = "INSERT INTO " & strtabla & "("

SQL2 = " VALUES ("

For I = 0 To GRID.Cols - 1

If d_grid(I).insertable = True Then

SQL1 = SQL1 & strCOMA & d_grid(I).campo_col

SQL2 = SQL2 & strCOMA & "'" & GRID.TextMatrix(FILA,

d_grid(I).n_col) & "'"

strCOMA = ","

End If

Next

SQL1 = SQL1 & ") "

SQL2 = SQL2 & ") "

SQL1 = SQL1 & SQL2

genera_INSERT = SQL1

End Function

Private Function genera_UPDATE(FILA As Integer) As String

Page 103: Tesis Sistema Informatico de La Escuela 21 de Mayo

64

Dim SQL1, SQL2, strCOMA, strand As String

strCOMA = " "

strand = " "

SQL1 = "UPDATE " & strtabla & " set "

SQL2 = " WHERE "

For I = 0 To GRID.Cols - 1

If d_grid(I).insertable = True And d_grid(I).clave = False Then

SQL1 = SQL1 & strCOMA & d_grid(I).campo_col & "='" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strCOMA = ","

End If

If d_grid(I).clave = True Then

SQL2 = SQL2 & strand & d_grid(I).campo_col & " = '" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

SQL1 = SQL1 & " "

SQL2 = SQL2 & " "

SQL1 = SQL1 & SQL2

genera_UPDATE = SQL1

End Function

Private Function genera_DELETE(FILA As Integer) As String

Dim SQL2, strand As String

strand = " "

SQL2 = "DELETE FROM " & strtabla & " WHERE "

For I = 0 To GRID.Cols - 1

If d_grid(I).clave = True Then

SQL2 = SQL2 & strand & d_grid(I).campo_col & " = '" &

GRID.TextMatrix(FILA, d_grid(I).n_col) & "'"

strand = " AND "

End If

Next

genera_DELETE = SQL2

End Function

Private Sub DAT_grid()

GRID.Cols = 20

GRID_RES.Cols = 20

d_grid(0).n_col = 0

d_grid(0).ancho_col = 0

d_grid(0).cabecera_col = ""

d_grid(0).campo_col = "periodo"

d_grid(0).editable = False

d_grid(0).clave = True

d_grid(0).insertable = True

d_grid(1).n_col = 1

Page 104: Tesis Sistema Informatico de La Escuela 21 de Mayo

65

d_grid(1).ancho_col = 0

d_grid(1).cabecera_col = ""

d_grid(1).campo_col = "grado"

d_grid(1).editable = False

d_grid(1).clave = True

d_grid(1).insertable = True

d_grid(2).n_col = 2

d_grid(2).ancho_col = 0

d_grid(2).cabecera_col = ""

d_grid(2).campo_col = "paralelo"

d_grid(2).editable = False

d_grid(2).clave = False

d_grid(2).insertable = False

d_grid(3).n_col = 3

d_grid(3).ancho_col = 0

d_grid(3).cabecera_col = ""

d_grid(3).campo_col = "matricula"

d_grid(3).editable = False

d_grid(3).clave = True

d_grid(3).insertable = True

d_grid(4).n_col = 4

d_grid(4).ancho_col = 0

d_grid(4).cabecera_col = ""

d_grid(4).campo_col = "trimestre"

d_grid(4).editable = False

d_grid(4).clave = True

d_grid(4).insertable = True

d_grid(5).n_col = 5

d_grid(5).ancho_col = 0

d_grid(5).cabecera_col = ""

d_grid(5).campo_col = "materia"

d_grid(5).editable = False

d_grid(5).clave = True

d_grid(5).insertable = True

d_grid(6).n_col = 6

d_grid(6).ancho_col = 400

d_grid(6).cabecera_col = "Nº"

d_grid(6).campo_col = "Nº"

d_grid(6).editable = False

d_grid(6).clave = False

d_grid(6).insertable = False

d_grid(7).n_col = 7

d_grid(7).ancho_col = 3500

d_grid(7).cabecera_col = "Nomina"

d_grid(7).campo_col = "estudiante"

d_grid(7).editable = False

d_grid(7).clave = False

d_grid(7).insertable = False

Page 105: Tesis Sistema Informatico de La Escuela 21 de Mayo

66

d_grid(8).n_col = 8

d_grid(8).ancho_col = 800

d_grid(8).cabecera_col = "Conducta"

d_grid(8).campo_col = "conducta"

d_grid(8).editable = True

d_grid(8).clave = False

d_grid(8).insertable = True

d_grid(9).n_col = 9

d_grid(9).ancho_col = 800

d_grid(9).cabecera_col = "Deber"

d_grid(9).campo_col = "deber"

d_grid(9).editable = True

d_grid(9).clave = False

d_grid(9).insertable = True

d_grid(10).n_col = 10

d_grid(10).ancho_col = 800

d_grid(10).cabecera_col = "Leccion"

d_grid(10).campo_col = "leccion"

d_grid(10).editable = True

d_grid(10).clave = False

d_grid(10).insertable = True

d_grid(11).n_col = 11

d_grid(11).ancho_col = 800

d_grid(11).cabecera_col = "Invest."

d_grid(11).campo_col = "trabajo"

d_grid(11).editable = True

d_grid(11).clave = False

d_grid(11).insertable = True

d_grid(12).n_col = 12

d_grid(12).ancho_col = 800

d_grid(12).cabecera_col = "Aporte"

d_grid(12).campo_col = "aporte"

d_grid(12).editable = True

d_grid(12).clave = False

d_grid(12).insertable = True

d_grid(13).n_col = 13

d_grid(13).ancho_col = 800

d_grid(13).cabecera_col = "Examen"

d_grid(13).campo_col = "examen"

d_grid(13).editable = True

d_grid(13).clave = False

d_grid(13).insertable = True

d_grid(14).n_col = 14

d_grid(14).ancho_col = 800

d_grid(14).cabecera_col = "Actuacion"

d_grid(14).campo_col = "actuacion"

d_grid(14).editable = True

d_grid(14).clave = False

Page 106: Tesis Sistema Informatico de La Escuela 21 de Mayo

67

d_grid(14).insertable = True

d_grid(15).n_col = 15

d_grid(15).ancho_col = 800

d_grid(15).cabecera_col = "Total"

d_grid(15).campo_col = "Total"

d_grid(15).editable = False

d_grid(15).clave = False

d_grid(15).insertable = True

d_grid(16).n_col = 16

d_grid(16).ancho_col = 800

d_grid(16).cabecera_col = "Promedio"

d_grid(16).campo_col = "Promedio2"

d_grid(16).editable = False

d_grid(16).clave = False

d_grid(16).insertable = True

d_grid(17).n_col = 17

d_grid(17).ancho_col = 1800

d_grid(17).cabecera_col = "Observacion"

d_grid(17).campo_col = "Observacion"

d_grid(17).editable = False

d_grid(17).clave = False

d_grid(17).insertable = False

d_grid(18).n_col = 18

d_grid(18).ancho_col = 0

d_grid(18).cabecera_col = ""

d_grid(18).campo_col = "profesor"

d_grid(18).editable = False

d_grid(18).clave = False

d_grid(18).insertable = False

d_grid(19).n_col = 19

d_grid(19).ancho_col = 0

d_grid(19).cabecera_col = "Promedio"

d_grid(19).campo_col = "promedio"

d_grid(19).editable = False

d_grid(19).clave = False

d_grid(19).insertable = True

End Sub

Private Sub CONF_GRID()

Dim I As Integer

GRID.Rows = 2

For I = 0 To GRID.Cols - 1

GRID.ColWidth(I) = d_grid(I).ancho_col

GRID.TextMatrix(0, I) = d_grid(I).cabecera_col

Next

End Sub

Private Sub GRID_Click()

Page 107: Tesis Sistema Informatico de La Escuela 21 de Mayo

68

Dim a_tex As String

If cmb_grado.ListIndex = -1 Then Exit Sub

If d_grid(GRID.col).editable = False Or GRID.Row = 0 Then Exit Sub

a_col = GRID.col

a_fil = GRID.Row

a_tex = ""

txt.Visible = False

txt.Top = GRID.Top + GRID.CellTop

txt.Left = GRID.Left + GRID.CellLeft

txt.Width = GRID.CellWidth - 10

txt.Height = GRID.CellHeight - 10

txt.TEXT = GRID.TextMatrix(a_fil, a_col)

txt.Visible = True

txt.SetFocus

txt.SelLength = Len(txt.TEXT)

'txt.SelStart = 1

End Sub

Private Sub GRID_Scroll()

txt.Visible = False

GRID.RowSel = GRID.Row

End Sub

Private Sub txt_Change()

On Error Resume Next

If Val(txt.TEXT) > NOTA_MAX Then

Mensage "El rango de la nota debe ser entre " & CStr(NOTA_MIN) & " y " &

CStr(NOTA_MAX)

txt.TEXT = CStr(NOTA_MIN)

txt.SelLength = 1

Exit Sub

End If

If txt.TEXT = "" Then

txt.TEXT = CStr(NOTA_MIN)

txt.SelLength = 1

Exit Sub

End If

GRID.TextMatrix(a_fil, a_col) = txt.TEXT

CALCULAR a_fil

End Sub

Private Sub LIMPIA_GRID()

Dim I, c As Integer

GRID.Rows = 2

For c = 0 To GRID.Cols - 1

GRID.TextMatrix(1, c) = ""

Page 108: Tesis Sistema Informatico de La Escuela 21 de Mayo

69

Next

End Sub

Private Sub CARGA_GRID(nombre As String, FILA As Integer, valor As

Variant)

Dim I As Integer

For I = 0 To GRID.Cols - 1

If d_grid(I).campo_col = nombre Then

GRID.TextMatrix(FILA, d_grid(I).n_col) = valor

End If

Next

End Sub

Private Sub txt_KeyDown(KeyCode As Integer, Shift As Integer)

Dim f, c As Integer

If KeyCode = 13 And Shift <> 1 Then

c = GRID.col

f = GRID.Row

If f = GRID.Rows - 1 And c = 14 Then Exit Sub

If c < 14 Then

c = c + 1

Else

f = f + 1

c = 8

End If

GRID.Row = f

GRID.col = c

GRID_Click

End If

If Shift = 1 And KeyCode = 13 Then

c = GRID.col

f = GRID.Row

If f = 1 And c = 8 Then Exit Sub

If c > 8 Then

c = c - 1

Else

f = f - 1

c = 14

End If

GRID.Row = f

GRID.col = c

GRID_Click

End If

If KeyCode = 40 And Shift = 0 Then 'FLECHA PA ABAJO

c = GRID.col

f = GRID.Row

If f = GRID.Rows - 1 Then Exit Sub

f = f + 1

GRID.Row = f

Page 109: Tesis Sistema Informatico de La Escuela 21 de Mayo

70

GRID.col = c

GRID_Click

End If

If KeyCode = 38 And Shift = 0 Then 'FLECHA PA ARRIBA

c = GRID.col

f = GRID.Row

If f = 1 Then Exit Sub

f = f - 1

GRID.Row = f

GRID.col = c

GRID_Click

End If

End Sub

Private Sub txt_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_KeyUp(KeyCode As Integer, Shift As Integer)

Clipboard.Clear

Clipboard.SetText ""

End Sub

Private Sub txt_MouseDown(Button As Integer, Shift As Integer, X As Single, Y

As Single)

Clipboard.Clear

Clipboard.SetText ""

End Sub

1.13 FORMULARIO INFORME DE NOTAS RESUMIDO X MATERIAS

Y TRIMESTRES

Dim d_grid(100) As DATOS_GRID

Dim Libro As Excel.Workbook

Dim HOJA As Excel.Worksheet

Private Sub cmb_grado_Click()

If cmb_grado.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "'"

LLENACOMBO cmb_materia, "select codigo,abreviatura from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_GRADO WHERE

periodo='" & ExtraeIDCombo(cmb_periodo) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "')"

End Sub

Page 110: Tesis Sistema Informatico de La Escuela 21 de Mayo

71

Private Sub CARGA_GRID(nombre As String, FILA As Integer, valor As

Variant)

Dim I As Integer

For I = 0 To GRID.Cols - 1

If d_grid(I).campo_col = nombre Then

GRID.TextMatrix(FILA, d_grid(I).n_col) = valor

End If

Next

End Sub

Private Sub LIMPIA_GRID()

Dim I, c As Integer

GRID.Rows = 2

For c = 0 To GRID.Cols - 1

GRID.TextMatrix(1, c) = ""

Next

End Sub

Private Sub cmb_periodo_Click()

cmb_paralelo.Clear

cmb_materia.Clear

LLENACOMBO cmb_grado, "select codigo,nombre from grados WHERE

CODIGO IN(SELECT DISTINCT GRADO FROM MATERIA_GRADO

WHERE PERIODO='" & ExtraeIDCombo(cmb_periodo) & "' )"

End Sub

Private Sub cmd_generaexel_Click()

Dim f, c As Integer

On Error Resume Next

If GRID.TextMatrix(1, 0) = "" And GRID.TextMatrix(1, 1) = "" Then Exit Sub

If Apli.Workbooks.Count > 0 Then Apli.Workbooks(1).Close False

Set Libro = Apli.Workbooks.Add

Libro.Worksheets(3).Delete

Libro.Worksheets(2).Delete

Set HOJA = Libro.Worksheets(1)

c = GRID.Cols - 1

f = GRID.Rows - 1

'Apli.Range.Font.Bold = True

Apli.Range("A1:" & LETRA_NUMERO(c) & "1").Select

With Apli.Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.Size = 14

.Bold = True

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

Page 111: Tesis Sistema Informatico de La Escuela 21 de Mayo

72

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("A1:" & LETRA_NUMERO(c) & "1").Select

Apli.ActiveCell.FormulaR1C1 = NOMBRE_ESCUELA

Apli.Range("A2:" & LETRA_NUMERO(c) & "2").Select

With Apli.Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.Size = 14

.Bold = True

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("A2:" & LETRA_NUMERO(c) & "2").Select

Apli.ActiveCell.FormulaR1C1 = cmb_periodo.TEXT

Apli.Range("A3:" & LETRA_NUMERO(c) & "3").Select

With Apli.Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.Size = 14

.Bold = True

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Apli.Selection.Merge

Apli.Range("A3:" & LETRA_NUMERO(c) & "3").Select

Apli.ActiveCell.FormulaR1C1 = "INFORME RESUMIDO DE NOTAS X

MATERIAS Y ALUMNOS"

HOJA.Cells(4, 2) = "GRADO : " & cmb_grado.TEXT

HOJA.Cells(4, 5) = "PARALELO : " & cmb_paralelo.TEXT

HOJA.Columns("A:A").ColumnWidth = 2.71

HOJA.Columns("B:B").ColumnWidth = 33

For c = 3 To GRID.Cols - 2

HOJA.Columns(c).ColumnWidth = 5.14

Next

Page 112: Tesis Sistema Informatico de La Escuela 21 de Mayo

73

HOJA.Columns(GRID.Cols - 1).ColumnWidth = 20

For f = 0 To GRID.Rows - 1

For c = 1 To GRID.Cols - 1

HOJA.Cells(f + 5, c) = GRID.TextMatrix(f, c)

If Val(GRID.TextMatrix(f, c)) < CInt(NOTA_APRUEBA) And c > 2 And f

> 0 And GRID.TextMatrix(f, col_nombre("observacion")) <> "APRUEBA" Then

HOJA.Cells(f + 5, c).Font.Color = -16776961

End If

HOJA.Cells(f + 5, c).Borders(xlEdgeLeft).LineStyle = xlContinuous

HOJA.Cells(f + 5, c).Borders(xlEdgeLeft).ColorIndex = 0

HOJA.Cells(f + 5, c).Borders(xlEdgeLeft).Weight = xlThin

HOJA.Cells(f + 5, c).Borders(xlEdgeTop).LineStyle = xlContinuous

HOJA.Cells(f + 5, c).Borders(xlEdgeTop).ColorIndex = 0

HOJA.Cells(f + 5, c).Borders(xlEdgeTop).Weight = xlThin

HOJA.Cells(f + 5, c).Borders(xlEdgeBottom).LineStyle = xlContinuous

HOJA.Cells(f + 5, c).Borders(xlEdgeBottom).ColorIndex = 0

HOJA.Cells(f + 5, c).Borders(xlEdgeBottom).Weight = xlThin

HOJA.Cells(f + 5, c).Borders(xlEdgeRight).LineStyle = xlContinuous

HOJA.Cells(f + 5, c).Borders(xlEdgeRight).ColorIndex = 0

HOJA.Cells(f + 5, c).Borders(xlEdgeRight).Weight = xlThin

'If f = 0 And c > 2 Then HOJA.Cells(f + 5, c).Orientation = 90

Next

Next

HOJA.PageSetup.Orientation = xlLandscape

HOJA.PrintOut

End Sub

Private Sub cmd_procesar_Click()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

Dim C_matricula As Integer

Dim C_materia As Integer

Dim FILA As Integer

LIMPIA_GRID

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Or

cmb_materia.ListCount = 0 Then Exit Sub

cargar_materias

CONF_GRID

numero = 1

C_matricula = col_nombre("matricula")

SQL1 = "SELECT M.N_lista,M.codigo as matricula,estu=(select nombres from

estudiante where codigo=M.estudiante) FROM MATRICULA M "

SQL1 = SQL1 & " where M.estado='S' and M.periodo='" &

ExtraeIDCombo(cmb_periodo) & "' and M.grado='" &

Page 113: Tesis Sistema Informatico de La Escuela 21 de Mayo

74

ExtraeIDCombo(cmb_grado) & "' and M.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' order by estu"

Set tabla_rep = base.Execute(SQL1)

Do Until tabla_rep.EOF = True

SQL2 = "update matricula set N_lista=" & numero & " where periodo='" &

Gperiodo & "' and codigo='" & tabla_rep.Fields(1).Value & "' "

base.Execute (SQL2)

numero = numero + 1

tabla_rep.MoveNext

Loop

tabla_rep.Close

Set tabla_rep = Nothing

SQL1 = "SELECT M.N_lista,M.codigo as matricula,estu=(select nombres from

estudiante where codigo=M.estudiante) FROM MATRICULA M "

SQL1 = SQL1 & " where M.estado='S' and M.periodo='" &

ExtraeIDCombo(cmb_periodo) & "' and M.grado='" &

ExtraeIDCombo(cmb_grado) & "' and M.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' order by estu"

Set tabla_rep = base.Execute(SQL1)

FILA = 1

Do Until tabla_rep.EOF = True

For I = 0 To tabla_rep.Fields.Count - 1

CARGA_GRID tabla_rep.Fields.Item(I).Name, FILA,

tabla_rep.Fields(I).Value

Next

tabla_rep.MoveNext

If tabla_rep.EOF = False Then

FILA = FILA + 1

GRID.Rows = GRID.Rows + 1

End If

Loop

tabla_rep.Close

Set tabla_rep = Nothing

For I = 0 To cmb_materia.ListCount - 1

cmb_materia.ListIndex = I

C_materia = col_nombre(cmb_materia.TEXT)

SQL1 = "select M2.codigo as

matricula,total=M2.promedio1+M2.promedio2+M2.promedio3 from (SELECT

M.N_lista as N_lista,estu=(select nombres from estudiante where

codigo=M.estudiante),promedio1=isnull((select promedio2 from notas where

periodo=M.periodo and matricula=M.codigo and trimestre='1' and materia='" &

ExtraeIDCombo(cmb_materia) & "'),0),promedio2=isnull((select promedio2 from

notas where periodo=M.periodo and matricula=M.codigo and trimestre='2' and

materia='" & ExtraeIDCombo(cmb_materia) & "'),0),promedio3=isnull((select

promedio2 from notas where periodo=M.periodo and matricula=M.codigo and

trimestre='3' and materia='" & ExtraeIDCombo(cmb_materia) & "'),0),M.codigo

Page 114: Tesis Sistema Informatico de La Escuela 21 de Mayo

75

as Codigo,M.periodo as periodo,M.grado as grado,M.paralelo as paralelo FROM

MATRICULA M where M.estado='S') M2 "

SQL1 = SQL1 & " where M2.periodo='" & ExtraeIDCombo(cmb_periodo) & "'

and M2.grado='" & ExtraeIDCombo(cmb_grado) & "' and M2.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' order by estu"

Set tabla_rep = base.Execute(SQL1)

Do Until tabla_rep.EOF = True

FILA = row_valor(tabla_rep.Fields(0).Value, C_matricula)

GRID.TextMatrix(FILA, C_materia) = tabla_rep.Fields(1).Value

If tabla_rep.Fields(1).Value < CInt(NOTA_APRUEBA) Then

GRID.Row = FILA

GRID.col = C_materia

GRID.CellForeColor = vbRed

End If

tabla_rep.MoveNext

Loop

tabla_rep.Close

Set tabla_rep = Nothing

Next

CALCULAR

End Sub

Private Sub CALCULAR()

Dim I As Integer

For I = 1 To GRID.Rows - 1

If GRID.TextMatrix(1, 0) <> "" Then

GRID.TextMatrix(I, col_nombre("observacion")) = get_observ(I)

If GRID.TextMatrix(I, col_nombre("observacion")) <> "APRUEBA"

Then

GRID.Row = I

GRID.col = col_nombre("observacion")

GRID.CellForeColor = vbRed

End If

End If

Next

End Sub

Private Function get_observ(FILA As Integer) As String

Dim c As Integer

Dim CADE1 As String

Dim NUM As Integer

NUM = 0

CADE1 = "APRUEBA"

For c = 3 To GRID.Cols - 2

If Val(GRID.TextMatrix(FILA, c)) < CInt(NOTA_APRUEBA) Then

CADE1 = "REPRUEBA"

NUM = NUM + 1

End If

Next

If NUM > 0 Then CADE1 = CADE1 & "(" & NUM & ")"

Page 115: Tesis Sistema Informatico de La Escuela 21 de Mayo

76

get_observ = CADE1

End Function

Private Function col_nombre(nombre As String) As Integer

Dim I As Integer

For I = 0 To GRID.Cols - 1

If UCase(d_grid(I).campo_col) = UCase(nombre) Then

col_nombre = d_grid(I).n_col

Exit Function

End If

Next

End Function

Private Function row_valor(valor As String, c As Integer) As Integer

Dim I As Integer

For I = 0 To GRID.Rows - 1

If GRID.TextMatrix(I, c) = UCase(valor) Then

row_valor = I

Exit Function

End If

Next

End Function

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

Me.Top = 0

Me.Left = 10

coloca_tolti Me

NOTA_APRUEBA = Extrae_config("14")

NOTA_REPRUEBA = Extrae_config("16")

NOTA_SUPLE = Extrae_config("15")

LLENACOMBO cmb_periodo, "select codigo,nombre from periodo"

cmb_periodo.ListIndex = IndexList(cmb_periodo, CLng(Gperiodo))

DAT_grid

End Sub

Private Sub DAT_grid()

GRID.Cols = 3

d_grid(0).n_col = 0

d_grid(0).ancho_col = 0

d_grid(0).cabecera_col = ""

d_grid(0).campo_col = "matricula"

d_grid(0).revisar = False

d_grid(1).n_col = 1

d_grid(1).ancho_col = 300

d_grid(1).cabecera_col = "Nº"

Page 116: Tesis Sistema Informatico de La Escuela 21 de Mayo

77

d_grid(1).campo_col = "N_lista"

d_grid(1).revisar = False

d_grid(2).n_col = 2

d_grid(2).ancho_col = 3000

d_grid(2).cabecera_col = "Nomina"

d_grid(2).campo_col = "estu"

d_grid(2).revisar = False

End Sub

Private Sub cargar_materias()

Dim I As Integer

GRID.Cols = cmb_materia.ListCount + 4

For I = 3 To GRID.Cols - 2

cmb_materia.ListIndex = I - 3

d_grid(I).n_col = I

d_grid(I).ancho_col = 700

d_grid(I).cabecera_col = cmb_materia.TEXT

d_grid(I).campo_col = cmb_materia.TEXT

d_grid(I).revisar = True

Next

I = GRID.Cols - 1

d_grid(I).n_col = I

d_grid(I).ancho_col = 1500

d_grid(I).cabecera_col = "Observacion"

d_grid(I).campo_col = "Observacion"

d_grid(I).revisar = False

End Sub

Private Sub CONF_GRID()

Dim I As Integer

GRID.Rows = 2

For I = 0 To GRID.Cols - 1

GRID.ColWidth(I) = d_grid(I).ancho_col

GRID.TextMatrix(0, I) = d_grid(I).cabecera_col

Next

End Sub

Private Function LETRA_NUMERO(NUM As Integer) As String

Select Case NUM

Case 1: LETRA_NUMERO = "A"

Case 2: LETRA_NUMERO = "B"

Case 3: LETRA_NUMERO = "C"

Case 4: LETRA_NUMERO = "D"

Case 5: LETRA_NUMERO = "E"

Case 6: LETRA_NUMERO = "F"

Case 7: LETRA_NUMERO = "G"

Case 8: LETRA_NUMERO = "H"

Case 9: LETRA_NUMERO = "I"

Case 10: LETRA_NUMERO = "J"

Case 11: LETRA_NUMERO = "K"

Case 12: LETRA_NUMERO = "L"

Page 117: Tesis Sistema Informatico de La Escuela 21 de Mayo

78

Case 13: LETRA_NUMERO = "M"

Case 14: LETRA_NUMERO = "N"

Case 15: LETRA_NUMERO = "O"

Case 16: LETRA_NUMERO = "P"

Case 17: LETRA_NUMERO = "Q"

Case 18: LETRA_NUMERO = "R"

Case 19: LETRA_NUMERO = "S"

Case 20: LETRA_NUMERO = "T"

Case 21: LETRA_NUMERO = "U"

Case 22: LETRA_NUMERO = "V"

Case 23: LETRA_NUMERO = "W"

Case 24: LETRA_NUMERO = "X"

Case 25: LETRA_NUMERO = "Y"

Case 26: LETRA_NUMERO = "Z"

Case 27: LETRA_NUMERO = "AA"

Case 28: LETRA_NUMERO = "AB"

Case 29: LETRA_NUMERO = "AC"

Case 30: LETRA_NUMERO = "AD"

Case 31: LETRA_NUMERO = "AE"

Case 32: LETRA_NUMERO = "AF"

Case 33: LETRA_NUMERO = "AG"

Case 34: LETRA_NUMERO = "AH"

Case Else: LETRA_NUMERO = "A"

End Select

End Function

1.14 FORMULARIO REGISTRO DE PARALELOS

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim d_grid(100) As DATOS_GRID

Dim a_col As Integer

Dim a_fil As Integer

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

Page 118: Tesis Sistema Informatico de La Escuela 21 de Mayo

79

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmb_cursos_Click()

Dim c As Integer

txt.Visible = False

GRID.Rows = 2

For c = 0 To GRID.Cols - 1

GRID_RES.TextMatrix(1, c) = ""

If c = 0 Or c = 3 Then

GRID.TextMatrix(1, c) = ""

ElseIf c = 1 Then

GRID.TextMatrix(1, c) = ExtraeIDCombo(cmb_cursos)

Else

GRID.TextMatrix(1, c) = txtperiodo.TEXT

End If

Next

CARGA_GRID

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_cancelar_Click()

'LLenaDatosForm

End Sub

Private Sub cmd_eliminar_Click()

txt.Visible = False

If Permiso("E", Me.Name) = False Then Exit Sub

ELIMINA_ITEM_GRID GRID.Row

End Sub

Private Sub cmd_guardar_Click()

'Guardar

BORRA_DATOS_GRID

GUARDA_GRID

End Sub

Private Sub cmd_nuevo_Click()

Page 119: Tesis Sistema Informatico de La Escuela 21 de Mayo

80

'Nuevo

If cmb_cursos.ListIndex = -1 Then Exit Sub

GRID.Rows = GRID.Rows + 1

GRID.TextMatrix(GRID.Rows - 1, 1) = ExtraeIDCombo(cmb_cursos)

'MsgBox (ExtraeIDCombo(cmb_cursos))

GRID.TextMatrix(GRID.Rows - 1, 2) = txtperiodo.TEXT

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_Load()

filtro = ""

coloca_tolti Me

txtperiodo.TEXT = Gperiodo

LLENACOMBO cmb_cursos, "select codigo,nombre from grados"

strtabla = "paralelo"

camposKP = "|codigo|"

nuevo_reg = "codigo"

DAT_grid

CONF_GRID

If cmb_cursos.ListCount > 0 Then cmb_cursos.ListIndex = 0

'Set FRM = Me

'LLenaDatosForm

End Sub

Private Sub DAT_grid()

GRID.Cols = 4

GRID_RES.Cols = 4

d_grid(0).n_col = 0

d_grid(0).ancho_col = 800

d_grid(0).cabecera_col = "Codigo"

d_grid(0).campo_col = "codigo"

d_grid(0).editable = False

d_grid(1).n_col = 1

d_grid(1).ancho_col = 0

d_grid(1).cabecera_col = ""

Page 120: Tesis Sistema Informatico de La Escuela 21 de Mayo

81

d_grid(1).campo_col = "grado"

d_grid(1).editable = False

d_grid(2).n_col = 2

d_grid(2).ancho_col = 0

d_grid(2).cabecera_col = ""

d_grid(2).campo_col = "periodo"

d_grid(2).editable = False

d_grid(3).n_col = 3

d_grid(3).ancho_col = 1000

d_grid(3).cabecera_col = "Nombre"

d_grid(3).campo_col = "codigo"

d_grid(3).editable = True

End Sub

Private Sub CONF_GRID()

Dim I As Integer

GRID.Rows = 2

For I = 0 To GRID.Cols - 1

GRID.ColWidth(I) = d_grid(I).ancho_col

GRID.TextMatrix(0, I) = d_grid(I).cabecera_col

Next

End Sub

Private Sub GRID_Click()

Dim a_tex As String

If cmb_cursos.ListIndex = -1 Then Exit Sub

If d_grid(GRID.col).editable = False Or GRID.Row = 0 Then Exit Sub

a_col = GRID.col

a_fil = GRID.Row

a_tex = ""

txt.Visible = False

txt.Top = GRID.Top + GRID.CellTop

txt.Left = GRID.Left + GRID.CellLeft

txt.Width = GRID.CellWidth - 10

txt.Height = GRID.CellHeight - 10

txt.TEXT = GRID.TextMatrix(a_fil, a_col)

txt.Visible = True

txt.SetFocus

End Sub

Private Sub txt_Change()

GRID.TextMatrix(a_fil, a_col) = txt.TEXT

End Sub

Private Sub GUARDA_GRID()

Dim I, mayor As Integer

Dim SQLSTR As String

Set tabla = base.Execute("select isnull(max(cast(" & nuevo_reg & " as integer)),0)

+ 1 as nuevo from " & strtabla)

mayor = tabla.Fields(0).Value

Page 121: Tesis Sistema Informatico de La Escuela 21 de Mayo

82

tabla.Close

Set tabla = Nothing

For I = 1 To GRID.Rows - 1

If GRID.TextMatrix(I, 0) = "" Then 'hay que insertar

SQLSTR = "INSERT INTO " & strtabla & "(codigo,grado,periodo,nombre)

Values ('" & mayor & "','" & GRID.TextMatrix(I, 1) & "','" &

GRID.TextMatrix(I, 2) & "','" & GRID.TextMatrix(I, 3) & "')"

GRID.TextMatrix(I, 0) = mayor

mayor = mayor + 1

Else ' hay que actualizar

SQLSTR = "UPDATE " & strtabla & " set nombre='" & GRID.TextMatrix(I,

3) & "' where codigo='" & GRID.TextMatrix(I, 0) & "'"

End If

base.Execute (SQLSTR)

Next

End Sub

Private Sub BORRA_DATOS_GRID()

Dim I, c As Integer

Dim SQLSTR As String

For I = 1 To GRID_RES.Rows - 1

If GRID_RES.TextMatrix(I, 0) <> "" Then

SQLSTR = "DELETE FROM " & strtabla & " WHERE codigo='" &

GRID_RES.TextMatrix(I, 0) & "'"

base.Execute (SQLSTR)

End If

Next

GRID_RES.Rows = 2

For c = 0 To GRID_RES.Cols - 1

GRID_RES.TextMatrix(1, c) = ""

Next

End Sub

Private Sub CARGA_GRID()

Dim SQLSTR As String

Dim I, FILAS As Integer

FILAS = 1

SQLSTR = "SELECT CODIGO,grado,PERIODO,NOMBRE FROM

PARALELO WHERE grado='" & ExtraeIDCombo(cmb_cursos) & "' AND

PERIODO='" & txtperiodo.TEXT & "' ORDER BY CAST(CODIGO AS

INTEGER)"

Set tabla = base.Execute(SQLSTR)

Do Until tabla.EOF = True

If FILAS = GRID.Rows Then GRID.Rows = GRID.Rows + 1

GRID.TextMatrix(FILAS, 0) = tabla.Fields(0).Value

GRID.TextMatrix(FILAS, 1) = tabla.Fields(1).Value

GRID.TextMatrix(FILAS, 2) = tabla.Fields(2).Value

GRID.TextMatrix(FILAS, 3) = tabla.Fields(3).Value

FILAS = FILAS + 1

tabla.MoveNext

Page 122: Tesis Sistema Informatico de La Escuela 21 de Mayo

83

Loop

tabla.Close

Set tabla = Nothing

End Sub

Private Sub ELIMINA_ITEM_GRID(FILA As Integer)

Dim r, I As Integer

If GRID.TextMatrix(FILA, 0) <> "" Then

If GRID_RES.Rows = 2 And GRID_RES.TextMatrix(1, 0) = "" Then 'NO

HAY NADA

GRID_RES.TextMatrix(1, 0) = GRID.TextMatrix(FILA, 0)

GRID_RES.TextMatrix(1, 1) = GRID.TextMatrix(FILA, 1)

GRID_RES.TextMatrix(1, 2) = GRID.TextMatrix(FILA, 2)

GRID_RES.TextMatrix(1, 3) = GRID.TextMatrix(FILA, 3)

Else

r = GRID_RES.Rows

GRID_RES.Rows = GRID_RES.Rows + 1

GRID_RES.TextMatrix(r, 0) = GRID.TextMatrix(FILA, 0)

GRID_RES.TextMatrix(r, 1) = GRID.TextMatrix(FILA, 1)

GRID_RES.TextMatrix(r, 2) = GRID.TextMatrix(FILA, 2)

GRID_RES.TextMatrix(r, 3) = GRID.TextMatrix(FILA, 3)

End If

End If

For I = FILA To GRID.Rows - 2

GRID.TextMatrix(I, 0) = GRID.TextMatrix(I + 1, 0)

GRID.TextMatrix(I, 1) = GRID.TextMatrix(I + 1, 1)

GRID.TextMatrix(I, 2) = GRID.TextMatrix(I + 1, 2)

GRID.TextMatrix(I, 3) = GRID.TextMatrix(I + 1, 3)

Next

GRID.Rows = GRID.Rows - 1

End Sub

Private Sub txt_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNombre(KeyAscii)

End Sub

1.15 FORMULARIO REGISTRO DE TRIMESTRES O PARCIALES

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Public Function Get_Accion() As String

Get_Accion = accion

Page 123: Tesis Sistema Informatico de La Escuela 21 de Mayo

84

End Function

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Elimna_reg

End Sub

Private Sub cmd_guardar_Click()

Guardar

End Sub

Private Sub cmd_nuevo_Click()

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

Page 124: Tesis Sistema Informatico de La Escuela 21 de Mayo

85

LLenaDatosForm 2

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_Load()

filtro = ""

strtabla = "trimestres"

camposKP = "|codigo|"

nuevo_reg = "codigo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub txtnombre_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.16 FORMULARIO ESTABLCER PERIODO ACTIVO

Private Sub Form_Load()

LLENACOMBO cmb_periodos, "select codigo,nombre from periodo"

SELECTCOMBO cmb_periodos, Gperiodo

End Sub

Private Sub LaVolpeButton1_Click()

Gperiodo = ExtraeIDCombo(cmb_periodos)

Grabar_Ini ruta_ini, "periodo", Gperiodo

NOMBRE_PERIODO = cmb_periodos.TEXT

MDIForm1.Caption = "Systema de Control Escolar - " & cmb_periodos.TEXT

End Sub

Private Sub LaVolpeButton2_Click()

Unload Me

End Sub

1.17 FORMULARIO REGISTRO DE PERIODOS

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Page 125: Tesis Sistema Informatico de La Escuela 21 de Mayo

86

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_buscar_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,NOMBRE FROM periodo "

Busqueda_where " WHERE codigo+NOMBRE "

Busqueda_orden "2"

Busqueda_Ncampos 2

Busqueda_campos 0, "Codigo", 20

Busqueda_campos 1, "Periodo", 80

Busqueda_indice 0

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

LLenaDatosForm 0, Busqueda.retorna

End If

Exit Sub

SALIR:

ERRORES

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Page 126: Tesis Sistema Informatico de La Escuela 21 de Mayo

87

Elimna_reg

End Sub

Private Sub cmd_guardar_Click()

Guardar

End Sub

Private Sub cmd_nuevo_Click()

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then SendKeys vbTab

End Sub

Private Sub Form_Load()

filtro = ""

strtabla = "PERIODO"

camposKP = "|codigo|"

nuevo_reg = "codigo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub txtdescripcion_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txtnombre_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Page 127: Tesis Sistema Informatico de La Escuela 21 de Mayo

88

1.18 FORMULARIO PERMISOS DE USUARIOS

Private Sub EjecutaSQL(cade As String)

On Error GoTo SALIR2

base.Execute (cade)

Exit Sub

SALIR2:

ERRORES

End Sub

Private Sub cmb_usuario_Click()

If cmb_usuario.ListIndex = -1 Then Exit Sub

LLENAListCheck list_permisos, "select p.codigo,p.nombre,estado=isnull((select

estado from permisos_usuario where permiso=p.codigo and usuario='" &

ExtraeIDCombo(cmb_usuario) & "' ),'0') from permisos p order by p.nombre"

End Sub

Private Sub cmd_guardar_Click()

Dim SQL1 As String

Dim SQL2 As String

Dim I As Integer

Dim t_per As New ADODB.Recordset

If cmb_usuario.ListIndex = -1 Then Exit Sub

For I = 0 To list_permisos.ListCount - 1

list_permisos.ListIndex = I

SQL1 = "select * from permisos_usuario where permiso='" &

ExtraeIDCombo(list_permisos) & "' and usuario='" &

ExtraeIDCombo(cmb_usuario) & "'"

Set t_per = base.Execute(SQL1)

If t_per.EOF = False Then

SQL2 = "UPDATE PERMISOS_USUARIO SET ESTADO='" &

CInt(list_permisos.Selected(I)) & "' WHERE permiso='" &

ExtraeIDCombo(list_permisos) & "' and usuario='" &

ExtraeIDCombo(cmb_usuario) & "'"

Else

SQL2 = "INSERT INTO

PERMISOS_USUARIO(PERMISO,USUARIO,ESTADO) VALUES('" &

ExtraeIDCombo(list_permisos) & "','" & ExtraeIDCombo(cmb_usuario) & "','" &

CInt(list_permisos.Selected(I)) & "')"

End If

t_per.Close

Set t_per = Nothing

EjecutaSQL SQL2

Next

Mensage "Registro Guardado o Modificado los permisos"

End Sub

Private Sub Form_Load()

Me.Top = 0

Page 128: Tesis Sistema Informatico de La Escuela 21 de Mayo

89

Me.Left = 10

coloca_tolti Me

LLENACOMBO cmb_usuario, "select codigo,nombre from usuarios order by

nombre"

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Public Sub SALIR()

Unload Me

End Sub

1.19 FORMULARIO REGISTRO DE PROFESORES

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_buscar_Click()

Page 129: Tesis Sistema Informatico de La Escuela 21 de Mayo

90

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,NOMBRE,cedula,direccion FROM profesor "

Busqueda_where " WHERE codigo+NOMBRE+cedula "

Busqueda_orden "2"

Busqueda_Ncampos 4

Busqueda_campos 0, "Codigo", 5

Busqueda_campos 1, "Nombre", 30

Busqueda_campos 2, "Cedula", 15

Busqueda_campos 3, "Direccion", 50

Busqueda_indice 0

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

LLenaDatosForm 0, Busqueda.retorna

End If

Exit Sub

SALIR:

ERRORES

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Elimna_reg

End Sub

Private Sub cmd_guardar_Click()

Guardar

End Sub

Private Sub cmd_nuevo_Click()

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then SendKeys vbTab

Page 130: Tesis Sistema Informatico de La Escuela 21 de Mayo

91

End Sub

Private Sub Form_Load()

Dim ruta As String

ruta = App.Path & "\iconos\listo.gif"

img_listo.Picture = LoadPicture(ruta)

filtro = ""

LLENACOMBO CMB_ESTADO_CIVIL, "select codigo,nombre from

testado_civil"

LLENACOMBO cmb_sexo, "select codigo,nombre from tsexo"

strtabla = "PROFESOR"

camposKP = "|codigo|"

nuevo_reg = "codigo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub txtcedula_Change()

If Cedula(txtcedula) = False Then

img_listo.Visible = False

'Mensage "El numero de cedula es " & vbCr & "Incorrecto"

Else

img_listo.Visible = True

End If

End Sub

Private Sub txtcedula_KeyPress(KeyAscii As Integer)

KeyAscii = SoloCedula(KeyAscii)

End Sub

Private Sub txtdireccion_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txtnombre_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNombre(KeyAscii)

End Sub

Private Sub txttelefono_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txttitulo_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.20 FORMULARIO INFORME ASISTENCIAS DE PROFESORES

Dim Imprimir As Boolean

Private Sub cmd_imprimir_Click()

On Error Resume Next

If Imprimir = False Then Exit Sub

If opt_detallado.Value = True Then

Page 131: Tesis Sistema Informatico de La Escuela 21 de Mayo

92

dtr_Asistencias_profesor_detallado.PrintReport

Else

dtr_Asistencias_profesor_concentrado.PrintReport

End If

End Sub

Private Sub cmd_procesar_Click()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

numero = 1

If cmb_periodo.ListIndex = -1 Then Exit Sub

If opt_detallado.Value = True Then

SQL1 = "select A.fecha,P.nombre,Asistencias=(case A.estado when 'S' then

'Asistio' else 'Falto' end),Justificaciones=(case A.Justificada when 'S' then

'Justificado' else '' end),Atrasos=(case A.atraso when 'S' then 'Atraso' else ''

end),A.hora_e,A.hora_s from asistencias_p as A join Profesor as P on

P.codigo=A.profesor where (A.estado='S' or A.justificada='S' or A.atraso='S') and

A.periodo='" & ExtraeIDCombo(cmb_periodo) & "' and A.fecha>='" &

dtp_desde.Value & "' and A.fecha<='" & DTP_hasta.Value & "' order by A.fecha"

coloca_rep

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_Asistencias_profesor_detallado.DataSource = tabla_rep

dtr_Asistencias_profesor_detallado.Sections("S4").Controls("eti_periodo").Captio

n = cmb_periodo.TEXT

dtr_Asistencias_profesor_detallado.Sections("S4").Controls("eti_escuela").Captio

n = NOMBRE_ESCUELA

Set

dtr_Asistencias_profesor_detallado.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_Asistencias_profesor_detallado.Refresh

Else

SQL1 = "select nombre,Asistencias=isnull((select sum(case estado when 'S'

then 1 else 0 end) from asistencias_p where periodo='" &

ExtraeIDCombo(cmb_periodo) & "' and profesor=P.codigo and fecha>='" &

dtp_desde.Value & "' and fecha <='" & DTP_hasta.Value & "'

),0),Justificaciones=isnull((select sum(case justificada when 'S' then 1 else 0 end)

from asistencias_p where periodo='" & ExtraeIDCombo(cmb_periodo) & "' and

profesor=P.codigo and fecha>='" & dtp_desde.Value & "' and fecha <='" &

DTP_hasta.Value & "'),0),Atrasos=isnull((select sum(case atraso when 'S' then 1

else 0 end) from asistencias_p where periodo='" & ExtraeIDCombo(cmb_periodo)

& "' and profesor=P.codigo and fecha>='" & dtp_desde.Value & "' and fecha <='"

& DTP_hasta.Value & "'),0) from profesor as P "

coloca_rep2

Page 132: Tesis Sistema Informatico de La Escuela 21 de Mayo

93

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_Asistencias_profesor_concentrado.DataSource = tabla_rep

dtr_Asistencias_profesor_concentrado.Sections("S4").Controls("eti_periodo").Ca

ption = cmb_periodo.TEXT

dtr_Asistencias_profesor_concentrado.Sections("S4").Controls("eti_escuela").Cap

tion = NOMBRE_ESCUELA

Set

dtr_Asistencias_profesor_concentrado.Sections("S4").Controls("escudo").Picture

= LoadPicture(ruta_escudo)

Imprimir = True

dtr_Asistencias_profesor_concentrado.Refresh

End If

End Sub

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error Resume Next

Me.Top = 0

Me.Left = 10

coloca_tolti Me

Imprimir = False

LLENACOMBO cmb_periodo, "select codigo,nombre from periodo"

cmb_periodo.ListIndex = IndexList(cmb_periodo, CLng(Gperiodo))

End Sub

Private Sub coloca_rep()

On Error Resume Next

dockForm dtr_Asistencias_profesor_detallado.hWnd, Picture1, True

End Sub

Private Sub coloca_rep2()

On Error Resume Next

dockForm dtr_Asistencias_profesor_concentrado.hWnd, Picture1, True

End Sub

Private Sub Form_Unload(Cancel As Integer)

On Error Resume Next

Unload dtr_Asistencias_profesor_concentrado

Unload dtr_Asistencias_profesor_detallado

End Sub

Private Sub opt_concentrado_Click()

Imprimir = False

End Sub

Page 133: Tesis Sistema Informatico de La Escuela 21 de Mayo

94

Private Sub opt_detallado_Click()

Imprimir = False

End Sub

1.21 FORMULARIO INFORME DE NOTAS X TRIMESTRE

Dim Imprimir As Boolean

Private Sub cmb_grado_Click()

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "'"

LLENACOMBO cmb_materias, "select codigo,nombre from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_GRADO WHERE

periodo='" & ExtraeIDCombo(cmb_periodo) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "')"

End Sub

Private Sub cmb_profesor_Click()

cmb_paralelo.Clear

cmb_grado.Clear

cmb_materias.Clear

If cmb_profesor.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_grado, "select codigo,nombre from grados WHERE

CODIGO IN(SELECT grado from MATERIA_PROFESOR WHERE

PERIODO='" & ExtraeIDCombo(cmb_periodo) & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' )"

LLENACOMBO cmb_materias, "select codigo,nombre from materias WHERE

CODIGO IN(SELECT MATERIA from MATERIA_PROFESOR WHERE

PERIODO='" & ExtraeIDCombo(cmb_periodo) & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' )"

End Sub

Private Sub cmd_imprimir_Click()

On Error Resume Next

If Imprimir = False Then Exit Sub

dtr_notas_x_trimestre.PrintReport

End Sub

Private Sub cmd_procesar_Click()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

numero = 1

Page 134: Tesis Sistema Informatico de La Escuela 21 de Mayo

95

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Or

cmb_materias.ListIndex = -1 Or cmb_parcial.ListIndex = -1 Or

cmb_periodo.ListIndex = -1 Then Exit Sub

SQL1 = "SELECT M.N_lista,estu=(select nombres from estudiante where

codigo=M.estudiante),N.conducta,N.deber,N.leccion,N.trabajo,N.aporte,N.exame

n,N.actuacion,promedio=round(((N.deber+N.leccion+N.trabajo+N.aporte+N.exa

men+N.actuacion)/6),0),observacion=dbo.val_obs(round((N.deber+N.leccion+N.t

rabajo+N.aporte+N.examen+N.actuacion)/6,0),M.periodo) FROM MATRICULA

M join notas N on M.codigo=N.matricula and M.periodo=N.periodo where

M.periodo='" & ExtraeIDCombo(cmb_periodo) & "' and M.grado='" &

ExtraeIDCombo(cmb_grado) & "' and M.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' and N.materia='" &

ExtraeIDCombo(cmb_materias) & "' and N.trimestre='" &

ExtraeIDCombo(cmb_parcial) & "' order by estu"

Set tabla_rep = base.Execute(SQL1)

Do Until tabla_rep.EOF = True

SQL2 = "update matricula set N_lista=" & numero & " where periodo='" &

Gperiodo & "' and codigo='" & tabla_rep.Fields(1).Value & "' "

base.Execute (SQL2)

numero = numero + 1

tabla_rep.MoveNext

Loop

tabla_rep.Close

Set tabla_rep = Nothing

coloca_rep

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_notas_x_trimestre.DataSource = tabla_rep

dtr_notas_x_trimestre.Sections("S2").Controls("eti_grado").Caption =

cmb_grado.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_paralelo").Caption =

cmb_paralelo.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_profesor").Caption =

cmb_profesor.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_materia").Caption =

cmb_materias.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_trimestre").Caption =

cmb_parcial.TEXT

dtr_notas_x_trimestre.Sections("S4").Controls("eti_periodo").Caption =

cmb_periodo.TEXT

dtr_notas_x_trimestre.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_notas_x_trimestre.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_notas_x_trimestre.Refresh

End Sub

Page 135: Tesis Sistema Informatico de La Escuela 21 de Mayo

96

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error Resume Next

Me.Top = 0

Me.Left = 10

coloca_tolti Me

Imprimir = False

Dim HOJA As Worksheet

Set HOJA = Libro_exel.Worksheets(1)

HOJA.Unprotect

LLENACOMBO cmb_profesor, "select codigo,nombre from profesor"

LLENACOMBO cmb_parcial, "select codigo,nombre from trimestres"

LLENACOMBO cmb_periodo, "select codigo,nombre from periodo"

cmb_periodo.ListIndex = IndexList(cmb_periodo, CLng(Gperiodo))

End Sub

Private Sub coloca_rep()

On Error Resume Next

dockForm dtr_notas_x_trimestre.hWnd, Picture1, True

End Sub

Private Sub Form_Unload(Cancel As Integer)

Unload dtr_notas_x_trimestre

'Unload dtr_notas_x_trimestre2

End Sub

1.22 FORMULARIO INFORME AUMNOS MATRICULADOS

Dim Imprimir As Boolean

Private Sub chk_casileros_Click()

If chk_casileros.Value = 0 Then

' descargar2

Else

' descargar

End If

Imprimir = False

End Sub

Private Sub descargar()

On Error Resume Next

Unload dtr_estu_matriculados

End Sub

Private Sub descargar2()

On Error Resume Next

Unload dtr_estu_matriculados2

End Sub

Page 136: Tesis Sistema Informatico de La Escuela 21 de Mayo

97

Private Sub cmb_grado_Click()

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" & Gperiodo & "'"

LLENACOMBO cmb_materias, "select codigo,nombre from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_GRADO WHERE

periodo='" & Gperiodo & "' and grado='" & ExtraeIDCombo(cmb_grado) & "')"

End Sub

Private Sub cmd_imprimir_Click()

On Error Resume Next

If Imprimir = False Then Exit Sub

If chk_casileros.Value = 0 Then

dtr_estu_matriculados.PrintReport

Else

dtr_estu_matriculados2.PrintReport

End If

End Sub

Private Sub cmd_procesar_Click()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

numero = 1

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Then Exit Sub

SQL1 = "select M.N_lista,M.codigo,estu=(select nombres from estudiante where

codigo=M.estudiante),grado=(select nombre from grados where

codigo=M.grado),paralelo=(select nombre from paralelo where

codigo=M.paralelo),M.folio from matricula M where periodo='" & Gperiodo &

"' and grado='" & ExtraeIDCombo(cmb_grado) & "' and paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' order by estu"

Set tabla_rep = base.Execute(SQL1)

Do Until tabla_rep.EOF = True

SQL2 = "update matricula set N_lista=" & numero & " where periodo='" &

Gperiodo & "' and codigo='" & tabla_rep.Fields(1).Value & "' "

base.Execute (SQL2)

numero = numero + 1

tabla_rep.MoveNext

Loop

tabla_rep.Close

Set tabla_rep = Nothing

If chk_casileros.Value = 0 Then

coloca_rep

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_estu_matriculados.DataSource = tabla_rep

dtr_estu_matriculados.Sections("S2").Controls("eti_grado").Caption =

cmb_grado.TEXT

Page 137: Tesis Sistema Informatico de La Escuela 21 de Mayo

98

dtr_estu_matriculados.Sections("S2").Controls("eti_paralelo").Caption =

cmb_paralelo.TEXT

dtr_estu_matriculados.Sections("S4").Controls("eti_periodo").Caption =

NOMBRE_PERIODO

dtr_estu_matriculados.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_estu_matriculados.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_estu_matriculados.Refresh

Else

coloca_rep2

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_estu_matriculados2.DataSource = tabla_rep

dtr_estu_matriculados2.Sections("S2").Controls("eti_grado").Caption =

cmb_grado.TEXT

dtr_estu_matriculados2.Sections("S2").Controls("eti_paralelo").Caption =

cmb_paralelo.TEXT

dtr_estu_matriculados2.Sections("S2").Controls("eti_materia").Caption =

cmb_materias.TEXT

dtr_estu_matriculados2.Sections("S4").Controls("eti_periodo").Caption =

NOMBRE_PERIODO

dtr_estu_matriculados2.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_estu_matriculados2.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_estu_matriculados2.Refresh

End If

End Sub

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error Resume Next

coloca_tolti Me

Me.Top = 0

Me.Left = 10

Imprimir = False

LLENACOMBO cmb_grado, "select codigo,nombre from grados"

End Sub

Private Sub coloca_rep()

On Error Resume Next

dockForm dtr_estu_matriculados.hWnd, Picture1, True

End Sub

Page 138: Tesis Sistema Informatico de La Escuela 21 de Mayo

99

Private Sub coloca_rep2()

On Error Resume Next

dockForm dtr_estu_matriculados2.hWnd, Picture1, True

End Sub

Private Sub Form_Unload(Cancel As Integer)

Unload dtr_estu_matriculados

Unload dtr_estu_matriculados2

End Sub

1.23 FORMULARIO INFORME DE NOTAS X ALUMNO RESUMIDO

Dim Imprimir As Boolean

Private Sub cmb_grado_Click()

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "'"

End Sub

Private Sub cmb_paralelo_Click()

If cmb_paralelo.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_alumno, "select codigo,nombres=(select nombres from

estudiante where codigo=matricula.estudiante) from matricula where estado='S'

and grado='" & ExtraeIDCombo(cmb_grado) & "' and paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "' order by nombres"

End Sub

Private Sub cmd_guardar_Click()

Dim I As Integer

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Then Exit Sub

For I = 0 To cmb_alumno.ListCount - 1

cmb_alumno.ListIndex = I

procesar

DoEvents

dtr_notas_alumno_concentrado.PrintReport

DoEvents

Next

End Sub

Private Sub cmd_imprimir_Click()

On Error Resume Next

If Imprimir = False Then Exit Sub

dtr_notas_alumno_concentrado.PrintReport

End Sub

Page 139: Tesis Sistema Informatico de La Escuela 21 de Mayo

100

Private Sub cmd_procesar_Click()

procesar

End Sub

Private Sub procesar()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

numero = 1

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Or

cmb_periodo.ListIndex = -1 Or cmb_alumno.ListIndex = -1 Then Exit Sub

SQL1 = "select

M2.materia,M2.promedio1,M2.promedio2,M2.promedio3,M2.conducta1,M2.con

ducta2,M2.conducta3,promedio_con=round((M2.conducta1+M2.conducta2+M2.c

onducta3) /

3,0),total=M2.promedio1+M2.promedio2+M2.promedio3,observacion=dbo.val_o

bs2(M2.promedio1+M2.promedio2+M2.promedio3,'" &

ExtraeIDCombo(cmb_periodo) & "') from (SELECT materia=(select nombre

from materias where codigo=M.materia), conducta1=isnull((select conducta from

notas where periodo='" & ExtraeIDCombo(cmb_periodo) & "' and

materia=M.materia and trimestre='1' and matricula='" &

ExtraeIDCombo(cmb_alumno) & "' ),0),conducta2=isnull((select conducta from

notas where periodo='" & ExtraeIDCombo(cmb_periodo) & "' and

materia=M.materia and trimestre='2'and matricula='" &

ExtraeIDCombo(cmb_alumno) & "' ),0),conducta3=isnull((select conducta from

notas where periodo='" & ExtraeIDCombo(cmb_periodo) & "' and

materia=M.materia and trimestre='3' and matricula='" &

ExtraeIDCombo(cmb_alumno) & "' ),0) "

SQL1 = SQL1 & " ,promedio1=isnull((select promedio2 from notas where

periodo='" & ExtraeIDCombo(cmb_periodo) & "' and materia=M.materia and

trimestre='1' and matricula='" & ExtraeIDCombo(cmb_alumno) &

"'),0),promedio2=isnull((select promedio2 from notas where periodo='" &

ExtraeIDCombo(cmb_periodo) & "' and materia=M.materia and trimestre='2' and

matricula='" & ExtraeIDCombo(cmb_alumno) & "'),0),promedio3=isnull((select

promedio2 from notas where periodo='" & ExtraeIDCombo(cmb_periodo) & "'

and materia=M.materia and trimestre='3' and matricula='" &

ExtraeIDCombo(cmb_alumno) & "'),0) FROM materia_grado M where

M.periodo='" & ExtraeIDCombo(cmb_periodo) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "' ) M2 order by M2.materia"

'SQL1 = SQL1 & " where M2.periodo='" & ExtraeIDCombo(cmb_periodo) & "'

and M2.grado='" & ExtraeIDCombo(cmb_grado) & "' and M2.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' order by estu"

coloca_rep

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_notas_alumno_concentrado.DataSource = tabla_rep

dtr_notas_alumno_concentrado.Sections("S2").Controls("eti_grado").Caption =

cmb_grado.TEXT

Page 140: Tesis Sistema Informatico de La Escuela 21 de Mayo

101

dtr_notas_alumno_concentrado.Sections("S2").Controls("eti_paralelo").Caption =

cmb_paralelo.TEXT

dtr_notas_alumno_concentrado.Sections("S2").Controls("eti_alumno").Caption =

cmb_alumno.TEXT

'dtr_notas_concentrado.Sections("S2").Controls("eti_materia").Caption =

cmb_materias.TEXT

'dtr_notas_concentrado.Sections("S2").Controls("eti_trimestre").Caption =

cmb_parcial.Text

dtr_notas_alumno_concentrado.Sections("S4").Controls("eti_periodo").Caption =

cmb_periodo.TEXT

dtr_notas_alumno_concentrado.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_notas_alumno_concentrado.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_notas_alumno_concentrado.Refresh

End Sub

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error Resume Next

Me.Top = 0

Me.Left = 10

coloca_tolti Me

Imprimir = False

LLENACOMBO cmb_grado, "select codigo,nombre from grados "

LLENACOMBO cmb_periodo, "select codigo,nombre from periodo"

cmb_periodo.ListIndex = IndexList(cmb_periodo, CLng(Gperiodo))

End Sub

Private Sub coloca_rep()

On Error Resume Next

dockForm dtr_notas_alumno_concentrado.hWnd, Picture1, True

End Sub

Private Sub Form_Unload(Cancel As Integer)

Unload dtr_notas_alumno_concentrado

'Unload dtr_notas_concentrado2

End Sub

1.24 FORMULARIO INFORME DE NOTAS DE ALUMNOS X

TRIMESTRE

Dim Imprimir As Boolean

Private Sub cmb_grado_Click()

Page 141: Tesis Sistema Informatico de La Escuela 21 de Mayo

102

If cmb_grado.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "'"

End Sub

Private Sub cmb_paralelo_Click()

If cmb_paralelo.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_alumno, "select codigo,nombres from estudiante where

codigo IN(select estudiante from matricula where grado='" &

ExtraeIDCombo(cmb_grado) & "' and paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "') order by nombres"

End Sub

Private Sub cmd_guardar_Click()

Dim I As Integer

If cmb_grado.ListIndex = -1 Or cmb_periodo.ListIndex = -1 Or

cmb_paralelo.ListIndex = -1 Or cmb_parcial.ListIndex = -1 Then Exit Sub

For I = 0 To cmb_alumno.ListCount - 1

cmb_alumno.ListIndex = I

procesar

DoEvents

dtr_notas_alumno_x_trimestre.PrintReport

DoEvents

Next

End Sub

Private Sub cmd_imprimir_Click()

On Error Resume Next

If Imprimir = False Then Exit Sub

dtr_notas_alumno_x_trimestre.PrintReport

End Sub

Private Sub procesar()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

numero = 1

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Or

cmb_parcial.ListIndex = -1 Or cmb_periodo.ListIndex = -1 Or

cmb_alumno.ListIndex = -1 Then Exit Sub

SQL1 = "SELECT materia=(select nombre from materias where

codigo=N.materia),N.conducta,N.deber,N.leccion,N.trabajo,N.aporte,N.examen,N

.actuacion,promedio=round(((N.deber+N.leccion+N.trabajo+N.aporte+N.examen

+N.actuacion)/6),0),observacion=dbo.val_obs(round((N.deber+N.leccion+N.traba

jo+N.aporte+N.examen+N.actuacion)/6,0),M.periodo) FROM MATRICULA M

join notas N on M.codigo=N.matricula and M.periodo=N.periodo where

Page 142: Tesis Sistema Informatico de La Escuela 21 de Mayo

103

M.estado='S' and M.estudiante='" & ExtraeIDCombo(cmb_alumno) & "' and

M.periodo='" & ExtraeIDCombo(cmb_periodo) & "' and M.grado='" &

ExtraeIDCombo(cmb_grado) & "' and M.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' and N.trimestre='" &

ExtraeIDCombo(cmb_parcial) & "' order by materia"

coloca_rep

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_notas_alumno_x_trimestre.DataSource = tabla_rep

dtr_notas_alumno_x_trimestre.Sections("S2").Controls("eti_grado").Caption =

cmb_grado.TEXT

dtr_notas_alumno_x_trimestre.Sections("S2").Controls("eti_paralelo").Caption =

cmb_paralelo.TEXT

dtr_notas_alumno_x_trimestre.Sections("S2").Controls("eti_alumno").Caption =

cmb_alumno.TEXT

dtr_notas_alumno_x_trimestre.Sections("S2").Controls("eti_trimestre").Caption =

cmb_parcial.TEXT

dtr_notas_alumno_x_trimestre.Sections("S4").Controls("eti_periodo").Caption =

cmb_periodo.TEXT

dtr_notas_alumno_x_trimestre.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_notas_alumno_x_trimestre.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_notas_alumno_x_trimestre.Refresh

End Sub

Private Sub cmd_procesar_Click()

procesar

End Sub

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error Resume Next

Me.Top = 0

Me.Left = 10

coloca_tolti Me

Imprimir = False

LLENACOMBO cmb_parcial, "select codigo,nombre from trimestres"

LLENACOMBO cmb_grado, "select codigo,nombre from grados "

LLENACOMBO cmb_periodo, "select codigo,nombre from periodo"

cmb_periodo.ListIndex = IndexList(cmb_periodo, CLng(Gperiodo))

End Sub

Private Sub coloca_rep()

On Error Resume Next

dockForm dtr_notas_alumno_x_trimestre.hWnd, Picture1, True

Page 143: Tesis Sistema Informatico de La Escuela 21 de Mayo

104

End Sub

Private Sub Form_Unload(Cancel As Integer)

Unload dtr_notas_alumno_x_trimestre

End Sub

1.25 FORMULARIO INFORME DE NOTAS X TRIMESTRE RESUMIDO

Dim Imprimir As Boolean

Private Sub cmb_grado_Click()

cmb_paralelo.Clear

cmb_materias.Clear

If cmb_grado.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "'"

'LLENACOMBO cmb_materias, "select codigo,nombre from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_GRADO WHERE

periodo='" & ExtraeIDCombo(cmb_periodo) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "')"

End Sub

Private Sub cmb_paralelo_Click()

cmb_materias.Clear

If cmb_grado.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_materias, "select codigo,nombre from materias WHERE

CODIGO IN(SELECT MATERIA from MATERIA_PROFESOR WHERE

PERIODO='" & ExtraeIDCombo(cmb_periodo) & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "' and paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' )"

End Sub

Private Sub cmb_periodo_Click()

cmb_profesor.ListIndex = -1

End Sub

Private Sub cmb_profesor_Click()

cmb_paralelo.Clear

cmb_grado.Clear

cmb_materias.Clear

If cmb_profesor.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_grado, "select codigo,nombre from grados WHERE

CODIGO IN(SELECT grado from MATERIA_PROFESOR WHERE

PERIODO='" & ExtraeIDCombo(cmb_periodo) & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' )"

Page 144: Tesis Sistema Informatico de La Escuela 21 de Mayo

105

End Sub

Private Sub cmd_imprimir_Click()

On Error Resume Next

If Imprimir = False Then Exit Sub

dtr_notas_concentrado.PrintReport

End Sub

Private Sub cmd_procesar_Click()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Dim SQL2 As String

Dim numero As Integer

numero = 1

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Or

cmb_materias.ListIndex = -1 Or cmb_periodo.ListIndex = -1 Then Exit Sub

SQL1 = "select

M2.N_lista,M2.codigo,M2.estu,M2.promedio1,M2.promedio2,M2.promedio3,M2

.conducta1,M2.conducta2,M2.conducta3,promedio_con=round((M2.conducta1+

M2.conducta2+M2.conducta3) /

3,0),total=M2.promedio1+M2.promedio2+M2.promedio3,observacion=dbo.val_o

bs2(M2.promedio1+M2.promedio2+M2.promedio3,M2.periodo) from (SELECT

M.N_lista as N_lista,estu=(select nombres from estudiante where

codigo=M.estudiante),conducta1=isnull((select conducta from notas where

periodo=M.periodo and matricula=M.codigo and trimestre='1' and materia='" &

ExtraeIDCombo(cmb_materias) & "'),0),conducta2=isnull((select conducta from

notas where periodo=M.periodo and matricula=M.codigo and trimestre='2' and

materia='" & ExtraeIDCombo(cmb_materias) & "'),0),conducta3=isnull((select

conducta from notas where periodo=M.periodo and matricula=M.codigo and

trimestre='3' and materia='" & ExtraeIDCombo(cmb_materias) & "'),0) "

SQL1 = SQL1 & ",promedio1=isnull((select promedio2 from notas where

periodo=M.periodo and matricula=M.codigo and trimestre='1' and materia='" &

ExtraeIDCombo(cmb_materias) & "'),0) ,promedio2=isnull((select promedio2

from notas where periodo=M.periodo and matricula=M.codigo and trimestre='2'

and materia='" & ExtraeIDCombo(cmb_materias) &

"'),0),promedio3=isnull((select promedio2 from notas where periodo=M.periodo

and matricula=M.codigo and trimestre='3' and materia='" &

ExtraeIDCombo(cmb_materias) & "'),0),M.codigo as Codigo,M.periodo as

periodo,M.grado as grado,M.paralelo as paralelo FROM MATRICULA M where

M.estado='S') M2"

SQL1 = SQL1 & " where M2.periodo='" & ExtraeIDCombo(cmb_periodo) & "'

and M2.grado='" & ExtraeIDCombo(cmb_grado) & "' and M2.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' order by estu"

Set tabla_rep = base.Execute(SQL1)

Do Until tabla_rep.EOF = True

SQL2 = "update matricula set N_lista=" & numero & " where periodo='" &

ExtraeIDCombo(cmb_periodo) & "' and codigo='" & tabla_rep.Fields(1).Value &

"' "

Page 145: Tesis Sistema Informatico de La Escuela 21 de Mayo

106

base.Execute (SQL2)

numero = numero + 1

tabla_rep.MoveNext

Loop

tabla_rep.Close

Set tabla_rep = Nothing

coloca_rep

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_notas_concentrado.DataSource = tabla_rep

dtr_notas_concentrado.Sections("S2").Controls("eti_grado").Caption =

cmb_grado.TEXT

dtr_notas_concentrado.Sections("S2").Controls("eti_paralelo").Caption =

cmb_paralelo.TEXT

dtr_notas_concentrado.Sections("S2").Controls("eti_profesor").Caption =

cmb_profesor.TEXT

dtr_notas_concentrado.Sections("S2").Controls("eti_materia").Caption =

cmb_materias.TEXT

'dtr_notas_concentrado.Sections("S2").Controls("eti_trimestre").Caption =

cmb_parcial.Text

dtr_notas_concentrado.Sections("S4").Controls("eti_periodo").Caption =

cmb_periodo.TEXT

dtr_notas_concentrado.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_notas_concentrado.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_notas_concentrado.Refresh

End Sub

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error Resume Next

Me.Top = 0

Me.Left = 10

coloca_tolti Me

Imprimir = False

LLENACOMBO cmb_profesor, "select codigo,nombre from profesor"

LLENACOMBO cmb_periodo, "select codigo,nombre from periodo"

cmb_periodo.ListIndex = IndexList(cmb_periodo, CLng(Gperiodo))

End Sub

Private Sub coloca_rep()

On Error Resume Next

dockForm dtr_notas_concentrado.hWnd, Picture1, True

End Sub

Page 146: Tesis Sistema Informatico de La Escuela 21 de Mayo

107

Private Sub Form_Unload(Cancel As Integer)

Unload dtr_notas_concentrado

'Unload dtr_notas_concentrado2

End Sub

1.26 FORMULARIO INFORME DE NOTAS X TRIMESTRE

Dim Imprimir As Boolean

Private Sub cmb_grado_Click()

If cmb_grado.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_paralelo, "select codigo,nombre from paralelo where

grado='" & ExtraeIDCombo(cmb_grado) & "' and periodo='" &

ExtraeIDCombo(cmb_periodo) & "'"

LLENACOMBO cmb_materias, "select codigo,nombre from materias where

CODIGO IN(SELECT MATERIA FROM MATERIA_profesor WHERE

periodo='" & ExtraeIDCombo(cmb_periodo) & "' and grado='" &

ExtraeIDCombo(cmb_grado) & "' and profesor='" &

ExtraeIDCombo(cmb_profesor) & "')"

End Sub

Private Sub cmb_profesor_Click()

cmb_paralelo.Clear

cmb_grado.Clear

cmb_materias.Clear

If cmb_profesor.ListIndex = -1 Then Exit Sub

LLENACOMBO cmb_grado, "select codigo,nombre from grados WHERE

CODIGO IN(SELECT grado from MATERIA_PROFESOR WHERE

PERIODO='" & ExtraeIDCombo(cmb_periodo) & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' )"

'LLENACOMBO cmb_materias, "select codigo,nombre from materias WHERE

CODIGO IN(SELECT MATERIA from MATERIA_PROFESOR WHERE

PERIODO='" & Gperiodo & "' AND PROFESOR='" &

ExtraeIDCombo(cmb_profesor) & "' )"

End Sub

Private Sub cmd_imprimir_Click()

On Error Resume Next

If Imprimir = False Then Exit Sub

dtr_notas_x_trimestre.PrintReport

End Sub

Private Sub cmd_procesar_Click()

Dim tabla_rep As New ADODB.Recordset

Dim SQL1 As String

Page 147: Tesis Sistema Informatico de La Escuela 21 de Mayo

108

Dim SQL2 As String

Dim numero As Integer

numero = 1

If cmb_grado.ListIndex = -1 Or cmb_paralelo.ListIndex = -1 Or

cmb_materias.ListIndex = -1 Or cmb_parcial.ListIndex = -1 Or

cmb_periodo.ListIndex = -1 Then Exit Sub

SQL1 = "SELECT M.N_lista,estu=(select nombres from estudiante where

codigo=M.estudiante),N.conducta,N.deber,N.leccion,N.trabajo,N.aporte,N.exame

n,N.actuacion,promedio=round(((N.deber+N.leccion+N.trabajo+N.aporte+N.exa

men+N.actuacion)/6),0),observacion=dbo.val_obs(round((N.deber+N.leccion+N.t

rabajo+N.aporte+N.examen+N.actuacion)/6,0),M.periodo) FROM MATRICULA

M join notas N on M.codigo=N.matricula and M.periodo=N.periodo where

M.estado='S' and M.periodo='" & ExtraeIDCombo(cmb_periodo) & "' and

M.grado='" & ExtraeIDCombo(cmb_grado) & "' and M.paralelo='" &

ExtraeIDCombo(cmb_paralelo) & "' and N.materia='" &

ExtraeIDCombo(cmb_materias) & "' and N.trimestre='" &

ExtraeIDCombo(cmb_parcial) & "' order by estu"

Set tabla_rep = base.Execute(SQL1)

Do Until tabla_rep.EOF = True

SQL2 = "update matricula set N_lista=" & numero & " where periodo='" &

Gperiodo & "' and codigo='" & tabla_rep.Fields(1).Value & "' "

base.Execute (SQL2)

numero = numero + 1

tabla_rep.MoveNext

Loop

tabla_rep.Close

Set tabla_rep = Nothing

coloca_rep

tabla_rep.Open SQL1, base, adOpenDynamic, adLockOptimistic

Set dtr_notas_x_trimestre.DataSource = tabla_rep

dtr_notas_x_trimestre.Sections("S2").Controls("eti_grado").Caption =

cmb_grado.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_paralelo").Caption =

cmb_paralelo.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_profesor").Caption =

cmb_profesor.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_materia").Caption =

cmb_materias.TEXT

dtr_notas_x_trimestre.Sections("S2").Controls("eti_trimestre").Caption =

cmb_parcial.TEXT

dtr_notas_x_trimestre.Sections("S4").Controls("eti_periodo").Caption =

cmb_periodo.TEXT

dtr_notas_x_trimestre.Sections("S4").Controls("eti_escuela").Caption =

NOMBRE_ESCUELA

Set dtr_notas_x_trimestre.Sections("S4").Controls("escudo").Picture =

LoadPicture(ruta_escudo)

Imprimir = True

dtr_notas_x_trimestre.Refresh

Page 148: Tesis Sistema Informatico de La Escuela 21 de Mayo

109

End Sub

Private Sub cmd_salir_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error Resume Next

Me.Top = 0

Me.Left = 10

coloca_tolti Me

Imprimir = False

LLENACOMBO cmb_profesor, "select codigo,nombre from profesor"

LLENACOMBO cmb_parcial, "select codigo,nombre from trimestres"

LLENACOMBO cmb_periodo, "select codigo,nombre from periodo"

cmb_periodo.ListIndex = IndexList(cmb_periodo, CLng(Gperiodo))

End Sub

Private Sub coloca_rep()

On Error Resume Next

dockForm dtr_notas_x_trimestre.hWnd, Picture1, True

End Sub

Private Sub Form_Unload(Cancel As Integer)

Unload dtr_notas_x_trimestre

'Unload dtr_notas_x_trimestre2

End Sub

1.27 FORMULARIO REGISTRO DE REPRESENTANTES

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Page 149: Tesis Sistema Informatico de La Escuela 21 de Mayo

110

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_buscar_Click()

On Error GoTo SALIR

Busqueda_sql "SELECT codigo,nombre,cedula,direccion FROM representante "

Busqueda_where " where codigo+NOMBRE+cedula "

Busqueda_orden "2"

Busqueda_Ncampos 4

Busqueda_campos 0, "Codigo", 5

Busqueda_campos 1, "Nombre", 40

Busqueda_campos 2, "Cedula", 20

Busqueda_campos 3, "Direccion", 60

Busqueda_indice 0

Load frmbusqueda

frmbusqueda.Show vbModal

If Busqueda.retorna <> "" Then

LLenaDatosForm 0, Busqueda.retorna

End If

Exit Sub

SALIR:

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Elimna_reg

End Sub

Private Sub cmd_guardar_Click()

Page 150: Tesis Sistema Informatico de La Escuela 21 de Mayo

111

Guardar

End Sub

Private Sub cmd_nuevo_Click()

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then SendKeys vbTab

End Sub

Private Sub Form_Load()

Dim ruta As String

ruta = App.Path & "\iconos\listo.gif"

img_listo.Picture = LoadPicture(ruta)

filtro = ""

strtabla = "representante"

camposKP = "|codigo|"

nuevo_reg = "codigo"

LLENACOMBO cmb_sexo, "select codigo,nombre from tsexo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub txtcedula_Change()

If Cedula(txtcedula) = False Then

img_listo.Visible = False

'Mensage "El numero de cedula es " & vbCr & "Incorrecto"

Else

img_listo.Visible = True

End If

End Sub

Private Sub txtcedula_KeyPress(KeyAscii As Integer)

Page 151: Tesis Sistema Informatico de La Escuela 21 de Mayo

112

KeyAscii = SoloCedula(KeyAscii)

End Sub

Private Sub txtdireccion_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txtnombre_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNombre(KeyAscii)

End Sub

Private Sub txttelefono_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txttrabajo_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.28 FORMULARIO REGISTRO DE USUARIOS

Dim strtabla As String

Dim camposKP As String

Dim nuevo_reg As String

Dim reg_actual As String

Dim filtro As String

Dim accion As String

Public Sub Set_Accion(valor As String)

accion = valor

End Sub

Public Function Get_Accion() As String

Get_Accion = accion

End Function

Public Function Get_filtro() As String

Get_filtro = filtro

End Function

Public Function Get_nuevo() As String

Get_nuevo = nuevo_reg

End Function

Public Sub Set_Reg_actual(valor As String)

reg_actual = valor

End Sub

Public Function Get_tabla() As String

Get_tabla = strtabla

End Function

Public Function Get_camposPK() As String

Get_camposPK = camposKP

End Function

Public Sub SALIR()

Unload Me

Page 152: Tesis Sistema Informatico de La Escuela 21 de Mayo

113

End Sub

Private Sub cmd_anterior_Click()

LLenaDatosForm 3

End Sub

Private Sub cmd_cancelar_Click()

Cancelar

End Sub

Private Sub cmd_eliminar_Click()

Elimna_reg

End Sub

Private Sub cmd_guardar_Click()

Guardar

End Sub

Private Sub cmd_nuevo_Click()

Nuevo

End Sub

Private Sub cmd_primero_Click()

LLenaDatosForm 1

End Sub

Private Sub cmd_salir_Click()

SALIR

End Sub

Private Sub cmd_siguiente_Click()

LLenaDatosForm 4

End Sub

Private Sub cmd_ultimo_Click()

LLenaDatosForm 2

End Sub

Private Sub Command1_Click()

CallByName FRM, "Set_Reg_actual", VbMethod, "hola"

End Sub

Private Sub Command2_Click()

MsgBox reg_actual

End Sub

Private Sub Form_Activate()

Set FRM = Me

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then SendKeys vbTab

End Sub

Page 153: Tesis Sistema Informatico de La Escuela 21 de Mayo

114

Private Sub Form_Load()

filtro = ""

strtabla = "Usuarios"

camposKP = "|codigo|"

nuevo_reg = "codigo"

Set FRM = Me

LLenaDatosForm

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txtnombre_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

1.29 FORMULARIO ESTABLECER CONFIGURACIONES

Private Sub cmd_busca_fondo_Click()

On Error Resume Next

cdl2.CancelError = True

cdl2.Filter = "imagenes de mapa de Bit *.bmp|*.bmp|imagenes *.jpg|*.jpg"

'cdl.FileName = "NOTAS " & cmb_materia.Text & " " &

ExtraeIDCombo(cmb_grado) & cmb_paralelo.Text & " " &

ExtraeIDCombo(cmb_parcial) & "º TRIMESTRE"

cdl2.ShowOpen

If cdl2.FileName = "" Then Exit Sub

Img_fondo.tag = cdl2.FileName

Img_fondo.Picture = LoadPicture(cdl2.FileName)

End Sub

Private Sub cmd_guarda_fondo_Click()

Dim CADE1, cade2 As String

If Img_fondo.tag = "" Then Exit Sub

CADE1 = Img_fondo.tag

cade2 = App.Path & "\fondo.bmp"

Kill cade2

FileCopy CADE1, cade2

frm_fondo.cambia_imagen

End Sub

Private Sub cmd_guarda_img_Click()

Dim CADE1, cade2 As String

If foto.tag = "" Then Exit Sub

CADE1 = foto.tag

cade2 = App.Path & "\iconos\escudo.jpg"

Kill cade2

FileCopy CADE1, cade2

Page 154: Tesis Sistema Informatico de La Escuela 21 de Mayo

115

End Sub

Private Sub cmd_guardar_Click()

Guarda_config "1", txt_n_max.TEXT, "Valor de la nota maxima"

Guarda_config "2", txt_n_min.TEXT, "Valor de la nota minima"

Guarda_config "3", txt_sobresaliente.TEXT, "nota minima sobresaliente"

Guarda_config "4", txt_muybueno.TEXT, "nota minima muy bueno"

Guarda_config "5", txt_bueno.TEXT, "nota minima bueno"

Guarda_config "6", txt_regular.TEXT, "nota minima regular"

Guarda_config "7", txt_insuficiente.TEXT, "nota maxima insuficiente"

NOTA_APRUEBA = txt_aprobado.TEXT

Guarda_config "14", txt_aprobado.TEXT, "nota minima para aprobar"

NOTA_SUPLE = txt_supletorio.TEXT

Guarda_config "15", txt_supletorio.TEXT, "nota minima para supletori"

NOTA_REPRUEBA = txt_reprobado.TEXT

Guarda_config "16", txt_reprobado.TEXT, "nota maxima para reprobar"

Guarda_config "17", CStr(cmb_guard_img_estu.ListIndex), "forma en que se

guardan la img de losalumnos"

'datos de la escuela

NOMBRE_ESCUELA = txt_escuela.TEXT

Guarda_config "8", txt_escuela.TEXT, "Nombre de la escuela"

Guarda_config "9", txt_direccion.TEXT, "Direccion de la escuela"

Guarda_config "10", txt_telefono.TEXT, "Telefono de la escuela"

Guarda_config "11", txt_director.TEXT, "Director(a) de la escuela"

Guarda_config "12", txt_secretario.TEXT, "Secretario(a) de la escuela"

Guarda_config "13", txt_ruc, "ruc de la escuela"

End Sub

Private Sub cmd_img_Click()

On Error Resume Next

cdl.CancelError = True

cdl.Filter = "imagenes de mapa de Bit *.bmp|*.bmp|imagenes *.jpg|*.jpg"

'cdl.FileName = "NOTAS " & cmb_materia.Text & " " &

ExtraeIDCombo(cmb_grado) & cmb_paralelo.Text & " " &

ExtraeIDCombo(cmb_parcial) & "º TRIMESTRE"

cdl.ShowOpen

If cdl.FileName = "" Then Exit Sub

foto.tag = cdl.FileName

foto.Picture = LoadPicture(cdl.FileName)

End Sub

Private Sub Form_Load()

coloca_tolti Me

txt_n_max.TEXT = Extrae_config("1")

txt_n_min.TEXT = Extrae_config("2")

txt_sobresaliente.TEXT = Extrae_config("3")

txt_muybueno.TEXT = Extrae_config("4")

Page 155: Tesis Sistema Informatico de La Escuela 21 de Mayo

116

txt_bueno.TEXT = Extrae_config("5")

txt_regular = Extrae_config("6")

txt_insuficiente.TEXT = Extrae_config("7")

txt_aprobado.TEXT = Extrae_config("14")

txt_supletorio.TEXT = Extrae_config("15")

txt_reprobado.TEXT = Extrae_config("16")

'datos de la escuela

txt_escuela.TEXT = Extrae_config("8")

txt_direccion.TEXT = Extrae_config("9")

txt_telefono.TEXT = Extrae_config("10")

txt_director.TEXT = Extrae_config("11")

txt_secretario.TEXT = Extrae_config("12")

txt_ruc = Extrae_config("13")

'varios

If Extrae_config("17") <> "" Then cmb_guard_img_estu.ListIndex =

CInt(Extrae_config("17"))

'carga imagenes

carga_escudo

carga_fondo

End Sub

Private Sub carga_escudo()

Dim cade As String

cade = App.Path & "\iconos\escudo.jpg"

Set foto.Picture = LoadPicture(cade)

End Sub

Private Sub carga_fondo()

Dim cade As String

cade = App.Path & "\fondo.bmp"

Set Img_fondo.Picture = LoadPicture(cade)

End Sub

Private Sub txt_aprobado_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_bueno_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_direccion_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txt_director_KeyPress(KeyAscii As Integer)

Page 156: Tesis Sistema Informatico de La Escuela 21 de Mayo

117

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txt_escuela_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txt_insuficiente_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_muybueno_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_n_max_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_n_min_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_regular_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_reprobado_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_ruc_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_secretario_KeyPress(KeyAscii As Integer)

KeyAscii = SoloTexto(KeyAscii)

End Sub

Private Sub txt_sobresaliente_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_supletorio_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

Private Sub txt_telefono_KeyPress(KeyAscii As Integer)

KeyAscii = SoloNumero(KeyAscii)

End Sub

1.30 FORMULARIO DE BUSQUEDA

Dim Tag2 As String

Private Sub CargaGrid()

Dim I As Integer

Dim aux As Boolean

aux = True

Limpiagrid

If Trim(txtbusqueda.TEXT) <> "" Then

Page 157: Tesis Sistema Informatico de La Escuela 21 de Mayo

118

Set tabla = base.Execute(Busqueda.sql & Busqueda.where & " like '%" &

Trim(txtbusqueda.TEXT) & "%' order by " & Busqueda.orden)

Else

Set tabla = base.Execute(Busqueda.sql & " order by " & Busqueda.orden)

End If

'Label2.Caption = CStr(TABLA.RecordCount)

Do Until tabla.EOF = True

If aux = False Then GRID.AddItem extraedatos(tabla)

If aux = True Then

For I = 0 To Busqueda.Ncampos - 1

GRID.TextMatrix(1, I) = CStr(tabla.Fields(I).Value)

Next

aux = False

End If

tabla.MoveNext

Loop

'If Grid.Rows > 2 Then Grid.RemoveItem (fila)

tabla.Close

Set tabla = Nothing

End Sub

Private Function extraedatos(t As ADODB.Recordset) As String

Dim I As Integer

Dim cade As String

For I = 0 To Busqueda.Ncampos - 1

cade = cade & t.Fields(I).Value

If I < Busqueda.Ncampos - 1 Then cade = cade & Chr(9)

Next

extraedatos = cade

End Function

Private Sub cmd_nuevo_Click()

Unload Me

Busqueda.retorna = "Abrir"

End Sub

Private Sub Command1_Click()

'Mensage Tag2

End Sub

Private Sub Form_Load()

'On Error GoTo SALIR

'configuramos la grilla

Configuragrid

CargaGrid

'set TABLA.Open Busqueda.sql, BASE

'Set data.DataSource = TABLA

If Busqueda.boton = True Then

Page 158: Tesis Sistema Informatico de La Escuela 21 de Mayo

119

cmd_nuevo.Enabled = True

Else

cmd_nuevo.Enabled = False

End If

Busqueda.boton = False

Tag2 = Busqueda.tag

Busqueda.retorna = ""

Exit Sub

SALIR:

ERRORES ' Err.Number, Err.Description

End Sub

Private Sub Limpiagrid()

On Error GoTo SALIR

Dim I As Integer

GRID.Rows = 2

For I = 0 To Busqueda.Ncampos - 1

GRID.TextMatrix(1, I) = ""

Next

Exit Sub

SALIR:

ERRORES ' Err.Number, Err.Description

End Sub

Private Sub Configuragrid()

'On Error GoTo SALIR

Dim I, col As Integer

col = 0

GRID.Cols = 1

For I = 0 To Busqueda.Ncampos - 1

GRID.TextMatrix(0, col) = Busqueda.campos(I).nombre

GRID.ColWidth(col) = (GRID.Width - 400) * Busqueda.campos(I).tamaño /

100

GRID.Cols = GRID.Cols + 1

col = col + 1

Next

If GRID.Cols > 1 Then GRID.Cols = GRID.Cols - 1

Exit Sub

SALIR:

ERRORES ' Err.Number, Err.Description

End Sub

Private Sub Grid_DblClick()

'On Error GoTo SALIR

If Trim(GRID.TextMatrix(GRID.Row, Busqueda.indice)) = "" Then Exit Sub

Busqueda.retorna = GRID.TextMatrix(GRID.Row, Busqueda.indice)

Unload Me

Page 159: Tesis Sistema Informatico de La Escuela 21 de Mayo

120

Exit Sub

SALIR:

ERRORES

End Sub

Private Sub GRID_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then Grid_DblClick

End Sub

Private Sub txtbusqueda_Change()

CargaGrid

End Sub

Private Sub txtbusqueda_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then SendKeys vbTab: Exit Sub

KeyAscii = SoloTexto(KeyAscii)

'If txtbusqueda.TEXT = "" Then CargaGrid

End Sub

Public Sub IsForm()

On Error GoTo SALIR

Dim I As Integer

'Me.ActiveControl

Do Until I > Forms.Count - 1

If Forms(I).tag = Busqueda.tag Then Forms(I).Show: Exit Sub '.WindowState =

vbNormal: Exit Sub

I = I + 1

Loop

Exit Sub

SALIR:

ERRORES

End Sub

Public Sub Opcion2(txt As String)

Busqueda.Opcion = txt

End Sub

Public Sub Tag3(txt As String)

Busqueda.tag = txt

End Sub

Public Function GetRetorna() As String

GetRetorna = Busqueda.retorna

End Function

'FRM.Busqueda.formulario = Me.Name

Page 160: Tesis Sistema Informatico de La Escuela 21 de Mayo

121

1.31 VARIABLE GLOBALES

Public base As New ADODB.Connection

Public tabla As New ADODB.Recordset

Public tabla2 As New ADODB.Recordset

Public tabla_cmb As New ADODB.Recordset

Public tabla_aux As New ADODB.Recordset

Public Apli As Excel.Application

Public FRM As Form

Public ruta_ini As String

Public DSN As String

Public Busqueda As busca

Public Gperiodo As String

Public SECCION As String

Public Cod_usuario As String

Public NOTA_MAX, NOTA_MIN, NOTA_SOBRESALIENTE,

NOTA_MUYBUENO As Double

Public NOTA_BUENO, NOTA_REGULAR, NOTA_INSUFICIENTE As

Double

Public NOMBRE_ESCUELA As String

Public NOMBRE_PERIODO As String

Public NOTA_APRUEBA As String

Public NOTA_SUPLE As String

Public NOTA_REPRUEBA As String

Public ruta_escudo As String

'valores de accion N=nuevo;C=cancelar;E=eliminar;O=otros;M=modificar

Option Explicit

Public nFile As Long

Public Chunk() As Byte

Public Const mBuffer As Long = 16384&

Public Type DatGene

empresa As String

USUARIO As String

End Type

Public Type DATOS_GRID

cabecera_col As String

ancho_col As Integer

campo_col As String

campo_col2 As String

n_col As Integer

editable As Boolean

clave As Boolean

insertable As Boolean

Page 161: Tesis Sistema Informatico de La Escuela 21 de Mayo

122

revisar As Boolean

Obligatorio As Boolean

End Type

Public Type campo

nombre As String

tamaño As Integer

End Type

Public Type busca

sql As String

Ncampos As Integer

indice As Integer

campos(20) As campo

retorna As String

orden As String

where As String

formulario As String

Opcion As String

tag As String

FRM As Form

boton As Boolean

End Type

Public Enum eShowWindow

HIDE_eSW = 0&

SHOWNORMAL_eSW = 1&

NORMAL_eSW = 1&

SHOWMINIMIZED_eSW = 2&

SHOWMAXIMIZED_eSW = 3&

MAXIMIZE_eSW = 3&

SHOWNOACTIVATE_eSW = 4&

SHOW_eSW = 5&

MINIMIZE_eSW = 6&

SHOWMINNOACTIVE_eSW = 7&

SHOWNA_eSW = 8&

RESTORE_eSW = 9&

SHOWDEFAULT_eSW = 10&

MAX_eSW = 10&

End Enum

Public Type POINTAPI

X As Long

Y As Long

End Type

Public Type RECTAPI

Left As Long

Top As Long

Right As Long

Page 162: Tesis Sistema Informatico de La Escuela 21 de Mayo

123

Bottom As Long

End Type

Public Type WINDOWPLACEMENT

Length As Long

Flags As Long

ShowCmd As Long

ptMinPosition As POINTAPI

ptMaxPosition As POINTAPI

rcNormalPosition As RECTAPI

End Type

Public Declare Function GetPrivateProfileString Lib "kernel32" Alias

"GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal

lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As

String, ByVal nSize As Long, ByVal lpFileName As String) As Long

'Función api que Escribe un valor - dato en un archivo Ini

Public Declare Function WritePrivateProfileString Lib "kernel32" Alias

"WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal

lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String)

As Long

' Para hacer ventanas hijas

Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long,

ByVal hWndNewParent As Long) As Long

Public Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long,

ByVal nCmdShow As eShowWindow) As Long

' Para posicionar una ventana según su hWnd

Public Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long,

ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight

As Long, ByVal bRepaint As Long) As Long

'

' Para cambiar el tamaño de una ventana y asignar los valores máximos y mínimos

del tamaño

Public Declare Function GetWindowPlacement Lib "user32" (ByVal hWnd As

Long, ByRef lpwndpl As WINDOWPLACEMENT) As Long

1.32 FUNCIONES GLOBALES

'Public BASE As New ADODB.Connection

'Public frm As Form

Sub main()

On Error GoTo SALIR

ruta_ini = App.Path & "\config.ini"

SECCION = "SISTEMA"

DSN = "DSN=" & Leer_Ini(ruta_ini, "DSN", "")

Gperiodo = Leer_Ini(ruta_ini, "periodo", "")

base.Open DSN '"Dsn=ESCUELA"

ruta_escudo = App.Path & "\iconos\escudo.jpg"

Load form_Login

Page 163: Tesis Sistema Informatico de La Escuela 21 de Mayo

124

form_Login.Show

Exit Sub

SALIR:

ERRORES

'Load MDIForm1

'MDIForm1.Show

End Sub

Public Sub Cancelar()

CallByName FRM, "Set_Accion", VbMethod, "C"

LLenaDatosForm

End Sub

Public Sub LLenaDatosForm(Optional Opcion As Integer = 0, Optional busca As

String = "")

Dim strfiltro, acc, strand, strtabla, campoPK, STRSQL, strbusca, orden, str_reg

As String

Dim aux As Boolean

aux = False

strtabla = CallByName(FRM, "get_tabla", VbMethod)

acc = CallByName(FRM, "get_accion", VbMethod)

strfiltro = CallByName(FRM, "get_filtro", VbMethod)

campoPK = CallByName(FRM, "get_nuevo", VbMethod)

If strfiltro <> "" Then

strfiltro = " where " & strfiltro

strand = " and "

Else

strand = ""

End If

If Opcion = 0 Then ' opcion para buscar o cargar por primera ves

orden = ""

If busca = "" Then

strbusca = strfiltro

Else

If strfiltro = "" Then strfiltro = " where "

strbusca = strfiltro & strand & campoPK & "='" & busca & "'"

End If

End If

If Opcion = 1 Then ' cargar el primer registro

orden = " order by cast(" & campoPK & " as integer) asc"

strbusca = strfiltro

End If

If Opcion = 2 Then ' cargar el ultimo registro

orden = " order by cast(" & campoPK & " as integer) desc"

strbusca = strfiltro

End If

If Opcion = 3 Then ' cargar el anterior

str_reg = Codigo_Reg_Actual

If strfiltro = "" Then

Page 164: Tesis Sistema Informatico de La Escuela 21 de Mayo

125

strbusca = " WHERE " & strand & " cast(" & campoPK & " as integer) <

cast('" & str_reg & "' as integer)"

Else

strbusca = strfiltro & strand & " cast(" & campoPK & " as integer) < cast('"

& str_reg & "' as integer)"

End If

orden = " order by cast(" & campoPK & " as integer) desc"

End If

If Opcion = 4 Then ' cargar el siguiente

str_reg = Codigo_Reg_Actual

If strfiltro = "" Then

strbusca = " WHERE " & strand & " cast(" & campoPK & " as integer) >

cast('" & str_reg & "' as integer)"

Else

strbusca = strfiltro & strand & " cast(" & campoPK & " as integer) > cast('"

& str_reg & "' as integer)"

End If

orden = " order by cast(" & campoPK & " as integer) asc"

End If

STRSQL = "select top 1 * from " & strtabla & strbusca & orden

If VerificaCambiosContenedor = True And acc <> "C" Then

If MsgBox("Se ha realizado cambios, Desea Grabarlos......?", vbYesNo +

vbInformation, "SISTEMA") = vbYes Then

Guardar

End If

End If

Set tabla = base.Execute(STRSQL)

If tabla.EOF = True Then

tabla.Close: Set tabla = Nothing:

STRSQL = "Select count(*) as cant from " & strtabla & strfiltro

Set tabla = base.Execute(STRSQL)

If tabla.Fields(0).Value = 0 Then

Limpiar

habilitaContenedor False

Activa_sin_reg

End If

tabla.Close: Set tabla = Nothing: Exit Sub

End If

habilitaContenedor True

Activa_cancelar

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Or TypeOf I Is

DTPicker Or TypeOf I Is CheckBox Or TypeOf I Is TextBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name Then

If I.DataMember = "L" Then I.Locked = False

Page 165: Tesis Sistema Informatico de La Escuela 21 de Mayo

126

If TypeOf I Is TextBox Then If I.DataField <> "" Then I.TEXT =

tabla.Fields(I.DataField).Value: I.tag = tabla.Fields(I.DataField).Value

If TypeOf I Is Label Then If I.DataField <> "" Then I.Caption =

tabla.Fields(I.DataField).Value: I.tag = tabla.Fields(I.DataField).Value

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then If

I.DataField <> "" Then If CStr(tabla.Fields(I.DataField).Value) <> ""

Then I.ListIndex = IndexList(I, CLng(tabla.Fields(I.DataField).Value)):

I.tag = ExtraeIDCombo(I)

If TypeOf I Is DTPicker Then If I.DataField <> "" Then I.Value =

tabla.Fields(I.DataField).Value: I.tag = I.Value

If TypeOf I Is CheckBox Then If I.DataField <> "" Then I.Value =

tabla.Fields(I.DataField).Value: I.tag = tabla.Fields(I.DataField).Value

If I.DataMember = "L" Then I.Locked = True

End If

End If

Next I

End With

tabla.Close

Set tabla = Nothing

End Sub

Public Function Verificar() As String

On Error Resume Next

Verificar = ""

Dim cade As String

cade = ""

Dim ctlControl As Object

For Each ctlControl In FRM.Controls

If TypeOf ctlControl Is TextBox Then

If ctlControl.DataField <> "" And Trim(ctlControl.TEXT) = "" And

ctlControl.Enabled = True And ctlControl.DataMember = "H" Then cade

= cade & vbCr & EXTRAE_MSG(ctlControl.Name)

If ctlControl.DataField <> "" And ctlControl.Enabled = True And

ctlControl.DataMember = "C" And Cedula(ctlControl) = False Then cade

= cade & vbCr & EXTRAE_MSG(ctlControl.Name)

If ctlControl.DataField <> "" And ctlControl.Enabled = True And

ctlControl.DataMember = "C2" And Cedula(ctlControl) = False And

ctlControl.TEXT <> "" Then cade = cade & vbCr &

EXTRAE_MSG(ctlControl.Name)

ElseIf TypeOf ctlControl Is ComboBox Or TypeOf ctlControl Is ListBox Then

If ctlControl.DataField <> "" And ctlControl.ListIndex = -1 And

ctlControl.Enabled = True And ctlControl.DataMember = "H" Then cade

= cade & vbCr & EXTRAE_MSG(ctlControl.Name)

End If

Next

If cade <> "" Then Verificar = "Para continuar los siguientes datos deben ser

llenados o corregidos" & cade

Page 166: Tesis Sistema Informatico de La Escuela 21 de Mayo

127

End Function

Public Function EXTRAE_MSG(nombre As String) As String

On Error Resume Next

EXTRAE_MSG = ""

Dim I As Object

For Each I In FRM.Controls

If TypeOf I Is Label Then

If I.tag = nombre Then

EXTRAE_MSG = I.Caption

Exit Function

End If

End If

Next

End Function

Public Function IndexList(ByVal combo As Object, Optional indice As Long = -

1) As Long

Dim I As Integer

IndexList = -1

For I = 0 To combo.ListCount - 1

If indice = combo.ItemData(I) Then

IndexList = I

combo.ListIndex = -1

Exit Function

End If

Next

End Function

Public Function EXISTE_ITEM(ByVal combo As Object, Optional indice As

Long = -1) As Boolean

Dim I As Integer

EXISTE_ITEM = False

For I = 0 To combo.ListCount - 1

If indice = combo.ItemData(I) Then

EXISTE_ITEM = True

combo.ListIndex = -1

Exit Function

End If

Next

End Function

Public Sub SELECTCOMBO(ByVal combo As ComboBox, ByVal indice As

String)

Dim I As Integer

For I = 0 To combo.ListCount - 1

If indice = combo.ItemData(I) Then

combo.ListIndex = I

Exit Sub

End If

Page 167: Tesis Sistema Informatico de La Escuela 21 de Mayo

128

Next

End Sub

Public Function ExtraeIDCombo(ByVal combo As Object) As String

ExtraeIDCombo = ""

If combo.ListIndex <> -1 Then

ExtraeIDCombo = CStr(combo.ItemData(combo.ListIndex))

End If

End Function

Public Sub LLENACOMBO(cmb As Object, sql As String)

Set tabla_cmb = base.Execute(sql)

cmb.Clear

Do Until tabla_cmb.EOF = True

cmb.AddItem tabla_cmb.Fields(1).Value

cmb.ItemData(cmb.NewIndex) = tabla_cmb.Fields(0).Value

tabla_cmb.MoveNext

Loop

tabla_cmb.Close

Set tabla_cmb = Nothing

cmb.tag = ExtraeIDCombo(cmb)

End Sub

Public Sub LLENAListCheck(cmb As ListBox, sql As String)

Set tabla_cmb = base.Execute(sql)

cmb.Clear

Do Until tabla_cmb.EOF = True

cmb.AddItem tabla_cmb.Fields(1).Value

cmb.ItemData(cmb.NewIndex) = tabla_cmb.Fields(0).Value

cmb.Selected(cmb.NewIndex) = CBool(tabla_cmb.Fields(2).Value)

tabla_cmb.MoveNext

Loop

tabla_cmb.Close

Set tabla_cmb = Nothing

cmb.tag = ExtraeIDCombo(cmb)

End Sub

Public Sub LLenaDatosContenedor(FRM As Object, Area As Object, record As

ADODB.Recordset)

'On Error GoTo PASA

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = Area.Name Then

If TypeOf I Is TextBox Then If I.DataField <> "" Then I.TEXT =

record.Fields(I.DataField).Value: I.tag = record.Fields(I.DataField).Value

Page 168: Tesis Sistema Informatico de La Escuela 21 de Mayo

129

If TypeOf I Is Label Then If I.DataField <> "" Then I.Caption =

record.Fields(I.DataField).Value: I.tag = record.Fields(I.DataField).Value

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then If

I.DataField <> "" Then I.ListIndex = IndexList(I,

record.Fields(I.DataField).Value): I.tag = IndexList(I,

record.Fields(I.DataField).Value)

If TypeOf I Is DTPicker Then If I.DataField <> "" Then I.Value =

record.Fields(I.DataField).Value: I.tag = record.Fields(I.DataField).Value

If TypeOf I Is CheckBox Then

If I.DataField <> "" Then I.Value =

record.Fields(I.DataField).Value: I.tag = record.Fields(I.DataField).Value

End If

End If

End If

Next I

End With

End Sub

Public Sub ActualizaDatosTag()

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name Then

If TypeOf I Is TextBox Then I.tag = I.TEXT

If TypeOf I Is Label Then If I.DataField <> "" Then I.tag = I.Caption

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then I.tag =

ExtraeIDCombo(I)

If TypeOf I Is DTPicker Then I.tag = Str(I.Value)

If TypeOf I Is CheckBox Then I.tag = Str(I.Value)

End If

End If

Next I

End With

End Sub

Public Function VerificaCambiosContenedor() As Boolean

VerificaCambiosContenedor = False

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name Then

Page 169: Tesis Sistema Informatico de La Escuela 21 de Mayo

130

If TypeOf I Is TextBox Then If I.tag <> I.TEXT Then

VerificaCambiosContenedor = True: Exit Function

If TypeOf I Is Label Then If I.DataField <> "" Then If I.tag <>

I.Caption Then VerificaCambiosContenedor = True: Exit Function

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then If I.tag <>

ExtraeIDCombo(I) Then VerificaCambiosContenedor = True: Exit

Function

'If TypeOf i Is DTPicker Then If i.tag <> i.Value Then

VerificaCambiosContenedor = True: Exit Function

If TypeOf I Is CheckBox Then If Val(I.tag) <> I.Value Then

VerificaCambiosContenedor = True: Exit Function

End If

End If

Next I

End With

End Function

Public Sub habilitaContenedor(valor As Boolean)

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name Then

If TypeOf I Is TextBox Then If I.DataMember = "E" Then I.Enabled

= valor

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then If

I.DataMember = "E" Then I.Enabled = valor

If TypeOf I Is DTPicker Then If I.DataMember = "E" Then I.Enabled

= valor

If TypeOf I Is CheckBox Then If I.DataMember = "E" Then

I.Enabled = valor

End If

End If

Next I

End With

End Sub

Public Sub Limpiar()

Dim c As Integer

On Error Resume Next

Dim I As Object

For Each I In FRM.Controls

If I.Container.Name = FRM.Name Then

If TypeOf I Is TextBox Then If I.DataMember <> "O" Then I.TEXT = "":

I.tag = ""

Page 170: Tesis Sistema Informatico de La Escuela 21 de Mayo

131

If TypeOf I Is Label Then If I.DataMember <> "O" Then If I.DataField <>

"" Then I.Caption = "": I.tag = ""

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then If I.DataMember

<> "O" Then I.TEXT = "": I.ListIndex = -1: I.tag = ""

If TypeOf I Is CheckBox Then If I.DataMember <> "O" Then I.Value = 0:

I.tag = ""

If TypeOf I Is OptionButton Then If I.DataMember <> "O" Then I.Value

= False: I.tag = ""

If TypeOf I Is DTPicker Then If I.DataMember <> "O" Then I.Value =

Date: I.tag = ""

If TypeOf I Is MSHFlexGrid Then

I.Rows = 2

For c = 0 To I.Cols - 1

I.TextMatrix(1, c) = ""

Next

End If

End If

Next

End Sub

Public Function GeneraInsertform() As String

Dim strtabla, insert, values As String

strtabla = CallByName(FRM, "get_tabla", VbMethod)

insert = "Insert Into " & strtabla & "("

values = " Values ("

With FRM

Dim I As Object

'MaskEdBox

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name And I.DataField <> "" Then

If TypeOf I Is TextBox Then insert = insert & I.DataField & ",":

values = values & "'" & I.TEXT & "',"

If TypeOf I Is Label Then insert = insert & I.DataField & ",": values =

values & "'" & I.Caption & "',"

If TypeOf I Is CheckBox Then insert = insert & I.DataField & ",":

values = values & "'" & I.Value & "',"

If TypeOf I Is DTPicker Then insert = insert & I.DataField & ",":

values = values & "'" & I.Value & "',"

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then insert = insert

& I.DataField & ",": values = values & "'" & ExtraeIDCombo(I) & "',"

End If

End If

Next I

End With

insert = Mid(insert, 1, Len(insert) - 1) & ")"

values = Mid(values, 1, Len(values) - 1) & ")"

Page 171: Tesis Sistema Informatico de La Escuela 21 de Mayo

132

GeneraInsertform = insert & values

End Function

Public Sub coloca_tolti(formu As Form)

With formu

Dim I As Object

For Each I In .Controls

If TypeOf I Is LaVolpeButton Then

I.ToolTipText = Primer_mayuscula(I.tag)

End If

Next I

End With

End Sub

Public Function GeneraUpdateform() As String

Dim strtabla, update, where, camposPK As String

strtabla = CallByName(FRM, "get_tabla", VbMethod)

camposPK = CallByName(FRM, "get_camposPK", VbMethod)

update = "Update " & strtabla & " set "

where = " Where "

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name And I.DataField <> "" Then

If InStr(camposPK, "|" & I.DataField & "|") = 0 Then

If TypeOf I Is TextBox Then update = update & I.DataField & "='"

& I.TEXT & "',"

If TypeOf I Is Label Then update = update & I.DataField & "='" &

I.Caption & "',"

If TypeOf I Is CheckBox Then update = update & I.DataField &

"='" & I.Value & "',"

If TypeOf I Is DTPicker Then update = update & I.DataField &

"='" & I.Value & "',"

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then update =

update & I.DataField & "='" & ExtraeIDCombo(I) & "',"

Else

If TypeOf I Is TextBox Then where = where & I.DataField & "='"

& I.TEXT & "' and "

If TypeOf I Is Label Then where = where & I.DataField & "='" &

I.Caption & "' and "

If TypeOf I Is CheckBox Then where = where & I.DataField &

"='" & I.Value & "' and "

If TypeOf I Is DTPicker Then where = where & I.DataField & "='"

& I.Value & "' and "

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then where =

where & I.DataField & "='" & ExtraeIDCombo(I) & "' and "

Page 172: Tesis Sistema Informatico de La Escuela 21 de Mayo

133

End If

End If

End If

Next I

End With

update = Mid(update, 1, Len(update) - 1)

where = Mid(where, 1, Len(where) - 4)

GeneraUpdateform = update & where

End Function

Public Sub Nuevo()

Dim strtabla, campoPK, STRSQL As String

Dim nuevo_reg As Integer

strtabla = CallByName(FRM, "get_tabla", VbMethod)

campoPK = CallByName(FRM, "get_nuevo", VbMethod)

STRSQL = "select isnull(max(cast(" & campoPK & " as integer)),0) + 1 as nuevo

from " & strtabla

If VerificaCambiosContenedor = True Then

If MsgBox("Se ha realizado cambios, Desea Grabarlos......?", vbYesNo +

vbInformation, "SISTEMA") = vbYes Then

Guardar

End If

End If

Limpiar

CallByName FRM, "Set_Accion", VbMethod, "N"

Set tabla = base.Execute(STRSQL)

nuevo_reg = tabla.Fields(0).Value

tabla.Close

Set tabla = Nothing

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name And I.DataField <> "" Then

If campoPK = I.DataField Then

If TypeOf I Is TextBox Then I.TEXT = nuevo_reg: I.tag =

nuevo_reg

If TypeOf I Is Label Then I.Caption = nuevo_reg: I.tag =

nuevo_reg

End If

End If

End If

Next I

End With

habilitaContenedor True

Activa_nuevo

Page 173: Tesis Sistema Informatico de La Escuela 21 de Mayo

134

End Sub

Public Function Busca_Reg() As Boolean

Dim strtabla, sql, camposPK As String

strtabla = CallByName(FRM, "get_tabla", VbMethod)

camposPK = CallByName(FRM, "get_camposPK", VbMethod)

Busca_Reg = False

sql = "select count(* ) from " & strtabla & " Where "

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name And I.DataField <> "" Then

If InStr(camposPK, "|" & I.DataField & "|") <> 0 Then

If TypeOf I Is TextBox Then sql = sql & I.DataField & "='" &

I.TEXT & "' and "

If TypeOf I Is Label Then If I.DataField <> "" Then sql = sql &

I.DataField & "='" & I.Caption & "' and "

If TypeOf I Is CheckBox Then sql = sql & I.DataField & "='" &

I.Value & "' and "

If TypeOf I Is DTPicker Then sql = sql & I.DataField & "='" &

I.Value & "' and "

End If

End If

End If

Next I

End With

sql = Mid(sql, 1, Len(sql) - 4)

Set tabla = base.Execute(sql)

If tabla.Fields(0).Value > 0 Then Busca_Reg = True

tabla.Close

Set tabla = Nothing

End Function

Public Sub Guardar()

Dim cade, acc As String

Dim sql As String

On Error GoTo SALIR

acc = CallByName(FRM, "get_accion", VbMethod)

If acc <> "N" Then

CallByName FRM, "Set_Accion", VbMethod, "M"

If Permiso("M", FRM.Name) = False Then Exit Sub

End If

cade = Verificar

If cade <> "" Then

MsgBox cade, vbInformation, "SISTEMA"

Exit Sub

End If

Page 174: Tesis Sistema Informatico de La Escuela 21 de Mayo

135

If Busca_Reg = True Then

sql = GeneraUpdateform

Else

sql = GeneraInsertform

End If

base.Execute (sql)

Mensage "Registro Guardado o Modificado"

ActualizaDatosTag

Activa_cancelar

Exit Sub

SALIR:

ERRORES

End Sub

Public Sub Mensage(texto As String)

Load Form_msg

Form_msg.eti_msg.Caption = texto

Form_msg.Show vbModal

End Sub

Public Function Codigo_Reg_Actual() As String

Dim strtabla, campoPK As String

campoPK = CallByName(FRM, "get_nuevo", VbMethod)

Codigo_Reg_Actual = ""

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name And I.DataField <> "" Then

If TypeOf I Is Label Then If campoPK = I.DataField Then

Codigo_Reg_Actual = I.Caption: Exit Function

If TypeOf I Is TextBox Then If campoPK = I.DataField Then

Codigo_Reg_Actual = I.TEXT: Exit Function

End If

End If

Next I

End With

End Function

Public Sub Elimna_reg()

On Error GoTo SALIDA

Dim strtabla, campoPK, DELSQL, strand As String

If Permiso("E", FRM.Name) = False Then Exit Sub

If MsgBox("Esta seguro de Eliminar el Registro ..........?", vbYesNo +

vbInformation, "SISTEMA") <> vbYes Then Exit Sub

Page 175: Tesis Sistema Informatico de La Escuela 21 de Mayo

136

strand = ""

CallByName FRM, "Set_Accion", VbMethod, "E"

strtabla = CallByName(FRM, "get_tabla", VbMethod)

camposPK = CallByName(FRM, "Get_camposPK", VbMethod)

DELSQL = "DELETE FROM " & strtabla & " where "

With FRM

Dim I As Object

For Each I In .Controls

If TypeOf I Is TextBox Or TypeOf I Is ComboBox Or TypeOf I Is

ListBox Or TypeOf I Is DTPicker Or TypeOf I Is CheckBox Or TypeOf I

Is Label Then

If I.Container.Name = FRM.Name And I.DataField <> "" Then

If InStr(camposPK, "|" & I.DataField & "|") <> 0 Then

If TypeOf I Is TextBox Then DELSQL = DELSQL & strand &

I.DataField & " ='" & I.TEXT & "'"

If TypeOf I Is Label Then DELSQL = DELSQL & strand &

I.DataField & " ='" & I.Caption & "'"

If TypeOf I Is CheckBox Then DELSQL = DELSQL & strand &

I.DataField & " ='" & I.Value & "'"

If TypeOf I Is DTPicker Then DELSQL = DELSQL & strand &

I.DataField & " ='" & I.Value & "'"

If TypeOf I Is ComboBox Or TypeOf I Is ListBox Then DELSQL

= DELSQL & strand & I.DataField & " ='" & ExtraeIDCombo(I) & "'"

If strand = "" Then strand = " and "

End If

End If

End If

Next I

End With

LLenaDatosForm 3

base.Execute (DELSQL)

Mensage "Registro Borrado"

LLenaDatosForm 4

ActualizaDatosTag

Exit Sub

SALIDA:

ERRORES

End Sub

Public Sub abrir_form(formu As Form, Optional nombre As String = "")

Dim t_per As New ADODB.Recordset

Dim SQL_per As String

Dim aux_per As Boolean

aux_per = False

SQL_per = "select * from permisos_usuario where estado=-1 and usuario='" &

Cod_usuario & "' and permiso in(select codigo from permisos where

tipo='F' and form='" & nombre & "')"

Page 176: Tesis Sistema Informatico de La Escuela 21 de Mayo

137

'SQL_per = "select * from permisos where codigo in(select permiso from

permisos_usuario where usuario='" & Cod_usuario & "' and estado=1) and

tipo='F' and form='" & formu.Name & "'"

Set t_per = base.Execute(SQL_per)

If t_per.EOF = False Or nombre = "" Then

aux_per = True

End If

t_per.Close

Set t_per = Nothing

If aux_per = True Then

formu.Top = 10

formu.Left = 10

Load formu

formu.Show

coloca_tolti formu

Else

MsgBox "No tiene acceso a esta ventana", vbInformation, "SISTEMA"

End If

End Sub

Public Function Permiso(accion As String, Optional nombre As String = "") As

Boolean

Dim t_per As New ADODB.Recordset

Dim SQL_per As String

Dim aux_per As Boolean

aux_per = False

SQL_per = "select * from permisos_usuario where estado=-1 and usuario='" &

Cod_usuario & "' and permiso in(select codigo from permisos where

tipo='" & accion & "' and form='" & nombre & "')"

Set t_per = base.Execute(SQL_per)

If t_per.EOF = False Or nombre = "" Then

aux_per = True

End If

t_per.Close

Set t_per = Nothing

If aux_per = False Then

MsgBox "No tiene permiso para realizar esta accion", vbInformation,

"SISTEMA"

End If

Permiso = aux_per

End Function

Public Sub ERRORES()

Dim Mensage, acc As String

Mensage = ""

acc = CallByName(FRM, "get_accion", VbMethod)

Select Case Err.Number

Case -2147217900:

Page 177: Tesis Sistema Informatico de La Escuela 21 de Mayo

138

If acc = "N" Then

Mensage = " NO SE PUEDE GRABAR EL NUEVO REGISTRO "

ElseIf acc = "M" Then

Mensage = " NO SE PUEDE MODIFICAR EL REGISTRO POR ESTA

RELACIONADO CON OTRA INFORMACION "

ElseIf acc = "E" Then

Mensage = " NO SE PUEDE BORRAR EL REGISTRO POR ESTA

RELACIONADO CON OTRA INFORMACION "

Else

Mensage = Err.Description

End If

Case Else: Mensage = Err.Description

End Select

MsgBox Mensage, vbInformation, "SISTEMA"

End Sub

Public Sub Activa_nuevo()

With FRM

Dim I As Object

For Each I In .Controls

Select Case I.Name

Case "cmd_nuevo": I.Enabled = False

Case "cmd_guardar": I.Enabled = True

Case "cmd_cancelar": I.Enabled = True

Case "cmd_eliminar": I.Enabled = False

Case "cmd_buscar": I.Enabled = False

Case "cmd_primero": I.Enabled = False

Case "cmd_anterior": I.Enabled = False

Case "cmd_siguiente": I.Enabled = False

Case "cmd_ultimo": I.Enabled = False

Case "cmd_imprimir": I.Enabled = False

End Select

Next I

End With

End Sub

Public Sub Activa_cancelar()

With FRM

Dim I As Object

For Each I In .Controls

Select Case I.Name

Case "cmd_nuevo": I.Enabled = True

Case "cmd_guardar": I.Enabled = True

Case "cmd_cancelar": I.Enabled = False

Case "cmd_eliminar": I.Enabled = True

Case "cmd_buscar": I.Enabled = True

Case "cmd_primero": I.Enabled = True

Case "cmd_anterior": I.Enabled = True

Case "cmd_siguiente": I.Enabled = True

Page 178: Tesis Sistema Informatico de La Escuela 21 de Mayo

139

Case "cmd_ultimo": I.Enabled = True

Case "cmd_imprimir": I.Enabled = True

End Select

Next I

End With

End Sub

Public Sub Activa_sin_reg()

With FRM

Dim I As Object

For Each I In .Controls

Select Case I.Name

Case "cmd_nuevo": I.Enabled = True

Case "cmd_guardar": I.Enabled = False

Case "cmd_cancelar": I.Enabled = False

Case "cmd_eliminar": I.Enabled = False

Case "cmd_buscar": I.Enabled = False

Case "cmd_primero": I.Enabled = False

Case "cmd_anterior": I.Enabled = False

Case "cmd_siguiente": I.Enabled = False

Case "cmd_ultimo": I.Enabled = False

Case "cmd_imprimir": I.Enabled = False

End Select

Next I

End With

End Sub

Public Sub Guarda_config(codigo As String, valor As String, OBS As String)

Dim SQL1, SQL2, SQL3 As String

SQL1 = "SELECT COUNT(*) AS UNO FROM CONFIG WHERE PERIODO='"

& Gperiodo & "' AND CODIGO='" & codigo & "'"

SQL2 = "INSERT INTO

CONFIG(CODIGO,PERIODO,VALOR,DESCRIPCION) VALUES('" &

codigo & "','" & Gperiodo & "','" & valor & "','" & OBS & "')"

SQL3 = "UPDATE CONFIG SET VALOR='" & valor & "',DESCRIPCION='" &

OBS & "' WHERE PERIODO='" & Gperiodo & "' AND CODIGO='" &

codigo & "'"

Set tabla = base.Execute(SQL1)

If tabla.Fields(0).Value = 0 Then

base.Execute (SQL2)

Else

base.Execute (SQL3)

End If

tabla.Close

Set tabla = Nothing

End Sub

Public Function Extrae_config(codigo As String) As String

Dim SQL1 As String

Extrae_config = ""

Page 179: Tesis Sistema Informatico de La Escuela 21 de Mayo

140

SQL1 = "SELECT ISNULL(VALOR,'') AS UNO FROM CONFIG WHERE

PERIODO='" & Gperiodo & "' AND CODIGO='" & codigo & "'"

Set tabla = base.Execute(SQL1)

If tabla.EOF = False Then

Extrae_config = tabla.Fields(0).Value

End If

tabla.Close

Set tabla = Nothing

End Function

Public Sub dockForm(ByRef formhWnd As Long, ByRef picDock As

PictureBox, Optional ByVal ajustar As Boolean = True)

Call SetParent(formhWnd, picDock.hWnd)

posDockForm formhWnd, picDock, ajustar

Call ShowWindow(formhWnd, NORMAL_eSW)

End Sub

Public Sub posDockForm(ByRef formhWnd As Long, ByRef picDock As

PictureBox, Optional ByVal ajustar As Boolean = True)

Dim nWidth As Long, nHeight As Long

Dim wndPl As WINDOWPLACEMENT

If ajustar Then

nWidth = picDock.ScaleWidth \ Screen.TwipsPerPixelX

nHeight = picDock.ScaleHeight \ Screen.TwipsPerPixelY

Else

Call GetWindowPlacement(formhWnd, wndPl)

With wndPl.rcNormalPosition

nWidth = .Right - .Left

nHeight = .Bottom - .Top

End With

End If

Call MoveWindow(formhWnd, 0, 0, nWidth, nHeight, True)

End Sub

Public Sub Busqueda_campos(NUM As Integer, txt As String, tama As Integer)

Busqueda.campos(NUM).nombre = txt

Busqueda.campos(NUM).tamaño = tama

End Sub

Public Sub Busqueda_sql(txt As String)

Busqueda.sql = txt

End Sub

Public Sub Busqueda_where(txt As String)

Busqueda.where = txt

End Sub

Public Sub Busqueda_orden(txt As String)

Busqueda.orden = txt

End Sub

Public Sub Busqueda_Ncampos(NUM As Integer)

Busqueda.Ncampos = NUM

End Sub

Page 180: Tesis Sistema Informatico de La Escuela 21 de Mayo

141

Public Sub Busqueda_indice(NUM As Integer)

Busqueda.indice = NUM

End Sub

Public Function Cedula(TEXT As TextBox) As Boolean

Cedula = False

Dim aux, I, suma As Integer

suma = 0

If Trim(TEXT) <> "" Then

If Len(TEXT) = 10 Then

For I = 1 To 9

aux = Val(Mid(TEXT, I, 1))

If I Mod 2 = 1 Then

aux = aux * 2

If aux > 9 Then

aux = aux - 9

End If

End If

suma = suma + aux

Next I

Do Until suma <= 0

suma = suma - 10

Loop

If Abs(suma) = Val(Mid(TEXT, 10, 1)) Then

Cedula = True

End If

End If

End If

End Function

Public Function SoloNumero(Letra As Integer) As Integer

SoloNumero = Letra

Select Case Letra

Case Asc("0") To Asc("9")

Case vbKeyBack, Asc(".")

Case Else: SoloNumero = 0

End Select

End Function

Public Function SoloCedula(Letra As Integer) As Integer

SoloCedula = Letra

Select Case Letra

Case Asc("0") To Asc("9")

Case vbKeyBack

Case Else: SoloCedula = 0

End Select

End Function

Public Function SoloTexto(Letra As Integer) As Integer

SoloTexto = Letra

Select Case Letra

Case Asc("0") To Asc("9")

Page 181: Tesis Sistema Informatico de La Escuela 21 de Mayo

142

Case Asc("a") To Asc("z")

Case Asc("A") To Asc("Z")

Case Asc("."), Asc(" "), Asc("-"), Asc("º"), Asc("@"), vbKeyBack

Case Asc("Ñ"), Asc("ñ")

Case Else: SoloTexto = 0

End Select

End Function

Public Function SoloNombre(Letra As Integer) As Integer

SoloNombre = Letra

Select Case Letra

Case Asc("a") To Asc("z")

Case Asc("A") To Asc("Z")

Case Asc("_"), Asc("-"), vbKeyBack, Asc("Á"), Asc("á"), Asc("É"), Asc("é"),

Asc("Í"), Asc("í"), Asc("ó"), Asc("Ó"), Asc("Ú"), Asc("ú")

Case Asc("Ñ"), Asc("ñ")

Case Else: SoloNombre = 0

End Select

End Function

Public Sub LeerBinary(tabla_a As ADODB.Recordset, unPicture As Object, ind

As Integer)

Dim nChunks As Long

Dim nSize As Long

Dim Fragment As Long

Dim I As Long

'

On Error Resume Next

' Se usa un fichero temporal para guardar la imagen

nFile = FreeFile

Open "pictemp" For Binary Access Write As #nFile

'

' Calcular los trozos completos y el resto

nSize = tabla_a.Fields(ind).ActualSize

nChunks = Int(nSize / mBuffer)

Fragment = nSize Mod mBuffer

Chunk() = tabla_a.Fields(ind).GetChunk(Fragment)

Put #nFile, , Chunk()

For I = 1 To nChunks

Chunk() = tabla_a.Fields(ind).GetChunk(mBuffer)

Put #nFile, , Chunk()

Next

Close #nFile

Erase Chunk

' Ahora se carga esa imagen en el control

unPicture.Picture = LoadPicture("pictemp")

' Ya no necesitamos el fichero, así que borrarlo

Page 182: Tesis Sistema Informatico de La Escuela 21 de Mayo

143

On Error Resume Next

If Len(Dir$("pictemp")) Then

Kill "pictemp"

End If

Err = 0

End Sub

Public Sub GuardarBinary(tabla_a As ADODB.Recordset, unPicture As Object,

ind As Integer)

'Guardar el contenido del Picture en el campo de la base

Dim I As Long

Dim Fragment As Long

Dim nSize As Long

Dim nChunks As Long

On Error Resume Next

' Guardar el contenido del picture en un fichero temporal

SavePicture unPicture.Picture, "pictemp"

' Leer el fichero y guardarlo en el campo

nFile = FreeFile

Open "pictemp" For Binary Access Read As #nFile

nSize = LOF(nFile) ' Longitud de los datos en el archivo

If nSize = 0 Then

Close nFile

Exit Sub

End If

'

' Calcular el número de trozos y el resto

nChunks = nSize \ mBuffer

Fragment = nSize Mod mBuffer

ReDim Chunk(Fragment)

'

Get #nFile, , Chunk()

tabla_a.Fields(ind).AppendChunk Chunk()

ReDim Chunk(mBuffer)

For I = 1 To nChunks

Get #nFile, , Chunk()

tabla_a.Fields(ind).AppendChunk Chunk()

Next I

Close #nFile

'

' Ya no necesitamos el fichero, así que borrarlo

On Local Error Resume Next

If Len(Dir$("pictemp")) Then

Kill "pictemp"

End If

Err = 0

Page 183: Tesis Sistema Informatico de La Escuela 21 de Mayo

144

End Sub

Public Function Primer_mayuscula(nombre As String) As String

Dim mayu As String

Dim resto As String

Dim resul As String

Dim envi As String

Dim xespac As Integer

mayu = ""

resto = ""

If Len(nombre) > 0 Then

mayu = UCase(Mid(nombre, 1, 1))

If Len(nombre) > 1 Then

resto = RTrim(LCase(Mid(nombre, 2, Len(nombre) - 1)))

End If

End If

If InStr(resto, " ") <> 0 Then

xespac = InStr(resto, " ")

envi = Mid(resto, xespac + 1, Len(resto) - (xespac))

resto = Mid(resto, 1, Len(resto) - (Len(resto) - xespac))

resul = mayu & resto & " " & Primer_mayuscula(envi)

Else

resul = mayu & resto

End If

Primer_mayuscula = resul

End Function

Page 184: Tesis Sistema Informatico de La Escuela 21 de Mayo

1

MANUAL

DEL

USUARIO

Page 185: Tesis Sistema Informatico de La Escuela 21 de Mayo

2

ÍNDICE

PÁG.

1. MANUAL DEL USUARIO 3

2. DESCRIPCION DETALLADA DEL SISTEMA 3

3. FUNCIONAMIENTO DEL SISTEMA 5

3.1 FORMULARIO DEL ESTUDIANTE 6

3.2 REGISTRO DEL REPRESENTANTE 6

3.3 FORMULARIO DE REGISTRO DE MATRICULA 6

3.4 INFORME DEL ESTUDIANTE MATRICULADOS 7

3.5 REGISTRO DE NOTAS DE ESTUDIANTE 7

3.6 INFORMES DE REGISTROS DE ALUMNOS POR NOTAS 8

3.7 INFORME DE NOTAS POR ALUMNO 8

3.8 INFORME DE NOTAS POR TRIMESTRE RESUMIDO 9

3.9 INFORME DE NOTAS POR TRIMESTRE 9

3.10 INFORME DE NOTAS POR MATERIAS Y TRIMESTRE 10

3.11 REGISTRO DE ASISTENCIA DE PROFESORES 10

3.12 INFORME DE ASISTENCIA DE PROFESORES DETALLADO 11

4. CONFIGURACIONES RE REGISTRO 11

4.1 CONFIGURACION DE REGISTRO DE PERIODO 11

4.2 CONFIGURACION DE GRADO 12

4.3 CONFIGURACION DE REGISTRO DE MATERIA 12

4.4 CONFIGURACION DE REGISTRO DE PARALELO 12

4.5 CONFIGURACION DE REGISTRO DE PROFESORES 13

4.6 CONFIGURACION DE PARCIALES 13

4.7 CONFIGURACION DEL USUARIO 13

4.8 ESTABLECER PERIODO ACTIVO 14

4.9 BLOQUEO DEL SISTEMA 14

4.10 REGISTRO DE CONFIGURACIONES DE NOTAS 14

4.11 REGISTRO DE CONFIGURACIONES DE ESCUELA 15

4.12 REGISTRO DE CONFIGURACIONES DE ESCUDO 15

4.13 REGISTRO DE CONFIGURACIONES DE FONDO 15

4.14 REGISTRO DE CONFIGURACIONES VARIOS 16

4.15 ESTABLECER CONFIGURACION DE MATERIAS A GRADO 16

4.16 ESTABLECER MATERIAS A PROFESORES 16

4.17 ESTABLECER ADMINISTRADOR 16

Page 186: Tesis Sistema Informatico de La Escuela 21 de Mayo

3

MANUAL DEL USUARIO

DESCRIPCIÓN DETALLADA DEL SISTEMA

En este manual tenemos los pasos a seguir en el sistema para un mejor y adecuado

manejo y de esta manera evitar problemas en el funcionamiento del mismo que a

continuación detallamos.

1. Instalación del Programa

- Insertar el CD.

- Hacer clic en el ícono Mi PC.

- Abrir el CD-Rom.

- Ejecutar el archivo Setup, una vez escogido este paso el sistema

comenzará por sí solo a instalarse, debiendo seguir los pasos y aceptar

todos los términos para realizar la instalación con éxito.

2. EJECUCIÓN DEL PROGRAMA.

- Seleccionar el botón inicio

- Seleccionar Todos los Programas

- Elegir el menú

- Por último clic en Administrado

Page 187: Tesis Sistema Informatico de La Escuela 21 de Mayo

4

Page 188: Tesis Sistema Informatico de La Escuela 21 de Mayo

5

3. FUNCIONAMIENTO DEL SISTEMA

INGRESO AL SISTEMA

Al ejecutar el programa aparecerá la interfaz INGRESO AL SISTEMA en

la cual el usuario deberá escribir su nombre y contraseña

3.1 FORMULARIO PRINCIPAL

PANTALLA INICIAL

La pantalla principal se encuentra formada por:

Barra de Titulo

Barra de Menú

3.1 FORMULARIO DE ESTUDIANTE

Page 189: Tesis Sistema Informatico de La Escuela 21 de Mayo

6

3.2 FORMULARIO DE REGISTRO DE REPRESENTANTES

3.3 FORMULARIO DE REGISTRO DE MATRICULA

3.4 INFORME DE ESTUDIANTES MATRICULADOS

Page 190: Tesis Sistema Informatico de La Escuela 21 de Mayo

7

3.5 REGISTRO DE NOTAS DE ESTUDIANTES

Page 191: Tesis Sistema Informatico de La Escuela 21 de Mayo

8

3.6 INFORME DE REGISTRO DE ALUMNOS POR NOTAS RESUMIDO

3.7INFORME DE NOTAS POR ALUMNO

Page 192: Tesis Sistema Informatico de La Escuela 21 de Mayo

9

3.8INFORME DE NOTAS POR TRIMESTRE RESUMIDO

3.9INFORME DE NOTAS POR TRIMESTRE

Page 193: Tesis Sistema Informatico de La Escuela 21 de Mayo

10

3.10 INFORME RESUMIDO DE NOTAS POR MATERIAS Y TRIMESTRES

3.11REGISTRO DE ASISTENCIA DE PROFESORES

Page 194: Tesis Sistema Informatico de La Escuela 21 de Mayo

11

3.12 INFORME DE ASISTENCIAS DE PROFESORES DETALLADO

4. CONFIGURACIONES DE REGISTROS

4.1 CONFIGURACIÓN DE REGISTRO DE PERÍODOS

Page 195: Tesis Sistema Informatico de La Escuela 21 de Mayo

12

4.2 CONFIGURACIÓN DE REGISTROS DE GRADOS

4.3 CONFIGURACIÓN DE REGISTROS DE MATERIAS

4.4 CONFIGURACIÓN DE REGISTRO DE PARALELOS

4.5 CONFIGURACIÓN DE REGISTROS DE PROFESORES

Page 196: Tesis Sistema Informatico de La Escuela 21 de Mayo

13

4.6 CONFIGURACIÓN DE PARCIALES

4.7 CONFIGURACIÓN DEL USUSARIO

4.8 ESTABLECER PERÍODO ACTIVO

Page 197: Tesis Sistema Informatico de La Escuela 21 de Mayo

14

4.9 BLOQUEO DE SISTEMA

4.10 REGISTRO DE CONFIGURACIONES DE NOTAS:

4.11 REGISTRO DE CONFIGURACIONES DE ESCUELA

Page 198: Tesis Sistema Informatico de La Escuela 21 de Mayo

15

4.12 REGISTRO DE CONFIGURACIONES DE ESUDO

4.13 REGISTRO DE CONFIGURACIONES DE FONDO

4.14 REGISTRO DE CONFIGURACIONES VARIOS

Page 199: Tesis Sistema Informatico de La Escuela 21 de Mayo

16

4.15 ESTABLECER CONFIGURACIÓN DE MATERIAS A GRADOS

4.16 ESTABLECER MATERIAS A PROFESORES

4.17 ESTABLECER ADMINISTRADOR