	REMARK	************************************\
		*   P/R180.BAS    PAYROLL JOURNAL  *\
		*  3/14/79               11:30 AM  *\
		************************************

%INCLUDE CURSOR
	RESTORE
	DATA "YTD     ","QTD   ","CURRENT"

	DIM S(96),R1(2),R2(5),G2$(5),G3(5),R$(5)
	GOTO 6000

%INCLUDE SUBS1
%INCLUDE GENINFO
%INCLUDE MSTRIN

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(37);"PAYROLL JOURNAL   ";
	X0=G3(2):GOSUB 680.5						REMARK  PRINT PERIOD START DATE
	PRINT " - ";
	X0=G3(3):GOSUB 680.5						REMARK  PRINT PERIOD END DATE
	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";	REMARK  PRINT HEADINGS FOR INCOME
	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$;"P/R JOURNAL";				REMARK  DISPLAY PROGRAM I.D. AND ENTRY MASK
	X1=256:GOSUB 210
	PRINT "START EMPLOYEE NUMBER"
	PRINT "END EMPLOYEE NUMBER"
	PRINT "1. HEADING"
	PRINT "2. CURRENT"
	PRINT "3. QUARTERLY"
	PRINT "4. YEARLY"
	PRINT "5. COMPANY TOTALS"
6015	PRINT 
	PRINT "FOR OPTIONS 1-5 --> 1=INCLUDE; 0=EXCLUDE"
	DIM E(2,3),O%(6),A(19,3),A2(3),Z0$(3)				REMARK  INITIALIZE REPORT ARRAYS TO ZERO
6020	X1=279:X2=3:X3=0:X4=999:GOSUB 345				REMARK  ENTER START EMPLOYEE NUMBER FOR REPORT
	IF X0=0 THEN\							REMARK  OF START EMPLOYEE NUMBER WAS ZERO,
	PRINT CLEAR.SCREEN$;"P/R JOURNAL LOADING MENU":\		REMARK  DISPLAY PROGRAM EXIT MESSAGE
	CHAIN "P/R000"							REMARK  AND LOAD THE MENU
	E(1,1)=X0
	X1=343:X2=3:X3=X0:X4=999:GOSUB 345				REMARK  ENTER ENDING EMPLOYEE NUMBER
	E(2,1)=X0
	FOR I%=1 TO 5
	X1=343 + I% * 64
	X2=1:X3=0:X4=1:GOSUB 345					REMARK  SET REPORT PARAMETERS
	O%(I%)=X0
	NEXT I%
	X2$="ENTRY CORRECT?":X2=1:X3=0:X4=1:GOSUB 665			REMARK  VERIFY ENTRY: '1'=O.K.; '0'=RETRY
	IF E(2,1) > MSTR.RECORDS THEN E(2,1)=MSTR.RECORDS
	IF E(1,1) > MSTR.RECORDS OR X0 <> 1 THEN GOTO 6020		REMARK  RE-ENTER IF REQUESTED OR IF \
									REMARK  A BAD EMPLOYEE RANGE WAS ENTERED
	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
	B=O%(1)*3+2*(O%(2)+O%(3)+O%(4))+4*SGN(O%(2)+O%(3)+O%(4))+2	REMARK  SET PRINT OPTION VARIABLE
	FOR R%=E(1,1) TO E(2,1)						REMARK  PRINT FOR EMPLOYEE RANGE ENTERED
	X0=R%:GOSUB 745							REMARK  READ THE EMPLOYEE RECORD

	IF S(1)=0 THEN GOTO 6564					REMARK  SKIP EMPLOYEE RECORD IF IT HAS BEEN DELETED

6305	IF B=2 THEN  6560
	IF S(83)=0 AND R2(1)=99 THEN GOTO 6563				REMARK  DO NOT PRINT INACTIVE EMPLOYEES
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
	IF O%(1)=0 THEN  6435
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 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
	IF O%(2)+O%(3)+O%(4)=0 THEN  6560				REMARK  SKIP PRINTING IF NOT SPECIFIED
	GOSUB 5300							REMARK  PRINT HEADINGS FOR EMPLOYEE DATA
	I1%=1
	FOR I%=3 TO 1 STEP -1
	I1%=I1%+1
	IF O%(I1%)=0 THEN  6440						REMARK  IF NOT SPECIFIED, SKIP PRINTING 
	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
	IF O%(I1%)=0 THEN  6445						REMARK  IF NOT SPECIFIED, SKIP PRINTING
	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				REMARK  ADD EMPLOYEE INFORMATION TO COMPANY TOTALS
6563	IF O%(5)+O%(6)=0 THEN  6564
	FOR I%=1 TO 3
	FOR J%=1 TO 18
	A1%=I%*24+J%
	A(J%,I%)=A(J%,I%)+S(A1%)					REMARK  ADD EMPLOYEE DETAIL TO REPORT TOTAL
	NEXT J%
	NEXT I%
	FOR I%=2 TO 3
	A2(I%)=A2(I%)+S(I%+4)
	NEXT I%
	A2(1)=A2(1)+S(14)
	GOTO 6564
6564	NEXT R%
6565	IF O%(5)=0 THEN 6010
6578	IF A(11,1)+A(18,1)+A(11,2)+A(18,2)+A(11,3)+A(18,3)=0 THEN 6010	REMARK  PRINT COMPANY TOTALS
	G2$(2)=G2$(1)
	G2$(1)="COMPANY TOTALS"
	LINE.COUNT%=60
	GOSUB 825
	PRINT TAB(49);
	PRINT USING A$;A2(1),A2(2),A2(3)				REMARK  TOTAL VACATION HOURS, M-T-D HOURS AND PAY
	PRINT 
6600	GOSUB 5300							REMARK  PRINT TOTAL PAY INFORMATION
	FOR I%=3 TO 1 STEP -1
	GOSUB 4500
	PRINT USING B$;A(1,I%);A(2,I%);A(3,I%);A(4,I%);\
	A(5,I%);A(6,I%);A(7,I%);A(8,I%);A(9,I%);A(10,I%);A(12,I%)	REMARK  PRINT CURRENT, Q-T-D AND Y-T-D TOTALS
	NEXT I%
	PRINT 
6635	GOSUB 5310							REMARK  PRINT TOTAL DEDUCTION INFORMATION
	FOR I%=3 TO 1 STEP -1
	GOSUB 4500
	PRINT USING B$;A(13,I%);A(14,I%);A(15,I%);\			REMARK  PRINT CURRENT, Q-T-D AND Y-T-D TOTALS
	A(16,I%);A(17,I%);A(18,I%);A(11,I%)-A(18,I%);A(11,I%)
	NEXT I%
	PRINT 
	G2$(1)=G2$(2)
	GOTO 6010							REMARK  BRANCH PREPARE FOR ANOTHER RUN
