10 DEFINT A-Z
15 DEF FNCENTER$(A$)=STRING$(26-LEN(A$)/2-.5," ")+A$
20 DEF FNLCNTR$(A$)=STRING$(40-LEN(A$)/2-.5," ")+A$
25 DEF FNVERTAB$(A)=STRING$(A!,LF$)
30 DEF FNPRTAT$(X,Y)=CHR$(&H1B)+"="+CHR$(Y+32)+CHR$(X+32)
35 DEF FNMONTH$(X$)=MID$("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",(VAL(X$)-1)*3+1,3)
40 COMMON ANS1$(),ANS2$(),ACNTCODE$(),ACNTLBL$(),ACNTBUDG!(),NUMRECS,DATE$,NUMACCTS
45 COMMON CLS$,DARK$,ESC$,BRITE$,STRSCR$,ENDSCR$
50 COMMON MVLEFT$,MVRITE$,MVDOWN$,MVUP$,CR$,LF$
55 COMMON TF$,DELEND$,DELINE$,DELCHA$,MOVSCR$
60 COMMON MOVCUR$,BELL$
1000 OPEN "R",1,"B:RECLENTH.DAT",2
1010 FIELD 1,2 AS A$
1020 LSET A$=MKI$(NUMRECS)
1030 PUT#1,VAL(DATE$)
1040 CLOSE
1250 US$=" ####   \\  #####  \\  \                  \ \              \####.## ###.## \\"
1260 PRINT CLS$
1270 PRINT:PRINT:PRINT FNCENTER$("S E A R C H   R E C O R D S")
1280 PRINT:PRINT:PRINT "  "FNCENTER$(STRSCR$+"Search Records Selection"+ENDSCR$)
1290 DATA "Date for search (mm/dd)  :00/00:"
1300 DATA "Account code for search  :  :"
1310 DATA "Check number for search  :<C 9C 8C 8C 8C:"
1320 DATA "Payee name for search    :                     :"
1330 DATA "Amount value for search  :;C 9C 9C 9C . :C 9C:"
1340 DATA "Item description for search :                :"
1350 RESTORE
1360 FOR X=1 TO 6
1370 READ PROMPT$(X)
1380 PLIN(X)=X+7
1390 PRINT FNPRTAT$(0,PLIN(X)) PROMPT$(X)
1400 NEXT X
1410 X=1
1420 PRINT FNPRTAT$(0,15)"Enter month and date for search.  A zero in either"
1430 PRINT "causes a search for all months and/or dates."
1440 PCOL=0:GOSUB 2090
1450 DT$=ANS$
1460 X=2
1470 PRINT FNPRTAT$(0,16) DELINE$ MVUP$ DELINE$;
1480 PRINT "Enter account code for search.  A blank code causes"
1490 PRINT "all accounts to be searched."
1500 PCOL=0:GOSUB 2090
1510 CD$=ANS$
1520 X=3
1530 PRINT FNPRTAT$(0,16) DELINE$ MVUP$ DELINE$;
1540 PRINT "Enter check number for search.  A number of zero"
1550 PRINT "causes all checks to be searched."
1560 PCOL=0:GOSUB 2090
1570 CK$=ANS$
1580 X=4
1590 PRINT FNPRTAT$(0,16) DELINE$ MVUP$ DELINE$;
1600 PRINT "Enter name of payee for search.  Leave this field"
1610 PRINT "blank to search for all payees."
1620 PCOL=0:GOSUB 2090
1630 PE$=ANS$
1640 X=5
1650 PRINT FNPRTAT$(0,16) DELINE$ MVUP$ DELINE$;
1660 PRINT "Enter a value other than zero to search for a"
1670 PRINT "specific amount."
1680 PCOL=0:GOSUB 2090
1690 AM$=ANS$
1700 X=6
1710 PRINT FNPRTAT$(0,16) DELINE$ MVUP$ DELINE$;
1720 PRINT "Enter name of item for search.  A blank item field"
1730 PRINT "will cause all items to be searched."
1740 PCOL=0:GOSUB 2090
1750 IT$=ANS$
1760 PRINT FNPRTAT$(0,16) DELINE$ MVUP$ DELINE$;
1770 PRINT "Send output to printer?  ";
1780 GOSUB 2040:PRINT
1790 IF YES$="Y" THEN P=-1 ELSE P=0
1800 IF VAL(DT$)=0 THEN 1930
1810 OPEN "R",1,"B:RECLENTH.DAT",2
1820 FIELD 1, 2 AS A$
1830 GET#1, VAL(DT$)
1840 RCS=CVI(A$)
1850 CLOSE
1860 IF RCS=0 THEN PRINT "No records for month: "DT$:GOTO 1880
1870 GOSUB 2420
1880 PRINT
1890 PRINT "Would you like to search some more?  ";
1900 GOSUB 2040
1910 IF YES$="Y" THEN 1260
1912 PRINT CLS$;FNPRTAT$(0,12)FNCENTER$("RETURNING TO MAIN MENU");
1914 PRINT FNPRTAT$(53,0);
1920 CHAIN "A:BUDG.BAS", 1600
1930 FOR X=1 TO VAL(DATE$)
1940 OPEN "R",1,"B:RECLENTH.DAT",2
1950 FIELD 1, 2 AS A$
1960 GET#1, X
1970 RCS=CVI(A$)
1980 CLOSE
1990 IF RCS=0 THEN PRINT "No records for month: "DT$:GOTO 2020
2000 DT$=STR$(X)+RIGHT$(DT$,3)
2010 GOSUB 2420
2020 NEXT X
2030 GOTO 1880
2040 YES$=INPUT$(1):YES$=CHR$(ASC(YES$)AND &HDF)
2060 IF YES$="Y" OR YES$="N" THEN PRINT YES$;:RETURN
2070 PRINT BELL$;
2080 GOTO 2040
2090 GOSUB 7000:PROMPT$=PROMPT$(X)
2110 PLIN=PLIN(X):PCOL=0
2120 PRINT FNPRTAT$(PCOL,PLIN)PROMPT$;
2130 PCOL=INSTR(PROMPT$,":"):CRS=INSTR(PCOL+1,PROMPT$,":")-PCOL+1
2140 FOR XYZ=1 TO CRS
2150 ANS2$(XYZ)=MID$(PROMPT$,XYZ+PCOL-1,1)
2160 IF XYZ<>1 THEN ANS1$(XYZ-1)=ANS2$(XYZ)
2170 NEXT XYZ:IF ANS1$(1)=CHR$(160) THEN 10000
2180 LTH=CRS-2
2190 PRINT FNPRTAT$(PCOL,PLIN);:CRS=2
2200 ANS$=INPUT$(1)
2210 IF ANS$=CR$ THEN 2300
2220 IF ANS$=MVRITE$ AND CRS<LTH+2 THEN CRS=CRS+1:PRINT ANS$;:IF ANS2$(CRS)=":" THEN 2280 ELSE IF INSTR("# 0123456789",ANS2$(CRS)) THEN 2200 ELSE 2220
2230 IF ANS$=MVLEFT$ AND CRS>1 THEN CRS=CRS-1:PRINT ANS$;:IF ANS2$(CRS)=":" THEN 2280 ELSE IF INSTR("# 0123456789",ANS2$(CRS)) THEN 2200 ELSE 2230
2240 IF ASC(ANS$)<32 THEN 2280
2250 IF ANS2$(CRS)=" " THEN 2290
2260 IF 0<>INSTR("0123456789",ANS2$(CRS)) AND 0<>INSTR("0123456789",ANS$) THEN 2290
2270 IF ANS2$(CRS)="#" AND INSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ANS$) THEN 2290
2280 PRINT BELL$;:GOTO 2200
2290 ANS1$(CRS-1)=ANS$:PRINT ANS$;MVLEFT$;:ANS$=MVRITE$:GOTO 2220
2300 IF LTH=0 THEN ANS$="" :RETURN
2310 IF INSTR("# ",ANS1$(LTH)) THEN LTH=LTH-1:GOTO 2300
2320 LAST$=ANS$
2330 ANS$=""
2340 FOR XYZ=1 TO LTH
2350 ANS$=ANS$+ANS1$(XYZ)
2360 NEXT XYZ
2370 RETURN
2420 OPEN "R",1,"B:"+FNMONTH$(DT$)+".DAT",49
2430 FIELD 1, 2 AS ACNTCODE$, 2 AS CHK$, 2 AS DAY$, 20 AS PAYEE$, 16 AS ITEM$, 4 AS AMNT$, 2 AS TAX$, 1 AS DFLAG$
2440 PRINT:PRINT "Month of search: "FNMONTH$(DT$)
2450 PRINT
2460 PRINT "RECORD CODE CHECK DATE PAYEE                ITEM             AMOUNT  TAXES"
2470 PRINT "------ ---- ----- ---- -------------------- ---------------- ------  -----"
2471 IF NOT P THEN 2480
2472 LPRINT:LPRINT "Month of search: "FNMONTH$(DT$)
2473 LPRINT
2474 LPRINT "RECORD CODE CHECK DATE PAYEE                ITEM             AMOUNT  TAXES"CR$;
2475 LPRINT "______ ____ _____ ____ ____________________ ________________ ______  _____
2480 FOR R=1 TO RCS:GET #1,R
2490 IF CD$<>"" AND CD$<>ACNTCODE$ THEN 2590
2500 IF VAL(CK$)<>0 AND VAL(CK$)<>CVI(CHK$) THEN 2590
2510 IF VAL(RIGHT$(DT$,2))<>0 AND VAL(RIGHT$(DT$,2))<>VAL(DAY$) THEN 2590
2520 IF PE$<>"" AND 0=INSTR(PAYEE$,PE$) THEN 2590
2530 IF IT$<>"" AND 0=INSTR(ITEM$,IT$) THEN 2590
2540 IF VAL(AM$)<>0 AND CSNG(VAL(AM$))<>CVS(AMNT$) THEN 2590
2550 IF DFLAG$="T" THEN D$="D" ELSE D$=" "
2560 PRINT USING US$;R;ACNTCODE$;CVI(CHK$);DAY$;PAYEE$;ITEM$;CVS(AMNT$);CVI(TAX$)/100;D$
2570 IF NOT P THEN 2590
2580 LPRINT USING US$;R;ACNTCODE$;CVI(CHK$);DAY$;PAYEE$;ITEM$;CVS(AMNT$);CVI(TAX$)/100;D$
2590 NEXT R
2595 CLOSE
2600 RETURN
7000 IF FRE(0)>500 THEN RETURN
7010 FOR BL=1 TO 7:PRINT BELL$;:POKE &HEF6B,3
7020 PRINT FNPRTAT$(0,PLIN) DELEND$ FNCENTER$("=======> GARBAGE COLLECTION IN PROGRESS <=======");
7030 FOR BLL=1 TO 20:NEXT BLL, BL:BL=FRE(A$)
7040 PRINT CR$ DELEND$;:RETURN
10000 PCOL=INSTR(PCOL+1,PROMPT$,"."):IF PCOL=0 THEN PCOL=LEN(PROMPT$) ELSE CRS=CRS-(LEN(PROMPT$)-PCOL)
10010 PCOL=PCOL+A-1:ANS2$=""
10020 PRINT FNPRTAT$(PCOL,PLIN);
10030 ANS$=INPUT$(1)
10040 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10050 IF ANS$=ESC$ THEN 10300
10060 IF INSTR(".0123456789",ANS$)=0 THEN 10400
10070 IF ANS$="." THEN IF ANS2$(CRS)="." THEN CRS=CRS+1:PRINT"."; ELSE 10400
10080 ANS2$=RIGHT$(ANS2$+ANS$,CRS-2)
10090 PRINT STRING$(LEN(ANS2$),8) ANS2$;
10100 IF ANS$<>"." THEN 10030
10110 ANS$=INPUT$(1)
10120 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10130 IF ANS$=ESC$ THEN 10300
10140 IF INSTR("0123456789",ANS$)=0 THEN 10500
10150 ANS2$=ANS2$+ANS$:PRINT STRING$(LEN(ANS2$)-1,8) ANS2$;
10160 CRS=CRS+1:IF ANS2$(CRS)=":" THEN PRINT BELL$;:GOTO 10600
10170 GOTO 10110
10200 LAST$=ANS$:ANS$=ANS2$:RETURN
10300 PCOL=A:GOTO 2120
10400 PRINT BELL$;:GOTO 10030
10500 PRINT BELL$;:GOTO 10110
10600 ANS$=INPUT$(1)
10610 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10620 IF ANS$=ESC$ THEN 10300
10630 PRINT BELL$;:GOTO 10600
30000 SAVE"SEARCH.BAS"
10 IF ANS$=CR$ OR ANS$=MVUP$ THEN 10200
10620 IF ANS$=ESC$ THEN 10300
10630 PRINT BELL$;:GOTO 