home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / manage1.zip / JOURN.PRG < prev    next >
Text File  |  1986-05-27  |  11KB  |  388 lines

  1. **    Last revision: April 6, 1986 at 15:54
  2. * journal entry screen
  3. SET INTENSITY ON
  4. CLOS INDEX
  5. STOR 0.00 TO debit
  6. STOR 0.00 TO credit
  7. IF (EOF() .OR. BOF())
  8.  STOR 'J001' TO entry
  9.  STOR .t. TO firstup
  10. ELSE
  11.  GO BOTTOM
  12.  STOR .f. TO firstup
  13.  DO WHIL .NOT. firstup
  14.   IF SUBSTR(data,1,1) = 'J'
  15.    STOR VAL(SUBSTR(data,2,3)) TO entryno
  16.    STOR entryno + 1001 TO entryno
  17.    STOR STR(entryno,4) to entry
  18.    STOR 'J' + SUBSTR(entry,2,3) TO entry
  19.    STOR .t. TO firstup
  20.   ELSE
  21.    STOR RECNO() TO rec_no
  22.    SKIP -1
  23.    IF RECNO() = rec_no
  24.     STOR 'J001' TO entry
  25.     RELE rec_no
  26.     STOR .t. TO firstup
  27.    ENDI # = rec:no
  28.   ENDI
  29.  ENDD WHILE .NOT. firstup
  30. ENDI # =0
  31. CLEA
  32. SET DELIMITER OFF
  33. STOR '                    ' TO blnks
  34. STOR SUBSTR(blnks,1,2) TO mprop
  35. STOR .t. TO more
  36. STOR .t. TO first
  37. STOR "When done, leave first amount blank and enter Control 'Q' or 'W'" TO prompt
  38. DO WHIL more
  39.  STOR SUBSTR(blnks,1,4) TO mbank1
  40.  STOR SUBSTR(blnks,1,4) TO mbank2
  41.  STOR SUBSTR(blnks,1,4) TO mbank3
  42.  STOR SUBSTR(blnks,1,4) TO mbank4
  43.  STOR SUBSTR(blnks,1,8) TO mdate1
  44.  STOR SUBSTR(blnks,1,8) TO mdate2
  45.  STOR SUBSTR(blnks,1,8) TO mdate3
  46.  STOR SUBSTR(blnks,1,8) TO mdate4
  47.  IF firstup
  48.   STOR entry TO mchk1
  49.   STOR .f. TO firstup
  50.   RELE entry, entryno
  51.  ELSE
  52.   STOR SUBSTR(blnks,1,4) TO mchk1
  53.  ENDI firstup
  54.  STOR SUBSTR(blnks,1,20) TO mpay1
  55.  STOR SUBSTR(blnks,1,4) TO macc1
  56.  STOR 0.00 TO mamt1
  57.  STOR SUBSTR(blnks,1,4) TO mchk2
  58.  STOR SUBSTR(blnks,1,20) TO mpay2
  59.  STOR SUBSTR(blnks,1,4) TO macc2
  60.  STOR 0.00 TO mamt2
  61.  STOR SUBSTR(blnks,1,4) TO mchk3
  62.  STOR SUBSTR(blnks,1,20) TO mpay3
  63.  STOR SUBSTR(blnks,1,4) TO macc3
  64.  STOR 0.00 TO mamt3
  65.  STOR SUBSTR(blnks,1,4) TO mchk4
  66.  STOR SUBSTR(blnks,1,20) TO mpay4
  67.  STOR SUBSTR(blnks,1,4) TO macc4
  68.  STOR 0.00 TO mamt4
  69.  STOR 'N' TO verify
  70.  IF first
  71.   @ 1,15 SAY "Journal Entry Screen  - Posted"
  72.   @ 1,48 SAY DTOC(date())
  73.   @ 3, 8 SAY "Use positive or negative numbers to indicate Debits and Credits"
  74.   @ 4,19 SAY "DEBITS AND CREDITS MUST BALANCE TO EXIT"
  75.   @ 6, 4 SAY "Property:"
  76.   @ 8, 1 SAY "Journal #:"
  77.   @ 8,37 SAY "Item:"
  78.   @ 9, 6 SAY "Date:"
  79.   @ 9,31 SAY "Account No:"
  80.   @ 9,50 SAY "Amount:"
  81.   @ 11, 1 SAY "Journal #:"
  82.   @ 11,37 SAY "Item:"
  83.   @ 12, 6 SAY "Date:"
  84.   @ 12,31 SAY "Account No:"
  85.   @ 12,50 SAY "Amount:"
  86.   @ 14, 1 SAY "Journal #:"
  87.   @ 14,37 SAY "Item:"
  88.   @ 15, 6 SAY "Date:"
  89.   @ 15,31 SAY "Account No:"
  90.   @ 15,50 SAY "Amount:"
  91.   @ 17, 1 SAY "Journal #:"
  92.   @ 17,37 SAY "Item:"
  93.   @ 18, 6 SAY "Date:"
  94.   @ 18,31 SAY "Account No:"
  95.   @ 18,50 SAY "Amount:"
  96.   @ 20, 3 SAY "DEBITS:"
  97.   @ 20,14 SAY debit
  98.   @ 20,34 SAY "CREDITS:"
  99.   @ 20,43 SAY credit
  100.   @ 22,05 SAY prompt
  101.  ENDI first
  102.  STOR .f. TO first
  103.  @ 6,14 GET mprop PICTURE '99'
  104.  @ 8,14 GET mchk1 PICTURE 'J999'
  105.  @ 8,43 GET mpay1
  106.  @ 9,14 GET mdate1 PICTURE '99/99/99'
  107.  @ 9,43 GET macc1 PICTURE '9999'
  108.  @ 9,60 GET mamt1
  109.  @ 11,14 GET mchk2 PICTURE 'J999'
  110.  @ 11,43 GET mpay2
  111.  @ 12,14 GET mdate2 PICTURE '99/99/99'
  112.  @ 12,43 GET macc2 PICTURE '9999'
  113.  @ 12,60 GET mamt2
  114.  @ 14,14 GET mchk3 PICTURE 'J999'
  115.  @ 14,43 GET mpay3
  116.  @ 15,14 GET mdate3 PICTURE '99/99/99'
  117.  @ 15,43 GET macc3 PICTURE '9999'
  118.  @ 15,60 GET mamt3
  119.  @ 17,14 GET mchk4 PICTURE 'J999'
  120.  @ 17,43 GET mpay4
  121.  @ 18,14 GET mdate4 PICTURE '99/99/99'
  122.  @ 18,43 GET macc4 PICTURE '9999'
  123.  @ 18,60 GET mamt4
  124.  READ
  125.  IF mamt1 > 0
  126.   STOR debit + mamt1 TO debit
  127.  ELSE
  128.   STOR credit + mamt1 TO credit
  129.  ENDI
  130.  IF mamt2 > 0
  131.   STOR debit + mamt2 TO debit
  132.  ELSE
  133.   STOR credit + mamt2 TO credit
  134.  ENDI
  135.  IF mamt3 > 0
  136.   STOR debit + mamt3 TO debit
  137.  ELSE
  138.   STOR credit + mamt3 TO credit
  139.  ENDI
  140.  IF mamt4 > 0
  141.   STOR debit + mamt4 TO debit
  142.  ELSE
  143.   STOR credit + mamt4 TO credit
  144.  ENDI
  145.  CLEA GETS
  146.  @ 20,14 SAY debit
  147.  @ 20,43 SAY credit
  148.  @ 22,00
  149.  @ 22,20 SAY "DO YOU WANT TO MAKE ANY CHANGES ? [ ]"
  150.  @ 22,55 GET verify PICTURE '!'
  151.  READ
  152.  CLEA GETS
  153.  IF verify = 'Y'
  154.   @ 6,14 GET mprop PICTURE '99'
  155.   @ 8,14 GET mchk1 PICTURE 'J999'
  156.   @ 8,43 GET mpay1
  157.   @ 9,14 GET mdate1 PICTURE '99/99/99'
  158.   @ 9,43 GET macc1 PICTURE '9999'
  159.   @ 9,60 GET mamt1
  160.   @ 11,14 GET mchk2 PICTURE 'J999'
  161.   @ 11,43 GET mpay2
  162.   @ 12,14 GET mdate2 PICTURE '99/99/99'
  163.   @ 12,43 GET macc2 PICTURE '9999'
  164.   @ 12,60 GET mamt2
  165.   @ 14,14 GET mchk3 PICTURE 'J999'
  166.   @ 14,43 GET mpay3
  167.   @ 15,14 GET mdate3 PICTURE '99/99/99'
  168.   @ 15,43 GET macc3 PICTURE '9999'
  169.   @ 15,60 GET mamt3
  170.   @ 17,14 GET mchk4 PICTURE 'J999'
  171.   @ 17,43 GET mpay4
  172.   @ 18,14 GET mdate4 PICTURE '99/99/99'
  173.   @ 18,43 GET macc4 PICTURE '9999'
  174.   @ 18,60 GET mamt4
  175.   @ 20,14 SAY debit
  176.   @ 20,43 SAY credit
  177.   READ
  178.   IF mamt1 > 0
  179.    STOR debit + mamt1 TO debit
  180.   ELSE
  181.    STOR credit + mamt1 TO credit
  182.   ENDI
  183.   IF mamt2 > 0
  184.    STOR debit + mamt2 TO debit
  185.   ELSE
  186.    STOR credit + mamt2 TO credit
  187.   ENDI
  188.   IF mamt3 > 0
  189.    STOR debit + mamt3 TO debit
  190.   ELSE
  191.    STOR credit + mamt3 TO credit
  192.   ENDI
  193.   IF mamt4 > 0
  194.    STOR debit + mamt4 TO debit
  195.   ELSE
  196.    STOR credit + mamt4 TO credit
  197.   ENDI
  198.   CLEA GETS
  199.   @ 21,00
  200.   @ 22,00
  201.   READ
  202.   CLEA GETS
  203.  ENDI verify
  204. * error checking routine
  205. * put in all of the other routines you may require
  206.  STOR .t. TO validate
  207.  DO WHIL VALIDATE
  208.   DO CASE
  209.   CASE mamt1 <> 0 .AND.(SUBSTR(mprop,2) = ' ')
  210.    STOR .t. TO error
  211.   CASE mamt1 <> 0 .AND.(SUBSTR(mchk1,2) = ' ')
  212.    STOR .t. TO error
  213.   CASE mamt2 <> 0 .AND.(SUBSTR(mchk2,2) = ' ')
  214.    STOR .t. TO error
  215.   CASE mamt3 <> 0 .AND.(SUBSTR(mchk3,2) = ' ')
  216.    STOR .t. TO error
  217.   CASE mamt4 <> 0 .AND.(SUBSTR(mchk4,2) = ' ')
  218.    STOR .t. TO error
  219.   CASE mamt1 <> 0 .AND.(mdate1 = ' ')
  220.    STOR .t. TO error
  221.   CASE mamt2 <> 0 .AND.(mdate2 = ' ')
  222.    STOR .t. TO error
  223.   CASE mamt3 <> 0 .AND.(mdate3 = ' ')
  224.    STOR .t. TO error
  225.   CASE mamt4 <> 0 .AND.(mdate4 = ' ')
  226.    STOR .t. TO error
  227.   CASE mamt1 <> 0 .AND.(SUBSTR(macc1,4) = ' ')
  228.    STOR .t. TO error
  229.   CASE mamt2 <> 0 .AND.(SUBSTR(macc2,4) = ' ')
  230.    STOR .t. TO error
  231.   CASE mamt3 <> 0 .AND.(SUBSTR(macc3,4) = ' ')
  232.    STOR .t. TO error
  233.   CASE mamt4 <> 0 .AND.(SUBSTR(macc4,4) = ' ')
  234.    STOR .t. TO error
  235.   OTHE
  236.    STOR .f. TO validate
  237.    STOR .f. TO error
  238.   ENDC
  239.   IF error
  240.    @ 21,00
  241.    @ 22,00
  242.    @ 21,14 SAY "PLEASE CORRECT THE INDICATED DATA"
  243. * keep looping till all fields are fixed
  244.    STOR .t. TO an_error
  245.    DO WHIL an_error
  246. * fix bad ones one at a time
  247.     DO CASE
  248.     CASE mamt1 <> 0 .AND.(SUBSTR(mprop,2) = ' ')
  249.      @ 22,00
  250.      @ 22,10 SAY "You must have a two number property account or '00'"
  251.      @ 6,14 GET mprop PICTURE '99'
  252.      READ
  253.     CASE mamt1 <> 0 .AND.(SUBSTR(mchk1,2) = ' ')
  254.      @ 22,00
  255.      @ 22,10 SAY "You must have a Journal Entry number"
  256.      @ 8,14 GET mchk1 PICTURE 'J999'
  257.      READ
  258.     CASE mamt1 <> 0 .AND.(mdate1 = ' ')
  259.      @ 22,00
  260.      @ 22,14 SAY "You must have a transaction date"
  261.      @ 9,14 GET mdate1 PICTURE '99/99/99'
  262.      READ
  263.     CASE mamt1 <> 0 .AND.(SUBSTR(macc1,4) = ' ')
  264.      @ 22,00
  265.      @ 22,14 SAY "You must have a four digit  account number"
  266.      @ 9,43 GET macc1 PICTURE '9999'
  267.      READ
  268.     CASE mamt2 <> 0 .AND.(SUBSTR(mchk2,2) = ' ')
  269.      @ 22,00
  270.      @ 22,10 SAY "You must have a Journal Entry number"
  271.      @ 11,14 GET mchk2 PICTURE 'J999'
  272.      READ
  273.     CASE mamt2 <> 0 .AND.(mdate2 = ' ')
  274.      @ 22,00
  275.      @ 22,14 SAY "You must have a transaction date"
  276.      @ 12,14 GET mdate2 PICTURE '99/99/99'
  277.      READ
  278.     CASE mamt2 <> 0 .AND.(SUBSTR(macc2,4) = ' ')
  279.      @ 22,00
  280.      @ 22,14 SAY "You must have a four digit account number"
  281.      @ 12,43 GET macc2 PICTURE '9999'
  282.      READ
  283.     CASE mamt3 <> 0 .AND.(SUBSTR(mchk3,2) = ' ')
  284.      @ 22,00
  285.      @ 22,10 SAY "You must have a Journal Entry number"
  286.      @ 14,14 GET mchk3 PICTURE 'J999'
  287.      READ
  288.     CASE mamt3 <> 0 .AND.(mdate3 = ' ')
  289.      @ 22,00
  290.      @ 22,14 SAY "You must have a transaction date"
  291.      @ 15,14 GET mdate3 PICTURE '99/99/99'
  292.      READ
  293.     CASE mamt3 <> 0 .AND.(SUBSTR(macc3,4) = ' ')
  294.      @ 22,00
  295.      @ 22,14 SAY "You must have a four digit account number"
  296.      @ 15,43 GET macc3 PICTURE '9999'
  297.      READ
  298.     CASE mamt4 <> 0 .AND.(SUBSTR(mchk4,2) = ' ')
  299.      @ 22,00
  300.      @ 22,10 SAY "You must have a Journal Entry number"
  301.      @ 17,14 GET mchk4 PICTURE 'J999'
  302.      READ
  303.     CASE mamt4 <> 0 .AND.(mdate4 = ' ')
  304.      @ 22,00
  305.      @ 22,14 SAY "You must have a transaction date"
  306.      @ 18,14 GET mdate4 PICTURE '99/99/99'
  307.      READ
  308.     CASE mamt4 <> 0 .AND.(SUBSTR(macc4,4) = ' ')
  309.      @ 22,00
  310.      @ 22,14 SAY "You must have a four digit account number"
  311.      @ 18,43 GET macc4 PICTURE '9999'
  312.      READ
  313.     OTHE
  314.      @ 21,00
  315.      @ 22,00
  316.      @ 22,05 SAY prompt
  317.      STOR .F. TO validate
  318.      STOR .f. TO an_error
  319.     ENDC
  320.    ENDD WHILE an:error
  321.   ENDI error
  322.  ENDD validate
  323.  RELE error, an_error, validate
  324.  IF mamt1 <> 0
  325.   STOR SUBSTR(mdate1,7,2) + SUBSTR(mdate1,1,2) + SUBSTR(mdate1,4,2) TO mdat1
  326.   APPE BLANK
  327.   IF mamt1 > 0
  328.    STOR 'D' TO ltr
  329.   ELSE
  330.    STOR 'C' TO ltr
  331.   ENDI
  332.   REPL date WITH mdat1
  333.   REPL data WITH mchk1+mprop+macc1+ltr+mpay1+DTOC(date())+'J'
  334.   REPL amount WITH mamt1
  335.   IF mamt2 <> 0
  336.    STOR SUBSTR(mdate2,7,2) + SUBSTR(mdate2,1,2) + SUBSTR(mdate2,4,2) TO mdat2
  337.    APPE BLANK
  338.    IF mamt2 > 0
  339.     STOR 'D' TO ltr
  340.    ELSE
  341.     STOR 'C' TO ltr
  342.    ENDI
  343.    REPL date WITH mdat2
  344.    REPL data WITH mchk2+mprop+macc2+ltr+mpay2+DTOC(date())+'J'
  345.    REPL amount WITH mamt2
  346.   ENDI mamt2
  347.   IF mamt3 <> 0
  348.    STOR SUBSTR(mdate3,7,2) + SUBSTR(mdate3,1,2) + SUBSTR(mdate3,4,2) TO mdat3
  349.    APPE BLANK
  350.    IF mamt3 > 0
  351.     STOR 'D' TO ltr
  352.    ELSE
  353.     STOR 'C' TO ltr
  354.    ENDI
  355.    REPL date WITH mdat3
  356.    REPL data WITH mchk3+mprop+macc3+ltr+mpay3+DTOC(date())+'J'
  357.    REPL amount WITH mamt3
  358.   ENDI mamt3
  359.   IF mamt4 <> 0
  360.    STOR SUBSTR(mdate4,7,2) + SUBSTR(mdate4,1,2) + SUBSTR(mdate4,4,2) TO mdat4
  361.    APPE BLANK
  362.    IF mamt1 > 0
  363.     STOR 'D' TO ltr
  364.    ELSE
  365.     STOR 'C' TO ltr
  366.    ENDI
  367.    REPL date WITH mdat4
  368.    REPL data WITH mchk4+mprop+macc4+ltr+mpay4+DTOC(date())+'J'
  369.    REPL amount with mamt4
  370.   ENDI mamt4
  371.   STOR .t. TO more
  372.   IF (debit + credit) = 0.00
  373.    @ 21,00
  374.   ELSE
  375.    @ 21,10 SAY 'DEBITS AND CREDITS DO NOT BALANCE - CORRECT BEFORE YOU EXIT'
  376.   ENDI debit
  377.  ELSE
  378.   IF (debit + credit) = 0.00
  379.    STOR .f. TO more
  380.   ENDI debit
  381.  ENDI mamt1 > 0
  382.  STOR .t. TO first
  383. ENDD WHILE more
  384. SET DELIMITER ON
  385. SET INTENSITY OFF
  386. SET INDEX TO &dr.:account
  387. RETU
  388.