home *** CD-ROM | disk | FTP | other *** search
- 10 DEFDBL A-W
- 20 CLS
- 30 PRINT "This program creates the mortgage ledger file 'MORGAG'"
- 40 PRINT "It generates three transactions per month for the life"
- 50 PRINT "of the mortgage. The first is a DEBIT of the payment,"
- 60 PRINT "for the bank account. The second is a CREDIT of the"
- 70 PRINT "interest, for a revenue account. The third is a CREDIT"
- 80 PRINT "of the principal repayment, for an asset account."
- 90 PRINT ""
- 100 PRINT "In addition, a final payment of the balance is created"
- 110 PRINT "at the end (DEBIT bank, CREDIT asset), and an original"
- 120 PRINT "transaction for the principal is created at the start."
- 130 PRINT "The file may be slightly out of balance, due to round"
- 140 PRINT "off error. This should be taken care of by LEDGER hand"
- 150 PRINT "entry."
- 160 PRINT ""
- 170 INPUT "Account number for Bank";BACCT
- 180 INPUT "Account number for Interest";IACCT
- 190 INPUT "Account number for Principal Repayment";PACCT
- 200 INPUT "Principal amount";PR
- 210 INPUT "Interest rate";INTER
- 220 INPUT "Number of payments";PAY
- 230 INPUT "Amount of each payment";PAYM
- 240 INPUT "Year of first payment";YEAR
- 250 INPUT "Month of first payment";MONTH
- 260 INPUT "Day of first payment";DAY
- 270 INPUT "Transaction type to use";TYPE$
- 280 INPUT "Transaction number to use";TNUMB
- 290 INPUT "Mortgage name (for comment)";COMMENT$
- 300 OPEN "morgag.ldg" FOR OUTPUT AS 1
- 310 PRINT "Creating data ..."
- 320 ACCOUNT=BACCT
- 330 AMOUNT=PR
- 340 GOSUB 770
- 350 PRINT#1,RECORD$
- 360 ACCOUNT=PACCT
- 370 AMOUNT=PR*-1
- 380 GOSUB 770
- 390 PRINT#1,RECORD$
- 400 X=PAY
- 410 FOR Y=1 TO X
- 420 ACCOUNT=BACCT
- 430 AMOUNT=PAYM*(-1)
- 440 GOSUB 770
- 450 PRINT#1,RECORD$
- 460 ACCOUNT=IACCT
- 470 AMOUNT=PR*INTER/12/100
- 480 GOSUB 770
- 490 PRINT#1,RECORD$
- 500 ACCOUNT=PACCT
- 510 AMOUNT=VAL(NUMB$)/100
- 520 PRINT USING "###";Y;
- 530 PRINT " Interest=";
- 540 PRINT USING "#######.##";AMOUNT;
- 550 AMOUNT=PAYM-AMOUNT
- 560 GOSUB 770
- 570 PRINT#1,RECORD$
- 580 AMOUNT=VAL(NUMB$)/100
- 590 PRINT " Principal=";
- 600 PRINT USING "#######.##";AMOUNT
- 610 PR=PR-AMOUNT
- 620 MONTH=MONTH+1
- 630 IF MONTH<13 GOTO 660
- 640 MONTH=1
- 650 YEAR=YEAR+1
- 660 NEXT Y
- 670 ACCOUNT=BACCT
- 680 AMOUNT=PR*(-1)
- 690 GOSUB 770
- 700 PRINT#1,RECORD$
- 710 ACCOUNT=PACCT
- 720 AMOUNT=PR
- 730 GOSUB 770
- 740 PRINT#1,RECORD$
- 750 CLOSE#1
- 760 SYSTEM
- 770 REM--***************************************************************
- 780 REM--sets up a transaction record from the following
- 790 REM-- year:the year, month:the month, day:the day
- 800 REM-- account:the account number, comment$:the comment
- 810 REM-- type$:the transaction type, tnumb:the transaction number
- 820 REM-- amount: the amount
- 830 RECORD$=STRING$(59," ")
- 840 MID$(RECORD$,1,1)="J"
- 850 NUMBER=YEAR
- 860 GOSUB 1090
- 870 MID$(RECORD$,2,2)=MID$(NUMB$,8,2)
- 880 NUMBER=MONTH
- 890 GOSUB 1090
- 900 MID$(RECORD$,4,2)=MID$(NUMB$,8,2)
- 910 NUMBER=DAY
- 920 GOSUB 1090
- 930 MID$(RECORD$,6,2)=MID$(NUMB$,8,2)
- 940 NUMBER=ACCOUNT
- 950 GOSUB 1090
- 960 MID$(RECORD$,8,5)=MID$(NUMB$,5,5)
- 970 IF LEN(TYPE$)>0 GOTO 990
- 980 TYPE$=" "
- 990 MID$(RECORD$,15,1)=MID$(TYPE$,1,1)
- 1000 NUMBER=TNUMB
- 1010 GOSUB 1090
- 1020 MID$(RECORD$,16,5)=MID$(NUMB$,5,5)
- 1030 MID$(RECORD$,21,25)=COMMENT$
- 1040 NUMBER=AMOUNT
- 1050 GOSUB 1090
- 1060 MID$(RECORD$,49,11)=NUMB$
- 1070 RETURN
- 1080 REM--***************************************************************
- 1090 REM--converts "number" to "numb$", with leading zeros and sign
- 1100 N1=NUMBER*100+.00001
- 1110 N1=INT(N1)
- 1120 T$=STR$(N1)
- 1130 NUMB$="00000000000"
- 1140 MID$(NUMB$,12-LEN(T$))=T$
- 1150 IF MID$(NUMB$,12-LEN(T$),1)=" " GOTO 1180
- 1160 MID$(NUMB$,1)="-"
- 1170 GOTO 1190
- 1180 MID$(NUMB$,1)="+"
- 1190 MID$(NUMB$,12-LEN(T$))="0"
- 1200 RETURN
- 1210 REM--***************************************************************
- ="+"
- 1190 MID$(NUMB$,12-LEN(T$))="0"
- 1200 RETU