
Ayuda con este prama
Publicado por Luis (14 intervenciones) el 24/04/2015 02:15:46
]amigos necesito ayuda con este programa quisiera saber si me podrían ayudar se los agradecería mucho.


Valora esta pregunta


0
{Mira esto como podrás apreciar solo permite 10 clientes por el tamaño de los datos.
Coméntame si te sirve como va o quieres otro tipo de estructura }
program facturas;
uses
crt;
const
max = 24;
descu1 = 15;
descu2 = 20;
type
pedido = record
precio : real;
cantida : real;
product : string[80];
limite : boolean;
end;
factura = record
npedido : integer;
producto : array[1..max] of pedido;
pro : integer;
total : real;
IVA : real;
total_y_IVA : real;
end;
var
cliente : array[1..10] of factura;
prod, cont : integer;
procedure genera_factura(nn : integer);
var
z : integer;
begin
if cliente[nn].pro > 0 then
begin
clrscr;
gotoxy(20,2);write('Factura Cliente');
gotoxy(2,3);write('ÚÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿');
gotoxy(2,4);write('³ Numero ³ Precio Base ³ Cantidad ³ Descuento ³ Total ³ Total + IVA ³');
gotoxy(2,5);write('³ Producto³ ³ Productos³ ³ ³ ³');
gotoxy(2,6);write('ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´');
if cliente[nn].pro = 1 then
begin
gotoxy(2,7);write('³ ³ ³ ³ ³ ³ ³');
gotoxy(2,8);write('ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´');
gotoxy(2,9);write('³ ³ ³ ³ ³ ³ ³');
gotoxy(2,10);write('ÀÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ');
end
else
begin
for z := 1 to cliente[nn].pro do
begin
gotoxy(2,6 + z);write('³ ³ ³ ³ ³ ³ ³');
gotoxy(2,6 + z);write('ÃÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´');
end;
gotoxy(2,6 + z);write('³ ³ ³ ³ ³ ³ ³');
gotoxy(2,6 + (z + 1));write('ÀÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ');
end;
end
else
begin
writeln(' No hay datos que mostrar pulse una tecla');
readkey;
end;
readkey;
end;
procedure entrada_pedido;
var
pulsa : char;
no, fin : boolean;
y, nume : integer;
begin
cont := cont + 1;
prod := 1;
fin := false;
writeln;
write(' Entre Numero Del Pedido : ');
readln(nume);
no := false;
for y := 1 to cont do
if cliente[y].npedido = nume then
no := true;
if no = false then
begin
cliente[cont].npedido := nume;
cliente[cont].producto[prod].limite := false;
repeat
clrscr;
writeln(' Entrada Pedido N. ',nume,' Producto N ',prod);
writeln;
write(' Nombre Del Producto : ');
readln(cliente[cont].producto[prod].product);
write(' Cantidad En Kls : ');
readln(cliente[cont].producto[prod].cantida);
write(' Precio Por Kl : ');
readln(cliente[cont].producto[prod].precio);
prod := prod + 1;
if prod > max then
begin
cliente[cont].producto[prod].limite := true;
writeln(' Tomados Limite De Productos');
writeln(' Pulse Una Tecla');
readkey;
fin := true;
cliente[cont].pro := max;
end
else
begin
writeln(' Desea Entrar Mas productos [S/N]');
repeat
pulsa := upcase(readkey);
until pulsa in['S','N'];
if pulsa = 'N' then
begin
cliente[cont].pro := prod;
fin := true;
end;
end;
until fin = true;
end
else
begin
writeln(' El numero De Pedido Ya Existe Pulse Una Tecla');
readkey;
end;
end;
procedure reporte;
begin
if cont > 0 then
begin
genera_factura(1);
end;
end;
procedure Menu;
var
sal : boolean;
tecla : char;
begin
sal := false;
cont := 0;
repeat
clrscr;
writeln;
writeln(' **** Menu Jeneral ****');
writeln;
writeln(' [G] = generar factura');
writeln(' [T] = totales acumulados');
writeln(' [S] = salir');
writeln;
writeln(' <<< Elija Opcion >>>');
repeat
tecla := upcase(readkey);
until tecla in['G','T','S'];
clrscr;
case tecla of
'G' : entrada_pedido;
'T' : reporte;
'S' : sal := true;
end;
until sal = true;
end;
begin
menu;
end.
Program MENU;
Uses crt;
const
Des=0.15;
Dess=0.20;
Iva=0.12;
Var
Opc, I:integer;
pre,can,s,np:integer;
t,a,b:real;
Begin
clrscr;
for I:=1 to 2 do
begin
textcolor(9);gotoxy(50,24);write('CARGA DE PRUEBA');
textcolor(15);
sound(i*200);
gotoxy(35,12);write('CARGANDO. ');delay(200);
gotoxy(35,12);write('CARGANDO.. ');delay(200);
gotoxy(35,12);write('CARGANDO... ');delay(200);
gotoxy(35,12);write('CARGANDO.... ');delay(200);
gotoxy(35,12);write('CARGANDO..... ');delay(200);
gotoxy(35,12);write('CARGANDO...... ');delay(200);
gotoxy(35,12);write('CARGANDO....... ');delay(200);
gotoxy(35,12);write('CARGANDO........ ');delay(200);
nosound;
end;
repeat
clrscr;
textcolor(15);
gotoxy(5,5); writeln('********************** SUPER MERCADO "SI HAY" *****************');
gotoxy(12,8); writeln('Generar Factura ............ 1');
gotoxy(12,9); writeln('Generar Totales............ 2');
gotoxy(12,10); writeln('SALIR ............ 3');
gotoxy(5,17); writeln('*****************************************************');
writeln();
gotoxy(12,20); writeln('Ingrese la opcion que desea ejecutar.....');
readln (Opc);
if ((Opc>=1) and (Opc<=3))then
Begin
Case(Opc)of
1:begin
clrscr;
np:=0;
a:=0;
t:=0;
b:=0;
repeat
np:=np+1;
begin
writeln ('ingrese precio base');
readln (pre);
writeln ('ingrese cantidad de productos');
readln (can);
t:=(pre*can);
if (can>=12) or (can<=18) then
begin
a:=(1-Des)*t;
end;
if (can>=19) or (can<24) then
begin
b:=(1-Dess)*t;
end;
clrscr;
gotoxy(5,2);writeln ('______________________________________________________________');
gotoxy(5,3);writeln ('| Numero | Precio| Cantidad | Descuento| Total | Total |');
gotoxy(5,4);writeln ('|Producto | Base | Productos | | | +IVA |');
gotoxy(5,5);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,6);writeln ('| | | | | | |');
gotoxy(5,7);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,8);writeln ('| | | | | | |');
gotoxy(5,9);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,10);writeln ('| | | | | | |');
gotoxy(5,11);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,12);writeln ('| | | | | | |');
gotoxy(5,13);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,14);writeln ('| | | | | | |');
gotoxy(5,15);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,16);writeln ('|Totales | | | | | |');
gotoxy(5,17);writeln ('|_________|________|____________|__________|________|________|');
gotoxy(10,6);writeln(np);gotoxy(19,6); writeln (pre);gotoxy(29,6); writeln (can);
gotoxy(47,6);writeln (t:8:0); gotoxy (48,6); writeln (a:8:1); gotoxy (48,6); writeln (b:8:1);
readkey;
clrscr;
writeln('desea agregar otro producto? Si=1 No=2');
readln (s);
if ((s<1) or (s>2)) then
begin
writeln ('Opcion Invalida');
end;
end;
until s=2;
readkey;
end;
2: begin
clrscr;
writeln ('SEGUNDO PROGRAMA');
readkey;
end;
end;
end
else
writeln ('OPCION ERRADA, REPITA NUEVAMENTE');
readkey;
until Opc=3;
End.
{Mira arreglado un poco pero ten en cuenta que cada vez que entres datos de compra los anteriores se anulan
solo quedan en pantalla.
para que pase linea tienes que crear una variable de paso por ejemplo .
paso : integer;
y incrementarla por cada entrada que realices en 2
y el goto pasaría a ser gotoxy(x,5 + paso);write();}
Program MENU;
Uses crt;
const
Des=15;
Dess=20;
Iva=12;
Var
Opc, I:integer;
pre,can,s,np:integer;
iv, t,a,b:real;
Begin
clrscr;
for I:=1 to 2 do
begin
textcolor(9);gotoxy(50,24);write('CARGA DE PRUEBA');
textcolor(15);
sound(i*200);
gotoxy(35,12);write('CARGANDO. ');delay(200);
gotoxy(35,12);write('CARGANDO.. ');delay(200);
gotoxy(35,12);write('CARGANDO... ');delay(200);
gotoxy(35,12);write('CARGANDO.... ');delay(200);
gotoxy(35,12);write('CARGANDO..... ');delay(200);
gotoxy(35,12);write('CARGANDO...... ');delay(200);
gotoxy(35,12);write('CARGANDO....... ');delay(200);
gotoxy(35,12);write('CARGANDO........ ');delay(200);
nosound;
end;
repeat
clrscr;
textcolor(15);
gotoxy(5,5); writeln('********************** SUPER MERCADO "SI HAY" *****************');
gotoxy(12,8); writeln('Generar Factura ............ 1');
gotoxy(12,9); writeln('Generar Totales............ 2');
gotoxy(12,10); writeln('SALIR ............ 3');
gotoxy(5,17); writeln('*****************************************************');
writeln;
gotoxy(12,20); writeln('Ingrese la opcion que desea ejecutar.....');
readln (Opc);
if ((Opc>=1) and (Opc<=3))then
Begin
Case(Opc)of
1:begin
clrscr;
np:=0;
a:=0;
t:=0;
b:=0;
repeat
np:=np+1;
begin
writeln ('ingrese precio base');
readln (pre);
writeln ('ingrese cantidad de productos');
readln (can);
t:=(pre*can);
if (can>=12) or (can<=18) then
begin
a:=(t*Des)/100;
end;
if (can>=19) or (can<24) then
begin
b:=(t*Dess)/100;
end;
iv := t * iva / 100;
clrscr;
gotoxy(5,2);writeln ('________________________________________________________________________');
gotoxy(5,3);writeln ('| Numero | Precio | Cantidad | Descuent | Total | Total |');
gotoxy(5,4);writeln ('|Producto | Base | Productos | | | +IVA |');
gotoxy(5,5);writeln ('|---------|--------|------------|----------|--------------|-------------|');
gotoxy(5,6);writeln ('| | | | | | |');
gotoxy(5,7);writeln ('|---------|--------|------------|----------|--------------|-------------|');
gotoxy(5,8);writeln ('| | | | | | |');
gotoxy(5,9);writeln ('|---------|--------|------------|----------|--------------|-------------|');
gotoxy(5,10);writeln('| | | | | | |');
gotoxy(5,11);writeln('|---------|--------|------------|----------|--------------|-------------|');
gotoxy(5,12);writeln('| | | | | | |');
gotoxy(5,13);writeln('|---------|--------|------------|----------|--------------|-------------|');
gotoxy(5,14);writeln('| | | | | | |');
gotoxy(5,15);writeln('|---------|--------|------------|----------|--------------|-------------|');
gotoxy(5,16);writeln('|Totales | | | | | |');
gotoxy(5,17);writeln('|_________|________|____________|__________|______________|_____________|');
gotoxy(10,6);write(np);gotoxy(19,6); write(pre);gotoxy(29,6); write(can);
gotoxy(39,6);write(t:0:2); gotoxy(50,6);write(t:0:2);
if (can>=19) or (can<24) then
begin
gotoxy(39,6);write(b:0:2);
gotoxy(66,6); write(t + iv:0:2);
end;
if (can>=12) or (can<=18) then
begin
gotoxy(39,6);write(a:0:2);
gotoxy(66,6); write(t + iv:0:2);
end;
gotoxy(51,16);write(t:0:2);
gotoxy(66,16);write(t + iv :0:2);
readkey;
clrscr;
writeln('desea agregar otro producto? Si=1 No=2');
readln (s);
if ((s<1) or (s>2)) then
begin
writeln ('Opcion Invalida');
end;
end;
until s=2;
readkey;
end;
2: begin
clrscr;
writeln ('SEGUNDO PROGRAMA');
readkey;
end;
end;
end
else
writeln ('OPCION ERRADA, REPITA NUEVAMENTE');
readkey;
until Opc=3;
End.
Program MENU;
//Creado por:Junior Alberto Perez Garcia.
Uses crt;
const
Des=0.15;
Dess=0.20;
Iva=0.12;
Var
Opcc:integer;
Opc, I:integer;
pre,can,np,lugar:integer;
tto,t,ttoo,tot,tal,total:real;
Begin
clrscr;
for I:=1 to 2 do
begin
sound(i*200);
gotoxy(35,12);write('CARGANDO. ');delay(200);
gotoxy(35,12);write('CARGANDO.. ');delay(200);
gotoxy(35,12);write('CARGANDO... ');delay(200);
gotoxy(35,12);write('CARGANDO.... ');delay(200);
gotoxy(35,12);write('CARGANDO..... ');delay(200);
gotoxy(35,12);write('CARGANDO...... ');delay(200);
gotoxy(35,12);write('CARGANDO....... ');delay(200);
gotoxy(35,12);write('CARGANDO........ ');delay(200);
nosound;
end;
repeat
clrscr;
textcolor(15);
gotoxy(5,5); writeln('********************** SUPER MERCADO "SI HAY" *****************');
gotoxy(12,8);writeln('Generar Factura ............ 1');
gotoxy(12,9);writeln('Generar Totales............ 2');
gotoxy(12,10);writeln('SALIR ............ 3');
gotoxy(5,17); writeln('*****************************************************');
writeln();
gotoxy(12,20); writeln('Ingrese la opcion que desea ejecutar.....');
readln (Opc);
if ((Opc>=1) and (Opc<=3))then
Begin
Case(Opc)of
1:begin
np:=0;
lugar:=-1;
repeat
np:=np+1;
lugar:=lugar+1;
textcolor (3);
gotoxy(5,2);writeln ('______________________________________________________________');
gotoxy(5,3);writeln ('| Numero | Precio| Cantidad | Descuento| Total | Total |');
gotoxy(5,4);writeln ('|Producto | Base | Productos | | | +IVA |');
gotoxy(5,5);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,6);writeln ('| | | | | | |');
gotoxy(5,7);writeln ('| | | | | | |');
gotoxy(5,8);writeln ('| | | | | | |');
gotoxy(5,9);writeln ('| | | | | | |');
gotoxy(5,10);writeln ('| | | | | | |');
gotoxy(5,11);writeln ('| | | | | | |');
gotoxy(5,12);writeln ('| | | | | | |');
gotoxy(5,13);writeln ('| | | | | | |');
gotoxy(5,14);writeln ('| | | | | | |');
gotoxy(5,15);writeln ('|---------|--------|------------|----------|--------|--------|');
gotoxy(5,16);writeln ('|Totales | | | | | |');
gotoxy(5,17);writeln ('|_________|________|____________|__________|________|________|');
gotoxy(7,6+lugar);writeln(np);
//gotoxy(19,6+lugar); writeln (pre);
//gotoxy(29,6+lugar); writeln (can);
//writeln ('Ingrese Precio Base');
gotoxy(17,6+lugar); readln (pre);
//writeln ('Ingrese Cantidad De Productos');
gotoxy(26,6+lugar); readln (can);
t:=(pre*can);
if ((can>=1) and (can<12)) then
t:=can*pre;
tto:=(1+Iva)*t;
gotoxy(47,6+lugar);writeln (t:8:0);
gotoxy (43,6+lugar); writeln (0);
gotoxy (58,6+lugar); writeln (tto:8:1);
if ((can>=12) and (can<=18)) then
t:=can*pre;
ttoo:=(1-Des)*t;
tot:=(1+Iva)*ttoo;
gotoxy(47,6+lugar);writeln (ttoo:8:0);
gotoxy (37,6+lugar); writeln (Des:8:2);
gotoxy (58,6+lugar); writeln (tot:8:2);
if ((can>=19) and (can<=24)) then
t:=can*pre;
tal:=(1-Dess)*t;
total:=(1+Iva)*tal;
gotoxy(47,6+lugar);writeln (tal:8:0);
gotoxy (37,6+lugar); writeln (Dess:8:2);
gotoxy (58,6+lugar); writeln (total:8:2);
readkey;
textcolor (7);
gotoxy(15,22); writeln('desea agregar otro producto? Si=1 o No=2');
readln (Opcc);
if (Opcc<=0) or (Opcc>2) then
begin
writeln ('Opcion Invalida');
end;
until (Opcc=2);
end;
2: begin
clrscr;
writeln ('SEGUNDO PROGRAMA');
readkey;
end;
end;
end
else
writeln ('OPCION ERRADA, REPITA NUEVAMENTE');
readkey;
until Opc=3;
End.