
	REMARK	+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	REMARK	+	GENERAL LEDGER CASH JOURNAL TRANSACTIONS	+
	REMARK	+		VERS. OF 10.45 AM	8/14/79		+
	REMARK	+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	DIM G2$(5),G3(5),D(7)
%INCLUDE CURSOR
	GOTO 6000
%INCLUDE SUBS1
%INCLUDE GENINFO
%INCLUDE ACCTFILE
%INCLUDE POSTFILE
%INCLUDE BINSERCH
%INCLUDE G/L-INFO


825	IF LINE.COUNT%<55 THEN RETURN					REMARK	LINE PRINTER ROUTINE
	PAGE.COUNT%=PAGE.COUNT%+1
	PRINT CHR$(12);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"CASH ACCT  ACCOUNT  DATE  REFERENCE   DESCRIPTION";
	PRINT TAB(69);"AMOUNT"
	PRINT:PRINT
	LINE.COUNT%=6
	RETURN


3625	READ #FILE.NO%,RECORD.NO%; P1,P2,P3,P4,P5,P6$,CL1,REC.TYPE%	REMARK	READ CASH JOURNAL RECORD
	RETURN
3675	PRINT #FILE.NO%,RECORD.NO%;P1,P2,P3,P4,P5,P6$,CL1,REC.TYPE%	REMARK	WRITE CASH JOURNAL RECORD
	RETURN


4020	IF EXTERNAL.POSTING.EXTENT% + DIRECT.POSTING.EXTENT% + \	REMARK	STOP PROGRAM IF POSTING FILES ARE FULL
	CASH.EXTENT% < MAXIMUM.POSTING.RECORDS% THEN RETURN
	PRINT CURSOR.HOME$:PRINT:PRINT"FILE FULL - RUN G/L UPDATE"
	PRINT "KEY <RETURN> TO EXIT"
	X1=148:X2=1:X3=0:X4=0:GOSUB 345
	GOTO 6340


5000	A1=0								REMARK	ENTER MONTH AND DAY FOR POSTING DATE FIELD
	X1=404:X2=4:X3=0:X4=9999:GOSUB 345	
	IF X0=0 THEN 5040
	P3=X0/100
	A1=INT(X0/100)							REMARK	CHECK FOR VALID MONTH
	IF A1<1 OR A1>12 THEN X2$="BAD DATE":GOSUB 615:GOTO 5000
	A1=X0-A1*100							REMARK	CHECK FOR VALID DAY
	IF A1<1 OR A1>31 THEN X2$="BAD DATE":GOSUB 615:GOTO 5000
5040	X1=405:GOSUB 210						REMARK	DISPLAY MONTH/DAY
	PRINT USING "##/##";INT(P3),(P3-INT(P3))*100
	RETURN 


5060	X1=468:X2=6:X3=0:X4=999999:GOSUB 345				REMARK	ENTER REFERENCE NUMBER FIELD
	P4=X0
	RETURN 


5080	X1=527:X2=11:X3=-9999999.99:X4=9999999.99:GOSUB 345		REMARK	ENTER POSTING FIELD AMOUNT
	P5=X0
	RETURN 

5100	X1=593:X2=23:X3=0:X4=0:GOSUB 345				REMARK	ENTER DESCRIPTION FIELD
	P6$=X0$
	RETURN




6000	MASKA$="######"							REMARK	START OF MAIN PROGRAM
	MASKB$=" #######.##"
	MASKC$="#####.#"
6010	MAXIMUM.POSTING.RECORDS%=3600
	OPEN "G/I0F010.DAT" AS 1,"G/L0F110.DAT" RECL 157 AS 2,\		REMARK	OPEN FILES
	"G/L0F020.DAT" RECL 36 AS 4,\
	"G/L0F130.DAT" AS 5, "CRT" RECL 1100 AS 19
	CREATE "WORKFILE.DAT" RECL 74 AS 3
	FILE.NO%=1:GOSUB 700						REMARK	GET GENERAL INFORMATION FILE
	FILE.NO%=5:GOSUB .314						REMARK	GET G/L INFORMATION FILE
	GOSUB 4020							REMARK	CHECK POSTING FILES' RECORD LENGTHS
