10 'CLS:INPUT "CHANGE LINE 1020 TO YOUR NAME AND ADDRESS. THEN DELETE LINE 10. PRESS ENTER TO CONTINUE",DUMMY$ 20 '*********************************************************************** 30 '*********************************************************************** 40 '**** **** 50 '**** HOME INVENTORY PROGRAM **** 60 '**** by **** 70 '**** Brian Mann **** 80 '**** (804) 320-4901 **** 90 '**** **** 100 '**** COPYRIGHT OCTOBER, 1982 BY BRIAN D. MANN **** 110 '**** FOR NONPROFIT DISTRIBUTION ONLY. ALL RIGHTS RESERVED. **** 120 '**** **** 130 '*********************************************************************** 140 '*********************************************************************** 150 DEF SEG=0 '------------------------------????? 160 K=PEEK(&H417) OR &H40 ' ? SET CAPS 170 POKE &H417,K '-------------------------?????? 180 ROOM =0:SUB=0:SUBTTL=0:BUFFER=0 190 SIZE=100:DIM DES$(SIZE), NO(SIZE), DOL(SIZE), RM(SIZE) 200 KEY OFF:FOR I=1 TO 10: KEY I,"":NEXT 210 RESTORE 'sets data statements to reset 220 GOTO 900 'main menu 230 CLS'########################### PRINT INPUT SCREEN ROUTINE ################## 240 RESTORE 250 BUFFER=BUFFER+1 260 DATA 5,45,8,41,12,37,14,57,16,42,0,0 270 COLOR 15,0,0 280 LOCATE 2,28 :PRINT "HOME INVENTORY PROGRAM"; 290 COLOR 7,0,0 300 LOCATE 5,10:PRINT "ENTER `S' TO SAVE, `M' FOR MENU==> " 310 LOCATE 8,10 :PRINT "ENTER DESCRIPTION OF ITEM ===> "; 320 LOCATE 10,20: PRINT "^ stop description here"; 330 LOCATE 12,10:PRINT "ENTER NUMBER OF ITEMS ===> 1"; 340 LOCATE 14,10: PRINT "ENTER REPLACEMENT COST OF INDIVIDUAL ITEM ===> 1 (EXAMPLE: 875.67)"; 350 LOCATE 16,10: PRINT "ENTER LOCATION OF ITEM(S) ===> ";ROOM 360 LOCATE 18,10: PRINT "1=LIVING ROOM, 2=KITCHEN/DINING ROOM, 3=DOWNSTAIRS BATH, 4=UPSTAIRS BATH, 5=BEDROOM, 6=STUDY, 7=ATTIC, 8=OUTSIDE" 370 LOCATE 23,5:PRINT "USE THE ENTER KEY TO MOVE FROM ONE FIELD TO ANOTHER." 380 LOCATE 24,5:PRINT "SAVE AN ENTRY ON THE SCREEN BEFORE GOING TO THE MENU."; 390 LOCATE 1,1:PRINT USING "BUFFER AT ## OF ###";BUFFER,SIZE; 400 GOTO 440 410 INPUT "",A$ 420 IF R=5 AND A$="S" THEN COLOR 7,0,0: GOTO 490 430 IF R=5 AND A$="M" THEN COLOR 7,0,0: GOTO 800 440 READ R,C 450 COLOR 15,0,0 460 IF R=0 AND C=0 THEN RESTORE:READ R,C 470 LOCATE R,C 480 GOTO 410 490 '############################ BEGINNING OF READ SCREEN ROUTINE ########### 500 DESC$="":X$="" ' RESET VARIABLES 510 FLAG1=1 ' RESET BUFFER DUMP VARIABLE 520 FOR I=41 TO 80 530 X=SCREEN(8,I) ' READ THE SCREEN AT 8,41-80 ONE CHAR AT A TIME 540 X$=CHR$(X)' CHANGE THE CHAR CODE TO A LETTER 550 DESC$=DESC$+X$' BUILD THE WORD FROM THE CHARACTERS 560 NEXT' GO TO THE NEXT CHARACTER 570 FOR I=1 TO 20 580 X=SCREEN(9,I) ' READ THE SCREEN AT 9,1-20 ONE CHAR AT A TIME 590 X$=CHR$(X)' CHANGE THE CHAR CODE TO A LETTER 600 DESC$=DESC$+X$' BUILD THE WORD FROM THE CHARACTERS 610 NEXT' GO TO THE NEXT CHARACTER 620 NUM$="":X$=""' THE REST USE THE SAME LOGIC 630 FOR I=37 TO 40 640 X=SCREEN(12,I) 650 X$=CHR$(X) 660 NUM$=NUM$+X$ 670 NEXT 680 NUM=VAL(NUM$) 690 DOLLAR$="":X$="" 700 FOR I=57 TO 63 710 X=SCREEN(14,I) 720 X$=CHR$(X) 730 DOLLAR$=DOLLAR$+X$ 740 NEXT 750 DOLLAR=VAL(DOLLAR$) 760 ROOM=SCREEN(16,42) 770 ROOM=VAL(CHR$(ROOM)) 780 DES$(BUFFER)=DESC$:NO(BUFFER)=NUM:DOL(BUFFER)=DOLLAR:RM(BUFFER)=ROOM' BUILD A BUFFER TO SAVE TIME IN ENTERING 790 IF BUFFER=SIZE THEN 800 ELSE 230' IS IT FULL? 800 IF FLAG1=0 THEN 900' HAS THE BUFFER BEEN DUMPED? 0 FOR YES, 1 FOR NO 810 WIDTH 40:LOCATE 12,10: PRINT "HOLD FOR DISK OPERATION" 820 OPEN "INVENTRY.DAT" FOR APPEND AS #1 830 IF A$="M" OR A$="m" THEN BUFFER = BUFFER - 1' MENU OPTION ADDS TO COUNTER WITHOUT ADDING TO ARRAY 840 FOR B=1 TO BUFFER 850 WRITE#1, DES$(B);NO(B),DOL(B),RM(B) 860 DES$(B)="":NO(B)=0:DOL(B)=0:RM(B)=0 870 NEXT 880 CLOSE:WIDTH 80: BUFFER=0: FLAG1=0' RESET 890 IF A$="S" OR A$="s" THEN 230 ELSE 900 900 REM -----------------MASTER MENU----------------- 910 WIDTH 80:CLS 920 BUFFER=0 930 COLOR 15,0,0 940 LOCATE 5,29: PRINT "HOME INVENTORY PROGRAM"; 950 COLOR 7,0,0 960 LOCATE 6,37:PRINT "by" 970 LOCATE 7,31:PRINT "BRIAN D. MANN" 980 COLOR 15,0,0 990 LOCATE 10,32: PRINT "MASTER MENU"; 1000 COLOR 7,0,0 1010 LOCATE 12,10: PRINT "DO YOU WISH TO ==>" 1020 LOCATE 14,20: PRINT "1. FILE AN ITEM IN THE INVENTORY.":LOCATE 16,20:PRINT "2. PRINT THE ITEMS ALREADY FILED.":LOCATE 18,20:PRINT "3. DELETE AN ENTRY" 1030 LOCATE 20,20: PRINT "4. EXIT THE PROGRAM" 1040 LOCATE 12,30: INPUT "",P 1050 IF P=1 THEN 230' ENTRY PANEL 1060 IF P=2 THEN 1110' PRINT ROUTINE 1070 IF P=3 THEN 1710' DELETE ITEM 1080 IF P=4 THEN 1100' EXIT 1090 BEEP: LOCATE 24,10: PRINT "YOU ENTERED ";P; "TRY AGAIN";:GOTO 1040 1100 CLS:END 1110 '########################### PRINT ROUTINE ################################ 1120 CLS 1130 COLOR 15 1140 LOCATE 8,35: PRINT" PRINT ROUTINE" 1150 COLOR 7 1160 LOCATE 12,10: PRINT "DO YOU WISH TO ==>" 1170 LOCATE 14,20: PRINT "1. PRINT THE LISTED ITEMS TO THE SCREEN.":LOCATE 16,20:PRINT "2. PRINT THE LISTED ITEMS TO THE PRINTER.":LOCATE 18,20:PRINT "3. RETURN TO THE MASTER MENU." 1180 LOCATE 12,30: INPUT "",P1 1190 SUB=0 1200 IF P1=1 THEN 1240 1210 IF P1=2 THEN 1240 1220 IF P1=3 THEN 900 1230 BEEP: GOTO 1180 1240 CLS 1250 I1=0 1260 ON ERROR GOTO 1920 1270 OPEN "INVENTRY.DAT" FOR INPUT AS #1 1280 IF EOF(1) THEN CLOSE: GOTO 1650 1290 I1=I1+1 1300 INPUT#1,DESC$,NUM,DOLLAR,ROOM 1310 IF ROOM=1 THEN ROOM$="LIVING ROOM":GOTO 1400 1320 IF ROOM=2 THEN ROOM$="KITCHEN/DINING ROOM":GOTO 1400 1330 IF ROOM=3 THEN ROOM$="DOWNSTAIRS BATHROOM":GOTO 1400 1340 IF ROOM=4 THEN ROOM$="UPSTAIRS BATHROOM":GOTO 1400 1350 IF ROOM=5 THEN ROOM$="MASTER BEDROOM":GOTO 1400 1360 IF ROOM=6 THEN ROOM$="STUDY":GOTO 1400 1370 IF ROOM=7 THEN ROOM$="ATTIC":GOTO 1400 1380 IF ROOM=8 THEN ROOM$="OUTSIDE":GOTO 1400 1390 ROOM$="UNSPECIFIED" 1400 SUBTTL=NUM*DOLLAR 1410 SUB=SUB+SUBTTL' KEEP UP WITH ACCUMULATED WORTH 1420 IF P1=2 THEN GOTO 1470 1430 PRINT USING "### & REPLACEMENT COST=$####.## NUM. OF ITEMS= ### SUBTOTAL= ####.## LOCATION:&";I1;DESC$;DOLLAR;NUM;DOLLAR*NUM;ROOM$ 1440 PRINT 1450 IF I1/7=INT(I1/7) THEN LOCATE 24,40:INPUT "PRESS ENTER TO CONTINUE";Z$ 1460 GOTO 1280 1470 REM ############################# OUTPUT TO PRINTER ##################### 1480 CLS 1490 IF I1 <>1 THEN 1600 1500 INPUT "WHAT IS THE DATE (IN THE FORM 08/12/82) ==>";DAT$ 1510 INPUT "SET THE TOP OF FORM ON THE PRINTER AND PRESS ENTER WHEN READY";Z$ 1520 WIDTH "LPT1:",132 1530 LPRINT CHR$(27) "0":LPRINT CHR$(27) "C" CHR$(88)'SET 8LINES/INCH AND 88 LINE FORM IT IS IMPORTANT THAT THIS IS DONE BEFORE ANYTHING IS PRINTED 1540 LPRINT CHR$(14);" HOME INVENTORY" 1550 LPRINT "BRIAN AND KAREN MANN. 628 ELGIN TERRACE, RICHMOND, VA. 23225 (804) 320-4901" 1560 LPRINT " AS OF ";DAT$; 1570 LPRINT CHR$(15) 1580 LPRINT SPC(72) "REPLACEMENT NUMBER OF" 1590 LPRINT "ITEM" SPC(25) "DESCRIPTION" SPC(31)" COST (EACH) ITEMS SUBTOTAL LOCATION" 1600 IF I1/80 <> INT(I1/80) THEN 1630 ELSE LPRINT CHR$(12) 1610 LPRINT SPC(72) "REPLACEMENT NUMBER OF" 1620 LPRINT "ITEM" SPC(25) "DESCRIPTION" SPC(31)" COST (EACH) ITEMS SUBTOTAL LOCATION" 1630 LPRINT USING "### & $####.## ### ####.## &";I1;DESC$;DOLLAR;NUM;DOLLAR*NUM;ROOM$ 1640 GOTO 1280 1650 ' ############################ EXIT ROUTINE ########################### 1660 IF P1=1 THEN PRINT USING "THE TOTAL WORTH OF THE FILED OBJECTS IS $#####.##";SUB:GOTO 1690 1670 IF P1=2 THEN LPRINT USING "THE TOTAL WORTH OF THE FILED OBJECTS IS $#####.##";SUB: 1680 IF P1=2 THEN LPRINT CHR$(12):LPRINT CHR(27) "@"; 1690 INPUT "PRESS ENTER TO RETURN TO THE MENU";Z$ 1700 GOTO 900 1710 ' ########################### DELETE ITEM ROUTINE #################### 1720 CLS 1730 LOCATE 2,2:PRINT "IT IS EASIER AND MORE FLEXIBLE TO DELETE ITEMS USING THE EDLIN PROGRAM SUPPLIED" 1740 LOCATE 3,2:PRINT "WITH IBM-DOS. EDIT THE `INVENTRY.DAT' FILE AND DELETE THE APPROPRIATE LINE."; 1750 LOCATE 8,35:COLOR 15:PRINT "DELETE ITEM":COLOR 7 1760 LOCATE 10,17:INPUT "ENTER THE ITEM NUMBER OF THE ITEM TO BE DELETED ( OR `0' TO RETURN TO THE MENU)===> ",ITEM 1770 IF ITEM = 0 THEN 900 1780 COLOR 23: LOCATE 24,31:PRINT "HOLD FOR DISK OPERATION";:COLOR 7:LOCATE 1,1 1790 I=1 1800 ON ERROR GOTO 1920 1810 NAME "INVENTRY.DAT" AS "TEMP.DAT" 1820 OPEN "TEMP.DAT" FOR INPUT AS #1 1830 OPEN "INVENTRY.DAT" FOR APPEND AS #2 1840 IF EOF(1) THEN 1890 1850 INPUT#1, DESC$,NUM,DOLLAR,ROOM 1860 IF I <> ITEM THEN WRITE#2, DESC$,NUM,DOLLAR,ROOM ELSE LOCATE 15,1:PRINT USING "ENTRY & DELETED";DESC$ 1870 I=I+1 1880 GOTO 1840 1890 CLOSE 1900 KILL"TEMP.DAT" 1910 GOTO 900 1920 '######################## ERROR HANDLING ROUTINE ######################### 1930 CLOSE:IF ERR=53 THEN 1960 1940 IF ERR=58 THEN 1980 1950 SOUND 100,20:PRINT USING "ERROR NUMBER ### IN LINE ##### . PRESS ENTER TO RETURN TO MAIN MENU.";ERR,ERL:INPUT Z1$: GOTO 900 1960 WIDTH 40: SOUND 100,20: LOCATE 12,10: PRINT "THERE IS NO INVENTRY.DAT ON THE DISK!!!":INPUT "PRESS ENTER TO RETURN TO THE MENU",Z1$ 1970 WIDTH 80:GOTO 900 1980 SOUND 100,20:PRINT "FILE TEMP.DAT ALREADY EXISTS. " 1990 INPUT "DO YOU WISH IT DELETED (Y OR N) ";ANS$ 2000 IF ANS$<>"Y" THEN GOTO 900 2010 KILL "TEMP.DAT" 2020 GOTO 1800 " 1990 INPUT "DO YOU WISH IT DELETED (Y OR N) ";ANS$ 2000 IF ANS$<>"Y" THEN GOTO 900 2010 KIL