	REMARK	**************************************************\
		*  P/R020.BAS  EMPLOYEE MASTER FILE MAINTENANCE  *\
		*     4/17/79                       4:45 PM      *\
		**************************************************

%INCLUDE CURSOR
%INCLUDE PRNMASK

	DIM S(96),R1(2),T2(8),R$(5),R2(5),G3(5),G2$(5)
	DEF FNR(A1)=INT(A1 * 100 + .05)/100				REMARK  ROUNDING FUNCTION
	GOTO 6000

%INCLUDE SUBS1
%INCLUDE MSTROUT
%INCLUDE MSTRIN
%INCLUDE GENINFO

5300  X1=F%* 64 + 199							REMARK  CHANGE EMPLOYEE NAME OR ADDRESS LINE
	X2=22
	X3=0
	X4=0
	GOSUB 345
	R$(F%)=X0$
	RETURN 


5350	X1=303								REMARK  CHANGE SOCIAL SECURITY NUMBER
	GOSUB 210
	PRINT "            "
	X1=303
	X2=9
	X3=0
	X4=999999999
	GOSUB 345
	X1=303
	R1(1)=X0
	GOSUB 760
	PRINT
	RETURN 


5400	IF F%=9 THEN\							REMARK  CHANGE EMPLOYEE TYPE CODE
	X1=652:\
	X2=2:\
	X3=0:\
	X4=99:\
	GOSUB 345:\
	R2(1)= X0:\
	RETURN 


5405	IF F%<=8  THEN\							REMARK  CHANGE FEDERAL STATE OR ADDITIONAL EXEMPTIONS
	X1=495:\
	X2=1:\
	X3=0:\
	X4=9:\
	GOSUB 345:\
	R2(5)= X0:\
	RETURN 
5410	X1=(F%-10) * 64 + 716
	X2=2
	X3=0
	X4=99
	GOSUB 345
	R2(F%-9)= X0
	RETURN 


5450	X1=716								REMARK  CHANGE MARITAL STATUS
	X2=1
	X3=0
	X4=0
	GOSUB 345
	R3$= X0$
	IF R3$="M" THEN RETURN
	IF R3$="S" THEN RETURN
	IF R3$="H" THEN RETURN
	X2$="M, S OR H ONLY"						REMARK  IF IMPROPER MARITAL STATUS, RE-PROMPT FOR ENTRY
	GOSUB 615
	GOTO 5450


5500	IF F% <>7 THEN A4=1002 ELSE A4=431
	X1=A4:GOSUB 673							REMARK  CHANGE DATE OF EMPLOYMENT OR LAST CHECK DATE
	IF F%=7 THEN S(2)=X0 ELSE S(4)=X0
	RETURN 


5550	X1=367								REMARK  CHANGE EMPLOYEE INSURANCE CLASS
	X2=2
	X3=0
	X4=99
	GOSUB 345
	S(3)= X0
	RETURN


5600	X1=940								REMARK  CHANGE LAST CHECK NUMBER
	X2=6
	X3=0
	X4=999999
	GOSUB 345
	S(5)= X0
	RETURN 


									REMARK  CHANGE HEALTH & WELFARE RATE, M-T-D HOURS, PAY
5650	IF F%<15 THEN X1=972 ELSE X1=(F%-14)*64 + 617			REMARK  OR VACATION HOURS REMAINING
5655	X2=9
	X3=0
	X4=9999.9999
	GOSUB 345							REMARK  ENTER HOURS
	IF F%=18  THEN S(14)=X0:RETURN					REMARK  IF VACATION HOURS ENTERED, SAVE AND RETURN
	IF F% <= 15  THEN S(F%-6)=X0:RETURN
5665	S(F%-10)= X0
	RETURN 


5670	X1=F%*64 + 217							REMARK  REMARK CHANGE SPECIAL INFORMATION FIELDS 1-3
	X2=9
	X3=0
	X4=999999.99
	GOSUB 345
	IF F%=1 THEN S(10)=X0:RETURN
	S(F%+13)=X0
	RETURN 


5700	IF F%>=12  THEN X1=302+64*(F%-11) ELSE X1=272+64*F%		REMARK  SET ENTRY COORDINATES FOR PROPER FIELD
5705	X2=9
	X3=0
	X4=999999.99							REMARK  ENTER AMOUNT
	GOSUB 345
	Z%=24*(B%-1) + F%
	IF F%>10 THEN S(Z%+1)=X0:RETURN
