10 REM 12/05/78
20 REM ** TRS-80 INVENTORY CONTROL SYSTEM **
25 IFPEEK(14312)>127THENPRINT"PRINTER NOT READY":GOTO40
30 LPRINTCHR$(27);CHR$(20)
40 POKE16425,1:CLEAR500:W$="":ONERRORGOTO90:OPEN"I",1,"TRANSFER"
50 LINEINPUT#1,PI$:LINEINPUT#1,PS$:LINEINPUT#1,PD$
60 LINEINPUT#1,PT$:LINEINPUT#1,PR$
70 CLOSE1:KILL"TRANSFER"
80 CLS:GOSUB250:GOTO200
90 IFERR/2+1=54THENRESUME110
100 ONERRORGOTO0
110 IFLEFT$(TIMES,2)="00"ORMID$(TIMES,3,1)<>"/"ORMID$(TIMES,6,1)<>"/"THENCLS:GOTO190
120 CLS:PRINT@458,"DATE IS SET TO ";LEFT$(TIMES,8);" . IS THIS CORRECT ? ";
130 FL=1:GOSUB370:Q$=IN$:IFQ$<>"Y"ANDQ$<>"N"THENPRINTCHR$(8);:GOTO130:ELSEIFQ$="N"THEN140:ELSE190
140 PRINT@588,"ENTER CORRECT DATE (MM/DD/YY) : ";
150 FL=8:GOSUB370:DT$=IN$
160 POKE16454,VAL(LEFT$(DT$,2)):POKE16452,VAL(RIGHT$(DT$,2))
170 POKE16453,VAL(MID$(DT$,4,2))
180 GOTO110
190 CLS:GOSUB250:GOSUB3180:IFP$=""THEN190:ELSEGOSUB3170:PRINT@472,"INITIALIZING";CHR$(30)
200 DEFINTA,C,H,J,K,F,L,M,N,P,T,V,W:DIMV(1000)
210 DEFFNGP(IC,IP)=(IP-IC)/IP*100
220 ONERRORGOTO3550:POKE16424,67:POKE16425,1:XX=1:LF$=CHR$(32):LL$=STRING$(132,"-")
230 READA0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,L0$,L1$,L6$,L7$:RESTORE:GOTO3010
240 GOSUB250:GOTO270
250 CLS:PRINTTAB(13)"TRS-80 INVENTORY CONTROL SYSTEM":PRINT@117,LEFT$(TIMES,8);:PRINT:RETURN
260 GOSUB250:PRINTTAB(20)"SYSTEM STATUS REPORT":PRINT:GOSUB3070:PRINT:GOSUB2480:RETURN
270 PRINT"FUNCTIONS:

