home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / manage1.zip / POSTIT.PRG < prev    next >
Text File  |  1986-05-29  |  12KB  |  383 lines

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