home *** CD-ROM | disk | FTP | other *** search
- DATABASE leads
- GLOBALS "globals.4gl"
-
- REPORT r_follow (rr)
- {
- The r_follow report prints follow-up contacts scheduled for each
- salesperson in a specified week. The report is sent to a file called
- follow.out.
- }
- DEFINE rr RECORD
- ndate LIKE contact.ndate,
- ref LIKE contact.ref,
- pfirst LIKE prospect.fname,
- plast LIKE prospect.lname,
- company LIKE prospect.company,
- phone LIKE prospect.phone,
- source LIKE prospect.source,
- sfirst LIKE sperson.fname,
- slast LIKE sperson.lname,
- empnum LIKE sperson.empnum,
- answer DATE
- END RECORD,
- cdate LIKE contact.cdate,
- notes LIKE contact.notes,
- ctype LIKE contact.ctype,
- tfirst LIKE sperson.fname,
- tlast LIKE sperson.lname
-
- OUTPUT
- REPORT TO "follow.out"
-
- FORMAT
- FIRST PAGE HEADER
- DECLARE c_prev CURSOR FOR
- SELECT contact.cdate,
- contact.notes,
- contact.ctype,
- sperson.lname,
- sperson.fname
- INTO cdate,
- notes,
- ctype,
- tlast,
- tfirst
- FROM contact,
- sperson
- WHERE contact.ref = rr.ref
- AND contact.cdate < rr.answer
- AND contact.empnum = sperson.empnum
- ORDER BY contact.cdate DESC
-
- PRINT "Contacts for ", rr.sfirst CLIPPED, 1 SPACE, rr.slast
- PRINT "For the week of ", rr.answer
-
- PAGE HEADER
- PRINT "Contacts for ", rr.sfirst CLIPPED, 1 SPACE, rr.slast
- PRINT "For the week of ", rr.answer
-
-
- BEFORE GROUP OF rr.empnum
- SKIP TO TOP OF PAGE
-
- ON EVERY ROW
- SKIP 1 LINE
- PRINT rr.ndate USING "MMM. DD:"
- PRINT rr.pfirst CLIPPED, 1 SPACE, rr.plast
- PRINT rr.company CLIPPED, ", Phone: ", rr.phone, ", Source: ";
- CASE (rr.source)
- WHEN "B" PRINT "Binder Weekly"
- WHEN "N" PRINT "Newspaper"
- WHEN "O" PRINT "Other"
- WHEN "P" PRINT "Binder Prod News"
- WHEN "R" PRINT "Radio"
- END CASE
- PRINT "Previous contacts:"
- SKIP 1 LINE
- LET eflag = -1
- FOREACH c_prev
- LET eflag = 0
- PRINT "> ", cdate, " by ", tfirst CLIPPED, 1 SPACE,
- tlast CLIPPED, " Type: ";
- IF ctype = "C" THEN PRINT "Complaint" END IF
- IF ctype = "I" THEN PRINT "Request info" END IF
- IF ctype = "Q" THEN PRINT "Inquiry" END IF
- IF ctype = "S" THEN PRINT "Sale" END IF
- IF (notes IS NOT NULL) THEN
- PRINT " Notes: ", notes
- END IF
- END FOREACH
- IF (eflag < 0) THEN
- PRINT "(first contact)"
- LET eflag = 0
- END IF
- SKIP 1 LINE
-
- END REPORT
-