home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP15.EXE / CHP1510.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  1.7 KB  |  55 lines

  1. /*
  2.    Listing 15.10. Printing with page and column headings, a first attempt.
  3.    NOTE: This is a code fragment... do not compile and use as-is!!
  4.    Author: Craig Yellick
  5.    Excerpted from "Clipper 5: A Developer's Guide"
  6.    Copyright (c) 1991 M&T Books
  7.                       501 Galveston Drive
  8.                       Redwood City, CA 94063-4728
  9.                       (415) 366-3600
  10. */
  11.  
  12. #define TOP_MAR   4
  13. #define BOT_MAR   6
  14. #define PAGE_LEN  66
  15.  
  16. function Main()
  17. /*
  18.    The venerable Vendor Listing again, this time with
  19.    both page and column headings on every page.
  20. */
  21.   local page_number, page_id1, page_id2
  22.  
  23.   use vendor new
  24.   set filter to vendor->ytd > 0
  25.   goto top
  26.   set device to printer
  27.   setprc(0,0)
  28.   page_number := 0
  29.   do while .not. vendor->(eof())
  30.     if PageEject(page_len, top_mar, bot_mar)
  31.       page_number++
  32.       page_id1 := dtoc(date()) +" " +rpt_id
  33.       page_id2 := time() +" Page " +ltrim(str(page_number))
  34.       @ prow() +1, left_mar say sys_title
  35.       @ prow(), (page_width -(len(page_id1) +right_mar)) say page_id1
  36.       @ prow() +1, left_mar say rpt_title
  37.       @ prow(), (page_width -(len(page_id2) +right_mar)) say page_id2
  38.       @ prow() +2, left_mar say col_head1
  39.       @ prow() +1, left_mar say col_head2
  40.     endif
  41.     @ prow() +1, left_mar say vendor->name
  42.     @ prow(), pcol() +2 say vendor->address
  43.     @ prow(), pcol() +2 say vendor->ytd picture "$9,999.99"
  44.     @ prow(), pcol() +6 say if(vendor->contract, "Yes", "No")
  45.     skip alias vendor
  46.   enddo
  47.   @ prow() +2, left_mar say "*** End of Report ***"
  48.   eject
  49.   set device to screen
  50.   close databases
  51.   quit
  52. return nil
  53.  
  54. // end of file CHP1510.PRG
  55.