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

  1. **    Last revision: April 6, 1986 at 15:54
  2. * postit.prg - module to update the file
  3. STOR .f. TO ok
  4. CLEA
  5. STOR 'Y' to comm
  6. @ 10,00 SAY 'Do you want to post the tenant rent payments to the tenant accounts ?'
  7. @ 10,70 GET comm PICTURE '!'
  8. READ
  9. DO WHIL AT(comm,'YN') = 0
  10.  @ 10,00 SAY 'Do you want to post the tenant rent payments to the tenant accounts ?'
  11.  @ 10,70 GET comm PICTURE '!'
  12.  READ
  13. ENDD
  14. IF comm = 'Y'
  15.  STOR .t. TO accrue1
  16. ELSE
  17.  STOR .f. TO accrue1
  18. ENDI
  19. STOR 'Y' TO comm1
  20. @ 12,10 SAY 'Do you want to post the monthly rent accruals ?'
  21. @ 12,59 GET comm1 PICTURE '!'
  22. READ
  23. DO WHIL AT(comm1,'YN') = 0
  24.  @ 12,10 SAY 'Do you want to post the monthly rent accruals ?'
  25.  @ 12,59 GET comm1 PICTURE '!'
  26.  READ
  27. ENDD
  28. IF comm1 = 'Y'
  29.  STOR DTOC(date()) to mdate1
  30.  @ 14,10 SAY 'What is the rent accrual date (MM/DD/YY) ? '
  31.  @ 14,59 GET mdate1 PICTURE '99/99/99'
  32.  READ
  33.  STOR .t. TO accrue
  34. ELSE
  35.  STOR .f. TO accrue
  36. ENDI comm1
  37. IF accrue1
  38.  STOR 0 TO latech
  39.  LOCA for SUBSTR(data,7,3) = '104' .AND. SUBSTR(data,12,1) = 'T' .AND.(.NOT. posted)
  40.  DO WHIL accrue1
  41.   STOR RECNO() TO rec_no
  42.   STOR SUBSTR(data,13,5) TO name
  43.   STOR SUBSTR(date,5,2) TO mlate
  44.   STOR amount to mamount
  45.   SELE B
  46.   USE &dr.:tenant
  47.   SET index to &dr.:codea
  48.   SEEK &name
  49.   IF .NOT. (EOF() .OR. BOF())
  50.    STOR trentd TO mtrentd
  51.    STOR trentt TO mtrentt
  52.    STOR trenty TO mtrenty
  53.    STOR tlatec TO mtlatec
  54.    IF VAL(mlate) > VAL(tlate)
  55.     STOR latech + mtlatec TO latech
  56.     STOR mtlatec + mtrentd TO mtrentd
  57.     REPL watchit WITH .t.
  58.    ENDI VAL(mlate)
  59.    REPL trentd WITH (mtrentd-mamount), trentt WITH (mtrentt+mamount)
  60.    REPL trenty WITH (mtrenty+mamount), posted WITH .t., tupdate WITH DTOC(DATE())
  61.    STOR .t. TO ok
  62.   ELSE
  63.    STOR .f. TO ok
  64.   ENDI # <) 0
  65.   SELE C
  66.   USE &dr.:account
  67.   SET INDEX TO &dr.:account
  68.   GO rec_no
  69.   IF ok
  70.    REPL posted WITH .t.
  71.   ENDI ok
  72.   CONT
  73.   IF EOF()
  74.    STOR .f. TO accrue1
  75.   ENDI EOF
  76.  ENDD WHILE accrue1
  77.  IF latech > 0
  78.   CLOS INDEX
  79.   GO BOTTOM
  80.   STOR .f. TO firstup
  81.   DO WHIL .NOT. firstup
  82.    IF SUBSTR(data,1,1) = 'J'
  83.     STOR VAL(SUBSTR(data,2,3)) TO entryno
  84.     STOR .t. TO firstup
  85.    ELSE
  86.     SKIP -1
  87.    ENDI
  88.   ENDD WHILE .NOT. firstup
  89.   SET INDEX TO &dr.:account
  90.   STOR entryno + 1 TO entryno
  91.   STOR entryno + 1000 TO entry
  92.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  93.   APPE BLANK
  94.   REPL date WITH DTOC(date())
  95.   REPL data with entry + '993020C'+'acc late chgs - all ' + DTOC(date())+'J'
  96.   REPL amount WITH (latech*-1)
  97.   APPE BLANK
  98.   REPL date WITH DTOC(date())
  99.   REPL data with entry + '991040D'+'acc late chgs - all ' + DTOC(date())+'J'
  100.   REPL amount WITH latech
  101.  ENDI latech
  102.  * RELE latech, firstup, entryno, entry, rec_no, accrue1, ok, comm
  103.  * RELE name, mlate, mamoubt, mtrentd, mtrentt, mtrenty, mtlatec
  104. ENDI accrue1
  105. IF accrue
  106.  SELE B
  107.  USE &dr.:TENANT
  108. * if more than 10 properties, will have to adjust this
  109.  STOR 0 TO rent01
  110.  STOR 0 TO rent02
  111.  STOR 0 TO rent03
  112.  STOR 0 TO rent04
  113.  STOR 0 TO rent05
  114.  STOR 0 TO rent06
  115.  STOR 0 TO rent07
  116.  STOR 0 TO rent08
  117.  STOR 0 TO rent09
  118.  STOR 0 TO rent10
  119.  GO TOP
  120.  DO WHIL .NOT. EOF()
  121.   IF SUBSTR(bcode,1,2) = '01'
  122.    STOR rent01 + (trent + taddl) TO rent01
  123.    REPL trentd WITH (trentd + trent + taddl)
  124.   ENDI $(bcode,1,2) = '01'
  125.   IF SUBSTR(bcode,1,2) = '02'
  126.    STOR rent02 + (trent + taddl) TO rent02
  127.    REPL trentd WITH (trentd + trent + taddl)
  128.   ENDI $(bcode,1,2) = '02'
  129.   IF SUBSTR(bcode,1,2) = '03'
  130.    STOR rent03 + (trent + taddl) TO rent03
  131.    REPL trentd WITH (trentd + trent + taddl)
  132.   ENDI $(bcode,1,2) = '03'
  133.   IF SUBSTR(bcode,1,2) = '04'
  134.    STOR rent04 + (trent + taddl) TO rent04
  135.    REPL trentd WITH (trentd + trent + taddl)
  136.   ENDI $(bcode,1,2) = '04'
  137.   IF SUBSTR(bcode,1,2) = '05'
  138.    STOR rent05 + (trent + taddl) TO rent05
  139.    REPL trentd WITH (trentd + trent + taddl)
  140.   ENDI $(bcode,1,2) = '05'
  141.   IF SUBSTR(bcode,1,2) = '06'
  142.    STOR rent06 + (trent + taddl) TO rent06
  143.    REPL trentd WITH (trentd + trent + taddl)
  144.   ENDI $(bcode,1,2) = '06'
  145.   IF SUBSTR(bcode,1,2) = '07'
  146.    STOR rent07 + (trent + taddl) TO rent07
  147.    REPL trentd WITH (trentd + trent + taddl)
  148.   ENDI $(bcode,1,2) = '07'
  149.   IF SUBSTR(bcode,1,2) = '08'
  150.    STOR rent08 + (trent + taddl) TO rent08
  151.    REPL trentd WITH (trentd + trent + taddl)
  152.   ENDI $(bcode,1,2) = '08'
  153.   IF SUBSTR(bcode,1,2) = '09'
  154.    STOR rent09 + (trent + taddl) TO rent09
  155.    REPL trentd WITH (trentd + trent + taddl)
  156.   ENDI $(bcode,1,2) = '09'
  157.   IF SUBSTR(bcode,1,2) = '10'
  158.    STOR rent10 + (trent + taddl) TO rent10
  159.    REPL trentd WITH (trentd + trent + taddl)
  160.   ENDI $(bcode,1,2) = '10'
  161.   SKIP
  162.  ENDD WHILE .NOT. eof
  163.  SELE C
  164.  USE &dr.:ACCOUNT
  165.  CLOS INDEX
  166.  GO BOTTOM
  167.  STOR .f. TO firstup
  168.  DO WHIL .NOT. firstup
  169.   IF SUBSTR(data,1,1) = 'J'
  170.    STOR VAL(SUBSTR(data,2,3)) TO entryno
  171.    STOR .t. TO firstup
  172.   ELSE
  173.    SKIP -1
  174.   ENDI
  175.  ENDD WHILE .NOT. firstup
  176.  STOR SUBSTR(mdate1,7,2) + SUBSTR(mdate1,1,2) + SUBSTR(mdate1,4,2) TO mdat1
  177.  IF rent01 > 0
  178.   STOR entryno + 1 TO entryno
  179.   STOR entryno + 1000 TO entryn
  180.   STOR STR(entryn,4) to entry
  181.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  182.   APPE BLANK
  183.   REPL date WITH mdat1
  184.   REPL data WITH entry+'013020C'+'rent accrual        '+DTOC(date())+'J'
  185.   REPL amount WITH (rent01*-1)
  186.   APPE BLANK
  187.   REPL date WITH mdat1
  188.   REPL data WITH entry+'011040D'+'rent accrual        '+DTOC(date())+'J'
  189.   REPL amount WITH rent01
  190.  ENDI rent01 > 0
  191.  IF rent02 > 0
  192.   STOR entryno + 1 TO entryno
  193.   STOR entryno + 1001 TO entryn
  194.   STOR STR(entryn,4) to entry
  195.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  196.   APPE BLANK
  197.   REPL date WITH mdat1
  198.   REPL data WITH entry+'023020C'+'rent accrual        '+DTOC(date())+'J'
  199.   REPL amount WITH (rent02*-1)
  200.   APPE BLANK
  201.   REPL date WITH mdat1
  202.   REPL data WITH entry+'021040D'+'rent accrual        '+DTOC(date())+'J'
  203.   REPL amount WITH rent02
  204.  ENDI rent02 > 0
  205.  IF rent03 > 0
  206.   STOR entryno + 1 TO entryno
  207.   STOR entryno + 1001 TO entryn
  208.   STOR STR(entryn,4) to entry
  209.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  210.   APPE BLANK
  211.   REPL date WITH mdat1
  212.   REPL data WITH entry+'033020C'+'rent accrual        '+DTOC(date())+'J'
  213.   REPL amount WITH (rent03*-1)
  214.   APPE BLANK
  215.   REPL date WITH mdat1
  216.   REPL data WITH entry+'031040D'+'rent accrual        '+DTOC(date())+'J'
  217.   REPL amount WITH rent03
  218.  ENDI rent03 > 0
  219.  IF rent04 > 0
  220.   STOR entryno + 1 TO entryno
  221.   STOR entryno + 1001 TO entryn
  222.   STOR STR(entryn,4) to entry
  223.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  224.   APPE BLANK
  225.   REPL date WITH mdat1
  226.   REPL data WITH entry+'043020C'+'rent accrual        '+DTOC(date())+'J'
  227.   REPL amount WITH (rent04*-1)
  228.   APPE BLANK
  229.   REPL date WITH mdat1
  230.   REPL data WITH entry+'041040D'+'rent accrual        '+DTOC(date())+'J'
  231.   REPL amount WITH rent04
  232.  ENDI rent04 > 0
  233.  IF rent05 > 0
  234.   STOR entryno + 1 TO entryno
  235.   STOR entryno + 1001 TO entryn
  236.   STOR STR(entryn,4) to entry
  237.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  238.   APPE BLANK
  239.   REPL date WITH mdat1
  240.   REPL data WITH entry+'053020C'+'rent accrual        '+DTOC(date())+'J'
  241.   REPL amount WITH (rent05*-1)
  242.   APPE BLANK
  243.   REPL date WITH mdat1
  244.   REPL data WITH entry+'051040D'+'rent accrual        '+DTOC(date())+'J'
  245.   REPL amount WITH rent05
  246.  ENDI rent05 > 0
  247.  IF rent06 > 0
  248.   STOR entryno + 1 TO entryno
  249.   STOR entryno + 1001 TO entryn
  250.   STOR STR(entryn,4) to entry
  251.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  252.   APPE BLANK
  253.   REPL date WITH mdat1
  254.   REPL data WITH entry+'063020C'+'rent accrual        '+DTOC(date())+'J'
  255.   REPL amount WITH (rent06*-1)
  256.   APPE BLANK
  257.   REPL date WITH mdat1
  258.   REPL data WITH entry+'061040D'+'rent accrual        '+DTOC(date())+'J'
  259.   REPL amount WITH rent06
  260.  ENDI rent06 > 0
  261.  IF rent07 > 0
  262.   STOR entryno + 1 TO entryno
  263.   STOR entryno + 1001 TO entryn
  264.   STOR STR(entryn,4) to entry
  265.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  266.   APPE BLANK
  267.   REPL date WITH mdat1
  268.   REPL data WITH entry+'073020C'+'rent accrual        '+DTOC(date())+'J'
  269.   REPL amount WITH (rent07*-1)
  270.   APPE BLANK
  271.   REPL date WITH mdat1
  272.   REPL data WITH entry+'071040D'+'rent accrual        '+DTOC(date())+'J'
  273.   REPL amount WITH rent07
  274.  ENDI rent07 > 0
  275.  IF rent08 > 0
  276.   STOR entryno + 1 TO entryno
  277.   STOR entryno + 1001 TO entryn
  278.   STOR STR(entryn,4) to entry
  279.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  280.   APPE BLANK
  281.   REPL date WITH mdat1
  282.   REPL data WITH entry+'083020C'+'rent accrual        '+DTOC(date())+'J'
  283.   REPL amount WITH (rent08*-1)
  284.   APPE BLANK
  285.   REPL date WITH mdat1
  286.   REPL data WITH entry+'081040D'+'rent accrual        '+DTOC(date())+'J'
  287.   REPL amount WITH rent08
  288.  ENDI rent08 > 0
  289.  IF rent09 > 0
  290.   STOR entryno + 1 TO entryno
  291.   STOR entryno + 1001 TO entryn
  292.   STOR STR(entryn,4) to entry
  293.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  294.   APPE BLANK
  295.   REPL date WITH mdat1
  296.   REPL data WITH entry+'093020C'+'rent accrual        '+DTOC(date())+'J'
  297.   REPL amount WITH (rent09*-1)
  298.   APPE BLANK
  299.   REPL date WITH mdat1
  300.   REPL data WITH entry+'091040D'+'rent accrual        '+DTOC(date())+'J'
  301.   REPL amount WITH rent09
  302.  ENDI rent09 > 0
  303.  IF rent10 > 0
  304.   STOR entryno + 1 TO entryno
  305.   STOR entryno + 1001 TO entryn
  306.   STOR STR(entryn,4) to entry
  307.   STOR 'J' + SUBSTR(entry,2,3) TO entry
  308.   APPE BLANK
  309.   REPL date WITH mdat1
  310.   REPL data WITH entry+'103020C'+'rent accrual        '+DTOC(date())+'J'
  311.   REPL amount WITH (rent10*-1)
  312.   APPE BLANK
  313.   REPL date WITH mdat1
  314.   REPL data WITH entry+'101040D'+'rent accrual        '+DTOC(date())+'J'
  315.   REPL amount WITH rent10
  316.  ENDI rent10 > 0
  317. ENDI accrue
  318. SELE C
  319. USE &dr.:account
  320. SET INDEX TO account
  321. STOR 'Y' TO command
  322. CLEA
  323. TEXT
  324.  
  325.           This module updates the accounting files so that statements
  326.           can be prepared.    The steps to do this are to reindex the
  327.           file - and then to set the accrual and statement dates.
  328.  
  329.           If all you want to do is update the rental  records to send
  330.           out monthly rent bills - you need not reindex.  You also do
  331.           not have to reindex if no entries were made since your last
  332.           reindexing.
  333.  
  334.                       SHALL WE REINDEX  ?
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345. ENDT
  346. @ 11,43 GET command PICTURE '!'
  347. READ
  348. IF command = 'Y'
  349.  @ 14,15 SAY 'Reindexing............please be patient'
  350.  @ 15,15 SAY '......................but I will keep you posted'
  351.  @ 16,00
  352.  SET TALK ON
  353.  SET ECHO ON
  354.  INDE ON date + SUBSTR(data,7,4) + SUBSTR(data,5,1) TO &dr.:account
  355.  SET TALK OFF
  356.  SET ECHO OFF
  357. ENDI command = 'Y'
  358. USE &dr.:account
  359. SET INDEX TO &dr.:account
  360. CLEA
  361. RETU
  362. 
  363.