	REMARK	************************************\
		*   P/R270.BAS   REORGANIZE FILES  *\
		*   4/18/79               7:30 PM  *\
		************************************
%INCLUDE CURSOR
	RESTORE
	DIM S(96),R1(2),R2(5),G2$(5),G3(5),R$(5),Z0$(3)
	GOTO 6000

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

	DATA "YTD     ","QTD   ","CURRENT"
	GOTO 6000


825	A1=110								REMARK  ****    LINE PRINTER ROUTINE    ****
	IF LINE.COUNT% < 55 THEN  RETURN				REMARK  IF SPACE REMAINS ON REPORT PAGE, RETURN
	P=P+1
	PRINT CHR$(12);
	PRINT TAB((A1-LEN(G2$(1)))/2);G2$(1);TAB(A1);"DATE ";		REMARK  PRINT COMPANY NAME AND REPORT DATE
	X0=G3(1):GOSUB 680.5
	PRINT 
	PRINT TAB(45);"PAYROLL REORGANIZE";

	PRINT TAB(A1);"PAGE";P
	PRINT 
	PRINT 
	LINE.COUNT%=6 							REMARK  RESET LINE COUNTER FOR NEW REPORT PAGE
	RETURN 
4500	PRINT Z0$(I%);TAB(9);						REMARK   PRINT "YTD", "QTD" OR "CURRENT" SUB-HEADING
	A3%=24*I%							REMARK  SET TOTALS POINTER
	RETURN 
5300	PRINT TAB(13);"REG HRS    REG PAY   O.T. HRS   O.T. PAY";
	PRINT "   P.W. HRS   P.W. PAY    H&W PAY    VAC HRS    VAC PAY";
	PRINT "  OTHER PAY    NON-TAX"
	LINE.COUNT%=LINE.COUNT%+1
	RETURN 
5310	PRINT TAB(13);"FED W/H    ST. W/H   F.I.C.A.     S.D.I.  OTHER ";
	PRINT "DED  TOTAL DED    NET PAY  TOTAL PAY"
	LINE.COUNT%=LINE.COUNT%+1
	RETURN 

6000	A$="VAC HOURS ######.##  MON HRS ######.##  MON PAY #######.##"	REMARK  SET UP PRINT MASKS
	B$=" #######.##"
	C$="######"
	D$=" ####.####"
	E$="EMPLOYEE TYPE  ##  FED-EX  ##  CHECK NO.    ######"
	E$=E$+"    H&W RATE  ####.####"
	F$="EMP. CLASS     ##  ST-EX   ##  CHECK DATE "
	G$="    MON HOURS ####.####"
	H$="INS. CLASS     ##  ADD-EX  ##  VAC HOURS ######.##"
	H$=H$+"    MON PAY   ####.####"
	OPEN "P/R0F110.DAT" RECL 1150 AS 1				REMARK  OPEN PAYROLL MASTER FILE
	Y9=2
	OPEN "G/I0F010.DAT" RECL 200 AS Y9
	GOSUB 700							REMARK  READ GENERAL INFORMATION FILE
6010	CONSOLE
	PRINT CLEAR.SCREEN$;"REORGANIZE"				REMARK  DISPLAY PROGRAM I.D. AND ENTRY MASK
	PRINT:PRINT:PRINT:PRINT
	PRINT "1) PAYROLL MASTER"
	PRINT "2) PAYROLL HISTORY"
	X2=1:X3=0:X4=2
	X2$="CHOOSE FILE TO REORGANIZE"
	GOSUB 665							REMARK  ENTER CHOICE FOR REORGANIZE


	IF X0=0 THEN\
	PRINT CLEAR.SCREEN$;"REORGANIZE LOADING MENU":\			REMARK  DISPLAY PROGRAM EXIT MESSAGE
	CHAIN "P/R000"							REMARK  AND LOAD THE MENU

	PRINT CLEAR.SCREEN$;
	IF X0=1 THEN PRINT "P/R REORGANIZE MASTER"
	IF X0=2 THEN PRINT "P/R REORGANIZE HISTORY"
	PRINT "KEY RETURN TO BEGIN;CTRL-C TO EXIT"

6100	IF CONSTAT%=0 THEN 6100
	X%=CONCHAR%
	IF X%=03H THEN CHAIN "P/R000"					REMARK  IF CTRL-C WAS DEPRESSED, CHAIN TO THE MENU
	IF X%<> 0DH THEN GOTO 6100					REMARK  DO NOT START PROCESSING UNTIL RETURN IS DEPRESSED

	PRINT "WORKING...DO NOT INTERRUPT"


	IF X0=2\
	THEN\								REMARK  IF 'REORGANIZE HISTORY' WAS SELECTED...
	CLOSE 1:\
	OPEN "P/R0F120.DAT" AS 1:\					REMARK  ERASE AND RE-CREATE HISTORY FILE; EXIT PROGRAM
	DELETE 1:CREATE "P/R0F120.DAT" AS 1:\
	HISTORY.RECORDS=0:GOSUB 720:\
	CHAIN "P/R000"


	RESTORE
	FOR I%=1 TO 3
	READ Z0$(I%)							REMARK  READ DATA FROM STATEMENT 10
	NEXT I%

