home *** CD-ROM | disk | FTP | other *** search
/ Software Du Jour / SoftwareDuJour.iso / BUSINESS / DBASE / DB3.ARC / CHECKSTU.PRG < prev    next >
Encoding:
Text File  |  1984-10-25  |  3.9 KB  |  133 lines

  1.      *************** Checkstu COMMAND FILE *****************
  2. *áPrint≤áou⌠áchecδ numbers¼áamounts¼áanΣ balance≤áfroφáthσ Checkfil when
  3. * SALARIES and BILLS are paid.  When more than one bill is paid by a
  4. * single check, the program totals all the bills against that check if they
  5. * are entered in consecutive order (which they are in the two command files).
  6. * Records are marked for deletion, but can be reviewed and retrieved.
  7. *****************************************************************************
  8. *
  9. CLEAR
  10. @ 3,25 SAY '*** DO NOT INTERRUPT ***'
  11. @ 4,25 SAY ' JUST GETTING ORGANIZED'
  12. *
  13. * A single check number may cover several bills, so these commands summarize
  14. * the payments by check number.  Any deleted entries in the Checkfil are
  15. * also eliminated when the TOTAL is done.
  16. SELECT 6
  17. TOTAL ON Check_Nmbr TO Scratch FOR .NOT. DELETED()
  18. COUNT FOR .NOT. DELETED() TO Entries
  19. *
  20. * We open the Scratch file in a second work area so that we can update the
  21. * Balance field from the Checkfil, which is open in the first work area.
  22. * For each entry in the Checkfil, the UPDATE command replaces the Balance
  23. * in the Scratch file with the Balance from the Checkfil.  When there are
  24. * several entries in the Scratch file for a given check number, this is 
  25. * done several times.  We could have written a loop to skip repeated entries,
  26. * but this way is faster and just as accurate.
  27. SELECT 9
  28. USE Scratch 
  29. UPDATE ON Check_Nmbr FROM Checkfil REPLACE Balance WITH F->Balance
  30. COUNT FOR .NOT. DELETED() TO Checks
  31. *
  32. STORE 0 TO Spacer, LineCnt
  33. *
  34. * If there were several entries for a single check number, print them
  35. IF Entries > Checks
  36.    SELECT 6
  37.    GO TOP
  38.    CLEAR
  39.    @ 4,0 SAY ' '
  40.    * Print the column headings for the output
  41.    SET PRINT ON
  42.    ? '                  THESE INDIVIDUAL BILLS WERE PAID:'
  43.    ?
  44.    ? '          Date     Check Name                   Amount  Bill';
  45.         +'    Job Number'
  46.    ?
  47.    * Now print all the checks that were written
  48.    DO WHILE .NOT. EOF()
  49.       IF .NOT. DELETED()
  50.          ?? '         ',Check_Date, Check_Nmbr + ' ' + Name, Amount,;
  51.                      Bill_Nmbr,Client+'-'+STR(Job_Nmbr,4)
  52.          ?
  53.          LineCnt = LineCnt + 1
  54.          Spacer = Spacer + 1
  55. è      ENDIF
  56.       *
  57.       IF LineCnt >= 50
  58.          ? CHR(12)
  59.          STORE 0 TO LineCnt, Spacer
  60.          ? '          Date   Check  Name                    Amount  Bill  ';
  61.                     +'  Job Number'
  62.       ENDIF
  63.       *
  64.       IF Spacer = 10
  65.          ?
  66.          Spacer = 0
  67.       ENDIF
  68.       *
  69.       SKIP
  70.    ENDDO
  71.    SELECT 9
  72. ENDIF
  73. Spacer = 0
  74. LineCnt = LineCnt + 3
  75. IF LineCnt > 44
  76.    ? CHR(12)
  77.    LineCnt = 0
  78. ENDIF
  79. *
  80. * Now print all the individual checks that are to be written
  81. Doing = 'Y'
  82. DO WHILE UPPER(Doing)='Y'
  83.    SELECT 9
  84.    GO TOP
  85.    CLEAR
  86.    SET PRINT ON
  87.    ? '                MAKE THE FOLLOWING ENTRIES IN THE CHECK BOOK:'
  88.    ?
  89.    ? '          Date     Check Name                   Amount   Balance'
  90.    ?
  91.    LineCnt = LineCnt + 3
  92.    DO WHILE .NOT. EOF()
  93.       IF .NOT. DELETED()
  94.          ?? '         ', Check_Date, Check_Nmbr + ' ' + Name,;
  95.                                                      Amount, Balance
  96.          ?
  97.          LineCnt = LineCnt + 1
  98.          Spacer = Spacer + 1
  99.       ENDIF
  100.       *
  101.       IF LineCnt >= 50
  102.          SET CONSOLE OFF
  103.          ? CHR(12)
  104.          SET CONSOLE ON
  105.          STORE 0 TO LineCnt, Spacer
  106.          ? '          Date     Check Name                   Amount   Balance'
  107.          ?
  108. è      ENDIF
  109.       *
  110.       IF Spacer = 10
  111.          ?
  112.          Spacer = 0
  113.       ENDIF
  114.       *
  115.       SKIP
  116.    ENDDO
  117.    ?
  118.    ?
  119.    ?
  120.    SET PRINT OFF
  121.    WAIT 'Do you want to print it again (Y or N)?' TO Doing
  122. ENDDO
  123. *
  124. SET PRINT ON
  125. ? CHR(12)
  126. SET PRINT OFF
  127. *        
  128. USE
  129. ERASE Scratch.dbf
  130. *
  131. SELECT 6
  132. DELETE All
  133. *
  134. RETURN
  135.