Вы находитесь на странице: 1из 199

Universidad Tcnica de Manab

Facultad de Ciencias Informticas

TESIS DE GRADO
Previa a la Obtencin del Ttulo de:

ANALISTA EN SISTEMAS
TEMA: DESARROLLO DE UN SISTEMA INFORMATICO ADMINISTRATIVO PARA LA ESCUELA FISCAL MIXTA 21 DE MAYO DEL CANTN PORTOVIEJO, PROVINCIA DE MANAB.

AUTORAS:

Ligia Elena Escobar Domnguez. Maryuri Johana Solrzano Turez.


DIRECTORA DE TESIS

Ing. Maricela Pinargote

Portoviejo - Manab - Ecuador 2010

CERTIFICACION
Ing. Maricela Pinargote, certifica que la presente tesis ha sido elaborada por las Srta. Ligia Elena Escobar Domnguez y Maryuri Johana Solrzano Turez, bajo mi direccin, control y seguimiento. El presente trabajo rene los requisitos de una investigacin y programacin concluida mediante el esfuerzo, dedicacin 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

UNIVERSIDAD TCNICA DE MANAB FACULTAD DE CIENCIAS INFORMTICAS ESCUELA DE COMPUTACIN

TEMA: DESARROLLO DE UN SISTEMA INFORMTICO ADMINISTRATIVO PARA LA ESCUELA FISCAL MIXTA 21 DE MAYO DEL CANTN PORTOVIEJO, PROVINCIA DE MANAB.

TESIS DE GRADO Sometida a consideracin de los Miembros del Tribunal de Revisin y

Sustentacin, legalizada por el Honorable Consejo Directivo como requisito previo a la obtencin del ttulo 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

DERECHO DEL AUTOR

Las presentes: Ligia Elena Escobar Domnguez y Maryuri Johana Solrzano Tuarez, declararan que la tesis es de total creacin 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 reproduccin o distribucin no autorizadas de este trabajo o de cualquier parte del mismo, pueden dar lugar a responsabilidades civiles y penales que sern perseguidas por las autoridades competentes.

Su anlisis, diseo y codificacin son de exclusividad de los autores.

Para constancia firman.

____________________
Ligia Escobar Domnguez AUTORA

____________________
Maryuri Solrzano Tuarez AUTORA

AGRADECIMIENTO
Agradezco primeramente a Dios por hacer posible el sueo que toda estudiante anhela en la vida: ser una Profesional.

A mis queridos profesores quienes con sus conocimientos y enseanzas me inculcaron todos los valores morales, ticos y profesionales los cuales los pondr en prctica durante toda mi vida.

A la Ing. Maricela Pinargote, mi Directora de Tesis, quien ha sido parte fundamental de este proyecto guindome en los anlisis 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 ms humilde y desinteresada que me han llevado a obtener un gran xito.

LIGIA ESCOBAR DOMNGUEZ

AGRADECIMIENTO
Con especial afecto agradezco a los directivos de esta importante Institucin Educativa como es la Universidad Tcnica 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 culminacin de esta etapa importante de mi vida.

A mi madre que me inculc valores de responsabilidad y dedicacin hacia la superacin y el esfuerzo continuo para cumplir toda meta anhelada.

Muchas gracias.

MARYURI SOLRZANO TUAREZ

DEDICATORIA
A Dios por ser l quien me ha iluminado desde el cielo despejando cualquier duda y regalndome un poquito de sabidura para poder terminar con xito este proyecto.

A mis padres Sr. Jorge Escobar y Sra. Jacqueline Domnguez, quienes con esfuerzo y sacrificio han sabido compartir mis momentos ms difciles dndome el apoyo incondicional en todos los aspectos.

A mi hija Camila Snchez quien es mi fuente de inspiracin 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 motivacin y su apoyo incondicional.

LIGIA ESCOBAR DOMNGUEZ

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.

