You've already forked lazarus-ccr
LazStats: Activate chm help for the Financial submenu. Minor improvements of the related forms.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7461 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -3,6 +3,8 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
Height = 216
|
||||
Top = 330
|
||||
Width = 401
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'DoubleDecliningValue.htm'
|
||||
AutoSize = True
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Double Declining Value'
|
||||
@ -13,11 +15,11 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
Position = poMainFormCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
object ResetBtn: TButton
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
Left = 174
|
||||
Left = 180
|
||||
Height = 25
|
||||
Top = 179
|
||||
Top = 185
|
||||
Width = 54
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -27,11 +29,11 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
TabOrder = 2
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideRight.Control = ReturnBtn
|
||||
Left = 240
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
Left = 246
|
||||
Height = 25
|
||||
Top = 179
|
||||
Top = 185
|
||||
Width = 76
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -40,31 +42,31 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object ReturnBtn: TButton
|
||||
object CloseBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 328
|
||||
Left = 334
|
||||
Height = 25
|
||||
Top = 179
|
||||
Width = 61
|
||||
Top = 185
|
||||
Width = 55
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Return'
|
||||
ModalResult = 1
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
TabOrder = 4
|
||||
end
|
||||
object HelpBtn: TButton
|
||||
Tag = 118
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
Left = 111
|
||||
Left = 117
|
||||
Height = 25
|
||||
Top = 179
|
||||
Top = 185
|
||||
Width = 51
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -82,9 +84,10 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 163
|
||||
Top = 169
|
||||
Width = 401
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object Panel1: TPanel
|
||||
@ -92,7 +95,7 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 87
|
||||
Height = 155
|
||||
Height = 157
|
||||
Top = 8
|
||||
Width = 227
|
||||
AutoSize = True
|
||||
@ -100,7 +103,7 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 155
|
||||
ClientHeight = 157
|
||||
ClientWidth = 227
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
@ -161,7 +164,7 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 136
|
||||
Top = 138
|
||||
Width = 119
|
||||
Caption = 'Obtained Depreciation'
|
||||
ParentColor = False
|
||||
@ -231,18 +234,18 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
object DeprecEdit: TEdit
|
||||
AnchorSideLeft.Control = Label5
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = PeriodEdit
|
||||
AnchorSideTop.Control = Bevel2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 127
|
||||
Height = 23
|
||||
Top = 132
|
||||
Top = 134
|
||||
Width = 100
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Top = 8
|
||||
Constraints.MinWidth = 100
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
@ -250,5 +253,19 @@ object DblDeclineFrm: TDblDeclineFrm
|
||||
TabOrder = 4
|
||||
Text = 'Edit1'
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
AnchorSideLeft.Control = Label4
|
||||
AnchorSideTop.Control = PeriodEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = PeriodEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 15
|
||||
Height = 8
|
||||
Top = 118
|
||||
Width = 212
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 2
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -15,11 +15,12 @@ type
|
||||
|
||||
TDblDeclineFrm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
Bevel2: TBevel;
|
||||
HelpBtn: TButton;
|
||||
Panel1: TPanel;
|
||||
ResetBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
ReturnBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
CostEdit: TEdit;
|
||||
LifeEdit: TEdit;
|
||||
EndEdit: TEdit;
|
||||
@ -143,11 +144,11 @@ procedure TDblDeclineFrm.FormActivate(Sender: TObject);
|
||||
var
|
||||
w: Integer;
|
||||
begin
|
||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, ReturnBtn.Width]);
|
||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||
HelpBtn.Constraints.MinWidth := w;
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
ReturnBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
end;
|
||||
|
||||
function TDblDeclineFrm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
||||
|
@ -1,12 +1,14 @@
|
||||
object LoanItFrm: TLoanItFrm
|
||||
Left = 310
|
||||
Height = 393
|
||||
Height = 377
|
||||
Top = 131
|
||||
Width = 353
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'LoanAmortizationSchedule.htm'
|
||||
AutoSize = True
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Loan Calculation and Amortization'
|
||||
ClientHeight = 393
|
||||
ClientHeight = 377
|
||||
ClientWidth = 353
|
||||
OnActivate = FormActivate
|
||||
OnShow = FormShow
|
||||
@ -17,9 +19,9 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 95
|
||||
Left = 103
|
||||
Height = 15
|
||||
Top = 105
|
||||
Top = 123
|
||||
Width = 93
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
@ -30,11 +32,11 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = InterestEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 16
|
||||
Left = 24
|
||||
Height = 15
|
||||
Top = 144
|
||||
Top = 162
|
||||
Width = 172
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Left = 24
|
||||
Caption = 'Annual Percentage Rate (APR %)'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -43,13 +45,13 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 100
|
||||
Left = 59
|
||||
Height = 15
|
||||
Top = 171
|
||||
Width = 88
|
||||
Top = 189
|
||||
Width = 137
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Number of years'
|
||||
Caption = 'Number of Years to Repay'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label4: TLabel
|
||||
@ -57,9 +59,9 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 30
|
||||
Left = 38
|
||||
Height = 15
|
||||
Top = 198
|
||||
Top = 216
|
||||
Width = 158
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
@ -71,9 +73,9 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 141
|
||||
Left = 149
|
||||
Height = 15
|
||||
Top = 237
|
||||
Top = 259
|
||||
Width = 47
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
@ -84,26 +86,27 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = NameEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Left = 24
|
||||
Height = 15
|
||||
Top = 12
|
||||
Width = 65
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Left = 24
|
||||
Caption = 'Your Name: '
|
||||
ParentColor = False
|
||||
end
|
||||
object AmountEdit: TEdit
|
||||
AnchorSideLeft.Control = InterestEdit
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Control = Bevel2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
Left = 196
|
||||
AnchorSideRight.Control = NameEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 204
|
||||
Height = 23
|
||||
Top = 101
|
||||
Width = 149
|
||||
Top = 119
|
||||
Width = 125
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Right = 8
|
||||
TabOrder = 3
|
||||
Text = 'AmountEdit'
|
||||
end
|
||||
@ -112,17 +115,16 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = AmountEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Control = AmountEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 196
|
||||
Left = 204
|
||||
Height = 23
|
||||
Top = 140
|
||||
Width = 149
|
||||
Top = 158
|
||||
Width = 125
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Right = 8
|
||||
TabOrder = 4
|
||||
Text = 'InterestEdit'
|
||||
end
|
||||
@ -132,10 +134,10 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = InterestEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 196
|
||||
Left = 204
|
||||
Height = 23
|
||||
Top = 167
|
||||
Width = 149
|
||||
Top = 185
|
||||
Width = 125
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
@ -148,10 +150,10 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = InterestEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 196
|
||||
Left = 204
|
||||
Height = 23
|
||||
Top = 194
|
||||
Width = 149
|
||||
Top = 212
|
||||
Width = 125
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
@ -160,17 +162,17 @@ object LoanItFrm: TLoanItFrm
|
||||
end
|
||||
object RePayEdit: TEdit
|
||||
AnchorSideLeft.Control = InterestEdit
|
||||
AnchorSideTop.Control = PayPerYrEdit
|
||||
AnchorSideTop.Control = Bevel4
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AmountEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 196
|
||||
Left = 204
|
||||
Height = 23
|
||||
Top = 233
|
||||
Width = 149
|
||||
Top = 255
|
||||
Width = 125
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Top = 8
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
@ -181,9 +183,9 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AmortizeBtn
|
||||
Left = 138
|
||||
Left = 144
|
||||
Height = 25
|
||||
Top = 315
|
||||
Top = 333
|
||||
Width = 54
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -197,10 +199,10 @@ object LoanItFrm: TLoanItFrm
|
||||
object AmortizeBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ReturnBtn
|
||||
Left = 200
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
Left = 206
|
||||
Height = 25
|
||||
Top = 315
|
||||
Top = 333
|
||||
Width = 76
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -211,21 +213,21 @@ object LoanItFrm: TLoanItFrm
|
||||
OnClick = AmortizeBtnClick
|
||||
TabOrder = 10
|
||||
end
|
||||
object ReturnBtn: TButton
|
||||
object CloseBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 284
|
||||
Left = 290
|
||||
Height = 25
|
||||
Top = 315
|
||||
Width = 61
|
||||
Top = 333
|
||||
Width = 55
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Return'
|
||||
ModalResult = 1
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
TabOrder = 11
|
||||
end
|
||||
object NameEdit: TEdit
|
||||
@ -234,27 +236,27 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 81
|
||||
Left = 97
|
||||
Height = 23
|
||||
Top = 8
|
||||
Width = 264
|
||||
Width = 232
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Right = 24
|
||||
TabOrder = 0
|
||||
Text = 'NameEdit'
|
||||
end
|
||||
object PrintChk: TCheckBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = RePayEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Left = 24
|
||||
Height = 19
|
||||
Top = 272
|
||||
Top = 290
|
||||
Width = 188
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Left = 24
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'Print the Amortization Schedule'
|
||||
TabOrder = 8
|
||||
end
|
||||
@ -266,7 +268,7 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 299
|
||||
Top = 317
|
||||
Width = 353
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
@ -278,9 +280,9 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Panel1
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 310
|
||||
Left = 294
|
||||
Height = 25
|
||||
Top = 60
|
||||
Top = 58
|
||||
Width = 35
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
@ -292,27 +294,24 @@ object LoanItFrm: TLoanItFrm
|
||||
AnchorSideTop.Control = NameEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = CalendarBtn
|
||||
Left = 16
|
||||
Height = 42
|
||||
Left = 30
|
||||
Height = 40
|
||||
Top = 43
|
||||
Width = 282
|
||||
Width = 260
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 24
|
||||
BorderSpacing.Top = 12
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Right = 4
|
||||
BevelOuter = bvNone
|
||||
ChildSizing.HorizontalSpacing = 12
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsScaleChilds
|
||||
ChildSizing.ShrinkHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 42
|
||||
ClientWidth = 282
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 40
|
||||
ClientWidth = 260
|
||||
TabOrder = 1
|
||||
object Label7: TLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
object MonthLabel: TLabel
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 15
|
||||
@ -321,65 +320,112 @@ object LoanItFrm: TLoanItFrm
|
||||
Caption = 'Current Month No'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label8: TLabel
|
||||
object DayLabel: TLabel
|
||||
AnchorSideLeft.Control = MonthLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 110
|
||||
Height = 15
|
||||
Top = 0
|
||||
Width = 80
|
||||
Width = 73
|
||||
Caption = 'Day of Month'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label9: TLabel
|
||||
object YearLabel: TLabel
|
||||
AnchorSideLeft.Control = DayLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 202
|
||||
Left = 195
|
||||
Height = 15
|
||||
Top = 0
|
||||
Width = 80
|
||||
Width = 65
|
||||
Caption = 'Current Year'
|
||||
ParentColor = False
|
||||
end
|
||||
object MonthEdit: TEdit
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = MonthLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
AnchorSideRight.Control = MonthLabel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 38
|
||||
Height = 23
|
||||
Top = 19
|
||||
Width = 98
|
||||
Top = 17
|
||||
Width = 60
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 2
|
||||
TabOrder = 0
|
||||
Text = 'MonthEdit'
|
||||
end
|
||||
object DayEdit: TEdit
|
||||
AnchorSideLeft.Control = DayLabel
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = DayLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 110
|
||||
Left = 116
|
||||
Height = 23
|
||||
Top = 19
|
||||
Width = 80
|
||||
Top = 17
|
||||
Width = 60
|
||||
Alignment = taRightJustify
|
||||
BorderSpacing.Top = 2
|
||||
TabOrder = 1
|
||||
Text = 'DayEdit'
|
||||
end
|
||||
object YearEdit: TEdit
|
||||
AnchorSideLeft.Control = YearLabel
|
||||
AnchorSideTop.Control = YearLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 202
|
||||
Left = 195
|
||||
Height = 23
|
||||
Top = 19
|
||||
Width = 80
|
||||
Top = 17
|
||||
Width = 60
|
||||
Alignment = taRightJustify
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Top = 2
|
||||
TabOrder = 2
|
||||
Text = 'YearEdit'
|
||||
end
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
AnchorSideLeft.Control = Owner
|
||||
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
|
||||
object Bevel4: TBevel
|
||||
AnchorSideLeft.Control = Label5
|
||||
AnchorSideTop.Control = PayPerYrEdit
|
||||
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
|
||||
object CalendarDialog1: TCalendarDialog
|
||||
Date = 43890
|
||||
OKCaption = '&OK'
|
||||
CancelCaption = 'Cancel'
|
||||
left = 48
|
||||
left = 40
|
||||
top = 312
|
||||
end
|
||||
end
|
||||
|
@ -14,6 +14,8 @@ type
|
||||
|
||||
TLoanItFrm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
Bevel2: TBevel;
|
||||
Bevel4: TBevel;
|
||||
CalendarBtn: TButton;
|
||||
CalendarDialog1: TCalendarDialog;
|
||||
Panel1: TPanel;
|
||||
@ -21,14 +23,14 @@ type
|
||||
DayEdit: TEdit;
|
||||
YearEdit: TEdit;
|
||||
MonthEdit: TEdit;
|
||||
Label7: TLabel;
|
||||
Label8: TLabel;
|
||||
Label9: TLabel;
|
||||
MonthLabel: TLabel;
|
||||
DayLabel: TLabel;
|
||||
YearLabel: TLabel;
|
||||
NameEdit: TEdit;
|
||||
Label6: TLabel;
|
||||
ResetBtn: TButton;
|
||||
AmortizeBtn: TButton;
|
||||
ReturnBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
AmountEdit: TEdit;
|
||||
InterestEdit: TEdit;
|
||||
YearsEdit: TEdit;
|
||||
@ -44,7 +46,6 @@ type
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ResetBtnClick(Sender: TObject);
|
||||
procedure Heading(AReport: TStrings);
|
||||
private
|
||||
{ private declarations }
|
||||
function Validate(out AMsg: String; out AControl: TWinControl): boolean;
|
||||
@ -64,15 +65,15 @@ uses
|
||||
|
||||
procedure TLoanItFrm.ResetBtnClick(Sender: TObject);
|
||||
begin
|
||||
NameEdit.Text := '';
|
||||
MonthEdit.Text := '';
|
||||
DayEdit.Text := '';
|
||||
YearEdit.Text := '';
|
||||
YearsEdit.Text := '30';
|
||||
AmountEdit.Text := '10000';
|
||||
InterestEdit.Text := '6.5';
|
||||
PayPerYrEdit.Text := '12';
|
||||
RepayEdit.Text := '';
|
||||
NameEdit.Text := '';
|
||||
MonthEdit.Text := '';
|
||||
DayEdit.Text := '';
|
||||
YearEdit.Text := '';
|
||||
YearsEdit.Text := '';
|
||||
AmountEdit.Text := '';
|
||||
InterestEdit.Text := '';
|
||||
PayPerYrEdit.Text := '';
|
||||
RepayEdit.Text := '';
|
||||
end;
|
||||
|
||||
procedure TLoanItFrm.FormShow(Sender: TObject);
|
||||
@ -81,85 +82,87 @@ begin
|
||||
end;
|
||||
|
||||
procedure TLoanItFrm.AmortizeBtnClick(Sender: TObject);
|
||||
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;
|
||||
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;
|
||||
if not Validate(msg, C) then begin
|
||||
C.SetFocus;
|
||||
MessageDlg(msg, mtError, [mbOk], 0);
|
||||
ModalResult := mrNone;
|
||||
exit;
|
||||
end;
|
||||
|
||||
aname := NameEdit.Text;
|
||||
no_per_year := StrToInt(PayPerYrEdit.Text);
|
||||
day := StrToInt(DayEdit.Text);
|
||||
month := StrToInt(MonthEdit.Text);
|
||||
years := StrToFloat(YearEdit.Text);
|
||||
amount := StrToFloat(AmountEdit.Text);
|
||||
no_years := StrToFloat(YearsEdit.Text);
|
||||
pcnt_interest := StrToFloat(InterestEdit.Text);
|
||||
aname := NameEdit.Text;
|
||||
no_per_year := StrToInt(PayPerYrEdit.Text);
|
||||
day := StrToInt(DayEdit.Text);
|
||||
month := StrToInt(MonthEdit.Text);
|
||||
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('%10.2f', [payment]);
|
||||
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 not PrintChk.Checked then
|
||||
exit;
|
||||
|
||||
if (no_per_year < 12) then
|
||||
fraction := 12.0 / no_per_year else fraction := 1.0;
|
||||
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
|
||||
Heading(lReport);
|
||||
for k := 1 to no_per_year do
|
||||
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 := 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/%2d %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('');
|
||||
//lReport.Add('----------------------------------------------------------------------------');
|
||||
end; // next j
|
||||
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);
|
||||
DisplayReport(lReport);
|
||||
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLoanItFrm.CalendarBtnClick(Sender: TObject);
|
||||
@ -187,10 +190,10 @@ procedure TLoanItFrm.FormActivate(Sender: TObject);
|
||||
var
|
||||
w: Integer;
|
||||
begin
|
||||
w := MaxValue([ResetBtn.Width, AmortizeBtn.Width, ReturnBtn.Width]);
|
||||
w := MaxValue([ResetBtn.Width, AmortizeBtn.Width, CloseBtn.Width]);
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
AmortizeBtn.Constraints.MinWidth := w;
|
||||
ReturnBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
{
|
||||
w := DayEdit.Width;
|
||||
DayEdit.Constraints.MaxWidth := w;
|
||||
@ -199,14 +202,6 @@ begin
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TLoanItFrm.Heading(AReport: TStrings);
|
||||
begin
|
||||
AReport.Add('----------------------------------------------------------------------------');
|
||||
AReport.Add('PAYMENT PAYMENT INTEREST BALANCE TOTAL TOTAL');
|
||||
AReport.Add('NUMBER AMOUNT PAYED REMAINING INTEREST PAID');
|
||||
AReport.Add('----------------------------------------------------------------------------');
|
||||
end;
|
||||
|
||||
function TLoanItFrm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
||||
var
|
||||
n: Integer;
|
||||
|
@ -1,8 +1,11 @@
|
||||
object SLDepFrm: TSLDepFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 685
|
||||
Height = 206
|
||||
Top = 433
|
||||
Width = 315
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'StraightLineDepreciation.htm'
|
||||
AutoSize = True
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Straight Line Depreciation'
|
||||
@ -48,6 +51,7 @@ object SLDepFrm: TSLDepFrm
|
||||
Top = 43
|
||||
Width = 165
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 16
|
||||
Caption = 'No. of Periods of Life Expected:'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -57,7 +61,7 @@ object SLDepFrm: TSLDepFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 24
|
||||
Height = 15
|
||||
Top = 113
|
||||
Top = 125
|
||||
Width = 166
|
||||
BorderSpacing.Left = 24
|
||||
Caption = 'Depreciation Allowed (Answer):'
|
||||
@ -71,7 +75,7 @@ object SLDepFrm: TSLDepFrm
|
||||
Left = 206
|
||||
Height = 23
|
||||
Top = 8
|
||||
Width = 101
|
||||
Width = 85
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
@ -87,7 +91,7 @@ object SLDepFrm: TSLDepFrm
|
||||
Left = 206
|
||||
Height = 23
|
||||
Top = 70
|
||||
Width = 101
|
||||
Width = 85
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
@ -103,7 +107,7 @@ object SLDepFrm: TSLDepFrm
|
||||
Left = 206
|
||||
Height = 23
|
||||
Top = 39
|
||||
Width = 101
|
||||
Width = 85
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
@ -113,19 +117,19 @@ object SLDepFrm: TSLDepFrm
|
||||
object DepreciationEdit: TEdit
|
||||
AnchorSideLeft.Control = Label4
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = SalvageEdit
|
||||
AnchorSideTop.Control = Bevel2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 206
|
||||
Height = 23
|
||||
Top = 109
|
||||
Width = 101
|
||||
Top = 121
|
||||
Width = 85
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Top = 12
|
||||
BorderSpacing.Right = 24
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
@ -133,13 +137,13 @@ object SLDepFrm: TSLDepFrm
|
||||
Text = 'Edit1'
|
||||
end
|
||||
object ResetBtn: TButton
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 100
|
||||
Left = 102
|
||||
Height = 25
|
||||
Top = 156
|
||||
Top = 168
|
||||
Width = 54
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -150,13 +154,13 @@ object SLDepFrm: TSLDepFrm
|
||||
TabOrder = 5
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideRight.Control = ReturnBtn
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 162
|
||||
Left = 164
|
||||
Height = 25
|
||||
Top = 156
|
||||
Top = 168
|
||||
Width = 76
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -166,38 +170,38 @@ object SLDepFrm: TSLDepFrm
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 6
|
||||
end
|
||||
object ReturnBtn: TButton
|
||||
object CloseBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 246
|
||||
Left = 248
|
||||
Height = 25
|
||||
Top = 156
|
||||
Width = 61
|
||||
Top = 168
|
||||
Width = 55
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Return'
|
||||
ModalResult = 1
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
TabOrder = 7
|
||||
end
|
||||
object HelpBtn: TButton
|
||||
Tag = 146
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 41
|
||||
Left = 43
|
||||
Height = 25
|
||||
Top = 156
|
||||
Top = 168
|
||||
Width = 51
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 7
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Help'
|
||||
@ -212,10 +216,24 @@ object SLDepFrm: TSLDepFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 140
|
||||
Top = 152
|
||||
Width = 315
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
AnchorSideLeft.Control = Label2
|
||||
AnchorSideTop.Control = SalvageEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = CostEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 44
|
||||
Height = 8
|
||||
Top = 101
|
||||
Width = 247
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
end
|
||||
|
@ -15,10 +15,11 @@ type
|
||||
|
||||
TSLDepFrm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
Bevel2: TBevel;
|
||||
HelpBtn: TButton;
|
||||
ResetBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
ReturnBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
CostEdit: TEdit;
|
||||
SalvageEdit: TEdit;
|
||||
PeriodsEdit: TEdit;
|
||||
|
@ -2,12 +2,14 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
Left = 461
|
||||
Height = 231
|
||||
Top = 241
|
||||
Width = 291
|
||||
Width = 372
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'SumsofYearsDigitsDepreciation.htm'
|
||||
AutoSize = True
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Sum of Years Depreciation'
|
||||
ClientHeight = 231
|
||||
ClientWidth = 291
|
||||
ClientWidth = 372
|
||||
OnActivate = FormActivate
|
||||
OnShow = FormShow
|
||||
Position = poMainFormCenter
|
||||
@ -17,9 +19,9 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label3
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 133
|
||||
Left = 152
|
||||
Height = 15
|
||||
Top = 12
|
||||
Top = 16
|
||||
Width = 62
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
@ -31,25 +33,25 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label3
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 52
|
||||
Left = 68
|
||||
Height = 15
|
||||
Top = 43
|
||||
Width = 143
|
||||
Top = 47
|
||||
Width = 146
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Salvage value at end of life:'
|
||||
Caption = 'Salvage Value at End of Life:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = LifeEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Left = 24
|
||||
Height = 15
|
||||
Top = 74
|
||||
Width = 187
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Number of Periods of life Expected:'
|
||||
Top = 78
|
||||
Width = 190
|
||||
BorderSpacing.Left = 24
|
||||
Caption = 'Number of Periods of Life Expected:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label4: TLabel
|
||||
@ -57,9 +59,9 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label3
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 50
|
||||
Left = 69
|
||||
Height = 15
|
||||
Top = 105
|
||||
Top = 109
|
||||
Width = 145
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
@ -67,13 +69,14 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
ParentColor = False
|
||||
end
|
||||
object Label5: TLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = DepreciationEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label3
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 17
|
||||
Left = 36
|
||||
Height = 15
|
||||
Top = 144
|
||||
Top = 148
|
||||
Width = 178
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
@ -85,13 +88,13 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = LifeEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 203
|
||||
Left = 222
|
||||
Height = 23
|
||||
Top = 8
|
||||
Width = 80
|
||||
Top = 12
|
||||
Width = 126
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Top = 12
|
||||
TabOrder = 0
|
||||
Text = 'CostEdit'
|
||||
end
|
||||
@ -101,15 +104,15 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = LifeEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 203
|
||||
Left = 222
|
||||
Height = 23
|
||||
Top = 39
|
||||
Width = 80
|
||||
Top = 43
|
||||
Width = 126
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
TabOrder = 1
|
||||
Text = 'Edit1'
|
||||
Text = 'SalvageEdit'
|
||||
end
|
||||
object LifeEdit: TEdit
|
||||
AnchorSideLeft.Control = Label3
|
||||
@ -118,71 +121,72 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 203
|
||||
Left = 222
|
||||
Height = 23
|
||||
Top = 70
|
||||
Width = 80
|
||||
Top = 74
|
||||
Width = 126
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Right = 24
|
||||
OnChange = LifeEditChange
|
||||
TabOrder = 2
|
||||
Text = 'Edit1'
|
||||
Text = 'LifeEdit'
|
||||
end
|
||||
object PeriodEdit: TEdit
|
||||
AnchorSideLeft.Control = LifeEdit
|
||||
AnchorSideTop.Control = LifeEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = LifeEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 203
|
||||
AnchorSideRight.Control = PrevBtn
|
||||
Left = 222
|
||||
Height = 23
|
||||
Top = 101
|
||||
Width = 80
|
||||
Top = 105
|
||||
Width = 76
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 2
|
||||
TabOrder = 3
|
||||
Text = 'Edit1'
|
||||
Text = 'PeriodEdit'
|
||||
end
|
||||
object DepreciationEdit: TEdit
|
||||
AnchorSideLeft.Control = LifeEdit
|
||||
AnchorSideTop.Control = PeriodEdit
|
||||
AnchorSideTop.Control = Bevel2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = LifeEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 203
|
||||
Left = 222
|
||||
Height = 23
|
||||
Top = 140
|
||||
Width = 80
|
||||
Top = 144
|
||||
Width = 126
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Top = 6
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 4
|
||||
Text = 'Edit1'
|
||||
end
|
||||
object ReturnBtn: TButton
|
||||
object CloseBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 218
|
||||
Left = 305
|
||||
Height = 25
|
||||
Top = 179
|
||||
Width = 61
|
||||
Top = 191
|
||||
Width = 55
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Return'
|
||||
ModalResult = 1
|
||||
TabOrder = 5
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
TabOrder = 8
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -192,46 +196,47 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 163
|
||||
Width = 291
|
||||
Top = 175
|
||||
Width = 372
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideRight.Control = ReturnBtn
|
||||
Left = 134
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
Left = 221
|
||||
Height = 25
|
||||
Top = 179
|
||||
Top = 191
|
||||
Width = 76
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 6
|
||||
TabOrder = 7
|
||||
end
|
||||
object ResetBtn: TButton
|
||||
AnchorSideTop.Control = ReturnBtn
|
||||
AnchorSideTop.Control = CloseBtn
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
Left = 72
|
||||
Left = 159
|
||||
Height = 25
|
||||
Top = 179
|
||||
Top = 191
|
||||
Width = 54
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 7
|
||||
TabOrder = 6
|
||||
end
|
||||
object HelpBtn: TButton
|
||||
Tag = 149
|
||||
AnchorSideTop.Control = ResetBtn
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
Left = 13
|
||||
Left = 100
|
||||
Height = 25
|
||||
Top = 179
|
||||
Top = 191
|
||||
Width = 51
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -239,6 +244,44 @@ object SumYrsDepFrm: TSumYrsDepFrm
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Help'
|
||||
OnClick = HelpBtnClick
|
||||
TabOrder = 8
|
||||
TabOrder = 5
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
AnchorSideLeft.Control = Label5
|
||||
AnchorSideTop.Control = PeriodEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = NextBtn
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 36
|
||||
Height = 8
|
||||
Top = 130
|
||||
Width = 312
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 2
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object PrevBtn: TSpeedButton
|
||||
AnchorSideTop.Control = PeriodEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = NextBtn
|
||||
Left = 300
|
||||
Height = 22
|
||||
Top = 105
|
||||
Width = 23
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 2
|
||||
Caption = '<'
|
||||
OnClick = PrevBtnClick
|
||||
end
|
||||
object NextBtn: TSpeedButton
|
||||
AnchorSideTop.Control = PeriodEdit
|
||||
AnchorSideRight.Control = CostEdit
|
||||
Left = 325
|
||||
Height = 22
|
||||
Top = 105
|
||||
Width = 23
|
||||
Anchors = [akTop]
|
||||
Caption = '>'
|
||||
OnClick = NextBtnClick
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, ExtCtrls, Math, ContextHelpUnit;
|
||||
StdCtrls, ExtCtrls, Buttons, Math, ContextHelpUnit;
|
||||
|
||||
type
|
||||
|
||||
@ -14,10 +14,11 @@ type
|
||||
|
||||
TSumYrsDepFrm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
Bevel2: TBevel;
|
||||
HelpBtn: TButton;
|
||||
ResetBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
ReturnBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
CostEdit: TEdit;
|
||||
SalvageEdit: TEdit;
|
||||
LifeEdit: TEdit;
|
||||
@ -28,14 +29,20 @@ type
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
Label5: TLabel;
|
||||
PrevBtn: TSpeedButton;
|
||||
NextBtn: TSpeedButton;
|
||||
procedure ComputeBtnClick(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure HelpBtnClick(Sender: TObject);
|
||||
procedure LifeEditChange(Sender: TObject);
|
||||
procedure NextBtnClick(Sender: TObject);
|
||||
procedure PrevBtnClick(Sender: TObject);
|
||||
procedure ResetBtnClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
function SYDDepreciation(Cost, Salvage: Extended; Life, Period: Integer): Extended;
|
||||
procedure UpdateBtnStates;
|
||||
function Validate(out AMsg: String; out AControl: TWinControl): Boolean;
|
||||
public
|
||||
{ public declarations }
|
||||
@ -50,11 +57,12 @@ implementation
|
||||
|
||||
procedure TSumYrsDepFrm.ResetBtnClick(Sender: TObject);
|
||||
begin
|
||||
CostEdit.Text := '';
|
||||
SalvageEdit.Text := '';
|
||||
LifeEdit.Text := '';
|
||||
DepreciationEdit.Text := '';
|
||||
PeriodEdit.Text := '';
|
||||
CostEdit.Text := '';
|
||||
SalvageEdit.Text := '';
|
||||
LifeEdit.Text := '';
|
||||
DepreciationEdit.Text := '';
|
||||
PeriodEdit.Text := '1';
|
||||
UpdateBtnstates;
|
||||
end;
|
||||
|
||||
procedure TSumYrsDepFrm.ComputeBtnClick(Sender: TObject);
|
||||
@ -88,11 +96,11 @@ begin
|
||||
Constraints.MaxHeight := Height;
|
||||
Constraints.MinWidth := Width;
|
||||
|
||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, ReturnBtn.Width]);
|
||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||
HelpBtn.Constraints.MinWidth := w;
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
ReturnBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
end;
|
||||
|
||||
procedure TSumYrsDepFrm.FormShow(Sender: TObject);
|
||||
@ -107,12 +115,41 @@ begin
|
||||
ContextHelpForm.HelpMessage((Sender as TButton).tag);
|
||||
end;
|
||||
|
||||
procedure TSumYrsDepFrm.LifeEditChange(Sender: TObject);
|
||||
begin
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
procedure TSumYrsDepFrm.NextBtnClick(Sender: TObject);
|
||||
var
|
||||
p, np: Integer;
|
||||
begin
|
||||
if TryStrToInt(PeriodEdit.Text, p) and TryStrToInt(LifeEdit.Text, np) and (p < np) then
|
||||
begin
|
||||
inc(p);
|
||||
PeriodEdit.Text := IntToStr(p);
|
||||
end;
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
procedure TSumYrsDepFrm.PrevBtnClick(Sender: TObject);
|
||||
var
|
||||
p: Integer;
|
||||
begin
|
||||
if TryStrToInt(PeriodEdit.Text, p) and (p > 1) then
|
||||
begin
|
||||
dec(p);
|
||||
PeriodEdit.Text := IntToStr(p);
|
||||
end;
|
||||
UpdateBtnStates;
|
||||
end;
|
||||
|
||||
{ SYD = (cost - salvage) * (life - period + 1) / (life*(life + 1)/2)
|
||||
Note: life*(life+1)/2 = 1+2+3+...+life "sum of years"
|
||||
The depreciation factor varies from life/sum_of_years in first period = 1
|
||||
down to 1/sum_of_years in last period = life.
|
||||
Total depreciation over life is cost-salvage.}
|
||||
function TSumYrsDepFrm.SYDDepreciation(Cost, Salvage: Extended; Life, Period: Integer): Extended;
|
||||
{ SYD = (cost - salvage) * (life - period + 1) / (life*(life + 1)/2) }
|
||||
{ Note: life*(life+1)/2 = 1+2+3+...+life "sum of years"
|
||||
The depreciation factor varies from life/sum_of_years in first period = 1
|
||||
downto 1/sum_of_years in last period = life.
|
||||
Total depreciation over life is cost-salvage.}
|
||||
var
|
||||
X1, X2: Extended;
|
||||
begin
|
||||
@ -185,6 +222,15 @@ begin
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
procedure TSumYrsDepFrm.UpdateBtnStates;
|
||||
var
|
||||
p: Integer = 0;
|
||||
np: Integer = 0;
|
||||
begin
|
||||
PrevBtn.Enabled := TryStrToInt(PeriodEdit.Text, p) and (p > 1);
|
||||
NextBtn.Enabled := TryStrToInt(LifeEdit.Text, np) and (p < np);
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I sumyrsdepunit.lrs}
|
||||
|
||||
|
Reference in New Issue
Block a user