6040	P2=3								REMARK	SET ACCOUNT TYPE FIELD FOR DIRECT POSTINGS
	X0=6:GOSUB 260							REMARK	LOAD CRT MASK
	X2$="ENTER OPERATION (0=EXIT, 1=RECEIPTS, 2=DISBURSE, 3=PRINT)"	REMARK	REQUEST OPERATION CODE
	X2=1:X3=0:X4=3:GOSUB 665
	OPERATION%=X0
	ON OPERATION%+1 GOTO 6340,6060,6060,6200			REMARK	BRANCH TO APPROPRIATE PROGRAM AREA


									REMARK	ENTER RECEIPTS / DISBURSEMENTS
6060	X1=269:X2=7:X3=0:X4=99999.9:GOSUB 345				REMARK	ENTER CASH ACCOUNT NUMBER
	P3=(INT(G3.0/100))/100
	CASH.TOTAL=0
	CASH.ACCOUNT=X0
	IF CASH.ACCOUNT=0 THEN GOTO 6040
	RECORD.COUNT%=ACCOUNT.FILE.EXTENT%
	Y2=2
	K1=CASH.ACCOUNT
	GOSUB 10.60							REMARK	CHECK ACCOUNT FILE FOR RECORD
	IF H=-1 THEN X2$="NOT ON FILE":GOSUB 615:GOTO 6060
	FILE.NO%=2:RECORD.NO%=L:GOSUB 3500				REMARK	RETREIVE CASH ACCOUNT DATA
	CL1$=L1$:CL1=L1
6070	X1=269:GOSUB 210
	PRINT USING MASKC$;CL1
	X1=278:GOSUB 210						REMARK	DISPLAY CASH ACCOUNT DATA
	PRINT CL1$
	X1=305:GOSUB 210
	PRINT USING MASKB$;CASH.TOTAL
	X1=333:X2=7:X3=0:X4=99999.9:GOSUB 345				REMARK	ENTER ACCOUNT NUMBER
	P1=X0
	IF P1=0 THEN GOTO 6180
	K1=P1
	GOSUB 10.60							REMARK	CHECK ACCOUNT FILE FOR RECORD
	IF H=-1 THEN X2$="NOT ON FILE":GOSUB 615:GOTO 6070
	FILE.NO%=2:RECORD.NO%=L:GOSUB 3500				REMARK	RETREIVE ACCOUNT DATA
	X1=342:GOSUB 210						REMARK	DISPLAY ACCOUNT DATA
	PRINT L1$;TAB(64)
	GOSUB 5040
	IF L4%=2 THEN X0$="BALANCE SHEET"\
	ELSE X0$="INCOME   STMT"
	X1=416:GOSUB 210
	PRINT X0$;", ";
	IF L5%=2 THEN X0$="CREDIT"\
	ELSE X0$="DEBIT "
	PRINT X0$;" ACCT"
	GOSUB 5060							REMARK	ENTER REFERENCE
	GOSUB 5080							REMARK	ENTER AMOUNT
	GOSUB 5100								REMARK	ENTER DESCRIPTION
6140	X2=1:X3=0:X4=5:X2$="ENTER FIELD TO CHANGE (0=NONE; 5=CANCEL)"	REMARK	ALLOW CHANGES TO ENTRIES
	GOSUB 665
	IF X0=0 THEN GOTO 6160
	IF X0=5 THEN X0=6:GOSUB 260:GOTO 6070				REMARK	CANCEL THE TRANSACTION
	ON X0 GOSUB 5000,5060,5080,5100					REMARK	BRANCH TO CHANGE APPROPRIATE FIELD
	GOTO 6140

6160	FILE.NO%=3
	REC.TYPE%=OPERATION%
	CASH.EXTENT%=CASH.EXTENT%+1
	RECORD.NO%=CASH.EXTENT%
	GOSUB 3675							REMARK	SAVE THE TRANSACTION
	X2$="RECORDED":GOSUB 615
	IF L5%=1 THEN P5=-P5
	CASH.TOTAL=CASH.TOTAL + P5
	GOSUB 4020							REMARK	CHECK POSTING FILES' RECORD LENGTHS
	X0=6:GOSUB 260							REMARK	REFRESH CRT MASK
	GOTO 6070