Tambin dedico en especial a mi hijo Kendru Steven Moreira Solrzano, por darme las fuerzas y motivacin para el proceso de esta investigacin.

A mi madre Dolores Turez, que con sus sabios consejos he podido conseguir mis metas anheladas.

MARYURI SOLRZANO TUAREZ

RESUMEN EJECUTIVO

El desarrollo de un programa computarizado optimiza el tiempo, sistematizar la labor del usuario, especialmente desarrollado para un anlisis rpido y eficaz.

Se ofrece una herramienta de trabajo a la Escuela Fiscal Mixta 21 de Mayo que consiste en un sistema de informacin ms exacta y rpida para el personal que all labora matriculando una cantidad de alumnos en un corto perodo de tiempo para dar inicio a las actividades del plantel de manera eficiente e integra.

Presenta una interfaz amigable capaz de realizar: las operaciones bsicas de mantenimiento de archivos que proporcione una mejor manera de proveer informacin actualizada para la toma de decisiones, registro y control de todos los procesos inherentes del sistema de inscripcin, ofrecer reportes de acuerdo a la necesidad del usuario.

El objetivo central del proyecto Desarrollo de un Sistema Informtico Administrativo para la Escuela Fiscal Mixta 21 de Mayo del Cantn Portoviejo, provincia de Manab, es automatizar el proceso de inscripcin de esta institucin educativa y todos los procesos inherentes al mismo que genere informacin oportuna, precisa y confiable mediante el uso de los sistemas de informacin, herramienta que contribuye a los diferentes sectores productivos de la sociedad en llevar las tareas administrativas rutinarias, tediosa y de gran volumen de informacin al computador, teora que afianza la propuesta de sistema de informacin para el proceso de inscripcin del plantel como nueva forma de trabajo que sustituya la metodologa hasta ahora utilizada en los sistemas administrativos escolares.

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.

NDICE CERTIFICACION APROBACION DERECHO DEL AUTOR AGRADECIMIENTO DEDICATORIA RESUMEN EJECUTIVO SUMARY TEMA INTRODUCCIN II III IV VI VIII IX X

CAPITULO I 1.1. JUSTIFICACIN 2.1 PLANTEAMIENTO DEL PROBLEMA 2.2 OBJETIVOS 2.3 OBJETIVO GENERAL 2.4 OBJETIVOS ESPECFICOS 1 2 3 3 3

CAPITULO II 2. MARCO REFERENCIAL 2.1 MARCO TERICO 2.1.1 DISEO DEL SISTEMA 2.1.2 OBJETIVOS DEL DISEO DE SQL. SERVER 2.1.3 VISUAL BASIC 5 6 7 8 11

CAPITULO III 3. DISEO METODOLGICO 3.1 METODOLOGA 3.2 TCNICAS 3.3 RESULTADOS OBTENIDO 3.3 PRESUPUESTO 13 13 13 14 15

CAPITULO IV 4.1 CONCLUSIONES Y RECOMENDACIONES 4.1.1 CONCLUSIONES 4.1.2 RECOMENDACIONES 16 16 17

CAPITULO V 5. PROPUESTA 5.1 DESCRIPCION GENERAL DEL SISTEMA 5.2 DETERMINACION DE REQUERIMIENTO 5.3 RELACIONES DE LAS BASES DE DATOS 5.4 CRONOGRAMA VALORADO 5.6 BIBLIOGRAFIA 18 18 18 19 20 21

ANEXOS MANUAL DEL PROGRAMADOR MANUAL DEL USUARIO CD DE INSTALACION

TEMA:
DESARROLLO DE UN SISTEMA INFORMTICO ADMINISTRATIVO PARA LA ESCUELA FISCAL MIXTA 21 DE MAYO DEL CANTN PORTOVIEJO, PROVINCIA DE MANAB.

