Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2 opcin:
modifycommand en la Ventana de Comandos
Solucin a):
close all
clear
set default to z:\inf2
set date dmy
set century on
num =0
nsuma=0
dias =0
@5,5 SAY "Ingrese das de prrroga: " GET dias VALID dias>=0 and dias<=7
READ
USE ventas
DO WHILE !EOF( )
num=num+1
nsuma=nsuma+importe
replace nro with num
replace total with nsuma
replace vencim with vencim +dias
SKIP
ENDDO
browse
Solucin b):
close all
clear
set default to z:\inf2
set date dmy
set century on
dias =0
@5,5 SAY "Ingrese das de prorroga: " GET dias RANGE 0,7
READ
USE ventas
num =RECNO() &&nmero de registro activo
nsuma=0
SCAN
nsuma=nsuma+importe
replace nro with num
replace total with nsuma
replace vencim with vencim +dias
num=num+1
ENDSCAN
browse
Ejercicio N 5:
*Crear la tabla CONSUMOS:
create table consumos (fechaini d,lecturaini N(7,0),fechafin d, lecturafin N(7,0), consumo N(7,0))
*Crear un programa nuevo con modify command:
clear
set default to "z:\inf2"
set date dmy
set century on
USE consumos
scatter memvar blank
&&se leen los datos del primer registro
@1,1 say "ingrese fecha inicial" get m.fechaini
@2,1 say "ingrese fecha final" get m.fechafin valid m.fechafin >m.fechaini
@3,1 say "ingrese lectura inicial" get m.lecturaini
@4,1 say "ingrese lectura final" get m.lecturafin valid m.lecturafin >m.lecturaini
READ
do while lastkey()!=27
m.consumo=m.lecturafin-m.lecturaini
append blank
gather memvar &&se completa el primer registro
m.lecturaini=m.lecturafin
m.fechaini=m.fechafin
clear
&& se leen los datos del resto de los registros
@1,1 say "ingrese fecha" get m.fechafin valid m.fechafin >m.fechaini
@2,1 say "ingrese lectura" get m.lecturafin valid m.lecturafin >m.lecturaini
READ
enddo
browse
wait "Presione una tecla para continuar" windows timeout 10
clear
close all
Observacin: Produce error el uso de DO WHILE LASTKEY() !=27 en este ejercicio?