tldm-universe/CMS/BP.CLOCK/MSD.CLOCK.PROJECT

120 lines
2.8 KiB
Plaintext
Raw Normal View History

2024-09-10 19:25:06 +00:00
* SUBROUTINE MSD.CLOCK.PROJECT
*
* 07/01/94
*
*---------------------------------------------------------------------*
*
$INCLUDE GEN.COMMON
*
*-------------------*
*
OPEN 'PROJECT.TIME' TO PROJECT.TIME ELSE ABORT 201, 'PROJECT.TIME'
* Q-POINTING TO PROJECT ACCOUNT (CMS.SUPPORT.TRANS.FILE)
*
OPEN 'PERFECT.WORK' TO PERFECT.WORK ELSE ABORT 201, 'PERFECT.WORK'
OPEN 'USER' TO USER ELSE ABORT 201, 'USER'
*
*-------------------*
*
T=0
EOF=0
TU=0
WT=0
PROGTABLE=''
*
*-------------------*
*
CRT @(0,16):CR
CRT @(20,16):RV:" CALCULATING RECORDS FOR PROGRAMMING STAFF ":ERV
*
EXECUTE "SELECT USER WITH DEPT \504\"
HH=0
10 *
READNEXT KEY ELSE GO 20
READ USER.REC FROM USER,KEY ELSE GO 10
HH=HH+1
PROGTABLE<HH>=KEY
GO 10
*
20 *
EXECUTE "SELECT PROJECT.TIME" CAPTURING OUTPUT
OUTPUT=OCONV(OUTPUT<3,1>,'G0 1')
*
LOOP
READNEXT KEY ELSE EOF=1
UNTIL EOF DO
TU=TU+1
IF REM(TU,10)=0 THEN
CRT @(23,17):CL:'PROJECT RECORDS READ :':TU
END
READ PREC FROM PROJECT.TIME,KEY ELSE GOTO 1500
ABBCT=DCOUNT(PREC<30>,VM)
FOR ABB = 1 TO ABBCT
PDATE=PREC<30,ABB> ;* DATE OF WORK
PUSER=PREC<33,ABB> ;* PROGRAMMER USER CODE
PTIME=PREC<34,ABB> ;* TIME IN MINUTES
IF PTIME < 1 THEN GOTO 1400
PGCT=DCOUNT(PROGTABLE,AM)
FOR PG = 1 TO PGCT
IF PUSER=OCONV(PROGTABLE<PG,1>,'G0|1') THEN
LOCATE(PDATE,PROGTABLE,PG;FND;'AR') THEN
OLD.TIME=''
OLD.TIME=OCONV(PROGTABLE<PG,FND>,'G1*1')
OLD.DATE=''
OLD.DATE=OCONV(PROGTABLE<PG,FND>,'G0*1')
NEW.TIME=''
NEW.TIME=PTIME+OLD.TIME
IF FND=1 THEN FND=2
PROGTABLE=INSERT(PROGTABLE,PG,FND;OLD.DATE:"*":NEW.TIME)
END ELSE
IF FND=1 THEN FND=2
PROGTABLE=INSERT(PROGTABLE,PG,FND;PDATE:'*':PTIME)
END
END ELSE
IF PG=PGCT THEN
PROGTABLE<PGCT+1,1>=PUSER:'|':PDATE:'*':PTIME
END
END
NEXT PG
1400 *
NEXT ABB
1500 *
REPEAT
*
3000 *
PROG.COUNT=DCOUNT(PROGTABLE,AM)
FOR PCNT = 1 TO PROG.COUNT
WEEK.TIME=0
WEEKREC=''
WEEK=1
LAST.DAY=8
PROGRAMMER=OCONV(PROGTABLE<PCNT,1>,'G0|1')
VALCT=DCOUNT(PROGTABLE<PCNT>,VM)
FOR VALC = 2 TO VALCT ;* THE FIRST VALUE = USER CODE
THIS.DAY='' ; THIS.TIME='' ; THIS.DATE=''
THIS.TIME=OCONV(PROGTABLE<PCNT,VALC>,'G1*1')
THIS.DATE=OCONV(PROGTABLE<PCNT,VALC>,'G0*1')
THIS.DAY =OCONV(THIS.DATE,'DW')
IF THIS.DAY < LAST.DAY THEN
NEW.WEEK=1
END ELSE
NEW.WEEK=0
END
IF VALC > 2 THEN
IF NOT(NEW.WEEK) THEN
WEEK.TIME=WEEK.TIME + THIS.TIME
END ELSE
WEEKREC<WEEK>=WEEK.TIME
WEEK=WEEK+1
WEEK.TIME=0
WEEK.TIME=THIS.TIME
END
END ELSE
WEEK.TIME=THIS.TIME
END
LAST.DAY=THIS.DAY
NEXT VALC
WRITE WEEKREC ON PERFECT.WORK,OCONV(PROGTABLE<PGCNT,1>,'G0|1')
NEXT PCNT
STOP