6180	EXTERNAL.POSTING.EXTENT%=EXTERNAL.POSTING.EXTENT%+1
	IF OPERATION%=1 THEN P5=CASH.TOTAL ELSE P5=-CASH.TOTAL
	P1=CL1:P4=0
	FILE.NO%=4:RECORD.NO%=EXTERNAL.POSTING.EXTENT%:GOSUB 3650	REMARK	SAVE THE CASH ACCOUNT TOTAL ON THE POSTING FILE
	CLOSE 5
	OPEN "G/L0F130.DAT" AS 5
	FILE.NO%=5:GOSUB .315						REMARK	UPDATE THE EXTENT INFORMATION
	GOSUB 4020
	X0=2:GOSUB 260							REMARK	REFRESH THE CRT MASK
	GOTO 6060

									REMARK	OPERATION IS PRINT
6200	X2$="ENTER REPORT OPTION (0=NONE, 1=RECEIPTS, 2=DISBURSEMENTS)"	REMARK	REQUEST REPORT OPTION
	X2=1:X3=0:X4=2:GOSUB 665
	REPORT.TYPE%=X0
	IF REPORT.TYPE%=0 THEN GOTO 6040				REMARK	IF REPORT OPTION IS 'NONE', LEAVE PRINT MODULE
	IF REPORT.TYPE%=1 THEN X4$="CASH RECEIPTS TRANSACTIONS"\
	ELSE X4$="CASH DISBURSEMENTS TRANSACTIONS"
	LPRINTER
	LINE.COUNT%=60							REMARK	SET REPORT PARAMETERS
	REPORT.TOTAL=0
	TRANS.COUNT%=0
	N=0:N1=0:LAST.CASH.ACCOUNT=0
	FILE.NO%=3
	IF CASH.EXTENT%=0 THEN GOTO 6200

	FOR RECORD.NO%=1 TO CASH.EXTENT%				REMARK	START PRINT LOOP
	GOSUB 3625							REMARK	READ THE JOURNAL RECORD FROM WORKFILE.DAT
	IF REPORT.TYPE%<>REC.TYPE% THEN GOTO 6250
	A1=110:GOSUB 825
	IF CL1<>LAST.CASH.ACCOUNT THEN\					REMARK	WHEN THE CASH ACCOUNT CHANGES, PRINT THE NEW ONE
		PRINT USING MASKC$;CL1;:\
		LAST.CASH.ACCOUNT=CL1
	PRINT TAB(12);
	PRINT USING MASKC$;P1;
	PRINT TAB(20);
	PRINT USING "##/##";INT(P3),100*(P3-INT(P3));
	PRINT TAB(28);
	PRINT USING MASKA$;P4;
	PRINT TAB(37);P6$;TAB(65);
	PRINT USING MASKB$;P5
	REPORT.TOTAL=REPORT.TOTAL+P5
	TRANS.COUNT%=TRANS.COUNT%+1
6250	NEXT RECORD.NO%
	PRINT TAB(28);							REMARK	PRINT TOTALS
	PRINT USING MASKA$;TRANS.COUNT%;
	PRINT "  TOTAL ";
	IF REPORT.TYPE%=1 THEN PRINT "RECEIPTS";\
		ELSE PRINT "DISBURSEMENTS";
	PRINT TAB(65);:PRINT USING MASKB$;REPORT.TOTAL
	GOTO 6200


									REMARK	END PROGRAM
6340	X2=1:X3=0:X4=1:X2$="DO YOU WANT A CASH JOURNAL LISTING?"	REMARK	ENCOURAGE PRINTING ANY POSTINGS JUST ENTERED
	GOSUB 665
	IF X0=1 THEN 6200
	IF CASH.EXTENT%=0 THEN GOTO 6400
	PRINT "WORKING...  DO NOT INTERRUPT"
	FOR I%=1 TO CASH.EXTENT%					REMARK	SAVE THE JOURNAL TRANSACTIONS ON THE POSTING FILE
	FILE.NO%=3:RECORD.NO%=I%:GOSUB 3625
	EXTERNAL.POSTING.EXTENT%=EXTERNAL.POSTING.EXTENT%+1
	FILE.NO%=4:RECORD.NO%=EXTERNAL.POSTING.EXTENT%:GOSUB 3650
	NEXT I%
	CLOSE 5
	OPEN "G/L0F130.DAT" AS 5
	FILE.NO%=5:GOSUB .315						REMARK	SAVE THE NEW FILE EXTENT INFORMATION
6400	DELETE 3
	PRINT CLEAR.SCREEN$;"G/L DIRECT POSTING LOADING MENU"
	CHAIN "G/L000"							REMARK	RELOAD MENU
