NOTE - THIS IS THE ACCOUNT PAYING COMMAND FILE
*
*
*  - explanatory text               
? 'THIS PROGRAM USES THE PRINTER. IF YOUR PRINTER IS NOT READY IT'
? ' MAY HANG UP AT THIS POINT. 5 LINES FURTHER DOWN IN THIS FILE'
? ' YOU WILL FIND A SECTION OF CODE TO SET UP AN ANADEX PRINTER FOR'
? ' PRINTING CHECKS. USE YOUR TEXT EDITOR TO MODIFY THIS FOR YOUR'
? ' PRINTER. '   
*  - turn off printing commands to screen
SET TALK OFF
*  - send results of @ statements to printer
SET FORMAT TO PRINT
*  - echo output to printer
SET PRINT ON
*  - turn off console
SET CONSOLE OFF
*  - go to top of page on printer
EJECT
*  - this is the ANADEX 9500 text
* SET FORM LENGTH TO 22 LINES ON ANADEX 9500
* ESC 4 022
*  - create ASCII string of esc4022
? CHR(27)+CHR(52)+CHR(48)+CHR(50)+CHR(50)
*  - turn off echo
SET PRINT OFF
*  - echo output to console
SET CONSOLE ON
*  - set loop variable true
STORE T TO STAY
*  - request current date
ACCEPT "Enter Today's Date  (YYMMDD)" TO TODAY
*  - ask for beginning check number for this run
INPUT  'Enter Beginning Check No.     ' TO NNO
*  - ask for disk drive with database files
ACCEPT 'Enter Data Disk Drive         ' TO DRV
*  - set system default to database disk drive
SET DEFAULT TO &DRV
USE CHECKS
*  - select primary database file
SELE SECO         
USE ACCNTS
*  - set up program loom
DO WHILE STAY
  *  - select seconary file ACCNTS
  SELECT SECONDARY
?   
?   
  *  - list data from ACCNTS
  LIST PNAME,S.AMT,DDATE
?   
?
?
? '       ENTER OPTION YOU WANT'
? '           -1  - EXIT'
? '            0  - WRITE CHECK TO ACCOUNT NOT IN DATABASE'
? '            N  - NUMBER OF ACCOUNT TO WRITE CHECK FOR'
  *  - ask for account number to print check for
  INPUT 'Which Account' TO ACCNT
  *  - check to see if exit
  IF ACCNT<0
     *   -  set loop variable false to exit program
     STORE F TO STAY
     LOOP
  ENDIF
  *  - check to see if writing check not in ACCNTS
  IF ACCNT=0
     *  - request data for check
     ACCEPT 'Enter Payee  ' TO NAME
     INPUT  'Enter Amount ' TO MAMT
  ELSE
     *  - locate account number in ACCNTS file
     GOTO ACCNT
     *  - store payee name to variable NAME
     STORE PNAME TO NAME
     *  - is check hasn't been canceled
     IF .NOT.VARIABLE
        *  - check to get amount still owed
        STORE S.AMT TO MAMT
        IF TODAY>=LDATE
           STORE S.AMT+LAMT TO MAMT
        ENDIF
     ELSE
        *  - user option on amount to pay this time
        INPUT 'Enter Amount To Pay ' TO MAMT
     ENDIF
     IF PERIOD>0
        IF (VAL($(DDATE,3,2))+PERIOD)>12
           STORE VAL(DDATE)+((88+PERIOD)*100) TO NDATE
        ELSE
           STORE VAL(DDATE)+100*PERIOD TO NDATE
        ENDIF
        REPLACE DDATE WITH STR(NDATE,6)
     ENDIF
  ENDIF
  *  - store variables to be printed on check
  STORE STR(NNO,4) TO XNO
  STORE STR(MAMT,10,2) TO XAMT
  *  - show user on screen proposed check values
  DISP OFF 'Check #',XNO,' Pay ',XAMT,' To ',NAME
  *  - ask if you want to print this check
  ? 'OK? (Y/N)'
  WAIT TO X
  *  - see if check is to be written
  IF X=$('Yy',1,1).OR.X=$('Yy',2,1)
     *   - select primary file
     SELE PRIMARY
     APPEND BLANK
     *   - put check data into primary file
     REPLACE TO WITH NAME,NO WITH NNO,AMT WITH MAMT,CAN WITH F
     REPLACE DATE WITH TODAY,MEMO WITH TYPE
     STORE NNO+1 TO NNO
* NOW PRINT CHECK ON PRINTER
@ 3,67 SAY 'Check No.'
@ 3,77 SAY XNO
@ 5,67 SAY 'Date:'
@ 5,73 SAY $(TODAY,3,2)+'/'+$(TODAY,5,2)+'/'+$(TODAY,1,2)
@ 10,1 SAY 'Pay to the'
@ 11,1 SAY 'Order of'
@ 11,12 SAY NAME
@ 11,68 SAY MAMT USING '$$,$$$,$$$.99'
@ 17,12 SAY INT(MAMT) USING '$$,$$$,$$$'
@ 17,23 SAY 'D O L L A R S   and  '
@ 17,44 SAY (MAMT-INT(MAMT))*100 USING '99'
@ 17,47 SAY 'C E N T S'
@ 20,12 SAY 'Type: '
@ 20,18 SAY TYPE
@ 20,41 SAY '----------------------------------------'
EJECT
ENDIF
ENDDO
RETURN