Introduccin
Los Sistemas Informticos en la actualidad son muy importantes ya que gracias a ellos la mayora de las instituciones por no decir todas, manejan las Bases de Datos de una forma ms cmoda y sencilla, sin la necesidad de archivar los registros en papeles u otros documentos, ya que la tenedura de libros se pasa a computadora sin un sistema informtico, lo que no permite obtener una informacin rpida de los registros diarios y mensuales que se necesitan en su debido momento.

Con los Sistemas Informticos esta tarea resulta ms fcil de manejar para los empleados que laboran en dichas instituciones, ya sean pblicas o privadas. Institucin escogida para aplicar este sistema informtico es la Escuela Nacional Mixta 21 de Mayo por el prestigio que tiene y por las facilidades que brindaron desde un principio para la obtencin de datos y materiales de apoyo para la culminacin de este proyecto. Este trabajo tuvo como meta final la realizacin de un Sistema Informtico creado en lenguaje de programacin Visual Basic 6.0, ya que es el ms utilizado en la actualidad y es muy fcil de manejarlo y cualquier persona capacitada podr manejarlo.

Estos datos e instrucciones se codificaran en dicho lenguaje de programacin para que puedan ser convertidos en lenguajes de computadoras y as poder ejecutar el programa.

CAPITULO I

1.1 Justificacin.
Este Sistema informtico 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 realizacin de un Sistema Informtico que ayude como controlar de una mejor manera los reportes e informes que a diario en ella se elaboran.

Para contribuir a la solucin de la problemtica se puso nfasis en la informacin que ofreci la Escuela a la interesada para la realizacin de este sistema.

En esta justificacin se expresan las razones experimentales y las posibles ventajas que se derivaran de los resultados de la realizacin de este proyecto. Y es evidente que la labor debe coordinar un buen nmero de campos para poder resolver el propsito planteado.

Un sistema de informacin es un conjunto de elementos que interactan entre s con el fin de apoyar las actividades de las instituciones educativas.

1.2 Planteamiento del problema.


La Informtica es la ciencia que sirve para que muchos procesos aumenten su eficiencia, y si una organizacin, institucin o empresa requiere ofrecer a sus clientes la calidad en el servicio que otorga, se hace emergente la bsqueda de soluciones que faciliten los procesos para servir mejor.

La Escuela Fiscal Mixta 21 de Mayo, institucin que ayuda a la comunidad con su educacin y prestigio, utiliza procesos manuales para recabar toda la informacin concerniente al alumnado y profesores como son las matriculas, notas trimestrales y asistencia del personal docente que surge durante el ao lectivo, lo que entorpece la agilidad y veracidad del procesamiento de datos, disminuyendo por consiguiente la efectividad de los servicios, lo que provoca insatisfaccin tanto para los alumnos como para la Institucin.

La manipulacin del Sistema Administrativo con recursos materiales como papel, plumas, borrador y calculadora es muy complicado para quien lo maneja, por esta razn el problema queda planteado de la siguiente manera:

Cmo influye el desarrollo de un Sistema Informtico de registros de Matriculacin, control de Notas y Asistencia del personal Docente, en la Escuela Fiscal Mixta 21 de Mayo de la ciudad de Portoviejo?

1.3 Objetivos.

1.3.1 Objetivo General.

Solucionar con la implementacin de un sistema informtico administrativo las dificultades que ocasiona a las autoridades de la Escuela 21 de Mayo el control de sus procesos de administracin mediante registros manuales.

1.3.2 Objetivos Especficos.

Facilitar al personal de la Escuela el proceso de registros de matriculacin, 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 obtencin inmediata de reportes de matriculas, notas, asistencia, etc. Proporcionar a travs del sistema el acceso a una informacin ordenada y actualizada del proceso administrativo de la institucin.

1.4 BENEFICIARIOS

1.4.1. DIRECTOS

Las principales personas que se beneficiaran con la implementacin del Sistema Informtico es el rea de Colectura de la Escuela Fiscal Mixta 21 de Mayo de la ciudad de Portoviejo Provincia de Manab.

