i am trying to program a project in pascal and i have hit a problem
the first one is that i am able to search for the client and i am able to display the content but when i want to display them again i cant seem to be able to do that.
the second problem is that i am able to do split screen (procedure left and right) but i cant seem to be able to get the normal screen after the procedures have been used. when i exit to main menu the screen is still split.
the listng:
program one;
uses
crt;
type
string3 = string[3];
string4 = string[4];
string5 = string[5];
string9 = string[9];
string10 = string[10];
string12 = string[12];
string13 = string[13];
string20 = string[20];
string25 = string[25];
string30 = string[30];
string40 = string[40];
string80 = string[80];
string100 = string[100];
string255 = string[255];
crec = record
cref : string4;
ctitle : string4;
csurname : string30;
cfname : string25;
caddress : string40;
cpcode : string9;
cpartnership : string3;
cshare : string5;
ctitle2 : string4;
csurname2 : string30;
cfname2 : string25;
caddress2 : string40;
cpcode2 : string9;
cpartnership2 : string3;
cshare2 : string5;
cbname : string20;
cbaddress : string40;
cbpcode : string9;
cbtel : string13;
cbfax : string13;
ccomment : string100;
end;
prec = record
pref : string5;
pcref : string4;
pdate : string10;
pcharges : string255;
end;
urec = record
uref : string5;
ucref : string4;
udate : string10;
ucharges : string255;
end;
const
space = ' ';
vatno = '250 376 825';
var
clientrec : crec;
clientfile : file of crec;
paidrec : prec;
paidfile : file of prec;
unpaidrec : urec;
unpaidfile : file of urec;
clientref2 : string;
surname : string;
title : string;
businessname : string;
businessaddress : string;
businesspcode : string;
mainselect : char;
adminselect : char;
madminselect : char;
customerselect : char;
queryselect : char;
numc : integer;
clientref : array[0..10] of string4;
clienttitle : array[0..10] of string4;
clientsurname : array[0..10] of string30;
clientfname : array[0..10] of string25;
clientaddress : array[0..10] of string40;
clientpcode : array[0..10] of string9;
clientpartnership : array[0..10] of string3;
clientshare : array[0..10] of string5;
clienttitle2 : array[0..10] of string4;
clientsurname2 : array[0..10] of string30;
clientfname2 : array[0..10] of string25;
clientaddress2 : array[0..10] of string40;
clientpcode2 : array[0..10] of string9;
clientpartnership2 : array[0..10] of string3;
clientshare2 : array[0..10] of string5;
clientbname : array[0..10] of string20;
clientbaddress : array[0..10] of string40;
clientbpcode : array[0..10] of string9;
clientbtel : array[0..10] of string13;
clientbfax : array[0..10] of string13;
clientcomment : array[0..10] of string100;
nump : integer;
paidref : array[0..10] of string5;
paidcref : array[0..10] of string4;
paiddate : array[0..10] of string10;
paidcharges : array[0..10] of string255;
numu : integer;
unpaidref : array[0..10] of string5;
unpaidcref : array[0..10] of string4;
unpaiddate : array[0..10] of string10;
unpaidcharges : array[0..10] of string255;
procedure left;
begin
window(1,11,60,50);
textbackground(green);
textcolor(white);
end;
procedure right;
begin
window(61,11,79,50);
textbackground(red);
textcolor(white);
end;
procedure createinvoice;
var
client : string;
top,bottom,mid : integer;
confirm : char;
amendment : string;
fig1 : string;
fig2 : string;
fig3 : string;
fig4 : string;
t1 : string;
t2 : string;
t3 : string;
t4 : string;
h1 : string;
h2 : string;
h3 : string;
h4 : string;
total: string;
if1 : integer;
if2 : integer;
if3 : integer;
if4 : integer;
it1 : integer;
it2 : integer;
it3 : integer;
it4 : integer;
ih1 : integer;
ih2 : integer;
ih3 : integer;
ih4 : integer;
check : integer;
xleft,yleft : integer;
xright,yright : integer;
begin
textbackground(blue);
clrscr;
textcolor(white);
writeln;
writeln;
writeln;
writeln(space:25,' SEARCH FOR CLIENT''S DETAILS');
writeln;
writeln(space:25,'=================');
writeln;
writeln;
write(space:10,'Enter reference number of client to produce invoice : ');
readln(client);
top := numc;
bottom := 0;
repeat
mid := trunc((top+bottom)/2);
if client < clientref[mid] then
top := mid - 1;
if client > clientref[mid] then
bottom := mid + 1;
until (client = clientref[mid]) or (top < bottom);
if client = clientref[mid] then
begin
writeln;
writeln(space:10,'Client details');
writeln(space:10,'==============');
writeln;
writeln(space:10,clientref[mid]);
writeln(space:10,clienttitle[mid]);
writeln(space:10,clientsurname[mid]);
writeln(space:10,clientfname[mid]);
writeln(space:10,clientaddress[mid]);
writeln(space:10,clientpcode[mid]);
writeln(space:10,clientpartnership[mid]);
writeln(space:10,clientshare[mid]);
writeln(space:10,clienttitle2[mid]);
writeln(space:10,clientsurname2[mid]);
writeln(space:10,clientfname2[mid]);
writeln(space:10,clientaddress2[mid]);
writeln(space:10,clientpcode2[mid]);
writeln(space:10,clientpartnership2[mid]);
writeln(space:10,clientshare2[mid]);
writeln(space:10,clientbname[mid]);
writeln(space:10,clientbaddress[mid]);
writeln(space:10,clientbpcode[mid]);
writeln(space:10,clientbtel[mid]);
writeln(space:10,clientbfax[mid]);
writeln(space:10,clientcomment[mid]);
i am able to display the stuff here but i cant further down.
writeln;
repeat
write(space:4,'Please confirm if you wish to create an invoice for this client Y/N : ');
confirm := readkey;
until (confirm='Y') or (confirm='y') or (confirm='N') or (confirm='n');
if (confirm='Y') or (confirm='y') then
begin
textbackground(blue);
textcolor(white);
clrscr;
writeln;
writeln(space:6,clientbname[mid]);
writeln(space:6,clienttitle[mid],' ',);
writeln(space:6,clientbaddress[mid]);
writeln(space:6,clientbpcode[mid]);
writeln;
writeln(space:6,'PLEASE ENTER THE HOURLY RATE AND NUMBER OF HOURS SPENT ON SERVICES');
writeln;
writeln(space:6,'Service provided Rate per hour Hours spent ');
writeln(space:6,'---------------- ------------- ----------- ');
writeln(space:46,' (œ) ');
left;
writeln;
writeln;
write(space:6,'1. Bookkeeping : ');
readln(h1);
xleft := wherex;
yleft := wherey;
right;
writeln;
writeln;
write(space:2,' : ');
readln(t1);
xright := wherex;
yright := wherey;
val(h1,ih1,check);
val(t1,it1,check);
if1 := it1 * ih1;
str(if1,fig1);
left;
gotoxy(xleft,yleft);
writeln;writeln;
writeln(space:6,'The value is : ',fig1);
readln;
i want to be able to go to normal screen here
end;
end
else
begin
writeln(chr(7));
textbackground(red);
clrscr;
textcolor(white+blink);
gotoxy(17,12);
writeln('NO SUCH MEMBER REF NUMBER EXISTS!');
gotoxy(17,15);
writeln('Please check the number again');
delay(1000)
end;
end;
the first one is that i am able to search for the client and i am able to display the content but when i want to display them again i cant seem to be able to do that.
the second problem is that i am able to do split screen (procedure left and right) but i cant seem to be able to get the normal screen after the procedures have been used. when i exit to main menu the screen is still split.
the listng:
program one;
uses
crt;
type
string3 = string[3];
string4 = string[4];
string5 = string[5];
string9 = string[9];
string10 = string[10];
string12 = string[12];
string13 = string[13];
string20 = string[20];
string25 = string[25];
string30 = string[30];
string40 = string[40];
string80 = string[80];
string100 = string[100];
string255 = string[255];
crec = record
cref : string4;
ctitle : string4;
csurname : string30;
cfname : string25;
caddress : string40;
cpcode : string9;
cpartnership : string3;
cshare : string5;
ctitle2 : string4;
csurname2 : string30;
cfname2 : string25;
caddress2 : string40;
cpcode2 : string9;
cpartnership2 : string3;
cshare2 : string5;
cbname : string20;
cbaddress : string40;
cbpcode : string9;
cbtel : string13;
cbfax : string13;
ccomment : string100;
end;
prec = record
pref : string5;
pcref : string4;
pdate : string10;
pcharges : string255;
end;
urec = record
uref : string5;
ucref : string4;
udate : string10;
ucharges : string255;
end;
const
space = ' ';
vatno = '250 376 825';
var
clientrec : crec;
clientfile : file of crec;
paidrec : prec;
paidfile : file of prec;
unpaidrec : urec;
unpaidfile : file of urec;
clientref2 : string;
surname : string;
title : string;
businessname : string;
businessaddress : string;
businesspcode : string;
mainselect : char;
adminselect : char;
madminselect : char;
customerselect : char;
queryselect : char;
numc : integer;
clientref : array[0..10] of string4;
clienttitle : array[0..10] of string4;
clientsurname : array[0..10] of string30;
clientfname : array[0..10] of string25;
clientaddress : array[0..10] of string40;
clientpcode : array[0..10] of string9;
clientpartnership : array[0..10] of string3;
clientshare : array[0..10] of string5;
clienttitle2 : array[0..10] of string4;
clientsurname2 : array[0..10] of string30;
clientfname2 : array[0..10] of string25;
clientaddress2 : array[0..10] of string40;
clientpcode2 : array[0..10] of string9;
clientpartnership2 : array[0..10] of string3;
clientshare2 : array[0..10] of string5;
clientbname : array[0..10] of string20;
clientbaddress : array[0..10] of string40;
clientbpcode : array[0..10] of string9;
clientbtel : array[0..10] of string13;
clientbfax : array[0..10] of string13;
clientcomment : array[0..10] of string100;
nump : integer;
paidref : array[0..10] of string5;
paidcref : array[0..10] of string4;
paiddate : array[0..10] of string10;
paidcharges : array[0..10] of string255;
numu : integer;
unpaidref : array[0..10] of string5;
unpaidcref : array[0..10] of string4;
unpaiddate : array[0..10] of string10;
unpaidcharges : array[0..10] of string255;
procedure left;
begin
window(1,11,60,50);
textbackground(green);
textcolor(white);
end;
procedure right;
begin
window(61,11,79,50);
textbackground(red);
textcolor(white);
end;
procedure createinvoice;
var
client : string;
top,bottom,mid : integer;
confirm : char;
amendment : string;
fig1 : string;
fig2 : string;
fig3 : string;
fig4 : string;
t1 : string;
t2 : string;
t3 : string;
t4 : string;
h1 : string;
h2 : string;
h3 : string;
h4 : string;
total: string;
if1 : integer;
if2 : integer;
if3 : integer;
if4 : integer;
it1 : integer;
it2 : integer;
it3 : integer;
it4 : integer;
ih1 : integer;
ih2 : integer;
ih3 : integer;
ih4 : integer;
check : integer;
xleft,yleft : integer;
xright,yright : integer;
begin
textbackground(blue);
clrscr;
textcolor(white);
writeln;
writeln;
writeln;
writeln(space:25,' SEARCH FOR CLIENT''S DETAILS');
writeln;
writeln(space:25,'=================');
writeln;
writeln;
write(space:10,'Enter reference number of client to produce invoice : ');
readln(client);
top := numc;
bottom := 0;
repeat
mid := trunc((top+bottom)/2);
if client < clientref[mid] then
top := mid - 1;
if client > clientref[mid] then
bottom := mid + 1;
until (client = clientref[mid]) or (top < bottom);
if client = clientref[mid] then
begin
writeln;
writeln(space:10,'Client details');
writeln(space:10,'==============');
writeln;
writeln(space:10,clientref[mid]);
writeln(space:10,clienttitle[mid]);
writeln(space:10,clientsurname[mid]);
writeln(space:10,clientfname[mid]);
writeln(space:10,clientaddress[mid]);
writeln(space:10,clientpcode[mid]);
writeln(space:10,clientpartnership[mid]);
writeln(space:10,clientshare[mid]);
writeln(space:10,clienttitle2[mid]);
writeln(space:10,clientsurname2[mid]);
writeln(space:10,clientfname2[mid]);
writeln(space:10,clientaddress2[mid]);
writeln(space:10,clientpcode2[mid]);
writeln(space:10,clientpartnership2[mid]);
writeln(space:10,clientshare2[mid]);
writeln(space:10,clientbname[mid]);
writeln(space:10,clientbaddress[mid]);
writeln(space:10,clientbpcode[mid]);
writeln(space:10,clientbtel[mid]);
writeln(space:10,clientbfax[mid]);
writeln(space:10,clientcomment[mid]);
i am able to display the stuff here but i cant further down.
writeln;
repeat
write(space:4,'Please confirm if you wish to create an invoice for this client Y/N : ');
confirm := readkey;
until (confirm='Y') or (confirm='y') or (confirm='N') or (confirm='n');
if (confirm='Y') or (confirm='y') then
begin
textbackground(blue);
textcolor(white);
clrscr;
writeln;
writeln(space:6,clientbname[mid]);
writeln(space:6,clienttitle[mid],' ',);
writeln(space:6,clientbaddress[mid]);
writeln(space:6,clientbpcode[mid]);
writeln;
writeln(space:6,'PLEASE ENTER THE HOURLY RATE AND NUMBER OF HOURS SPENT ON SERVICES');
writeln;
writeln(space:6,'Service provided Rate per hour Hours spent ');
writeln(space:6,'---------------- ------------- ----------- ');
writeln(space:46,' (œ) ');
left;
writeln;
writeln;
write(space:6,'1. Bookkeeping : ');
readln(h1);
xleft := wherex;
yleft := wherey;
right;
writeln;
writeln;
write(space:2,' : ');
readln(t1);
xright := wherex;
yright := wherey;
val(h1,ih1,check);
val(t1,it1,check);
if1 := it1 * ih1;
str(if1,fig1);
left;
gotoxy(xleft,yleft);
writeln;writeln;
writeln(space:6,'The value is : ',fig1);
readln;
i want to be able to go to normal screen here
end;
end
else
begin
writeln(chr(7));
textbackground(red);
clrscr;
textcolor(white+blink);
gotoxy(17,12);
writeln('NO SUCH MEMBER REF NUMBER EXISTS!');
gotoxy(17,15);
writeln('Please check the number again');
delay(1000)
end;
end;
Comment