      ************  CHECKSTUB COMMAND FILE  ***************
* Prints out check numbers, amounts, and balances from the CheckFile when
* SALARIES and BILLS are paid.  When more than one bill is paid by a
* single check, the program totals all the bills against that check if they
* are entered in consecutive order (which they are, in the two command files).
* Records are marked for deletion, but can be reviewed and retreived.
**************************************************************************

ERASE
@ 5,10 SAY '*** DO NOT INTERRUPT ***'
@ 6,10 SAY ' JUST GETTING ORGANIZED'

USE B:CheckFil
TOTAL ON Check:Nmbr TO Scratch FOR .NOT. *
COUNT FOR .NOT. * TO Entries

USE Scratch
UPDATE FROM B:CheckFil ON Check:Nmbr REPLACE Balance
COUNT FOR .NOT. * TO Checks

IF Entries > Checks
   USE B:CheckFil
   ERASE
   @ 4,0 SAY ' '
   SET PRINT ON 
   ? '                  THESE INDIVIDUAL BILLS WERE PAID:'
   ?
   ? '          Date   Check  Name                    Amount  #'
   ?
   LIST '          '+Check:Date, Check:Nmbr, Name, Amount, Bill:Nmbr OFF;
        FOR .NOT. *
   ?
   ?
   ?
ENDIF

USE Scratch
STORE 'Y' TO Doing
DO WHILE !(Doing) = 'Y'
   ERASE
   SET PRINT ON
   ? '                MAKE THE FOLLOWING ENTRIES IN THE CHECK BOOK:'
   ?
   ? '          Date   Check  Name                    Amount    Balance'
   ?
   LIST '          '+Check:Date, Check:nmbr, Name, Amount, Balance OFF
   ?
   ?
   ?
   SET PRINT OFF
   ? 'Do you want to print it again (Y or N)?'
   WAIT TO Doing
ENDDO

SET PRINT ON
? CHR(12)
SET PRINT OFF

USE B:CheckFil
DELETE All

DELETE FILE Scratch
RELEASE Doing, Checks, Entries
RETURN
