home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / techs.zip / TECH21.ARC / REPORT.PRG < prev   
Text File  |  1985-11-02  |  3KB  |  83 lines

  1. * Program..: Report.PRG
  2. * Author...: Karen A. Robinson
  3. * Date.....: October 1, 1985
  4. * Version..: dBASE III, any version
  5. * Note(s)..: USEs Referral.DBF and Recruit.DBF to generate a
  6. *            custom report of student referrals by recruiter.
  7. *            Simulates a report produced by the REPORT FORM.
  8. *
  9. CLEAR
  10. SET TALK OFF
  11. * ---Open work areas.
  12. SELECT 2
  13. USE Referral INDEX Code
  14. SELECT 1
  15. USE Recruit
  16. SET DEVICE TO PRINT
  17. * ---Print all recruiters and their respective referrals.
  18. DO WHILE .NOT. EOF()
  19. * ---Initialize memory variables for the page headings.
  20.    STORE  1 TO m_pagctr
  21.    STORE 90 TO m_line
  22.    * ---Calculate column positions so that the name and address
  23.    * ---of the recruiter will be centered.
  24.    STORE 40 - LEN(TRIM(Name))/2    TO m_1
  25.    STORE 40 - LEN(TRIM(Address))/2 TO m_2
  26.    STORE 40 - ((LEN(TRIM(City)) + LEN(State) + LEN(Zip) + 4)/2);
  27.          TO m_3
  28.    * --Find the first referral from Recruit.DBF.
  29.    SELECT Referral
  30.    SEEK Recruit->Ref_code
  31.    * ---Test for the existence of a referral.
  32.    * ---If one is not found, then get the next recruiter
  33.    * ---and start the process over.
  34.    IF EOF()
  35.       SELECT Recruit
  36.       SKIP
  37.       LOOP
  38.    ENDIF
  39.  
  40.    * ---The first referral has been found.  The following
  41.    * ---prints all the records from Referral.DBF that have
  42.    * ---the same Ref_code as the Ref_code in Recruit.DBF.
  43.    DO WHILE Ref_code = Recruit->Ref_code .AND. .NOT. EOF()
  44.       * ---Test for a new page.  If the line count exceeds
  45.       * ---56, a new page is required.
  46.       IF m_line > 56
  47.          * ---Print page and column headings.
  48.          @  1, 28 SAY 'STUDENT REFERRAL REPORT'
  49.          @  1, 65 SAY 'Page ' + STR(m_pagctr,3)
  50.          @  2, 65 SAY 'Date    '
  51.          @  2, 72 SAY DATE()
  52.          @  4,m_1 SAY Recruit->Name
  53.          @  5,m_2 SAY Recruit->Address
  54.          @  6,m_3 SAY TRIM(Recruit->City) + ', ' +;
  55.                       Recruit->State + ' ' + Recruit->Zip
  56.          @  9,14 SAY 'Level'
  57.          @  9,23 SAY 'Center'
  58.          @  9,43 SAY 'Student Name'
  59.          * ---Increment page and line counts.
  60.          STORE 11 TO m_line
  61.          STORE m_pagctr + 1 TO m_pagctr
  62.       ENDIF
  63.       * ---Print a referral, a record from the Referral
  64.       * ---database file.
  65.       @ m_line,14 SAY Level
  66.       @ m_line,23 SAY Center
  67.       @ m_line,43 SAY Name
  68.       * ---Increment the line counter.
  69.       STORE m_line + 1 TO m_line
  70.       * ---Get the next Referral for the current
  71.       * ---recruiter.
  72.       SKIP
  73.    ENDDO
  74.    * ---Get the next recruiter.
  75.    SELECT Recruit
  76.    SKIP
  77. ENDDO
  78. * ---Restore the environment and return.
  79. EJECT
  80. SET DEVICE TO SCREEN
  81. CLOSE DATABASES
  82. RETURN
  83. * EOP Report.PRG