INSTITUTO 9 DE JULIO - SAN MIGUEL DE TUCUMAN -NIVEL TERCIARIO - CARRERA DE ANALISTA DE SISTEMAS DE COMPUTACION

29 agosto 2008

PROCESO DE ALTA

Proceso por el cual se ingresa un registro a la tabla, este proceso controla si el dato que se quiere agregar no existe ya. Esta busqueda se hace en forma secuencial (recorre la tabla desde el primer al ultimo registro hasta encontrar el registro buscado), o acceder al registro buscado a traves de un campo clave. Este segundo metodo es mucho mas practico por la velocidad con que ubica dicho registro, pero necesita de un archivo indice (donde se almacena el ordenamiento que se necesita).
*******************************************************************
* OBJETIVO: PROCESO DE ALTA EN TABLA ALUMNOS.DBF
* Estructura de la tabla:
* dni c(10)
* nom c(20)
* ape c(20)
* fecing f(10)
* cuota n(3,2)
*
*Ordenamiento: index on dni tag dni
*******************************************************************
set confirm on && obliga oprimir ENTER para pasar al campo sgte.
set century on && fecha con 4 digitos
control=1
clea
close data
* pone en uso tabla alumnos ordenada por dni
use alumnos order tag dni
op=0
do while control=1
clear
xdni=space(10)
xnom=space(20)
xape=space(20)
xdire=spac(40)
xfecing=CTOD(" / / ")
xcuota=0
@ 1,1 say "Documento (DNI) :" get xdni
read
if lastkey()=27 && si oprime tecla ESC cierra tabla y sale
close data
clea
return
endif
seek xdni && busca el dni en la tabla ordenada
if found() && si lo encontro
wait "DOCUENTO YA EXISTENTE..." windows nowait
loop && transfiere el control al do while (arriba)
endif
@ 3,1 say "Apellido :" get xape function "!"
@ 5,1 say "Nombre :" get xnom function "!"
@ 7,1 say "Direccion :" get xdire
@ 9,1 say "Fecha Ingreso :" get xfecing
@ 11,1 say "Cuota :" get xcuota picture "999.99"
@ 13,1 get op function "*h Confirma;Termina" size 2,20,3 && alto,ancho,esp. entre botones
read cycle
if lastkey()=27 && si oprime tecla ESC cierra tabla y sale
close data
clea
retur
endif
do case
case op=1
append blank
replace dni with xdni
replace ape with xape
replace nom with xnom
replace dire with xdire
replace fecing with xfecing
replace cuota with xcuota
case op=2
control=0
endcase
enddo
close data
clea
return