You've already forked lazarus-ccr
LazStats: Inherit form of LoanItUnit from report&chart template. Add chart of amortization.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7783 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -865,7 +865,7 @@
|
|||||||
<Unit95>
|
<Unit95>
|
||||||
<Filename Value="forms\analysis\financial\loanitunit.pas"/>
|
<Filename Value="forms\analysis\financial\loanitunit.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="LoanItFrm"/>
|
<ComponentName Value="LoanItForm"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="LoanItUnit"/>
|
<UnitName Value="LoanItUnit"/>
|
||||||
|
@ -1,431 +1,368 @@
|
|||||||
object LoanItFrm: TLoanItFrm
|
inherited LoanItForm: TLoanItForm
|
||||||
Left = 310
|
Left = 310
|
||||||
Height = 377
|
Height = 406
|
||||||
Top = 131
|
Top = 131
|
||||||
Width = 353
|
Width = 723
|
||||||
HelpType = htKeyword
|
HelpType = htKeyword
|
||||||
HelpKeyword = 'html/LoanAmortizationSchedule.htm'
|
HelpKeyword = 'html/LoanAmortizationSchedule.htm'
|
||||||
AutoSize = True
|
|
||||||
BorderStyle = bsDialog
|
|
||||||
Caption = 'Loan Calculation and Amortization'
|
Caption = 'Loan Calculation and Amortization'
|
||||||
ClientHeight = 377
|
ClientHeight = 406
|
||||||
ClientWidth = 353
|
ClientWidth = 723
|
||||||
OnActivate = FormActivate
|
inherited ParamsPanel: TPanel
|
||||||
OnShow = FormShow
|
Height = 390
|
||||||
Position = poMainFormCenter
|
ClientHeight = 390
|
||||||
LCLVersion = '2.1.0.0'
|
inherited CloseBtn: TButton
|
||||||
object Label1: TLabel
|
Top = 365
|
||||||
AnchorSideTop.Control = AmountEdit
|
end
|
||||||
AnchorSideTop.Side = asrCenter
|
inherited ComputeBtn: TButton
|
||||||
AnchorSideRight.Control = Label2
|
Top = 365
|
||||||
AnchorSideRight.Side = asrBottom
|
end
|
||||||
Left = 103
|
inherited ResetBtn: TButton
|
||||||
Height = 15
|
Top = 365
|
||||||
Top = 123
|
end
|
||||||
Width = 93
|
inherited HelpBtn: TButton
|
||||||
Anchors = [akTop, akRight]
|
Top = 365
|
||||||
BorderSpacing.Left = 8
|
end
|
||||||
Caption = 'Principal Amount'
|
inherited ButtonBevel: TBevel
|
||||||
ParentColor = False
|
Top = 349
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
object Label6: TLabel[5]
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideTop.Control = InterestEdit
|
AnchorSideTop.Control = NameEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 24
|
Left = 24
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 162
|
Top = 4
|
||||||
Width = 172
|
Width = 65
|
||||||
BorderSpacing.Left = 24
|
BorderSpacing.Left = 24
|
||||||
Caption = 'Annual Percentage Rate (APR %)'
|
Caption = 'Your Name: '
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label3: TLabel
|
object NameEdit: TEdit[6]
|
||||||
AnchorSideTop.Control = YearsEdit
|
AnchorSideLeft.Control = Label6
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideRight.Control = Label2
|
AnchorSideTop.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Control = ParamsPanel
|
||||||
Left = 59
|
AnchorSideRight.Side = asrBottom
|
||||||
Height = 15
|
Left = 97
|
||||||
Top = 189
|
Height = 23
|
||||||
Width = 137
|
Top = 0
|
||||||
Anchors = [akTop, akRight]
|
Width = 194
|
||||||
BorderSpacing.Left = 8
|
Anchors = [akTop, akLeft, akRight]
|
||||||
Caption = 'Number of Years to Repay'
|
BorderSpacing.Left = 8
|
||||||
ParentColor = False
|
TabOrder = 4
|
||||||
end
|
Text = 'NameEdit'
|
||||||
object Label4: TLabel
|
end
|
||||||
AnchorSideTop.Control = PayPerYrEdit
|
object CalendarBtn: TButton[7]
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = Label2
|
AnchorSideRight.Control = NameEdit
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 38
|
AnchorSideBottom.Control = Panel1
|
||||||
Height = 15
|
AnchorSideBottom.Side = asrBottom
|
||||||
Top = 216
|
Left = 256
|
||||||
Width = 158
|
Height = 25
|
||||||
Anchors = [akTop, akRight]
|
Top = 50
|
||||||
BorderSpacing.Left = 8
|
Width = 35
|
||||||
Caption = 'Number of Payments Per Year'
|
Anchors = [akRight, akBottom]
|
||||||
ParentColor = False
|
AutoSize = True
|
||||||
end
|
Caption = '...'
|
||||||
object Label5: TLabel
|
OnClick = CalendarBtnClick
|
||||||
AnchorSideTop.Control = RePayEdit
|
TabOrder = 5
|
||||||
AnchorSideTop.Side = asrCenter
|
end
|
||||||
AnchorSideRight.Control = Label2
|
object Panel1: TPanel[8]
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideTop.Control = NameEdit
|
||||||
Left = 149
|
AnchorSideTop.Side = asrBottom
|
||||||
Height = 15
|
AnchorSideRight.Control = CalendarBtn
|
||||||
Top = 259
|
Left = -8
|
||||||
Width = 47
|
Height = 40
|
||||||
Anchors = [akTop, akRight]
|
Top = 35
|
||||||
BorderSpacing.Left = 8
|
Width = 260
|
||||||
Caption = 'Payment'
|
Anchors = [akTop, akRight]
|
||||||
ParentColor = False
|
AutoSize = True
|
||||||
end
|
BorderSpacing.Left = 24
|
||||||
object Label6: TLabel
|
BorderSpacing.Top = 12
|
||||||
AnchorSideLeft.Control = Owner
|
BorderSpacing.Right = 4
|
||||||
AnchorSideTop.Control = NameEdit
|
BevelOuter = bvNone
|
||||||
AnchorSideTop.Side = asrCenter
|
ChildSizing.HorizontalSpacing = 12
|
||||||
Left = 24
|
ChildSizing.ControlsPerLine = 1
|
||||||
Height = 15
|
ClientHeight = 40
|
||||||
Top = 12
|
ClientWidth = 260
|
||||||
Width = 65
|
TabOrder = 6
|
||||||
BorderSpacing.Left = 24
|
object MonthLabel: TLabel
|
||||||
Caption = 'Your Name: '
|
AnchorSideLeft.Control = Panel1
|
||||||
ParentColor = False
|
AnchorSideTop.Control = Panel1
|
||||||
end
|
AnchorSideRight.Side = asrBottom
|
||||||
object AmountEdit: TEdit
|
Left = 0
|
||||||
AnchorSideLeft.Control = InterestEdit
|
Height = 15
|
||||||
AnchorSideTop.Control = Bevel2
|
Top = 0
|
||||||
AnchorSideTop.Side = asrBottom
|
Width = 98
|
||||||
AnchorSideRight.Control = NameEdit
|
Caption = 'Current Month No'
|
||||||
AnchorSideRight.Side = asrBottom
|
ParentColor = False
|
||||||
Left = 204
|
end
|
||||||
Height = 23
|
object DayLabel: TLabel
|
||||||
Top = 119
|
AnchorSideLeft.Control = MonthLabel
|
||||||
Width = 125
|
AnchorSideLeft.Side = asrBottom
|
||||||
Alignment = taRightJustify
|
AnchorSideTop.Control = Panel1
|
||||||
Anchors = [akTop, akLeft, akRight]
|
AnchorSideRight.Side = asrBottom
|
||||||
BorderSpacing.Top = 16
|
Left = 110
|
||||||
TabOrder = 3
|
Height = 15
|
||||||
Text = 'AmountEdit'
|
Top = 0
|
||||||
end
|
Width = 73
|
||||||
object InterestEdit: TEdit
|
Caption = 'Day of Month'
|
||||||
AnchorSideLeft.Control = Label2
|
ParentColor = False
|
||||||
AnchorSideLeft.Side = asrBottom
|
end
|
||||||
AnchorSideTop.Control = AmountEdit
|
object YearLabel: TLabel
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideLeft.Control = DayLabel
|
||||||
AnchorSideRight.Control = AmountEdit
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideTop.Control = Panel1
|
||||||
Left = 204
|
AnchorSideRight.Side = asrBottom
|
||||||
Height = 23
|
Left = 195
|
||||||
Top = 158
|
Height = 15
|
||||||
Width = 125
|
Top = 0
|
||||||
Alignment = taRightJustify
|
Width = 65
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Caption = 'Current Year'
|
||||||
BorderSpacing.Left = 8
|
ParentColor = False
|
||||||
BorderSpacing.Top = 16
|
end
|
||||||
TabOrder = 4
|
object MonthEdit: TEdit
|
||||||
Text = 'InterestEdit'
|
AnchorSideLeft.Side = asrBottom
|
||||||
end
|
AnchorSideTop.Control = MonthLabel
|
||||||
object YearsEdit: TEdit
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideLeft.Control = InterestEdit
|
AnchorSideRight.Control = MonthLabel
|
||||||
AnchorSideTop.Control = InterestEdit
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideTop.Side = asrBottom
|
Left = 38
|
||||||
AnchorSideRight.Control = InterestEdit
|
Height = 23
|
||||||
AnchorSideRight.Side = asrBottom
|
Top = 17
|
||||||
Left = 204
|
Width = 60
|
||||||
Height = 23
|
Alignment = taRightJustify
|
||||||
Top = 185
|
Anchors = [akTop, akRight]
|
||||||
Width = 125
|
BorderSpacing.Top = 2
|
||||||
Alignment = taRightJustify
|
TabOrder = 0
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Text = 'MonthEdit'
|
||||||
BorderSpacing.Top = 4
|
end
|
||||||
TabOrder = 5
|
object DayEdit: TEdit
|
||||||
Text = 'YearsEdit'
|
AnchorSideLeft.Control = DayLabel
|
||||||
end
|
AnchorSideLeft.Side = asrCenter
|
||||||
object PayPerYrEdit: TEdit
|
AnchorSideTop.Control = DayLabel
|
||||||
AnchorSideLeft.Control = InterestEdit
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideTop.Control = YearsEdit
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideTop.Side = asrBottom
|
Left = 116
|
||||||
AnchorSideRight.Control = InterestEdit
|
Height = 23
|
||||||
AnchorSideRight.Side = asrBottom
|
Top = 17
|
||||||
Left = 204
|
Width = 60
|
||||||
Height = 23
|
Alignment = taRightJustify
|
||||||
Top = 212
|
BorderSpacing.Top = 2
|
||||||
Width = 125
|
TabOrder = 1
|
||||||
Alignment = taRightJustify
|
Text = 'DayEdit'
|
||||||
Anchors = [akTop, akLeft, akRight]
|
end
|
||||||
BorderSpacing.Top = 4
|
object YearEdit: TEdit
|
||||||
TabOrder = 6
|
AnchorSideLeft.Control = YearLabel
|
||||||
Text = 'PayPerYrEdit'
|
AnchorSideTop.Control = YearLabel
|
||||||
end
|
AnchorSideTop.Side = asrBottom
|
||||||
object RePayEdit: TEdit
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideLeft.Control = InterestEdit
|
Left = 195
|
||||||
AnchorSideTop.Control = Bevel4
|
Height = 23
|
||||||
AnchorSideTop.Side = asrBottom
|
Top = 17
|
||||||
AnchorSideRight.Control = AmountEdit
|
Width = 60
|
||||||
AnchorSideRight.Side = asrBottom
|
Alignment = taRightJustify
|
||||||
Left = 204
|
BorderSpacing.Top = 2
|
||||||
Height = 23
|
TabOrder = 2
|
||||||
Top = 255
|
Text = 'YearEdit'
|
||||||
Width = 125
|
end
|
||||||
Alignment = taRightJustify
|
end
|
||||||
Anchors = [akTop, akLeft, akRight]
|
object Bevel2: TBevel[9]
|
||||||
BorderSpacing.Top = 8
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
Font.Style = [fsBold]
|
|
||||||
ParentFont = False
|
|
||||||
ReadOnly = True
|
|
||||||
TabOrder = 7
|
|
||||||
Text = 'RePayEdit'
|
|
||||||
end
|
|
||||||
object ResetBtn: TButton
|
|
||||||
AnchorSideTop.Control = Bevel1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = AmortizeBtn
|
|
||||||
Left = 144
|
|
||||||
Height = 25
|
|
||||||
Top = 333
|
|
||||||
Width = 54
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Reset'
|
|
||||||
OnClick = ResetBtnClick
|
|
||||||
TabOrder = 9
|
|
||||||
end
|
|
||||||
object AmortizeBtn: TButton
|
|
||||||
AnchorSideTop.Control = Bevel1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = CloseBtn
|
|
||||||
Left = 206
|
|
||||||
Height = 25
|
|
||||||
Top = 333
|
|
||||||
Width = 76
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
BorderSpacing.Bottom = 8
|
|
||||||
Caption = 'Compute'
|
|
||||||
OnClick = AmortizeBtnClick
|
|
||||||
TabOrder = 10
|
|
||||||
end
|
|
||||||
object CloseBtn: TButton
|
|
||||||
AnchorSideTop.Control = Bevel1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 290
|
|
||||||
Height = 25
|
|
||||||
Top = 333
|
|
||||||
Width = 55
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 8
|
|
||||||
Caption = 'Close'
|
|
||||||
ModalResult = 11
|
|
||||||
TabOrder = 11
|
|
||||||
end
|
|
||||||
object NameEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = Label6
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = Owner
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 97
|
|
||||||
Height = 23
|
|
||||||
Top = 8
|
|
||||||
Width = 232
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Left = 8
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
BorderSpacing.Right = 24
|
|
||||||
TabOrder = 0
|
|
||||||
Text = 'NameEdit'
|
|
||||||
end
|
|
||||||
object PrintChk: TCheckBox
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = RePayEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 24
|
|
||||||
Height = 19
|
|
||||||
Top = 290
|
|
||||||
Width = 188
|
|
||||||
BorderSpacing.Left = 24
|
|
||||||
BorderSpacing.Top = 12
|
|
||||||
Caption = 'Print the Amortization Schedule'
|
|
||||||
TabOrder = 8
|
|
||||||
end
|
|
||||||
object Bevel1: TBevel
|
|
||||||
AnchorSideLeft.Control = Owner
|
|
||||||
AnchorSideTop.Control = PrintChk
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 0
|
|
||||||
Height = 8
|
|
||||||
Top = 317
|
|
||||||
Width = 353
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 8
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
|
||||||
object CalendarBtn: TButton
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
AnchorSideRight.Control = NameEdit
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = Panel1
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 294
|
|
||||||
Height = 25
|
|
||||||
Top = 58
|
|
||||||
Width = 35
|
|
||||||
Anchors = [akRight, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
Caption = '...'
|
|
||||||
OnClick = CalendarBtnClick
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object Panel1: TPanel
|
|
||||||
AnchorSideTop.Control = NameEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = CalendarBtn
|
|
||||||
Left = 30
|
|
||||||
Height = 40
|
|
||||||
Top = 43
|
|
||||||
Width = 260
|
|
||||||
Anchors = [akTop, akRight]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 24
|
|
||||||
BorderSpacing.Top = 12
|
|
||||||
BorderSpacing.Right = 4
|
|
||||||
BevelOuter = bvNone
|
|
||||||
ChildSizing.HorizontalSpacing = 12
|
|
||||||
ChildSizing.ControlsPerLine = 1
|
|
||||||
ClientHeight = 40
|
|
||||||
ClientWidth = 260
|
|
||||||
TabOrder = 1
|
|
||||||
object MonthLabel: TLabel
|
|
||||||
AnchorSideLeft.Control = Panel1
|
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 15
|
Height = 8
|
||||||
Top = 0
|
Top = 87
|
||||||
Width = 98
|
Width = 291
|
||||||
Caption = 'Current Month No'
|
Anchors = [akTop, akLeft, akRight]
|
||||||
ParentColor = False
|
BorderSpacing.Top = 12
|
||||||
|
Shape = bsBottomLine
|
||||||
end
|
end
|
||||||
object DayLabel: TLabel
|
object Label1: TLabel[10]
|
||||||
AnchorSideLeft.Control = MonthLabel
|
AnchorSideTop.Control = AmountEdit
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideRight.Control = Label2
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 110
|
Left = 103
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 0
|
Top = 115
|
||||||
Width = 73
|
Width = 93
|
||||||
Caption = 'Day of Month'
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
Caption = 'Principal Amount'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object YearLabel: TLabel
|
object Label2: TLabel[11]
|
||||||
AnchorSideLeft.Control = DayLabel
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideTop.Control = InterestEdit
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Side = asrCenter
|
||||||
|
Left = 24
|
||||||
|
Height = 15
|
||||||
|
Top = 154
|
||||||
|
Width = 172
|
||||||
|
BorderSpacing.Left = 24
|
||||||
|
Caption = 'Annual Percentage Rate (APR %)'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object Label3: TLabel[12]
|
||||||
|
AnchorSideTop.Control = YearsEdit
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = Label2
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 195
|
Left = 59
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 0
|
Top = 181
|
||||||
Width = 65
|
Width = 137
|
||||||
Caption = 'Current Year'
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
Caption = 'Number of Years to Repay'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object MonthEdit: TEdit
|
object Label4: TLabel[13]
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideTop.Control = PayPerYrEdit
|
||||||
AnchorSideTop.Control = MonthLabel
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideRight.Control = Label2
|
||||||
AnchorSideRight.Control = MonthLabel
|
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 38
|
Left = 38
|
||||||
Height = 23
|
Height = 15
|
||||||
Top = 17
|
Top = 208
|
||||||
Width = 60
|
Width = 158
|
||||||
Alignment = taRightJustify
|
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Top = 2
|
BorderSpacing.Left = 8
|
||||||
TabOrder = 0
|
Caption = 'Number of Payments Per Year'
|
||||||
Text = 'MonthEdit'
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object DayEdit: TEdit
|
object Label5: TLabel[14]
|
||||||
AnchorSideLeft.Control = DayLabel
|
AnchorSideTop.Control = RePayEdit
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideTop.Control = DayLabel
|
AnchorSideRight.Control = Label2
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 116
|
Left = 149
|
||||||
Height = 23
|
Height = 15
|
||||||
Top = 17
|
Top = 251
|
||||||
Width = 60
|
Width = 47
|
||||||
Alignment = taRightJustify
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Top = 2
|
BorderSpacing.Left = 8
|
||||||
TabOrder = 1
|
Caption = 'Payment'
|
||||||
Text = 'DayEdit'
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object YearEdit: TEdit
|
object AmountEdit: TEdit[15]
|
||||||
AnchorSideLeft.Control = YearLabel
|
AnchorSideLeft.Control = InterestEdit
|
||||||
AnchorSideTop.Control = YearLabel
|
AnchorSideTop.Control = Bevel2
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = NameEdit
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 195
|
Left = 204
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 17
|
Top = 111
|
||||||
Width = 60
|
Width = 87
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
BorderSpacing.Top = 2
|
Anchors = [akTop, akLeft, akRight]
|
||||||
TabOrder = 2
|
BorderSpacing.Top = 16
|
||||||
Text = 'YearEdit'
|
TabOrder = 7
|
||||||
|
Text = 'AmountEdit'
|
||||||
|
end
|
||||||
|
object InterestEdit: TEdit[16]
|
||||||
|
AnchorSideLeft.Control = Label2
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = AmountEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = AmountEdit
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 204
|
||||||
|
Height = 23
|
||||||
|
Top = 150
|
||||||
|
Width = 87
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 8
|
||||||
|
BorderSpacing.Top = 16
|
||||||
|
TabOrder = 8
|
||||||
|
Text = 'InterestEdit'
|
||||||
|
end
|
||||||
|
object YearsEdit: TEdit[17]
|
||||||
|
AnchorSideLeft.Control = InterestEdit
|
||||||
|
AnchorSideTop.Control = InterestEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = InterestEdit
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 204
|
||||||
|
Height = 23
|
||||||
|
Top = 177
|
||||||
|
Width = 87
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
TabOrder = 9
|
||||||
|
Text = 'YearsEdit'
|
||||||
|
end
|
||||||
|
object PayPerYrEdit: TEdit[18]
|
||||||
|
AnchorSideLeft.Control = InterestEdit
|
||||||
|
AnchorSideTop.Control = YearsEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = InterestEdit
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 204
|
||||||
|
Height = 23
|
||||||
|
Top = 204
|
||||||
|
Width = 87
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
TabOrder = 10
|
||||||
|
Text = 'PayPerYrEdit'
|
||||||
|
end
|
||||||
|
object RePayEdit: TEdit[19]
|
||||||
|
AnchorSideLeft.Control = InterestEdit
|
||||||
|
AnchorSideTop.Control = Bevel4
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = AmountEdit
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 204
|
||||||
|
Height = 23
|
||||||
|
Top = 247
|
||||||
|
Width = 87
|
||||||
|
Alignment = taRightJustify
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 8
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
ParentFont = False
|
||||||
|
ReadOnly = True
|
||||||
|
TabOrder = 11
|
||||||
|
Text = 'RePayEdit'
|
||||||
|
end
|
||||||
|
object Bevel4: TBevel[20]
|
||||||
|
AnchorSideLeft.Control = ParamsPanel
|
||||||
|
AnchorSideTop.Control = PayPerYrEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = ParamsPanel
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 0
|
||||||
|
Height = 8
|
||||||
|
Top = 231
|
||||||
|
Width = 291
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
Shape = bsBottomLine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Bevel2: TBevel
|
inherited ParamsSplitter: TSplitter
|
||||||
AnchorSideLeft.Control = Owner
|
Height = 406
|
||||||
AnchorSideTop.Control = Panel1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 24
|
|
||||||
Height = 8
|
|
||||||
Top = 95
|
|
||||||
Width = 305
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Left = 24
|
|
||||||
BorderSpacing.Top = 12
|
|
||||||
BorderSpacing.Right = 24
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
end
|
||||||
object Bevel4: TBevel
|
inherited PageControl: TPageControl
|
||||||
AnchorSideLeft.Control = Label5
|
Height = 390
|
||||||
AnchorSideTop.Control = PayPerYrEdit
|
Width = 403
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
AnchorSideRight.Control = Owner
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
Left = 149
|
|
||||||
Height = 8
|
|
||||||
Top = 239
|
|
||||||
Width = 180
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
|
||||||
BorderSpacing.Top = 4
|
|
||||||
BorderSpacing.Right = 24
|
|
||||||
Shape = bsBottomLine
|
|
||||||
end
|
end
|
||||||
object CalendarDialog1: TCalendarDialog
|
object CalendarDialog1: TCalendarDialog[3]
|
||||||
Date = 43890
|
Date = 43890
|
||||||
OKCaption = '&OK'
|
OKCaption = '&OK'
|
||||||
CancelCaption = 'Cancel'
|
CancelCaption = 'Cancel'
|
||||||
Left = 40
|
Left = 56
|
||||||
Top = 312
|
Top = 264
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,21 +5,20 @@ unit LoanItUnit;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, ExtCtrls, ExtDlgs;
|
StdCtrls, ExtCtrls, ExtDlgs, ComCtrls, TACustomSeries, TAIntervalSources,
|
||||||
|
ChartFrameUnit, BasicStatsReportAndChartFormUnit;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TLoanItFrm }
|
{ TLoanItForm }
|
||||||
|
|
||||||
TLoanItFrm = class(TForm)
|
TLoanItForm = class(TBasicStatsReportAndChartForm)
|
||||||
Bevel1: TBevel;
|
|
||||||
Bevel2: TBevel;
|
Bevel2: TBevel;
|
||||||
Bevel4: TBevel;
|
Bevel4: TBevel;
|
||||||
CalendarBtn: TButton;
|
CalendarBtn: TButton;
|
||||||
CalendarDialog1: TCalendarDialog;
|
CalendarDialog1: TCalendarDialog;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
PrintChk: TCheckBox;
|
|
||||||
DayEdit: TEdit;
|
DayEdit: TEdit;
|
||||||
YearEdit: TEdit;
|
YearEdit: TEdit;
|
||||||
MonthEdit: TEdit;
|
MonthEdit: TEdit;
|
||||||
@ -28,9 +27,6 @@ type
|
|||||||
YearLabel: TLabel;
|
YearLabel: TLabel;
|
||||||
NameEdit: TEdit;
|
NameEdit: TEdit;
|
||||||
Label6: TLabel;
|
Label6: TLabel;
|
||||||
ResetBtn: TButton;
|
|
||||||
AmortizeBtn: TButton;
|
|
||||||
CloseBtn: TButton;
|
|
||||||
AmountEdit: TEdit;
|
AmountEdit: TEdit;
|
||||||
InterestEdit: TEdit;
|
InterestEdit: TEdit;
|
||||||
YearsEdit: TEdit;
|
YearsEdit: TEdit;
|
||||||
@ -41,131 +37,99 @@ type
|
|||||||
Label3: TLabel;
|
Label3: TLabel;
|
||||||
Label4: TLabel;
|
Label4: TLabel;
|
||||||
Label5: TLabel;
|
Label5: TLabel;
|
||||||
procedure AmortizeBtnClick(Sender: TObject);
|
|
||||||
procedure CalendarBtnClick(Sender: TObject);
|
procedure CalendarBtnClick(Sender: TObject);
|
||||||
procedure FormActivate(Sender: TObject);
|
|
||||||
procedure FormShow(Sender: TObject);
|
|
||||||
procedure ResetBtnClick(Sender: TObject);
|
|
||||||
private
|
private
|
||||||
{ private declarations }
|
FBalanceRemainSeries: TChartSeries;
|
||||||
function Validate(out AMsg: String; out AControl: TWinControl): boolean;
|
FTotalInterestSeries: TChartSeries;
|
||||||
|
FTotalPaidSeries: TChartSeries;
|
||||||
|
|
||||||
|
protected
|
||||||
|
procedure AdjustConstraints; override;
|
||||||
|
procedure Compute; override;
|
||||||
|
function Validate(out AMsg: String; out AControl: TWinControl): boolean; override;
|
||||||
|
|
||||||
public
|
public
|
||||||
{ public declarations }
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure Reset; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
LoanItFrm: TLoanItFrm;
|
LoanItForm: TLoanItForm;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, DateUtils, OutputUnit;
|
Math, DateUtils,
|
||||||
|
TAChartUtils, TALegend, TASeries;
|
||||||
|
|
||||||
{ TLoanItFrm }
|
{ TLoanItForm }
|
||||||
|
|
||||||
procedure TLoanItFrm.ResetBtnClick(Sender: TObject);
|
constructor TLoanItForm.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
NameEdit.Text := '';
|
inherited;
|
||||||
MonthEdit.Text := '';
|
|
||||||
DayEdit.Text := '';
|
|
||||||
YearEdit.Text := '';
|
|
||||||
YearsEdit.Text := '';
|
|
||||||
AmountEdit.Text := '';
|
|
||||||
InterestEdit.Text := '';
|
|
||||||
PayPerYrEdit.Text := '';
|
|
||||||
RepayEdit.Text := '';
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TLoanItFrm.FormShow(Sender: TObject);
|
FBalanceRemainSeries := TLineSeries.Create(FChartFrame);
|
||||||
begin
|
with TLineSeries(FBalanceRemainSeries) do
|
||||||
ResetBtnClick(self);
|
begin
|
||||||
end;
|
LinePen.Color := DATA_COLORS[0];
|
||||||
|
LinePen.Width := 2;
|
||||||
procedure TLoanItFrm.AmortizeBtnClick(Sender: TObject);
|
Title := 'Remaining balance';
|
||||||
var
|
|
||||||
no_per_year, year_payed, month_payed, day, month, j, k : integer;
|
|
||||||
fraction, interest, numerator, denominator, payment, total_interest : double;
|
|
||||||
amount, interest_payment, total_payed, pcnt_interest, years, no_years : double;
|
|
||||||
aname: string;
|
|
||||||
msg: String;
|
|
||||||
C: TWinControl;
|
|
||||||
lReport: TStrings;
|
|
||||||
begin
|
|
||||||
if not Validate(msg, C) then begin
|
|
||||||
C.SetFocus;
|
|
||||||
MessageDlg(msg, mtError, [mbOk], 0);
|
|
||||||
ModalResult := mrNone;
|
|
||||||
exit;
|
|
||||||
end;
|
end;
|
||||||
|
FChartFrame.Chart.AddSeries(FBalanceRemainSeries);
|
||||||
|
|
||||||
aname := NameEdit.Text;
|
FTotalInterestSeries := TLineSeries.Create(FChartFrame);
|
||||||
no_per_year := StrToInt(PayPerYrEdit.Text);
|
with TLineSeries(FTotalInterestSeries) do
|
||||||
day := StrToInt(DayEdit.Text);
|
begin
|
||||||
month := StrToInt(MonthEdit.Text);
|
LinePen.Color := DATA_COLORS[1];
|
||||||
years := StrToFloat(YearEdit.Text);
|
Title := 'Total interest';
|
||||||
amount := StrToFloat(AmountEdit.Text);
|
|
||||||
no_years := StrToFloat(YearsEdit.Text);
|
|
||||||
pcnt_interest := StrToFloat(InterestEdit.Text);
|
|
||||||
|
|
||||||
interest := pcnt_interest / 100.0;
|
|
||||||
numerator := interest * amount / no_per_year;
|
|
||||||
denominator := 1.0 - (1.0 / power((interest / no_per_year + 1.0), (no_per_year * no_years) ) );
|
|
||||||
payment := numerator / denominator;
|
|
||||||
RePayEdit.Text := Format('%.2f', [payment]);
|
|
||||||
|
|
||||||
if not PrintChk.Checked then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
if (no_per_year < 12) then
|
|
||||||
fraction := 12.0 / no_per_year else fraction := 1.0;
|
|
||||||
|
|
||||||
lReport := TStringList.Create;
|
|
||||||
try
|
|
||||||
lReport.Add( 'PAYMENT SCHEDULE PROGRAM by W. G. Miller');
|
|
||||||
lReport.Add( '');
|
|
||||||
lReport.Add( '---------------------------------------------------------------------------');
|
|
||||||
lReport.Add( '');
|
|
||||||
lReport.Add( 'Name of Borrower: ' + aname);
|
|
||||||
lReport.Add( 'Amount borrowed: $%.2f at %.2f percent over %.1f years.', [amount, pcnt_interest, no_years]);
|
|
||||||
lReport.Add( '');
|
|
||||||
total_interest := 0.0;
|
|
||||||
total_payed := 0.0;
|
|
||||||
for j := 1 to round(no_years) do
|
|
||||||
begin
|
|
||||||
lReport.Add('---------------------------------------------------------------------------');
|
|
||||||
lReport.Add(' PAYMENT PAYMENT INTEREST BALANCE TOTAL TOTAL');
|
|
||||||
lReport.Add(' DATE AMOUNT PAYED REMAINING INTEREST PAID');
|
|
||||||
lReport.Add('---------------------------------------------------------------------------');
|
|
||||||
// 'xx/xx/xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx
|
|
||||||
for k := 1 to no_per_year do
|
|
||||||
begin
|
|
||||||
year_payed := round(years) + j - 1 ;
|
|
||||||
month_payed := round(k * fraction + (month - fraction));
|
|
||||||
if (month_payed > 12) then
|
|
||||||
begin
|
|
||||||
year_payed := year_payed + 1;
|
|
||||||
month_payed := month_payed - 12;
|
|
||||||
end;
|
|
||||||
interest_payment := amount * interest / no_per_year;
|
|
||||||
amount := amount - payment + interest_payment;
|
|
||||||
total_interest := total_interest + interest_payment;
|
|
||||||
total_payed := total_payed + payment;
|
|
||||||
lReport.Add('%2d/%2d/%4d %12.2f %12.2f %12.2f %12.2f %12.2f', [
|
|
||||||
month_payed, day, year_payed, payment, interest_payment,
|
|
||||||
amount, total_interest, total_payed
|
|
||||||
]);
|
|
||||||
end; // next k
|
|
||||||
lReport.Add('');
|
|
||||||
end; // next j
|
|
||||||
|
|
||||||
DisplayReport(lReport);
|
|
||||||
|
|
||||||
finally
|
|
||||||
lReport.Free;
|
|
||||||
end;
|
end;
|
||||||
|
FChartFrame.Chart.AddSeries(FTotalInterestSeries);
|
||||||
|
|
||||||
|
FTotalPaidSeries := TLineSeries.Create(FChartFrame);
|
||||||
|
with TLineSeries(FTotalPaidSeries) do
|
||||||
|
begin
|
||||||
|
LinePen.Color := DATA_COLORS[2];
|
||||||
|
Title := 'Total paid';
|
||||||
|
end;
|
||||||
|
FChartFrame.Chart.AddSeries(FTotalPaidSeries);
|
||||||
|
|
||||||
|
FChartFrame.Chart.Legend.Visible := true;
|
||||||
|
FChartFrame.Chart.Legend.ColumnCount := 3;
|
||||||
|
FChartFrame.Chart.Legend.Alignment := laBottomCenter;
|
||||||
|
|
||||||
|
FChartFrame.Chart.BottomAxis.Marks.Source := TDateTimeIntervalchartSource.Create(FChartFrame);
|
||||||
|
with TDateTimeIntervalChartSource(FChartFrame.Chart.BottomAxis.Marks.Source) do
|
||||||
|
begin
|
||||||
|
Params.MaxLength := 120;
|
||||||
|
Params.MinLength := 50;
|
||||||
|
end;
|
||||||
|
FChartFrame.Chart.BottomAxis.Marks.Style := smsLabel;
|
||||||
|
FChartFrame.Chart.LeftAxis.Marks.Format := '%.0n';
|
||||||
|
|
||||||
|
FChartFrame.SetXTitle('Date');
|
||||||
|
FChartFrame.SetYTitle('Amounts');
|
||||||
|
FChartFrame.SetTitle('Amortization Schedule');
|
||||||
|
|
||||||
|
PageControl.ActivePageIndex := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLoanItFrm.CalendarBtnClick(Sender: TObject);
|
|
||||||
|
procedure TLoanItForm.AdjustConstraints;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
ParamsPanel.Constraints.MinWidth := Max(
|
||||||
|
Panel1.Width + Panel1.BorderSpacing.Right + CalendarBtn.Width,
|
||||||
|
4 * CloseBtn.Width + 3 * CloseBtn.BorderSpacing.Left
|
||||||
|
);
|
||||||
|
ParamsPanel.Constraints.MinHeight := RepayEdit.Top + RepayEdit.Height +
|
||||||
|
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TLoanItForm.CalendarBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
d: TDate;
|
d: TDate;
|
||||||
dy, mn, yr: Integer;
|
dy, mn, yr: Integer;
|
||||||
@ -186,23 +150,108 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLoanItFrm.FormActivate(Sender: TObject);
|
|
||||||
|
procedure TLoanItForm.Compute;
|
||||||
var
|
var
|
||||||
w: Integer;
|
no_per_year, year_paid, month_paid, day, month, j, k: integer;
|
||||||
|
fraction, interest, numerator, denominator, payment, total_interest: double;
|
||||||
|
amount, interest_payment, total_paid, pcnt_interest, years, no_years: double;
|
||||||
|
aname: string;
|
||||||
|
paymentDate: TDate;
|
||||||
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
w := MaxValue([ResetBtn.Width, AmortizeBtn.Width, CloseBtn.Width]);
|
FBalanceRemainSeries.Clear;
|
||||||
ResetBtn.Constraints.MinWidth := w;
|
FTotalInterestSeries.Clear;
|
||||||
AmortizeBtn.Constraints.MinWidth := w;
|
FTotalPaidSeries.Clear;
|
||||||
CloseBtn.Constraints.MinWidth := w;
|
|
||||||
{
|
aname := NameEdit.Text;
|
||||||
w := DayEdit.Width;
|
no_per_year := StrToInt(PayPerYrEdit.Text);
|
||||||
DayEdit.Constraints.MaxWidth := w;
|
day := StrToInt(DayEdit.Text);
|
||||||
MonthEdit.Constraints.MaxWidth := w;
|
month := StrToInt(MonthEdit.Text);
|
||||||
YearEdit.Constraints.MaxWidth := w;
|
years := StrToFloat(YearEdit.Text);
|
||||||
}
|
amount := StrToFloat(AmountEdit.Text);
|
||||||
|
no_years := StrToFloat(YearsEdit.Text);
|
||||||
|
pcnt_interest := StrToFloat(InterestEdit.Text);
|
||||||
|
|
||||||
|
interest := pcnt_interest / 100.0;
|
||||||
|
numerator := interest * amount / no_per_year;
|
||||||
|
denominator := 1.0 - (1.0 / power((interest / no_per_year + 1.0), (no_per_year * no_years) ) );
|
||||||
|
payment := numerator / denominator;
|
||||||
|
RePayEdit.Text := Format('%.2f', [payment]);
|
||||||
|
|
||||||
|
if (no_per_year < 12) then
|
||||||
|
fraction := 12.0 / no_per_year
|
||||||
|
else
|
||||||
|
fraction := 1.0;
|
||||||
|
|
||||||
|
lReport := TStringList.Create;
|
||||||
|
try
|
||||||
|
lReport.Add( 'PAYMENT SCHEDULE PROGRAM by W. G. Miller');
|
||||||
|
lReport.Add( '');
|
||||||
|
lReport.Add( '---------------------------------------------------------------------------');
|
||||||
|
lReport.Add( '');
|
||||||
|
lReport.Add( 'Name of Borrower: ' + aname);
|
||||||
|
lReport.Add( 'Amount borrowed: $%.2f at %.2f percent over %.1f years.', [amount, pcnt_interest, no_years]);
|
||||||
|
lReport.Add( '');
|
||||||
|
total_interest := 0.0;
|
||||||
|
total_paid := 0.0;
|
||||||
|
for j := 1 to round(no_years) do
|
||||||
|
begin
|
||||||
|
lReport.Add('---------------------------------------------------------------------------');
|
||||||
|
lReport.Add(' PAYMENT PAYMENT INTEREST BALANCE TOTAL TOTAL');
|
||||||
|
lReport.Add(' DATE AMOUNT PAYED REMAINING INTEREST PAID');
|
||||||
|
lReport.Add('---------------------------------------------------------------------------');
|
||||||
|
// 'xx/xx/xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx
|
||||||
|
for k := 1 to no_per_year do
|
||||||
|
begin
|
||||||
|
year_paid := round(years) + j - 1 ;
|
||||||
|
month_paid := round(k * fraction + (month - fraction));
|
||||||
|
if (month_paid > 12) then
|
||||||
|
begin
|
||||||
|
year_paid := year_paid + 1;
|
||||||
|
month_paid := month_paid - 12;
|
||||||
|
end;
|
||||||
|
interest_payment := amount * interest / no_per_year;
|
||||||
|
amount := amount - payment + interest_payment;
|
||||||
|
total_interest := total_interest + interest_payment;
|
||||||
|
total_paid := total_paid + payment;
|
||||||
|
lReport.Add('%.2d/%.2d/%4d %12.2f %12.2f %12.2f %12.2f %12.2f', [
|
||||||
|
month_paid, day, year_paid, payment, interest_payment,
|
||||||
|
amount, total_interest, total_paid
|
||||||
|
]);
|
||||||
|
|
||||||
|
paymentDate := EncodeDate(year_paid, month_paid, day);
|
||||||
|
FBalanceRemainSeries.AddXY(paymentDate, amount);
|
||||||
|
FTotalInterestSeries.AddXY(paymentDate, total_interest);
|
||||||
|
FTotalPaidSeries.AddXY(paymentDate, total_paid);
|
||||||
|
end; // next k
|
||||||
|
lReport.Add('');
|
||||||
|
end; // next j
|
||||||
|
|
||||||
|
FReportFrame.DisplayReport(lReport);
|
||||||
|
|
||||||
|
finally
|
||||||
|
lReport.Free;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLoanItFrm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
|
||||||
|
procedure TLoanItForm.Reset;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
NameEdit.Text := '';
|
||||||
|
MonthEdit.Text := '';
|
||||||
|
DayEdit.Text := '';
|
||||||
|
YearEdit.Text := '';
|
||||||
|
YearsEdit.Text := '';
|
||||||
|
AmountEdit.Text := '';
|
||||||
|
InterestEdit.Text := '';
|
||||||
|
PayPerYrEdit.Text := '';
|
||||||
|
RepayEdit.Text := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLoanItForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
||||||
var
|
var
|
||||||
n: Integer;
|
n: Integer;
|
||||||
x: Double;
|
x: Double;
|
||||||
@ -315,9 +364,6 @@ begin
|
|||||||
Result := true;
|
Result := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
|
||||||
|
|
||||||
{$I loanitunit.lrs}
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -1817,9 +1817,9 @@ end;
|
|||||||
// Menu "Analysis" > "Financial" > "Loan Amortization Schedule"
|
// Menu "Analysis" > "Financial" > "Loan Amortization Schedule"
|
||||||
procedure TOS3MainFrm.MenuItem10Click(Sender: TObject);
|
procedure TOS3MainFrm.MenuItem10Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if LoanItFrm = nil then
|
if LoanItForm = nil then
|
||||||
Application.CreateForm(TLoanItFrm, LoanItFrm);
|
Application.CreateForm(TLoanItForm, LoanItForm);
|
||||||
LoanItFrm.ShowModal;
|
LoanItForm.Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Menu "Analysis" > "Nonparametric" > "Cochran Q Test"
|
// Menu "Analysis" > "Nonparametric" > "Cochran Q Test"
|
||||||
|
Reference in New Issue
Block a user