Here's my OLD turbo pascal program for your reference
USES CRT;
const maxunit=6;
type
dif_unit=record
unitnum:string[7];
buyer,name:string[20];
datearrive,datesold:STRING[14];
chasisnum:string[10];
enginenum:string[10];
remark:string[7];
tcost:real;
deduct:real;
price:real;
end;
unitarray=array[1..maxunit] of dif_unit;
var
unitrec:unitarray;
ans:char;
xn,recnum:integer;
procedure table;
begin
gotoxy(1,12);writeln('ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿');
gotoxy(1,13);writeln('³ ³');
gotoxy(1,14);writeln('³ ³');
gotoxy(1,15);writeln('³ ³');
gotoxy(1,16);writeln('³ ³');
gotoxy(1,17);writeln('³ ³');
gotoxy(1,18);writeln('³ ³');
gotoxy(1,19);writeln('³ ³');
gotoxy(1,20);writeln('³ ³');
gotoxy(1,21);writeln('³ ³');
gotoxy(1,22);writeln('³ ³');
gotoxy(1,23);writeln('ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ');
end;
procedure chair;
begin
gotoxy(14,13);writeln('UNIT CODE:');
gotoxy(12,14);writeln('DATE ARRIVE:');
gotoxy(04,16);writeln('UNIT NAME AND MODEL:');
gotoxy(05,17);writeln('UNIT CHASIS NUMBER:');
gotoxy(05,18);writeln('UNIT ENGINE NUMBER:');
gotoxy(13,20);writeln('UNIT PRICE:');
end;
procedure z;
VAR e:integer;
begin
for e:=1 to maxunit do
begin
unitrec[e].unitnum:='';
unitrec[e].name:='';
unitrec[e].datearrive:='';
unitrec[e].datesold:='';
unitrec[e].chasisnum:='';
unitrec[e].enginenum:='';
unitrec[e].tcost:=0;
unitrec[e].deduct:=0;
unitrec[e].remark:='';
unitrec[e].price:=0;
end;
end;
procedure unitadd;
label u,j,k,l,h;
var
xn,e:integer;
xunitnum:string;
y,t,r:BOOLEAN;
function g:boolean;
begin
if unitrec[xn].unitnum='' then
g:=true
else
g:=false;
end;
function s:boolean;
begin
if xunitnum = unitrec[e].unitnum then
s:=true
else
s:=false;
end;
begin
if (recnum=maxunit-1) then
begin
gotoxy(50,11);writeln('<*> UNIT FULL, NOT ACCEPTED <*>');
gotoxy(50,11);ans:=readkey;exit;
end;
table;
chair;
gotoxy(54,4);textcolor(15+16);textbackground(0);writeln('1');normvideo;
gotoxy(25,13);readln(xunitnum);
if (xunitnum='') then exit;
e:=1;
repeat
t:=s;
INC(e);
until (t=true) or (e>=maxunit);
if t = true then
begin
gotoxy(58,13);textcolor(15);textbackground(0);
writeln('RECORD ALREADY EXIST');normvideo;
gotoxy(78,14);ans:=readkey;
exit;
end
else
begin
xn:=1;
repeat
y:=g;
inc(xn);
until (y=true);
IF (y=true) then
begin
unitrec[xn-1].unitnum:=xunitnum;
unitrec[xn-1].remark:='UNSOLD';
u:gotoxy(25,14); readln(unitrec[xn-1].datearrive);
if (unitrec[xn-1].datearrive)='' then
begin unitrec[xn-1].datearrive:='';goto u;end;
j:GOTOXY(25,16); readln(unitrec[xn-1].name);
if (unitrec[xn-1].name)='' then
begin unitrec[xn-1].name:='';goto j;end;
k:GOTOXY(25,17); readln(unitrec[xn-1].chasisnum);
if (unitrec[xn-1].chasisnum)='' then
begin unitrec[xn-1].chasisnum:='';goto k;end;
l:GOTOXY(25,18); readln(unitrec[xn-1].enginenum);
if (unitrec[xn-1].enginenum)='' then
begin unitrec[xn-1].enginenum:='';goto l;end;
h:r:=false;
while not r do
begin
gotoxy(25,20);writeln(' ');
gotoxy(25,20);
{$i-}readln(unitrec[xn-1].price);{$I+}
r:=(ioresult=0);
if (not r) then begin writeln(^G);goto h;end else end;
end;
gotoxy(25,20);writeln(unitrec[xn-1].price:7:2);
repeat
gotoxy(60,13);writeln('ADD RECORD ! (Y/N)');
gotoxy(71,13);textcolor(15+16);textbackground(0);writeln('N');normvideo;
gotoxy(71,13);ans:=readkey;
if upcase(ans)<>'Y' then
begin
unitrec[xn-1].unitnum:='';
unitrec[xn-1].name:=' ';
unitrec[xn-1].datearrive:=' ';
unitrec[xn-1].chasisnum:=' ';
unitrec[xn-1].enginenum:=' ';
unitrec[xn-1].remark:=' ';
unitrec[xn-1].price:=0;
dec(xn);
exit;
end;
until upcase(ans)='Y';
end;
inc(recnum);
end;
procedure unitsold;
label u,m,n;
var
e:integer;
xunitnum:string[7];
v,r:boolean;
function wo:boolean;
begin
if xunitnum = unitrec[e].unitnum then
wo:=true
else
wo:=false;
end;
function w:boolean;
begin
if xunitnum = unitrec[e].unitnum then
if unitrec[e].remark<>'SOLD' then
w:=true
else
w:=false;
end;
begin
table;
chair;
gotoxy(54,5);textcolor(15+16);textbackground(0);writeln('2');normvideo;
gotoxy(25,13);readln(xunitnum);
if (xunitnum)='' then exit;
e:=1;
repeat
v:=w;
inc(e);
until (v=true) or (e>=maxunit);
if (v=true) then
begin
gotoxy(25,14);writeln(unitrec[e-1].datearrive);
gotoxy(25,16);writeln(unitrec[e-1].name);
gotoxy(25,17);writeln(unitrec[e-1].chasisnum);
gotoxy(25,18);writeln(unitrec[e-1].enginenum);
gotoxy(25,20);writeln(unitrec[e-1].price:7:2);
gotoxy(59,22);writeln('REMARK: ',unitrec[e-1].REMARK);
end
else
begin
if v=wo then
begin
gotoxy(12,4);textcolor(15);textbackground(0);
gotoxy(58,13);writeln('<-<-< UNIT SOLD >->->');normvideo;
gotoxy(78,14);ans:=readkey;exit;
end
else
begin
gotoxy(12,4);textcolor(15);textbackground(0);
gotoxy(55,13);writeln('>-> RECORD NOT EXIST <-<');normvideo;
gotoxy(78,14);ans:=readkey;exit;
end;
end;
repeat
gotoxy(54,13);writeln('Considered sold ? (Y/N)');
textcolor(15+16);textbackground(0);gotoxy(70,13);writeln('N');normvideo;
gotoxy(70,13);ans:=readkey;
if upcase(ans)<>'Y' then exit;
until upcase(ans)='Y';
gotoxy(12,14);writeln('DATE ARRIVE: ',unitrec[e-1].datearrive);
gotoxy(12,15);writeln(' DATE SOLD: ');
u:gotoxy(25,15); readln(unitrec[e-1].datesold);
if (unitrec[e-1].datesold)='' then
begin unitrec[e-1].datesold:='';
gotoxy(25,15);writeln(' ');
goto u;end;
gotoxy(7,19);writeln('UNIT BUYERS NAME:');
m:GOTOXY(25,19); readln(unitrec[e-1].buyer);
if (unitrec[e-1].buyer)='' then
begin unitrec[e-1].buyer:='';
gotoxy(25,19);writeln(' ');
goto m;end;
gotoxy(14,21);writeln('DEDUCTION:');
n:r:=false;
while not r do
begin
gotoxy(25,21);writeln(' ');
gotoxy(25,21);
{$i-}readln(unitrec[e-1].deduct);{$I+}
r:=(ioresult=0);
if (not r) then begin writeln(^G);goto n;end else end;
unitrec[e-1].remark:='SOLD';
unitrec[e-1].Tcost:=unitrec[e-1].price-unitrec[e-1].deduct;
gotoxy(11,22);writeln('TOTAL PRICE:');
gotoxy(25,22);writeln(unitrec[e-1].tcost:7:2);
gotoxy(25,21);writeln(' ');
gotoxy(25,21);writeln(unitrec[e-1].deduct:7:2);
textcolor(15+16);textbackground(0);gotoxy(70,13);writeln('Y');normvideo;
gotoxy(59,22);writeln('REMARK: ',unitrec[e-1].REMARK,' ');
gotoxy(70,13);ans:=readkey;
end;
procedure edit;
label p,u,j,k,l,h,m,n,f,c,y,o;
var
xn,e:integer;
xunitnum:string[7];
v,r:boolean;
function s:boolean;
begin
if xunitnum = unitrec[e].unitnum then
s:=true
else
s:=false;
end;
begin
table;
chair;
gotoxy(54,6);textcolor(15+16);textbackground(0);writeln('3');normvideo;
gotoxy(25,13);readln(xunitnum);
if (xunitnum)='' then exit;
e:=1;
repeat
v:=s;
inc(e);
until (v=true) or (e>=maxunit);
if (v=true) then
begin
gotoxy(7,19);writeln('UNIT BUYERS NAME:');
gotoxy(14,21);writeln('DEDUCTION:');
gotoxy(8,22);writeln('TOTAL UNIT COST:');
gotoxy(12,14);writeln('DATE ARRIVE: ');
gotoxy(25,14);writeln(unitrec[e-1].datearrive);