1 REM ACCTREC  
10 CLS:PRINT  TAB(10);"ACCOUNTS RECEIVABLE PROGRAM":PRINT   
20 PRINT "THIS PROGRAM IS A BALANCE FORWARD ACCOUNTS RECEIVABLE   
25 PRINT "SYSTEM. WHAT THIS MEANS IS THAT PAYMENTS DO NOT ACCRUE  
30 PRINT "TOWARDS ANY INDIVIDUAL INVOICE BUT TOWARDS LUMP SUM   
35 PRINT "BALANCES RECEIVABLE. THIS TYPE OF A/R SYSTEM IS TYPICALLY  
40 PRINT "USED BY PROFESSIONALS. INVOICES ARE KEPT ON FILE UNTIL  
45 PRINT "MONTH'S END. LINE PRINTER OUTPUT IS SUPPORTED. DATA FILES  
50 PRINT "MAY BE STORED ON EITHER CASSETTE OR DISKETTE. SEE THE  
55 PRINT "ACCOMPANYING DOCUMENTATION FOR INSTRUCTIONS.  
56 PRINT :INPUT "PRESS ENTER TO BEGIN";Z9$  
58 CLEAR  2000  
59 NC=25:DIM  A(NC+1,7),A$(NC+1,1)  
60 MI=200:DIM B(MI,1),B$(MI,1):REM MAX INVOICES IN SYSTEM  
65 DIM F$(20):REM FORMATTING  
70 GOSUB  9000  
80 FOR  I=1  TO  NC:A$(I,1)="9999":NEXT   
100 CLS:INPUT "ARE DISK DRIVES ATTACHED(Y/N)";ZD$  
110 IF  ZD$<>"Y"  AND  ZD$<>"N"  THEN  GOSUB  10000:GOTO  100  
500 CLS:PRINT "       MAIN MENU":PRINT   
505 PRINT " 0.QUIT"
510 PRINT " 1.ADD TO OR BEGIN INVOICE/PAYMENT FILE"  
520 PRINT " 2.READ FILE IN FROM TAPE  
530 PRINT " 3.WRITE FILE OUT ONTO TAPE  
540 PRINT " 4.READ FILE IN FROM DISK  
550 PRINT " 5.WRITE FILE OUT ONTO DISK  
560 PRINT " 6.EDIT FILE  
570 PRINT " 7.REPORT GENERATOR  
580 PRINT " 8.POST & ELIMINATE INVOICES-UPDATE FILES  
600 INPUT "ENTER YOUR CHOICE";Z9  
605 IF Z9 = 0 THEN END
610 ON  Z9 GOSUB  1000,2000,2100,2200,2300,3000,5000,7000  
620 GOTO  500  
1000 REM ADD TO OR START FILE ALREADY IN MEMORY  
1010 CLS: IF  NI=0  THEN  PRINT  "NEW FILE":GOSUB  10100  
1015 I=NI+1  
1016 J=I  
1020 GOSUB 6050:REM INPUT 1 RECORD  
1030 CLS:PRINT F$(1):GOSUB 6300:REM PRINT OUT 1 RECORD  
1040 GOSUB  10200:IF  Z9$="N" THEN GOTO  1020  
1050 IF  Z9$="A"  THEN  RETURN    
1060 NI=NI+1:REM NEW RECORD ON FILE  
1070 GOSUB 10400:REM MORE?  
1080 IF  Z9$="Y"  THEN  GOTO  1010 :  ELSE   RETURN   
2000 REM READ IN FILE FROM TAPE  
2010 CLS:PRINT "PUT DATA TAPE IN TAPE DRIVE":GOSUB  10100  
2015 ' IF  ZD$="Y"  THEN  CMD"T"  
2020 INPUT  #-1,NI  
2030 FOR  I=1  TO  NI:GOSUB  2700:NEXT  I  
2035 FOR  I=1  TO  NC:GOSUB  2500:NEXT  I  
2040 RETURN   
2100 REM WRITE OUT FILE ONTO TAPE  
2105 CLS  
2110 PRINT "PUT DATA TAPE IN TAPE DRIVE":GOSUB  10100  
2115 ' IF  ZD$="Y"  THEN  CMD"T"  
2130 WRITE  #-1,NI  
2140 FOR  I=1 TO NI:GOSUB  2800:NEXT  I  
2145 FOR  I=1  TO  NC:GOSUB  2600:NEXT  I  
2150 RETURN   
2200 REM READ IN FILE FROM DISK  
2210 CLS:PRINT "PUT DATA DISK IN DISK DRIVE":GOSUB  10100  
2220 ON  ERROR  GOTO  2290  
2225 INPUT "ENTER NAME OF DATA FILE TO BE READ ";ZN$  
2230 OPEN "I",1,ZN$  
2240 INPUT  # 1,NI  
2250 FOR  I=1  TO  NI:GOSUB  2750:NEXT  I  
2255 FOR  I=1  TO  NC:GOSUB  2550:NEXT  I  
2260 CLOSE # 1  
2270 RETURN   
2290 PRINT  "FILE DOES NOT EXIST":GOSUB  10100:RETURN   
2300 REM WRITE FILE OUT TO DISK  
2305 CLS  
2310 PRINT :PRINT "PUT DATA DISK IN DISK DRIVE":GOSUB  10100  
2315 PRINT "PRESENT FILE NAME IS ";ZN$;:INPUT " NEW NAME";ZN$  
2320 OPEN "O",1,ZN$  
2330 WRITE  # 1,NI  
2340 FOR  I=1  TO  NI:GOSUB  2850:NEXT  I  
2345 FOR  I=1  TO  NC:GOSUB  2650:NEXT  I  
2370 CLOSE # 1  
2380 RETURN   
2500 REM INPUT 1 CUSTOMER FROM TAPE  
2510 INPUT  #-1,A(I,0),A$(I,1),A(I,1),A(I,2),A(I,3),A(I,4),A(I,5),A(I,6),A(I,7): Z8$=A$(I,1):GOSUB  11000:A$(I,1)=Z8$  
2520 RETURN   
2550 REM INPUT 1 CUSTOMER FROM DISKETTE  
2560 INPUT  # 1,A(I,0),A$(I,1),A(I,1),A(I,2),A(I,3),A(I,4),A(I,5),A(I,6),A(I,7): Z8$=A$(I,1):GOSUB  11000:A$(I,1)=Z8$  
2570 RETURN   
2600 REM OUTPUT 1 CUSTOMER TO TAPE  
2610 WRITE  #-1,A(I,0),A$(I,1),A(I,1),A(I,2),A(I,3),A(I,4),A(I,5),A(I,6),A(I,7)  
2620 RETURN   
2650 REM OUTPUT 1 CUSTOMER TO DISKETTE  
2660 WRITE  # 1,A(I,0),A$(I,1),A(I,1),A(I,2),A(I,3),A(I,4),A(I,5),A(I,6),A(I,7)  
2670 RETURN   
2700 REM INPUT 1 INVOICE FROM CASSETTE  
2710 INPUT  #-1,B$(I,0),B(I,0),B(I,1),B$(I,1)  
2720 RETURN   
2750 REM INPUT 1 INVOICE FROM DISKETTE  
2760 INPUT  # 1,B$(I,0),B(I,0),B(I,1),B$(I,1)  
2770 RETURN   
2800 REM OUTPUT 1 INVOICE TO CASSETTE  
2810 WRITE  #-1,B$(I,0),B(I,0),B(I,1),B$(I,1)  
2820 RETURN   
2850 REM OUTPUT 1 INVOICE TO DISKETTE  
2860 WRITE  # 1,B$(I,0),B(I,0),B(I,1),B$(I,1)  
2870 RETURN   
3000 REM EDIT FILE  
3002 CLS:INPUT "EDITING INVOICE FILE(I) OR CUSTOMER FILE(C)";Z9$  
3004 IF  Z9$<>"I"  AND  Z9$<>"C"  THEN  GOSUB  10000:GOTO  3002  
3006 IF  Z9$="C"  THEN  GOTO  3100  
3010 CLS:PRINT  F$(1)  
3020 FOR  J=1  TO  NI  
3030 GOSUB  6300  
3050 IF  J/12=INT(J/12)  THEN  GOSUB  4000:PRINT  F$(1)  
3060 NEXT  J  
3062 J=J-1  
3065 IF  J/12=INT(J/12)  THEN  GOTO  3080  
3070 GOSUB  4000  
3080 RETURN   
3100 REM EDIT CUSTOMER  
3110 CLS  
3120 PRINT "CUSTOMER NUMBER TO EDIT MUST BE LESS THAN";NC+1  
3130 PRINT :INPUT "CUSTOMER NUMBER TO EDIT(0 TO END)";I  
3135 IF  I=0  THEN  RETURN   
3140 A(I,0)=I:PRINT  F$(4):GOSUB  6100:PRINT :PRINT  F$(7):GOSUB  6150:PRINT   
3150 GOSUB  6000  
3160 PRINT :GOSUB  10100:GOTO  3110  
4000 REM EDIT SUBROUTINE  
4020 PRINT   
4025 I=0  
4030 INPUT "ENTER # OF ITEM YOU WISH TO EDIT,0 IF NONE";I  
4035 IF  I=0  THEN  RETURN   
4040 K=J:J=I:CLS:PRINT  F$(1):GOSUB  6300:PRINT :GOSUB  6050  
4050 CLS:J=K:GOTO  4025  
4060 PRINT :GOSUB  6000  
4070 CLS:PRINT "   ";F$(2):PRINT "   ";F$(3)  
4080 FOR  J=INT(K/12)*12+1  TO  K:PRINT USING "## ";J;:GOSUB 6100:NEXT   
4090 GOTO  4020  
5000 REM REPORT GENERATOR  
5005 CLS:INPUT "IS A LINE PRINTER TO BE USED(Y/N)";Z2$:IF  Z2$<>"Y"  AND  Z2$<>"N" THEN GOSUB  10000:GOTO  5005  
5007 CLS:PRINT  TAB(10);"REPORT MENU":PRINT   
5010 PRINT "1. AGED RECEIVABLES REPORT  
5020 PRINT "2. COMPLETE CUSTOMER LIST  
5030 PRINT "3. COMPLETE CUSTOMER LIST WITH INVOICES ATTACHED  
5040 PRINT "4. LIST OF ALL INVOICES  
5050 PRINT "5. END LIST PROGRAM  
5060 PRINT :INPUT "ENTER APPROPRIATE CHOICE";Z9  
5065 IF  Z9=5  THEN  RETURN   
5070 ON  Z9 GOSUB  5100,5200,5300,5400  
5080 GOTO  5007  
5100 REM AGED RECEIVABLES REPORT  
5105 FOR  I=0  TO  7:V(I)=0:NEXT   
5106 CLS  
5107 F$="AGED RECEIVABLES REPORT":PRINT  TAB(15); F$:PRINT :IF  Z2$="Y"  THEN  LPRINT  TAB(20); F$:LPRINT " "  
5110 PRINT  F$(4):IF  Z2$="Y"  THEN  LPRINT  F$(4):LPRINT " "  
5115 FOR  I=1  TO  NC  
5117 IF  A$(I,1)="9999"  THEN  GOTO  5133  
5120 GOSUB  6100:IF  Z2$="Y"  THEN  GOSUB  6200  
5125 FOR  J=1 TO 4:V(J)=V(J)+A(I,J):NEXT   
5130 IF  I/12=INT(I/12)  AND  Z2$="N"  THEN  PRINT :GOSUB  10100  
5133 NEXT  I  
5135 PRINT :IF  Z2$="Y"  THEN  LPRINT " "  
5140 PRINT USING  F$(6);"TOTALS",V(1),V(2),V(3),V(4)  
5150 IF  Z2$="Y"  THEN  LPRINT  USING  F$(6);"TOTALS",V(1),V(2),V(3),V(4)  
5190 PRINT :GOSUB  10100  
5195 RETURN   
5200 REM COMPLETE CUSTOMER LIST  
5205 F$="CUSTOMER LIST":PRINT  TAB(20); F$:IF  Z2$="Y"  THEN  LPRINT  TAB(20); F$:LPRINT " "  
5210 CLS  
5215 FOR  I=1  TO  NC  
5220 IF  A$(I,1)="9999"  THEN  GOTO  5260  
5230 PRINT  F$(4):GOSUB  6100:PRINT  F$(7):GOSUB  6150  
5240 IF  Z2$="Y"  THEN  LPRINT  F$(4):GOSUB  6200:LPRINT " ":LPRINT  F$(7):GOSUB  6250:LPRINT " ":LPRINT " "  
5250 IF  Z2$<>"Y"  THEN  PRINT :GOSUB  10100:PRINT   
5260 NEXT  I  
5290 RETURN   
5300 REM COMPLETE CUSTOMER LIST PLUS INVOICES  
5310 CLS  
5312 F$="CUSTOMER LIST":PRINT  TAB(20); F$:IF  Z2$="Y"  THEN  LPRINT  TAB(20); F$:LPRINT " "  
5315 FOR  I=1  TO  NC  
5320 IF  A$(I,1)="9999"  THEN  GOTO  5360  
5325 FOR  J=1 TO 7:V(J)=0:NEXT   
5330 PRINT  F$(4):GOSUB  6100:PRINT  F$(7):GOSUB  6150  
5332 PRINT  F$(1)  
5334 FOR  J=1  TO  NI  
5335 IF  B(J,0)=I  THEN  GOSUB  6300:V(1)=V(1)+B(J,1)  
5336 NEXT  J  
5337 PRINT   
5340 IF  Z2$="Y"  THEN  LPRINT  F$(4):GOSUB  6200:LPRINT " ":LPRINT  F$(7):GOSUB  6250:LPRINT " "  
5345 IF  Z2$<>"Y"  THEN  GOTO  5355  
5347 LPRINT  F$(1)  
5348 FOR  J=1  TO  NI  
5349 IF  B(J,0)=I  THEN  GOSUB  6350  
5350 NEXT  J  
5351 IF  Z2$="Y"  THEN  LPRINT "CHANGE IN OWED THIS MONTH = ";V(1)  
5352 IF  Z2$="Y"  THEN  LPRINT " ":LPRINT " "  
5355 IF  Z2$<>"Y"  THEN  PRINT :GOSUB  10100  
5360 NEXT  I  
5370 RETURN   
5400 REM COMPLETE INVOICE LIST  
5410 CLS  
5415 F$="INVOICE LIST":PRINT  TAB(25); F$:PRINT :IF  Z2$="Y"  THEN  LPRINT  TAB(25); F$:LPRINT " "  
5420 V(0)=0:V(1)=0:V(2)=0  
5430 PRINT  F$(1):IF  Z2$="Y"  THEN  LPRINT  F$(1):LPRINT " "  
5440 FOR  J= 1  TO  NI  
5450 GOSUB  6300:IF  Z2$="Y"  THEN  GOSUB  6350  
5455 V(0)=V(0)+B(J,1)  
5460 IF  B(J,1)>0  THEN  V(1)=V(1)+B(J,1) :  ELSE   V(2)=V(2)+B(J,1)  
5470 IF  Z2$<>"Y"  AND  J/12=INT(J/12)  THEN  PRINT :GOSUB  10100:CLS:PRINT  F$(1)  
5475 NEXT  J  
5480 PRINT USING  F$(3);"TOTAL CHARGES",V(1)  
5482 PRINT USING  F$(3);"TOTAL PAYMENTS",V(2)  
5484 PRINT USING  F$(3);"CHG-PAYMENTS ",V(0)  
5486 IF  Z2$<>"Y"  THEN  GOTO  5495  
5488 LPRINT  USING  F$(3);"TOTAL CHARGES",V(1)  
5489 LPRINT  USING  F$(3);"TOTAL PAYMENTS",V(2)  
5490 LPRINT  USING  F$(3);"CHG-PAYMENTS ",V(0)  
5495 PRINT :GOSUB  10100  
5499 RETURN   
6000 REM SBR FOR INPUTTING DATA ON 1 CUSTOMER  
6005 F$(9)="%                % "  
6006 F$(10)="     #####.##      "  
6010 A(I,0)=I  
6015 PRINT USING  F$(9);A$(I,1),:INPUT "CUST. NAME    ";A$(I,1)  
6018 PRINT USING  F$(10);A(I,1),:INPUT "CURRENT OWED ";A(I,1)  
6020 PRINT USING  F$(10);A(I,2),:INPUT "30-60 OWED   ";A(I,2)  
6022 PRINT USING  F$(10);A(I,3),:INPUT "60-90 OWED   ";A(I,3)  
6024 PRINT USING  F$(10);A(I,4),:INPUT "90+   OWED   ";A(I,4)  
6026 PRINT USING  F$(10);A(I,5),:INPUT "PAY LAST MTH ";A(I,5)  
6028 PRINT USING  F$(10);A(I,6),:INPUT "CHG LAST MTH ";A(I,6)  
6030 PRINT USING  F$(10);A(I,7),:INPUT "CUMUL. CHGES ";A(I,7)  
6040 RETURN   
6050 REM SBR FOR INPUTTING DATA FOR 1 INVOICE  
6055 F$(9)="  %               %":F$(10)="    ######.##      ":      F$(11)="        ###        "  
6057 PRINT :PRINT "ENTER NEGATIVE ITEM AMOUNT FOR PAYMENT":PRINT   
6060 PRINT USING  F$(9);B$(I,0),:INPUT  "ITEM NUMBER ";B$(I,0)  
6065 PRINT USING  F$(11);B(I,0),:INPUT  "CUST. NUMBER";B(I,0)  
6067 IF  B(I,0)>NC  THEN  PRINT "ILLEGAL CUSTOMER NUMBER":GOTO  6065  
6068 IF  A$(B(I,0),1)="9999"  THEN  PRINT "ILLEGAL CUSTOMER NUMBER":GOTO  6065  
6070 PRINT USING  F$(10);B(I,1),:INPUT  "ITEM AMOUNT ";B(I,1)  
6075 PRINT USING  F$(9);B$(I,1),:INPUT  "COMMENT     ";B$(I,1)  
6099 RETURN   
6100 REM PRINT CUSTOMER 1ST LINE ON CRT  
6110 PRINT USING  F$(5);A(I,0),A$(I,1),A(I,1),A(I,2),A(I,3),A(I,4)  
6120 RETURN   
6150 REM PRINT CUSTOMER 2ND LINE ON CRT  
6160 PRINT USING  F$(8);A(I,5),A(I,6),A(I,7)  
6170 RETURN   
6200 REM PRINT CUSTOMER 1ST LINE ON PRINTER  
6210 LPRINT  USING  F$(5);A(I,0),A$(I,1),A(I,1),A(I,2),A(I,3),A(I,4)  
6220 RETURN   
6250 REM PRINT CUSTOMER 2ND LINE ON PRINTER  
6260 LPRINT  USING  F$(8);A(I,5),A(I,6),A(I,7)  
6270 RETURN   
6300 REM PRINT 1 INVOICE LINE ON CRT  
6310 PRINT USING  F$(2);J,B$(J,0),B(J,0),B(J,1),B$(J,1)  
6320 RETURN   
6350 REM PRINT 1 INVOICE LINE ON PRINTER  
6360 IF  Z2$="Y"  THEN  LPRINT  USING  F$(2);J,B$(J,0),B(J,0),B(J,1),B$(J,1)  
6370 RETURN   
7000 REM POST TO ACCTS.  
7010 CLS  
7020 INPUT "POSTING ACCTS-PRESS Y TO PROCEED,N TO RETURN";Z9$  
7030 IF  Z9$="N"  THEN  RETURN   
7040 IF  Z9$<>"Y"  THEN  GOSUB  10000:PRINT :GOTO  7020  
7050 FOR  I=1  TO  NC:A(I,5)=0:A(I,6)=0:NEXT  I  
7060 FOR  I=1  TO  NI  
7070 IF  B(I,1)>0  THEN  A(B(I,0),6)=A(B(I,0),6)+B(I,1) :  ELSE   A(B(I,0),5)=A(B(I,0),5)+B(I,1)  
7080 NEXT  I  
7100 PRINT :INPUT "ARE OWED BY DATE AND CUMULATIVE BILL TO BE UPDATED(Y/N)";Z3$  
7110 IF  Z3$<>"Y"  AND  Z3$<>"N"  THEN  GOSUB  10000:GOTO  7100  
7120 IF  Z3$="N"  THEN  RETURN   
7150 REM UPDATE FILES  
7155 NI=0:B$(1,0)="":B(1,0)=0:B(1,1)=0:B$(1,1)=""  
7160 FOR  I = 1  TO  NC  
7165 A(I,7)=A(I,7)+A(I,6)  
7170 A(I,4)=A(I,4)+A(I,3):A(I,3)=A(I,2):A(I,2)=A(I,1):A(I,1)=A(I,6)  
7180 REM NOW APPLY PAYMENTS  
7185 AA=A(I,5)  
7190 FOR  J=4  TO  1  STEP  -1  
7195 IF  AA=0  THEN  GOTO  7290  
7200 IF  A(I,J)=0  THEN  GOTO  7290  
7210 A(I,J)=A(I,J)+AA:IF  A(I,J)>=0  THEN  AA=0:GOTO  7290  
7220 AA=A(I,J):A(I,J)=0  
7290 NEXT  J  
7300 A(I,1)=AA+A(I,1)  
7310 NEXT  I  
7320 RETURN   
9000 REM FORMATTING VARIABLES  
9010 F$(1)=" NO.   ITEM #    CUSTOMER #     ITEM AMOUNT       COMMENT"  
9020 F$(2)="###   %     %      ###            #####.##      %            %"  
9030 F$(3)="     %                       % $$######.##"  
9040 F$(4)="CUST.NO.   CUST.NAME     CURRENT   30-60    60-90      90+"  
9050 F$(5)="  ###     %          %  #####.##  #####.##  #####.##  #####.##"  
9060 F$(6)=" %                  %  ######.## ######.## ######.## ######.##"  
9070 F$(7)=" PMTS. LAST MONTH     CHGES LAST MONTH   CUMULATIVE CHGES"  
9080 F$(8)="    $$#####.##             $$#####.##       $$######.##"  
9099 RETURN   
10000 REM INPUT ERROR SBR  
10010 PRINT "INPUT ERROR! TRY AGAIN!":FOR  Z9=1 TO 300:NEXT  Z9  
10020 RETURN   
10100 INPUT "PRESS ENTER TO CONTINUE";Z9:RETURN   
10200 REM Y,N,A SBR  
10205 Z9$=" "  
10210 INPUT "ENTER Y IF OK,N IF ERROR,A TO ABORT";Z9$  
10220 IF  Z9$<>"Y"  AND  Z9$<>"N"  AND  Z9$<>"A" THEN GOSUB  10000:GOTO 10205  
10230 RETURN   
10300 REM Y,N SBR  
10305 Z9$=" "  
10310 INPUT "ENTER Y IF OK, N IF ERROR";Z9$  
10320 IF  Z9$<>"Y"  AND  Z9$<>"N" THEN GOSUB  10000:GOTO  10305  
10330 RETURN   
10400 REM MORE ENTRY? SBR  
10405 Z9$=" "  
10410 INPUT "DO YOU DESIRE MORE ENTRIES(Y/N)";Z9$  
10420 IF  Z9$<>"Y"  AND  Z9$<>"N" THEN GOSUB  10000:GOTO  10405  
10430 RETURN   
10500 REM ONLY Y/N SBR  
10510 IF  Z9$<>"Y"  AND  Z9$<>"N" THEN GOSUB  10000  
10520 RETURN   
11000 REM ELIMINATES TRAILING BLANKS OF VARIABLE Z8$  
11010 IF  RIGHT$(Z8$,1)=" "  THEN  Z8$=LEFT$(Z8$,LEN(Z8$)-1):GOTO  11010  
11020 RETURN   