1.4.2. INDIRECTOS Usuarios en general.

CAPITULO II

2. Marco Referencial.
Como consecuencia de fuertes invierno ocurridos entre los aos 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 canchn de caa sin piso totalmente antipedaggico con 200 alumnos aproximadamente y como nico profesor el Sr. Jorge Bello Saltos.

Por el nmero elevado de alumnos, las autoridades educativas creyeron conveniente reajustar la escuela Cristbal Coln, pasando la Sra. Estrella Zambrano Macas a laborar en esta escuela; adems colaboraban varios jvenes.

Con el pasar del tiempo se fue incrementando el nmero de profesores y en la actualidad la Institucin cuenta con 11 profesores titulares, 2 contratos, 1 conserje y la Directora es la Lcda. Carlota Andrade.

Manual de la Escuela 21 de Mayo

2.1 Marco Terico.


La investigacin se basa en la problemtica que tiene la Escuela Fiscal Mixta 21 de Mayo siendo uno de estos problemas la falta de un Sistema Informtico 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 Informtico que se basa en un Software que Controle los Registros como son: matriculacin, control de notas y asistencia del personal docente. La Directora ha decidido que; para el mejor desarrollo y progreso de la Institucin, que se actualice sus computadoras con un software que proporcione los registros ya mencionados y va hacer en el lenguaje de programacin llamado Visual Basic, es el lenguaje ms utilizado y el ms fcil 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, mens, cuadros de textos, listas, etc.

Esto es para que exista una mejor distribucin de entrega de reportes, ya que con este Software ser de mucha ayuda y facilitar de manera ms rpida los registros que dispone la Escuela Fiscal Mixta 21 de Mayo. 6

LA CONSTRUCCIN DE UNA APLICACIN EN WINDOWS CON VISUAL BASIC IMPLICA TRES PASOS DE PROGRAMACIN.

Crear la interfaz de usuario mediante los controles de VISUAL BASIC. Establecer las caractersticas o propiedades de los elementos de dicha interfaz de usuario, medida que sea necesaria. Escribir el cdigo del programa para uno o ms elementos de la interfaz del usuario, a medida que sean necesarios.

2.1.1 Diseo del Sistema.

Se llevara a cabo el anlisis de requisitos del programa que es una base de datos que registra la informacin 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 usarn para mantener guardados los datos en el disco aun despus de terminar la ejecucin del programa deber contar tambin con funciones que sean necesarios, el programa debe validar los diversos datos que se ingresaran, estos deben estar acompaados con un respectivo mensaje que ayude a comprender su correcta utilizacin.

El desempeo 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 informacin haciendo que se envi un mensaje de alerta cuando un

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

2.1.2 Objetivos del Diseo de SQL Server

Los clientes estn buscando soluciones para sus problemas de negocios. 2La mayora de las "soluciones" de bases de datos solamente traen mltiples niveles de costos y complejidad. La estrategia de Microsoft es la de hacer que SQL Server sea la base de datos ms fcil de utilizar para construir, administrar e implementar aplicaciones de negocios. Esto significa tener que poner a disposicin un modelo de programacin rpido y sencillo para desarrolladores, eliminando la administracin de base de datos para operaciones estndar, y suministrando herramientas sofisticadas para operaciones ms complejas.

SQL Server disminuye el costo total de propiedad a travs de caractersticas como administracin multi-servidor y con una sola consola; ejecucin y alerta de trabajos basadas en eventos; seguridad integrada; y scripting administrativo. Esta versin tambin libera al administrador de base de datos para aspectos ms sofisticados del trabajo al automatizar las tareas de rutina. Al combinar estos poderosos servicios de administracin con las nuevas caractersticas de configuracin automtica, Microsoft SQL Server es la eleccin ideal de automatizacin de sucursales y aplicaciones de base de datos insertadas.

www. Monografas.com/trabajos14/sqlserver/sqlserver.shtml