5715	S(Z%)=X0							REMARK  SAVE ENTERED AMOUNT IN MASTER FILE FIELD
	RETURN 


5720	IF B%=2 THEN Z%=25						REMARK  SET POINTER OFFSETS FOR ACCUMULATION
	IF B%=3 THEN Z%=49						REMARK  OF TOTALS FOR EMPLOYEE
	IF B%=4 THEN Z%=73
	S(Z%+10) = S(Z%+1)+S(Z%+3)+S(Z%+5)+S(Z%+6)+S(Z%+8)+S(Z%+9)
	S(Z%+17) = S(Z%+12)+S(Z%+13)+S(Z%+14)+S(Z%+15)+S(Z%+16)		REMARK  PAY AND DEDUCTION AMOUNTS ON FILE
	X1 = 640
	GOSUB 210
	GOSUB 7105							REMARK  DISPLAY TOTAL AMOUNTS ON SCREEN
	RETURN


6000	OPEN "P/R0F110.DAT" RECL 1150 AS 1,"CRT" RECL 1100 AS 19	REMARK  OPEN EMPLOYEE MASTER AND CRT MASK FILES
	OPEN "G/I0F010.DAT" RECL 200 AS 3:Y9=3
	GOSUB 700							REMARK  READ GENERAL INFORMATION FILE
6005	X0=3:GOSUB 260
	C2%=1
	B%=0
	X2=1
	X3=1
	X4=5
	X2$="ENTER OPERATION CODE (1=ADD,2=CHANGE,3=POST,4=DELETE,5=EXIT)"
	GOSUB 665							REMARK  REQUEST OPERATION CODE
	C%=X0
	IF C%=5 THEN PRINT CLEAR.SCREEN$;\				REMARK  IF PERATION CODE 5 SELECTED, LOAD MENU
	"P/R MASTER F/M LOADING MENU":CHAIN "P/R000"
6007	X2=3
	X3=0
	X4=999     
	X2$="ENTER EMPLOYEE NUMBER"
	GOSUB 665							REMARK  ENTER EMPLOYEE NUMBER
	IF  X0=0 THEN 6005						REMARK  IF NONE ENTERED, PROMPT FOR OPERATION CODE
	IF X0 > MSTR.RECORDS THEN X2$="OUT OF RANGE":GOSUB 615:GOTO 6007
	GOSUB 745							REMARK  GET MASTER RECORD FROM FILE

	ON C% GOSUB 6100,6200,6300,6500					REMARK  BRANCH BASED ON CURRENT OPERATION CODE
	GOTO 6005


6100	IF S(1)>0 THEN X2$="ALREADY ON FILE":GOSUB 615:RETURN		REMARK  ADD EMPLOYEE MASTER RECORD TO FILE

	DIM S(96),R$(5),R1(2),R2(5)					REMARK  RE-INITIALIZE EMPLOYEE MASTER FILE FIELDS
	R3$=""
	S(1)=X0

6105	B%=1

	FOR F%=1 TO 4
	GOSUB 5300							REMARK  ENTER EMPLOYEE NAME AND ADDRESS
	NEXT F%

	GOSUB 5350							REMARK  ENTER SOCIAL SECURITY NUMBER
	GOSUB 5550							REMARK  ENTER INSURANCE CLASS CODE

	F%=7
	GOSUB 5500							REMARK  ENTER DATE OF EMPLOYMENT

	FOR F%=8 TO 9
	GOSUB 5400							REMARK  ENTER EMPLOYEE CLASS AND PAY TYPE
	NEXT F%

	GOSUB 5450							REMARK  ENTER EMPLOYEE MARITAL STATUS

	FOR F%=11  TO 13
	GOSUB 5400							REMARK  ENTER EMPLOYEE CLASS CODE AND EMPLOYEE TYPE
	NEXT F%

	FOR F%=14 TO 18
	GOSUB 5650							REMARK  ENTER HEALTH & WELFARE RATE, M-T-D HOURS,\
									        M-T-D PAY AND VACATION HOURS REMAINING
	NEXT F%	

	GOSUB 5600							REMARK  ENTER LAST CHECK NUMBER FOR EMPLOYEE

	F%=20:GOSUB 5500						REMARK  ENTER DATE OF LAST CHECK
 
