home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 15 / 015.d81 / budgeter (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  5KB  |  189 lines

  1. 1 dim v%(12,26),c$(52),m$(12),ca$(26),tt(12),rt(12)
  2. 2 data january,february,march,april,may,june,july,august,september,october
  3. 3 data november,december
  4. 4 print "[147][144]yearly budgeter"
  5. 6 print "by"
  6. 8 print "glen mcnay"
  7. 9 poke 53281,1:poke53280,6
  8. 10 print "[144]"
  9. 11 forx=1to12:readm$(x):next
  10. 12 open2,8,2,"budget.file"
  11. 14 forx=1to26:input#2,ca$(x)
  12. 15 next x:close2
  13. 16 fordl=1to1000:next
  14. 18 gosub700:print:print"enter option":print"":print
  15. 20 get a$:if a$="" then 20
  16. 30 if a$="e"then100
  17. 40 if a$="r"then200
  18. 43 if a$="p" then 1000
  19. 45 if a$="m"then900
  20. 50 if a$="s"then300
  21. 53 if a$="a"then400
  22. 54 if a$="t"then 500
  23. 55 if a$="l"thenkg=0:gosub 600
  24. 56 if a$="c"thencf=0:goto3000
  25. 57 if a$="i"then 800
  26. 58 if a$="q"then63000
  27. 60 (NULL) to 18
  28. 100 print "enter:1 to edit existing month"
  29. 101 print "       2 to add new data to a month":input a
  30. 103 if a<1 or a>2 then 100
  31. 105 input"enter mo. 1-12";m
  32. 108 if m<1 and m>12 then 105
  33. 110 if a=1 then 150
  34. 112 for c=1 to 26
  35. 114 gosub 600
  36. 115 print"for category "c"[146] enter value":print"[enter -1 to exit]"
  37. 116 qnd=0:input qnd
  38. 117 ifqnd=-1thenc=26:goto119
  39. 118 v%(m,c)=qnd:ifc>2thenv%(m,c)=-v%(m,c)
  40. 119 next c
  41. 120 goto 18
  42. 150 gosub 600
  43. 153 print"enter category":input c:ifc>26thenprint"out of range.":goto153
  44. 154 print"the current value is",v%(m,c)
  45. 155 print"enter the new value":input v%(m,c)
  46. 156 if c>2 then v%(m,c)=-v%(m,c)
  47. 160 print"enter m for more, anything else to exit"
  48. 162 get a$:if a$=""then 162
  49. 163 if a$="m"then150
  50. 164 goto 18
  51. 200 print"enter name of file":input n$:print
  52. 205 input "enter device #";d
  53. 220 open 1,d,0,n$
  54. 230 for m=1to12:forc=1to26
  55. 235 input#1,v%(m,c)
  56. 237 next c:next m
  57. 240 close 1
  58. 250 print "data retrieved"
  59. 260 fordl=1to1000:nextdl
  60. 299 goto 18
  61. 300 print"enter name for your file"
  62. 310 input n$:print
  63. 320 input "enter device #";d
  64. 325 open 1,d,1,n$
  65. 330 for m=1to12:forc=1to26
  66. 340 print#1,v%(m,c):nextc,m
  67. 360 close 1:print"data stored"
  68. 370 fordl=1to1000:nextdl
  69. 399 goto18
  70. 400 print "[147]analysis":print:print"month";tab(10)"total";tab(20)"ytd total"
  71. 402 print
  72. 405 r=0
  73. 410 form=1to12:t=0:forc=1to26
  74. 415 t=t+v%(m,c)
  75. 420 next c:r=r+t:printm$(m);tab(11)t;tab(21)r:next m
  76. 430 print""spc(10)"<press a key>"
  77. 435 poke198,0:wait198,1:poke198,0
  78. 499 goto18
  79. 500 gosub 600
  80. 505 input"enter category";c
  81. 515 print"[147]";ca$(c)
  82. 517 print"month","value":print
  83. 520 for m=1 to 12:print m$(m),v%(m,c):next
  84. 545 t=0
  85. 550 for m=1 to 12:t=t+v%(m,c):nextm
  86. 560 print:print"[144]total = ";t""
  87. 589 print:printspc(10)"<press a key>":poke198,0:wait198,1:poke198,0
  88. 590 goto 18
  89. 600 print"[147] #  cat",,"#  cat[146]":s$="                                        "
  90. 601 forx=1to13
  91. 602 p$=str$(x)+" "+ca$(x):p$=p$+mid$(s$,1,19-len(p$))+str$(x+13)+" "+ca$(x+13)
  92. 603 printp$:next:ifkg<>1thenprint""spc(10)"<press a key>"
  93. 620 ifkg<>1thenpoke198,0:wait198,1:poke198,0
  94. 680 return
  95. 690 :
  96. 700 print"[147]commands are:"
  97. 702 print:print"e = edit":print"r = read data"
  98. 704 print"s = save data":print"a = analyze data"
  99. 706 print"t = total a category"
  100. 708 print"l = list categories":print"c = change categories"
  101. 710 print"i = inspect a month"
  102. 718 print "m = monthly payment"
  103. 720 print "p = print"
  104. 725 print "q = quit"
  105. 730 print
  106. 780 return
  107. 800 print"[147]enter month";
  108. 801 input m:ifm<1orm>12then800
  109. 802 s$="                                       "
  110. 805 print:print"";m$(m):print
  111. 810 forx=1to13
  112. 812 p$=mid$(ca$(x)+"     ",1,8)+" "+str$(v%(m,x))
  113. 814 p$=p$+mid$(s$,1,19-len(p$))+mid$(ca$(x+13)+"    ",1,8)+" "+str$(v%(m,x+13))
  114. 815 printp$
  115. 820 nextx
  116. 827 t=0
  117. 830 for c=1to26:t=t+v%(m,c):next
  118. 840 print:print"[144]total = ";t""
  119. 850 print""spc(10)"<press a key>"
  120. 855 poke198,0:wait198,1:poke198,0
  121. 890 goto 18
  122. 900 gosub 600
  123. 910 input "enter category";c:               ifc<1orc>26then910
  124. 920 input "enter value";b
  125. 925 if c>2 then b=-abs(b)
  126. 930 input "enter start month";i:            ifi<1ori>12then930
  127. 932 input "enter stop month";j:             ifj<1ori>12then930
  128. 934 ifi>jthen930
  129. 940 for m=i to j:v%(m,c)=b:next m
  130. 999 (NULL) to 18
  131. 1000 rem printer routine
  132. 1005 print "printer routine"
  133. 1010 input"start month (1-7)";m1
  134. 1015 if m1<1 or m1>7 then 1010
  135. 1020 print "ready printer","type go to continue"
  136. 1030 input g9$
  137. 1040 if g9$<>"go"then 18
  138. 1045 input"enter date";d$
  139. 1050 open 4,4
  140. 1060 print#4:print#4,chr$(14)chr$(16)"20budget"chr$(15),d$:print#4
  141. 1070 print#4,"category"chr$(16)"11"m$(m1)chr$(16)"21"m$(m1+1)chr$(16)"31"m$(m1+2);
  142. 1080 print#4,chr$(16)"41"m$(m1+3)chr$(16)"51"m$(m1+4)chr$(16)"61"m$(m1+5)
  143. 1090 for t=1 to 75:print#4,"[168]";:next t:print#4
  144. 1100 for t=1 to 26
  145. 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);
  146. 1115 print#4,chr$(16)"41"v%(m1+3,t)chr$(16)"51"v%(m1+4,t)chr$(16)"61"v%(m1+5,t)
  147. 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]";
  148. 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]"
  149. 1120 next t
  150. 1149 rem monthly tot.
  151. 1150 for k=1to12:tt(k)=0:next k
  152. 1160 for k=1 to 12
  153. 1170 for c=1 to 26
  154. 1180 tt(k)=tt(k)+v%(k,c)
  155. 1190 next c
  156. 1195 next k
  157. 1200 print#4:print#4,"totals"chr$(16)"11"tt(m1)chr$(16)"21"tt(m1+1)chr$(16)"31"tt(m1+2);
  158. 1205 print#4,chr$(16)"41"tt(m1+3)chr$(16)"51"tt(m1+4)chr$(16)"61"tt(m1+5)
  159. 1300 print#4:rem running totals
  160. 1310 for j=1 to12:rt(j)=0:next j
  161. 1315 rt(1)=tt(1)
  162. 1320 for j=2 to 12:rt(j)=rt(j-1)+tt(j):next j
  163. 1330 print#4,"running"
  164. 1340 print#4,"totals"chr$(16)"11"rt(m1)chr$(16)"21"rt(m1+1)chr$(16)"31"rt(m1+2);
  165. 1350 print#4,chr$(16)"41"rt(m1+3)chr$(16)"51"rt(m1+4)chr$(16)"61"rt(m1+5)
  166. 1997 print#4
  167. 1998 close4
  168. 1999 goto 18
  169. 3000 rem  change categories  l.s.
  170. 3010 kg=1:gosub600
  171. 3020 :
  172. 3030 print"enter number to change (x=exit):";
  173. 3040 inputin$:ifin$="x"then4000
  174. 3045 in=val(in$):ifin<1orin>26then           poke53280,rnd(1)*15:goto3040
  175. 3050 cf=cf+1
  176. 3060 print"change "ca$(in)" to :";
  177. 3070 inputca$(in):ca$(in)=mid$(ca$(in)+"                 ",1,14):goto3000
  178. 4000 ifcf=0then4100
  179. 4010 print"[147]  "cf"changes recorded. please wait.."
  180. 4020 print"           rewriting file..."
  181. 4030 open15,8,15,"s0:budget.file":           close15
  182. 4040 open2,8,2,"budget.file,s,w"
  183. 4050 forx=1to26:print#2,ca$(x):              poke53280,x:next:close2
  184. 4060 print"finished...":fordl=1to500:next
  185. 4100 goto18
  186. 63000 rem   connect to l.s.
  187. 63010 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
  188. 63020 poke631,13:poke632,13:poke198,2:        end
  189.