blend_spreadsheet_loan_generator 0.1.41 → 0.1.42
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b00db62c718e38412c067656409ac37d1fdcf8c9b4d5a9c9699ca192e3607b14
|
4
|
+
data.tar.gz: 364c5ef55c018309ee0492ca1608c069259bccb7ea2d71d483a2ed03dc0c4a6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7852e9e3f19fdadd753878ac77ffa2a26175890f7b85ea338e260158580b6482637b1d03ed4af6c3528ae1928a1511218500aa3de8eaaf3bd3ab7e8b16def27b
|
7
|
+
data.tar.gz: 596d3dc61d9f379e89b4ac08dcc59e245a3192efc530df68f43818a354d2273eb5f5bca277b7a7167484fadf0b0cf99cf2efca283ce4540cf30b2962039d3c3d
|
@@ -87,13 +87,20 @@ module BlendSpreadsheetLoanGenerator
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
def custom_early_repayment
|
91
|
+
%w[
|
92
|
+
period_calculated_fees
|
93
|
+
capitalized_fees_end
|
94
|
+
]
|
95
|
+
end
|
96
|
+
|
90
97
|
def apply_formulas(worksheet:, early_repayment: true)
|
91
98
|
columns.each.with_index do |title, column|
|
92
99
|
worksheet[1, column + 1] = title
|
93
100
|
end
|
94
101
|
loan.duration.times do |line|
|
95
102
|
columns.each.with_index do |title, column|
|
96
|
-
if early_repayment && title
|
103
|
+
if early_repayment && title.in?(custom_early_repayment)
|
97
104
|
worksheet[line + 2, column + 1] = @formula.send("#{title}_formula", line: line + 2, early_repayment: true)
|
98
105
|
else
|
99
106
|
worksheet[line + 2, column + 1] = @formula.send("#{title}_formula", line: line + 2)
|
@@ -168,6 +168,10 @@ module BlendSpreadsheetLoanGenerator
|
|
168
168
|
worksheet[2, columns.index('period_reimbursed_guaranteed_fees') + 1] =
|
169
169
|
excel_float(guaranteed_fees_paid)
|
170
170
|
|
171
|
+
worksheet[2, columns.index('period_calculated_fees') + 1] =
|
172
|
+
excel_float(0.0)
|
173
|
+
|
174
|
+
|
171
175
|
apply_formats(worksheet: worksheet)
|
172
176
|
|
173
177
|
worksheet.save
|
@@ -207,11 +207,12 @@ module BlendSpreadsheetLoanGenerator
|
|
207
207
|
"=ARRONDI(#{capitalized_fees_end(line - 1)}; 2)"
|
208
208
|
end
|
209
209
|
|
210
|
-
def capitalized_fees_end_formula(line:)
|
210
|
+
def capitalized_fees_end_formula(line:, early_repayment: false)
|
211
211
|
term = line - 1
|
212
212
|
if term <= loan.deferred_and_capitalized
|
213
|
-
|
214
|
-
|
213
|
+
index = early_repayment ? index(line - 1) : index(line)
|
214
|
+
with_fees = "#{remaining_capital_start(line)} * (1 + #{period_fees_rate(line)} + #{period_rate(line)})^#{index}"
|
215
|
+
without_fees = "#{remaining_capital_start(line)} * (1 + #{period_rate(line)})^#{index}"
|
215
216
|
"=ARRONDI(#{with_fees} - #{without_fees}; 2)"
|
216
217
|
else
|
217
218
|
"=ARRONDI(#{capitalized_fees_start(line)} - #{period_reimbursed_capitalized_fees(line)}; 2)"
|