Pascal/Turbo Pascal - ayuda programa en pascal

 
Vista:

ayuda programa en pascal

Publicado por david (3 intervenciones) el 02/03/2012 06:47:52
bueno soy nuevo en esto y me han enviado un proyecto con archivos y ando bueno perdido una ayuda de como estructurarlo este es el programa

Para cada localidad se manejarán tres (3) tiempos diferentes ordenados de menor a mayor, para lo cual el incumplimiento de alguno implicará un descuento, como se explica en la tabla siguiente: Tiempo (Minutos) Descuento (%)
<= Tiempo 1
0
<= Tiempo 2
20
<= Tiempo 3
50
> Tiempo 3
100
En función de la aplicación de dichos descuentos es importante conocer cada una de las localidades en que la pizzería podrá realizar entregas, así como los valores correspondientes a los tres tiempos de entrega descritos anteriormente, tomando que la cantidad de localidades es desconocida, que las mismas pueden cambiar, y que se requiere un almacenamiento permanente de las mismas.
Ahora bien, toda vez que se reciba una solicitud, la misma es registrada incluyendo los datos de contacto del cliente (nombre completo, cédula, teléfono, dirección), así como el número del pedido, la descripción y el total a pagar (no se estipula para ello el manejo de un menú de pizzas), y el establecimiento de la localidad de entrega, y la fecha y hora de la solicitud a partir de la cual se inicia el conteo de los minutos para la entrega del pedido (Hora y Minutos en formato militar). Posterior a la entrega, se registra la hora de entrega del pedido en el mismo formato de la hora de solicitud (en una opción denominada cierre o entrega de pedido), con la cual se calculará el tiempo transcurrido para la entrega y se calculará y registrará el descuento correspondiente, que servirá para determinar el total exacto pagado por los clientes.
REQUERIMIENTOS BÁSICOS DEL PROGRAMA
El programa debe
&#61692; Crear y administrar los archivos localidades.dat y pedidos.dat, registrando los datos necesarios en función de lo explicado anteriormente.
&#61692; Mostrar un menú principal con las opciones:
1. Apertura de día: se crea un nuevo día que no posea registros dentro del archivo pedidos.dat, con la cual se realizarán los nuevos pedidos del día.
2. Añadir localidad: Registrar una localidad no existente en el archivo, junto con los tiempos de entrega permitidos.
3. Editar una localidad: modificar alguno de los datos de una localidad existente, excepto el nombre de la localidad.
4. Registrar una solicitud: añadir un nuevo pedido con los datos necesarios de la solicitud del mismo.
5. Entrega de pedido: ubicará un pedido dentro del archivo, registrará la hora de entrega y calculará el descuento correspondiente, en caso de ser necesario.
6. Cierre de día: mostrará el total vendido durante ese día, el monto calculado para efectos descuento, y el total neto recibido por parte de los clientes (vendido - descuento). Al realizarse el cierre no se podrán registrar nuevos pedidos para esa fecha. Debe tomarse en cuenta que si existen pedidos no entregados para esa fecha no se podrá realizar el cierre hasta tanto los mismos sean entregados.
7. Listado de las localidades: mostrará todas las localidades registradas en el archivo localidades.dat.
8. Reporte de ingresos por fecha: el programa solicitará una fecha determinada, y se mostrará el total de ventas y de descuentos para esa fecha.
9. Reporte de ingresos por localidad: el programa solicitará una localidad (registrada en el archivo localidades.dat) y totalizará los ingresos y descuentos correspondientes, independiente de la fecha.
10. Salir del programa.

tenemos la idea la hemos estructurado pro una ayuda no nos vendria nada mal gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

ayuda programa en pascal

Publicado por ramon (2158 intervenciones) el 03/03/2012 17:22:57
{Esto va a valer si o no para seguir }

program pizzeria;
uses
crt;
const
fech : string = 'temp.dat';
type
pizza = record
tiempos : array[1..3] of integer;
poblacion : string[20];
nombre : string[200];
direcci : string[100];
telefo : longint;
numcarne : string[20];
numpedido : word;
descripcion : string;
totalpizza : real;
totalcosto : real;
fecha : string[10];
hora : string[5];
entrega : string[5];
end;

var
f : file of pizza;
datos : pizza;
tecla : char;