6110	FOR B%=2 TO 4
	GOSUB 7000							REMARK  SEQUENTIALLY ENTER CURRENT, Q-T-D AND Y-T-D\
									        DOLLAR AMOUNTS FOR NEW EMPLOYEE
	X2=1
	X3=0
	X4=1
	X2$="ENTER REMAINING PERIODS?"
	GOSUB 665							REMARK  ENTER '0' IF DONE WITH ENTRIES; '1' IF NOT
	IF  X0 > 0 THEN\
	FOR F%=1 TO 16:\
	GOSUB 5700:\							REMARK  ENTER ALL AMOUNT FIELDS
	NEXT F%:\
	GOSUB 5720\							REMARK  WHEN DONE, RE-DISPLAY ALL AMOUNT ENTRIES
	ELSE B%=4							REMARK  IF '0' WAS ENTERED, TERMINATE THE LOOP
	NEXT B%
6115	GOSUB 6205							REMARK   CHANGE FIELDS IF NEEDED, THEN SAVE RECORD
	RETURN


									REMARK  ****    CHANGE EMPLOYEE MASTER RECORD    ****
6200	IF S(1)=0 THEN X2$="NOT ON FILE":GOSUB 615:RETURN		REMARK  IF RECORD IS LOGICALLY DELETED, EXIT ROUTINE
6205	B%=1
	GOSUB 7000							REMARK  DISPLAY HEADER PORTION OF RECORD
	C1%=93
6210	X2=2:X3=0:X4=94:X2$="ENTER FIELD TO CHANGE":GOSUB 665		REMARK  PROMPT FOR FIELD TO CHANGE
	F%=X0
	IF F%>=90 THEN B%=F%-89:GOSUB 7000:GOTO 6210			REMARK  IF OTHER MASK WAS REQUESTED, DISPLAY IT
	IF F% > 20 THEN GOTO 6210					REMARK  IF FIELD NUMBER WAS INVALID, RE-PROMPT

6215	IF F%=0 THEN X0=S(1):GOSUB 750:RETURN				REMARK  IF FIELD TO CHANGE = 0, SAVE RECORD AND RETURN
	IF B%>1 THEN 6250
	IF F%<= 4 THEN GOSUB 5300:GOTO 6210				REMARK  CHANGE EMPLOYEE NAME/ADDRESS IF F <= 4
	IF F%<=5 THEN GOSUB 5350:GOTO 6210				REMARK  CHANGE SOCIAL SECURITY NUMBER
	IF F%=10 THEN GOSUB 5450:GOTO 6210				REMARK  CHANGE EMPLOYEE MARITAL STATUS
	IF F%>=8 AND F%<=13 THEN GOSUB 5400:GOTO 6210			REMARK  CHANGE EXEMPTION FIELDS

	IF F% > 13 AND F% < 19 THEN GOSUB 5650:GOTO 6210		REMARK  CHANGE PAY,H&W RATES, M-T-D HRS OR PAY
	IF F%=19 THEN GOSUB 5600:GOTO 6210				REMARK  CHANGE LAST CHECK NUMBER
	IF F%=20 OR F%=7 THEN GOSUB 5500:GOTO 6210			REMARK  CHANGE DATE OF LAST CHECK
	IF F%=6 THEN GOSUB 5550:GOTO 6210				REMARK  CHANGE INSURANCE CLASS CODE
6250	IF B%=5 THEN 6295
	IF F%>16 THEN 6210
	GOSUB 5700							REMARK  ENTER CURRENT, Q-T-D OR Y-T-D AMOUNT
	GOSUB 5720							REMARK  RE-DISPLAY AMOUNT TOTALS
	GOTO 6210
6295	IF F%<=3 THEN GOSUB 5670						REMARK  CHANGE SPECIAL INFORMATION FIELDS 1 TO 3
	GOTO 6210



6300	IF S(1)=0 THEN X2$="NOT ON FILE":GOSUB 615:RETURN		REMARK  ROUTINE TO POST MANUALLY-WRITTEN CHECKS
	B%=1
	GOSUB 7005							REMARK  DISPLAY HEADER MASK
	X2=1
	X3=0
	X4=1
	X2$="ENTER 1 TO POST"
	GOSUB 665							REMARK  ENTER '1' TO START POSTING
	IF X0=0 THEN RETURN						REMARK  GO BACK TO EMPLOYEE NUMBER PROMPT IF REPLY=0
	GOSUB 5600							REMARK  ENTER CHECK DATE
	GOSUB 5500							REMARK  ENTER CHECK NUMBER FOR MANUAL CHECK
	B%=4
	GOSUB 7000							REMARK  DISPLAY CURRENT AMOUNT FIELDS
	FOR F%=1 TO 16
	GOSUB 5700							REMARK  ENTER EACH CURRENT AMOUNT FIELD MANUALLY
	NEXT F%
	GOSUB 5720							REMARK  DISPLAY CURRENT AMOUNT TOTALS FOR CHECK
	C1%=16
	GOSUB 6210							REMARK  ALLOW OPERATOR CHANGES TO FIELDS 1-16
	FOR I%=25 TO 42
	S(I%)=S(I%) + S(I% + 48)					REMARK  ACCUMULATE POSTING TOTALS
6303	A1=(INT(S(4)/10000)-1)/3
	IF A1=INT(A1) AND G3(4)=1 THEN S(I%+24)=0			REMARK  IF NEW QUARTER, ZERO OUT Q-T-D TOTALS
6305	S(I%+24) = S(I%+24) + S(I%+48)					REMARK  ACCUMULATE POSTING TOTALS : Q-T-D AND Y-T-D
	NEXT I%
6307	IF R2(1)<>1 THEN X0=80 ELSE X0=1				REMARK  SET WAGE DIVISOR BASED ON EMPLOYEE TYPE
6308	X0=S(76)-FNR(S(8)/X0 * S(75))					REMARK  IF OVERTIME HOURS, CALCULATE O/T PAY
	IF R2(5)<>1 THEN 6310

	IF S(7)+S(83)-S(84)-X0 >= 1733 THEN\				REMARK  ADD TO INSURANCE-EXCLUDABLE AMOUNT
	S(10)=S(10)+S(83)-S(84)-X0 ELSE GOTO 6310
	IF S(7)<=1733 THEN S(10)=S(10)+S(7)-1733			
6310	S(7)=S(7) + S(83)-S(84)						REMARK  ADD NET CHECK TO M-T-D PAY
6320	S(6)=S(6) + S(73) + S(75) + S(77) + S(80)			REMARK  ADD TO TOTAL M-T-D HOURS
	S(10)=S(10) +  X0						REMARK  ADD TO INSURANCE-EXCLUDABLE AMOUNT
	X2$="POSTED"
	GOSUB 615							REMARK  FLASH MESSAGE THAT EMPLOYEE RECORD WAS POSTED
	X0=S(1)
	GOSUB 750							REMARK  RE-SAVE EMPLOYEE RECORD
	RETURN
6500	IF S(1)=0 THEN X2$="NOT ON FILE":GOSUB 615:RETURN
	B%=1
	GOSUB 745							REMARK  READ EMPLOYEE MASTER RECORD
	GOSUB 7000							REMARK  DISPLAY HEADER INFORMATION
	X2=3
	X3=0
	X4=0
	X2$="ENTER DELETE CODE TO DELETE RECORD"
	GOSUB 665
	IF  X0$<>"DEL" THEN RETURN					REMARK  ENTER DELETE CODE; REJECT INCORRECT CODE
	X0=S(1)
	S(1)=0								REMARK  RECORD IS DELETED BY SETTING S(1)=0
	GOSUB 750
	X2$="RECORD DELETED":GOSUB 615					REMARK  FLASH RECORD DELETION MESSAGE TO OPERATOR
	RETURN 



7000	IF B%=5 THEN 7110						REMARK  DISPLAY APPROPRIATE MASK AND EMPLOYEE DATA
	X0=SGN(B%-1)+3
	GOSUB 260							REMARK  READ AND DISPLAY APPROPRAITE CRT MASK
	IF B%=0 THEN 7030
7005	X1=37
	GOSUB 210
	PRINT S(1);"     "						REMARK  DISPLAY EMPLOYEE NUMBER
	PRINT
	IF B%>1 THEN 7100
	PRINT:PRINT
	FOR I%=1 TO 4
	X1=8
	GOSUB 215
	PRINT R$(I%)							REMARK  DISPLAY EMPLOYEE NAME AND ADDRESS
	NEXT I%
