Category : Pascal Source Code
Archive   : GSDB21.ZIP
Filename : DB_XPL13.PAS

 
Output of file : DB_XPL13.PAS contained in archive : GSDB21.ZIP

program DB_Xpl13;
uses
CRT,
DOS,
GS_KeyI,
GS_dBFld,
GS_dBase;

var
Health : GS_dBFld_Objt;
DumyStr : string;

procedure ShowTheMemo;
var
i,
ml : integer;

begin
Health.MemoGet(Health.FieldGet('COMMENTS'));
ml := Health.MemoLines;
ClrScr;
if ml <> 0 then
for i := 1 to ml do
writeln(Health.MemoGetLine(i))
else write('[ EMPTY ]');
end;


procedure DisplayRecord;
begin
Health.FieldDisplay('FOOD','Name of Food: ',1,1);
Health.FieldDisplay('QUANTITY','Quantity: ',1,2);
Health.FieldDisplay('UNITTYPE','Type of Unit: ',1,3);
Health.FieldDisplay('CALS','Calories: ',1,4);
Health.FieldDisplay('TOT_FAT_G','Total Fat: ',1,5);
Health.FieldDisplay('SAT_FAT_G','Saturated Fat: ',1,6);
gotoxy(1,7);
if Health.NumberGet('TOT_FAT_G') > 0.000 then
write('Percent of Saturated Fat to Total Fat is : ',
(Health.NumberGet('SAT_FAT_G')*100)/Health.NumberGet('TOT_FAT_G'):5:1)
else write('':79);
Health.FieldDisplay('CHOLES_MG','Cholesterol per Mg: ',1,8);
Health.FieldDisplay('COMMENTS','COMMENTS: ',1,9);
window(1,11,80,24);
ShowTheMemo;
window(1,1,80,25);
end;


begin
ClrScr;
GotoXY(1,25);
write('Press ESC to stop, any other key to continue');
Health.Init('HEALTH');
Health.Open;
Health.Index('FOODNAME');
Health.MemoWidth(75);
Health.GetRec(Top_Record);
while (not Health.File_EOF) and (not GS_KeyI_Esc) do
begin
DisplayRecord;
WaitForKey;
if GS_KeyI_Chr = Kbd_Esc then GS_KeyI_Esc := true;
Health.GetRec(Next_Record);
end;
Health.Close;
end.