home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / APPS / DATABASE / LEDGER.ZIP / MORGAG.BAS < prev    next >
Encoding:
BASIC Source File  |  1986-02-14  |  3.8 KB  |  124 lines

  1. 10 DEFDBL A-W
  2. 20 CLS
  3. 30 PRINT "This program creates the mortgage ledger file 'MORGAG'"
  4. 40 PRINT "It generates three transactions per month for the life"
  5. 50 PRINT "of the mortgage.  The first is a DEBIT of the payment,"
  6. 60 PRINT "for the bank account.  The second is a CREDIT  of  the"
  7. 70 PRINT "interest, for a revenue account. The third is a CREDIT"
  8. 80 PRINT "of the principal repayment, for an asset account."
  9. 90 PRINT ""
  10. 100 PRINT "In addition, a final payment of the balance is created"
  11. 110 PRINT "at the end (DEBIT bank, CREDIT asset), and an original"
  12. 120 PRINT "transaction for the principal is created at the start."
  13. 130 PRINT "The file may be slightly out of balance,  due to round"
  14. 140 PRINT "off error. This should be taken care of by LEDGER hand"
  15. 150 PRINT "entry."
  16. 160 PRINT ""
  17. 170 INPUT "Account number for Bank";BACCT
  18. 180 INPUT "Account number for Interest";IACCT
  19. 190 INPUT "Account number for Principal Repayment";PACCT
  20. 200 INPUT "Principal amount";PR
  21. 210 INPUT "Interest rate";INTER
  22. 220 INPUT "Number of payments";PAY
  23. 230 INPUT "Amount of each payment";PAYM
  24. 240 INPUT "Year of first payment";YEAR
  25. 250 INPUT "Month of first payment";MONTH
  26. 260 INPUT "Day of first payment";DAY
  27. 270 INPUT "Transaction type to use";TYPE$
  28. 280 INPUT "Transaction number to use";TNUMB
  29. 290 INPUT "Mortgage name (for comment)";COMMENT$
  30. 300 OPEN "morgag.ldg" FOR OUTPUT AS 1
  31. 310 PRINT "Creating data ..."
  32. 320 ACCOUNT=BACCT
  33. 330 AMOUNT=PR
  34. 340 GOSUB 770
  35. 350 PRINT#1,RECORD$
  36. 360 ACCOUNT=PACCT
  37. 370 AMOUNT=PR*-1
  38. 380 GOSUB 770
  39. 390 PRINT#1,RECORD$
  40. 400 X=PAY
  41. 410 FOR Y=1 TO X
  42. 420 ACCOUNT=BACCT
  43. 430 AMOUNT=PAYM*(-1)
  44. 440 GOSUB 770
  45. 450 PRINT#1,RECORD$
  46. 460 ACCOUNT=IACCT
  47. 470 AMOUNT=PR*INTER/12/100
  48. 480 GOSUB 770
  49. 490 PRINT#1,RECORD$
  50. 500 ACCOUNT=PACCT
  51. 510 AMOUNT=VAL(NUMB$)/100
  52. 520 PRINT USING "###";Y;
  53. 530 PRINT "    Interest=";
  54. 540 PRINT USING "#######.##";AMOUNT;
  55. 550 AMOUNT=PAYM-AMOUNT
  56. 560 GOSUB 770
  57. 570 PRINT#1,RECORD$
  58. 580 AMOUNT=VAL(NUMB$)/100
  59. 590 PRINT "   Principal=";
  60. 600 PRINT USING "#######.##";AMOUNT
  61. 610 PR=PR-AMOUNT
  62. 620 MONTH=MONTH+1
  63. 630 IF MONTH<13 GOTO 660
  64. 640 MONTH=1
  65. 650 YEAR=YEAR+1
  66. 660 NEXT Y
  67. 670 ACCOUNT=BACCT
  68. 680 AMOUNT=PR*(-1)
  69. 690 GOSUB 770
  70. 700 PRINT#1,RECORD$
  71. 710 ACCOUNT=PACCT
  72. 720 AMOUNT=PR
  73. 730 GOSUB 770
  74. 740 PRINT#1,RECORD$
  75. 750 CLOSE#1
  76. 760 SYSTEM
  77. 770 REM--***************************************************************
  78. 780 REM--sets up a transaction record from the following
  79. 790 REM-- year:the year, month:the month, day:the day
  80. 800 REM-- account:the account number, comment$:the comment
  81. 810 REM-- type$:the transaction type, tnumb:the transaction number
  82. 820 REM-- amount: the amount
  83. 830 RECORD$=STRING$(59," ")
  84. 840 MID$(RECORD$,1,1)="J"
  85. 850 NUMBER=YEAR
  86. 860 GOSUB 1090
  87. 870 MID$(RECORD$,2,2)=MID$(NUMB$,8,2)
  88. 880 NUMBER=MONTH
  89. 890 GOSUB 1090
  90. 900 MID$(RECORD$,4,2)=MID$(NUMB$,8,2)
  91. 910 NUMBER=DAY
  92. 920 GOSUB 1090
  93. 930 MID$(RECORD$,6,2)=MID$(NUMB$,8,2)
  94. 940 NUMBER=ACCOUNT
  95. 950 GOSUB 1090
  96. 960 MID$(RECORD$,8,5)=MID$(NUMB$,5,5)
  97. 970 IF LEN(TYPE$)>0 GOTO 990
  98. 980 TYPE$=" "
  99. 990 MID$(RECORD$,15,1)=MID$(TYPE$,1,1)
  100. 1000 NUMBER=TNUMB
  101. 1010 GOSUB 1090
  102. 1020 MID$(RECORD$,16,5)=MID$(NUMB$,5,5)
  103. 1030 MID$(RECORD$,21,25)=COMMENT$
  104. 1040 NUMBER=AMOUNT
  105. 1050 GOSUB 1090
  106. 1060 MID$(RECORD$,49,11)=NUMB$
  107. 1070 RETURN
  108. 1080 REM--***************************************************************
  109. 1090 REM--converts "number" to "numb$", with leading zeros and sign
  110. 1100 N1=NUMBER*100+.00001
  111. 1110 N1=INT(N1)
  112. 1120 T$=STR$(N1)
  113. 1130 NUMB$="00000000000"
  114. 1140 MID$(NUMB$,12-LEN(T$))=T$
  115. 1150 IF MID$(NUMB$,12-LEN(T$),1)=" " GOTO 1180
  116. 1160 MID$(NUMB$,1)="-"
  117. 1170 GOTO 1190
  118. 1180 MID$(NUMB$,1)="+"
  119. 1190 MID$(NUMB$,12-LEN(T$))="0"
  120. 1200 RETURN
  121. 1210 REM--***************************************************************
  122. ="+"
  123. 1190 MID$(NUMB$,12-LEN(T$))="0"
  124. 1200 RETU