

	REMARK	**************************************\
		*  P/R230.BAS       PRINT W-2 FORMS  *\
		*  5/17/79                  1:15 PM  *\
		**************************************

%INCLUDE CURSOR

	DIM S(96),R$(5),R2(5),R1(2),G2$(5),G3(5),F1(6),K(4,20)

	GOTO 6000

%INCLUDE SUBS1
%INCLUDE GENINFO
%INCLUDE MSTRIN

6000	MASKA$="  ######.##"						REMARK  SET UP PRINT MASKS
	MASKB$=" #####.##"
	MASKC$="######.##"
	MASKD$="#######.##"

	Y9=2
	OPEN "G/I0F010.DAT" RECL 200 AS Y9:GOSUB 700			REMARK  OPEN AND LOAD GENERAL INFORMATION FILE
	OPEN "P/R0F110.DAT" RECL 1150 AS 1				REMARK  OPEN PAYROLL MASTER FILE
	OPEN "P/R0F060.DAT" AS 3					REMARK  OPEN FEDERAL TAX FILE

	A3$="0"
	PRINT CLEAR.SCREEN$;"FEDERAL FORM W-2"				REMARK  DISPLAY PROGRAM I.D. ON CRT
	PRINT "ENTER START EMPLOYEE NUMBER OF ZERO TO EXIT"
	PRINT:PRINT:PRINT"START EMPLOYEE NUMBER"

	PRINT "END EMPLOYEE NUMBER"
6010	X1=279:X2=3:X3=0:X4=MSTR.RECORDS:GOSUB 345			REMARK  ENTER START EMPLOYEE NUMBER

	IF X0=0 THEN\							REMARK  IF START EMPLOYEE=0, END PROGRAM
	PRINT CLEAR.SCREEN$;"W-2 LOADING MENU":\
	CHAIN "P/R000"


	B=X0
	X1=343:X2=3:X3=B:X4=999:GOSUB 345				REMARK  ENTER END EMPLOYEE
	E=X0
	IF E>MSTR.RECORDS THEN E=MSTR.RECORDS				REMARK  SET DEFAULT END OF FILE
	X2$="ENTRY CORRECT?":X2=1:X3=0:X4=1:GOSUB 665
	IF X0<>1 THEN 6010						REMARK  VERIFY ENTRY:'1'=O.K.; '0'=RETRY
	X2$="TOTALS ONLY?":X2=1:X3=0:X4=1:GOSUB 665			REMARK  PROMPT IF THIS RUN FOR TOTALS ONLY
	TOTALS.ONLY%=X0

	READ #3;L,L,L,L,L,L						REMARK  READ EMPLOYEE FICA CUTOFF

	LPRINTER							REMARK  SELECT PRINTER AS OUTPUT DEVICE

	FOR I%=B TO E							REMARK  PRINT W-2 FORMS FOR EMPLOYEE RANGE
	X0=I%
	GOSUB 745							REMARK  READ EMPLOYEE RECORD
	IF S(1)=0 THEN GOTO 6150
6060	IF S(35)-S(36)=0 THEN 6150
	IF TOTALS.ONLY%=1 THEN GOTO 6090
	PRINT TAB(23);MID$(G2$(5),13,12)				REMARK  PRINT COMPANY'S FEDERAL & STATE I.D. NUMBERS
	FOR J%=1TO 4
	PRINT G2$(J%)							REMARK  PRINT EMPLOYER'S NAME AND ADDRESS
	NEXT J%
	PRINT TAB(34);MID$(G2$(5),1,12)					
	PRINT:PRINT
	X0=R1(1):GOSUB 760.5						REMARK  PRINT EMPLOYEE'S SOCIAL SECURITY NUMBER
6070	PRINT TAB(14);
	PRINT USING MASKC$;S(37);					REMARK PRINT EMPLOYEE'S FEDERAL WITHHOLDING TAX

6090	A=S(35)-S(36)							REMARK  CALCULATE FICA WAGES FOR EMPLOYEE
	IF A>L THEN A=L
	IF TOTALS.ONLY% THEN GOTO 6140
