tldm-universe/CMS/BP.CLOCK/STATUS.WO.PRINT
2024-09-10 15:25:06 -04:00

172 lines
2.8 KiB
Plaintext
Executable File

*--------------------------*
* TABLE
* GENERIC TABLE MAINTENANCE PROGRAM TO UPDATE CLOCK TABLES.
*--------------------------*
CS=@(-1) ; CR=@(-3) ; CL=@(-4) ; RV=@(-13) ; ERV=@(-14)
VM=CHAR(253) ; SVM=CHAR(252) ; AM=CHAR(254) ; BEEP=CHAR(7)
PF1='<' ; PF2='P' ; PF3='/'
FF=CHAR(12)
LF=CHAR(10):CHAR(13)
PROMPT ""
HD=''; LN=''; LNCT=0
COL=0; POS=0; MAX=20
LAYOUT=''
GOSUB 10000 ;* SETUP LAYOUT ARRAY
*
FILENAME='STATUS.WORKORDER'
OPEN FILENAME TO OFILE ELSE ABORT
EXECUTE \SSELECT \:FILENAME
BRAY=''
LOOP
READNEXT KEY ELSE KEY='EOF'
UNTIL KEY='EOF' DO
BRAY=INSERT(BRAY,1,-1;KEY)
REPEAT
*
GOSUB 2100
BCT=DCOUNT(BRAY<1>,VM)
B=0
LOOP
B=B+1
KEY=BRAY<1,B>
UNTIL B > BCT DO
READ IREC FROM OFILE,KEY THEN
OREC=IREC
IREC=INSERT(IREC,1;KEY)
GOSUB 2000; * DISPLAY RECORD
END
REPEAT
CRT @(0,22):CL
STOP
*
2000 * DISPLAY DATA
FOR A=1 TO 7
ISTR=IREC<A>
IF LAYOUT<5,A>#'' THEN
ISTR=OCONV(ISTR,LAYOUT<5,A>)
END
ILEN=LAYOUT<4,A>
IF A=7 THEN
OLEN=LEN(ISTR)
IF OLEN > ILEN THEN
GOSUB 2600
LN=LN:OSTR
END ELSE
GOSUB 2700 ;* JUST ADD ISTR TO THE PRINT LINE
LN=LN:OSTR
END
END ELSE
GOSUB 2500
LN=LN:OSTR
END
NEXT A
GOSUB 2100
RETURN
2100 * PRINT LINE LOGIC
IF LNCT=0 THEN
IF MODE THEN
GOSUB 132
LN=FF:HD
END ELSE
LN=FF:HD[1,80]
END
END ELSE
IF MODE THEN
GOSUB 132
END ELSE
LN=LN[1,80]
END
END
IF LNCT > MAX THEN
LNHOLD=LN
LNCT=0
GOSUB 2100
LN=LNHOLD
END
PRINT LN
LN=''
LNCT=LNCT+1
RETURN
2500 * CONSTRUCT ELEMENTS FOR OUTPUT LINE
OLEN=INT(ILEN/2)-INT(LEN(ISTR)/2)
OSTR=SPACE(OLEN):ISTR
MASK="L#":ILEN
OSTR=OSTR MASK
RETURN
2600 *
DONE=0
X=1; Y=ILEN; Z=0
LOOP
Z=Z+1
UNTIL DONE DO
IF Z > 1 THEN
X=Z*Y-Y+1
OSTR=OSTR:LF:SPACE(75):ISTR[X,Y]
LNCT=LNCT+1
IF X+Y > OLEN THEN DONE=1
END ELSE
OSTR=ISTR[X,Y]
END
REPEAT
RETURN
2700 *
MASK="L#":ILEN
OSTR=OSTR MASK
RETURN
*
80 *
A=CHAR(27):"`:":CHAR(12)
PRINT A
RETURN
132 *
A=CHAR(27):"`;":CHAR(12)
PRINT A
RETURN
*
10000 * SETUP LAYOUT ARRAY
FOR A=1 TO 7
LAYOUT<1,A>=A
NEXT A
LAYOUT<2,1>='WORK ORDER'
LAYOUT<3,1>='Enter the WORK ORDER #'
LAYOUT<4,1>=10
*
LAYOUT<2,2>='WO DATE'
LAYOUT<3,2>='Enter the DATE the Work Order was Submitted'
LAYOUT<4,2>=10
LAYOUT<5,2>='D2/'
*
LAYOUT<2,3>='DUE DATE'
LAYOUT<3,3>='Enter the DATE the Work Order is DUE'
LAYOUT<4,3>=10
LAYOUT<5,3>='D2/'
*
LAYOUT<2,4>='DESCRIPTION'
LAYOUT<3,4>='Enter a brief DESCRIPTION of this Work Order'
LAYOUT<4,4>=30
*
LAYOUT<2,5>='PRGMR'
LAYOUT<3,5>='Enter PROGRAMMER assigned to the task'
LAYOUT<4,5>=5
*
LAYOUT<2,6>='COMPLETED'
LAYOUT<3,6>='Enter the DATE this project was COMPLETED'
LAYOUT<4,6>=10
LAYOUT<5,6>='D2/'
*
LAYOUT<2,7>='POST COMPLETION NOTES'
LAYOUT<3,7>='Enter NOTES (ie, counts, outstanding issues, etc.)'
LAYOUT<4,7>=50
*
MODE=0
*
ACT=DCOUNT(LAYOUT<1>,VM)
FOR A=1 TO ACT
ISTR=LAYOUT<2,A>
ILEN=LAYOUT<4,A>
GOSUB 2500
HD=HD:OSTR
NEXT A
*
RETURN