Los clientes invierten en sistemas de administracin de bases de datos, en forma de aplicaciones escritas para esa base de datos y la educacin que implica para la implementacin y administracin. Esa inversin debe protegerse: a medida que el negocio crece, la base de datos deber crecer y manejar ms datos, transacciones y usuarios. Los clientes tambin desean proteger las inversiones a medida que escalan aplicaciones de base de datos hacia equipos porttiles y sucursales.

Para cumplir con estas necesidades, Microsoft ofrece un motor de base datos nico que escala desde una computadora porttil que ejecuta Windows 95 o Windows 98, hasta clusters de procesadores mltiples simtricos de terabyte que ejecutan Windows NT Server Enterprise Edition. Todos estos sistemas mantienen la seguridad y confiabilidad que exigen los sistemas de negocios de misin crtica. Nueva para el lanzamiento de 7.0 es una versin de rastro de baja memoria con capacidades de replicacin de multi-sitio. Se ajusta muy bien a las necesidades cada vez mayores del mercado de la computacin mvil. Las otras caractersticas tales como bloqueo a nivel de lnea dinmico, 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 eleccin ideal para sistemas OLTP de alta tecnologa y sistemas de data warehousing.

Mientras los sistemas de procesamiento siguen siendo un componente clave para las infraestructuras de bases de datos corporativas, las compaas tambin estn invirtiendo bastante en mejorar la comprensin que tienen de sus datos. La estrategia de Microsoft consiste en reducir el costo y la complejidad del data

warehousing mientras hace que la tecnologa sea ms accesible a una mayor cantidad de pblico.

Microsoft ha establecido un enfoque total a todo el proceso de data warehousing (almacenamiento de datos). El objetivo es facilitar la construccin y diseo de soluciones de data warehousing costo efectivas a travs de una combinacin de tecnologas, servicios y alianzas con los proveedores.

La Microsoft Alliance for Data Warehousing es una coalicin que une a los lderes en la industria de almacenamiento de datos y aplicaciones. El Microsoft Data Warehousing Framework constituye un conjunto de interfaces de programacin diseadas para simplificar la integracin y administracin de soluciones de data warehousing.

Las innovaciones del producto en SQL Server 7.0 mejoran el proceso de data warehousing: Servicios de Transformacin de Datos; manejo mejorado de las consultas complejas y bases de datos muy grandes; procesamiento analtico en lnea e integrado; y el Microsoft Repository. Otro componente esencial es el soporte extenso para integracin de terceros.

10

2.1.3 Visual Basic


3

Este lenguaje de programacin es desarrollado por Alan Cooper para Microsoft.

El lenguaje de programacin es un dialecto de BASIC, con importantes aadidos.

Su primera versin fue presentada en 1991 con la intencin de simplificar la

programacin utilizando un ambiente de desarrollo completamente grfico que

facilitara la creacin de interfaces grficas y en cierta medida tambin la

programacin misma. Desde el 2001 Microsoft ha propuesto abandonar el

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

comn de libreras independiente de la version del sistema operativo, .NET

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

de fcil transicin de cdigo entre ellos) que presenta serias incompatibilidades

con el cdigo Visual Basic existente.

Visual Basic constituye un IDE (entorno de desarrollo integrado o en ingls Integrated Development Enviroment) que ha sido empaquetado como un programa de aplicacin, es decir, consiste en un editor de cdigo (programa donde

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

11

se escribe el cdigo fuente), un depurador (programa que corrige errores en el cdigo fuente para que pueda ser bien compilado), un compilador (programa que traduce el cdigo fuente a lenguaje de mquina), y un constructor de interfaz grfica o GUI (es una forma de programar en la que no es necesario escribir el cdigo para la parte grfica del programa, sino que se puede hacer de forma visual).

12

CAPITULO III 3. Diseo Metodolgico.


Para realizar la investigacin se consideraron los siguientes aspectos: Metodologa y Tcnicas