1 - INPUT NEW ITEMS
2 - ACCESS / UPDATE
3 - OUTPUT REPORTS AND SUMMARIES
4 - CREATE NEW INVENTORY
5 - ENTER SALES TICKETS
6 - END OF PERIOD PROCESSING"
280 PRINT"7 - ENTER RECEIPTS OF ON-ORDER ITEMS
8 - ENTER ITEMS PLACED ON ORDER
9 - DISPLAY SYSTEM STATUS
@ - EXIT FROM PROGRAM"
290 PRINT:PRINT"SELECT FUNCTION > ";
300 FL=-1:GOSUB370:S$=IN$:IFCF=1THEN330:ELSEIFS$<"1"ORS$>"9"THENPRINTCHR$(8);:GOTO300
310 ONVAL(S$)GOSUB560,800,1530,1800,1870,2000,1300,1310,260
320 IFFD=0THEN240:ELSECLS:PRINT@464,"LOADING IN DATA FOR SORT":CLOSE:GOSUB2750:GOSUB2720:GOTO3670
330 CLS
340 PRINT@472,"END OF PROGRAM":PRINT:PRINT:IFER=1THENCLOSE:CLEAR50:END:ELSECLOSE:GOSUB2750:GOSUB2720:CLEAR50:END
350 PRINT@128,CHR$(30);CHR$(29);"(TYPE @ TO EXIT TO MAIN MENU)";:RETURN
360 PRINT@128,CHR$(30);CHR$(29);"(TYPE @ TO REDO ENTRY)";:RETURN
370 IN$="":CF=0:W$=INKEY$:WD=0:WS=WD:WL=WD:IFFL=WDTHENFL=1
380 PRINTSTRING$(ABS(FL),CHR$(136));STRING$(ABS(FL),CHR$(24));
390 PRINTCHR$(14);:FORW=1TO25:W$=INKEY$:IFW$<>""THEN400:ELSENEXT:PRINTCHR$(15);:FORW=1TO25:W$=INKEY$:IFW$<>""THEN400:ELSENEXT:GOTO390
400 IFW$<>CHR$(13)THEN420:ELSEPRINTSTRING$(ABS(FL)-WL," ");
410 PRINTCHR$(15);:W=25:NEXT:RETURN
420 IFW$<>"@"THEN440
430 CF=1:PRINTCHR$(15);:RETURN
440 PRINTCHR$(14);:IFW$=CHR$(24)THENPRINTSTRING$(WL,CHR$(24));:GOTO370
450 IFW$<>CHR$(8)THEN490:ELSEIFWL=0THEN390:ELSEPRINTCHR$(24);:IFFL>0THEN470:ELSEIFPEEK(16418)=44THEN480
460 IFPEEK(16418)=46THENWD=0:GOTO470:ELSEIFPEEK(16418)=43ORPEEK(16418)=45THENWS=0
470 IN$=LEFT$(IN$,LEN(IN$)-1)
480 WL=WL-1:POKE16418,136:GOTO390
490 IFABS(FL)=WLTHEN390:ELSEIFFL>0THENIFW$>=" "ANDW$<="z"THEN540
500 IFW$="."ANDWD=0THENWD=1:GOTO540
510 IFW$=","THENPRINTW$;:WL=WL+1:GOTO550
520 IF(W$="-"ORW$="+")ANDWS=0ANDWL=0THENWS=1:GOTO540
530 IFW$<"0"ORW$>"9"THEN390
540 PRINTW$;:IN$=IN$+W$:WL=WL+1
550 IFABS(FL)=1THEN410:ELSE390
560 CLS:PRINTTAB(20)"INPUT NEW ITEMS":PRINT
570 IFER=1THENGOSUB3060:RETURN
580 J=TN
590 IFTI=1000THENCLS:PRINT@468,"SYSTEM IS FULL (1000 ITEMS)":GOSUB2480:RETURN:ELSEPRINT@A0,CHR$(30);:GOSUB2510:GOSUB350
600 IFFD<>0THENPRINT@295,"(LAST ENTRY: ";IS$;")";
610 FL=10:PRINT@A0,;:GOSUB370:IFCF=0THENIS$=IN$:ELSE630
620 IFIS$<>""THEN640:ELSE610
630 RETURN
640 GOSUB360
650 FL=19:PRINT@A1,;:GOSUB370:IFCF=0THENID$=IN$:ELSE560
660 FL=-4:PRINT@A2,;:GOSUB370:IFCF=0THENIQ%=VAL(IN$):ELSE560
670 FL=-7:PRINT@A3,;:GOSUB370:GOSUB3750:IFCF=0THENIC=VAL(IN$):PRINTCHR$(30);:ELSEONCFGOTO560,670
680 FL=-7:PRINT@A4,;:GOSUB370:GOSUB3750:IFCF=0THENIP=VAL(IN$):PRINTCHR$(30);:ELSEONCFGOTO560,680
690 GOSUB2830
700 FL=10:PRINT@A5,;:GOSUB370:IFCF=0THENIL$=IN$:ELSE560
710 FL=-4:PRINT@A6,;:GOSUB370:IFCF=0THENIR%=VAL(IN$):ELSE560
720 PRINT" / ";:FL=-4:GOSUB370:IFCF=0THENIN%=VAL(IN$):ELSE560
730 FL=-4:PRINT@A7,;:GOSUB370:IFCF=0THENIO%=VAL(IN$):ELSE560
740 FL=8:PRINT@A8,;:GOSUB370:IFCF=0THENIM$=IN$:ELSE560
750 FL=6:PRINT@A9,;:GOSUB370:IFCF=0THENIV$=IN$:ELSE560
760 P1=0:P2=0:GOSUB3860
770 TC#=TC#+IC*IQ%:TP#=TP#+IP*IQ%:TR#=TR#+IO%*IC:TI=TI+1
780 FD=1:GOSUB3130:GOSUB2630:GOSUB2660:GOSUB2650:GOSUB2540
790 GOSUB2600:GOSUB2560:TN=TN+1:J=TN:GOSUB2510:GOTO590
800 CLS:PRINTTAB(20)"ACCESS / UPDATE DATA":PRINT
810 IFER=1THENGOSUB3060:RETURN
820 PRINT@A0,CHR$(31);:GOSUB2510
830 GOSUB2780:PRINT"ENTER STOCK # (TYPE @ TO EXIT) ----> ";
840 FL=10:GOSUB370:IFCF=0THENIS$=IN$:ELSE1270
850 GOSUB2420
860 IFK=0THENPRINT@AB,"ITEM NOT IN LISTING";:GOSUB2500:GOSUB2510:GOTO830
870 GOSUB2760
880 GOSUB2780:PRINT"SELECT (U)PDATE, (S)EARCH, (N)EXT ITEM, (P)REVIOUS ITEM,
(A)DJUST QTY, (D)ELETE, (@) TO EXIT TO MAIN MENU --> ";
890 FL=1:GOSUB370:IFCF=1THEN1270:ELSEO$=IN$:IFO$<>"U"ANDO$<>"S"ANDO$<>"N"ANDO$<>"P"ANDO$<>"D"ANDO$<>"A"THENPRINTCHR$(8);:GOTO890
900 IFO$="D"THEN1210
910 IFO$="S"THEN820
920 IFO$="U"THEN970
930 IFO$="A"THEN1240
940 IFO$="P"ANDN<>1THENN=N-1:J=V(N):IFSGN(J)=-1THEN940:ELSEGOSUB2630:GOSUB2660:GOSUB2670:GOSUB2760:GOTO880
950 IFO$="N"ANDN+1<>TNTHENN=N+1:J=V(N):GOTO960:ELSEPRINTCHR$(8);:GOTO890
960 IFSGN(J)=-1THEN950:ELSEGOSUB2630:GOSUB2660:GOSUB2670:GOSUB2760:GOTO880
970 GOSUB2780:PRINT"SELECT LINE TO BE UPDATED (TYPE @ TO RESTART)--> ";
980 FL=-1:GOSUB370:IFCF=0THENU$=IN$:IFU$<"1"ORU$>"9"THENPRINTCHR$(8);:GOTO980
990 IFCF<>0THEN880
1000 GOSUB2780:ONVAL(U$)GOTO1010,1030,1050,1070,1090,1110,1140,1160,1180
1010 GOSUB2780:PRINT"1 - DESCRIPTION : ";
1020 FL=19:GOSUB370:IFCF=0THENID$=IN$:GOTO1200:ELSE990
1030 GOSUB2780
1040 PRINT"2 - QUANTITY : ";:FL=-4:GOSUB370:IFCF=0THENGOSUB1280:IQ%=VAL(IN$):GOSUB1290:GOTO1200:ELSE990
1050 GOSUB2780
1060 PRINT"3 - COST : ";:FL=-7:GOSUB370:GOSUB3750:IFCF=0THENGOSUB1280:IC=VAL(IN$):GOSUB1290:PRINTCHR$(30);:GOTO1200:ELSEONCFGOTO990,1050
1070 GOSUB2780
1080 PRINT"4 - RETAIL PRICE : ";:FL=-7:GOSUB370:GOSUB3750:IFCF=0THENGOSUB1280:IP=VAL(IN$):GOSUB1290:PRINTCHR$(30);:GOTO1200:ELSEONCFGOTO990,1070
1090 GOSUB2780:PRINT"5 - LOCATION : ";
1100 FL=10:GOSUB370:IFCF=0THENIL$=IN$:GOTO1200:ELSE990
1110 GOSUB2780:PRINT"6 - REORDER POINT/QTY : ";
1120 FL=-4:GOSUB370:IFCF=0THENIR%=VAL(IN$):ELSE990
1130 PRINT" / ";:FL=-4:GOSUB370:IFCF=0THENIN%=VAL(IN$):GOTO1200:ELSE990
1140 GOSUB2780:PRINT"7 - # ON ORDER : ";
1150 FL=-4:GOSUB370:IFCF=0THENGOSUB1280:IO%=VAL(IN$):GOSUB1290:GOTO1200:ELSE990
1160 GOSUB2780:PRINT"8 - DATE LAST ORDER : ";
1170 FL=8:GOSUB370:IFCF=0THENIM$=IN$:GOTO1200:ELSE990
1180 GOSUB2780:PRINT"9 - VENDOR : ";
1190 FL=6:GOSUB370:IFCF=0THENIV$=IN$:GOTO1200:ELSE990
1200 GOSUB2560:GOSUB2510:GOSUB2860:GOTO880
1210 V(N)=-J
1220 TI=TI-1:GOSUB1280:F=F+1
1230 IFN+1=TNTHENPRINT@A0,CHR$(31);:GOSUB2510:GOTO830:ELSEN=N+1:J=V(N):IFSGN(J)=1THENGOSUB2630:GOSUB2660:GOSUB2670:GOTO870:ELSE1230
1240 GOSUB2780:PRINT"ENTER + OR - AND CHANGE IN QUANTITY ---> ";
1250 FL=-4:GOSUB370:IFCF=0THENCH$=IN$:ELSE990
1260 IQ%=IQ%+VAL(CH$):TC#=TC#+IC*VAL(CH$):TP#=TP#+IP*VAL(CH$):GOTO1200
1270 RETURN
1280 TC#=TC#-IQ%*IC:TP#=TP#-IQ%*IP:TR#=TR#-IO%*IC:RETURN
1290 TC#=TC#+IQ%*IC:TP#=TP#+IQ%*IP:TR#=TR#+IO%*IC:RETURN
1300 CLS:PRINTTAB(10)"ENTER RECEIPTS OF ON-ORDER ITEMS":PRINT:GOTO1320
1310 CLS:PRINTTAB(15)"ENTER ITEMS PLACED ON ORDER":PRINT
1320 IFER=1THENGOSUB3060:RETURN
1330 PRINT@A0,CHR$(31);:GOSUB2510
1340 GOSUB2780:PRINT"ENTER STOCK# (TYPE @ TO EXIT) ----> ";
1350 FL=10:GOSUB370:IFCF=0THENIS$=IN$:ELSE1270
1360 GOSUB2420
1370 IFK=0THENPRINT@AB,"ITEM NOT IN LISTING";:GOSUB2500:GOSUB2510:GOTO1340
1380 GOSUB2760
1390 IFS$="8"THEN1490
1400 GOSUB2780:PRINT"QUANTITY RECEIVED: ";
1410 FL=-4:GOSUB370:IFCF=0THENGOSUB1280:IQ%=IQ%+VAL(IN$):IO%=IO%-VAL(IN$):ELSE1340
1420 GOSUB2780:PRINT"CHANGE IN COST (HIT <ENTER> TO SKIP): ";
1430 FL=-7:GOSUB370:IFCF<>0THEN1340:ELSEIFIN$=""THEN1450:ELSEGOSUB3750
1440 IFCF=0THENIC=VAL(IN$):PRINTCHR$(30);:ELSE1420
1450 GOSUB2780:PRINT"CHANGE IN SELL PRICE (HIT <ENTER> TO SKIP): ";
1460 FL=-7:GOSUB370:IFCF<>0THEN1340:ELSEIFIN$=""THEN1480:ELSEGOSUB3750
1470 IFCF=0THENIP=VAL(IN$):PRINTCHR$(30);:ELSE1450
1480 GOSUB1290:GOSUB2560:GOSUB2510:GOSUB2860:GOTO1340
1490 GOSUB2780:PRINT"QUANTITY ORDERED (HIT <ENTER> FOR DEFAULT QTY): ";
1500 FL=-4:GOSUB370:IFCF<>0THEN1340:ELSEGOSUB1280:IFIN$=""THENIO%=IO%+IN%:ELSEIO%=IO%+VAL(IN$)
1510 GOSUB2780:PRINT"DATE OF ORDER (HIT <eNTER> FOR LAST ENTERED DATE): ";
1520 FL=8:GOSUB370:IFIN$<>""THENIP$=IN$:IM$=IN$:GOTO1480:ELSEIM$=IP$:GOTO1480
1530 CLS:PRINTTAB(15)"OUTPUT REPORTS AND SUMMARIES":PRINT
1540 IFER=1THENGOSUB3060:RETURN
1550 PRINT"OPTIONS:

1 - PRINTOUT COMPLETE LISTING
2 - PRINTOUT OF NOT-IN-STOCK ITEMS
3 - PRINTOUT ALL ITEMS ON ORDER
4 - PRINTOUT ALL ITEMS AT OR BELOW REORDER POINT
5 - PRINTOUT BY VENDOR
6 - PRINTOUT BY PREFIX / SUFFIX"
1560 PRINT"7 - PRINT SUGGESTED PURCHASE ORDER TO VENDOR
8 - TEST PRINTER
@ - EXIT TO MAIN MENU"
1570 PRINT:PRINT"SELECT OPTION --> ";
1580 FL=-1:GOSUB370:IFCF=1THENRETURN:ELSEO$=IN$:IFO$<"1"ORO$>"8"THENPRINTCHR$(8);:GOTO1580
1590 GOSUB3730:IFXX=1THEN1530
1600 GOSUB3000
1610 O=VAL(O$):IFO=8THENFORT=0TO131:LPRINT"*";:NEXT:CLS:GOTO1530
1620 GOSUB2960:IFO<>7THENGOSUB2970:GOSUB3000
1630 ONOGOSUB3250,3270,3290,3310,3330,3360,3430
1640 IFO<>7THENGOSUB2890:FORN=1TOTN-1:ELSEGOSUB3780:FORN=1TOTN-1
1650 J=V(N):IFSGN(J)=-1THEN1680
1660 ONOGOSUB3260,3280,3300,3320,3350,3400,3450
1670 EN$=INKEY$:IFEN$="@"THENLPRINT" ":LPRINT"   * TERMINATED *":POKE16425,1:GOTO1530
1680 NEXT
1690 IFO<>1ANDO<>3ANDO<>7ANDO<>5ANDO<>6THEN1770
1700 IFO=3THEN1760
1710 IFO=7THEN3830
1720 IFO=5ORO=6THEN3480
1725 IF GI<>TI AND GC#<>TC# AND GP#<>TP# AND GR#<>TR# THENGOSUB4050
1730 GI=0:GC#=0:GP#=0:GR#=0:LPRINT" ":LPRINT"TOTAL ITEMS LISTED:";TAB(25)TI
1740 IFCC=0THENLPRINT"TOTAL COST VALUE:";TAB(25);:LPRINTUSINGL6$;TC#
1750 LPRINT"TOTAL RETAIL VALUE:";TAB(25);:LPRINTUSINGL6$;TP#
1760 IFCC=0THENLPRINT" ":LPRINT"TOTAL COST OF ORDERS:";TAB(25);:LPRINTUSINGL6$;TR#
1770 GOSUB3240:CLS:GOTO1530
1780 GOSUB2630:GOSUB2660:GOSUB2670:RETURN
1790 GOSUB2540:GOSUB2600:GOSUB2610:GOSUB4000:RETURN
1800 CLS:PRINTTAB(20)"CREATE NEW INVENTORY"
1810 IFER=0THENPRINT@448,"SYSTEM CONTAINS INVENTORY DATA. IF YOU WISH TO ERASE ALL DATA,
TYPE (SHIFT) K OR ELSE TYPE @ TO RETURN TO MAIN MENU --> ";:ELSE1840
1820 FL=1:GOSUB370:IFCF=1THENRETURN:ELSET$=IN$:IFT$<>"k"THENPRINTCHR$(8);:GOTO1820
1830 CLOSE:KILLPI$:KILLPD$:KILLPT$:KILLPS$:KILLPR$:CLS:PRINT@468,"ALL DATA ERASED":ER=1:PRINT:PRINT:GOSUB2480:RETURN
1840 TC#=0:TP#=0:TR#=0:TI=0:TN=1:HI=0:HN=1:F=0:ER=0:GOSUB2530
1850 PRINT@460,"SYSTEM READY FOR NEW INVENTORY"
1860 PRINT:PRINT:GOSUB2480:RETURN
1870 CLS:PRINTTAB(21)"ENTER SALES TICKETS":PRINT
1880 IFER=1THENGOSUB3060:RETURN
1890 GOSUB2350:H=HN:HC=0
1900 IFHI=1000THENCLS:PRINT@448,"SALES FILE IS FULL (1000 ITEMS). USE FUNCTION 6 TO
POST SALES AND CLEAR THE FILE.":CLOSE1:GOSUB2500:RETURN
1910 GOSUB350
1920 PRINT@256,CHR$(31);
1930 IFHC<>0THENPRINT@295,"(LAST ENTRY: ";HA$;")";
1940 PRINT@256,"STOCK NUMBER: ";
1950 FL=10:GOSUB370:IFCF=0THENHA$=IN$:ELSECLOSE1:RETURN
1960 GOSUB360:PRINT@384,"QUANTITY SOLD: ";
1970 FL=-4:GOSUB370:IFCF=0THENHB=VAL(IN$):ELSE1910
1980 GOSUB2360:GOSUB2400:GOSUB2380
1990 HI=HI+1:HN=HN+1:H=HN:HC=1:GOTO1900
2000 CLS:PRINTTAB(20)"END OF PERIOD PROCESSING":PRINT
2010 IFER=1THENGOSUB3060:RETURN
2020 PRINT@128,"FUNCTIONS:

1 - POST SALES TICKETS AND CLEAR TICKET FILE

2 - CLEAR CURRENT SALES FIGURES FROM INVENTORY

3 - CLEAR CURRENT AND CUMULATIVE SALES FIGURES FROM INVENTORY

@ - EXIT TO MAIN MENU":PRINT
2030 PRINT"SELECT FUNCTION > ";
2040 FL=-1:GOSUB370:IFCF=1THENRETURN:ELSEHO$=IN$:IFHO$<"1"ORHO$>"3"THENPRINTCHR$(8);:GOTO2040
2045 IFVAL(HO$)>1THENPRINT"  ARE YOU SURE (Y/N)";:FL=1:GOSUB370:IFIN$<>"Y"THEN2000
2050 ONVAL(HO$)GOTO2060,2260,2280
2060 GOSUB3730:IFXX=1THEN2000
2070 IFHI=0THENCLS:PRINT@460,"NO UNPOSTED SALES TICKETS IN FILE":GOSUB2500:GOTO2000:ELSEGOSUB2190
2080 CLS:PRINT@468,"pOSTING IN PROGRESS"
2090 GOSUB2350:HT=HI:HC#=0
2100 FORH=1TOHI
2110 GOSUB2360:GOSUB2400:GOSUB2410:IS$=HA$
2120 GOSUB2420:IFK=0THENGOSUB2200:GOTO2170
2130 GOSUB2540:GOSUB2600:GOSUB2610
2140 P1=P1+HB:P2=P2+HB:HC#=HC#+HB*IC
2150 IQ%=IQ%-HB:TC#=TC#-HB*IC:TP#=TP#-HB*IP:IFIQ%<0THENGOSUB2220
2160 GOSUB2560:HT=HT-1:PRINT@596,"TICKETS REMAINING: ";HT
2170 NEXT:GOSUB2230
2180 HI=0:HN=1:CLOSE1:KILLPR$:GOTO2000
2190 GOSUB2960:LPRINTTAB(30)"SALES TICKET POSTING REPORT":LPRINTLF$:RETURN
2200 LPRINT"E R R O R : STOCK # ";HA$;" IS NOT IN INVENTORY LISTING AND WAS NOT POSTED":LPRINTLF$
2210 RETURN
2220 LPRINT"N O T E : STOCK # ";HA$;" NOW HAS A QUANTITY OF ";IQ%:LPRINTLF$:RETURN
2230 LPRINT"NUMBER OF ITEMS POSTED: ";HI-HT
2240 LPRINT"TOTAL COST OF GOODS SOLD: ";USINGL6$;HC#
2250 GOSUB3240:RETURN
2260 CLS:PRINT@463,"CLEARING CURRENT SALES FIGURES"
2270 GOSUB2300:GOTO2000
2280 CLS:PRINT@460,"CLEARING CURRENT AND CUMULATIVE SALES FIGURES"
2290 GOSUB2300:GOTO2000
2300 FORJ=1TOTN-1
2310 GOSUB2540:GOSUB2600:GOSUB2610
2320 IFHO$="3"THENP2=0
2330 P1=0
2340 GOSUB2560:NEXT:RETURN
2350 OPEN"R",1,PR$:RETURN
2360 HR=INT((H-1)/20)+1:HD=H-20*INT((H-1)/20)-1
2370 FIELD1,HD*12ASD$,10ASH1$,2ASH2$:RETURN
2380 LSETH1$=HA$:RSETH2$=MKI$(HB)
2390 PUT1,HR:RETURN
2400 GET1,HR:RETURN
2410 HA$=H1$:HB=CVI(H2$):RETURN
2420 NL=0:NH=TN
2430 K=INT((NH-NL)/2):IFK=0THENRETURN:ELSEN=K+NL
2435 IFN=NHTHENNH=INT((NH-NL)/2)+NL:GOTO2430:ELSEIFV(N)<0THENN=N+1:GOTO2435
2440 J=ABS(V(N)):GOSUB2630:GOSUB2660:IFIS$+STRING$(10-LEN(IS$)," ")=N$THENIS$=N$:GOTO2470
2450 IFIS$+STRING$(10-LEN(IS$)," ")<N$THENNH=N:GOTO2430
2460 NL=N:GOTO2430
2470 IFSGN(V(N))=-1THENK=0:RETURN:ELSERETURN
2480 PRINTTAB(10)"TYPE @ TO RETURN TO MAIN MENU --> ";
2490 FL=1:GOSUB370:IFCF=1THENRETURN:ELSEPRINTCHR$(8);:GOTO2490
2500 FORT=1TO2500:NEXT:RETURN
2510 PRINT@256,"0 - STOCK # -------->
1 - DESCRIPTION ---->
2 - QUANTITY ------->
3 - COST ----------->
4 - SELL ----------->
5 - LOCATION ------->
6 - REORDER PT/QTY-->
7 - # ON ORDER ----->
8 - DATE LAST ORDER->
9 - VENDOR --------->";CHR$(31);
2520 RETURN
2530 OPEN"R",2,PD$:OPEN"R",3,PS$:RETURN
2540 JR=INT((J-1)/4)+1:JD=J-4*INT((J-1)/4)-1
2550 FIELD2,JD*63ASD$,19ASFD$,2ASFQ$,4ASFC$,4ASFP$,10ASFL$,2ASFR$,2ASFA$,2ASFO$,8ASFM$,6ASFV$,2ASP1$,2ASP2$:RETURN
2560 LSETFD$=ID$:RSETFQ$=MKI$(IQ%):RSETFC$=MKS$(IC)
2570 RSETFP$=MKS$(IP):LSETFL$=IL$:RSETFR$=MKI$(IR%):RSETFA$=MKI$(IN%)
2580 RSETFO$=MKI$(IO%):LSETFM$=IM$:LSETFV$=IV$:RSETP1$=MKI$(P1):RSETP2$=MKI$(P2)
2590 PUT2,JR:RETURN
2600 GET2,JR:RETURN
2610 ID$=FD$:IQ%=CVI(FQ$):IC=CVS(FC$):IP=CVS(FP$):IL$=FL$
2620 IR%=CVI(FR$):IN%=CVI(FA$):IO%=CVI(FO$):IM$=FM$:IV$=FV$:P1=CVI(P1$):P2=CVI(P2$):RETURN
2630 JR=INT((J-1)/25)+1:JD=J-25*INT((J-1)/25)-1
2640 FIELD3,JD*10ASD$,10ASN$:RETURN
2650 LSETN$=IS$:PUT3,JR:RETURN
2660 GET3,JR:RETURN
2670 IS$=N$:RETURN
2680 OPEN"I",1,PI$:OPEN"I",3,PT$
2690 INPUT#3,TC#,TP#,TR#,TI,HI:CLOSE3
2700 INPUT#1,TN,HN,F
2710 FORN=1TOTN-1:INPUT#1,V(N):NEXT:CLOSE1:RETURN
2720 OPEN"O",1,PI$
2730 PRINT#1,TN;HN;F
2740 FORN=1TOTN-1:PRINT#1,V(N):NEXT:CLOSE1:RETURN
2750 OPEN"O",3,PT$:PRINT#3,TC#;TP#;TR#;TI;HI:CLOSE3:RETURN
2760 PRINT@A0,CHR$(30);:GOSUB2510:GOSUB2540:GOSUB2600:GOSUB2610:PRINT@A0,IS$;:GOSUB2860:RETURN
2770 DATA281,345,409,473,537,601,665,729,793,857,128,490,960
2780 PRINT@AA,CHR$(30):PRINTCHR$(30);:PRINT@AA,;:RETURN
2790 DATA"####"
2800 DATA"####.##"
2810 DATA"$$###,####.##"
2820 DATA"###.#"
2830 IFIP<>0THENPRINT@552,"GROSS PROFIT= ";USINGL7$;FNGP(IC,IP);:PRINT" %";:RETURN:ELSERETURN
2840 IFCC=1THENLPRINT"  ****";:RETURN
2850 IFIP<>0THENLPRINT" ";USINGL7$;FNGP(IC,IP);:RETURN:ELSERETURN
2860 PRINT@A1,ID$;:PRINT@A2,IQ%;:PRINT@A3,USINGL1$;IC;:PRINT@A4,USINGL1$;IP;:GOSUB2830
2870 PRINT@A5,IL$;:PRINT@A6,IR%;"/";IN%;:PRINT@A7,IO%;:PRINT@A8,IM$;:PRINT@A9,IV$;:GOSUB3860
2880 RETURN
2890 LPRINT"STOCK #     DESCRIPTION           QTY     COST     SELL  GP %  LOCATION    R/O PT / QTY   ON ORDER  DATE      VENDOR   CURR / CUML"
2900 LPRINT"=======     ===========           ===     ====     ====  ====  ========    =====   ====   ========  ====      ======   ====   ===="
2910 LPRINT" ":RETURN
2920 GOSUB3720:LPRINTIS$;TAB(12)ID$;TAB(33);:LPRINTUSINGL0$;IQ%;:LPRINTTAB(39);:IFCC=0THENLPRINTUSINGL1$;IC;:ELSELPRINT"   ****";
2930 LPRINTTAB(48)USINGL1$;IP;:GOSUB2840
2940 LPRINTTAB(63)IL$;"  ";:LPRINTUSINGL0$;IR%;:LPRINT" / ";:LPRINTUSINGL0$;IN%;:LPRINT"      ";:LPRINTUSINGL0$;IO%;:LPRINT"    ";IM$;"  ";IV$;"   ";USINGL0$;P1;:LPRINT" / ";USINGL0$;P2
2950 RETURN
2960 LPRINTLL$:LPRINTLF$:LPRINTLF$:LPRINTLEFT$(TIMES,8):LPRINTLF$:RETURN
2970 CLS:PRINT@456,"DO YOU WANT TO SUPPRESS COST AND PROFIT FIGURES ? ";
2980 FL=1:GOSUB370:IFIN$<>"Y"ANDIN$<>"N"THENPRINTCHR$(8);:GOTO2980
2990 IFIN$="N"THENCC=0:RETURN:ELSECC=1:RETURN
3000 PRINT@128,CHR$(31):PRINT@470,"** PRINTING **":RETURN
3010 GOSUB2680:IFER=1THENRESUME3050
3020 PRINT@128,CHR$(31);
3030 GOSUB2530
3040 GOTO240
3050 PRINT@448,CHR$(30);CHR$(29);"NO DATA IN SYSTEM. USE FUNCTION 4 OF MENU TO CREATE INVENTORY.":PRINT:GOSUB2480:GOTO240
3060 PRINT@458,"NO DATA IN SYSTEM! USE FUNCTION 4 FIRST!":GOSUB2500:RETURN
3070 PRINT:PRINT"NUMBER OF ITEMS CURRENTLY IN LISTING: ";TI
3080 PRINT"NUMBER OF UNPOSTED SALES TICKETS: ";HI
3090 PRINT"TOTAL COST (WHOLESALE) VALUE: ";:PRINTUSINGL6$;TC#
3100 PRINT"TOTAL RETAIL SALE VALUE ----: ";:PRINTUSINGL6$;TP#
3110 PRINT"TOTAL VALUE OF ITEMS ORDERED: ";:PRINTUSINGL6$;TR#
3120 RETURN
3130 IFF=0THENV(J)=J:RETURN
3140 FORN=1TOTN-1
3150 IFSGN(V(N))=-1THENV(N)=ABS(V(N)):J=V(N):TN=TN-1:F=F-1:RETURN
3160 NEXT:F=0:V(J)=J:RETURN
3170 PI$="INDEXFIL"+"."+P$+":0":PD$="DATAFILE"+"."+P$+":0":PT$="INFOFILE"+"."+P$+":0":PS$="STOCKNUM"+"."+P$+":0":PR$="SALEDATA"+"."+P$+":0":RETURN
3180 PRINT@472,"ENTER PASSWORD ---> ";
3190 P$="":FORX=1TO8
3200 PE$=INKEY$:IFPE$=""THEN3200:ELSEIFPE$<" "ORPE$>"Z"THEN3220
3210 P$=P$+PE$:PRINT"#";:GOTO3230
3220 IFASC(PE$)=13THENRETURN:ELSE3200
3230 NEXT:RETURN
3240 LPRINT" ":LPRINT"END OF LISTING":LPRINTLL$:LPRINTCHR$(12):RETURN
3250 LPRINTTAB(30)"COMPLETE INVENTORY LISTING":LPRINT" ":RETURN
3260 GOSUB1780:GOSUB1790:GOSUB2920:RETURN
3270 LPRINTTAB(30)"LISTING OF NOT-IN-STOCK ITEMS":LPRINT" ":RETURN
3280 GOSUB1790:IFIQ%>0THENRETURN:ELSEGOSUB1780:GOSUB2920:RETURN
3290 LPRINTTAB(30)"LISTING OF ALL ITEMS ON ORDER":LPRINT" ":RETURN
3300 GOSUB1790:IFIO%=0THENRETURN:ELSEGOSUB1780:GOSUB2920:RETURN
3310 LPRINTTAB(30)"LISTING OF ALL ITEMS AT OR BELOW REORDER POINT":LPRINT" ":RETURN
3320 GOSUB1790:IFIQ%>IR%THENRETURN:ELSEGOSUB1780:GOSUB2920:RETURN
3330 GOSUB3530:GOSUB3000
3340 LPRINTTAB(30)"LISTING BY VENDOR: ";IX$:LPRINT" ":GOSUB3460:RETURN
3350 GOSUB1790:IFLEFT$(IV$,LEN(IX$))<>IX$THENRETURN:ELSEGOSUB1780:GOSUB3470:GOSUB2920:RETURN
3360 CLS:GOSUB3460:PRINT@468,"(P)REFIX OR (S)UFFIX ? "
3370 S$=INKEY$:IFS$<>"P"ANDS$<>"S"THEN3370
3380 IFS$="P"THENPRINT@532,"ENTER PREFIX --> ";:FL=10:GOSUB370:K$=IN$:GOSUB3000:LPRINTTAB(30)"LISTING BY PREFIX: ";K$:LPRINT" ":RETURN
3390 PRINT@532,"ENTER SUFFIX --> ";:FL=10:GOSUB370:K$=IN$:GOSUB3000:LPRINTTAB(30)"LISTING BY SUFFIX: ";K$:LPRINT" ":RETURN
3400 GOSUB1780:IFS$="S"THEN3420
3410 IFLEFT$(IS$,LEN(K$))<>K$THENRETURN:ELSEGOSUB1790:GOSUB3470:GOSUB2920:RETURN
3420 IFRIGHT$(IS$,LEN(K$))<>K$THENRETURN:ELSEGOSUB1790:GOSUB3470:GOSUB2920:RETURN
3430 GOSUB3530:GOSUB3000
3440 LPRINTTAB(20)"SUGGESTED PURCHASE ORDER TO VENDOR: ";IX$:LPRINT" ":TT=0:T1#=0:RETURN
3450 GOSUB1790:IFLEFT$(IV$,LEN(IX$))<>IX$ORIQ%>IR%ORIR%<(IO%+IQ%)THENRETURN:ELSEGOSUB1780:GOSUB3800:RETURN
3460 TT=0:T1#=0:T2#=0:T3#=0:RETURN
3470 TT=TT+1:T1#=T1#+IQ%*IC:T2#=T2#+IQ%*IP:T3#=T3#+IO%*IC:RETURN
3480 LPRINT" ":LPRINT"NUMBER OF ITEMS:";TAB(25)TT
3490 IFCC=0THENLPRINT"TOTAL COST VALUE:";TAB(25)USINGL6$;T1#
3500 LPRINT"TOTAL RETAIL VALUE:";TAB(25)USINGL6$;T2#
3510 IFCC=0THENLPRINT"TOTAL COST OF ORDERS:";TAB(25)USINGL6$;T3#
3520 GOSUB3240:CLS:GOTO1540
3530 CLS:PRINT@450,"ENTER ENOUGH LETTERS TO IDENTIFY VENDOR --> ";
3540 FL=6:GOSUB370:IX$=IN$:RETURN
3550 IFERR/2+1=54THENER=1:RETURN
3560 IFERR/2+1=57THEN3610
3570 IFERR/2+1=68THENCLS:CLOSE:PRINT@458,"NO DISK IN DRIVE #1 - RUN TERMINATED":CLEAR50:PRINT:PRINT:END
3580 IFERR/2+1=70THENCLS:PRINT@465,"UNAUTHORIZED ACCESS TO INVENTORY SYSTEM
"TAB(28)"RUN TERMINATED":PRINT:CLEAR50:END
3590 PRINT:PRINTCHR$(30);"UNEXPECTED ERROR CODE ";ERR/2+1;"IN LINE";ERL:GOSUB2500:GOTO330
3600 ONERRORGOTO0
3610 CLS:PRINT@404,"** DISK I/O ERROR **":TE=TE+1
3620 PRINT@586,"TOTAL I/O ERRORS THIS RUN: ";TE
3630 PRINT@650,"THIS ERROR OCCURRED IN LINE";ERL
3640 PRINT@778,"(T)RY AGAIN OR (E)XIT FROM PROGRAM ? ";
3650 FL=1:GOSUB370:IFIN$<>"T"ANDIN$<>"E"THENPRINTCHR$(8);:GOTO3650
3660 IFIN$="T"THENRESUME:ELSE330
3670 OPEN"O",1,"TRANSFER:0"
3680 PRINT#1,PI$:PRINT#1,PS$:PRINT#1,PD$:PRINT#1,PT$:PRINT#1,PR$
3690 CLOSE1:CLEAR50
3700 RUN"DATASORT"
3710 END
3720 IFPEEK(&H4029)<58THENRETURN:ELSELPRINTCHR$(12):GOSUB2960:GOSUB2890:RETURN
3730 IFPEEK(14312)<=127THENXX=0:RETURN
3740 CLS:PRINT@468,"PRINTER NOT READY !!":XX=1:GOSUB2500:CLS:RETURN
3750 IFCF<>0THENRETURN
3760 IFLEN(IN$)>=3THENIFMID$(IN$,LEN(IN$)-2,1)="."THENRETURN
3770 PRINT" INVALID FORMAT !";:FORT=1TO1000:NEXT:CF=2:RETURN
3780 LPRINT" QTY       STOCK #         DESCRIPTION             COST         EXTENSION"
3790 LPRINT" ===        ========       ===========             ====         =========":LPRINT" ":RETURN
3800 TT=TT+1:T1#=T1#+IN%*IC
3810 LPRINTUSINGL0$;IN%;:LPRINTTAB(12)IS$;TAB(27)ID$;:LPRINTTAB(48)USINGL1$;IC;:LPRINTTAB(60)USINGL6$;IN%*IC
3820 RETURN
3830 LPRINT" ":LPRINT"TOTAL ITEMS:";TT
3840 LPRINT"TOTAL COST OF ORDER:";TAB(20)USINGL6$;T1#
3850 GOSUB3240:CLS:GOTO1540
3860 PRINT@616,"CURRENT SALES   : ";P1;
3870 PRINT@680,"CUMULATIVE SALES: ";P2;
3880 RETURN
4000 GC#=GC#+IQ%*IC:GP#=GP#+IQ%*IP:GR#=GR#+IO%*IC:GI=GI+1:RETURN
4050 TI=GI:TC#=GC#:TP#=GP#:TR#=GR#:RETURN