function entradadatos(x, y : integer; cual : char) : string;
var
cot : integer;
dat : string;
puls : char;
begin
fillchar(dat,226,' ');
dat[0] := chr(225);
cot := 1;
gotoxy(x,y);
repeat
puls := readkey;
if cual in['n','N'] then
begin
if puls in[#48..#57,#46] then
begin
dat[cot] := puls;
dat[0] := chr(cot);
gotoxy(x - 1 + cot,y);write(dat[cot]);
cot := cot + 1;
if cot > 20 then
cot := 20;
end;
end;
if cual in['t','T'] then
begin
if puls in[#39..#126,#164,#165,#32] then
begin
dat[cot] := puls;
dat[0] := chr(cot);
gotoxy(x - 1 + cot,y);write(dat[cot]);
cot := cot + 1;
if cot > 80 then
cot := 80;
end;
end;
if puls = #8 then
begin
cot := cot - 1;
if cot < 1 then
cot := 1;
dat[cot] := ' ';
dat[0] := chr(cot);
gotoxy(x - 1 + cot,y);write(dat[cot]);
end;
until puls = #13;
entradadatos := copy(dat,1,length(dat));
end;


procedure entradas_dia;
var
num : longint;
nw : word;
error : integer;
da : string[20];
tt : char;
begin
clrscr;
fillchar(datos,sizeof(datos),0);
gotoxy(10,2);write('Entrada Pedido Pizza');
gotoxy(10,4);write('Nombre y Apellidos : ');
gotoxy(10,5);write('N§ Cedula : ');
gotoxy(10,6);write('Direccion : ');
gotoxy(10,7);write('N§ Telefono : ');
gotoxy(10,8);write('N§ De Pedido : ');
gotoxy(10,9);write('Descriccion : ');
gotoxy(10,10);write('Hora Pedido : ');
datos.nombre := entradadatos(31,4,'t');
datos.numcarne := entradadatos(31,5,'t');
datos.direcci := entradadatos(31,6,'t');
da := entradadatos(31,7,'n');
val(da,num,error);
if error > 0 then
begin
delete(da,error,1);
val(da,num,error);
end;
datos.telefo := num;
da := entradadatos(31,8,'n');
val(da,nw,error);
if error > 0 then
begin
delete(da,error,1);
val(da,nw,error);
end;
datos.numpedido := nw;
datos.descripcion := entradadatos(31,9,'t');
datos.hora := entradadatos(31,10,'t');
gotoxy(12,12);write('Datos Correctos [S/N]');
repeat
tt := readkey;
until tt in['s','S','n','N'];
if tt in['n','N'] then
entradas_dia
else
begin
if fech = 'temp.dat' then
begin
clrscr;
gotoxy(10,4);write('Entre Fecha : [02/02/12]');
gotoxy(24,4);readln(fech);
end;
assign(f,'p' + fech + '.dat');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
assign(f,fech);
rewrite(f);
seek(f,0);
write(f,datos);
close(f);
end
else
begin
seek(f,filesize(f));
write(f,datos);
close(f);
end;
end;
end;



procedure marcadormenu(xm, ym : integer; activo : boolean);
begin
if activo = true then
begin
textcolor(15);
end
else
begin
textcolor(0);
end;
gotoxy(xm - 1,ym - 1);write(' -----------------------------------');
gotoxy(xm - 1,ym);write('|');
gotoxy(xm + 35,ym);write('|');
gotoxy(xm - 1,ym + 1);write(' -----------------------------------');
textcolor(15);
end;

procedure menu;
var
xc, yc : integer;
tec : char;
sal : boolean;
begin
xc := 7;
yc := 3;
sal := false;
repeat
gotoxy(8,1);write('***** Menu General *****');
gotoxy(8,3);write('Apertura de dia');
gotoxy(8,5);write('A¤adir localidad');
gotoxy(8,7);write('Editar una localidad');
gotoxy(8,9);write('Registrar una solicitud');
gotoxy(8,11);write('Entrega de pedido');
gotoxy(8,13);write('Cierre de dia');
gotoxy(8,15);write('Listado de las localidades');
gotoxy(8,17);write('Reporte de ingresos por fecha');
gotoxy(8,19);write('Reporte de ingresos por localidad');
gotoxy(8,21);write('Salir del programa');
marcadormenu(xc,yc,true);
tec := readkey;
marcadormenu(xc,yc,false);
if tec = #80 then
begin
yc := yc + 2;
if yc > 21 then
yc := 21;
end;
if tec = #72 then
begin
yc := yc - 2;
if yc < 3 then
yc := 3;
end;
if tec = #13 then
begin
case yc of
3 : entradas_dia;
5 :;
7 :;
9 : entradas_dia;
11 :;
13 :;
15 :;
17 :;
19 :;
21 : sal := true;
end;
end;
until (sal = true) or (tec = #27);

end;


begin
clrscr;
menu;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

ayuda programa en pascal

Publicado por david (3 intervenciones) el 03/03/2012 18:04:00
gracias amigo Si vale y mucho
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

ayuda programa en pascal

Publicado por David (3 intervenciones) el 06/03/2012 03:56:26
Disculpa Ramón ayudame a hacer las ultimas opciones faltantes es urgente por favor gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

ayuda programa en pascal

Publicado por ramon (2158 intervenciones) el 09/03/2012 16:51:23
{Espero te ayude esto}

program pizzeria;
uses
crt, dos;
const
contiempos : array[1..4] of integer = (0, 20, 50, 100);
preciopedido : array[1..5] of real = (1.23,2.34,3.12,4.0,5.30);
type
string10 = string[10];
regpoblacion = record
codigo : integer;
poblacion : string[20];
tiempos : integer;
descuent : integer;
end;

pizza = record
fechadia : string[10];
codigo : integer;
nombre : string[200];
direcci : string[100];
telefo : longint;
numcarne : string[20];
numpedido : word;
descripcion : string;
totalpizza : real;
totalcosto : real;
fecha : string[10];
hora : string[5];
entrega : string[5];
end;

var
f1 : file of regpoblacion;
f : file of pizza;
datos : pizza;
dato1 : regpoblacion;
tecla : char;



function stringreal(s : string) : real;
var
r : real;
er : integer;
begin
val(s,r,er);
stringreal := r;
end;

function wordstring(r : word) : string;
var
dac : string[4];
begin
str(r,dac);
wordstring := copy(dac,1,length(dac));
end;



function fechaactual : string10;
var
ayo, mes, dia, dise : word;
dat1, dat2, dat3 : string[4];
begin
fechaactual := ' ';
getdate(ayo,mes,dia,dise);
dat1 := wordstring(dia);
dat2 := wordstring(mes);
dat3 := wordstring(ayo);
fechaactual := dat1 + '/' + dat2 + '/' + dat3;
end;

function entradadatos(x, y : integer; cual : char) : string;
var
cot : integer;
dat : string;
puls : char;
begin
fillchar(dat,226,' ');
dat[0] := chr(225);
cot := 1;
gotoxy(x,y);
repeat
puls := readkey;
if cual in['n','N'] then
begin
if puls in[#48..#57,#46] then
begin
dat[cot] := puls;
dat[0] := chr(cot);
gotoxy(x - 1 + cot,y);write(dat[cot]);
cot := cot + 1;
if cot > 20 then
cot := 20;
end;
end;
if cual in['t','T'] then
begin
if puls in[#39..#126,#164,#165,#32] then
begin
dat[cot] := puls;
dat[0] := chr(cot);
gotoxy(x - 1 + cot,y);write(dat[cot]);
cot := cot + 1;
if cot > 80 then
cot := 80;
end;
end;
if puls = #8 then
begin
cot := cot - 1;
if cot < 1 then
cot := 1;
dat[cot] := ' ';
dat[0] := chr(cot);
gotoxy(x - 1 + cot,y);write(dat[cot]);
end;
until puls = #13;
entradadatos := copy(dat,1,length(dat));
end;


procedure entradas_dia;
var
num : longint;
nw : word;
error : integer;
da : string[20];
tt : char;
begin
clrscr;
fillchar(datos,sizeof(datos),0);
gotoxy(10,6);write('*** Entrada Pedido Pizza ***');
gotoxy(10,8);write('Codigo ciudad : ');
gotoxy(10,9);write('Nombre y Apellidos : ');
gotoxy(10,10);write('N§ Cedula : ');
gotoxy(10,11);write('Direccion : ');
gotoxy(10,12);write('N§ Telefono : ');
gotoxy(10,13);write('N§ De Pedido : De 1...5');
gotoxy(10,14);write('Descriccion : ');
gotoxy(10,15);write('Hora Pedido : ');
da := entradadatos(31,8,'n');
val(da,num,error);
if error > 0 then
begin
delete(da,error,1);
val(da,num,error);
end;
datos.codigo := num;
datos.nombre := entradadatos(31,9,'t');
datos.numcarne := entradadatos(31,10,'t');
datos.direcci := entradadatos(31,11,'t');
da := entradadatos(31,12,'n');
val(da,num,error);
if error > 0 then
begin
delete(da,error,1);
val(da,num,error);
end;
datos.telefo := num;
da := entradadatos(31,13,'n');
val(da,nw,error);
if error > 0 then
begin
delete(da,error,1);
val(da,nw,error);
end;
datos.numpedido := nw;
datos.totalpizza := preciopedido[nw];
datos.descripcion := entradadatos(31,14,'t');
datos.hora := entradadatos(31,15,'t');
gotoxy(12,18);write('Datos Correctos [S/N]');
repeat
tt := readkey;
until tt in['s','S','n','N'];
if tt in['n','N'] then
entradas_dia
else
begin
datos.fechadia := fechaactual;
assign(f,'pedidos.dat');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
rewrite(f);
seek(f,0);
write(f,datos);
close(f);
end
else
begin
seek(f,filesize(f));
write(f,datos);
close(f);
end;
end;
end;

procedure entradapoblacion;
var
day : string;
err, nu : integer;
tt : char;
begin
clrscr;
gotoxy(10,2);write('*** Entrada Poblacion ***');
gotoxy(10,3);write('Codigo Poblacion : ');
gotoxy(10,4);write('Nombre Poblacion : ');
gotoxy(10,5);write('Tiempo : ');
day := entradadatos(31,3,'n');
val(day,nu,err);
if err > 0 then
begin
delete(day,err,1);
val(day,nu,err);
end;
dato1.codigo := nu;
dato1.poblacion := entradadatos(31,4,'t');
day := entradadatos(31,5,'n');
val(day,nu,err);
if err > 0 then
begin
delete(day,err,1);
val(day,nu,err);
end;
dato1.tiempos := nu;
dato1.descuent := contiempos[dato1.tiempos];
gotoxy(12,12);write('Datos Correctos [S/N]');
repeat
tt := readkey;
until tt in['s','S','n','N'];
if tt in['n','N'] then
entradapoblacion
else
begin
assign(f1,'poblacio.dat');
{$I-} reset(f1); {$I+}
if ioresult <> 0 then
begin
rewrite(f1);
seek(f1,0);
write(f1,dato1);
close(f1);
end
else
begin
seek(f1,filesize(f1));
write(f1,dato1);
close(f1);
end;
end;
end;

procedure entregapedido;
var
codi : integer;
nupedi : word;
nume : string;
horeentrega : string[5];
i, error : integer;
fuera : boolean;
hoentre, horario : real;
begin
clrscr;
gotoxy(10,2);write('*** Entrega Pedido ***');
gotoxy(10,4);write('Codigo : ');
gotoxy(10,5);write('N§ Pedido : ');
gotoxy(10,6);write('Hora Entrega : ');
fillchar(nume,11,' ');
nume[0] := chr(10);
error := 0;
nume := entradadatos(25,4,'n');
val(nume,codi,error);
if error > 0 then
begin
delete(nume,error,1);
val(nume,codi,error);
end;
fillchar(nume,11,' ');
nume[0] := chr(10);
error := 0;
nume := entradadatos(25,5,'n');
val(nume,nupedi,error);
if error > 0 then
begin
delete(nume,error,1);
val(nume,nupedi,error);
end;
horeentrega := entradadatos(25,6,'t');
assign(f,'pedidos.dat');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
exit;
end
else
begin
i := 0;
fuera := false;
repeat
seek(f,i);
read(f,datos);
if (datos.codigo = codi) and (datos.numpedido = nupedi) and
(datos.fechadia = fechaactual) then
begin
fuera := true;
end;
i := i + 1;
until (i > filesize(f) - 1) or (fuera = true);
datos.entrega := copy(horeentrega,1,length(horeentrega));
horario := stringreal(datos.hora);
hoentre := stringreal(datos.entrega);
if round(hoentre - horario) in[1..10] then
begin
case round(hoentre - horario) of
1 : begin
datos.totalcosto := datos.totalpizza -
((datos.totalpizza * contiempos[1]) / 100);
end;
2 : begin
datos.totalcosto := datos.totalpizza -
((datos.totalpizza * contiempos[2]) / 100);
end;
3 : begin
datos.totalcosto := datos.totalpizza -
((datos.totalpizza * contiempos[3]) / 100);
end;
4..10 : begin
datos.totalcosto := datos.totalpizza -
((datos.totalpizza * contiempos[4]) / 100);
end;
end;
end
else
datos.totalcosto := datos.totalpizza;
seek(f,i - 1);
write(f,datos);
close(f);
end;
end;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

ayuda programa en pascal

Publicado por ramon (2158 intervenciones) el 09/03/2012 16:55:55
{Segunda parte dividida en dos}

procedure cierredia;
var
ii : integer;
tecl1 : char;
x, y : integer;
begin
assign(f,'pedidos.dat');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
exit;
end
else
begin
clrscr;
fillchar(datos,sizeof(datos),0);
gotoxy(30,1);write('**** Cierre Del Dia ****');
gotoxy(2,2);write('N§ Ped. Descriccion Tota Pizza Total Costo',
' Hora Hora Entrega');
ii := 0;
y := 3;
x := 4;
repeat
seek(f,ii);
read(f,datos);
with datos do
begin
gotoxy(x,y);write(numpedido);
gotoxy(x + 5,y);write(descripcion);
gotoxy(x + 30,y);write(totalpizza:3:2);
gotoxy(x + 45,y);write(totalcosto:3:2);
gotoxy(x + 57,y);write(hora);
gotoxy(x + 66,y);write(entrega);
end;
y := y + 1;
if y > 20 then
begin
gotoxy(10,22);write('Pulse Una Tecla Para Segir O [ESC] Salir');
tecl1 := readkey;
clrscr;
gotoxy(30,1);write('**** Cierre Del Dia ****');
gotoxy(2,2);write('N§ Pedido Descriccion Tota Pizza Total Costo',
' Hora Hora Entrega');
y := 3;
end;
ii := ii + 1;
until (ii > filesize(f) - 1) or (tecl1 = #27);
close(f);
if tecl1 <> #27 then
begin
gotoxy(10,22);write('Fin de Datos Del Dia Pulse Una Tecla');
repeat until keypressed;
delay(500);
end;
end;
end;

procedure Presentaciudades;
var
tama, ii : longint;
y : integer;
begin
clrscr;
assign(f1,'poblacio.dat');
{$I-} reset(f1); {$I+}
if ioresult <> 0 then
begin
exit;
end
else
begin
gotoxy(20,1);write('**** Listado De Poblaciones ****');
gotoxy(2,2);write('Codigo Poblacion Descuento %');
tama := filesize(f1) - 1;
ii := 0;
y := 3;
repeat
seek(f1,ii);
read(f1,dato1);
with dato1 do
begin
gotoxy(4,y);write(codigo);
gotoxy(11,y);write(poblacion);
gotoxy(40,y);write(contiempos[tiempos]);
y := y + 1;
if y > 20 then
begin
gotoxy(2,22);write('Pulse Una Tecla Para Segir');
repeat until keypressed;
clrscr;
gotoxy(20,1);write('**** Listado De Poblaciones ****');
gotoxy(2,2);write('Codigo Poblacion Descuento %');
y := 3;
end;
end;
ii := ii + 1;
until ii > tama;
close(f1);
gotoxy(2,22);write('/// Fin De Informacion Pulse Una Tecla \\\');
repeat until keypressed;
delay(500);
end;
end;

procedure reporteporfecha;
var
fecharep : string[10];
cont : longint;
ventas : word;
y : integer;
totalingreso : real;
begin
clrscr;
gotoxy(10,1);write('**** Reporte Por Fechas ****');
gotoxy(1,3);write('Fecha A Reportar : Forma : 12/10/2012');
fecharep := entradadatos(20,3,'t');
assign(f,'pedidos.dat');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
exit;
end
else
begin
clrscr;
totalingreso := 0;
cont := 0;
ventas := 0;
gotoxy(20,1);write('**** Ventas En Fecha **** [',fecharep,']');
gotoxy(2,2);write('Ventas Costo Descuentos Tiempo');
y := 3;
repeat
seek(f,cont);
read(f,datos);
if datos.fechadia = fecharep then
begin
ventas := ventas + 1;
gotoxy(4,y);write(ventas,' ',datos.totalpizza:3:2,' ',
(datos.totalcosto - datos.totalpizza):3:2,' ',
stringreal(datos.entrega) - stringreal(datos.hora):3:2);
totalingreso := totalingreso + datos.totalcosto;
y := y + 1;
if y > 20 then
begin
gotoxy(3,22);write('\\\ Pulse Una Tecla Para Segir ///');
repeat until keypressed;
clrscr;
gotoxy(20,1);write('**** Ventas En Fecha **** [',fecharep,']');
gotoxy(2,2);write('Ventas Costo Descuentos Tiempo');
y := 3;
end;
end;
cont := cont + 1;
until cont > filesize(f) - 1;
close(f);
gotoxy(40,22);write('Total Ingresos : ',totalingreso:8:2);
gotoxy(20,23);write('Pulse Una Tecla Para Salir');
repeat until keypressed;
delay(500);
end;
end;

procedure reporteporlocalidad;
var
codigos : integer;
cont : longint;
ventas : word;
y : integer;
totalingreso : real;
tex : string[10];
begin
clrscr;
gotoxy(10,1);write('**** Reporte Por Localidad ****');
gotoxy(1,3);write('Entre Codigo Localidad : ');
tex := entradadatos(26,3,'n');
val(tex,codigos,y);
if y > 0 then
begin
delete(tex,y,1);
val(tex,codigos,y);
end;
assign(f,'pedidos.dat');
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
exit;
end
else
begin
clrscr;
totalingreso := 0;
cont := 0;
ventas := 0;
gotoxy(20,1);write('**** Ventas En Localidad **** [',codigos,']');
gotoxy(2,2);write('Ventas Costo Descuentos Tiempo');
y := 3;
repeat
seek(f,cont);
read(f,datos);
if datos.codigo = codigos then
begin
ventas := ventas + 1;
gotoxy(4,y);write(ventas,' ',datos.totalpizza:3:2,' ',
(datos.totalcosto - datos.totalpizza):3:2,' ',
stringreal(datos.entrega) - stringreal(datos.hora):3:2);
totalingreso := totalingreso + datos.totalcosto;
y := y + 1;
if y > 20 then
begin
gotoxy(3,22);write('\\\ Pulse Una Tecla Para Segir ///');
repeat until keypressed;
clrscr;
gotoxy(20,1);write('**** Ventas En Localidad **** [',codigos,']');
gotoxy(2,2);write('Ventas Costo Descuentos Tiempo');
y := 3;
end;
end;
cont := cont + 1;
until cont > filesize(f) - 1;
close(f);
gotoxy(40,22);write('Total Ingresos : ',totalingreso:8:2);
gotoxy(20,23);write('Pulse Una Tecla Para Salir');
repeat until keypressed;
delay(500);
end;
end;




procedure marcadormenu(xm, ym : integer; activo : boolean);
begin
if activo = true then
begin
textcolor(15);
end
else
begin
textcolor(0);
end;
gotoxy(xm - 1,ym - 1);write(' -----------------------------------');
gotoxy(xm - 1,ym);write('|');
gotoxy(xm + 35,ym);write('|');
gotoxy(xm - 1,ym + 1);write(' -----------------------------------');
textcolor(15);
end;

procedure menu;
var
xc, yc : integer;
tec : char;
sal : boolean;
begin
xc := 7;
yc := 3;
sal := false;
repeat
clrscr;
gotoxy(8,1);write('***** Menu General *****');
gotoxy(8,3);write('Apertura de dia');
gotoxy(8,5);write('A¤adir localidad');
gotoxy(8,7);write('Editar una localidad');
gotoxy(8,9);write('Registrar una solicitud');
gotoxy(8,11);write('Entrega de pedido');
gotoxy(8,13);write('Cierre de dia');
gotoxy(8,15);write('Listado de las localidades');
gotoxy(8,17);write('Reporte de ingresos por fecha');
gotoxy(8,19);write('Reporte de ingresos por localidad');
gotoxy(8,21);write('Salir del programa');
marcadormenu(xc,yc,true);
tec := readkey;
marcadormenu(xc,yc,false);
if tec = #80 then
begin
yc := yc + 2;
if yc > 21 then
yc := 21;
end;
if tec = #72 then
begin
yc := yc - 2;
if yc < 3 then
yc := 3;
end;
if tec = #13 then
begin
case yc of
3 : entradas_dia;
5 : entradapoblacion;
7 : entradapoblacion;
9 : entradas_dia;
11 : entregapedido;
13 : cierredia;
15 : Presentaciudades;
17 : reporteporfecha;
19 : reporteporlocalidad;
21 : sal := true;
end;
end;
until (sal = true) or (tec = #27);

end;


begin
clrscr;
menu;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar