	REMARK	*********************************************\
		*  P/R06B.BAS  TRANSACTION FILE MAINTENANCE *\
		*     5/16/79			11:00 AM    *\
		*********************************************

	DIM P$(7),W$(5),T2(8),G3(5),G2$(5)
%INCLUDE PRNMASK
%INCLUDE CURSOR

	GOTO 6000

%INCLUDE SUBS1
%INCLUDE GENINFO
780	IF END #Y4 THEN 795
	READ #Y4,X0;T2(1),T2(2),T2(3),T2(4),T2(5),T2(6),T2(7),T2(8)	REMARK  READ TRANSACTION RECORD
	RETURN
795	R1=99:RETURN

800	PRINT #Y4,X0;T2(1),T2(2),T2(3),T2(4),T2(5),T2(6),T2(7),T2(8)	REMARK  WRITE TRANSACTION RECORD
	RETURN

									REMARK  *****  LINE PRINTER ROUTINE  *****



825	A1=59								REMARK  SET CARRIAGE WIDTH
	IF LINE.COUNT% < 55 THEN RETURN					REMARK  IF SPACE REMAINS ON REPORT PAGE, RETURN
	PRINT CHR$(12);
	P=P+1
	PRINT
	PRINT TAB((A1-LEN(G2$(1)))/2);G2$(1);TAB(A1);"DATE ";
	X0=G3(1):GOSUB 680.5						REMARK  PRINT TODAY'S DATE
	PRINT
	PRINT TAB((A1-LEN(X4$))/2);X4$;TAB(A1);"PAGE ";P
	PRINT TAB((A1-6)/2);"DAY";G3(5)
	PRINT
	PRINT " LOC.  EMP.  DAY  PT  HOURS  WT  JOB NO.  DEPT   AMOUNT"
	PRINT
	LINE.COUNT%=6							REMARK  RESET LINE COUNTER FOR NEW PAGE
	RETURN


5300	X1=530:X2=1:X3=0:X4=6:GOSUB 345					REMARK  CHANGE PAY TYPE
	T2(3)=X0
	X1=530:GOSUB 210
	PRINT USING "#  /123456789012/";T2(3),P$(T2(3)+1)		REMARK  DISPLAY PAY TYPE AND CORRESPONDING DESCRIPTION
	RETURN


5350	X1=594:X2=1:X3=0:X4=4:GOSUB 345					REMARK  CHANGE WORK TYPE
	T2(4)=X0
	X1=594:GOSUB 210
	PRINT USING "#  /123456789012/";T2(4),W$(T2(4)+1)		REMARK  DISPLAY WORK TYPE AND CORRESPONDING DESCRIPTION
	RETURN


5400	X1=653:X2=6:X3=0:X4=999999:GOSUB 345				REMARK  CHANGE JOB NUMBER
	T2(6)=X0
	RETURN



5450	X1=721:X2=2:X3=0:X4=99						REMARK  CHANGE DEPARTMENT NUMBER
	GOSUB 345
	T2(5)=X0
	RETURN


5500	X1=782:X2=5:X3=0:X4=99.99:GOSUB 345				REMARK  CHANGE HOURS
	T2(7)=X0
	RETURN


5550	X1=844:X2=7:X3=0:X4=9999.99:GOSUB 345				REMARK  CHANGE AMOUNT
	T2(8)=X0
	RETURN



6000	MASKA$="   # /13456789012/"					REMARK  SET UP PRINT MASKS
	MASKB$="#### /134567890123456789012/"
	MASKC$="  ## /13456789012345678901234 /"
	MASKD$="####  ####   ##   #"

%INCLUDE PRNMASK

	Y4=1:Y9=2
	OPEN "P/R0F040.DAT" RECL 42 AS 1				REMARK  OPEN PAYROLL TRANSACTION FILE
	OPEN "G/I0F010.DAT" RECL 200 AS Y9:GOSUB 700			REMARK  OPEN AND LOAD GENERAL INFORMATION FILE
	OPEN "CRT" RECL 1100 AS 19

	P$(1)="SALARY"							REMARK  SET UP PAY TYPE DESCRIPTIONS
	P$(2)="HOURLY"
	P$(3)="VACATION"
	P$(4)="HOLIDAY"
	P$(5)="PIECE WORK"
	P$(6)="OVERTIME"
	P$(7)="COMP TIME"

	W$(1)="N/A"							REMARK  SET UP WORK TYPE DESCRIPTIONS
	W$(2)="PHASE 1"
	W$(3)="PHASE II"
	W$(4)="NO JOB NO."
	W$(5)="JOB NO."

	X0=6:GOSUB 260							REMARK  LOAD TRANSACTION F/M CRT MASK

6020	CONSOLE
	IF B>0 THEN GOSUB 265
	X2=1:X3=0:X4=2
	X2$="ENTER OPERATION (1=PRINT; 2=CHANGE OR DELETE; 0=END)"	REMARK  ENTER OPERATION CODE
	GOSUB 665

	IF X0=0 THEN PRINT CLEAR.SCREEN$;:\				REMARK  IF CODE=0, TERMINATE PROGRAM AND LOAD MENU
	PRINT "P/R TRANSACTION FILE MAINTENANCE LOADING MENU":\
	CHAIN "P/R000"

	OPERATION.CODE=X0
	IF OPERATION.CODE=2 THEN GOTO 6300


6100	X1=275:X2=4:X3=0:X4=9999:GOSUB 345				REMARK  ENTER START TRANSACTION REFERENCE NUMBER
	B=X0
	IF B=0 THEN 6020						REMARK  IF ZERO WAS ENTERED, PROMPT FOR OPERATION CODE

	X1=286:X2=4:X3=B:X4=9999:GOSUB 345				REMARK  ENTER END TRANSACTION NUMBER
	E=X0

	X2=1:X3=0:X4=1:X2$="ENTRY CORRECT":GOSUB 665			REMARK VERIFY ENTRY
	IF X0 <> 1 THEN 6100
	CLOSE Y4
	OPEN "P/R0F040.DAT" RECL 42 AS Y4
	Z=0:S2=0:R1=0:P=0						REMARK  SET EMPLOYEE VARIABLE, EOF FLAG AND PAGE COUNT

	LINE.COUNT%=60
	LPRINTER							REMARK  SET PRINTER AS OUTPUT DEVICE
	X4$="PAYROLL TRANSACTION REPORT"
	FIRST.EMPL=1

6120	X0=B								REMARK  READ TRANSACTION RECORD FROM FILE
	GOSUB 780

	IF R1=99 OR B>E THEN Z=9000000000:GOTO 6145			REMARK  PRINT LAST EMPLOYEE TOTALS

	IF T2(1)=S2 THEN 6170						REMARK  PRINT DETAIL IF EMPLOYEE HAS NOT CHANGED

	IF FIRST.EMPL=1 THEN FIRST.EMPL=0:GOTO 6167			REMARK  IF FIRST RECORD, DON'T BREAK FOR TOTALS

	IF S1=0 THEN 6155						REMARK  DON'T BREAK FOR TOTALS IF ONLY ONE TRANSACTION\
									        EXISTS FOR THIS EMPLOYEE

6145	GOSUB 825							REMARK  CHECK FOR END OF REPORT PAGE
	PRINT TAB(20);:PRINT USING MASK4.2$;S1				REMARK  PRINT EMPLOYEE TOTAL 
	LINE.COUNT%=LINE.COUNT%+1

6155	PRINT								REMARK  SPACE ONE LINE AND SET EMPLOYEE TOTAL TO ZERO
	LINE.COUNT%=LINE.COUNT%+1
	S1=0

	IF Z=9000000000 THEN 6020					REMARK  IF END OF RANGE, PROMPT FOR OPERATION CODE

6167	S2=T2(1)

6170	LINE.COUNT%=LINE.COUNT%+1
	GOSUB 825							REMARK  CHECK FOR END OF PAGE

	S1=S1+T2(7)							REMARK  ACCUMULATE HOURS FOR THIS EMPLOYEE'S TRANSACTIONS
	PRINT USING MASKD$;B,T2(1),T2(2),T2(3);				REMARK  PRINT EMPLOYEE NUMBER,DAY NUMBER AND PAY TYPE

	IF T2(7)>0 THEN PRINT "  ";:PRINT USING MASK2.2$;T2(7);		REMARK  PRINT HOURS IF GREATER THAN ZERO

	PRINT TAB(29);
	IF T2(4)>0 THEN PRINT T2(4);					REMARK  PRINT WORK TYPE IF GREATER THAN ZERO

	PRINT TAB(33);
	IF T2(6)>0 THEN PRINT USING MASK6$;T2(6);			REMARK  PRINT JOB NUMBER "  "" ""   ""   ""

	PRINT TAB(45);
	IF T2(5)>0 THEN PRINT USING "##";T2(5);				REMARK  PRINT DEPARTMENT "  "" ""   ""   ""

	PRINT TAB(49);
	IF T2(8)>0 THEN PRINT USING MASK4.2$;T2(8);			REMARK  PRINT TRANS. AMT "  "" ""   ""   ""

	PRINT
	B=B+1								REMARK  INCREMENT RECORD POINTER AND GET NEXT RECORD
	GOTO 6120


6300	X1=275:X2=4:X3=0:X4=9999:GOSUB 345				REMARK  ENTER REFERENCE NUMBER FOR TRANSACTION TO CHANGE
	R1=0
	IF X0>0 THEN 6310

	X2=3:X3=0:X4=999:X2$="ENTER EMPLOYEE NUMBER":GOSUB 665		REMARK  IF ZERO WAS ENTERED, SEARCH FOR TRANSACTION RECORD\
									        BASED ON EMPLOYEE NUMBER
	IF X0=0 THEN 6020						REMARK  IF EMPLOYEE NUMBER=0, PROMPT FOR OPERATION CODE
	X=X0
	X0=0
	T2(1)=0
	WHILE X > T2(1)							REMARK  SCAN THE FILE UNTIL KEY IS MATCHED OR SURPASSED
	X0=X0+1
	GOSUB 780
	IF R1=99 THEN T2(1)=9999
	WEND

	IF T2(1)=X THEN B=X0:GOTO 6315\					REMARK  IF A MATCH WAS FOUND, RETURN;OTHERWISE,
	ELSE\								REMARK  FLASH ERROR BULLETIN AND REQUEST OPERATION CODE
	X2$="NOT ON FILE":GOSUB 615:GOTO 6020


6310	B=X0
	E=0
	GOSUB 780
6315	IF R1=99 THEN 6020

	GOSUB 7000							REMARK  DISPLAY TRANSACTION DATA ON CRT

6320	X2=2:X3=-1:X4=6
	X2$="ENTER FIELD TO CHANGE (0=NONE; -1=CHANGE OPERATION)"	REMARK  REQUEST FIELD TO CHANGE FOR THIS TRANSACTION
	GOSUB 665

	IF X0=0 THEN X0=B:GOSUB 800:GOTO 6330				REMARK  IF NO CHANGES, SAVE RECORD & GET NEXT TRANSACTION
	F=X0
	IF F=-1 THEN 6020						REMARK  IF -1 ENTERED, REQUEST NEW OPERATION CODE

	ON F GOSUB 5300,5350,5400,5450,5500,5550			REMARK  CHANGE RECORD BASED ON FIELD NUMBER ENTERED
	GOTO 6320

6330	B=B+1:X0=B							REMARK  LOCATE NEXT TRANSACTION IN FILE...
	GOSUB 780

	IF R1<>99 THEN GOSUB 7000:GOTO 6320\				REMARK  DISPLAY IT IF FOUND;IF NOT, PROMPT OPERATOR
	ELSE\								REMARK  FOR ANOTHER TRANSACTION REFERENCE NUMBER
	GOTO 6300


7000	X1=274:GOSUB 210						REMARK  DISPLAY CURRENT TRANSACTION DATA ON CRT

	PRINT USING MASKC$;B						REMARK  DISPLAY TRANSACTION REFERENCE NUMBER
	PRINT
	X1=14:GOSUB 215
	PRINT USING MASK6$;T2(1)					REMARK  DISPLAY EMPLOYEE NUMBER
	X1=16:GOSUB 215
	PRINT USING MASKB$;T2(2)					REMARK  DISPLAY DAY NUMBER
	X1=16:GOSUB 215
	PRINT USING MASKA$;T2(3),P$(T2(3)+1)				REMARK  DISPLAY PAY TYPE AND CORRESPONDING DESCRIPTION
	X1=16:GOSUB 215
	PRINT USING MASKA$;T2(4),W$(T2(4)+1)				REMARK  DISPLAY WORK TYPE AND CORRESPONDING DESCRIPTION
	X1=14
	GOSUB 215
	PRINT USING MASK6$;T2(6)					REMARK  DISPLAY JOB NUMBER
	X1=14:GOSUB 215
	PRINT USING MASK6$;T2(5)					REMARK  DISPLAY DEPARTMENT NUMBER
	X1=15:GOSUB 215
	PRINT USING MASK2.2$;T2(7)					REMARK  DISPLAY HOURS
	X1=13:GOSUB 215
	PRINT USING MASK4.2$;T2(8)					REMARK  DISPLAY TRANSACTION AMOUNT
	RETURN


