1950 IF LEFT$(DA$,4) = "YEAR" THEN AD = HOLD(8,20)
1960 & PRNT,AD,F$
1970 DI = IT(8,19) -AD
1980 X = X -3:Y = 23: GOSUB 1340
1990 AD = 100: REM CUSTOMIZE TO YOUR OWN TASTE
2000 & PRNT,DI,F3$
2020 RETURN
2040 REM **********************
2060 REM
2080 REM SPACE RESERVED FOR A
2100 REM BASIC SCREEN FORMAT-
2120 REM ING ROUTINE IN CASE A
2140 REM "PRINT USING" UTILITY
2160 REM IS NOT AVAILABLE. SEE
2180 REM ARTICLE FOR OTHER RE-
2200 REM QUIRED CHANGES.
2220 REM
2240 REM **********************
2260 REM ----------------------
2280 REM ROUTINE TO INPUT DATA
2300 REM ----------------------
2320 A$ = "":E$ = "":X = 14 +P *7
2340 FOR Y = 3 TO 18: GOSUB 2360: NEXT : GOTO 2900
2360 EX = Y -2:I$ = EX$(EX): GOSUB 3280: GOSUB 3180:CT = 0: IF Y = 19 THEN POP : GOSUB 3300: GOTO 2320
2380 IF EX = 1 THEN I$ = INST$: GOSUB 3180
2400 GOSUB 1340
2420 IF IT(DA,EX) < >0 THEN GOSUB 1340: PRINT CHR$(8)">";: & PRNT,IT(DA,EX),F$: GOTO 2460
2440 PRINT CHR$(8)">"UNDERLINE$
2460 GOSUB 1340
2480 A$ = "":E$ = "":CT = 0: GOSUB 1340
2500 POKE 49168,0: GET A$
2520 IF A$ = "L" OR A$ = "R" OR A$ = CHR$(8) OR A$ = CHR$(21) OR A$ = "Q" THEN POP : GOSUB 3300:IT(DA,17) = 0: FOR I = 1 TO 16:IT(DA,17) = IT(DA,17) +IT(DA,I): NEXT :IT(DA,19) = IT(DA,17) -IT(DA,18):OP = IT(DA,19): GOSUB 1340: PRINT CHR$(8)" ";: RETURN
2540 IF A$ = CHR$(13) AND IT(DA,EX) < >0 GOTO 2820
2560 IF A$ = CHR$(13) THEN E$ = "0": GOTO 2780
2580 IF A$ < > CHR$(8) AND A$ < > CHR$(21) AND A$ < > CHR$(27) AND A$ < >"L" AND A$ < >"R" AND A$ < >"Q" AND A$ < >"." AND (A$ <"0" OR A$ >"9") GOTO 2500
2600 GOTO 2640
2620 POKE 49168,0: GET A$
2640 IF A$ = CHR$(27) THEN GOSUB 3300: GOSUB 1340: PRINT CHR$(8)" ";: & PRNT,IT(DA,EX),F$:Y = Y -1: IF Y <3 THEN Y = 3
2660 IF A$ = CHR$(27) THEN GOTO 2360
2680 IF A$ = CHR$(13) GOTO 2780
2700 IF (A$ <"0" OR A$ >"9") AND A$ < >"." THEN GOTO 2360
2720 IF CT = 0 AND IT(DA,EX) < >0 THEN PRINT " ";: GOSUB 1340
4140 VTAB 8: PRINT "DO YOU WANT:": PRINT : PRINT : PRINT "(1) YEAR-TO-DATE INFORMATION": PRINT : PRINT "(2) A PAST WEEK'S EXPENSES": IF S4% = 1 THEN PRINT : PRINT "(3) THE DATA JUST INPUT"
4160 PRINT : PRINT : PRINT "PRESS ESC TO RETURN TO THE MAIN MENU OR INDICATE YOUR CHOICE BY NUMBER PLEASE: ";: GET ANS$: PRINT ANS$: IF ANS$ = CHR$(27) GOTO 8660
4180 IF ANS$ <"1" OR ANS$ >"3" GOTO 4100
4200 A = VAL(ANS$): PRINT : PRINT : PRINT OMP$: IF A = 3 AND S4% < >1 GOTO 4100
4220 ON A GOTO 4260,4480,4860
4240 REM YEAR-TO-DATE
4260 HOME
4280 IF S4% = 1 AND S1% = 0 THEN PRINT : PRINT "NOTE: THIS WILL DESTROY THE DATA WHICH WAS JUST INPUT BUT NOT SAVED. PRESS ESC TO CONTINUE--ANYTHING ELSE TO RETURN: ";: GET A$: PRINT A$: IF A$ < > CHR$(27) GOTO 4100
4300 DA$ = "YEAR-TO-DATE"
4320 S1% = 0:S2% = 1:S3% = 1:S4% = 0:S5% = 1
4340 INVERSE : PRINT SPC( 10)DA$" TOTALS" SPC( 11): NORMAL
4360 POKE 34,1
4380 GOSUB 6220
4400 TEXT
4420 FOR DA = 1 TO 8: FOR EX = 1 TO 20:IT(DA,EX) = HOLD(DA,EX): NEXT EX,DA
4440 GOTO 4860
4460 REM PAST WEEK'S EXPENSES
4480 HOME
4500 IF S4% = 1 AND S1% = 0 THEN PRINT "NOTE: THIS WILL DESTROY THE DATA WHICH WAS JUST INPUT AND NOT YET SAVED. PRESSESC TO CONTINUE--ANYTHING ELSE TO START OVER. ->";: GET A$: PRINT A$: IF A$ < > CHR$(27) GOTO 4100
4520 S4% = 0:S2% = 1:S3% = 0: HOME
4540 INVERSE :TI$ = " REVIEW A PAST WEEK'S EXPENSES ": PRINT TI$: NORMAL : POKE 34,1
4560 VTAB 8: PRINT "DO YOU WANT A CATALOG (Y/N)?";: GET A$: PRINT A$: IF A$ = "Y" THEN PRINT D$"CATALOG,S"SL",D"DR: PRINT : PRINT : PRINT "PRESS ANY KEY TO CONTINUE->";: GET B$: PRINT B$: GOTO 4600
4580 IF A$ < >"N" GOTO 4560
4600 HOME : VTAB 12: PRINT "PLEASE INPUT THE DATE/NAME OF THE WEEK WHICH YOU WISH TO REVIEW.": GOSUB 7060
4620 HOME : PRINT OMP$
4640 PRINT D$"MON C,I,O"
4660 PRINT D$"OPEN EXPENSES FOR "DA$",L9,S"SL",D"DR
4680 FOR DA = 1 TO 8
4700 FOR EX = 1 TO 19
4720 PRINT D$"READ EXPENSES FOR "DA$",R";(DA -1) *19 +EX
4740 INPUT IT(DA,EX)
4760 NEXT EX,DA
4780 PRINT D$"CLOSE"
4800 PRINT D$"NOMON C,I,O"
4820 TEXT
4840 REM REVIEW DATA SUBROUTINE
4860 GOSUB 3500
4880 P = 0:S = 1
4900 GOSUB 4020: HOME : TEXT :I$ = "REVIEW: <-/->/L/R/C(HANGE/P(RINT/ESC": GOSUB 3180
4920 FOR DA = S TO S +3: GOSUB 1420:P = P +1: NEXT :P = 0
5400 GOSUB 4020: HOME : TEXT :I$ = INST$: GOSUB 3180
5420 DA = 1: FOR P = 0 TO 3: GOSUB 1420:DA = DA +1: NEXT :P = 0:DA = 1
5440 GOSUB 2320
5460 I$ = INST$: GOSUB 3180
5480 FOR PAUSE = 1 TO 1000: NEXT
5500 GOSUB 1420
5520 IF A$ = "L" GOTO 5400
5540 IF A$ = "R" THEN DA = 5: GOSUB 4020: HOME : TEXT :I$ = INST$: GOSUB 3180: FOR P = 0 TO 3: GOSUB 1420:DA = DA +1: NEXT :DA = 5:P = 0: GOTO 5440
5560 IF A$ = "Q" GOTO 5720
5580 IF A$ = CHR$(8) THEN DA = DA -1:P = P -1: IF DA <1 THEN DA = 1:P = 0
5600 IF P <0 THEN GOSUB 4020: HOME : TEXT : FOR P = 0 TO 3: GOSUB 1420:DA = DA +1: NEXT :P = 0:DA = DA -4
5620 IF A$ = CHR$(8) GOTO 5440
5640 DA = DA +1:P = P +1
5660 IF DA = 8 GOTO 5720
5680 IF P >3 THEN GOSUB 4020: HOME : TEXT :DA = DA -3: FOR P = 0 TO 3: GOSUB 1420:DA = DA +1: NEXT :DA = DA -1:P = 3: GOTO 5440
5700 GOTO 5440
5720 I$ = OMP$: FLASH : GOSUB 3200: NORMAL : FOR EX = 1 TO 19:IT(8,EX) = 0: FOR DA = 1 TO 7:IT(8,EX) = IT(8,EX) +IT(DA,EX): NEXT DA,EX
5740 DA = 5: FOR P = 0 TO 3: GOSUB 1420:DA = DA +1: NEXT
5760 POKE -16368,0:I$ = "SELECT: 1-DEL RPT 2-SAVE 3-CONT 4-MENU:": GOSUB 3180: GET A$: IF A$ <"1" OR A$ >"4" GOTO 5760
5780 POKE 2039, ASC(A$) +128
5800 X = VAL(A$)
5820 ON X GOTO 5920,5860,5400,8660
5840 REM SAVE RPT/UPDATE Y-T-D
5860 IF S4% = 1 AND S1% = 0 THEN S2% = 0:S5% = 0: POKE 34,23: HOME : PRINT : TEXT : GOTO 6160
5880 HOME :S5% = 0: GOTO 6460
5900 REM CLEAR & ERASE
5920 HOME
5940 IF S4% = 1 THEN PRINT "DATA JUST INPUT HAS BEEN CLEARED.": CLEAR :S% = 1: VTAB 10: PRINT "PRESS ANY KEY TO CONTINUE: ";: GET A$: PRINT A$: GOTO 11020
5960 PRINT "THIS FUNCTION WILL COMPLETELY DELETE THE REPORT FILE TITLED:": PRINT : PRINT "EXPENSES FOR "DA$
5980 PRINT : PRINT "AND UPDATE THE YEAR TO DATE TOTALS TO REFLECT IT'S REMOVAL. IF YOU ARE SURE YOU WISH TO CONTINUE PRESS ESC. ANY OTHER KEY WILL RETURN YOU TO THE CHANGE MODE. ->";: GET A$: PRINT A$
6000 IF A$ < > CHR$(27) GOTO 5380
6020 PRINT D$"MON C,I,O"
6040 PRINT D$"DELETE EXPENSES FOR "DA$",S"SL",D"DR
6060 S5% = 1: GOSUB 6620
6080 GOTO 8660
6100 REM --------------------
6120 REM UPDATE TOTALS FILE
6140 REM --------------------
6160 HOME : INVERSE : PRINT "GETTING YEAR-TO-DATE TOTALS FILE": NORMAL
6180 PRINT : GOTO 6220
6200 HOME : INVERSE : PRINT "ONE MOMENT PLEASE": NORMAL
7400 GET A$: IF A$ > CHR$(47) AND A$ < CHR$(58) THEN YR$ = YR$ +A$: PRINT A$;: GOTO 7400
7420 IF A$ = CHR$(13) GOTO 7460
7440 GOTO 7380
7460 IF LEN(YR$) = 2 OR LEN(YR$) = 4 GOTO 7500
7480 GOTO 7380
7500 IF LEN(YR$) = 2 THEN YR$ = "19" +YR$
7520 A$ = " ": PRINT A$;:DA$ = MO$ +DY$ +YR$
7540 GOSUB 1340: CALL -868: PRINT DA$" <- IS THIS DATE OK (Y/N)?";: GET A$: IF A$ = CHR$(13) THEN A$ = "Y"
7560 PRINT A$: IF A$ = "N" GOTO 7140
7580 IF A$ < >"Y" GOTO 7540
7600 S3% = 1
7620 RETURN
7640 REM ---------------------
7660 REM SEND TO DISK
7680 REM ---------------------
7700 HOME
7720 PRINT D$"MON C,I,O"
7740 D$ = CHR$(4): PRINT D$;"OPEN EXPENSES FOR ";DA$;",L9,S"SL",D"DR
7760 PRINT D$;"DELETE EXPENSES FOR "DA$",S"SL",D"DR
7780 PRINT D$;"OPEN EXPENSES FOR ";DA$;",L9,S"SL",D"DR
7800 FOR H = 1 TO 8
7820 FOR I = 1 TO 19
7840 PRINT D$;"WRITE EXPENSES FOR ";DA$;",R";(H -1) *19 +I
7860 PRINT ( INT(IT(H,I) *100 +0.001))/100
7880 NEXT I,H
7900 PRINT D$;"CLOSE EXPENSES FOR ";DA$
7920 PRINT D$"NOMON C,I,O"
7940 S1% = 1
7960 IF S5% = 1 THEN RETURN
7980 GOTO 8660
8000 REM --------------------
8020 REM CHANGE FILE NAME
8040 REM --------------------
8060 HOME :HOLD$ = DA$:S2% = 1: INVERSE :TI$ = "CHANGE DATE/NAME OF AN EXISTING REPORT": PRINT TI$: NORMAL : VTAB 4: PRINT "OPTIONS:": PRINT : PRINT
8080 PRINT " 1) CATALOG DRIVE "DR: PRINT : PRINT " 2) ENTER PRESENT DATE/NAME OF THE REPORT TO BE CHANGED": PRINT : PRINT : PRINT "PRESS ESC TO RETURN TO THE MAIN MENU OR ENTER YOUR CHOICE BY NUMBER PLEASE: ";: GET A$: PRINT A$
8100 IF A$ = CHR$(27) GOTO 8660
8120 IF A$ = "1" THEN HOME : PRINT D$"CATALOG, S"SL",D"DR: PRINT "PRESS ANY KEY TO CONTINUE:";: GET B$: PRINT B$
8140 IF A$ < >"2" GOTO 8060
8160 HOME : INVERSE : PRINT TI$: NORMAL : PRINT : PRINT : PRINT "PLEASE ENTER THE CURRENT DATE/NAME OF THE REPORT WHICH YOU WISH TO CHANGE."
9820 B$ = STR$( INT((A +.005) *100)): IF LEN(B$) >2 THEN A$ = LEFT$(B$, LEN(B$) -2) +"." + RIGHT$(B$,2): RETURN
9840 IF LEN(B$) = 2 THEN A$ = "." +B$: RETURN
9860 A$ = ".0" +B$: RETURN
9880 REM --------------------
9900 REM ONERR PRINT OUT AND
9920 REM ERR HANDLING ROUTINE
9940 REM --------------------
9960 X = PEEK(222): REM GET ERROR CODE
9980 REM ** APPLESOFT ERRORS **
10000 IF X = 0 THEN PRINT "NEXT WITHOUT FOR";
10020 IF X = 16 THEN PRINT "SYNTAX";
10040 IF X = 22 THEN PRINT "RETURN WITHOUT GOSUB";
10060 IF X = 42 THEN PRINT "OUT OF DAT<CTRL-A>A";
10080 IF X = 53 THEN PRINT "ILLEGAL QUANTITY";
10100 IF X = 69 THEN PRINT "OVERFLOW";
10120 IF X = 77 THEN PRINT "OUT OF MEMORY";
10140 IF X = 90 THEN PRINT "UNDEFINED STATEMENT";
10160 IF X = 107 THEN PRINT "BAD SUBSCRIPT";
10180 IF X = 120 THEN PRINT "REDIMENSIONED ARRAY";
10200 IF X = 133 THEN PRINT "DIVISION BY ZERO";
10220 IF X = 163 THEN PRINT "TYPE MISMATCH";
10240 IF X = 176 THEN PRINT "STRING TOO LONG";
10260 IF X = 191 THEN PRINT "FORMULA TOO COMPLEX";
10280 IF X = 224 THEN PRINT "UNDEFINED FUNCTION";
10300 IF X = 254 THEN PRINT "BAD RESPONSE TO INPUT STATEMENT";
10320 IF X = 255 THEN PRINT "CTRL C INTERRUPT";
10340 REM ****DOS MESSAGES***
10360 IF X = 1 THEN PRINT "LANGUAGE NOT AVAILABLE";
10380 IF X = 2 OR X = 3 THEN PRINT "RANGE ERROR";
10400 IF X = 4 THEN PRINT "WRITE PROTECTED";
10420 IF X = 5 GOTO 10820
10440 IF X = 6 AND ERR$ = "ON" THEN ERR$ = "OFF": GOTO 10820
10460 IF X = 6 GOTO 10720
10480 IF X = 7 THEN PRINT "VOL. MISMATCH";
10500 IF X = 8 THEN PRINT "I/0 ERROR";
10520 IF X = 9 THEN PRINT "DISK FULL";
10540 IF X = 10 THEN PRINT "FILE LOCKED";
10560 IF X = 11 THEN PRINT "SYNTAX";
10580 IF X = 12 THEN PRINT "NO BUFFERS AVAILABLE";
10600 IF X = 13 THEN PRINT "FILE TYPE MISMATCH";
10620 IF X = 14 THEN PRINT "PROGRAM TOO LARGE";
10640 IF X = 15 THEN PRINT "NOT DIRECT COMMAND";
10660 PRINT " ERROR IN LINE # ";( PEEK(218) +( PEEK(219) *256))
10680 END
10700 REM CREATE NEW HEADER
10720 HOME : PRINT "THERE IS NO PREVIOUSLY ESTABLISHED EXPENSE HEADER FILE ON THIS DISK.": PRINT : PRINT "DO YOU WISH TO INITILIZE A HEADER ON THIS DISK FOR A NEW EXPENSE PERIOD? (Y OR N): ";: GET A$: PRINT A$
10740 IF A$ = "N" GOTO 8660
10760 IF A$ < >"Y" GOTO 10720
10780 GOTO 6460
10800 REM HANDLE REQUEST FOR BOGUS FILE
10820 TEXT : PRINT : HOME
10840 PRINT D$"OPEN EXPENSES FOR "DA$",L9,S"SL",D"DR
10860 PRINT D$"DELETE EXPENSES FOR "DA$",S"SL",D"DR
10880 PRINT : PRINT "THE DATE ";DA$;" IS NOT CURRENTLY": PRINT "IN MEMORY AS A DATE BEGINNING AN ESTAB- LISHED EXPENSE PERIOD.": PRINT : PRINT "PRESS ANY KEY TO CONTINUE: ": GET A$: PRINT A$