blend_spreadsheet_loan_generator 0.1.33 → 0.1.34

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: caf298e238200e25827511da7dac19fb3632a4e4a85b1ea86f16323dd2e28b58
4
- data.tar.gz: 52fc113243acc66cc02c65016871ba435cbeb70762b28d9240e07afb0a27dbd9
3
+ metadata.gz: 8afe8c32a76a11a3afd5fd90cc9c5728116650fdb99c3d68cbc9a69c6016d671
4
+ data.tar.gz: d727c22901f61615b4ef4cb592fe9f357dfbe1dfb65ca3fccb6a9b3ef1149b76
5
5
  SHA512:
6
- metadata.gz: a41171c8bda9961b3b483fdc911a2eca6c0e7cd7d7fa47824e14d306f8d65316c6a9a8ec8e00fe16d25e0d9927d990664f69d75c0728d2c8608586dfde06fe72
7
- data.tar.gz: 9bf8c3e0e21dc5f5419d90db5fd3be45032bf6f485c9cf4c077d441acfa443f73a7e16102fd4c2bba751ac21351fa50530debd677ef240a82ec446977caa7a66
6
+ metadata.gz: bd1c6e2922917ca77eb25f0bb316e9e693d1ecf8a6abddfbeb174c5facd778ad01979233af173bcaa822ee2f45805641738ebffd8657ef865645ddfc0aa2d139
7
+ data.tar.gz: 89a27d018920a740a9813a016fdc12bc183a10deabd001bd029274cfb9c384d1728401093e6ff1aff51abcaf2c437ecdbd8169d56fa6fb77346a517b590756d5
@@ -163,21 +163,30 @@ module BlendSpreadsheetLoanGenerator
163
163
  term = line - 1
164
164
  if term <= loan.deferred_and_capitalized
165
165
  excel_float(0.0)
166
+ elsif loan.deferred_and_capitalized > 0 && loan.deferred.present?
167
+
166
168
  else
167
169
  "=ARRONDI(#{period_calculated_fees(line)}; 2)"
168
170
  end
169
171
  end
170
172
 
171
173
  def period_calculated_fees_formula(line:)
172
- amount_to_capitalize = [
173
- '(',
174
- remaining_capital_start(line),
175
- '+',
176
- capitalized_interests_start(line),
177
- ')'
178
- ].join(' ')
179
-
180
- "=#{amount_to_capitalize} * #{period_fees_rate(line)}"
174
+ term = line - 1
175
+ if loan.deferred_and_capitalized > 0 && term > loan.deferred_and_capitalized
176
+ with_fees = "#{remaining_capital_start(line: line)} * (1 + #{period_rate(line: line)} + #{period_fees_rate(line: line)})^#{loan.deferred_and_capitalized} * (#{period_rate(line: line)} + #{period_fees_rate(line: line)})"
177
+ without_fees = "#{remaining_capital_start(line: line)} * (1 + #{period_rate(line: line)})^#{loan.deferred_and_capitalized} * #{period_rate(line: line)}"
178
+ "=#{with_fees} - #{without_fees}"
179
+ else
180
+ amount_to_capitalize = [
181
+ '(',
182
+ remaining_capital_start(line),
183
+ '+',
184
+ capitalized_interests_start(line),
185
+ ')'
186
+ ].join(' ')
187
+
188
+ "=#{amount_to_capitalize} * #{period_fees_rate(line)}"
189
+ end
181
190
  end
182
191
 
183
192
  def capitalized_fees_start_formula(line:)
@@ -1,7 +1,7 @@
1
1
  require 'dry/cli'
2
2
 
3
3
  module BlendSpreadsheetLoanGenerator
4
- VERSION = '0.1.33'.freeze
4
+ VERSION = '0.1.34'.freeze
5
5
 
6
6
  class Version < Dry::CLI::Command
7
7
  desc 'Print version'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blend_spreadsheet_loan_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.33
4
+ version: 0.1.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - MZiserman