Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : CANS_101.ZIP
Filename : REPORT8.PRG

 
Output of file : REPORT8.PRG contained in archive : CANS_101.ZIP
*---------------------------------------------------------------
*
* System Name: Beer Cans Inventory System
*
* Program: REPORT8.PRG
*
* Programmer: Eric L. Poole
* Date: 15 February 1988
*
* Purpose: To provide a simple query capability for users
* to search for a string of text data in any
* field of the data base and display or print
* the results of the search.
*
*---------------------------------------------------------------

set talk off

set color to w+/ ,gr+/r+
clear

* ---------- Display Search Banner.

set color to r+/b
@ 4,15 to 8,65 double

set color to bg+/
@ 6,26 say "SEARCH FOR DATA IN ANY FIELD"

* ---------- Wait for User to Read Banner.

@ 14,1 say " "
wait

do while .t.
clear

* ---------- Display Field Names Menu.

set color to gr+/
@ 2,34 say "SEARCH MENU"

set color to w+
@ 6,22 say "Fields are:"

set color to g+
@ 6,35 say "1. Brand Name"
@ 7,35 say "2. Brewery"
@ 8,35 say "3. Location"
@ 9,35 say "4. Size of Can"
@ 10,35 say "5. Type of Beverage"
@ 11,35 say "6. US or Foreign"
@ 12,35 say "7. Type of Can"
@ 13,35 say "8. Grade"

set color to bg+/gr+

@ 4,18 to 15,60 double
?

set color to w+

* ---------- Set Default Choice.

choice = 1

* ---------- Prompt for Choice.

@ 17,18 say "Enter Number (1-8) of field to search on? " get 
choice pict "9" range 1,8

read

* ---------- Determine Field Name Based on Number.

do case

case choice = 1
fld = "brand"
rpt = "report1.frm"
index on upper(brand) + str(size,5,1) to temp.ndx

case choice = 2
fld = "brewery"
rpt = "report2.frm"
index on upper(brewery) + upper(brand) + str(size,5,1) to 
temp.ndx

case choice = 3
fld = "location"
rpt = "report2a.frm"
index on upper(location) + upper(brewery) + upper(brand) + 
str(size,5,1) to temp.ndx

case choice = 4
fld = "str(size,5,1)"
rpt = "report6.frm"
index on str(size,5,1) + upper(brand) + upper(substr(type,2,3)) 
to temp.ndx

case choice = 5
fld = "bev"
rpt = "report4.frm"
index on upper(bev) + upper(brand) + str(size,5,1) to temp.ndx

case choice = 6
fld = "us_f"
rpt = "report7.frm"
index on upper(us_f) + upper(brand) + str(size,5,1) to temp.ndx

case choice = 7
fld ="type"
rpt = "report3.frm"
index on upper(substr(type,2,3)) + upper(brand) + 
str(size,5,1) to temp.ndx

case choice = 8
fld = "grade"
rpt = "report5.frm"
index on upper(grade) + upper(brand) + str(size,5,1) to temp.ndx

endcase

if choice = 4
?
accept "Look for what size? " to cond
?
else
?
accept "Look for what &fld? " to cond
?
endif

* ---------- Check for Display or Print.

accept "Send to Screen or Printer (S/p)? " to sp

if upper(sp) = "P"
set print on
endif

* ---------- Search and List Data if Found.

set color to g+
clear

if choice = 4
?
? "Searching for size = &cond"
?
else
?
? "Searching for &fld = &cond"
?
endif

set color to gr+
?
report form &rpt for upper("&cond") $ upper(&fld)

* ----------- End of Search.

set color to r+
?
? "End of Search ...."
?
set print off
set index to
erase temp.ndx

* ---------- Check to Search Again.

set color to w+
accept "Search again (Y/n)? " to yn

if upper(yn) = "N"

* ---------- Return to Reports Menu

return
endif

enddo (while .t.)



  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : CANS_101.ZIP
Filename : REPORT8.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/