CLUB 100 Library - 415/939-1246 BBS 937-5039 NEWSLETTER, 932-8856 VOICE PLRG.BAS (Parts List Report Generator) -------- Written by Tony B. Anderson The occasion arose where I had to create some parts lists for some projects I am involved in building at work. The list had to be suitable for a "Gofer" to go out and buy the parts locally, and to include as part of a final report on the development of the project. ("Gofer" is a term which refers to someone who "goes fer" stuff; no derogatory conotation is intended.) I decided to use TEXT for input of the parts list, which could also be used to make corrections easily to the final list which would be submitted with the "Finished" report. TEXT could also be used to edit the list, in the case of part substitutions, or to update the prices on the original list. I started the parts list for each project with a standard header which could be pasted into the top of each file, with the project description added to the top line, in the following form: (The three dots indicate the top and bottom of each file, used here for clarity, they are not included in the actual files.) ... Parts List for Project assigned to Part # Qty Description Unit pr. Total ------------------------------------------------------------------------------- ... Note that each column heading coincides with the normal TAB spacing in the TEXT program. That would make it easy to TAB between columns when entering data. Here is a copy of the complete file, in it's final form: (80-column printout required - This file contains a parts list for a cable tester box we built.) ... Parts List for Cable Tester Box Project: Project assigned to Howard Part # Qty Description Unit pr. Total ------------------------------------------------------------------------------- 270-223 1 Blue Project Box $ 2.69 276-041 3 Red Jumbo LED's 2/69 $ 1.38 276-080 3 Jumbo LED Holders 2/119 $ 2.38 274-013 1 Cannon D3F Connector $ 3.69 1 Cannon D3M Connector $ 3.52 270-326 1 9-volt battery clamp 2/59 $ .59 270-325 1 9-volt battery clip 5/99 $ .99 274-312 2 3-cond Phone Jacks $ 1.99 274-346 2 RCA Phono Jacks 4/199 $ 1.99 274-249 2 1/8" Phone Jacks 2/159 $ 1.59 278-212 2 F-61 Chassis Connectors 2/89 $ .89 2 BNC Chassis connectors 1.33 $ 2.66 2 Cannon Mounting Templates 8.50 $ 17.00 SW-961 3 Switchcraft Pushbuttons 2.72 $ 8.16 ... A simple Shift-Print hardcopy could be used as a purchasing list at the local Radio Shack Store, or other parts dealers. In fact, the parts numbers shown above, (with the 200-series numbers) and the prices of most items were taken directly from the current Radio Shack catalog. (It's amazing how fast the Radio Shack people can locate the right parts on the racks, when you have a nicely formatted list of the parts numbers!) Those items without parts numbers had to be purchased from other sources. You could also list specific item part numbers there, as in the case for the Switchcraft pushbuttons, which we did not want substituted. Note also a column for package prices... Radio Shack often packages several like items in a package at a package price. In the case of the LED's and holders, we only needed three of each, but they come in packages in multiples of two. So the total price paid indicates how much we actually paid for the parts, regardless of any parts we may have had left over. While not entirely accurate, this method does reflect the amount of money actually spent on the project. After the parts were purchased, the parts list file was updated with the prices actually charged for various items, and the following program is run, which prints the final report copy for the department head. The program is simple; it simply gets the name of your file, prints a header for the report, then reads the file line by line, printing each line as it goes, and adding up the prices in the last column. At then end of the file, the program draws a line, prints sub-total, sales tax, and the total amount spent on the project. The program will run on any model, and should print to any printer. It expects the parts list file to be in RAM, but if you have it on disk, and an appropriate DOS, you can access files directly from the disk. As an added feature, which you may want to delete, after printing the final project report, the program opens the file, and adds a final line which indicates the total project cost at the end of the file. This is useful when you archive the file to disk, and need to refer to it later, without rerunning the report generator to add up the totals. However, if you run the report generator program again, once that final line has been added to the file, the report program will pick up that amount, and add it to the total again, giving you a false total. If you don't need or want this feature, simply delete lines 150 and 160. 0 ' PLRG.BAS (Report Generator for project parts lists) 2 ' Copyright 1988 Tony B. Anderson All Rights Reserved 10 CLS:PRINT:INPUT" Name of the partlist file";F$ 20 FORA=1TOLEN(F$):B=ASC(MID$(F$,A,1)):IFB>95THENMID$(F$,A,1)=CHR$(B-32) 30 NEXT:OPENF$FORINPUTAS1 40 PRINT:PRINT" Working..." 50 LPRINT"Parts List Report for the "F$" file."TAB(70)DATE$:LPRINTTAB(70)LEFT$(TIME$,5):LPRINT:LPRINT 60 IFEOF(1)THEN110 70 LINEINPUT#1,A$ 80 IFA$=""THEN100 90 IFINSTR(A$,"$")THENB$=RIGHT$(A$,6):T=T+VAL(B$) 100 LPRINTA$:GOTO60 110 LPRINTTAB(70)STRING$(9,45):LPRINTTAB(55)"Subtotal:"TAB(70);:LPRINTUSING"$ ####.##";T 120 LPRINTTAB(55)"Sales Tax:"TAB(70);:TX=T*.06:LPRINTUSING"$ ####.##";TX 130 LPRINT:LPRINTTAB(55)"GRAND TOTAL:"TAB(70);:LPRINTUSING"$ ####.##";T+TX 140 LPRINTCHR$(12) 150 CLOSE:T1=INT((T+TX)*100)/100 160 OPENF$FORAPPENDAS1:PRINT#1,:PRINT#1,DATE$" Total Price to date: $"T1 170 MENU