home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / billing.zip / BILL.PRG < prev    next >
Text File  |  1986-11-10  |  4KB  |  156 lines

  1. *--[ bill.prg ]-- custom billing format
  2. SET PROCEDURE TO procfile
  3. SELECT 1
  4. USE client INDEX cltcode ALIAS clt
  5. SELECT 2
  6. USE taskunit INDEX taskdate ALIAS task
  7. SET RELATION TO c_code INTO clt
  8. CLEAR
  9. prt_out=.N.
  10. start_date=CTOD(STR(MONTH(DATE()),2,0)+"/01/"+SUBSTR(STR(YEAR(DATE()),4,0),3,2))
  11. end_date=CTOD(STR(MONTH(DATE())+1,2,0)+"/01/"+SUBSTR(STR(YEAR(DATE()),4,0),3,2))
  12. m_client=101
  13. end_clt=999
  14. SET COLOR TO W+
  15. @ 1,24 SAY "DISPLAY OR PRINT CLIENT BILLING"
  16. SET COLOR TO W
  17. TEXT
  18. ===============================================================================
  19.  
  20.      You may select whether to print or display billing data.  Different
  21.      headers are used on the printed and displayed versions.
  22.  
  23.      The report may be limited to one or more clients by client code order.
  24.      Select the starting and ending client codes.  All clients having time
  25.      recorded will be displayed.
  26.  
  27.      Specify starting and ending dates in the same way.  The default is for
  28.      the entire month for a normal billing.  A charge must be found for the
  29.      first client in month specified.
  30.  
  31. ===============================================================================
  32. ENDTEXT
  33. IF clipper
  34.     *box
  35. ELSE
  36.     @ 16,13 TO 22,58 DOUBLE
  37. ENDIF clipper
  38. @ 17,15 SAY "DO YOU WANT TO PRINT BILLS        [ ]"
  39. @ 17,COL()-2 GET prt_out
  40. @ 18,15 SAY "ENTER CLIENT CODE TO START REPORT "
  41. @ 18,COL() GET m_client PICTURE "###"
  42. @ 19,15 SAY "ENTER CLIENT CODE TO END REPORT   "
  43. @ 19,COL() GET end_clt PICTURE "###"
  44. @ 20,15 SAY "ENTER STARTING DATE FOR REPORT    "
  45. @ 20,COL() GET start_date PICTURE "@D"
  46. @ 21,15 SAY "ENTER ENDING DATE FOR REPORT      "
  47. @ 21,COL() GET end_date PICTURE "@D"
  48. READ
  49. CLEAR
  50. IF prt_out
  51.     SET DEVICE TO PRINT
  52. ENDIF prt_out
  53. STORE 0 TO total_time,total_fee
  54. DO get_task
  55. SELECT task
  56. DO WHILE .NOT. EOF() .AND. c_code<=end_clt
  57.     CLEAR
  58.     STORE 0 TO t_hours,t_fee
  59.     IF prt_out
  60.         DO headline
  61.         line=15
  62.     ELSE
  63.         @ 1,20 SAY "CLIENT NAME "
  64.         SET COLOR TO W+
  65.         @ 1,32 SAY TRIM(clt->c_name)+" ["+STR(clt->c_code,3,0)+"]"
  66.         SET COLOR TO W
  67.         @ 2,0 SAY "==============================================================================="
  68.         SET COLOR TO W+
  69.         @ 3,5 SAY "  DATE    DESCRIPTION OF TASK                      HOURS   CHARGES"
  70.         SET COLOR TO W
  71.         @ 4,5 SAY "-------- ----------------------------------------- -----   -------"
  72.         line=5
  73.     ENDIF prt_out
  74.     DO WHILE c_code=m_client .AND. taskdate<=end_date
  75.         @ line,5 SAY taskdate
  76.         @ line,14 SAY descriptn
  77.         @ line,56 SAY hours PICTURE "###.#"
  78.         @ line,64 SAY IIF(charge,hours*clt->rate,0) PICTURE "####.##"
  79.         t_hours=t_hours+hours
  80.         t_fee=t_fee+IIF(charge,hours*clt->rate,0)
  81.         line=line+1
  82.         IF prt_out
  83.             IF line=53
  84.                 EJECT
  85.                 DO headline
  86.                 line=15
  87.             ENDIF line=53
  88.         ELSE
  89.             IF line=21
  90.                 WAIT "               PRESS RETURN TO CONTINUE"
  91.                 line=5
  92.                 @ line,0 CLEAR
  93.             ENDIF line=21
  94.         ENDIF prt_out
  95.         SKIP
  96.         IF EOF()
  97.             EXIT
  98.         ENDIF EOF()
  99.     ENDDO WHILE c_code=m_client .AND. taskdate<=end_date
  100.  
  101.     *make sure we have the proper client regardless of the current task
  102.     SELECT clt
  103.     SEEK m_client
  104.     SELECT task
  105.     IF prt_out
  106.         IF line=51
  107.             EJECT
  108.             DO headline
  109.         ENDIF line=51
  110.     ELSE
  111.         IF line=19
  112.             line=5
  113.             @ line,0 CLEAR
  114.         ENDIF line=19
  115.     ENDIF prt_out
  116.     @ line,55 SAY "------  --------"
  117.     @ line+1,56 SAY t_hours PICTURE "###.#"
  118.     @ line+1,64 SAY t_fee PICTURE "####.##"
  119.     IF MONTH(start_date)=MONTH(DATE())
  120.         @ line+2,47 SAY "Previous Balance"
  121.         @ line+2,64 SAY clt->current PICTURE "####.##"
  122.         @ line+3,64 SAY "--------"
  123.         @ line+4,50 SAY "TOTAL NOW DUE"
  124.         @ line+4,64 SAY t_fee+clt->current PICTURE "####.##"
  125.     ENDIF MONTH(start_date)=MONTH(DATE())
  126.     IF .NOT. prt_out
  127.         WAIT "               PRESS RETURN AFTER READING SCREEN"
  128.     ENDIF .NOT. prt_out
  129.     total_time=total_time+t_hours
  130.     total_fee=total_fee+t_fee
  131.     *locate the next client - task combination
  132.     CLEAR
  133.     SELECT clt
  134.     *? "current client = "+str(c_code,3,0)+"    "
  135.     SKIP &&go to next client here
  136.     *?? "next client is "+str(c_code,3,0)
  137.     IF c_code>end_clt
  138.         EXIT
  139.     ENDIF c_code>end_clt
  140.     m_client=clt->c_code
  141.     DO get_task
  142.     SELECT task
  143. ENDDO WHILE .NOT. EOF()
  144. IF prt_out
  145.     EJECT
  146. ELSE
  147.     SET DEVICE TO SCREEN
  148.     line=5
  149.     @ line,0 CLEAR
  150. ENDIF prt_out
  151. SET DEVICE TO SCREEN
  152. @ line+2,56 SAY total_time PICTURE "###.#"
  153. @ line+2,64 SAY total_fee PICTURE "####.##"
  154. WAIT "               PRESS RETURN AFTER READING SCREEN"
  155. RETURN
  156.