home *** CD-ROM | disk | FTP | other *** search
- *--[ bill.prg ]-- custom billing format
- SET PROCEDURE TO procfile
- SELECT 1
- USE client INDEX cltcode ALIAS clt
- SELECT 2
- USE taskunit INDEX taskdate ALIAS task
- SET RELATION TO c_code INTO clt
- CLEAR
- prt_out=.N.
- start_date=CTOD(STR(MONTH(DATE()),2,0)+"/01/"+SUBSTR(STR(YEAR(DATE()),4,0),3,2))
- end_date=CTOD(STR(MONTH(DATE())+1,2,0)+"/01/"+SUBSTR(STR(YEAR(DATE()),4,0),3,2))
- m_client=101
- end_clt=999
- SET COLOR TO W+
- @ 1,24 SAY "DISPLAY OR PRINT CLIENT BILLING"
- SET COLOR TO W
- TEXT
- ===============================================================================
-
- You may select whether to print or display billing data. Different
- headers are used on the printed and displayed versions.
-
- The report may be limited to one or more clients by client code order.
- Select the starting and ending client codes. All clients having time
- recorded will be displayed.
-
- Specify starting and ending dates in the same way. The default is for
- the entire month for a normal billing. A charge must be found for the
- first client in month specified.
-
- ===============================================================================
- ENDTEXT
- IF clipper
- *box
- ELSE
- @ 16,13 TO 22,58 DOUBLE
- ENDIF clipper
- @ 17,15 SAY "DO YOU WANT TO PRINT BILLS [ ]"
- @ 17,COL()-2 GET prt_out
- @ 18,15 SAY "ENTER CLIENT CODE TO START REPORT "
- @ 18,COL() GET m_client PICTURE "###"
- @ 19,15 SAY "ENTER CLIENT CODE TO END REPORT "
- @ 19,COL() GET end_clt PICTURE "###"
- @ 20,15 SAY "ENTER STARTING DATE FOR REPORT "
- @ 20,COL() GET start_date PICTURE "@D"
- @ 21,15 SAY "ENTER ENDING DATE FOR REPORT "
- @ 21,COL() GET end_date PICTURE "@D"
- READ
- CLEAR
- IF prt_out
- SET DEVICE TO PRINT
- ENDIF prt_out
- STORE 0 TO total_time,total_fee
- DO get_task
- SELECT task
- DO WHILE .NOT. EOF() .AND. c_code<=end_clt
- CLEAR
- STORE 0 TO t_hours,t_fee
- IF prt_out
- DO headline
- line=15
- ELSE
- @ 1,20 SAY "CLIENT NAME "
- SET COLOR TO W+
- @ 1,32 SAY TRIM(clt->c_name)+" ["+STR(clt->c_code,3,0)+"]"
- SET COLOR TO W
- @ 2,0 SAY "==============================================================================="
- SET COLOR TO W+
- @ 3,5 SAY " DATE DESCRIPTION OF TASK HOURS CHARGES"
- SET COLOR TO W
- @ 4,5 SAY "-------- ----------------------------------------- ----- -------"
- line=5
- ENDIF prt_out
- DO WHILE c_code=m_client .AND. taskdate<=end_date
- @ line,5 SAY taskdate
- @ line,14 SAY descriptn
- @ line,56 SAY hours PICTURE "###.#"
- @ line,64 SAY IIF(charge,hours*clt->rate,0) PICTURE "####.##"
- t_hours=t_hours+hours
- t_fee=t_fee+IIF(charge,hours*clt->rate,0)
- line=line+1
- IF prt_out
- IF line=53
- EJECT
- DO headline
- line=15
- ENDIF line=53
- ELSE
- IF line=21
- WAIT " PRESS RETURN TO CONTINUE"
- line=5
- @ line,0 CLEAR
- ENDIF line=21
- ENDIF prt_out
- SKIP
- IF EOF()
- EXIT
- ENDIF EOF()
- ENDDO WHILE c_code=m_client .AND. taskdate<=end_date
-
- *make sure we have the proper client regardless of the current task
- SELECT clt
- SEEK m_client
- SELECT task
- IF prt_out
- IF line=51
- EJECT
- DO headline
- ENDIF line=51
- ELSE
- IF line=19
- line=5
- @ line,0 CLEAR
- ENDIF line=19
- ENDIF prt_out
- @ line,55 SAY "------ --------"
- @ line+1,56 SAY t_hours PICTURE "###.#"
- @ line+1,64 SAY t_fee PICTURE "####.##"
- IF MONTH(start_date)=MONTH(DATE())
- @ line+2,47 SAY "Previous Balance"
- @ line+2,64 SAY clt->current PICTURE "####.##"
- @ line+3,64 SAY "--------"
- @ line+4,50 SAY "TOTAL NOW DUE"
- @ line+4,64 SAY t_fee+clt->current PICTURE "####.##"
- ENDIF MONTH(start_date)=MONTH(DATE())
- IF .NOT. prt_out
- WAIT " PRESS RETURN AFTER READING SCREEN"
- ENDIF .NOT. prt_out
- total_time=total_time+t_hours
- total_fee=total_fee+t_fee
- *locate the next client - task combination
- CLEAR
- SELECT clt
- *? "current client = "+str(c_code,3,0)+" "
- SKIP &&go to next client here
- *?? "next client is "+str(c_code,3,0)
- IF c_code>end_clt
- EXIT
- ENDIF c_code>end_clt
- m_client=clt->c_code
- DO get_task
- SELECT task
- ENDDO WHILE .NOT. EOF()
- IF prt_out
- EJECT
- ELSE
- SET DEVICE TO SCREEN
- line=5
- @ line,0 CLEAR
- ENDIF prt_out
- SET DEVICE TO SCREEN
- @ line+2,56 SAY total_time PICTURE "###.#"
- @ line+2,64 SAY total_fee PICTURE "####.##"
- WAIT " PRESS RETURN AFTER READING SCREEN"
- RETURN