home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG027.ARC
/
TTLIST.INC
< prev
next >
Wrap
Text File
|
1979-12-31
|
5KB
|
185 lines
OVERLAY PROCEDURE List(date : str14);
LABEL
escape;
VAR
i,l,k : INTEGER;
Bottom : INTEGER;
Ptr,Rec : INTEGER;
yes : integer;
LD : integer;
ch : CHAR;
bl : charset;
ear : str5;
Animal : Animal_rec;
yy,ww,dd : integer;
ok2 : boolean;
PROCEDURE Movecurs(ch : CHAR; VAR G : INTEGER);
VAR
old : INTEGER;
BEGIN
old := G;
CASE ch OF
^E : BEGIN
G := G -1;
IF g = 3
THEN g := bottom + 3;
END;
^X : BEGIN
G := G + 1;
IF g = bottom + 4
THEN g := 4;
END;
^Q : G := 4;
END; {Case of ch}
dis(1,old,' ');
dis(1,G,'->');
END;
BEGIN
rec := 1;
line(1);
dis(1,2,'LIST NAME EAR NUMBER SEX AGE');
ClrEOL;
Display_Recs_Used;
line(16);
l := 4;
ClearKey(EarIndexFile);
ClearKey(NameIndexFile);
LD := FileLen(DatF) - 1;
repeat
ear := '';
dis(1,5,'Press RETURN to LIST ALL or type Starting Ear No. _____');
InputStr(ear,5,50,4,[^M,^Z,^X,^E],ch);
if ear <> '' then
begin
ear := UpCaseStr(ear);
fillup(ear);
FindKey(EarIndexFile,Ptr,Ear);
if (Not ok) then
begin
writeln;
writeln('Ear Number Not Found');
end;
end;
until ok or (ear = '');
if ear = '' then ear := '!!!!!';
ClearFrame;
Bottom := 0;
dis(1,17,
' | | | | | | S = Screen | P = Printer | <ESC> = MAIN MENU |');
BL := ['P','S',#27,^M];
select(75,17,' ',BL,Ch);
if ch = #27 then goto escape;
if ch = 'P' then
begin
writeln(lst);
writeln(lst,' LIST of Animals on the ',date_Today);
writeln(lst,' Name Ear No Sex Sire Dam Birth Death');
writeln(lst);
repeat
NextKey(EarIndexFile,Ptr,ear);
GetRec(DatF,Ptr,Animal);
with Animal do
begin
write(lst,name,' ':20 -(length(name)),ear_no,sex:4,sire:7,dam:7);
writeln(lst,date_born:14,date_died:14);
end;
l := l + 1;
if l = 57 then
begin
write('Press RETURN to continue.':50);
readln;
writeln(lst);
writeln(lst,' LIST of Animals on the ',date_Today);
writeln(lst,' Name Ear No Sex Sire Dam Birth Death');
writeln(lst);
l := 4;
end;
until (not ok);
writeln(lst);
end;
l := 4;
rec := 0;
FindKey(EarIndexFile,Ptr,Ear);
PrevKey(EarIndexFile,Ptr,Ear);
REPEAT
IF (UsedRecs(DatF) <= 12) THEN
BEGIN
dis(1,17,
' | | | | | | | | <ESC> = MAIN MENU');
bl := [#27,^E,^X,^Q,'1','2','3','4','5','6'];
END;
IF (rec <= 12) AND (UsedRecs(DatF) > 12) THEN
BEGIN
dis(1,17,
' | | | | | | | N = Next screen | <ESC> = MAIN MENU');
bl := ['N',#27,^E,^X,^Q,'1','2','3','4','5','6'];
END;
IF (rec > 12) THEN
BEGIN
dis(1,17,
' | | | | | | B = Back | N = Next screen | <ESC> = MAIN MENU');
bl := ['B','N',#27,^E,^X,^Q,'1','2','3','4','5','6'];
END;
NextKey(EarIndexFile,Ptr,ear);
GetRec(DatF,Ptr,Animal);
Bottom := Bottom + 1;
rec := rec + 1;
list_table[bottom ] := Animal;
WITH Animal DO
BEGIN
dis(4,L,name);
dis(30,L,Ear_no);
dis(45,L,sex);
yy := 0;
ww := 0;
dd := 0;
verify_date(Date_Born,ok2);
if ok2 then
begin
verify_date(Date_Died,ok2);
if ok2 then age(Date_Born,Date_Died,yy,ww,dd)
else age(Date_Born,Date,yy,ww,dd);
gotoxy(50,L);
if yy > 0 then write(YY:2,' Years',ww:3,' Weeks',dd:3,' Days')
else write(ww:2,' Weeks',dd:3,' Days');
end;
END;
L := L + 1;
IF (l = 16) or (Rec = LD) then
BEGIN
i := 4;
f_table;
REPEAT
movecurs(ch,i);
select(74,17,' ',BL,Ch);
IF ch = #27 THEN goto escape;
k := 0;
val(ch,k,yes);
IF k IN [1..6]
THEN
Animals_table(k,list_table[i-3]);
UNTIL (ch = 'N') OR (ch = 'B');
IF ch = 'B'
THEN
BEGIN
rec := rec - (12 + bottom);
for i := 1 to 12 + bottom do
PrevKey(EarIndexFile,Ptr,Ear);
IF rec < 1
THEN Rec := 1;
END;
if rec = UsedRecs(DatF) then rec := 1;
Ptr := Rec;
Bottom := 0;
ClearFrame;
l := 4;
END;
UNTIL (ch = #27);
escape:
END;