home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dbbills.zip / PROCFILE.PRG < prev    next >
Text File  |  1986-11-10  |  3KB  |  76 lines

  1. PROCEDURE headline
  2.     SET COLOR TO W+
  3.     @ 1,27 SAY "TENNESSEE DATA CONSULTING"
  4.     @ 2,27 SAY "7003 Chadwick, Suite 265"
  5.     @ 3,30 SAY "Brentwood, TN 37027"
  6.     @ 4,33 SAY "(615)377-6253"
  7.     SET COLOR TO W
  8.     @ 6,5 SAY clt->c_name
  9.     @ 7,5 SAY clt->street
  10.     @ 8,5 SAY TRIM(clt->city)+", "+clt->state+" "+clt->zip
  11.     @ 10,5 SAY "Statement for services provided during "+CMONTH(DATE()-15)+"."
  12.     @ 12,5 SAY "  DATE    DESCRIPTION OF TASK                      HOURS   CHARGES"
  13.     @ 13,5 SAY "-------- ----------------------------------------- -----   -------"
  14. RETURN
  15.  
  16. PROCEDURE get_task
  17. * if you want to see how the search works, replace all [*?] with [?]
  18. *
  19. *date_key=STR(m_client,3,0)+SUBSTR(DTOC(start_date),7,2)+SUBSTR(DTOC(start_date),1,2)+SUBSTR(DTOC(start_date),4,2)
  20. SET DATE ANSI
  21. date_key=STR(m_client,3,0)+DTOC(start_date)
  22. looking=.T.
  23. DO WHILE looking
  24.     *look for specific client/date
  25.     SELECT task
  26.     *?  "seek1 for "+date_key
  27.     SEEK date_key
  28.     *?? "  found client="+str(c_code,3,0)+"   task_date="+dtoc(taskdate)
  29.     IF .NOT. FOUND()
  30.         *look for client year/month group
  31.         *? "seek2 for "+STR(m_client,3,0)+SUBSTR(DTOC(start_date),7,2)+SUBSTR(DTOC(start_date),1,2)
  32.         *SEEK STR(m_client,3,0)+SUBSTR(DTOC(start_date),7,2)+SUBSTR(DTOC(start_date),1,2)
  33.         SEEK SUBSTR(date_key,1,8)
  34.         *?? "found client="+str(c_code,3,0)+"   task_date="+dtoc(taskdate)
  35.         *? "check for desired record before locate step"
  36.         IF c_code=m_client .AND. taskdate>=start_date .AND. taskdate<end_date
  37.             *? "eurika! found by month w/o locate step"
  38.             EXIT
  39.         ENDIF c_code=m_client .AND. taskdate=start_date
  40.         IF .NOT. FOUND()
  41.             *? "no find on client code + month requested"
  42.             *nothing this month, so try next client; but get last one
  43.             SELECT clt
  44.             SEEK m_client 
  45.             IF c_code=0
  46.                 SET DATE AMERICAN
  47.                 RETURN
  48.             ELSE
  49.                 SKIP
  50.             ENDIF c_code=0
  51.             m_client=c_code
  52.             SELECT task
  53.             *date_key=STR(m_client,3,0)+SUBSTR(DTOC(start_date),7,2)+SUBSTR(DTOC(start_date),1,2)+SUBSTR(DTOC(start_date),4,2)
  54.             date_key=STR(m_client,3,0)+DTOC(start_date)
  55.             *? "cycle to next client with date_key = "+date_key
  56.             LOOP
  57.         ELSE
  58.             *get next best date
  59.             *? "nothing found by date; locating from "+str(c_code,3,0)+dtoc(taskdate)
  60.             LOCATE FOR c_code=m_client .AND. taskdate>=start_date .AND. taskdate<end_date
  61.             *? "located record "+str(c_code,3,0)+dtoc(taskdate)
  62.             IF .NOT. FOUND()
  63.                 CLEAR
  64.                 @ 12,15 SAY "CANNOT LOCATE KEY DATE OF "+CMONTH(start_date)+" "+STR(DOW(start_date),2,0)
  65.                 WAIT
  66.                 RETURN
  67.             ENDIF .NOT. FOUND()
  68.         ENDIF .NOT. FOUND()
  69.     ENDIF .NOT. FOUND()
  70.     looking=IIF(FOUND(),.F.,.T.)
  71. ENDDO WHILE looking
  72. *? "resulting record is "+str(c_code,3,0)+dtoc(taskdate)
  73. *wait
  74. SET DATE AMERICAN
  75. RETURN
  76.