

	REMARK	#########################################################
	REMARK	#	ACCOUNTS PAYABLE TRANSACTION PRINT   (A/P02B)	#
	REMARK	#	   VERS. OF 10.00 AM	6/19/79			#
	REMARK	#########################################################
	DIM G3(5),G2$(5),M$(5),B1(6),B(6,5),C(27),D(27),P(6)
	DEF FNF(X9%)=X9%-INT(X9%/10)*10					REMARK	STRIP OFF TENS DIGIT
%INCLUDE CURSOR
	GOTO 6000
%INCLUDE SUBS1
%INCLUDE GENINFO
%INCLUDE READINV
%INCLUDE A/P-INFO
	DATA "INVOICE","DELETE","MODIFY","CR MEMO","DB MEMO"
	DATA "NEW","DEL","MOD"


825	IF LINE.COUNT%<55 AND PAGE.COUNT%>0 THEN RETURN			REMARK	LINE PRINTER ROUTINE
	PAGE.COUNT%=PAGE.COUNT%+1
	PRINT CHR$(12);
	PRINT TAB((A1-LEN(G2$(1)))/2);G2$(1);TAB(A1);"DATE ";
	X0=G3(1):GOSUB 680.5
	PRINT
	PRINT TAB((A1-LEN(X4$))/2);X4$;TAB(A1);"PAGE";PAGE.COUNT%
	PRINT
	PRINT "R#  VENDOR     INV    DESCR    BUYER CK REG  INV DATE ";
	PRINT "PAY DATE     AMOUNT   DISCOUNT    FREIGHT      TAXES      TOTAL"
	PRINT
	LINE.COUNT%=6
	RETURN


5000	PRINT TAB(6);"AMT";						REMARK	PRINT G/L OR JOB DISTRIBUTION
	FOR I%=I1% TO I2%
	IF C(I%)<>0 THEN PRINT USING MASKB$;C(I%);
	NEXT I%
	PRINT 
	LINE.COUNT%=LINE.COUNT%+2
	RETURN 



6000	MASKA$="###"							REMARK	START OF MAIN PROGRAM
	MASKB$=" #######.##"
	MASKC$="    #####.#"
	MASKD$="     ######"
	MASKE$="######"
	OPEN "CRT" RECL 1100 AS 19, "G/I0F010.DAT" AS 3, "A/P0F130.DAT" AS 1,\
	"A/P0F020.DAT" RECL 580 AS 5
	Y9=3: GOSUB 700							REMARK	RETRIEVE GENERAL INFORMATION FILE DATA
	X0=1: GOSUB 3310						REMARK	RETRIEVE A/P INFORMATION FILE DATA
	IF TRANSACTION.RCD.COUNT%=0 THEN \
		PRINT CLEAR.SCREEN$;:\
		X2$="NO TRANSACTIONS ON FILE":\
		GOSUB 615:\
		GOTO 6220
	X9=5
	X0=5:GOSUB 260							REMARK	DISPLAY REPORT OPTIONS MASK
