home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 15
/
015.d81
/
budgeter
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
5KB
|
189 lines
1 dim v%(12,26),c$(52),m$(12),ca$(26),tt(12),rt(12)
2 data january,february,march,april,may,june,july,august,september,october
3 data november,december
4 print "[147][144]yearly budgeter"
6 print "by"
8 print "glen mcnay"
9 poke 53281,1:poke53280,6
10 print "[144]"
11 forx=1to12:readm$(x):next
12 open2,8,2,"budget.file"
14 forx=1to26:input#2,ca$(x)
15 next x:close2
16 fordl=1to1000:next
18 gosub700:print:print"enter option":print"":print
20 get a$:if a$="" then 20
30 if a$="e"then100
40 if a$="r"then200
43 if a$="p" then 1000
45 if a$="m"then900
50 if a$="s"then300
53 if a$="a"then400
54 if a$="t"then 500
55 if a$="l"thenkg=0:gosub 600
56 if a$="c"thencf=0:goto3000
57 if a$="i"then 800
58 if a$="q"then63000
60 (NULL) to 18
100 print "enter:1 to edit existing month"
101 print " 2 to add new data to a month":input a
103 if a<1 or a>2 then 100
105 input"enter mo. 1-12";m
108 if m<1 and m>12 then 105
110 if a=1 then 150
112 for c=1 to 26
114 gosub 600
115 print"for category "c"[146] enter value":print"[enter -1 to exit]"
116 qnd=0:input qnd
117 ifqnd=-1thenc=26:goto119
118 v%(m,c)=qnd:ifc>2thenv%(m,c)=-v%(m,c)
119 next c
120 goto 18
150 gosub 600
153 print"enter category":input c:ifc>26thenprint"out of range.":goto153
154 print"the current value is",v%(m,c)
155 print"enter the new value":input v%(m,c)
156 if c>2 then v%(m,c)=-v%(m,c)
160 print"enter m for more, anything else to exit"
162 get a$:if a$=""then 162
163 if a$="m"then150
164 goto 18
200 print"enter name of file":input n$:print
205 input "enter device #";d
220 open 1,d,0,n$
230 for m=1to12:forc=1to26
235 input#1,v%(m,c)
237 next c:next m
240 close 1
250 print "data retrieved"
260 fordl=1to1000:nextdl
299 goto 18
300 print"enter name for your file"
310 input n$:print
320 input "enter device #";d
325 open 1,d,1,n$
330 for m=1to12:forc=1to26
340 print#1,v%(m,c):nextc,m
360 close 1:print"data stored"
370 fordl=1to1000:nextdl
399 goto18
400 print "[147]analysis":print:print"month";tab(10)"total";tab(20)"ytd total"
402 print
405 r=0
410 form=1to12:t=0:forc=1to26
415 t=t+v%(m,c)
420 next c:r=r+t:printm$(m);tab(11)t;tab(21)r:next m
430 print""spc(10)"<press a key>"
435 poke198,0:wait198,1:poke198,0
499 goto18
500 gosub 600
505 input"enter category";c
515 print"[147]";ca$(c)
517 print"month","value":print
520 for m=1 to 12:print m$(m),v%(m,c):next
545 t=0
550 for m=1 to 12:t=t+v%(m,c):nextm
560 print:print"[144]total = ";t""
589 print:printspc(10)"<press a key>":poke198,0:wait198,1:poke198,0
590 goto 18
600 print"[147] # cat",,"# cat[146]":s$=" "
601 forx=1to13
602 p$=str$(x)+" "+ca$(x):p$=p$+mid$(s$,1,19-len(p$))+str$(x+13)+" "+ca$(x+13)
603 printp$:next:ifkg<>1thenprint""spc(10)"<press a key>"
620 ifkg<>1thenpoke198,0:wait198,1:poke198,0
680 return
690 :
700 print"[147]commands are:"
702 print:print"e = edit":print"r = read data"
704 print"s = save data":print"a = analyze data"
706 print"t = total a category"
708 print"l = list categories":print"c = change categories"
710 print"i = inspect a month"
718 print "m = monthly payment"
720 print "p = print"
725 print "q = quit"
730 print
780 return
800 print"[147]enter month";
801 input m:ifm<1orm>12then800
802 s$=" "
805 print:print"";m$(m):print
810 forx=1to13
812 p$=mid$(ca$(x)+" ",1,8)+" "+str$(v%(m,x))
814 p$=p$+mid$(s$,1,19-len(p$))+mid$(ca$(x+13)+" ",1,8)+" "+str$(v%(m,x+13))
815 printp$
820 nextx
827 t=0
830 for c=1to26:t=t+v%(m,c):next
840 print:print"[144]total = ";t""
850 print""spc(10)"<press a key>"
855 poke198,0:wait198,1:poke198,0
890 goto 18
900 gosub 600
910 input "enter category";c: ifc<1orc>26then910
920 input "enter value";b
925 if c>2 then b=-abs(b)
930 input "enter start month";i: ifi<1ori>12then930
932 input "enter stop month";j: ifj<1ori>12then930
934 ifi>jthen930
940 for m=i to j:v%(m,c)=b:next m
999 (NULL) to 18
1000 rem printer routine
1005 print "printer routine"
1010 input"start month (1-7)";m1
1015 if m1<1 or m1>7 then 1010
1020 print "ready printer","type go to continue"
1030 input g9$
1040 if g9$<>"go"then 18
1045 input"enter date";d$
1050 open 4,4
1060 print#4:print#4,chr$(14)chr$(16)"20budget"chr$(15),d$:print#4
1070 print#4,"category"chr$(16)"11"m$(m1)chr$(16)"21"m$(m1+1)chr$(16)"31"m$(m1+2);
1080 print#4,chr$(16)"41"m$(m1+3)chr$(16)"51"m$(m1+4)chr$(16)"61"m$(m1+5)
1090 for t=1 to 75:print#4,"[168]";:next t:print#4
1100 for t=1 to 26
1110 print#4,ca$(t)chr$(16)"11"v%(m1,t)chr$(16)"21"v%(m1+1,t)chr$(16)"31"v%(m1+2,t);
1115 print#4,chr$(16)"41"v%(m1+3,t)chr$(16)"51"v%(m1+4,t)chr$(16)"61"v%(m1+5,t)
1118 print#4," actual"chr$(16)"11[164][164][164][164][164][164][164][164]"chr$(16)"21[164][164][164][164][164][164][164][164]"chr$(16)"31[164][164][164][164][164][164][164][164]";
1119 print#4,chr$(16)"41[164][164][164][164][164][164][164][164]"chr$(16)"51[164][164][164][164][164][164][164][164]"chr$(16)"61[164][164][164][164][164][164][164][164]"
1120 next t
1149 rem monthly tot.
1150 for k=1to12:tt(k)=0:next k
1160 for k=1 to 12
1170 for c=1 to 26
1180 tt(k)=tt(k)+v%(k,c)
1190 next c
1195 next k
1200 print#4:print#4,"totals"chr$(16)"11"tt(m1)chr$(16)"21"tt(m1+1)chr$(16)"31"tt(m1+2);
1205 print#4,chr$(16)"41"tt(m1+3)chr$(16)"51"tt(m1+4)chr$(16)"61"tt(m1+5)
1300 print#4:rem running totals
1310 for j=1 to12:rt(j)=0:next j
1315 rt(1)=tt(1)
1320 for j=2 to 12:rt(j)=rt(j-1)+tt(j):next j
1330 print#4,"running"
1340 print#4,"totals"chr$(16)"11"rt(m1)chr$(16)"21"rt(m1+1)chr$(16)"31"rt(m1+2);
1350 print#4,chr$(16)"41"rt(m1+3)chr$(16)"51"rt(m1+4)chr$(16)"61"rt(m1+5)
1997 print#4
1998 close4
1999 goto 18
3000 rem change categories l.s.
3010 kg=1:gosub600
3020 :
3030 print"enter number to change (x=exit):";
3040 inputin$:ifin$="x"then4000
3045 in=val(in$):ifin<1orin>26then poke53280,rnd(1)*15:goto3040
3050 cf=cf+1
3060 print"change "ca$(in)" to :";
3070 inputca$(in):ca$(in)=mid$(ca$(in)+" ",1,14):goto3000
4000 ifcf=0then4100
4010 print"[147] "cf"changes recorded. please wait.."
4020 print" rewriting file..."
4030 open15,8,15,"s0:budget.file": close15
4040 open2,8,2,"budget.file,s,w"
4050 forx=1to26:print#2,ca$(x): poke53280,x:next:close2
4060 print"finished...":fordl=1to500:next
4100 goto18
63000 rem connect to l.s.
63010 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
63020 poke631,13:poke632,13:poke198,2: end