CLEAR
SET TALK OFF
RESTORE FROM B:CHECKS
***********************************************************
*
* FILE: CHECKS.CMD
*
* MAIN COMMAND FILE FOR CHECKBOOK SYSTEM
*
* DATE: 22-AUG-82

STORE 'V3.5' TO V:CHECKS

*
***********************************************************

USE B:CHECKS INDEX B:CHECKS
SET BELL OFF
SET EJECT OFF

*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

DO WHILE T

SET FORMAT TO SCREEN
ERASE

?
? ' C H E C K B O O K   P R O G R A M   ', V:CHECKS
?
?
? 'SELECT FUNCTION:'
?
? 'N = Enter New Items'
? 'C = Enter Cancellations'
? 'B = Compute Statement Balance'
? 'L = List All Items'
? 'P = Print All Items'
?
? 'R = RETURN TO dBASE II'
?
? 'Select Function:'

WAIT TO A

*----------------------------------------------------------

DO CASE

CASE !(A) = 'N'
	DO B:NEWENTER

CASE !(A) = 'C'
	DO B:CANCEL

CASE !(A) = 'B'
	ERASE
	COUNT FOR CANCEL = ' ' .AND. TYPECODE < 100 TO N:DEP:OUT
	IF N:DEP:OUT <> 0
	  SUM AMOUNT TO A:DEP:OUT FOR CANCEL = ' ' .AND. TYPECODE < 100 
	ELSE
	  STORE 0 TO A:DEP:OUT
	ENDIF
	?
	? STR(N:DEP:OUT,3) + ' Deposits outstanding, total = ' + STR(A:DEP:OUT,10,2)
	COUNT FOR CANCEL = ' ' .AND. TYPECODE >= 100 TO N:CHK:OUT
	IF N:CHK:OUT <> 0
	  SUM AMOUNT TO A:CHK:OUT FOR CANCEL = ' ' .AND. TYPECODE >= 100
	ELSE
	  STORE 0 TO A:CHK:OUT
	ENDIF
	?
	? STR(N:CHK:OUT,3) + ' Checks outstanding, total = ' + STR(A:CHK:OUT,10,2)
	?
	?
	? 'Checkbook balance should be: ' + STR(M:OLDBAL,10,2)
	?
	?
	? 'Statement balance should be : '+ STR((M:OLDBAL + A:CHK:OUT - A:DEP:OUT),10,2)
	WAIT


CASE !(A) = 'R'
	SAVE TO B:CHECKS
	SET TALK ON
	ERASE
	RETURN

* N O T E : RETURN CURRENTLY LEAVES FILES OPEN!!! *******

CASE !(A) = 'L'
	USE B:CHECKS
	ERASE
	?
	? '************************************************************'
	?
	LIST
	?
	? ' Next check number = ' , M:RNUM+1
	?
	? ' BALANCE = ', M:OLDBAL
	?
	? '************************************************************'
	USE B:CHECKS INDEX B:CHECKS
	WAIT

CASE !(A) = 'P'
	USE B:CHECKS
	SET PRINT ON
	?
	? '************************************************************'
	?
	LIST
	?
	? 'Next check number =', M:RNUM+1
	?
	? 'BALANCE =', M:OLDBAL
	?
	? '************************************************************'
	?
	SET PRINT OFF 
	USE B:CHECKS INDEX B:CHECKS

ENDCASE

*----------------------------------------------------------

ENDDO

*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