7010	PRINT
	PRINT 
	X1=12
	GOSUB 215
	PRINT R2(1);" "							REMARK  DISPLAY EMPLOYEE TYPE CODE
	X1=13
	GOSUB 215
	PRINT R3$							REMARK  DISPLAY MARITAL STATUS CODE
	FOR I%=2 TO 4
	X1=12
	GOSUB 215
	PRINT R2(I%)							REMARK  DISPLAY EMPLOYEE EXEMPTIONS
	NEXT I%
	X1=13
	GOSUB 215
	PRINT USING  MASK4.4$;S(8);					REMARK  DISPLAY EMPLOYEE PAY RATE
	X1=303
	X0=R1(1)
	GOSUB 760							REMARK  DISPLAY SOCIAL SECURITY NUMBER
	PRINT 
	X1=47
	GOSUB 215
	PRINT S(3);" "							REMARK  DISPLAY INSURANCE CLASS CODE
	X1=48
	GOSUB 215
	X0=S(2):GOSUB 680.5						REMARK  DISPLAY DATE OF EMPLOYMENT
	PRINT 
	X1=47
	GOSUB 215
	PRINT R2(5):PRINT:PRINT						REMARK  DISPLAY EMPLOYEE CLASS CODE
	X1=42:GOSUB 215
	PRINT USING  MASK4.4$;S(9)					REMARK  DISPLAY HEALTH & WELFARE RATE
7020	FOR I%=6 TO 7
	X1=42:GOSUB 215
	PRINT USING  MASK4.4$;S(I%)					REMARK  DISPLAY MONTHLY HOURS AND PAY
	NEXT I%
	X1=42:GOSUB 215
	PRINT USING  MASK4.4$;S(14)					REMARK  DISPLAY VACATION HOURS REMAINING
	X1=45:GOSUB 215
	PRINT USING MASK6$;S(5)						REMARK  DISPLAY LAST CHECK NUMBER
	X1=43:GOSUB 215
	X0=S(4)
	GOSUB 680.5							REMARK  DISPLAY LAST CHECK DATE
	RETURN 
7030	X1=64
	GOSUB 210
	RETURN
7100	X1=0:GOSUB 210
	IF B%=2 THEN PRINT "    YTD";
	IF B%=3 THEN PRINT "    QTD";
	IF B%=4 THEN PRINT "CURRENT";
7103	Z%=25 + 24 * (B%-2)						REMARK  DISPLAY CURRENT, Q-T-D OR Y-T-D EMPLOYEE TOTALS
	PRINT:PRINT:PRINT:PRINT:PRINT
	FOR I%=Z% TO Z% + 9
	X1=17
	GOSUB 215
	PRINT USING  MASK6.2$;S(I%)					REMARK  DISPLAY AMOUNT FIELD
	NEXT I%
	X1=17:GOSUB 215
	PRINT USING  MASK6.2$;S(Z% + 11);				REMARK  DISPLAY NON-TAXABLE PAY
	X1=320:GOSUB 210
	Z%=37 + 24 * (B%-2)
	FOR I%=Z% TO Z% + 4
	X1=47
	GOSUB 215
	PRINT USING  MASK6.2$;S(I%)					REMARK  DISPLAY DEDUCTION AMOUNT
	NEXT I%
7105	Z%=(B%-2)*24 + 35						REMARK  DISPLAY CURRENT, Q-T-D OR Y-T-D PAYROLL TOTALS
	Z1%=Z% + 7
	X1=47
	GOSUB 215
	PRINT USING MASK6.2$;S(Z%)					REMARK  DISPLAY TOTAL PAY FOR PERIOD
	X1=47
	GOSUB 215
	PRINT USING MASK6.2$;S(Z1%)					REMARK  DISPLAY TOTAL DEDUCTIONS FOR PERIOD
	X1=47
	GOSUB 215
	PRINT USING  MASK6.2$;S(Z%)-S(Z1%)				REMARK  DISPLAY TOTAL NET PAY FOR PERIOD
	RETURN 


7110	PRINT CLEAR.SCREEN$;"SPECIAL INFORMATION FOR EMPLOYEE ";S(1)	REMARK  DISPLAY SPECIAL INFORMATION FOR EMPLOYEE
	PRINT 
	PRINT 
	PRINT
	PRINT "1. INSURANCE EXCLUSION";TAB(26);
	PRINT USING  MASK6.2$;S(10)
	PRINT "2. SPARE";TAB(26);
7115	PRINT USING  MASK6.2$;S(15)
	PRINT "3. SPARE";TAB(26);
	PRINT USING MASK6.2$;S(16)
	RETURN 