6010	FOR I%=1 TO 6							REMARK	ZERO REPORT TOTALS
	B1(I%)=0
	FOR J%=1 TO 5
	B(I%,J%)=0
	NEXT J%,I%
	X1=269:X2=1:X3=0:X4=2:GOSUB 345					REMARK	ENTER REPORT TYPE
	IF X0=0 THEN 6220
	S=X0
	X1=333:X2=1:X3=0:X4=5:GOSUB 345					REMARK	ENTER REPORT GROUP
	G=X0
	X1=408:X2=3:X3=1:X4=999:GOSUB 345				REMARK	ENTER START RECORD NUMBER
	F=X0
	X1=472:X2=3:X3=F:X4=999:GOSUB 345				REMARK	ENTER END RECORD NUMBER
	F2=X0
	IF F2>TRANSACTION.RCD.COUNT% THEN F2=TRANSACTION.RCD.COUNT%
	X1=586:X2=1:X3=0:X4=1:GOSUB 345					REMARK	VERIFY OPTIONS ENTRY
	IF X0<>1THEN 6010
	LINE.COUNT%=60
	B0=1
	PAGE.COUNT%=0
	LPRINTER


	FOR TRANSACTION.INDEX%=F TO F2					REMARK	START PRINT LOOP
	FILE.NO=5:X0%=TRANSACTION.INDEX%:GOSUB 3000			REMARK	RETRIEVE TRANSACTION RECORD
	IF W2%=1 THEN W3%=W1% \						REMARK	SET COMPOSITE TRANSACTION TYPE AND OPERATION
	ELSE W3%=W2%
	IF G<>0 AND G<>FNF(W3%) THEN 6180				REMARK	CHECK TRANSACTION FOR PROPER GROUP
	B0=FNF(W3%)
	IF W3%=2 OR W3%=4 THEN \					REMARK	ACCUMULATE TRANSACTION TO TOTALS
	B(B0,1)=B(B0,1)-C(23):\
	B(B0,5)=B(B0,5)-C(23)\
	ELSE\
	FOR I%=1 TO 4:\
	B(B0,I%)=B(B0,I%)+C(22+I%):\
	B(B0,5)=B(B0,5)+C(22+I%):\
	NEXT I%
	B1(B0)=B1(B0)+1
	IF S=2 THEN 6180						REMARK	IF REQUESTED, PRINT TRANSACTION DETAIL
	X4$="A/P TRANSACTIONS":A1=115:GOSUB 825
	PRINT USING MASKA$;TRANSACTION.INDEX%;
	PRINT " ";W1$;TAB(13);
	PRINT USING MASKE$;W0;
	PRINT TAB(22);W2$;TAB(34);W3$;TAB(37);
	PRINT USING MASKE$;D(25);
	PRINT TAB(46);
	X0=D(23):GOSUB 680.5
	PRINT TAB(55);
	X0=D(24):GOSUB 680.5
	PRINT TAB(63);
	PRINT USING MASKB$;C(23);C(24);C(25);C(26);C(23)+C(24)+C(25)+C(26);
	RESTORE
	FOR I%=1 TO FNF(W2%)+5
	READ X0$
	NEXT I%
	PRINT " ";X0$;" ";
	RESTORE
	FOR I%=1 TO W1%
	READ X0$
	NEXT I%
	PRINT X0$;
	IF W2%>=10 THEN PRINT "*";
	PRINT 
	PRINT "   G/L #";
	FOR I%=1 TO 11
	IF C(I%)<>0 THEN PRINT USING MASKC$;D(I%);
	NEXT I%
	PRINT 
	I1%=1:I2%=11:GOSUB 5000
	IF C(12)=0 THEN 6170
	PRINT "   JOB #";
	FOR I%=12 TO 22
	IF C(I%)<>0 THEN PRINT USING MASKD$;D(I%);
	NEXT I%
	PRINT 
	I1%=12:I2%=22:GOSUB 5000
6170	PRINT 
	LINE.COUNT%=LINE.COUNT%+2
6180	NEXT TRANSACTION.INDEX%

	LINE.COUNT%=LINE.COUNT%+14-11*SGN(G)				REMARK	PRINT TOTALS
	X4$="A/P TRANSACTION REPORT":A1=115:LINE.COUNT%=60:GOSUB 825
	IF G<>0 THEN B0=G:GOTO 6330
6190	PRINT:PRINT:PRINT"TOTALS";					REMARK	PRINT TOTALS FOR ALL GROUPS
	B3=0
	RESTORE 
	FOR B0=1 TO 5
	READ X0$
	PRINT TAB(11);
	PRINT USING MASKA$;B1(B0);
	PRINT "  ";X0$;" TRANSACTIONS";TAB(63);
	B3=B3+B1(B0)
	FOR I%=1 TO 5
	PRINT USING MASKB$;B(B0,I%);
	B(6,I%)=B(6,I%)+B(B0,I%)
	NEXT I%
	PRINT 
	NEXT B0
	PRINT:PRINT:PRINT"TOTAL";TAB(11);
	PRINT USING MASKA$;B3;
	PRINT "  TRANSACTIONS";
	PRINT TAB(63);
	FOR I%=1 TO 5
	PRINT USING MASKB$;B(6,I%);
	NEXT I%
	PRINT 
	PRINT 
	PRINT "BEGINNING REC #",
	PRINT USING MASKD$;F
	PRINT "ENDING    REC #",
	PRINT USING MASKD$;F2
	PRINT "TOTAL  IN  FILE",
	PRINT USING MASKD$;TRANSACTION.RCD.COUNT%
	PRINT
	GOTO 6010


6220	CONSOLE								REMARK	END PROGRAM
	PRINT CLEAR.SCREEN$;"A/P TRANSACTION PRINT LOADING MENU"
	CHAIN"A/P000"							REMARK	LOAD MENU



6330	PRINT:PRINT"  TOTAL";TAB(11);					REMARK	PRINT TOTALS FOR ONE GROUP ONLY
	PRINT USING MASKA$;B1(B0);
	RESTORE
	FOR I%=1 TO B0
	READ X0$
	NEXT I%
	PRINT "  ";X0$;" TRANSACTIONS";TAB(63);
	PRINT USING MASKB$; B(B0,1);B(B0,2);B(B0,3);B(B0,4);B(B0,5)
	PRINT:PRINT
	GOTO 6010