3.1 Metodologa.

La metodologa que se aplicar son dos, de campo y el bibliogrfico.

Campo.- son un conjunto de mtodos, tcnicas y procedimientos sistemticos que se utilizarn para obtener respuestas al problema planteado.

Bibliogrfico.- esta es de tipo bibliogrfico por cunto el desarrollo de la investigacin se apoya en informacin de libros, Internet y en folletos, etc.

3.2 Tcnicas.

Se aplic la siguiente tcnica:

Tcnicas de entrevista.- Permitir recopilar informacin en forma verbal, a travs de preguntas previamente elaboradas. Se entrevistarn de forma individual al personal de la Escuela Fiscal 21 de Mayo, quienes sern los principales beneficiados del proyecto.

13

3.3 Resultados Obtenidos Con el desarrollo del sistema informtico para la Escuela 21 de Mayo se logr solucionar las dificultades que se originaban al momento de realizar los procesos de matriculacin, reporte de notas y asistencia del personal. El sistema desarrollado permite un manejo fcil y eficiente del control de asistencia del personal, as como tambin 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 travs del sistema el acceso a una informacin ordenada y actualizada del proceso administrativo de la institucin

14

3.3 Presupuesto.

Nro 1 2 3 4 5 6 7 8 9

Descripcin Material de escritorio y oficina Copias Transporte Tinta para impresora Impresin Empastadas de Tesis Alquiler de Internet y Computadora Material bibliogrfico Remas de Hojas SUMAN IMPREVISTOS 10% TOTAL

Cantidad 1 2334 1 3 1 9 1 1 7

Costo Unitario 30.00 0.03 30.00 25.00 65.00 7.00 60.00 50.00 4.00

Sub. Total $ 30.00 $ 70.00 $ 30.00 $ 75.00 $ 65.00 $ 63.00 $ 60.00 $ 50.00 $ 28.00 $ 471.00 $ 47.10 $ 518.10

SON: QUINIENTOS DIECIOCHO 10/100 DOLARES.

15

CAPITULO IV

4.1 CONCLUSIONES Y RECOMENDACIONES

4.1.1 CONCLUSIONES Despus de concluir con nuestro proyecto DESARROLLO DE UN SISTEMA INFORMATICO ADMINISTRATIVO PARA LA ESCUELA FISCAL MIXTA 21 DE MAYO DEL CANTN 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 matriculacin, reporte de notas, asistencia del personal docente y dems procesos que se realizan en la Escuela.

El sistema cuenta con varias funcionabilidades que facilitan al usuario la comprensin y manejo del mismo.

El desarrollo del sistema cuenta con un manual de usuario que tiene la documentacin necesaria que servir a la persona administrar el sistema. encargada de

16

4.1.2 RECOMENDACIONES

Para la debida utilizacin del sistema es recomendable tener en cuenta las siguientes recomendaciones:

Que el Administrador de sistema tenga conocimientos bsicos en Informtica y una previa capacitacin a la utilizacin del mismo.

Para cualquier ayuda utilizar el manual de usuario.

El administrador debe ser el nico responsable de la informacin que se ingresa al sistema para que no hayan confusiones.

Para que la implementacin del sistema sea efectiva es recomendable que la informacin se maneje con gran seguridad.

17

CAPITULO V

5. PROPUESTA

5.1. DESCRIPCION GENERAL DEL SISTEMA El programa llamado Ejecutable.exe es un sistema informtico que sirve para llevar registros de matriculacin, 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 informtico lo conforman los siguientes mdulos: Formularios de Matriculacin: 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 informtico 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 computacin que se necesitan para un ptimo funcionamiento son: Marca Mainborad: Tipo de Procesador: Tamao de Disco Duro: Memoria RAM: Monitor: Unidad de CD: Impresora: Intel Dual Core de 2.0 GHz o Superior 160 GB de Espacio Inicial o Superior 1 GB o Superior VGA o SVGA DVD-Rom Opcional

