311 lines
7.0 KiB
Plaintext
311 lines
7.0 KiB
Plaintext
|
*--------------------------*
|
||
|
* 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='/'
|
||
|
PROMPT ""
|
||
|
PORT=OCONV('','U50BB')
|
||
|
PORT=FIELD(PORT," ",1)
|
||
|
*
|
||
|
OPEN 'PT' TO PT.FILE ELSE ABORT
|
||
|
READV PT FROM PT.FILE,PORT,1 ELSE PT=''
|
||
|
BEGIN CASE
|
||
|
CASE PT='2020'; ADDS=1
|
||
|
CASE PT='4000'; ADDS=2
|
||
|
CASE PT='2025'; ADDS=2
|
||
|
CASE 1 ; ADDS=0
|
||
|
END CASE
|
||
|
IF ADDS THEN
|
||
|
* TA ON; TA CLEAR
|
||
|
END
|
||
|
*
|
||
|
FILENAME='USER'
|
||
|
LAYOUT=1:VM:2:VM:3:VM:4:VM:5:VM:6:VM:7
|
||
|
LAYOUT<2>="FIRST NAME":VM:"LAST NAME":VM:"PHONE":VM:"PASSWORD":VM:"DEPT":VM:"SS #":VM:"IN TIME"
|
||
|
LAYOUT<3,1>="Enter the FIRST NAME of this user"
|
||
|
LAYOUT<3,2>="Enter the LAST NAME of this user"
|
||
|
LAYOUT<3,3>="Enter the PHONE # of this user"
|
||
|
LAYOUT<3,4>="Enter the user PASSWORD"
|
||
|
LAYOUT<3,5>="Enter the DEPARTMENT of this user, ?(help)"
|
||
|
LAYOUT<3,6>="Enter the EMPLOYEE # of this user"
|
||
|
LAYOUT<3,7>="Enter the TIME the employee should clock in"
|
||
|
LAYOUT<4>=VM:VM:VM:VM:'DEPT'
|
||
|
OPEN FILENAME TO OFILE ELSE ABORT
|
||
|
10 *
|
||
|
CRT CS
|
||
|
CRT @(0,0):"CLOCKTABLE.USER"
|
||
|
STRING=FILENAME:" MAINTENANCE"
|
||
|
CENTER=40-INT(LEN(STRING)/2)
|
||
|
XCT=DCOUNT(LAYOUT<1>,VM)
|
||
|
OLD.LEN=0
|
||
|
FOR X=1 TO XCT
|
||
|
XLEN=LEN(LAYOUT<2,X>)
|
||
|
IF XLEN > OLD.LEN THEN OLD.LEN=XLEN
|
||
|
NEXT X
|
||
|
XLEN=OLD.LEN
|
||
|
CRT @(CENTER,3):RV:STRING:ERV
|
||
|
STRING=FILENAME
|
||
|
CRT @(0,22):CL:"Enter ":FILENAME:" code '/' to escape"
|
||
|
CRT @(CENTER,6):CL:STRING:" ":
|
||
|
CENTER=CENTER-5
|
||
|
INPUT KEY
|
||
|
IF KEY='/' OR KEY='' THEN STOP
|
||
|
READ IREC FROM OFILE,KEY THEN
|
||
|
GOSUB 2000
|
||
|
OREC=IREC
|
||
|
END ELSE
|
||
|
CRT @(0,22):CL:FILENAME:" record not found - 'A'(add)":
|
||
|
INPUT ANS
|
||
|
IF ANS = 'A' THEN
|
||
|
IREC=''
|
||
|
OREC=''
|
||
|
GOSUB 2000
|
||
|
GOSUB 1000
|
||
|
END ELSE
|
||
|
GO 10
|
||
|
END
|
||
|
END
|
||
|
GOSUB 3000
|
||
|
GO 10
|
||
|
1000 *
|
||
|
ACT=DCOUNT(LAYOUT<1>,VM)
|
||
|
FOR A=1 TO ACT
|
||
|
ALEN=LEN(LAYOUT<2,A>)
|
||
|
CRT @(0,22):CL:LAYOUT<3,A>:
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":
|
||
|
INPUT ANS
|
||
|
IF A=7 THEN
|
||
|
ANS=ICONV(ANS,'MT')
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OCONV(ANS,'MTS')
|
||
|
END
|
||
|
IF ANS = '?' THEN
|
||
|
ANS=''
|
||
|
GOSUB 9000
|
||
|
CRT @(0,5):CR
|
||
|
IREC=OREC
|
||
|
GOSUB 2000
|
||
|
A=5
|
||
|
ALEN=LEN(LAYOUT<2,A>)
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":ANS
|
||
|
IREC<A>=''
|
||
|
END
|
||
|
IF ANS # '' THEN
|
||
|
OREC<A>=ANS
|
||
|
END
|
||
|
NEXT A
|
||
|
RETURN
|
||
|
2000 *
|
||
|
ACT=DCOUNT(LAYOUT<1>,VM)
|
||
|
FOR A=1 TO ACT
|
||
|
ALEN=LEN(LAYOUT<2,A>)
|
||
|
IF A=7 THEN
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OCONV(IREC<A>,'MTS')
|
||
|
END ELSE
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":IREC<A>
|
||
|
END
|
||
|
NEXT A
|
||
|
RETURN
|
||
|
3000 *
|
||
|
CRT @(0,22):CL:"Enter # change, 'E'(end), 'D'(delete) else RETURN ":
|
||
|
INPUT A
|
||
|
IF A='E' THEN GOSUB 4000; GO 10
|
||
|
IF A='D' THEN GOSUB 4200; GO 10
|
||
|
IF A >=1 AND A <=ACT THEN
|
||
|
ALEN=LEN(LAYOUT<2,A>)
|
||
|
CRT @(0,22):CL:LAYOUT<3,A>:
|
||
|
IF A=7 THEN
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OCONV(OREC<A>,'MTS'):CL
|
||
|
END ELSE
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OREC<A>:CL
|
||
|
END
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":
|
||
|
INPUT ANS
|
||
|
IF ANS='?' THEN
|
||
|
GOSUB 9000
|
||
|
CRT @(0,5):CR
|
||
|
GOSUB 2000
|
||
|
A=5
|
||
|
ALEN=LEN(LAYOUT<2,A>)
|
||
|
END
|
||
|
IF ANS # '' THEN
|
||
|
IF A=7 THEN
|
||
|
OREC<A>=ICONV(ANS,'MT')
|
||
|
END ELSE
|
||
|
OREC<A>=ANS
|
||
|
END
|
||
|
END
|
||
|
IF A=7 THEN
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OCONV(OREC<A>,'MTS'):CL
|
||
|
END ELSE
|
||
|
CRT @(CENTER,7+A):A:" ":LAYOUT<2,A>:STR(" ",XLEN-ALEN):": ":OREC<A>:CL
|
||
|
END
|
||
|
GO 3000
|
||
|
END
|
||
|
CRT @(0,22):CL:"NO SELECTION MADE":
|
||
|
RQM
|
||
|
GO 10
|
||
|
RETURN
|
||
|
4000 *
|
||
|
IF OREC<6> ="" THEN
|
||
|
CRT CS:BEEP:@(10,10):"NO UPDATE IS ALLOWED TO THIS RECORD WITHOUT A VALID EMPLOYEE #!"
|
||
|
CRT @(10,11):"PLEASE SEE THE ACCOUNTING DEPARTMENT FOR AN EMPLOYEE # NOW!"
|
||
|
RQM;RQM
|
||
|
END ELSE
|
||
|
IF OREC<43>='' THEN OREC<43>='C'
|
||
|
WRITE OREC ON OFILE,KEY
|
||
|
CRT @(0,22):CL:"RECORD UPDATED":
|
||
|
RQM
|
||
|
END
|
||
|
RETURN
|
||
|
4200 *---- delete a user --------------------------------------*
|
||
|
CRT @(0,22):CL:BEEP:RV:" ARE YOU SURE YOU WANT TO DELETE USER ":KEY:" (Y/N) :":ERV:
|
||
|
INPUT DELANS,9
|
||
|
IF DELANS[1,1]='Y' THEN
|
||
|
DELETE OFILE,KEY
|
||
|
CRT @(0,22):CL:BEEP:RV:" USER HAS BEEN DELETED! <return> :":ERV:
|
||
|
INPUT ANY,4
|
||
|
RETURN
|
||
|
END
|
||
|
CRT @(0,22):CL:BEEP:RV:" USER HAS NOT BEEN DELETE! <return> :":ERV:
|
||
|
INPUT ANY,4
|
||
|
RETURN
|
||
|
*
|
||
|
9000 * HELP
|
||
|
IF LAYOUT<4,A> # '' THEN
|
||
|
OPEN LAYOUT<4,A> TO HFILE ELSE
|
||
|
CRT @(0,22):"HELP FILE ":LAYOUT<4,A>:" NOT FOUND!":CL
|
||
|
RQM
|
||
|
GO 9099
|
||
|
END
|
||
|
HELP.TBL=''
|
||
|
SELECT HFILE
|
||
|
LOOP
|
||
|
READNEXT HKEY ELSE HKEY='EOF'
|
||
|
UNTIL HKEY='EOF' DO
|
||
|
LOCATE(HKEY,HELP.TBL,1;INDX;'AR') ELSE
|
||
|
READV HDESC FROM HFILE,HKEY,1 ELSE HDESC='UNKNOWN'
|
||
|
HELP.TBL=INSERT(HELP.TBL,1,INDX;HKEY)
|
||
|
HELP.TBL=INSERT(HELP.TBL,2,INDX;HDESC)
|
||
|
END
|
||
|
REPEAT
|
||
|
ANS=''
|
||
|
GOSUB 9500
|
||
|
END ELSE
|
||
|
CRT @(0,22):"NO HELP AVAILABLE FOR THIS PROMPT!":CL
|
||
|
RQM
|
||
|
END
|
||
|
9099 *
|
||
|
RETURN
|
||
|
9500 * HELP HEADER
|
||
|
POS=6; COL=0
|
||
|
CRT @(COL,POS):CR
|
||
|
GOSUB 2225
|
||
|
TSTRING=LAYOUT<2,A>'L#9':"DESCRIPTION"'L#27'
|
||
|
CRT @(COL+2,POS):TSTRING
|
||
|
CRT @(COL+42,POS):TSTRING
|
||
|
*
|
||
|
X=0;XX=0; MAX=14; SW=0; COL=2
|
||
|
XCT=DCOUNT(HELP.TBL<1>,VM)
|
||
|
LOOP
|
||
|
X=X+1
|
||
|
XX=XX+1
|
||
|
TSTRING=HELP.TBL<1,X>'L#9':HELP.TBL<2,X>[1,27]'L#27'
|
||
|
CRT @(COL,POS+XX):TSTRING
|
||
|
IF INT(XX/MAX) THEN
|
||
|
SW=SW+1
|
||
|
IF REM(SW,2) THEN
|
||
|
COL=42
|
||
|
END ELSE
|
||
|
COL=2
|
||
|
GOSUB 9600
|
||
|
END
|
||
|
XX=0
|
||
|
END
|
||
|
UNTIL ANS # '' DO REPEAT
|
||
|
IF ANS='/' THEN ANS=''
|
||
|
RETURN
|
||
|
*
|
||
|
9600 *
|
||
|
CRT @(0,22):RV:"Enter ":LAYOUT<2,A>:", N(next page), B(back page)":ERV:CL:
|
||
|
INPUT ANS2:
|
||
|
IF ANS2='' OR ANS2='/' THEN
|
||
|
ANS='/'
|
||
|
GO 9699
|
||
|
END
|
||
|
IF ANS2='B' THEN
|
||
|
X=X-(XX+(MAX*3))
|
||
|
IF X < 0 THEN X=0
|
||
|
SW=0
|
||
|
END ELSE
|
||
|
IF ANS2='N' THEN
|
||
|
IF X > XCT THEN
|
||
|
CRT @(0,22):"End of list!":CL
|
||
|
RQM
|
||
|
GO 9600
|
||
|
END
|
||
|
END ELSE
|
||
|
LOCATE(ANS2,HELP.TBL,1;INDX) THEN
|
||
|
ANS=ANS2
|
||
|
END ELSE
|
||
|
CRT @(0,22):RV:BEEP:"INVALID CODE - Try Again!":ERV:CL:
|
||
|
END
|
||
|
END
|
||
|
END
|
||
|
9699 *
|
||
|
RETURN
|
||
|
2225 * DRAW BOX
|
||
|
IF ADDS THEN
|
||
|
FOR X=POS TO 21
|
||
|
IF X=POS THEN
|
||
|
TSTRING1="#"
|
||
|
TCOL=COL; TPOS=X; GOSUB 2275
|
||
|
TSTRING1="L"
|
||
|
TCOL=COL+39; GOSUB 2275
|
||
|
TSTRING1="D"
|
||
|
TCOL=COL+79; GOSUB 2275
|
||
|
END ELSE
|
||
|
IF X=21 THEN
|
||
|
TSTRING1="B":STR("<",38):"M":STR("<",39):"F"
|
||
|
TCOL=COL; TPOS=X; GOSUB 2275
|
||
|
END ELSE
|
||
|
TSTRING1=">"
|
||
|
TCOL=COL; TPOS=X; GOSUB 2275
|
||
|
TCOL=COL+39; GOSUB 2275
|
||
|
TCOL=COL+79; GOSUB 2275
|
||
|
END
|
||
|
END
|
||
|
NEXT X
|
||
|
END ELSE
|
||
|
FOR X=POS TO 21
|
||
|
IF X=POS THEN
|
||
|
TSTRING1="|"
|
||
|
TCOL=COL; TPOS=X; GOSUB 2285
|
||
|
TSTRING1="|"
|
||
|
TCOL=COL+39; GOSUB 2285
|
||
|
TSTRING1="|"
|
||
|
TCOL=COL+79; GOSUB 2285
|
||
|
END ELSE
|
||
|
IF X=21 THEN
|
||
|
TSTRING1=STR("~",80)
|
||
|
TCOL=COL; TPOS=X; GOSUB 2285
|
||
|
END ELSE
|
||
|
TSTRING1="|"
|
||
|
TCOL=COL; TPOS=X; GOSUB 2285
|
||
|
TCOL=COL+39; GOSUB 2285
|
||
|
TCOL=COL+79; GOSUB 2285
|
||
|
END
|
||
|
END
|
||
|
NEXT X
|
||
|
END
|
||
|
RETURN
|
||
|
2275 * PRINT GRAPHICS
|
||
|
CRT CHAR(27):CHAR(72):CHAR(2)
|
||
|
CRT @(TCOL,TPOS):TSTRING1:
|
||
|
CRT CHAR(27):CHAR(72):CHAR(3)
|
||
|
RETURN
|
||
|
2285 * PRINT LINE
|
||
|
CRT @(TCOL,TPOS):TSTRING1:
|
||
|
RETURN
|