home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 6 / 06.iso / a / a610 / 6.ddi / DEMO / FGL / R_FOLLOW.4GL < prev    next >
Encoding:
Text File  |  1989-12-08  |  2.9 KB  |  97 lines

  1. DATABASE leads
  2. GLOBALS "globals.4gl"
  3.  
  4. REPORT r_follow   (rr)
  5. {
  6. The r_follow report prints follow-up contacts scheduled for each
  7. salesperson in a specified week.  The report is sent to a file called
  8. follow.out.
  9. }
  10. DEFINE   rr                RECORD
  11.             ndate          LIKE contact.ndate,
  12.             ref            LIKE contact.ref,
  13.             pfirst         LIKE prospect.fname,
  14.             plast          LIKE prospect.lname,
  15.             company        LIKE prospect.company,
  16.             phone          LIKE prospect.phone,
  17.             source         LIKE prospect.source,
  18.             sfirst         LIKE sperson.fname,
  19.             slast          LIKE sperson.lname,
  20.             empnum         LIKE sperson.empnum,
  21.             answer         DATE
  22.          END RECORD,
  23.          cdate             LIKE contact.cdate,
  24.          notes             LIKE contact.notes,
  25.          ctype             LIKE contact.ctype,
  26.          tfirst            LIKE sperson.fname,
  27.          tlast             LIKE sperson.lname
  28.  
  29. OUTPUT
  30.    REPORT TO "follow.out"
  31.  
  32. FORMAT
  33. FIRST PAGE HEADER
  34.    DECLARE c_prev CURSOR FOR
  35.       SELECT      contact.cdate,
  36.                   contact.notes,
  37.                   contact.ctype,
  38.                   sperson.lname,
  39.                   sperson.fname
  40.          INTO     cdate,
  41.                   notes,
  42.                   ctype,
  43.                   tlast,
  44.                   tfirst
  45.          FROM     contact,
  46.                   sperson
  47.          WHERE    contact.ref = rr.ref
  48.                   AND contact.cdate < rr.answer
  49.                   AND contact.empnum = sperson.empnum
  50.          ORDER BY contact.cdate DESC
  51.  
  52.    PRINT "Contacts for ", rr.sfirst CLIPPED, 1 SPACE, rr.slast
  53.    PRINT "For the week of ", rr.answer
  54.  
  55. PAGE HEADER
  56.    PRINT "Contacts for ", rr.sfirst CLIPPED, 1 SPACE, rr.slast
  57.    PRINT "For the week of ", rr.answer
  58.       
  59.  
  60. BEFORE GROUP OF rr.empnum
  61.    SKIP TO TOP OF PAGE
  62.  
  63. ON EVERY ROW
  64.    SKIP 1 LINE
  65.    PRINT rr.ndate USING "MMM. DD:"
  66.    PRINT rr.pfirst CLIPPED, 1 SPACE, rr.plast
  67.    PRINT rr.company CLIPPED, ", Phone: ", rr.phone, ", Source: ";
  68.    CASE (rr.source)
  69.       WHEN "B" PRINT "Binder Weekly"
  70.       WHEN "N" PRINT "Newspaper"
  71.       WHEN "O" PRINT "Other"
  72.       WHEN "P" PRINT "Binder Prod News"
  73.       WHEN "R" PRINT "Radio"
  74.    END CASE
  75.    PRINT "Previous contacts:"
  76.    SKIP 1 LINE
  77.    LET eflag = -1
  78.    FOREACH c_prev
  79.       LET eflag = 0
  80.       PRINT "> ", cdate, " by ", tfirst CLIPPED, 1 SPACE,
  81.             tlast CLIPPED, "  Type: ";
  82.       IF ctype = "C" THEN PRINT "Complaint" END IF
  83.       IF ctype = "I" THEN PRINT "Request info" END IF
  84.       IF ctype = "Q" THEN PRINT "Inquiry" END IF
  85.       IF ctype = "S" THEN PRINT "Sale" END IF
  86.       IF (notes IS NOT NULL) THEN
  87.          PRINT "  Notes: ", notes
  88.       END IF
  89.    END FOREACH
  90.    IF (eflag < 0) THEN
  91.       PRINT "(first contact)"
  92.       LET eflag = 0
  93.    END IF
  94.    SKIP 1 LINE
  95.  
  96. END REPORT
  97.