18

5.3 RELACIONES DE LAS BASES DE DATOS

19

5.4 CRONOGRAMA VALORADO

SISTEMA

Matriculacin Registros Estudiantes Representantes Matricula Informes Informe De Alumnos Matriculados

Notas Registros Notas de Estudiante Informes

Asistencias Registros Asistencias de Profesores 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 Informe de Asistencias de Profesores

Configuracin 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 21

5.5 Bibliografa.

BATINI, CERI Y NAVATHE. Diseo Conceptual de Bases de Datos. Adisson Wesley. 1994.

Internet de la pgina 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 Edicin McGraw Hill. Espaa. 1993.

21 15

ANEXOS

MANUAL DEL PROGRAMADOR

NDICE PG. 1. CODIFICACIN 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

1. 1.1

CODIFICACION DEL PROGRAMA 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

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"

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"

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

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

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

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

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()

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()

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

10

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

11

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

12

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

13

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

14

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"

15

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

16

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 = ""

17

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

18

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

19

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

20

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

21

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

22

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

23

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

24

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

25

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

26

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

27

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

28

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

29

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

30

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"

31

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

32

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

33

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") & "')"

34

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) & "'"

35

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

36

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

37

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

38

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

39

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()

40

'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

41

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='" &

42

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

43

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

44

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

45

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 & "'"

46

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)

47

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

48

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

49

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

50

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

51

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

52

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

53

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

54

.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

55

.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)

56

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

57

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)

58

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

59

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

60

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)

61

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"))

62

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

63

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

64

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

65

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

66

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()

67

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) = ""

68

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

69

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

70

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

71

.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

72

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='" &

73

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

74

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 & ")"

75

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"

76

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"

77

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

78

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()

79

'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 = ""

80

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

81

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

82

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

83

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()

84

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

85

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()

86

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

87

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

88

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()

89

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

90

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

91

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

92

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

93

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

94

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

95

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

96

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

97

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

98

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

99

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

100

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()

101

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

102

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

103

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) & "' )"

104

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 & "' "

105

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

106

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

107

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

108

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

109

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()

110

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)

111

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

112

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

113

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

114

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")

115

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)

116

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

117

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

118

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).tamao / 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

119

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

120

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

121

revisar As Boolean Obligatorio As Boolean End Type

Public Type campo nombre As String tamao 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

122

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 'Funcin 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 segn 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 tamao de una ventana y asignar los valores mximos y mnimos del tamao 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

123

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

124

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

125

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

126

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

127

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

128

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

129

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 = ""

130

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) & ")"

131

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 "

132

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

133

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

134

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

135

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 & "')"

136

'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:

137

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

138

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 = ""

139

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).tamao = 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

140

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")

141

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

142

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 nmero 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

143

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

144

MANUAL DEL USUARIO

