SUBROUTINE MSD.BILLING.INFO * AUTHOR: SCOTT REDMOND * DATE: 05/10/95 * PURPOSE: CLIENT BILLING INFO FOR PROJECT SYSTEM USERS * (PROGRAMMING) * *----------------------------------------------------------------* * $INCLUDE GEN.COMMON $INCLUDE USER * *----------------------------------------------------------------* * OPEN 'USER' TO USER.FILE ELSE ABORT 201, 'USER' OPEN 'HP.CONTROL' TO HPC ELSE ABORT 201, 'HP.CONTROL' OPEN 'CLOCK.GEN.KEYS' TO CLOCK.GEN.KEYS ELSE ABORT 201, 'CLOCK.GEN.KEYS' OPEN 'PC.CLIENT' TO PC.CLIENT ELSE ABORT 201, 'PC.CLIENT' OPEN 'INFO.HIST' TO INFO.HIST ELSE ABORT 201, 'INFO.HIST' * *----------------------------------------------------------------* * EOF=0 ; T=0 ; WT=0 ; CHANNEL.1=CHAR(12) ; PAGECNT=0 ; LNCT=99 TODAY=DATE() ; LAST.DEPT='' ; FIRST.SW=1 TOTALS='' SDATE=ICONV('03/26/94','D') FOR X = 1 TO 14 ;* init column totals TOTALS=0 NEXT X * TIME.TABLE='' START=0 FOR X = SDATE TO TODAY STEP 14 START=START+1 TIME.TABLE=INSERT(TIME.TABLE,1,START;X+1) TIME.TABLE=INSERT(TIME.TABLE,2,START;X+14) TIME.TABLE=INSERT(TIME.TABLE,3,START;START) NEXT X * TODAY=OCONV(DATE(),'D2/') *----------------------------------------------------------------* * 10 * CRT CS HDG='CLIENT BILLING INFORMATION REPORT' HDL=(80 - LEN(HDG)) /2 CRT @(0,0):CL:RV:STR(' ',80):ERV CRT @(HDL,0):RV:HDG:ERV: * READ JEN.REC FROM CLOCK.GEN.KEYS,"NEXT.PAY.PERIOD" ELSE CRT @(0,22):CL:RV:" ERROR - MISSING CLOCK.GEN.KEYS ITEM! ":ERV: INPUT ANY,3 RETURN END * 200 * CRT @(0,22):CL:RV:" ENTER THE PAY PERIOD BEGINNING DATE FOR REPORT ":ERV: CRT @(8,6):CL:RV:" PAY PERIOD BEGINNING DATE :":ERV:" ":OCONV(JEN.REC<1>-14,'D2/') CRT @(38,6): INPUT FIRST.DATE,10 IF FIRST.DATE=PF3 THEN RETURN IF FIRST.DATE='' THEN FIRST.DATE=OCONV(JEN.REC<1>-14,'D2/') FIRST.DATE=ICONV(FIRST.DATE,'D') IF FIRST.DATE <= SDATE THEN FIRST.DATE=SDATE+1 IF FIRST.DATE > JEN.REC<1>-14 THEN CRT @(39,6):CL:OCONV(FIRST.DATE,'D2/') CRT @(0,22):CL:BEEP:RV:" The last pay period processed was ":OCONV(JEN.REC<1>-14,'D2/'):" :":ERV: INPUT ANY,3 FIRST.DATE=JEN.REC<1>-14 END IF FIRST.DATE < 1 THEN GO 200 CRT @(39,6):CL:OCONV(FIRST.DATE,'D2/') * *--- figure beginning and ending pay period date --------------------* LOCATE(FIRST.DATE,TIME.TABLE,1;WHR;"AR") THEN NULL IF TIME.TABLE<2,START> >= TODAY THEN POSITION=START-1 END ELSE POSITION=START END IF FIRST.DATE = TIME.TABLE<1,WHR> THEN POSITION=WHR END ELSE IF FIRST.DATE <= TIME.TABLE<2,WHR> THEN POSITION=WHR-1 END END FIRST.PERIOD=TIME.TABLE<3,POSITION> FIRST.DATE=TIME.TABLE<1,POSITION> SECOND.HOLD=TIME.TABLE<2,POSITION> 300 * CRT @(8,6):CL:RV:" PAY PERIOD BEGINNING DATE :":ERV:" ":OCONV(FIRST.DATE,'D2/') CRT @(8,8):CR:RV:" PAY PERIOD ENDING DATE :":ERV:" ":OCONV(SECOND.HOLD,'D2/') *----------------------------------------------------------------* * H1=TODAY'L#8':SPACE(15):'CLIENT BILLING HOURS DETAIL REPORT' H2=SPACE(27):'For Pay Period ':OCONV(FIRST.DATE,'D') H3='Name':SPACE(18) H3=H3:'Client Name':SPACE(25) H3=H3:'Bill':SPACE(1):'Service':SPACE(4):'Free' * 350 * CRT @(0,22):CL:RV:" ENTER 'B' TO BEGIN REPORT :":ERV: INPUT BEGIN.ANS,4 IF BEGIN.ANS[1,1] # 'B' THEN RETURN * CRT @(8,16):CR:BEEP:RV:" This report must be sent to a laser printer! ":ERV: CRT @(0,18): EXECUTE "EX PRINTER" CRT @(0,16):CR: * CRT @(0,22):CL:RV:" SELECTING USERS RECORDS - PLEASE WAIT... ":ERV: PRINTER ON READ SMALL FROM HPC,'16.PITCH' ELSE SMALL='' READ LAND FROM HPC,'LANDSCAPE' ELSE LAND='' READ RESET FROM HPC,'RESET' ELSE RESET='' * *PRINT SMALL ; PRINT LAND * HOUR.TABLE='' * HUSH ON EXECUTE "SSELECT INFO.HIST BY LNAME BY FNAME WITH LAST.PAY.DATE \":OCONV(SECOND.HOLD,'D2/'):"\" HUSH OFF * LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO T=T+1 READ UREC FROM INFO.HIST,ID THEN IF UREC<49> # '' THEN FOUND=1 ELSE FOUND='' IF FOUND THEN ;* user has billing info on file GOSUB 6000 ;* sort client info in alpha order LINE='' NAME=UREC<2>:", ":UREC<1> LINE=NAME'L#20':SPACE(2) JJCT=DCOUNT(UREC<49>,VM) ;* number of clients FOR JJ = 1 TO JJCT CLIENT.NUM=UREC<49,JJ> READ CLIENT.REC FROM PC.CLIENT,CLIENT.NUM THEN CLIENT.NAME=OCONV(CLIENT.REC<1>,'MCU') END ELSE CLIENT.NAME='UNKNOWN' END IF JJ > 1 THEN LINE='' LINE=SPACE(22) END LINE=LINE:CLIENT.NAME'L#32':SPACE(2) LINE=LINE:UREC<50,JJ>'R26(#6)':SPACE(2) ;* bill hours LINE=LINE:UREC<51,JJ>'R26(#6)':SPACE(2) ;* service hours LINE=LINE:UREC<52,JJ>'R26(#6)':SPACE(2) ;* free hours GOSUB 8000 IF JJ >= JJCT THEN GOSUB 8000 LINE='' LINE=SPACE(22) LINE=LINE:'***** TOTALS':SPACE(22) LINE=LINE:UREC<46,1>'R26(#6)':SPACE(2) ;* total bill hours LINE=LINE:UREC<47,1>'R26(#6)':SPACE(2) ;* total service hours LINE=LINE:UREC<48,1>'R26(#6)':SPACE(2) ;* total free hours GOSUB 8000 GOSUB 8000 END LOCATE(CLIENT.NAME,HOUR.TABLE,1;FND;"AL") THEN USER.TOTAL=0 USER.TOTAL=UREC<50,JJ>+UREC<51,JJ>+UREC<52,JJ> HOUR.TABLE<2,FND>=HOUR.TABLE<2,FND>+UREC<50,JJ> ;* bill hrs HOUR.TABLE<3,FND>=HOUR.TABLE<3,FND>+UREC<51,JJ> ;* serv hrs HOUR.TABLE<4,FND>=HOUR.TABLE<4,FND>+UREC<52,JJ> ;* free hrs HOUR.TABLE<5,FND>=HOUR.TABLE<5,FND>+USER.TOTAL ;* total hrs END ELSE USER.TOTAL=0 USER.TOTAL=UREC<50,JJ>+UREC<51,JJ>+UREC<52,JJ> HOUR.TABLE=INSERT(HOUR.TABLE,1,FND;CLIENT.NAME) ;* alpha name HOUR.TABLE=INSERT(HOUR.TABLE,2,FND;UREC<50,JJ>) ;* bill hrs HOUR.TABLE=INSERT(HOUR.TABLE,3,FND;UREC<51,JJ>) ;* serv hrs HOUR.TABLE=INSERT(HOUR.TABLE,4,FND;UREC<52,JJ>) ;* free hrs HOUR.TABLE=INSERT(HOUR.TABLE,5,FND;USER.TOTAL) ;* total hrs END NEXT JJ END END 2000 * REPEAT * *----------------- FORMAT CLIENT SUMMARY REPORT ----------------------* LINE='' ; LNCT=99 ; PAGECNT=0 NUM.CLIENTS=DCOUNT(HOUR.TABLE<1>,VM) H1=OCONV(DATE(),'D2/'):SPACE(14):'CLIENT BILLING HOURS SUMMARY REPORT' H2=SPACE(27):'For Pay Period ':OCONV(FIRST.DATE,'D') H3='Client Name':SPACE(26) H3=H3:'Bill':SPACE(4):'Service':SPACE(7):'Free':SPACE(6):'Total' * *--------- print report from table -----------* TOTAL.BILL=0 ; TOTAL.SERV=0 ; TOTAL.FREE=0 GRAND.TOTAL=0 FOR YY = 1 TO NUM.CLIENTS LINE='' LINE=HOUR.TABLE<1,YY>'L#30':SPACE(3) LINE=LINE:HOUR.TABLE<2,YY>'R26(#8)':SPACE(3) ;* bill hrs LINE=LINE:HOUR.TABLE<3,YY>'R26(#8)':SPACE(3) ;* service hrs LINE=LINE:HOUR.TABLE<4,YY>'R26(#8)':SPACE(3) ;* free hurs LINE=LINE:HOUR.TABLE<5,YY>'R26(#8)':SPACE(3) ;* total hrs TOTAL.BILL=TOTAL.BILL+HOUR.TABLE<2,YY> TOTAL.SERV=TOTAL.SERV+HOUR.TABLE<3,YY> TOTAL.FREE=TOTAL.FREE+HOUR.TABLE<4,YY> GRAND.TOTAL=GRAND.TOTAL+HOUR.TABLE<5,YY> GOSUB 8000 NEXT YY GOSUB 8000 * -------- print totals --------* LINE='******* GRAND TOTALS':SPACE(13) LINE=LINE:TOTAL.BILL'R26(#8)':SPACE(3) LINE=LINE:TOTAL.SERV'R26(#8)':SPACE(3) LINE=LINE:TOTAL.FREE'R26(#8)':SPACE(3) LINE=LINE:GRAND.TOTAL'R26(#8)' GOSUB 8000 GOSUB 8000 GOSUB 8000 LINE='* Note: Hours shown above do not include time clock users.' GOSUB 8000 * 9999 * CRT @(0,18):CR: PRINT RESET PRINTER CLOSE PRINTER OFF CRT @(0,22):CL:RV:" PROCESS COMPLETE :":ERV: INPUT ANY,3 RETURN * 6000 *--- total figures ----------------------------------------* SORT.TABLE='' SORTCT=DCOUNT(UREC<49>,VM) FOR FF = 1 TO SORTCT FIND.KEY=UREC<49,FF> READ QREC FROM PC.CLIENT,FIND.KEY THEN LOCATE(QREC<1>,SORT.TABLE,1;FND;'AL') ELSE SORT.TABLE=INSERT(SORT.TABLE,1,FND;QREC<1>) ;* alpha name SORT.TABLE=INSERT(SORT.TABLE,2,FND;FIND.KEY) ;* client num SORT.TABLE=INSERT(SORT.TABLE,3,FND;UREC<50,FF>) ;* bill hours SORT.TABLE=INSERT(SORT.TABLE,4,FND;UREC<51,FF>) ;* serv hours SORT.TABLE=INSERT(SORT.TABLE,5,FND;UREC<52,FF>) ;* free hours END END NEXT FF UREC<49>=SORT.TABLE<2> UREC<50>=SORT.TABLE<3> UREC<51>=SORT.TABLE<4> UREC<52>=SORT.TABLE<5> RETURN * 8000 *--- print line -------------------------------------------* IF LNCT > 58 THEN PRINT CHANNEL.1 PAGECNT=PAGECNT+1 H1B=H1:SPACE(10):"PAGE ":PAGECNT PRINT H1B PRINT H2 PRINT PRINT PRINT H3 PRINT LNCT=6 END PRINT LINE LINE='' LNCT=LNCT+1 RETURN