6100	PRINT TAB(28);
	PRINT USING MASKA$+MASKA$;S(35)-S(36);S(39);			REMARK  PRINT TAXABLE PAY AND FICA TAX FOR THE YEAR
	PRINT TAB(51);
	PRINT USING MASKB$;A						REMARK  PRINT FICA WAGES
	PRINT
	PRINT TAB(3);R$(1);TAB(34);"NO"					REMARK  PRINT EMPLOYEE NAME AND ADDRESS
	PRINT TAB(3);R$(2)
	PRINT TAB(3);R$(3);TAB(29);
	PRINT USING MASKA$;S(38);S(35)-S(36);				REMARK  PRINT STATE WITHHOLDING TAX AND STATE TAXABLE PAY
	PRINT TAB(57);"CA"
	PRINT TAB(3);R$(4);TAB(55);"CA SDI"
	PRINT TAB(49);:PRINT USING MASKA$;S(40)				REMARK  PRINT CALIFORNIA SDI DEDUCTION FOR THE YEAR
	PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT

6140	EMPLOYEE.COUNT%=EMPLOYEE.COUNT%+1				REMARK  ACUMULATE THIS EMPLOYEE TO REPORT TOTALS
	INDEX%=INT(FLOAT(EMPLOYEE.COUNT%)/41)+1
	K(1,INDEX%)=K(1,INDEX%)+S(37)
	K(2,INDEX%)=K(2,INDEX%)+S(35)-S(36)
	K(3,INDEX%)=K(3,INDEX%)+S(39)
	K(4,INDEX%)=K(4,INDEX%)+A

	IF FLOAT(EMPLOYEE.COUNT%)/41=INT(FLOAT(EMPLOYEE.COUNT%)/41)\	REMARK  SKIP ONE FORM FOR EVERY 41 IF W-2'S ARE PRINTED
	AND TOTALS.ONLY%=0\
	THEN\
	FOR J%=1 TO 22:\
	PRINT:\
	NEXT J%

6150	NEXT I%

6200	CONSOLE								REMARK  RE-SELECT CONSOLE FOR INPUT
	X2=1:X3=0:X4=1
	X2$="MOUNT STANDARD PAPER AND PRESS <RETURN> WHEN READY"
	GOSUB 665							REMARK  WAIT FOR OPERATOR RESPONSE
	LPRINTER
	PRINT TAB(12);"FED. INCOME";TAB(43);"FICA TAX";TAB(61);"TOTAL"	REMARK  PRINT HEADINGS
	PRINT "GROUP";TAB(12);"TAX WITHHELD";TAB(31);"WAGES";
	PRINT TAB(43);"WITHHELD";TAB(58);"FICA WAGES"
	PRINT
	FOR I%=1 TO INT(FLOAT(EMPLOYEE.COUNT%)/41)+1
	PRINT
	PRINT TAB(3);I%;TAB(12);					REMARK  PRINT REPORT TOTALS FOR TWENTY GROUPS OF 41 EMPLOYEES
	PRINT USING MASKD$;K(1,I%);
	PRINT TAB(28);
	PRINT USING MASKD$;K(2,I%);
	PRINT TAB(41);
	PRINT USING MASKD$;K(3,I%);
	PRINT TAB(58);
	PRINT USING MASKD$;K(4,I%)
	NEXT I%

	GOTO 6010							REMARK  RE-PROMPT OPERATOR TO RUN W-2 PROGRAM
	PRINT "GROUP";TAB(12);"TAX WITHHELD";TAB(31);"WAGES";
	PRINT TAB(43);"WITHHELD";TAB(58);"FICA WAGES"
	PRINT
	FOR I%=1 TO INT(FLOAT(EMPLOYEE.COUNT%)/41)+1
	PRINT
	PRINT TAB(3);I%;TAB(12);					REMARK  PRINT REPORT TOTALS FOR TWENTY GROUPS OF 41 EMPLOYEES
