10 DEFINT A-Z
15 DEF FNCENTER$(A$)=STRING$(26-LEN(A$)/2-.5," ")+A$
20 DEF FNLCNTR$(A$)=STRING$(40-LEN(A$)/2-.5," ")+A$
25 DEF FNVERTAB$(A)=STRING$(A!,LF$)
30 DEF FNPRTAT$(X,Y)=CHR$(&H1B)+"="+CHR$(Y+32)+CHR$(X+32)
35 DEF FNMONTH$(X$)=MID$("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",(VAL(X$)-1)*3+1,3)
40 COMMON ANS1$(),ANS2$(),ACNTCODE$(),ACNTLBL$(),ACNTBUDG!(),NUMRECS,DATE$,NUMACCTS
45 COMMON CLS$,DARK$,ESC$,BRITE$,STRSCR$,ENDSCR$
50 COMMON MVLEFT$,MVRITE$,MVDOWN$,MVUP$,CR$,LF$
55 COMMON TF$,DELEND$,DELINE$,DELCHA$,MOVSCR$
60 COMMON MOVCUR$,BELL$
1250 '
1260 '
1270 '	E D I T   B U D G E T   R O U T I N E
1280 '
1290 '	This is the routine to use in order
1300 '	to add new account labels, and change
1310 '	old labels, and to change budgeted
1320 '	amounts for each account.
1330 '
1340 PRINT CLS$
1350 PRINT:PRINT:PRINT FNCENTER$("B U D G E T   E D I T O R")
1360 PRINT:PRINT:PRINT "  "FNCENTER$(STRSCR$+"Budget Editor Menu"+ENDSCR$)
1370 PRINT FNCENTER$(STR$(NUMACCTS)+" Accounts")
1380 PRINT
1390 '
1400 PRINT FNCENTER$("(1) Add new account labels              ")
1410 PRINT FNCENTER$("(2) Edit old account labels             ")
1420 PRINT
1430 PRINT FNCENTER$("(3) Review account labels               ")
1440 PRINT FNCENTER$("(4) Generate hardcopy of account codes  ")
1450 PRINT FNCENTER$("(5) Generate hardcopy of account budgets")
1460 PRINT
1470 PRINT FNCENTER$("(0) Return to Main Menu                 ")
1480 '
1490 PCOL=0:PLIN=20:PROMPT$=FNCENTER$("Please enter your selection :0:")
1500 GOSUB 3790
1510 IF ANS$="0" THEN 4100
1520 IF ANS$>"5" THEN PRINT BELL;:GOTO 1490
1530 ON VAL(ANS$) GOSUB 1580,2030,2720,2940,3340
1540 GOTO 1340
1550 DATA "Account code ......... :  :"
1560 DATA "Account label ................... :                    :"
1570 DATA "Budget for account .............. ::C 8C 8C 8C . 9C 7C:"
1580 IF NUMACCTS<200 THEN 1620
1590 PRINT FNPRTAT$(0,20) DELEND$ "Cannot add more labels!"
1600 FOR X=1 TO 1000:NEXT X
1610 GOTO 1490
1620 PRINT CLS$
1630 PRINT FNCENTER$("Add Account Labels Option")
1640 '
1650 RESTORE 1550
1660 FL=6
1670 FOR X=1 TO 3
1680 PLIN(X)=FL
1690 FL=FL+2
1700 READ ANS$
1710 PROMPT$(X)=ANS$
1720 NEXT X
1730 FOR X=1 TO 3
1740 PRINT FNPRTAT$(0,PLIN(X)) PROMPT$(X)
1750 NEXT X
1760 X=0:NUMACCTS=NUMACCTS+1
1770 X=X+1
1780 ON X GOTO 1790,1920,1980,1910
1790 PRINT FNPRTAT$(0,16) DELINE$ "Type in a two character code."
1800 GOSUB 3770
1810 IF ANS$="" THEN PRINT BELL$;:NUMACCTS=NUMACCTS-1:GOTO 1340
1820 XX=1
1830 WHILE XX<NUMACCTS AND ACNTCODE$(XX)<>ANS$
1840 XX=XX+1
1850 WEND
1860 IF XX=NUMACCTS THEN 1890
1870 PRINT FNPRTAT$(0,17)"Code " ANS$ " already exists for " ACNTCODE$(XX)
1880 PRINT BELL$;:FOR XX=1 TO 10:NEXT:GOTO 1790
1890 ACNTCODE$(XX)=ANS$
1900 GOTO 1770
1910 RETURN
1920 PRINT FNPRTAT$(0,17) DELINE$ CR$ MVUP$ DELINE$;
1930 PRINT "Type in a label for this account."
1940 GOSUB 3770
1950 IF ANS$="" THEN PRINT BELL$;:GOTO 1920
1960 ACNTLBL$(NUMACCTS)=ANS$
1970 GOTO 1770
1980 PRINT FNPRTAT$(0,16) DELINE$ "Type in budgeted amount for this account."
1990 GOSUB 3770
2000 ACNTBUDG!(NUMACCTS)=VAL(ANS$)
2010 GOTO 1770
2020 RESUME 2290
2030 PRINT CLS$
2040 PRINT FNPRTAT$(0,1) FNCENTER$("Edit Labels Option")
2050 PRINT:PRINT:PRINT
2060 PRINT "     To use this option you must know the two byte"
2070 PRINT "account code of the label to be edited.  If you"
2080 PRINT "do not know what the code of the account is, answer"
2090 PRINT "'no' to the next question and then get a review of"
2100 PRINT "the account labels under the Budget Editor menu."
2110 PRINT
2120 PRINT "     You should note that it is generally not a"
2130 PRINT "good practice to change account labels, and almost"
2140 PRINT "never should one change the account code, since"
2150 PRINT "records may have been placed under these accounts."
2160 PRINT "The main purpose for this option is to change the"
2170 PRINT "budgeted amount for an account...  Indeed this"
2180 PRINT "should be done frequently.
2190 XX=5
2200 PRINT FNPRTAT$(XX,19) DELEND$"Do you wish to continue with this option?  ";
2210 GOSUB 3720
2220 IF YES$="N" THEN RETURN ELSE PRINT DELINE$;
2230 PLIN=21:PCOL=XX:PROMPT$="Enter the code of the account to edit.  :  :"
2240 GOSUB 3790
2250 XX=1:ON ERROR GOTO 2020
2260 WHILE ACNTCODE$(XX)<>ANS$ AND XX<=NUMACCTS
2270 XX=XX+1
2280 WEND
2290 ON ERROR GOTO 0
2300 IF XX<=NUMACCTS THEN 2330
2310 PRINT BELL$ CLS$ FNPRTAT$(5,3) "Account code not found."
2320 GOTO 2040
2330 PRINT CLS$
2340 PRINT STRSCR$ "CODE -  ACCOUNT NAME          -    BUDGET" ENDSCR$
2350 A$=" \\  -  \                  \  -  $$###.##"
2360 PRINT USING A$;ACNTCODE$(XX);ACNTLBL$(XX);ACNTBUDG!(XX)
2370 PRINT:PRINT
2380 PRINT "Do You wish to change the code?  ";
2390 GOSUB 3720
2400 IF YES$="N" THEN 2510
2410 PLIN=6:PCOL=0:PROMPT$="Please enter the new code.  :  :"
2420 GOSUB 3790
2430 FOR X=1 TO NUMACCTS
2440 IF ACNTCODE$(X)=ANS$ AND X<>XX THEN YES$="N"
2450 NEXT X
2460 IF YES$="Y" THEN ACNTCODE$(XX)=ANS$:GOTO 2500
2470 PRINT FNPRTAT$(2,7) BELL$ "Code used in other account."
2480 FOR X=1 TO 500:NEXT X
2490 GOTO 2330
2500 ACNTCODE$(XX)=ANS$
2510 PRINT CLS$
2520 PRINT STRSCR$ "CODE -  ACCOUNT NAME          -    BUDGET" ENDSCR$
2530 PRINT USING A$;ACNTCODE$(XX);ACNTLBL$(XX);ACNTBUDG!(XX)
2540 PRINT:PRINT
2550 PRINT "Do You wish to change the account name?  ";
2560 GOSUB 3720
2570 IF YES$="N" THEN 2610
2580 PLIN=6:PCOL=0:PROMPT$="Please enter the new name.  :                    :"
2590 GOSUB 3790
2600 ACNTLBL$(XX)=ANS$
2610 PRINT CLS$
2620 PRINT STRSCR$ "CODE -  ACCOUNT NAME          -    BUDGET" ENDSCR$
2630 PRINT USING A$;ACNTCODE$(XX);ACNTLBL$(XX);ACNTBUDG!(XX)
2640 PRINT:PRINT
2650 PRINT "Do You wish to change the account budget?  ";
2660 GOSUB 3720
2670 IF YES$="N" THEN 2702
2680 PLIN=6:PCOL=0:PROMPT$="Please enter the new budget.  :@C >C >C =C . >C ;C:"
2690 GOSUB 3790
2700 ACNTBUDG!(XX)=VAL(ANS$)
2702 PRINT CLS$
2704 PRINT STRSCR$ "CODE -  ACCOUNT NAME          -    BUDGET" ENDSCR$
2706 PRINT USING A$;ACNTCODE$(XX);ACNTLBL$(XX);ACNTBUDG!(XX)
2710 XX=0:GOTO 2200
2720 PRINT CLS$;
2730 PRINT STRSCR$ "CODE -  ACCOUNT NAME          -    BUDGET" ENDSCR$
2740 A$=           " \\  -  \                  \  -  $$###.##"
2750 XX=1:SUM!=0
2760 LN=2:GOSUB 2850
2770 IF XX>NUMACCTS THEN PRINT USING A$;" ";"               TOTAL";SUM!+.001:GOTO 2820
2780 PRINT:PRINT "Press <RETURN> to continue, any other to exit.  ";
2790 ANS$=INPUT$(1)
2800 IF ANS$=CR$ THEN GOSUB 2900:GOTO 2760
2810 RETURN
2820 PRINT:PRINT "End of accounts. Press <RETURN> to exit.  ";
2830 ANS$=INPUT$(1)
2840 RETURN
2850 IF XX>NUMACCTS THEN RETURN
2860 PRINT FNPRTAT$(0,LN);
2870 PRINT USING A$;ACNTCODE$(XX);ACNTLBL$(XX);ACNTBUDG!(XX)
2875 IF ACNTCODE$(XX)="DP" THEN SUM!=SUM!+ACNTBUDG!(XX) ELSE SUM!=SUM!-ACNTBUDG!(XX)
2880 XX=XX+1:LN=LN+1
2890 IF LN=21 THEN RETURN ELSE 2850
2900 FOR LN=1 TO 22:PRINT FNPRTAT$(0,2) DELINE$;:NEXT:RETURN
2940 PRINT CLS$
2950 PRINT FNCENTER$("HARDCOPY OF ACCOUNT CODES")
2960 PRINT:PRINT:PRINT
2970 PRINT "     The program is about ready to generate a list"
2980 PRINT "of the account codes and their definitions.  For"
2990 PRINT "this to be done a printer must be attached and"
3000 PRINT "ready to print.  Paper should be positioned at"
3010 PRINT "top-of-form (see your printer's manual), for this"
3020 PRINT "routine to work correctly."
3030 PRINT
3040 PRINT "     If your printer is not connected, or if it is"
3050 PRINT "turned off or off line, correct this condition by"
3060 PRINT "by following pertinent instructions in your com-"
3070 PRINT "puter and/or line printer manuals."
3080 PRINT
3090 PRINT DELEND$"     Are you and your printer ready to print?  ";
3100 GOSUB 3720
3110 IF YES$="N" THEN RETURN
3120 PRINT CR$ LF$ LF$ "     Printing account codes..."
3130 A$="  \\  - \                \  \\  - \                \  \\  - \                \"
3140 B$=" CODE   ACCOUNT            CODE   ACCOUNT            CODE   ACCOUNT"
3150 C$=" _____________________________________________________________________________"
3160 LN=1:XX=1
3170 LPRINT CR$ LF$ LF$ LF$;
3180 X=1
3190 WHILE X<=9 AND XX<=NUMACCTS
3200 IF X=1 THEN LPRINT B$ CR$ C$
3210 IF XX<=NUMACCTS THEN A1$=ACNTCODE$(XX):B1$=ACNTLBL$(XX) ELSE A1$=" ":B1$=" "
3220 XX=XX+1
3230 IF XX<=NUMACCTS THEN A2$=ACNTCODE$(XX):B2$=ACNTLBL$(XX) ELSE A2$=" ":B2$=" "
3240 XX=XX+1
3250 IF XX<=NUMACCTS THEN A3$=ACNTCODE$(XX):B3$=ACNTLBL$(XX) ELSE A3$=" ":B3$=" "
3260 XX=XX+1
3270 LPRINT USING A$;A1$;B1$;A2$;B2$;A3$;B3$
3275 X=X+1
3280 WEND
3290 LPRINT LF$ LF$;
3300 LN=LN+1
3310 IF LN=6 THEN LPRINT TF$;:IF XX<=NUMACCTS THEN 3170
3320 IF XX<=NUMACCTS THEN 3180
3330 RETURN
3340 PRINT CLS$
3350 PRINT FNCENTER$("HARDCOPY OF ACCOUNT BUDGETS")
3360 PRINT:PRINT:PRINT
3370 PRINT "     The program is about ready to generate a list"
3380 PRINT "of the accounts and their budgets.  For this to be"
3390 PRINT "done a printer must be attached and ready to print."
3400 PRINT "Paper should be positioned at top-of-form (see your"
3410 PRINT "printer's manual), for this routine to work"
3420 PRINT "correctly."
3430 PRINT
3440 PRINT "     If your printer is not connected, or if it is"
3450 PRINT "turned off or off line, correct this condition by"
3460 PRINT "by following pertinent instructions in your com-"
3470 PRINT "puter and/or line printer manuals."
3480 PRINT
3490 PRINT "     Are you and your printer ready to print?  ";
3500 GOSUB 3720
3510 IF YES$="N" THEN RETURN
3520 PRINT CR$ LF$ LF$ "     Printing account budgets..."
3530 A$="       \                  \ $$###.##        \                  \ $$###.##"
3540 B$="       ACCOUNT                BUDGET        ACCOUNT                BUDGET"
3550 C$="       _____________________________        _____________________________"
3560 LN=1:XX=1
3570 LPRINT CR$ LF$ LF$ LF$;
3580 X=1
3590 WHILE X<=9 AND XX<=NUMACCTS
3600 IF X=1 THEN LPRINT B$ CR$ C$
3610 IF XX<=NUMACCTS THEN A1$=ACNTLBL$(XX):B1!=ACNTBUDG!(XX) ELSE A1$=" ":B1!=0
3620 XX=XX+1
3630 IF XX<=NUMACCTS THEN A2$=ACNTLBL$(XX):B2!=ACNTBUDG!(XX) ELSE A2$=" ":B2!=0
3640 XX=XX+1
3650 LPRINT USING A$;A1$;B1!;A2$;B2!
3655 X=X+1
3660 WEND
3670 LPRINT LF$ LF$;
3680 LN=LN+1
3690 IF LN=6 THEN LPRINT TF$;:IF XX<=NUMACCTS THEN 3570
3700 IF XX<=NUMACCTS THEN 3580
3710 RETURN
3720 YES$=INPUT$(1)
3740 IF YES$="Y" OR YES$="N" THEN PRINT YES$;:RETURN
3750 PRINT BELL$;
3760 GOTO 3720
3770 PROMPT$=PROMPT$(X)
3780 PLIN=PLIN(X):PCOL=0
3790 GOSUB 7000:PRINT FNPRTAT$(PCOL,PLIN)PROMPT$;:A=PCOL
3800 PCOL=INSTR(PROMPT$,":"):CRS=INSTR(PCOL+1,PROMPT$,":")-PCOL+1
3810 FOR XYZ=1 TO CRS
3820 ANS2$(XYZ)=MID$(PROMPT$,XYZ+PCOL-1,1)
3830 IF XYZ<>1 THEN ANS1$(XYZ-1)=ANS2$(XYZ)
3840 NEXT XYZ:IF ANS1$(1)=CHR$(160) THEN 10000 ELSE PCOL=PCOL+A
3850 LTH=CRS-2
3860 PRINT FNPRTAT$(PCOL,PLIN);:CRS=2
3870 ANS$=INPUT$(1)
3880 IF ANS$=CR$ THEN 3970
3890 IF ANS$=MVRITE$ AND CRS<LTH+2 THEN CRS=CRS+1:PRINT ANS$;:IF ANS2$(CRS)=":" THEN 3950 ELSE IF INSTR("# 0123456789",ANS2$(CRS)) THEN 3870 ELSE 3890
3900 IF ANS$=MVLEFT$ AND CRS>1 THEN CRS=CRS-1:PRINT ANS$;:IF ANS2$(CRS)=":" THEN 3950 ELSE IF INSTR("# 0123456789",ANS2$(CRS)) THEN 3870 ELSE 3900
3910 IF ASC(ANS$)<32 THEN 3950
3920 IF ANS2$(CRS)=" " THEN 3960
3930 IF 0<>INSTR("0123456789",ANS2$(CRS)) AND 0<>INSTR("0123456789",ANS$) THEN 3960
3940 IF ANS2$(CRS)="#" AND INSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ANS$) THEN 3960
3950 PRINT BELL$;:GOTO 3870
3960 ANS1$(CRS-1)=ANS$:PRINT ANS$;MVLEFT$;:ANS$=MVRITE$:GOTO 3890
3970 IF LTH=0 THEN ANS$="" :RETURN
3980 IF INSTR("# ",ANS1$(LTH)) THEN LTH=LTH-1:GOTO 3970
3990 LAST$=ANS$
4000 ANS$=""
4010 FOR XYZ=1 TO LTH
4020 ANS$=ANS$+ANS1$(XYZ)
4030 NEXT XYZ
4040 RETURN
4100 PRINT CLS$ FNPRTAT$(0,12) FNCENTER$("RETURNING TO MAIN MENU");
4200 PRINT FNPRTAT$(53,0);
5000 CHAIN "A:BUDG.BAS", 1600
7000 IF FRE(0)>500 THEN RETURN
7010 FOR BL=1 TO 7:PRINT BELL$;:POKE &HEF6B,3
7020 PRINT FNPRTAT$(0,PLIN) DELEND$ FNCENTER$("=======> GARBAGE COLLECTION IN PROGRESS <=======");
7030 FOR BLL=1 TO 20:NEXT BLL, BL:BL=FRE(A$)
7040 PRINT CR$ DELEND$;:RETURN
10000 PCOL=INSTR(PCOL+1,PROMPT$,"."):IF PCOL=0 THEN PCOL=LEN(PROMPT$) ELSE CRS=CRS-(LEN(PROMPT$)-PCOL)
10010 PCOL=PCOL+A-1:ANS2$=""
10020 PRINT FNPRTAT$(PCOL,PLIN);
10030 ANS$=INPUT$(1)
10040 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10050 IF ANS$=ESC$ THEN 10300
10060 IF INSTR(".0123456789",ANS$)=0 THEN 10400
10070 IF ANS$="." THEN IF ANS2$(CRS)="." THEN CRS=CRS+1:PRINT"."; ELSE 10400
10080 ANS2$=RIGHT$(ANS2$+ANS$,CRS-2)
10090 PRINT STRING$(LEN(ANS2$),8) ANS2$;
10100 IF ANS$<>"." THEN 10030
10110 ANS$=INPUT$(1)
10120 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10130 IF ANS$=ESC$ THEN 10300
10140 IF INSTR("0123456789",ANS$)=0 THEN 10500
10150 ANS2$=ANS2$+ANS$:PRINT STRING$(LEN(ANS2$)-1,8) ANS2$;
10160 CRS=CRS+1:IF ANS2$(CRS)=":" THEN PRINT BELL$;:GOTO 10600
10170 GOTO 10110
10200 LAST$=ANS$:ANS$=ANS2$:RETURN
10300 PCOL=A:GOTO 3790
10400 PRINT BELL$;:GOTO 10030
10500 PRINT BELL$;:GOTO 10110
10600 ANS$=INPUT$(1)
10610 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10620 IF ANS$=ESC$ THEN 10300
10630 PRINT BELL$;:GOTO 10600
30000 SAVE"EDITBUDG.BAS"
 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10620 IF ANS$=ESC$ THEN 10300
10630 PRINT BELL$;:GOTO 10600
30000 SAVE"EDITBUDG.BAS