6133	LPRINTER							REMARK  SELECT PRINTER AS OUTPUT DEVICE
	LINE.COUNT%=70:GOSUB 825					REMARK  PRINT REPORT HEADINGS
	FOR R%=1 TO MSTR.RECORDS					REMARK  PRINT FOR EMPLOYEE RANGE ENTERED
	X0=R%:GOSUB 745							REMARK  READ THE EMPLOYEE RECORD
	IF R2(1) <> 99 OR S(1)=0 THEN GOTO 6565
6310	GOSUB 825							REMARK  CHECK FOR END OF REPORT PAGE
	PRINT " EMP NO. ";
	PRINT USING C$;S(1);						REMARK  PRINT EMPLOEE NUMBER
	PRINT " NAME: ";R$(1);TAB(49);"SS #  ";
	X0=R1(1):GOSUB 760.5						REMARK   ""   EMPLYEE NAME AND SOCIAL SECURITY NUMBER
6375	PRINT "  STATUS   ";R3$;"  DATE/EMP   ";			REMARK   ""   EMPLOYEE STATUS AND DATE EMPLOYED
	X0=S(2):GOSUB 680.5
	PRINT "    PAY RATE ";
	PRINT USING D$;S(8)						REMARK   ""   PAY RATE
	LINE.COUNT%=LINE.COUNT% + 1:GOSUB 825
	PRINT "  **DELETED**";TAB(16);" ADDR: ";R$(2);TAB(49);		REMARK   ""   ADDRESS
	PRINT USING E$;R2(1),R2(2),S(5),S(9)				REMARK   ""   EMPLOYEE TYPE, FEDERAL EXEMPTIONS,\
									        LAST CHECK NUMBER AND H&W RATE
	LINE.COUNT%=LINE.COUNT%+1:GOSUB 825				REMARK  CHECK FOR END OF REPORT PAGE
	PRINT TAB(23);R$(3);TAB(49);					REMARK   ""   EMPLOYEE ADDRESS LINE 2
	PRINT USING F$;R2(5),R2(3);					REMARK   ""   EMPLOYEE CLASS AND STATE EXEMPTIONS
	X0=S(4):GOSUB 680.5						REMARK   ""   LAST CHECK DATE
6420	PRINT USING G$;S(6)						REMARK   ""   MONTHLY HOURS
	LINE.COUNT%=LINE.COUNT%+1:GOSUB 825
	PRINT TAB(23);R$(4);TAB(49);					REMARK   ""   ADDRESS LINE 3
	PRINT USING H$;S(3),R2(4),S(14),S(7)				REMARK   ""   INS. CLASS, ADDITIONAL EXEMPTIONS,\
									         ""   VACATION HOURS LEFT AND MONTHLY PAY
6435	PRINT 								REMARK  PRINT CURRENT, Q-T-D OR Y-T-D EMPLOYEE DATA
	LINE.COUNT%=LINE.COUNT%+2
	GOSUB 825							REMARK  CHECK FOR END OF REPORT PAGE
	GOSUB 5300							REMARK  PRINT HEADINGS FOR EMPLOYEE DATA
	I1%=1

	FOR I%=3 TO 1 STEP -1
	I1%=I1%+1
	GOSUB 4500							REMARK  PRINT APPROPRIATE SUB-HEADING
	PRINT USING B$;S(A3%+1);S(A3%+2);S(A3%+3);\			REMARK  PRINT ITEMIZED PAY INFORMATION
	S(A3%+4);S(A3%+5);S(A3%+6);S(A3%+7);\
	S(A3%+8);S(A3%+9);S(A3%+10);S(A3%+12)
	LINE.COUNT%=LINE.COUNT%+1:GOSUB 825
6440	NEXT I%
	PRINT 
	LINE.COUNT%=LINE.COUNT%+1:GOSUB 825
	GOSUB 5310							REMARK  PRINT DEDUCTION HEADING
	I1%=1
	FOR I%=3 TO 1 STEP -1
	I1%=I1%+1
	GOSUB 4500							REMARK  PRINT APPROPRIATE SUB-HEADING
	PRINT USING B$;S(A3%+13);S(A3%+14);S(A3%+15);\			REMARK  PRINT DEDUCTION DETAIL
	S(A3%+16);S(A3%+17);S(A3%+18);S(A3%+11)-S(A3%+18);S(A3%+11)
	LINE.COUNT%=LINE.COUNT%+1:GOSUB 825
6445	NEXT I%
	PRINT 
6560	LINE.COUNT%=LINE.COUNT%+1:GOSUB 825
	S(1)=0:X0=R%:GOSUB 750						REMARK  SAVE RECORD AFTER LOGICALLY DELETING IT

6565	NEXT R%
	PRINT CHR$(0CH)							REMARK  EJECT FINAL REPORT PAGE AND SELECT CONSOLE
	CONSOLE
	PRINT CLEAR.SCREEN$;"P/R REORGANIZE MASTER LOADING MENU"	REMARK  TERMINATE PROGRAM AND LOAD MENU WHEN REORGANIZE ENDS
	CHAIN "P/R000"
