1 REM BUSBUD
5 CLEAR 1000
10 CLS:PRINT TAB(10);"BUSINESS BOOKKEEPING SYSTEM":PRINT
20 PRINT"THIS BUSINESS BOOKKEEPING AND BUDGET ANALYSIS PROGRAM HAS THE
25 PRINT"SAME CATEGORIES AS THE DOME  SIMPLIFIED WEEKLY BOOKKEEPING 
30 PRINT"RECORD #600. THE PROGRAM CAN HANDLE 1 MONTH'S WORTH OF DATA
35 PRINT"AT A TIME, BUT NOT TO EXCEED 100 ENTRIES ON A 16K MACHINE.
40 PRINT"ON MACHINES WITH GREATER MEMORY IT IS ONLY NECESSARY TO CHANGE
45 PRINT"THE MAXX=100 ON LINE 100 TO MAXX=200 FOR 200 ENTRIES, 
50 PRINT"ETC. TO LEARN THE SYSTEM, USE IT. REMEMBER TO READ A MONTH'S
55 PRINT"DATA INTO MEMORY BEFORE USE(UNLESS IT'S A NEW MONTH), AND TO
60 PRINT"SAVE THE DATA AFTER USE. OTHERWISE DRASTIC RESULTS MAY OCCUR.
65 PRINT"THE BUDGET ANALYSIS WILL COMPARE ACTUAL EXPENDITURES TO
70 PRINT"USER INPUT BUDGET AMOUNTS FOR EACH CATEGORY.
80 PRINT:INPUT"PRESS ENTER TO BEGIN";Z9$
95 CLS
96 INPUT"ARE DISK DRIVES ATTACHED(Y/N)";ZD$
98 IF ZD$<>"Y" AND ZD$<>"N" THEN GOSUB 10000:GOTO 95
100 CLEAR 1000:DEFDBL A,C,Y:MAXX=100:DIM A(100,3),C(43,3),C$(43),Y(43)
110 DIM AE(3),AT(3),AS(3),AO(3)
120 GOSUB 10500:GOSUB 14000:GOSUB 11000
1000 CLS:PRINT"    MAIN MENU"
1005 PRINT
1010 PRINT"1.READ IN MONTH'S DATA FROM CASSETTE"
1020 PRINT"2.READ IN MONTH'S DATA FROM DISK
1030 PRINT"3.WRITE MONTH'S DATA TO CASSETTE
1040 PRINT"4.WRITE MONTH'S DATA TO DISK
1050 PRINT"5.ADD TO MONTH'S FILE
1060 PRINT"6.EDIT MONTH'S FILE
1070 PRINT"7.CATEGORY REVIEW AND CHANGE
1080 PRINT"8.BUDGET ANALYSIS
1085 PRINT"9.NEW MONTH INITIALIZE,BUDGET SAME"
1090 PRINT"10.END PROGRAM
1100 PRINT:INPUT"MAKE YOUR CHOICE ";Z5
1110 IF Z5<>INT(Z5) OR Z5<1 OR Z5>10 THEN GOSUB 10000:GOTO 1000
1120 ON Z5 GOSUB 2100,2200,2300,2400,2500,2600,2700,2800,2950,2900
1130 GOTO 1000
2100 REM DATA INPUT FROM CASSETTE
2105 CLS:PRINT"CASSETTE INPUT 
2130 PRINT:INPUT"INPUT MONTH ";M1
2150 INPUT"PREPARE CASSETTE TAPE.PRESS ENTER WHEN READY";Z9
2160 GOSUB 12000
2165 IF M<>M1 THEN GOSUB 10200 ' WRONG MONTH
2170 GOSUB 10100:RETURN
2200 REM DATA INPUT FROM DISK
2210 CLS:PRINT"DISK DATA INPUT "
2220 PRINT:INPUT"ENTER MONTH(1-12)";M1
2230 IF M1<>INT(M1) OR M1<1 OR M1>12 THEN GOSUB 10000:GOTO 2210
2240 PRINT"PREPARE DISKETTE IN DISK DRIVE":GOSUB 10100
2250 GOSUB 13000
2260 IF M<>M1 THEN GOSUB 10200
2270 GOSUB 10100:RETURN
2300 REM DATA OUTPUT TO CASSETTE
2310 CLS:PRINT"DATA OUTPUT TO CASSETTE"
2320 INPUT"ENTER MONTH(1-12)";M1:M=M1
2350 INPUT"PRESS ENTER WHEN CASSETTE READY";Z9
2360 GOSUB 12200
2370 RETURN
2400 REM DATA OUTPUT TO DISK
2410 CLS:PRINT"DATA OUTPUT TO DISK"
2415 INPUT"ENTER MONTH NUMBER(1-12)";M1
2420 M=M1:PRINT"PREPARE DISKETTE IN DRIVE ":GOSUB 10100
2430 GOSUB 13200
2450 RETURN
2500 CLS:PRINT"ADD TO FILE ROUTINE":PRINT
2505 PRINT"LAST ITEM SO FAR.":PRINT USING F$(3);ZZ$
2510 N=N1:GOSUB 10700
2515 GOSUB 15500
2520 PRINT:INPUT"ANY MORE ADDITIONS TODAY(Y/N)";Z9$
2530 IF Z9$<>"Y" AND Z9$<>"N" THEN GOSUB 10000:GOTO 2520
2540 IF Z9$="Y" THEN GOTO 2500 ELSE RETURN
2600 REM EDIT & REVIEW
2610 CLS:PRINT USING F$(3);ZZ$
2620 FOR N=1 TO N1:GOSUB 10700
2630 IF N/10= INT(N/10) THEN GOSUB 2640:CLS:PRINT USING F$(3);ZZ$
2635 NEXT N
2637 X$=" "
2640 INPUT"INPUT E TO EDIT,ENTER FOR MORE";X$
2645 IF X$="E" THEN GOSUB 10800
2650 IF N<>N+1 THEN RETURN
2660 RETURN
2700 REM CATEGORY REVIEW OR CHANGE
2710 CLS:PRINT "   MENU"
2720 PRINT:PRINT"1.REVIEW OF ALL CATEGORIES"
2730 PRINT"2.CHANGE BUDGET AMOUNTS FOR MONTH"
2735 PRINT"3.RETURN TO MAIN MENU"
2740 PRINT:INPUT"MAKE CHOICE";Z9:ON Z9 GOTO 2750,2770,2799
2745 GOSUB 10100:GOTO 2710
2750 GOSUB 14200:GOTO 2710
2770 FOR I=0 TO 42
2775 PRINT USING F$(4);I,C$(I),C(I,2);:INPUT" CHANGE AMT. ";C(I,2)
2780 NEXT I :GOTO 2710
2799 RETURN
2800 REM BUDGET ANALYSIS
2810 FOR I=0 TO 42:C(I,1)=0:NEXT I
2820 FOR I=1 TO N1:C(A(I,1),1)=C(A(I,1),1)+A(I,2):NEXT I
2830 AI(1)=C(0,1):AI(2)=C(0,2):AI(3)=AI(1)-AI(2)
2840 AE(1)=0:AE(2)=0:AE(3)=0
2850 FOR I=1 TO 35:AE(1)=AE(1)+C(I,1):AE(2)=AE(2)+C(I,2):NEXT
2855 AE(3)=AE(1)-AE(2)
2865 AT(1)=0:AT(2)=0:AT(3)=0
2868 FOR I=36 TO 42:AT(1)=AT(1)+C(I,1):AT(2)=AT(2)+C(I,2):NEXT
2870 AT(3)=AT(1)-AT(2)
2872 CLS:PRINT USING F$(6);ZZ$
2875 FOR I=0 TO 42
2878 IF I/11=INT(I/11) AND I<>0 THEN GOSUB 10100:CLS:PRINT USING F$(6);ZZ$
2880 PRINT USING F$(5);I,C$(I),C(I,1),C(I,2),C(I,1)-C(I,2)
2882 NEXT I
2883 PRINT:INPUT"PRESS ENTER FOR TOTALS";Z9$:CLS
2884 PRINT USING F$(6);ZZ$
2885 PRINT USING F$(5);0,"TOTAL INCOME",AI(1),AI(2),AI(3)
2888 PRINT USING F$(5);0,"DEDUCT.EXP.",AE(1),AE(2),AE(3)
2890 PRINT USING F$(5);0,"NON DED EXP.",AT(1),AT(2),AT(3)
2892 AO(1)=AI(1)-AE(1)-AT(1):AO(2)=AI(2)-AE(2)-AT(2):AO(3)=AO(1)-AO(2)
2895 PRINT USING F$(5);0,"NET CASH FLOW",AO(1),AO(2),AO(3)
2898 PRINT:GOSUB 10100
2899 RETURN
2900 CLS:INPUT"ARE YOU SURE(Y/N)";Z9$
2910 IF Z9$<>"Y" THEN RETURN
2920 END
2950 REM ZERO FOR NEW MONTH.LEAVES BUDGET AMTS ALONE
2960 GOSUB 11000:RETURN
10000 REM INPUT ERROR SBR
10010 PRINT"INPUT ERROR! TRY AGAIN!":FOR J3=1 TO 300:NEXT
10020 RETURN
10100 INPUT"PRESS ENTER TO CONTINUE ";Z9:RETURN
10200 PRINT"MONTHS DO NOT COINCIDE.INPUT IS FOR MONTH ";M:RETURN
10500 REM FORMATS
10505 F$(4)="## %                      % ######.##"
10510 F$(2)="###  ##   %                 % ######.##   ##"
10520 F$(3)="NO.  CL.       CL.              AMT.      DAY  !"
10530 F$(5)="## %             % ######.##  ######.## ######.##"
10540 F$(6)="CL       CL          TOTAL      BUDGET   OV.OR.UND !"
10590 RETURN
10700 PRINT USING F$(2);N,A(N,1),C$(A(N,1)),A(N,2),A(N,3)
10705 RETURN
10800 REM EDIT ROUTINE
10805 INPUT"WHICH ITEM NUMBER TO EDIT";E
10810 IF E<0 OR E>N1 OR E<>INT(E) THEN GOSUB 10000:GOTO 10805
10815 C(A(E,1),1)=C(A(E,1),1)-A(E,2)
10820 N2=E:GOSUB 15520
10830 IF Z8=1 THEN N1=N1-1
10850 RETURN
11000 REM SBR ZEROES MONTHLY AMOUNTS
11010 FOR J3=1 TO MAXX:FOR J4=1 TO 3
11020 A(J3,J4)=0
11030 NEXT J4:NEXT J3
11040 FOR J3=0 TO 42
11050 C(J3,1)=0:C(J3,3)=0
11060 NEXT J3
11070 N1=0
11090 RETURN
12000 REM SBR TO READ IN MONTHLY DATA FROM CASSETTE
12010 GOSUB 11000:REM ZERO ANY OLD AMOUNTS
12015 ON ERROR GOTO 12020
12016 ' IF ZD$="Y" THEN CMD"T"
12020 INPUT #-1,M:REM M IS MONTH NUMBER
12025 FOR N=0 TO 42
12030 INPUT #-1,C(N,1),C(N,2),C(N,3):REM BUDGET & SPENT AMTS.
12040 NEXT N
12050 INPUT #-1,N1:REM N1 = # RECORDS IN FILE
12060 IF N1=0 THEN RETURN
12070 FOR N=1 TO N1
12080 INPUT #-1,A(N,1),A(N,2),A(N,3)
12090 NEXT N
12110 RETURN
12200 REM PRINT MONTHLY DATA ONTO CASSETTE
12205 ON ERROR GOTO 12210
12208 ' IF ZD$="Y" THEN CMD"T"
12210 WRITE #-1,M :REM MONTH NUMBER
12220 FOR N=0 TO 42
12230 WRITE #-1,C(N,1),C(N,2),C(N,3):REM BUDGET & AMTS SPENT
12235 NEXT N
12240 WRITE #-1,N1:REM N1=NO. OF RECORDS IN FILE
12250 IF N1=0 THEN RETURN
12260 FOR N=1 TO N1
12270 WRITE #-1,A(N,1),A(N,2),A(N,3)
12280 NEXT N
12290 RETURN
12440 REM NEXT N
12450 REM RETURN
12600 REM JUST GET FINAL MONTHLY TOTALS FROM CASSETTE
12610 INPUT #-1,M:REM MONTH NUMBER
12620 FOR N=0 TO 42
12630 INPUT #-1,C(N,1),C(N,2),C(N,3)
12640 NEXT N
12650 RETURN
13000 REM READ IN MONTHLY DATA FROM DISK
13010 GOSUB 11000: REM ZERO ANY OLD AMOUNTS
13015 FF$=STR$(M1):FF$=RIGHT$(FF$,LEN(FF$)-1)
13020 F$="MONTH"+FF$:REM M1 IS MONTH IN PROGRAM
13025 OPEN"I",1,F$
13030 INPUT #1,M:REM MONTH NUMBER
13040 FOR N=0 TO 42
13050 INPUT #1,C(N,1),C(N,2),C(N,3):REM BUDGET AMTS & TOTALS FOR CAT.
13060 NEXT N
13070 INPUT #1,N1:REM NUMBER OF ITEMS PRSENTLY IN FILE
13080 IF N1=0 THEN CLOSE #1:RETURN
13090 FOR N=1 TO N1
13100 INPUT #1,A(N,1),A(N,2),A(N,3)
13110 NEXT N
13120 CLOSE #1:RETURN
13200 REM PRINT MONTHLY DATA ONTO DISK
13205 FF$=STR$(M1):FF$=RIGHT$(FF$,LEN(FF$)-1)
13210 F$="MONTH"+FF$:REM M1 IS MONTH IN PROGRAM
13220 OPEN"O",1,F$
13230 WRITE # 1,M
13240 FOR N=0 TO 42
13250 WRITE # 1,C(N,1),C(N,2),C(N,3)
13260 NEXT N
13270 WRITE # 1,N1:REM NUMBER OF ITEMS PRESENTLY ON FILE
13280 IF N1=0 THEN CLOSE #1:RETURN
13290 FOR N=1 TO N1
13300 WRITE # 1,A(N,1),A(N,2),A(N,3)
13310 NEXT N
13320 CLOSE #1:RETURN
13600 REM JUST GET FINAL MONTHLY TOTALS FROM DISK
13610 GOSUB 11000:REM ZERO OLD AMOUNTS
13620 F$="MONTH"+STR$(M1)
13630 OPEN"I",1,F$
13640 INPUT # 1,M
13650 FOR N=0 TO 42
13660 INPUT # 1,C(N,1),C(N,2),C(N,3)
13670 NEXT N
13680 CLOSE #1:RETURN
14000 REM ROUTINE LOADING C$() ARRAY
14010 DATA INCOME,MDSE-MATERIALS,ACCOUNTING,ADVERTISING,AUTO EXP
14015 DATA CARTONS-ETC.,CONTRIBUTIONS,DELIVERY EXP.,ELECTRICITY
14020 DATA ENTERTAINMENT,FREIGHT & EXPRESS,HEAT,INSURANCE,INTEREST
14025 DATA LAUNDRY,LEGAL EXP.,LICENSES,MISC. EXP.,OFFICE EXP.,POSTAGE
14030 DATA RENT,REPAIRS,SHOP EXP.,TAX-SOC.SEC.,TAX-STATE UNEMP.,TAX-OTHER
14035 DATA SELLING EXP.,SUPPLIES,TELEPHONE,TRADE DUES-ETC.,TRAVELING EXP.
14040 DATA WAGES & COMM.,WATER,"  ","  ","  "
14045 DATA NOTES PAYABLE,FED. INC. TAX,LOANS PAYABLE,LOANS RECEIV.
14050 DATA PERSONAL,FIXED ASSETS,"   ","   ","  ","  "
14070 FOR J3=0 TO 42:READ C$(J3):NEXT
14080 RETURN
14200 REM REVIEW OF CATEGORIES
14210 F$(1)="## %                    %  ## %                 %"
14220 CLS:FOR I=0 TO 42 STEP 2
14230 PRINT USING F$(1);I,C$(I),I+1,C$(I+1)
14235 IF I/22=INT(I/22) AND I<>0 THEN PRINT:GOSUB 10100:CLS
14240 NEXT I
14245 PRINT:PRINT"CATEGORIES 1-35 DEDUCTABLES EXPENSES":PRINT"CATEGORIES 36-42 NONDEDUCTABLE EXPENSES":PRINT
14250 GOSUB 10100
14260 RETURN
15000 REM GET MONTHLY TOTALS FROM MONTH'S DATA
15010 FOR N=1 TO N1
15020 K=A(N,1):C(K,1)=C(K,1)+A(N,2)
15030 NEXT N
15040 RETURN
15500 REM INPUT ROUTINE
15510 N2=N1+1:PRINT
15515 REM
15520 INPUT"CLASSIFICATION,AMOUNT,DAY";A(N2,1),A(N2,2),A(N2,3)
15522 A9=A(N2,1):IF A9<>ABS(INT(A9)) OR A9>42 THEN GOSUB 10000:GOTO 15515
15525 PRINT:PRINT C$(A(N2,1));"    $";A(N2,2),A(N2,3)
15530 INPUT"ENTER 1 IF OK,2 IF IN ERROR,3 TO ABORT";Z8
15540 IF Z8<>1 AND Z8<>2 AND Z8<>3 THEN GOSUB 10000:GOTO 15530
15550 IF Z8=2 THEN GOTO 15520
15555 IF Z8=3 THEN RETURN
15560 N1=N1+1:C(A(N2,1),1)=C(A(N2,1),1)+A(N2,2)
15570 RETURN