NDICE PG. 1. MANUAL DEL USUARIO 2. DESCRIPCION DETALLADA DEL SISTEMA 3. FUNCIONAMIENTO DEL SISTEMA 3.1 FORMULARIO DEL ESTUDIANTE 3.2 REGISTRO DEL REPRESENTANTE 3.3 FORMULARIO DE REGISTRO DE MATRICULA 3.4 INFORME DEL ESTUDIANTE MATRICULADOS 3.5 REGISTRO DE NOTAS DE ESTUDIANTE 3.6 INFORMES DE REGISTROS DE ALUMNOS POR NOTAS 3.7 INFORME DE NOTAS POR ALUMNO 3.8 INFORME DE NOTAS POR TRIMESTRE RESUMIDO 3.9 INFORME DE NOTAS POR TRIMESTRE 3.10 INFORME DE NOTAS POR MATERIAS Y TRIMESTRE 3.11 REGISTRO DE ASISTENCIA DE PROFESORES 3.12 INFORME DE ASISTENCIA DE PROFESORES DETALLADO 4. CONFIGURACIONES RE REGISTRO 4.1 CONFIGURACION DE REGISTRO DE PERIODO 4.2 CONFIGURACION DE GRADO 4.3 CONFIGURACION DE REGISTRO DE MATERIA 4.4 CONFIGURACION DE REGISTRO DE PARALELO 4.5 CONFIGURACION DE REGISTRO DE PROFESORES 4.6 CONFIGURACION DE PARCIALES 4.7 CONFIGURACION DEL USUARIO 4.8 ESTABLECER PERIODO ACTIVO 4.9 BLOQUEO DEL SISTEMA 4.10 REGISTRO DE CONFIGURACIONES DE NOTAS 4.11 REGISTRO DE CONFIGURACIONES DE ESCUELA 4.12 REGISTRO DE CONFIGURACIONES DE ESCUDO 4.13 REGISTRO DE CONFIGURACIONES DE FONDO 4.14 REGISTRO DE CONFIGURACIONES VARIOS 4.15 ESTABLECER CONFIGURACION DE MATERIAS A GRADO 4.16 ESTABLECER MATERIAS A PROFESORES 4.17 ESTABLECER ADMINISTRADOR 3 3 5 6 6 6 7 7 8 8 9 9 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 16

MANUAL DEL USUARIO DESCRIPCIN 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 continuacin detallamos.

1. Instalacin 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 trminos para realizar la instalacin con xito.

2. EJECUCIN DEL PROGRAMA. Seleccionar el botn inicio Seleccionar Todos los Programas Elegir el men Por ltimo clic en Administrado

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 contrasea

3.1 FORMULARIO PRINCIPAL PANTALLA INICIAL La pantalla principal se encuentra formada por: Barra de Titulo Barra de Men

3.1 FORMULARIO DE ESTUDIANTE 5

3.2 FORMULARIO DE REGISTRO DE REPRESENTANTES

3.3 FORMULARIO DE REGISTRO DE MATRICULA

3.4 INFORME DE ESTUDIANTES MATRICULADOS

3.5 REGISTRO DE NOTAS DE ESTUDIANTES

3.6 INFORME DE REGISTRO DE ALUMNOS POR NOTAS RESUMIDO

3.7INFORME DE NOTAS POR ALUMNO

3.8INFORME DE NOTAS POR TRIMESTRE RESUMIDO

3.9INFORME DE NOTAS POR TRIMESTRE

3.10 INFORME RESUMIDO DE NOTAS POR MATERIAS Y TRIMESTRES

3.11REGISTRO DE ASISTENCIA DE PROFESORES

10

3.12 INFORME DE ASISTENCIAS DE PROFESORES DETALLADO

4.

CONFIGURACIONES DE REGISTROS

4.1 CONFIGURACIN DE REGISTRO DE PERODOS

11

4.2 CONFIGURACIN DE REGISTROS DE GRADOS

4.3 CONFIGURACIN DE REGISTROS DE MATERIAS

4.4 CONFIGURACIN DE REGISTRO DE PARALELOS

4.5 CONFIGURACIN DE REGISTROS DE PROFESORES

12

4.6 CONFIGURACIN DE PARCIALES

4.7 CONFIGURACIN DEL USUSARIO

4.8 ESTABLECER PERODO ACTIVO

13

4.9 BLOQUEO DE SISTEMA

4.10 REGISTRO DE CONFIGURACIONES DE NOTAS:

4.11 REGISTRO DE CONFIGURACIONES DE ESCUELA

14

4.12 REGISTRO DE CONFIGURACIONES DE ESUDO

4.13 REGISTRO DE CONFIGURACIONES DE FONDO

4.14 REGISTRO DE CONFIGURACIONES VARIOS

15

4.15 ESTABLECER CONFIGURACIN DE MATERIAS A GRADOS

4.16 ESTABLECER MATERIAS A PROFESORES

4.17 ESTABLECER ADMINISTRADOR

16

Вам также может понравиться