home *** CD-ROM | disk | FTP | other *** search
Wrap
Null Bytes Alternating | 1995-11-12 | 5.4 KB | 69 lines
'++LotusScript Development Environment:2:5:(Options):0:66 '++LotusScript Development Environment:2:5:(Forward):0:1 Declare Sub Click(Source As Button, X As Long, Y As Long, Flags As Long) '++LotusScript Development Environment:2:5:(Declarations):0:2 '++LotusScript Development Environment:2:2:BindEvents:1:129 Private Sub BindEvents(Byval Objectname_ As String) Static Source As BUTTON Set Source = Bind(Objectname_) On Event Click From Source Call Click End Sub '++LotusScript Development Environment:2:2:Click:1:12 Sub Click(Source As Button, X As Long, Y As Long, Flags As Long) Dim con As New connection Dim QryLoan As New Query Dim QryPayment As New Query Dim RsLoan As New resultset Dim RsPayment As New resultset If source.startyear.text <> "" And source.initialamountofloan.text <> "" Then If con.connectto ("dbase IV") Then Set QryPayment.connection=con Set QryLoan.connection=con QryPayment.tablename=currentdocument.path+"payment.dbf" QryLoan.tablename=currentdocument.path+"loan.dbf" Set RsPayment.query=QryPayment Set RsLoan.query=QryLoan LoanNumberVariable=source.loan_no.text QryPayment.sql="select * from """+QryPayment.tablename+""""+" WHERE Loan_no = "+LoanNumberVariable If (RsPayment.execute) Then If (RsLoan.execute) Then Createmessage currentwindow.repaint If RsPayment.numrows<1 Then BalanceVariable=source.InitialAmountofLoan1.text CummulativeInterest=0 For i=1 To Val(source.number~ of~ payments.text) RsPayment.addrow RsPayment.setvalue "Loan_no",LoanNumberVariable RsPayment.setvalue "BEGBAL",BalanceVariable interestamount=RsPayment.getvalue("BEGBAL")*((Val(source.interestrate.text))/1200) PaymentVariable=source.Payment_amount1.text PrinPaid=PaymentVariable-interestamount NewBalance=BalanceVariable-PrinPaid Smonth=source.startmonth.text Syear=source.startyear.text RsPayment.setvalue "Pay_Date",Datenumber(syear,smonth+(i-1),1) RsPayment.setvalue "BEGBAL",Newbal RsPayment.setvalue "Loan_no",LoanNumberVariable CummulativeInterest=CummulativeInterest+InterestAmount RsPayment.setvalue "Cumm_Int",CummulativeInterest RsPayment.updaterow BalanceVariable=NewBalance Next i Set a=source.txtCreateMessage Delete a Else Messagebox"You must delete the current amortization schedule in order to create a new one. If you would like to leave this schedule and creat another, choose 'Create a New Customer Record'" Set a=source.txtCreateMessage Delete a End If End If End If End If currentapplication.applicationwindow.domenucommand(IDM_refresh) End If End Sub