home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 12 / 012.d81 / budget-master (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1985-01-01  |  10.7 KB  |  393 lines

  1. 18 print"[147]":poke53280,0:poke53281,0
  2. 19 print"****************************************";
  3. 20 print"*             budget-master            *";
  4. 21 print"**                 by                 **";
  5. 22 print"*           dennis bloomfield          *";
  6. 23 print"****************************************"
  7. 24 :
  8. 26 ni=16
  9. 27 fl=0:p=0:mc$="janfebmaraprmayjunjulaugsepoctnovdecxxx"
  10. 28 in$="0":hd$=""
  11. 29 bl$="                                        "
  12. 30 dim i$(ni),h$(3),am(2,ni):readi$(0)
  13. 31 open2,8,2,"budget.file"
  14. 32 forde=1toni:input#2,i$(de),am(0,de):next:close2
  15. 33 forde=0to3:readh$(de):next
  16. 34 a$="":z$="":o$="":nd$="mon-yr":na$=nd$:of$="":nf$=""
  17. 35 m1$="[158]return for menu[154]"
  18. 50 printhd$;tab(8);"[158]hit any key to continue"
  19. 55 gosub1090
  20. 100 p=0:print"[147]                 menu                   ";
  21. 102 print"      currently working on: ";na$;"      [146]";
  22. 104 print"        [158]g[154]enerate/alter catagories"
  23. 105 print"        [158]c[154]urrent budget to screen"
  24. 110 print"        [158]e[154]nter/alter monthly data"
  25. 115 print"        [158]p[154]rint current budget"
  26. 120 print"        [158]s[154]ave current budget"
  27. 125 print"        [158]l[154]oad data file"
  28. 130 print"        [158]r[154]eport generator"
  29. 132 print"        [158]d[154]isc command menu"
  30. 135 print"        [158]q[154]uit budget program"
  31. 140 print"               selection?               "
  32. 150 a=0:gosub1090:gosub1010:ifa<1ora>9thengosub998:goto100
  33. 155 ifa<4ora=7then180
  34. 160 gosub930
  35. 175 ifa$<>"y"then100
  36. 180 onagosub200,300,400,500,600,700,2050,800,60000
  37. 185 ifa=9thengosub62000:rem write file
  38. 190 fl=0:lc=0:goto100
  39. 200 sp$="     ":print"[147]    ";:forde=0to1:printh$(de);sp$;:next
  40. 205 printh$(2);:sp$="  ":printsp$;h$(3);"    [154]":gosub960
  41. 210 forde=1toni:gosub950
  42. 211 ifde=>10thenprint"   ";
  43. 212 ifde<10thenprint"    ";
  44. 214 printde;i$(de);:d=am(0,de):gosub992:printsp$;
  45. 217 printam(0,de);
  46. 220 forr=1to2:d=am(r,de):gosub992:printsp$;
  47. 225 ifr=2then227
  48. 226 printam(r,de);:next
  49. 227 printam(r,de):next:next
  50. 228 print"    [183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183]      ";
  51. 230 print"    ";i$(0);"[157]  ";
  52. 240 gosub970:d=am(0,0):gosub992:printsp$;
  53. 250 printam(0,0);
  54. 260 forr=1to2:de=0:d=am(r,de):gosub992:printsp$;
  55. 265 ifr=2then267
  56. 266 printam(r,de);:next
  57. 267 printam(r,de):next
  58. 269 iffl<>0then298
  59. 270 print"[154]    income:"+in$+" ideal balance: ";(in-am(0,0))
  60. 280 print"          actual balance:";(in-am(1,0))
  61. 296 printhd$;"        [158]hit any key to continue[154]"
  62. 297 gosub1090:printhd$;bl$;:return
  63. 298 return
  64. 300 fl=1:gosub200:printhd$;"[145]    [158]    return , in , or item #    [154]"
  65. 310 n$="":printhd$;:input"    item number";n$
  66. 312 ifn$="in"thengosub360:goto300
  67. 313 ifn$=""then350
  68. 314 n=val(n$)
  69. 315 ifn>niorn<1thengosub998:goto310
  70. 320 printhd$;"[145][145]    the current value of ";i$(n);" = ";am(1,n)
  71. 325 print"    [158]  return, menu,  + or - amount [154]":printbl$
  72. 330 z$="":input"[145][145]    new amount   ";z$
  73. 331 ifz$=""then300
  74. 332 ifz$="m"then350
  75. 333 o$=left$(z$,1)
  76. 334 ifo$<>"+"ando$<>"-"then320
  77. 335 m$=right$(z$,len(z$)-1):m=val(m$)
  78. 336 ifo$="-"thenam(1,n)=am(1,n)-m
  79. 337 ifo$="+"thenam(1,n)=am(1,n)+m
  80. 340 goto300
  81. 350 print"":return
  82. 360 printhd$;"    current income is: ";in
  83. 365 input"    new income";in$
  84. 366 ifin$=""thenreturn
  85. 367 o$=left$(in$,1)
  86. 368 ifo$<>"+"ando$<>"-"thenprinthd$;"";bl$;"[145]";:goto365
  87. 369 m$=right$(in$,len(in$)-1):m=val(m$)
  88. 370 ifo$="-"thenin=in-m
  89. 371 ifo$="+"thenin=in+m
  90. 375 in$=str$(in):return
  91. 400 s2$="           ":lc=lc+32
  92. 401 print"[147][158]printer ready? (y)"
  93. 402 print"any other key to abort":gosub1090:ifa$="y"then406
  94. 403 ifa$<>"y"andp=0thenprint"print-out  aborted"
  95. 404 ifa$<>"y"andp=>1thenprint"report terminated":re=nm
  96. 405 forde=1to1000:next:return
  97. 406 print"[147]":forde=1toni:gosub950:next:gosub960:gosub970:open4,4
  98. 407 print#4,s2$;s2$;"      ";chr$(14);na$;chr$(15);:print#4,chr$(10)
  99. 408 print#4,"       ";:forr=0to3:print#4,h$(r);:ifr<>3thenprint#4,s2$;
  100. 409 next:print#4,chr$(13)
  101. 410 forr=1to68:print#4,chr$(163);:next
  102. 411 forr=1to3:print#4:next
  103. 412 s2$="        "
  104. 413 forde=1toni
  105. 415 ifde<10thenprint#4,"   ";
  106. 416 ifde=>10thenprint#4,"  ";
  107. 420 print#4,de;"-";i$(de);
  108. 425 forr=0to2:d=am(r,de):gosub992
  109. 430 print#4,s2$+sp$;
  110. 432 ifr=3thenprint#4,"  ";
  111. 435 print#4,am(r,de);:next:print#4:next
  112. 440 print#4:print#4:forr=1to68:print#4,chr$(163);:next
  113. 442 gosub960:print#4:print#4,"     ";i$(0);" ";
  114. 445 gosub970:forr=0to2:de=0:d=am(r,de):gosub992
  115. 450 print#4,s2$+sp$;
  116. 452 ifr=3thenprint#4,"  ";
  117. 455 print#4,am(r,de);:next:print#4
  118. 460 print#4:print#4,"                  income . . . . . . . . .";
  119. 462 d=in:gosub992:print#4,sp$;d
  120. 465 print#4,"                  ideal balance  . . . . .";
  121. 467 d=(in-am(0,0)):gosub992:print#4,sp$;d
  122. 470 print#4,"                  actual balance . . . . .";
  123. 472 d=(in-am(1,0)):gosub992:print#4,sp$;d
  124. 474 ifp>0then496
  125. 475 print"another copy? (y)"
  126. 478 gosub1090:ifa$<>"y"then496
  127. 488 iflc>32thenlc=0:forr=1to2:print#4:next
  128. 490 print#4:close4:print"[147]":forde=1to1000:next:goto400
  129. 495 iflc>32thenlc=0:forr=1to2:print#4:next:goto497
  130. 496 iflc>32thenlc=0
  131. 497 print#4:close4
  132. 498 return
  133. 500 print"[147][154]";m1$
  134. 501 print"file to save: [158]";na$:print"[154]filename ok? (y-n)"
  135. 502 gosub1090:ifa$=chr$(13)thenreturn
  136. 503 ifa$<>"y"thengosub980:goto500
  137. 507 print"saving: [158]";na$
  138. 510 open15,8,15
  139. 511 open2,8,2,"@0:"+na$+",s,w"
  140. 515 print#2,in$
  141. 516 forde=0toni
  142. 517 print#2,i$(de)
  143. 518 next
  144. 520 forde=0toni
  145. 521 forr=0to2
  146. 522 print#2,am(r,de)
  147. 523 next
  148. 524 next
  149. 530 fl=fl+1:gosub630:return
  150. 600 print"[147][154]";m1$
  151. 601 print"file to load: [158]";na$:print"[154]filename ok? (y-n)"
  152. 602 gosub1090:ifa$=chr$(13)thenreturn
  153. 603 ifa$<>"y"thengosub980:goto600
  154. 606 print"loading: [158]";na$
  155. 610 open15,8,15
  156. 611 open2,8,2,"0:"+na$+",s,r"
  157. 615 input#2,in$
  158. 616 in=val(in$)
  159. 617 forde=0toni
  160. 618 input#2,i$(de)
  161. 619 next
  162. 620 forde=0toni
  163. 621 forr=0to2
  164. 622 input#2,am(r,de)
  165. 623 next
  166. 624 next
  167. 630 input#15,e1$,e2$,e3$,e4$
  168. 635 print"    ";e1$;" ";e2$;" ";e3$;" ";e4$;" ":forde=1to700:next
  169. 636 ife2$<>"ok"andp=0andfl=0thengosub900
  170. 640 close2
  171. 645 close15,8,15:return
  172. 700 print"[147]";m1$:print"[158]p[146]rinter or [158]s[146]creen?"
  173. 701 gosub1090:ifa$=chr$(13)thenreturn
  174. 702 ifa$<>"p"anda$<>"s"thengosub998:print"[147][158]";:goto700
  175. 703 gosub920
  176. 705 print"[158]starting":gosub981:ifna$=nd$thenreturn
  177. 710 input"[158]number of months to report";nm:ifnm=0thenreturn
  178. 711 ifnm>12then700
  179. 715 ifa$="p"then750
  180. 720 forre=1tonm:gosub798:print"[147]":gosub606
  181. 725 print"[147]report for month of: [158]";na$;"[154]":forde=1to2000:next
  182. 726 ife2$="ok"then730
  183. 727 ife2$<>"ok"thenprint"[158]";na$;" ";e2$
  184. 728 print"report terminated[154]":gosub900:goto742
  185. 730 gosub200:yi=yi+in:y1=y1+(in-am(0,0)):y2=y2+(in-am(1,0))
  186. 735 print"[147]report totals to:[158] ";na$;"[154]"
  187. 739 de=0:print"income total     [158]";:d=yi:gosub992:printsp$;yi
  188. 740 print"[154]ideal bal. total [158]";:d=y1:gosub992:printsp$;y1
  189. 741 print"[154]actual bal. total[158]";:d=y2:gosub992:printsp$;y2
  190. 742 ife2$="ok"then745
  191. 744 forde=1to2000:next:return
  192. 745 gosub296
  193. 746 ifre=nmthen749
  194. 747 gosub1110
  195. 748 next:return
  196. 749 next:return
  197. 750 forre=1tonm:p=p+1:gosub798
  198. 753 print"[147]":gosub606
  199. 754 ife2$<>"ok"then756
  200. 755 goto760
  201. 756 print"[147]";na$;" ";e2$;"--report terminated"
  202. 757 open4,4:print#4:print#4:print#4
  203. 758 print#4,"              ";na$;" ";e2$;"-report terminated"
  204. 759 close4,4:goto765
  205. 760 gosub400:ifa$<>"y"andre=nmandp=nmthen765
  206. 761 yi=yi+in:y1=y1+(in-am(0,0)):y2=y2+(in-am(1,0))
  207. 763 gosub1110
  208. 764 next
  209. 765 open4,4:ifa$<>"y"then768
  210. 766 iflc=0thenforde=1to25:print#4:next:goto768
  211. 767 iflc=32thenforde=1to4:print#4:next
  212. 768 print#4,"                           report totals":print#4
  213. 770 print#4,"                     income total     [158]";:d=yi:gosub992
  214. 771 print#4,sp$;yi
  215. 772 print#4,"                     ideal bal. total [158]";:d=y1:gosub992
  216. 773 print#4,sp$;y1
  217. 775 print#4,"                     actual bal. total[158]";:d=y2:gosub992
  218. 776 print#4,sp$;y2
  219. 777 print#4
  220. 778 close4
  221. 779 return
  222. 798 forde=0toni:i$(de)="":next:gosub960:gosub970:return
  223. 800 print"[147][154]":goto63000
  224. 900 gosub976:gosub975:de=0:in$="0":in=0
  225. 910 gosub950:na$=nd$:return
  226. 920 yi=0:y1=0:y2=0:return
  227. 930 print"           [158]are you sure?(y)[145]":forde=1to300:next
  228. 935 print"                           [145]":forde=1to300:next
  229. 940 geta$:ifa$=""then930
  230. 945 return
  231. 950 am(2,de)=am(0,de)-am(1,de):return
  232. 960 forr=0to2:am(r,0)=0:next:return
  233. 970 forr=0to2:forde=1toni:am(r,0)=am(r,0)+am(r,de):next:next:return
  234. 975 restore:forde=0toni:reada$:i$(de)=a$:next:return
  235. 976 forr=1to2:forde=0toni:am(r,de)=0:next:next:return
  236. 980 print"[147][158]return to escape[154]"
  237. 981 na$="":m$="":input"[158]month name";m$:ifm$=""then990
  238. 982 ch$=left$(m$,3)
  239. 983 forde=1to34step3:ifch$=mid$(mc$,de,3)then986
  240. 984 next
  241. 985 gosub998::goto980
  242. 986 y$="":input"year";y$:ify$=""then990
  243. 987 yr$=right$(y$,2)
  244. 988 na$=na$+ch$+chr$(45)+yr$
  245. 990 ifna$=""thenna$=nd$
  246. 991 return
  247. 992 ifabs(d)<10thensp$="     ":return
  248. 993 ifabs(d)<100thensp$="    ":return
  249. 994 ifabs(d)<1000thensp$="   ":return
  250. 995 ifabs(d)<10000thensp$="  ":return
  251. 996 ifabs(d)<100000thensp$=" ":return
  252. 997 sp$="":return
  253. 998 printhd$;"    [158]invalid input, please do again![154]":forde=1to1500:next
  254. 999 printhd$;bl$:return
  255. 1010 ifa$="c"thena=1
  256. 1020 ifa$="e"thena=2
  257. 1030 ifa$="p"thena=3
  258. 1040 ifa$="s"thena=4
  259. 1050 ifa$="l"thena=5
  260. 1060 ifa$="r"thena=6
  261. 1070 ifa$="d"thena=7
  262. 1075 ifa$="q"thena=8
  263. 1076 ifa$="g"thena=9
  264. 1080 return
  265. 1090 geta$:ifa$=""then1090
  266. 1100 return
  267. 1110 forde=1to34step3
  268. 1115 ifch$=mid$(mc$,de,3)thenna$=(mid$(mc$,de+3,3))+"-"+yr$
  269. 1120 next:ch$=left$(na$,3):ifch$<>"xxx"thenreturn
  270. 1125 ifch$="xxx"thench$="jan":y=val(right$(na$,2))
  271. 1127 ifch$="xxx"thenna$="":ny=y+1:y$=str$(ny)
  272. 1130 yr$=right$(y$,2):na$=ch$+"-"+yr$:return
  273. 2003 data"totals"
  274. 2009 :
  275. 2010 :
  276. 2011 :
  277. 2016 data"item#","ideal","real ","diff."
  278. 2022 :
  279. 2023 :
  280. 2050 a=0:print"[147]";bl$;"              disc options              ";bl$
  281. 2055 print"[146]";tab(13);"[158]d[154]irectory"
  282. 2060 printtab(13);"[158]r[154]ename file"
  283. 2065 printtab(13);"[158]s[154]cratch file"
  284. 2070 printtab(13);"[158]f[154]ormat disk"
  285. 2075 printtab(13);"[158]i[154]nitialize drive"
  286. 2077 printtab(13);"[158]v[154]alidate disk"
  287. 2080 printtab(13);"";m1$
  288. 2082 print"";bl$;"               selection?               ";bl$
  289. 2085 gosub1090
  290. 2090 ifa$="d"thena=1
  291. 2095 ifa$="r"thena=2
  292. 2100 ifa$="s"thena=3
  293. 2105 ifa$="f"thena=4
  294. 2110 ifa$="i"thena=5
  295. 2112 ifa$="v"thena=6
  296. 2115 ifa$=chr$(13)thenreturn
  297. 2120 ifa<1ora>6then2050
  298. 2125 onagosub2135,2225,2265,2295,2355,2365
  299. 2130 goto2050
  300. 2135 print"[147][158]any key to pause/restart listing[154]":print:open1,8,0,"$0"
  301. 2140 get#1,a$,b$
  302. 2145 get#1,a$,b$
  303. 2150 get#1,a$,b$
  304. 2155 c=0
  305. 2160 ifa$<>""thenc=asc(a$)
  306. 2165 ifb$<>""thenc=c+asc(b$)*256
  307. 2167 ifc<10thenprint" ";
  308. 2170 print"       ";mid$(str$(c),2);tab(4);"  ";
  309. 2175 get#1,b$:ifst<>0then2215
  310. 2180 ifb$<>chr$(34)then2175
  311. 2185 get#1,b$:ifb$<>chr$(34)thenprintb$;:goto2185
  312. 2190 get#1,b$:ifb$=chr$(32)then2190
  313. 2195 printtab(28);:c$=""
  314. 2200 c$=c$+b$:get#1,b$:ifb$<>""then2200
  315. 2205 printleft$(c$,3)
  316. 2206 geta$:ifa$<>""thenprint:print"";m1$
  317. 2208 ifa$<>""thengosub1090:ifa$=chr$(13)then2220
  318. 2210 ifst=0then2145
  319. 2215 print"[157]blocks free"
  320. 2220 close1:ifa$=chr$(13)then2222
  321. 2221 print:gosub296
  322. 2222 return
  323. 2225 print"[147]";m1$
  324. 2228 of$="":input"old filename";of$
  325. 2229 ifof$=""then2260
  326. 2230 nf$="":input"new filename";nf$
  327. 2235 ifnf$=""then2260
  328. 2240 open15,8,15:print#15,"r0:"+nf$+"="+of$
  329. 2245 input#15,e1$,e2$,e3$,e4$
  330. 2250 print"[158]";e1$;" ";e2$;" ";e3$;" ";e4$;"[146]":forde=1to1000:next
  331. 2255 close15,8,15
  332. 2260 return
  333. 2265 gosub930:ifa$<>"y"then2290
  334. 2268 print"[147]";m1$
  335. 2270 of$="":input"filename to scratch";of$
  336. 2275 ifof$=""then2290
  337. 2280 open15,8,15:print#15,"s0:"+of$
  338. 2285 gosub 2245
  339. 2290 return
  340. 2295 gosub930:ifa$<>"y"then2350
  341. 2298 print"[147]";m1$
  342. 2300 print"input disc name (16 char. max)"
  343. 2302 of$="":input"name: ";of$
  344. 2312 iflen(of$)>16thengosub998:goto2298
  345. 2325 ifof$=""then2350
  346. 2330 print"input disc id code (2 char. max)"
  347. 2331 nf$="":input"id code: ";nf$
  348. 2332 iflen(nf$)>2thengosub998:goto2298
  349. 2335 ifnf$=""then2350
  350. 2340 open15,8,15:print#15,"n0:"+of$+","+nf$
  351. 2345 gosub2245
  352. 2350 return
  353. 2355 print"[147]initializing drive"
  354. 2360 open15,8,15:print#15,"i0:":print"";:gosub2245:return
  355. 2365 print"[147]validating disc"
  356. 2370 open15,8,15:print#15,"v0:":print"";:gosub2245:return
  357. 60000 rem    enter/alter catagories
  358. 60010 print"[147]"
  359. 60020 printspc(10)"1. edit/change catagories"
  360. 60030 printspc(10)"2. edit/change ideal amounts"
  361. 60040 print"which ?"
  362. 60045 poke198,0:wait198,1:getz$:ifz$="\"thenreturn
  363. 60047 ifz$<>"1"andz$<>"2"thenpoke53280,rnd(1)*15:goto60045
  364. 60050 ifz$="2"then61000
  365. 60060 print"[147]          edit/change catagories"
  366. 60070 forde=1toni:de$=str$(de):printmid$(de$,len(de$)-1)". "i$(de):next
  367. 60080 input"change which ?     [157][157][157][157][157][157]";cn$:cn=val(cn$):ifcn$="\"then60000
  368. 60085 ifcn<1orcn>nithenprint"try a number between 1 and"ni"[145][145][145]":goto60080
  369. 60087 print"change "i$(cn)" to:           [157][157][157][157][157][157][157][157][157][157]";:inputi$(cn)
  370. 60090 i$(cn)=left$(i$(cn)+"    ",5)
  371. 60095 goto60060
  372. 61000 print"[147]         edit/change ideal amounts"
  373. 61010 forde=1toni:de$=str$(de):printmid$(de$,len(de$)-1)". ideal amount for ";
  374. 61012 printi$(de)" is:"am(0,de):next
  375. 61020 input"change which ?     [157][157][157][157][157][157]";cn$:cn=val(cn$):ifcn$="\"then60000
  376. 61025 ifcn<1orcn>nithenprint"try a number between 1 and"ni"[145][145][145]":goto61020
  377. 61087 print"change "am(0,cn)" to:           [157][157][157][157][157][157][157][157][157][157]";:inputam(0,cn):goto61000
  378. 62000 rem    re-write the file
  379. 62002 print"please wait...re-writing a file."
  380. 62005 open15,8,15,"s0:budget.file"
  381. 62008 open2,8,2,"0:budget.file,s,w"
  382. 62010 forde=1toni:print".";
  383. 62020 i$(de)=left$(i$(de)+"     ",5)
  384. 62030 print#2,i$(de)","am(0,de)
  385. 62040 next
  386. 62050 close2
  387. 62060 input#15,er,er$:ifer<>0thenprint"sorry...we had an error:"er,er$:goto50
  388. 62070 close2:close15:return
  389. 62999 end
  390. 63000 rem    connect back to l.s.
  391. 63002 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
  392. 63004 poke198,0:poke631,13:poke632,13:poke198,2:end
  393.