* CANCEL.CMD
* M. LYNN
* Verson 1.6
ERASE
IF file = '2'
SET INDEX TO INDBUSNO
ELSE
SET INDEX TO INDPERNO
ENDIF

LOCATE FOR number > 1 .AND. $(date,7,2)= year .AND. .NOT. canceled
IF EOF
@ 10, 5 SAY 'All checks for 19'+year+' have been canceled.'
@ 22, 5 SAY 'PRESS ANY KEY TO CONTINUE'
SET CONSOLE OFF
WAIT
SET CONSOLE ON
SET INDEX TO
RETURN
ELSE
STORE # TO recnum
STORE number TO c:num
SET INTENSITY ON
@ 1,0  SAY 'SYSTEM DATE: '+date()+'     ACCOUNT: '+maccount+'          RECORD #:'
@ 2, 0 SAY 'ACCOUNT NUMBER: '+ac:no
@ 1,65 SAY recnum
SET INTENSITY OFF

@ 4, 0 SAY 'STARTING AT FIRST UNCANCELED CHECK - ENTER CHECK NUMBER OF 0 TO EXIT'
DO WHILE T
@ 6, 0 SAY 'ENTER CANCELLED CHECK NO' GET c:num PICTURE '9999'
READ

	IF c:num = 0
	SET INDEX TO
	RELEASE recnum, c:num, x:can, answer
	RETURN
	ENDIF

STORE STR(c:num,4) TO x:can

FIND &x:can

	IF # = 0
	@ 16, 0 SAY 'Check '+STR(c:num,4)+' cannot be found'
	SET CONSOLE OFF
	WAIT
	SET CONSOLE ON
	@ 16, 0
	ELSE
	STORE # TO recnum
	@ 1,65 SAY recnum
	IF canceled
	@ 15, 0 SAY '*** Check is already canceled ***'
	ENDIF
	@ 10, 0 SAY 'Paid to '+TRIM(to)+' on '+date
	@ 12, 0 SAY 'Amount of check is '+STR(amount,10,2)
	@ 13, 0 SAY 'Is this the one? (Y/N)' 
	SET CONSOLE OFF
	WAIT TO answer
	SET CONSOLE ON
	@ 15, 0
	@ 10, 0
	@ 12, 0
	@ 13, 0

	        IF !(answer) ='Y'
        	REPLACE canceled WITH T
	        ENDIF

	  ENDIF

STORE c:num + 1 to c:num
ENDDO
ENDIF
    IF !(answer) ='Y'
        	REPLACE cance