home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / manage.zip / STATEM.PRG < prev    next >
Text File  |  1987-08-16  |  10KB  |  319 lines

  1. **    Last revision: April 6, 1986 at 15:54
  2. * statement module
  3. SELE C
  4. USE &dr.:account
  5. SET index TO &dr.:account
  6. CLEA
  7. STOR .t. TO more2
  8. DO WHIL more2
  9.  STOR 'Y' TO printer
  10.  STOR 'N' TO disk
  11.  STOR '        ' TO filename
  12.  STOR 0 TO rec_no
  13.  STOR '?' TO comm
  14.  STOR 'N' TO nowprint
  15.  STOR '?' to command
  16.  CLEA
  17.  IF clipper
  18.   @ 0,0, 22, 79 BOX frame
  19.   @ 4,1 SAY line1
  20.   @ 19,1 SAY line1
  21.  ELSE
  22.  @ 0,0 TO 4,79
  23.  @ 0,0 TO 19,79
  24.  @ 0,0 TO 22,79 DOUBLE
  25.  ENDI
  26.  @ 20,5 SAY 'Please select one of the above options. You may also leave this menu'
  27.  @ 21,5 SAY "by typing 'Q' and get on-line HELP by typing '?'."
  28.  @ 2,04 SAY dconame + ' -  STATEMENT PRINTING MENU'
  29.  @ 2,65 SAY DTOC(date())
  30.  @ 7,11 SAY "A.  Prepare a new Trial Balance"
  31.  @ 8,11 SAY "B.  Prepare a new Balance Sheet and Profit & Loss Statement"
  32.  @ 9,11 SAY "C.  Print a previously prepared Trial Balance"
  33.  @ 10,11 SAY "D.  Print a previously prepared Balance Sheet and P&L Statement"
  34.  @ 11,11 SAY "E.  Return to main accounting menu"
  35.  @ 13,23 SAY "PLEASE SELECT ONE OF THE OPTIONS"
  36.  @ 13,58 GET comm PICTURE '!'
  37.  READ
  38.  DO WHIL AT(COMM, 'ABCDE?Q') = 0
  39.   STOR '?' TO comm
  40.   @ 13,58 GET comm PICTURE '!'
  41.   READ
  42.  ENDD WHILE @(comm)
  43.  DO CASE
  44.  CASE comm = 'A' .OR. comm = 'B'
  45.   STOR DTOC(DATE()) TO stdate
  46.   STOR '12' TO mfyr
  47.   STOR '99' TO build1
  48.   STOR ',' TO bl
  49.   STOR bl TO mcode1
  50.   STOR bl TO mcode2
  51.   STOR bl TO mcode3
  52.   STOR bl TO mcode4
  53.   STOR bl TO mcode5
  54.   STOR bl TO mcode6
  55.   STOR bl TO mcode7
  56.   STOR bl TO mcode8
  57.   STOR bl TO mcode9
  58.   STOR bl TO mcode0
  59.   STOR bl TO mcodea
  60.   STOR 'N' to stub1
  61.   STOR '        ' TO stubdate
  62.   STOR .t. TO maybe
  63.   @ 13,01 SAY line1
  64.   @ 14,01 SAY "                   What is the statement date ?  "
  65.   @ 14,58 GET stdate PICTURE '99/99/99'
  66.   READ
  67.   STOR SUBSTR(stdate,7,2) + SUBSTR(stdate,1,2) + SUBSTR(stdate,4,2) TO stdat
  68.   @ 15,01 SAY "        What is the ending month of the fiscal or calendar year ?  "
  69.   @ 15,68 GET mfyr PICTURE '99'
  70.   READ
  71.   IF comm = 'B'
  72.    @ 16,01 SAY "        Do you want a one month report included ?    "
  73.    @ 16,60 GET stub1 PICTURE '!'
  74.    READ
  75.   ENDI comm= 'B'
  76.   IF stub1 = 'Y'
  77.    STOR .t. TO stub
  78.    STOR bl TO mcode6a
  79.    STOR bl TO mcode7a
  80.    STOR bl TO mcode8a
  81.    STOR bl TO mcode9a
  82.    STOR bl TO mcode0a
  83.    STOR bl TO mcodeaa
  84.    IF SUBSTR(stdat,3,2) = '01'
  85.     STOR (VAL(stdat) -10000)  TO stdat1
  86.     STOR STR(stdat1,6) TO stdat
  87.     STOR SUBSTR(stdat,1,2) + '12' + SUBSTR(stdat,5,2) TO stubdate
  88.    ELSE
  89.     STOR (VAL(stdat) -100) TO stdat1
  90.     STOR STR(stdat1,6) TO stubdate
  91.    ENDI $(stdat)
  92.   ELSE
  93.    STOR .f. TO stub
  94.   ENDI stub1
  95.   @ 17,01 SAY "        What building shall we do ('99' for all) ?                  "
  96.   @ 17,60 GET build1 PICTURE '99'
  97.   READ
  98.   @ 18,01 SAY "        Do you want to print the statement now ?                    "
  99.   @ 18,60 GET nowprint PICTURE '!'
  100.   READ
  101.   STOR 1 TO countit
  102.   @ 17,01 SAY SPACE(75)
  103.   @ 18,01 SAY SPACE(75)
  104.   @ 14,01 SAY SPACE(75)
  105.   @ 15,01 SAY "       This will take a while - so please be patient                      "
  106.   @ 16,01 SAY "          I am examining record number.......                       "
  107.   @ 16,40 SAY countit
  108.   STOR 0 TO tempamt
  109.   STOR 0 TO tempamt1
  110.   GO top
  111.   STOR SUBSTR(data,7,4) TO tempcr
  112.   STOR SUBSTR(data,5,2) TO build
  113.   STOR .t. TO range
  114.   STOR .t. TO more
  115.   STOR 1 TO planct
  116.   STOR '10115220321323425530640750856957060A' TO plan
  117.   DO WHIL more
  118. *******************************************************************************
  119. *  NOTE - if you change the ranges in the Chart of Accounts the three         *
  120. *  number groupings in 'plan' may require changing to caculate the statements *
  121. *  'plan' appears again later on under IF STUB                                *
  122. *******************************************************************************
  123.    STOR .t. TO LOOPING
  124.    DO WHIL looping
  125.     STOR SUBSTR(plan,planct,3) TO nu
  126.     STOR SUBSTR(nu,1,2) TO nu1
  127.     STOR SUBSTR(nu,3,1) TO nu2
  128.     IF range .AND. planct = 19
  129.      STOR RECNO() TO rec_no
  130.      STOR .f. TO range
  131.      STOR tempcr TO tempcr1
  132.     ENDI range
  133.     IF SUBSTR(tempcr,1,2) = '&nu1'
  134.      DO WHIL SUBSTR(data,7,2) = '&nu1' .AND. (.NOT. EOF())
  135.       IF (build1 = '99' .OR. build1 = build) .AND. date <= stdat
  136.        STOR SUBSTR(data,7,4) TO cr
  137.        IF tempcr = cr
  138.         STOR .t. TO maybe
  139.         STOR tempamt + amount TO tempamt
  140.        ELSE
  141.         STOR STR(tempamt,12,2) TO tempam
  142.         STOR 0 TO tempamt
  143.         STOR 1 TO blank
  144.         DO WHIL SUBSTR(tempam,blank,1)=' '
  145.          STOR blank+1 TO blank
  146.         ENDD
  147.         STOR SUBSTR(tempam,blank) TO tempam
  148.         STOR (tempcr +',' + tempam +',') TO mtemp
  149.         STOR (mcode&nu2 + mtemp) TO mcode&nu2
  150.         STOR cr TO tempcr
  151.         STOR .f. TO maybe
  152.        ENDI tempcr = cr
  153.       ELSE
  154.        SKIP
  155.       ENDI build1
  156.       IF maybe
  157.        SKIP
  158.        STOR countit + 1 TO countit
  159.        @ 16,40 SAY countit
  160.       ENDI maybe
  161.      ENDD WHILE $(data,7,2) = nu2
  162.      STOR STR(tempamt,12,2) TO tempam
  163.      STOR 1 TO blank
  164.      DO WHIL SUBSTR(tempam,blank,1)=' '
  165.       STOR blank+1 TO blank
  166.      ENDD
  167.      STOR SUBSTR(tempam,blank) TO tempam
  168.      STOR (tempcr +',' + tempam +',') TO mtemp
  169.      STOR (mcode&nu2 + mtemp) TO mcode&nu2
  170.      STOR SUBSTR(data,7,4) TO tempcr
  171.      STOR 0 TO tempamt
  172.     ENDI $(tempcr,1,2) = nu1
  173.     STOR planct + 3 TO planct
  174.     IF nu2 = 'A' .OR. EOF()
  175.      STOR .f. TO looping
  176.     ENDI nu2
  177.    ENDD while looping
  178.    IF stub
  179.     GO rec_no
  180.     STOR 0 TO tempamt
  181.     STOR tempcr1 TO tempcr
  182.     STOR 1 TO planct
  183.     STOR '306a407a508a569a570a60Aa' TO plan
  184.     STOR .t. TO LOOPING
  185.     DO WHIL looping
  186.      STOR SUBSTR(plan,planct,4) TO nu
  187.      STOR SUBSTR(nu,1,2) TO nu1
  188.      STOR SUBSTR(nu,3,2) TO nu2
  189.      IF SUBSTR(tempcr,1,2) = '&nu1'
  190.       DO WHIL SUBSTR(data,7,2) = '&nu1' .AND. (.NOT. EOF())
  191.        IF (build1 = '99' .OR. build1 = build) .AND. date <= stdat
  192.         STOR SUBSTR(data,7,4) TO cr
  193.         IF tempcr = cr
  194.          STOR .t. TO maybe
  195.          STOR tempamt + amount TO tempamt
  196.         ELSE
  197.          STOR STR(tempamt,12,2) TO tempam
  198.          STOR 0 TO tempamt
  199.          STOR 1 TO blank
  200.          DO WHIL SUBSTR(tempam,blank,1)=' '
  201.           STOR blank+1 TO blank
  202.          ENDD
  203.          STOR SUBSTR(tempam,blank) TO tempam
  204.          STOR (tempcr +',' + tempam +',') TO mtemp
  205.          STOR (mcode&nu2 + mtemp) TO mcode&nu2
  206.          STOR cr TO tempcr
  207.          STOR .f. TO maybe
  208.         ENDI tempcr = cr
  209.        ELSE
  210.         SKIP
  211.        ENDI build1
  212.        IF maybe
  213.         SKIP
  214.         STOR countit + 1 TO countit
  215.         @ 16,40 SAY countit
  216.        ENDI maybe
  217.       ENDD WHILE $(data,7,2) = nu2
  218.       STOR STR(tempamt,12,2) TO tempam
  219.       STOR 1 TO blank
  220.       DO WHIL SUBSTR(tempam,blank,1)=' '
  221.        STOR blank+1 TO blank
  222.       ENDD
  223.       STOR SUBSTR(tempam,blank) TO tempam
  224.       STOR (tempcr +',' + tempam +',') TO mtemp
  225.       STOR (mcode&nu2 + mtemp) TO mcode&nu2
  226.       STOR SUBSTR(data,7,4) TO tempcr
  227.       STOR 0 TO tempamt
  228.      ENDI $(tempcr,1,2) = nu1
  229.      STOR planct + 4 TO planct
  230.      IF SUBSTR(nu2,1,1) = 'A' .OR. EOF()
  231.       STOR .f. TO looping
  232.      ENDI nu2
  233.     ENDD while looping
  234.    ENDI stub
  235.    STOR .f. TO more
  236.   ENDD while more
  237.   SELE E
  238.   USE &dr.:statemnt
  239.   IF stub
  240.    APPE BLANK
  241.    REPL date WITH stdate, fyr WITH mfyr, bld WITH build1
  242.    REPL code6 WITH mcode6a, code7 WITH mcode7a, code8 WITH mcode8a
  243.    REPL code9 WITH mcode9a, code0 WITH mcode0a, codea WITH mcodeaa
  244.    REPL stubs WITH .t.
  245.   ENDI stub
  246.   APPE BLANK
  247.   REPL date WITH stdate, fyr WITH mfyr, bld WITH build1
  248.   REPL code1 WITH mcode1, code2 WITH mcode2, code3 WITH mcode3
  249.   REPL code4 WITH mcode4, code5 WITH mcode5, code6 WITH mcode6
  250.   REPL code7 WITH mcode7, code8 WITH mcode8, code9 WITH mcode9
  251.   REPL code0 WITH mcode0, codea WITH mcodea
  252.   IF stub
  253.    REPL stubs WITH .t.
  254.   ENDI stub
  255.   IF nowprint = 'Y'
  256.    STOR stdate TO daya
  257.    * RELE stdate, mfyr, mcode1, mcode2, mcode3, mcode4, mcode5
  258.    * RELE mcode6, mcode7, mcode8, mcode9, mcode0,mcodea, bl, maybe, cr
  259.    * RELE mcode6a, mcode7a, mcode8a, mcode9a, mcode0a, mcodeaa
  260.    * RELE countit, tempcr, blank, tempam, mtemp, more, account
  261.    * RELE command, build1, tempamt, stub1
  262.    IF comm = 'A'
  263.     STOR 'C' TO com1
  264.    ELSE
  265.     STOR 'D' TO com1
  266.    ENDI comm
  267.    DO statemp
  268.   ELSE
  269.    CLEA
  270.    SELE C
  271.    USE &dr.:account
  272.    SET INDEX TO &dr.:account
  273.    STOR .t. TO more2
  274.   ENDI nowprint
  275.  CASE comm = 'C' .OR. comm = 'D'
  276.   IF comm = 'C'
  277.    STOR 'C' TO com1
  278.   ELSE
  279.    STOR 'D' TO com1
  280.   ENDI comm
  281.   DO statemp
  282.  CASE comm = '?'
  283.   CLEA
  284.   TEXT
  285.  
  286.           S T A T E M E N T   P R I N T I N G   H E L P   M E N U
  287.  
  288.     This module calculates a trial balance and an income statement and
  289.     a balance sheet.  It will also prepare a one month 'stub' income
  290.     statement.
  291.  
  292.     You can print the statement at the time of the calculation, or at
  293.     any later time. It will always print the last statement prepared
  294.     under a particular date.  If you initially asked for the stub 
  295.     statement, it will always print the stub statement in addition to
  296.     the full statement.
  297.  
  298.     If you elect to print the statement, you can send it to both the
  299.     screen and the printer or just the screen.  You can also send the
  300.     output to a disk file where you can edit it further before printing.
  301.  
  302.     It will take a few minutes for the calculations, so please be patient
  303.     while it runs.
  304.  
  305.  
  306.                     Please hit any key to return to the menu
  307.   ENDT
  308.   SET CONSOLE OFF
  309.   WAIT
  310.   SET CONSOLE ON
  311.   CLEA
  312.   STOR .t. TO more2
  313.  CASE comm = 'E' .OR. comm = 'Q'
  314.   STOR .f. TO more2
  315.  ENDC
  316. ENDD WHILE more2
  317. RETU
  318. 
  319.