home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dbbooks.zip / BOOKS.DOC < prev    next >
Text File  |  1987-02-14  |  20KB  |  760 lines

  1.                 Bookkeeping System Command Files
  2.  
  3.      Here are the command files for the bookkeeping system.   The 
  4. first is BINSTALL, which allows you to set up the initial general 
  5. information and Chart of Accounts. 
  6. 
  7.  
  8. ******************************* BINSTALL.CMD
  9. **************** Start the Chart of Accounts.
  10. SET TALK OFF
  11. SET DEFA TO B
  12.  
  13. ********************** Get General Information.
  14. ERASE
  15. USE GENINFO
  16. DELE ALL
  17. PACK
  18. APPEND BLANK
  19. ?
  20. ? "         Start the Bookkeeping System"
  21. ? "This program allows you to set up general"
  22. ? "information and a Chart of Accounts for the"
  23. ? "bookkeeping system.  You need to use this"
  24. ? "program only once.  The edit option under the"
  25. ? "BOOKS main menu allows you to make changes."
  26. @ 9,0 SAY "Enter the name of the Company or User"
  27. @ 9,40 GET COMPANY
  28. READ
  29.  
  30. ****************** Next, set up chart of accounts.
  31. ERASE
  32. ? "Next, you need to set up the Chart of Accounts"
  33. ? "Account numbers use the format XXX.XX (e.g. 100.00)"
  34. ? "Account numbers in the range of 100.00 to 299.99"
  35. ? "Are for INCOME only.  Account numbers in the range"
  36. ? "300.00 to 999.99 are for EXPENSES only."
  37. ?
  38. ? "Press any key to continue..."
  39. WAIT
  40. ERASE
  41. ? "Accounts that have a non-zero decimal portion"
  42. ? "are sub-accounts, and are not included in totals."
  43. ? "Hence, you may want to break transactions that "
  44. ? "involve a single check into sub-accounts.  For "
  45. ? "example, you only write one check for utilities."
  46. ? "You may, however, wish to record the amount of"
  47. ? "this single check that went toward Gas, and the"
  48. ? "amount that went toward Electricity.  To do so,"
  49. ? "Set up three accounts as follows:"
  50. ?
  51. ? "     Account"
  52. ? "      Number       Title"
  53. ?
  54. ? "      400.00     Utilities"
  55. ? "      400.10     Gas"
  56. ? "      400.20     Electricity"
  57. ?
  58. ? "In this example, only one check will be written,"
  59. ? "for account 400.  Accounts 400.10 and 400.20 will"
  60. ? "be recorded, but checks will not be written."
  61. ?
  62. ? "Press RETURN to continue, ESC to QUIT...."
  63. WAIT   
  64.  
  65. ERASE
  66. USE COA INDEX COA
  67. DELE ALL
  68. PACK
  69.  
  70. STORE T TO ADDING
  71. DO WHILE ADDING
  72.    APPEND BLANK
  73.    ERASE
  74.    @  1, 0 SAY "Type in Account Number, Title, and Current Balance"
  75.    @  1,50 SAY "."
  76.    @  2, 0 SAY "Enter Ctrl-W to Quit"
  77.    @  4, 0 SAY "Account Number"
  78.    @  4,16 GET ACCT
  79.    @  5, 0 SAY "Title"
  80.    @  5,16 GET TITLE
  81.    @  6, 0 SAY "Month-to-Date"
  82.    @  6,16 GET AMOUNT
  83.    @  7, 0 SAY "Quarter-to-Date"
  84.    @  7,16 GET QTD
  85.    @  8, 0 SAY "Year-to-Date"
  86.    @  8,16 GET YTD
  87.    READ
  88.    ************* Check for 0 as acct.
  89.    IF ACCT = 0
  90.       STORE F TO ADDING
  91.    ENDIF
  92. ENDDO (while adding)
  93.  
  94. ************** Done adding.
  95. ERASE
  96. ? "Returning to dot prompt.  To use the bookkeeping"
  97. ? "System, type DO BOOKS when dot appears."
  98. ?
  99. ?
  100. DELE ALL FOR ACCT = 0
  101. PACK
  102. USE
  103. 
  104.  
  105.  
  106.  
  107.  
  108.      BOOKS is the main menu program for the bookkeeping system...
  109.  
  110.  
  111. 
  112. *********************************** BOOKS.CMD
  113. *************** Bookkeeping System Main Menu.
  114. SET TALK OFF
  115. SET DEFA TO B
  116. SET BELL OFF
  117. STORE 0 TO CHOICE
  118.  
  119. *************** First, get today's date.
  120. ERAS
  121. STORE DATE() TO T:DATE
  122. @ 5,1 SAY "Enter today's date";
  123.   GET T:DATE PICT "99/99/99"
  124. READ
  125. ***************** Display Main Menu.
  126. DO WHILE CHOICE <> 5
  127.    ERASE
  128.    @  2,10 SAY "Bookkeeping System Main Menu"
  129.    @  4,11 SAY "1. Add New Transactions"
  130.    @  5,11 SAY "2. Update Chart of Accounts"
  131.    @  6,11 SAY "3. Print Reports"
  132.    @  7,11 SAY "4. Edit Data"
  133.    @  8,11 SAY "5. Exit"
  134.    @ 10,10 SAY "Enter your choice (1-4) from above"
  135.    @ 10,45 GET CHOICE PICT "9"
  136.    READ
  137.  
  138.    ************** Branch Accordingly.
  139.    DO CASE
  140.  
  141.       CASE CHOICE = 1 
  142.          DO ADDTRANS
  143.  
  144.       CASE CHOICE = 2
  145.          DO UPDATER
  146.  
  147.       CASE CHOICE = 3
  148.          DO BREPORTS
  149.  
  150.       CASE CHOICE = 4
  151.          DO BEDIT
  152.  
  153.    ENDCASE
  154.  
  155. ENDDO (while choice <> 4)
  156. 
  157.  
  158.      The  ADDTRANS file allows you to enter individual income and 
  159. expense transactions.  It rejects transactions that do not have a 
  160. valid account number.
  161. 
  162. *********************************** ADDTRANS.CMD
  163. ************************** Add new transactions.
  164. ************************** Set up data files.
  165.  
  166. ************* First, get last check number
  167. USE GENINFO
  168. STORE LAST:CHECK TO CNO
  169.  
  170. SET BELL OFF
  171. SELE PRIM
  172. USE TRANS INDEX ACCT,DATES
  173. SELE SECO
  174. USE COA INDEX COA
  175.  
  176. SELE PRIM
  177.  
  178. ******************* Get data for transactions.
  179. STORE T TO ADDING
  180. DO WHILE ADDING
  181.    APPEND BLANK
  182.    REPLACE DATE WITH T:DATE
  183.  
  184.    ERASE
  185.    @  1, 0 SAY "--- Enter new transactions (0 when done) --"
  186.  
  187.    ************** Accept only valid account numbers.
  188.    STORE N TO OK
  189.    DO WHILE .NOT. OK
  190.       @  3, 0 SAY "Account Number"
  191.       @  3,15 GET ACCT
  192.       READ
  193.  
  194.       IF ACCT > 0
  195.          STORE STR(ACCT,6,2) TO LOOKUP
  196.          SELE SECO
  197.          ************** Make sure account exists on COA. 
  198.          FIND &LOOKUP
  199.          IF # > 0
  200.             STORE T TO OK
  201.             @ 3,26 SAY TITLE
  202.             STORE TITLE TO MTITLE
  203.          ELSE
  204.             @ 3,26 SAY "No such account!"
  205.             ? CHR(7)
  206.          ENDIF (account number exists)
  207.       ELSE
  208.          STORE F TO ADDING
  209.          STORE T TO OK
  210.          LOOP
  211.       ENDIF (acct > 0)
  212.       SELE PRIM
  213.    ENDDO (while .NOT. ok)
  214.  
  215.    *********** Get rest of info if user not exiting.   
  216.    IF ADDING
  217.       ************** Get reason
  218.       @  5, 0 SAY "Description"
  219.       @  5,12 GET REASON
  220.       READ
  221.       
  222.       *************** If no reason type in, use account title.
  223.       IF REASON = " "
  224.          REPLACE REASON WITH TITLE
  225.          @ 5,12 SAY REASON
  226.       ENDIF
  227.       
  228.       @  7, 0 SAY "Amount"
  229.       @  7, 7 GET AMOUNT
  230.       @  9, 0 SAY "Date"
  231.       @  9, 5 GET DATE
  232.       READ
  233.       
  234.       *********** Ask about type if expense account
  235.       *********** and not a sub-account.
  236.       IF ACCT > 299.99 .AND. INT(ACCT)=ACCT
  237.          @ 11, 0 SAY "Type (1=Check, 2=Other)"
  238.          @ 11,24 GET TYPE
  239.          READ
  240.          ************ If check, ask about check info.
  241.          IF TYPE = 1
  242.             REPL CHECK:NO WITH CNO
  243.             @ 13, 0 SAY "Check Number"
  244.             @ 13,13 GET CHECK:NO
  245.             @ 15, 0 SAY "To Whom Paid"
  246.             @ 15,13 GET TO:WHOM
  247.             READ
  248.             ********* Incerement check number. 
  249.             STORE CHECK:NO TO CNO
  250.             STORE CNO +1 TO CNO        
  251.          ENDIF (type = 1
  252.       ENDIF (acct > 299.99)
  253.       
  254.    ENDIF(if adding)
  255.    
  256. ENDDO (while adding)
  257.  
  258. ************** Done adding. Close files and update 
  259. ************** General information file.
  260. SELE PRIM
  261. DELE ALL FOR ACCT=0
  262. USE
  263. SELE SECO
  264. USE
  265. USE GENINFO
  266. REPLACE LAST:CHECK WITH CNO
  267. USE
  268. RETURN
  269.  
  270. 
  271.  
  272.  
  273.      The UPDATER command file updates Month-to-date,  Quarter-to-
  274. Date,  and  Year-to-Date  balances on the Chart of Accounts  file 
  275. (COA) from the transaction (TRANS) file.
  276. 
  277.  
  278. *********************************** UPDATER.CMD
  279. ************** Monthly update program for
  280. ************** Updating Chart of Accounts Balances.
  281. ERAS
  282. ? "This program should be performed once a month"
  283. ? "to bring the Chart of Accounts totals up-to-date"
  284. ?
  285. STORE " " TO YN
  286. @ 5,2 SAY "Is this the program you want? " GET YN
  287. READ
  288.  
  289. IF !(YN) <> "Y"
  290.    RETURN
  291. ENDIF (yn <> y)
  292.  
  293. ******************** Ask about start of new quarter.
  294. ERASE
  295. STORE " " TO QTR
  296. @ 10,2 SAY "Is this the start of a new quarter? "
  297. @ 10,38 GET QTR
  298. READ
  299.  
  300. ************* Perform the update.
  301. ERASE
  302. ? "Performing the update...."
  303. USE TRANS INDEX ACCT
  304. COPY TO TEMP FOR .NOT. POSTED
  305. REPL ALL POSTED WITH T
  306. USE COA INDEX COA
  307. ************** Set Month-to-Date field (AMOUNT) to zero.
  308. REPLACE ALL AMOUNT WITH 0
  309.  
  310. ************** If start of new quarter, replace all
  311. ************** Quarterly balances with zeroes too.
  312. IF !(QTR)="Y"
  313.    REPLACE ALL QTD WITH 0
  314. ENDIF (qtr=y)
  315.  
  316. ************** Update from TEMO file, then
  317. ************** increment QTD and YTD.
  318. UPDATE ON ACCT FROM TEMP ADD AMOUNT
  319. REPL ALL QTD WITH QTD+AMOUNT
  320. REPL ALL YTD WITH YTD+AMOUNT
  321.  
  322. ************** Now, set POSTED flag in TRANS to T.
  323. USE TRANS
  324. REPLACE ALL POSTED WITH T
  325.  
  326. ************** Update Geninfo File
  327. USE GENINFO
  328. REPLACE LAST:UPDAT WITH T:DATE
  329. USE
  330. RETURN
  331. 
  332.      BREPORTS asks the user which report they want,  and branches 
  333. to the appropriate command file...
  334. 
  335.  
  336. ********************************* BREPORTS.CMD
  337. ********************** Ask user which report
  338. ********************** to use, and branch accordingly.
  339. STORE 0 TO REPCHOICE
  340. DO WHILE REPCHOICE <> 5
  341.    ERASE
  342.    TEXT
  343.                  Bookkeeping Report Options
  344.  
  345.                    1. Current Transactions
  346.                    2. Chart of Accounts
  347.                    3. Write checks
  348.                    4. Check Register
  349.  
  350.                    5. Return to Main Menu
  351.  
  352.    ENDTEXT
  353.    @ 12,10 SAY "Enter choice (1-5) from above ";
  354.      GET REPCHOICE PICTURE "9"
  355.    READ
  356.  
  357.    DO CASE
  358.       CASE REPCHOICE=1
  359.          DO CURREPT
  360.  
  361.       CASE REPCHOICE=2
  362.          DO COAREPT
  363.  
  364.       CASE REPCHOICE=3
  365.          DO CHECKS
  366.  
  367.       CASE REPCHOICE=4
  368.          DO REGISTER
  369.  
  370.    ENDCASE
  371. ENDDO (while repchoice <> 5)
  372. RETURN
  373. 
  374.  
  375.     The  CURREPT  command file prints data from the  TRANS  file, 
  376. either for the current month, or a range of dates (e.g. 01/01/84-
  377. 03/31/84).   It uses pre-defined reports (ACCT.FRM or  DATES.FRM) 
  378. to print the basic reports.  However, these report formats do NOT 
  379. contain  page  headings or totals.   The program itself  provides 
  380. page headings and totals, and uses the REPORT FORM command in the 
  381. PLAIN mode.
  382. 
  383.  
  384.  
  385.  
  386. ********************************** CURREPT.CMD
  387. ********** Print report of Current Transactions.
  388.  
  389. ********** First get company name from geninfo file
  390. USE GENINFO
  391. STORE COMPANY TO COMPANY
  392.  
  393. ********** First, get info on dates, and store
  394. ********** to first search macro (COND1) 
  395. ERASE
  396. STORE " " TO YN
  397. @ 5,2 SAY "Transactions for this month only? ";
  398.   GET YN
  399.   READ
  400.  
  401. ************* Set up condition according to user's request.
  402. IF !(YN)="Y"
  403.    STORE "DATE = '"+$(T:DATE,1,2)+"'" TO COND1
  404.    STORE F TO RANGE
  405. ELSE
  406.    STORE "        " TO START,FINISH
  407.    @ 7,2 SAY "Enter starting date " GET START PICT "99/99/99"
  408.    @ 9,2 SAY "Enter ending date " GET FINISH PICT "99/99/99"
  409.    READ
  410.    STORE "DATE >=START .AND. DATE <=FINISH" TO COND1
  411.    STORE T TO RANGE
  412. ENDIF (yn=y)
  413.  
  414. ********************** Next, get sort order.
  415. ERAS
  416. STORE 0 TO RCHOICE
  417. @ 3,10 SAY "Sort Orders"
  418. @ 5,8 SAY "1. By Account Number"
  419. @ 6,8 SAY "2. By Date"
  420. @ 8,8 SAY "Enter choice (1-2) " GET RCHOICE PICT "9"
  421. READ
  422.  
  423. ********************** Set up sort order and report type.
  424. IF RCHOICE = 2
  425.    USE TRANS INDEX DATES
  426.    STORE "DATES" TO ROPTION
  427. ELSE
  428.    USE TRANS INDEX ACCT
  429.    STORE "ACCTS" TO ROPTION
  430. ENDIF
  431.  
  432. ********************** Ask about printer....
  433. ERAS
  434. STORE " " TO YN
  435. @ 5,2 SAY "Send Report to printer? " GET YN
  436. READ
  437.  
  438. ********************** and set up second macro
  439. ********************** accordingly (COND2).
  440.  
  441. IF !(YN)="Y"
  442.    STORE "TO PRINT" TO COND2
  443. ELSE
  444.    STORE " " TO COND2
  445. ENDIF (yn=y)
  446.  
  447. ********************** Mark sub-accounts for report.
  448. REPL ALL MARKER WITH "*" FOR ACCT <> INT(ACCT)
  449.  
  450. ********************** Print the report using
  451. ********************** pre-defined report formats.
  452. SET EJECT OFF
  453. ERASE
  454. ? "              Current Transactions for &COMPANY"
  455. ?
  456. ********************* Print appropriate sub-heading.
  457. IF RANGE
  458.    ? "For transactions from &START to &FINISH"
  459. ELSE
  460.    ? "For &T:DATE"
  461. ENDIF (range)
  462.  
  463. *********** Caculate totals, leaving out sub-accounts.
  464. SUM AMOUNT FOR ACCT<300 .AND. &COND1 .AND. INT(ACCT)=ACCT TO INCOME
  465. SUM AMOUNT FOR ACCT>=300 .AND. &COND1 .AND. INT(ACCT)=ACCT TO EXPENSE
  466.  
  467. ******************** Print income transactions.
  468. ?
  469. ? "INCOME:"
  470. REPO FORM &ROPTION FOR ACCT<300 .AND. &COND1 &COND2 PLAIN
  471. ? "Total Income                     ",INCOME
  472. ?
  473. ******************** Print expense transactions.
  474. ? "EXPENSES:"
  475. REPO FORM &ROPTION FOR ACCT>=300 .AND. &COND1 &COND2 PLAIN
  476. ? "Total Expenses                   ",EXPENSE
  477. ******************** Display balance at bottom of sheet.
  478. ?
  479. ? "Total Income                     ",INCOME
  480. ? "Total Expenses                   ",EXPENSE
  481. ? "                                    ---------"
  482. ? "Balance                         ",INCOME-EXPENSE
  483. ?
  484. ? " NOTE: Sub accounts (with decimal numbers above 0) "
  485. ? " are not included in totals."
  486. EJECT
  487.  
  488. *************** If report not going to printer,
  489. *************** pause on screen. 
  490. IF COND2 = " "
  491.    ?
  492.    ? "Press any key to continue"
  493.    WAIT
  494. ENDIF (cond2=" ")
  495. RETURN
  496. 
  497.      The  COAREPT program prints the Chart of Accounts  with  MTD 
  498. AMOUNT),  QTD,  and  YTD  balances,  using COA.FRM as the  REPORT 
  499. FORMat. 
  500. 
  501.  
  502. **************************** COAREPT.CMD
  503. ************ Print Chart of Accounts and Balances.
  504. ************ Get date of last update.
  505. USE GENINFO
  506. STORE LAST:UPDAT TO LAST:DATE
  507.  
  508. USE COA INDEX COA
  509.  
  510. ************ Ask about hardcopy.
  511. ERAS
  512. STORE " " TO YN
  513. @ 5,2 SAY "Send report to printer? " GET YN
  514. READ
  515.  
  516. IF !(YN)="Y"
  517.    STORE "TO PRINT" TO COND
  518. ELSE
  519.    STORE " " TO COND
  520. ENDIF (yn=y)
  521.  
  522.  
  523. *********** Calculate totals, leaving out sub-accounts.
  524. ERASE
  525. ? "Calculating totals...."
  526.  
  527. SUM AMOUNT FOR ACCT<300 .AND. INT(ACCT)=ACCT TO TOT:MTD1
  528. SUM AMOUNT FOR ACCT>=300 .AND. INT(ACCT)=ACCT TO TOT:MTD2
  529. SUM QTD FOR ACCT<300 .AND. INT(ACCT)=ACCT TO TOT:QTD1
  530. SUM QTD FOR ACCT>=300 .AND. INT(ACCT)=ACCT TO TOT:QTD2
  531. SUM YTD FOR ACCT<300 .AND. INT(ACCT)=ACCT TO TOT:YTD1
  532. SUM YTD FOR ACCT>=300 .AND. INT(ACCT)=ACCT TO TOT:YTD2
  533.  
  534. ********************** Print the report using
  535. ********************** pre-defined report formats.
  536. SET EJECT OFF
  537. ERASE
  538. ? "              Chart of Accounts for &COMPANY"
  539. ?
  540. ********************* Print appropriate sub-heading.
  541. ? "Last Update: &LAST:DATE"
  542.  
  543. ******************** Print income accounts.
  544. ?
  545. ? "INCOME:"
  546. REPO FORM COA FOR ACCT<300 &COND PLAIN
  547. ? "Total Income            ",TOT:MTD1," ",TOT:QTD1," ",TOT:YTD1
  548. ?
  549.  
  550.  
  551. ******************** Print expense transactions.
  552. ? "EXPENSES:"
  553. REPO FORM COA FOR ACCT>=300 &COND PLAIN
  554. ? "Total Expenses          ",TOT:MTD2," ",TOT:QTD2," ",TOT:YTD2
  555. ******************** Display balance at bottom of sheet.
  556. ?
  557. ? "Total Income            ",TOT:MTD1," ",TOT:QTD1," ",TOT:YTD1
  558. ? "Total Expenses          ",TOT:MTD2," ",TOT:QTD2," ",TOT:YTD2
  559. ?
  560. ? "Balance                  ",;
  561.    TOT:MTD1-TOT:MTD2," ",TOT:QTD1-TOT:QTD2," ",;
  562.    TOT:YTD1-TOT:YTD2
  563. EJECT
  564.  
  565. *************** If report not going to printer,
  566. *************** pause on screen. 
  567. IF COND = " "
  568.    ?
  569.    ?
  570.    ? "Press any key to continue"
  571.    WAIT
  572. ENDIF (cond=" ")
  573.  
  574. RETURN
  575. 
  576.  
  577.  
  578.      The  CHECKS  command file prints checks.   It uses a  memory 
  579. file  called ENGLISH.MEM to help transalate numbers  to  English.  
  580. The  ENGLISH.MEM command file is created by the MAKEMEMS  command 
  581. file presented after CHECKS.   However,  MAKEMEMS must be created 
  582. and run before CHECKS.CMD will work.
  583.  
  584. 
  585. ************************************ CHECKS.CMD
  586. ************************************ Write checks.
  587. ERASE
  588. SET TALK OFF
  589. ? "Preparing checks file"
  590. ?
  591. ? "Load checks into printer"
  592.  
  593. ***************** Save existing memory variables to THOUGHT,
  594. ***************** and bring in English-equivalent variables.
  595. SAVE TO THOUGHT
  596. RESTORE FROM ENGLISH
  597.  
  598. *************** Create little file of checks to be written.
  599. USE TRANS INDEX ACCT
  600. COPY TO TEMP FOR CHECK:NO>0 .AND. .NOT. WRITTEN
  601. USE TEMP
  602. INDEX ON CHECK:NO TO CHECKNOS
  603. GO TOP
  604. ? "First check to be printed will be ",CHECK:NO 
  605. ?
  606. ? "Press any key to begin writing checks"
  607. WAIT
  608.  
  609. ERASE
  610. SET PRINT ON
  611.  
  612. DO WHILE .NOT. EOF
  613.  
  614.  
  615.    ************ Translate AMOUNT to English.
  616.    STORE 1 TO COUNTER,START
  617.    STORE STR(AMOUNT,9,2) TO STRING
  618.  
  619.    ****************************** Loop through thousands and hundreds. 
  620.    DO WHILE COUNTER < 3
  621.  
  622.       ************************** Split out hundreds, tens, and ones.
  623.       STORE $(STRING,START,3) TO CHUNK
  624.       STORE $(CHUNK,1,1) TO HUN
  625.       STORE $(CHUNK,2,2) TO TEN
  626.       STORE $(CHUNK,3,1) TO ONE
  627.  
  628.       ********************* Handle hundreds.
  629.       IF VAL(CHUNK) > 99
  630.          STORE ENGLISH + U&HUN + ' HUNDRED ' TO ENGLISH
  631.       ENDIF (chunk > 99)
  632.  
  633.       ********************* Handle second 2 digits.
  634.       STORE VAL(TEN) TO T
  635.       IF T > 0
  636.  
  637.         DO CASE
  638.  
  639.          ********** Case 1: Handle teens or even tens.
  640.          CASE (INT(T/10.0)=T/10.0) .OR. (T>9 .AND. T<20)
  641.               STORE ENGLISH + U&TEN TO ENGLISH
  642.  
  643.          ********** Case 2: Handle greater than 10 but not evenly divisible.
  644.          CASE T > 9 .AND. (INT(T/10.0)#T/10.0)
  645.               STORE $(TEN,1,1) +'0' TO TEN
  646.               STORE ENGLISH + U&TEN+' '+U&ONE TO ENGLISH
  647.  
  648.          ********** Case 3: Handle less than 10.
  649.          CASE T < 10
  650.               STORE ENGLISH + U&ONE TO ENGLISH
  651.       ENDCASE
  652.  
  653.      ENDIF (T > 0)
  654.  
  655.      **************** Add "Thousand" if necessary.
  656.      IF AMOUNT > 999.99 .AND. COUNTER = 1
  657.         STORE ENGLISH+' THOUSAND ' TO ENGLISH
  658.      ENDIF (need to add "thousand")
  659.      **************** Prepare for pass through hundreds.
  660.      STORE 4 TO START
  661.      STORE COUNTER+1 TO COUNTER
  662.  
  663.    ENDDO (while counter < 3.) 
  664.  
  665.    ***************** Tack on cents.
  666.    IF INT(AMOUNT) > 0    
  667.       STORE ENGLISH + " AND " TO ENGLISH
  668.    ENDIF
  669.  
  670.    STORE ENGLISH + $(STRING,8,2)+"/100" TO ENGLISH
  671.  
  672.    ***************** Print a check.
  673.    ? "                          ",DATE
  674.    ?
  675.    ? "   ",TO:WHOM,"     ",AMOUNT
  676.    ?
  677.    ? "  ",ENGLISH
  678.    ?
  679.    ?
  680.    ?
  681.    ?
  682.    ?
  683.    SKIP
  684.    STORE " " TO ENGLISH
  685. ENDDO   
  686. SET PRINT OFF
  687. ************************ Flag checks as written in TRANS
  688. USE TRANS
  689. REPLACE ALL WRITTEN WITH Y FOR CHECK:NO>0
  690. USE
  691.  
  692. ***************** Get rid of "English" memory
  693. ***************** variables, and bring back originals.
  694. RELEASE ALL
  695. RESTORE FROM THOUGHT
  696. USE
  697. RETURN
  698. 
  699.  
  700.      The  MAKEMEMS  command file creates the  ENGLISH.MEM  memory 
  701. file that CHECKS.CMD depends on to translate numbers to English. 
  702. 
  703.  
  704. *************** MAKEMEMS.CMD
  705. *************** Sets up memory file for
  706. *************** storing English equivalents.
  707. SET DEFA TO B 
  708. SET TALK OFF
  709. RELE ALL
  710.  
  711. STORE ' ' TO U,ENGLISH
  712. STORE 'ONE' TO U1
  713. STORE 'TWO' TO U2
  714. STORE 'THREE' TO U3
  715. STORE 'FOUR' TO U4
  716. STORE 'FIVE' TO U5
  717. STORE 'SIX' TO U6
  718. STORE 'SEVEN' TO U7
  719. STORE 'EIGHT' TO U8
  720. STORE 'NINE' TO U9
  721. STORE 'TEN' TO U10
  722. STORE 'ELEVEN' TO U11
  723. STORE 'TWELVE' TO U12
  724. STORE 'THIRTEEN' TO U13
  725. STORE 'FOURTEEN' TO U14
  726. STORE 'FIFTEEN' TO U15
  727. STORE 'SIXTEEN' TO U16
  728. STORE 'SEVENTEEN' TO U17
  729. STORE 'EIGHTEEN' TO U18
  730. STORE 'NINETEEN' TO U19
  731. STORE 'TWENTY' TO U20
  732. STORE 'THIRTY' TO U30
  733. STORE 'FORTY' TO U40
  734. STORE 'FIFTY' TO U50
  735. STORE 'SIXTY' TO U60
  736. STORE 'SEVENTY' TO U70
  737. STORE 'EIGHTY' TO U80
  738. STORE 'NINETY' TO U90
  739.  
  740. SAVE TO ENGLISH
  741. DISP MEMO
  742. RETURN
  743. 
  744.   
  745.      I  did not include the code for handling the check  register 
  746. here, because I'm hoping to discuss this in class.  It presents a 
  747. few  design  problems;  such  as how to handle  deposits  to  the 
  748. checking acount, how to handle multiple accounts, and others.  In 
  749. this  class,  I'm more concerned about design considerations than 
  750. tricky  programming techniques.   In DBMS  programming,  you  can 
  751. always  "borrow"  a  routine (such as the  check-writing  routine 
  752. above)  to solve a particular problem.   Setting up the  database 
  753. (which includes all data and index files), requires a more subtle 
  754. design skill.  
  755.  
  756.  
  757.  
  758.