lucabook 0.2.20 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cgi/escape'
3
4
  require 'csv'
5
+ require 'mail'
4
6
  require 'pathname'
5
7
  require 'date'
6
8
  require 'luca_support'
@@ -15,31 +17,18 @@ module LucaBook
15
17
  @dirname = 'journals'
16
18
  @record_type = 'raw'
17
19
 
18
- attr_reader :statement
20
+ attr_reader :statement, :pl_data, :bs_data, :start_balance
19
21
 
20
- def initialize(data, count = nil, date: nil)
21
- @data = data
22
+ def initialize(data, count = nil, start_d: nil, end_d: nil)
23
+ @monthly = data
22
24
  @count = count
23
25
  @dict = LucaRecord::Dict.load('base.tsv')
24
- @start_date = date
26
+ @start_date = start_d
27
+ @end_date = end_d
25
28
  @start_balance = set_balance
26
29
  end
27
30
 
28
- # TODO: not compatible with LucaRecord::Base.open_records
29
- def search_tag(code)
30
- count = 0
31
- Dir.children(LucaSupport::Config::Pjdir).sort.each do |dir|
32
- next if ! FileTest.directory?(LucaSupport::Config::Pjdir+dir)
33
-
34
- open_records(datadir, dir, 3) do |row, i|
35
- next if i == 2
36
- count += 1 if row.include?(code)
37
- end
38
- end
39
- puts "#{code}: #{count}"
40
- end
41
-
42
- def self.term(from_year, from_month, to_year = from_year, to_month = from_month)
31
+ def self.range(from_year, from_month, to_year = from_year, to_month = from_month)
43
32
  date = Date.new(from_year.to_i, from_month.to_i, -1)
44
33
  last_date = Date.new(to_year.to_i, to_month.to_i, -1)
45
34
  raise 'invalid term specified' if date > last_date
@@ -53,39 +42,41 @@ module LucaBook
53
42
  date = Date.new(date.next_month.year, date.next_month.month, -1)
54
43
  end
55
44
  end
56
- new(reports, counts, date: Date.new(from_year.to_i, from_month.to_i, -1))
45
+ new(reports, counts,
46
+ start_d: Date.new(from_year.to_i, from_month.to_i, 1),
47
+ end_d: Date.new(to_year.to_i, to_month.to_i, -1)
48
+ )
57
49
  end
58
50
 
59
- def by_code(code, year=nil, month=nil)
60
- raise 'not supported year range yet' if ! year.nil? && month.nil?
61
-
62
- balance = @book.load_start.dig(code) || 0
63
- full_term = self.class.scan_terms
64
- if ! month.nil?
65
- pre_term = full_term.select { |y, m| y <= year.to_i && m < month.to_i }
66
- balance += pre_term.map { |y, m| self.class.net(y, m)}.inject(0){|sum, h| sum + h[code] }
67
- [{ code: code, balance: balance, note: "#{code} #{@dict.dig(code, :label)}" }] + records_with_balance(year, month, code, balance)
68
- else
69
- start = { code: code, balance: balance, note: "#{code} #{@dict.dig(code, :label)}" }
70
- full_term.map { |y, m| y }.uniq.map { |y|
71
- records_with_balance(y, nil, code, balance)
72
- }.flatten.prepend(start)
73
- end
74
- end
51
+ def self.by_code(code, from_year, from_month, to_year = from_year, to_month = from_month)
52
+ date = Date.new(from_year.to_i, from_month.to_i, -1)
53
+ last_date = Date.new(to_year.to_i, to_month.to_i, -1)
54
+ raise 'invalid term specified' if date > last_date
75
55
 
76
- def records_with_balance(year, month, code, balance)
77
- @book.search(year, month, nil, code).each do |h|
78
- balance += Util.calc_diff(Util.amount_by_code(h[:debit], code), code) - Util.calc_diff(Util.amount_by_code(h[:credit], code), code)
79
- h[:balance] = balance
56
+ reports = [].tap do |r|
57
+ while date <= last_date do
58
+ diff = {}.tap do |h|
59
+ g = gross(date.year, date.month, code: code)
60
+ sum = g.dig(:debit).nil? ? BigDecimal('0') : Util.calc_diff(g[:debit], code)
61
+ sum -= g.dig(:credit).nil? ? BigDecimal('0') : Util.calc_diff(g[:credit], code)
62
+ h['code'] = code
63
+ h['label'] = LucaRecord::Dict.load('base.tsv').dig(code, :label)
64
+ h['net'] = sum
65
+ h['debit_amount'] = g[:debit]
66
+ h['debit_count'] = g[:debit_count]
67
+ h['credit_amount'] = g[:credit]
68
+ h['credit_count'] = g[:credit_count]
69
+ h['_d'] = date.to_s
70
+ end
71
+ r << diff
72
+ date = Date.new(date.next_month.year, date.next_month.month, -1)
73
+ end
80
74
  end
81
- end
82
-
83
- def to_yaml
84
- YAML.dump(readable(code2label)).tap { |data| puts data }
75
+ LucaSupport::Code.readable(reports)
85
76
  end
86
77
 
87
78
  def code2label
88
- @statement ||= @data
79
+ @statement ||= @monthly
89
80
  @statement.map do |report|
90
81
  {}.tap do |h|
91
82
  report.each { |k, v| h[@dict.dig(k, :label) || k] = v }
@@ -114,39 +105,52 @@ module LucaBook
114
105
  end
115
106
  keys.map! { |k| k[0, level] }.uniq.select! { |k| k.length <= level } if level
116
107
  @count.prepend({}.tap { |header| keys.each { |k| header[k] = @dict.dig(k, :label) }})
117
- puts YAML.dump(@count)
118
108
  @count
119
109
  end
120
110
 
111
+ # TODO: pl/bs may not be immutable
112
+ def report_mail(level = 3)
113
+ @company = CONFIG.dig('company', 'name')
114
+ {}.tap do |res|
115
+ pl(level).reverse.each do |month|
116
+ month.each do |k, v|
117
+ res[k] ||= []
118
+ res[k] << v
119
+ end
120
+ end
121
+ @months = res['_d']
122
+ @pl = res.select{ |k,v| k != '_d' }
123
+ end
124
+ @bs = bs
125
+
126
+ mail = Mail.new
127
+ mail.to = CONFIG.dig('mail', 'preview') || CONFIG.dig('mail', 'from')
128
+ mail.subject = 'Financial Report available'
129
+ mail.html_part = Mail::Part.new(body: render_erb(search_template('monthly-report.html.erb')), content_type: 'text/html; charset=UTF-8')
130
+ LucaSupport::Mail.new(mail, PJDIR).deliver
131
+ end
132
+
121
133
  def bs(level = 3, legal: false)
122
- @start_balance.keys.each { |k| @data.first[k] ||= 0 }
123
- @data.map! { |data| data.select { |k, _v| k.length <= level } }
124
- @data.map! { |data| code_sum(data).merge(data) } if legal
125
- base = accumulate_balance(@data)
134
+ set_bs(level, legal: legal)
135
+ base = accumulate_balance(@bs_data)
126
136
  rows = [base[:debit].length, base[:credit].length].max
127
137
  @statement = [].tap do |a|
128
138
  rows.times do |i|
129
139
  {}.tap do |res|
130
140
  res['debit_label'] = base[:debit][i] ? @dict.dig(base[:debit][i].keys[0], :label) : ''
131
- res['debit_balance'] = base[:debit][i] ? (@start_balance.dig(base[:debit][i].keys[0]) || 0) + base[:debit][i].values[0] : ''
132
- res['debit_diff'] = base[:debit][i] ? base[:debit][i].values[0] : ''
141
+ #res['debit_balance'] = base[:debit][i] ? (@start_balance.dig(base[:debit][i].keys[0]) || 0) + base[:debit][i].values[0] : ''
142
+ res['debit_balance'] = base[:debit][i] ? base[:debit][i].values[0] : ''
133
143
  res['credit_label'] = base[:credit][i] ? @dict.dig(base[:credit][i].keys[0], :label) : ''
134
- res['credit_balance'] = base[:credit][i] ? (@start_balance.dig(base[:credit][i].keys[0]) || 0) + base[:credit][i].values[0] : ''
135
- res['credit_diff'] = base[:credit][i] ? base[:credit][i].values[0] : ''
144
+ #res['credit_balance'] = base[:credit][i] ? (@start_balance.dig(base[:credit][i].keys[0]) || 0) + base[:credit][i].values[0] : ''
145
+ res['credit_balance'] = base[:credit][i] ? base[:credit][i].values[0] : ''
136
146
  a << res
137
147
  end
138
148
  end
139
149
  end
140
- puts YAML.dump(readable(@statement))
141
- self
150
+ readable(@statement)
142
151
  end
143
152
 
144
- def accumulate_balance(monthly_diffs)
145
- data = monthly_diffs.each_with_object({}) do |month, h|
146
- month.each do |k, v|
147
- h[k] = h[k].nil? ? v : h[k] + v
148
- end
149
- end
153
+ def accumulate_balance(data)
150
154
  { debit: [], credit: [] }.tap do |res|
151
155
  data.sort.to_h.each do |k, v|
152
156
  case k
@@ -160,29 +164,14 @@ module LucaBook
160
164
  end
161
165
 
162
166
  def pl(level = 2)
163
- term_keys = @data.inject([]) { |a, data| a + data.keys }
164
- .compact.select { |k| /^[A-H_].+/.match(k) }
165
- fy = @start_balance.select { |k, _v| /^[A-H].+/.match(k) }
166
- keys = (term_keys + fy.keys).uniq.sort
167
- keys.select! { |k| k.length <= level }
168
- @statement = @data.map do |data|
167
+ set_pl(level)
168
+ @statement = @monthly.map do |data|
169
169
  {}.tap do |h|
170
- keys.each { |k| h[k] = data[k] || BigDecimal('0') }
170
+ @pl_data.keys.each { |k| h[k] = data[k] || BigDecimal('0') }
171
171
  end
172
172
  end
173
- term = @statement.each_with_object({}) do |item, h|
174
- item.each do |k, v|
175
- h[k] = h[k].nil? ? v : h[k] + v if /^[^_]/.match(k)
176
- end
177
- end
178
- fy = {}.tap do |h|
179
- keys.each do |k|
180
- h[k] = BigDecimal(fy[k] || '0') + BigDecimal(term[k] || '0')
181
- end
182
- end
183
- @statement << term.tap { |h| h['_d'] = 'Period Total' }
184
- @statement << fy.tap { |h| h['_d'] = 'FY Total' }
185
- self
173
+ @statement << @pl_data
174
+ readable(code2label)
186
175
  end
187
176
 
188
177
  def self.accumulate_term(start_year, start_month, end_year, end_month)
@@ -191,14 +180,11 @@ module LucaBook
191
180
  return nil if date > last_date
192
181
 
193
182
  {}.tap do |res|
194
- while date <= last_date do
195
- diff, _count = net(date.year, date.month)
196
- diff.each do |k, v|
197
- next if /^[_]/.match(k)
183
+ diff, _count = net(date.year, date.month, last_date.year, last_date.month)
184
+ diff.each do |k, v|
185
+ next if /^[_]/.match(k)
198
186
 
199
- res[k] = res[k].nil? ? v : res[k] + v
200
- end
201
- date = date.next_month
187
+ res[k] = res[k].nil? ? v : res[k] + v
202
188
  end
203
189
  end
204
190
  end
@@ -228,19 +214,22 @@ module LucaBook
228
214
 
229
215
  report['9142'] = (report['9142'] || BigDecimal('0')) + res['HA']
230
216
  res['9142'] = report['9142']
231
- res['10'] = sum_matched(report, /^[123][0-9A-Z]{2,}/)
232
- res['40'] = sum_matched(report, /^[4][0-9A-Z]{2,}/)
217
+ res['10'] = sum_matched(report, /^[12][0-9A-Z]{2,}/)
218
+ jp_4v = sum_matched(report, /^[4][V]{2,}/) # deferred assets for JP GAAP
219
+ res['30'] = sum_matched(report, /^[34][0-9A-Z]{2,}/) - jp_4v
220
+ res['4V'] = jp_4v if CONFIG['country'] == 'jp'
233
221
  res['50'] = sum_matched(report, /^[56][0-9A-Z]{2,}/)
234
222
  res['70'] = sum_matched(report, /^[78][0-9A-Z]{2,}/)
235
223
  res['91'] = sum_matched(report, /^91[0-9A-Z]{1,}/)
236
224
  res['8ZZ'] = res['50'] + res['70']
237
225
  res['9ZZ'] = sum_matched(report, /^[9][0-9A-Z]{2,}/)
238
226
 
239
- res['1'] = res['10'] + res['40']
227
+ res['1'] = res['10'] + res['30']
240
228
  res['5'] = res['8ZZ'] + res['9ZZ']
241
229
  res['_d'] = report['_d']
242
230
 
243
231
  report.each do |k, v|
232
+ res[k] ||= sum_matched(report, /^#{k}[0-9A-Z]{1,}/) if k.length == 2
244
233
  res[k] = v if k.length == 3
245
234
  end
246
235
 
@@ -251,6 +240,7 @@ module LucaBook
251
240
  else
252
241
  res[k[0, 3]] = v
253
242
  end
243
+ res[k] = v
254
244
  end
255
245
  end
256
246
  res.sort.to_h
@@ -265,14 +255,16 @@ module LucaBook
265
255
 
266
256
  def set_balance
267
257
  pre_last = @start_date.prev_month
268
- pre = if @start_date.month > LucaSupport::CONFIG['fy_start'].to_i
269
- self.class.accumulate_term(pre_last.year, LucaSupport::CONFIG['fy_start'], pre_last.year, pre_last.month)
270
- elsif @start_date.month < LucaSupport::CONFIG['fy_start'].to_i
271
- self.class.accumulate_term(pre_last.year - 1, LucaSupport::CONFIG['fy_start'], pre_last.year, pre_last.month)
272
- end
258
+ start_year = if @start_date.month > CONFIG['fy_start'].to_i
259
+ pre_last.year
260
+ else
261
+ pre_last.year - 1
262
+ end
263
+ pre = self.class.accumulate_term(start_year, CONFIG['fy_start'], pre_last.year, pre_last.month)
273
264
 
274
265
  base = Dict.latest_balance.each_with_object({}) do |(k, v), h|
275
266
  h[k] = BigDecimal(v[:balance].to_s) if v[:balance]
267
+ h[k] ||= BigDecimal('0') if k.length == 2
276
268
  end
277
269
  if pre
278
270
  idx = (pre.keys + base.keys).uniq
@@ -289,15 +281,17 @@ module LucaBook
289
281
 
290
282
  # for assert purpose
291
283
  #
292
- def self.gross(year, month = nil, code = nil, date_range = nil, rows = 4)
284
+ def self.gross(start_year, start_month, end_year = nil, end_month = nil, code: nil, date_range: nil, rows: 4)
293
285
  if ! date_range.nil?
294
286
  raise if date_range.class != Range
295
287
  # TODO: date based range search
296
288
  end
297
289
 
290
+ end_year ||= start_year
291
+ end_month ||= start_month
298
292
  sum = { debit: {}, credit: {}, debit_count: {}, credit_count: {} }
299
293
  idx_memo = []
300
- asof(year, month) do |f, _path|
294
+ term(start_year, start_month, end_year, end_month, code) do |f, _path|
301
295
  CSV.new(f, headers: false, col_sep: "\t", encoding: 'UTF-8')
302
296
  .each_with_index do |row, i|
303
297
  break if i >= rows
@@ -305,17 +299,23 @@ module LucaBook
305
299
  case i
306
300
  when 0
307
301
  idx_memo = row.map(&:to_s)
302
+ next if code && !idx_memo.include?(code)
303
+
308
304
  idx_memo.each do |r|
309
305
  sum[:debit][r] ||= BigDecimal('0')
310
306
  sum[:debit_count][r] ||= 0
311
307
  end
312
308
  when 1
309
+ next if code && !idx_memo.include?(code)
310
+
313
311
  row.each_with_index do |r, j|
314
312
  sum[:debit][idx_memo[j]] += BigDecimal(r.to_s)
315
313
  sum[:debit_count][idx_memo[j]] += 1
316
314
  end
317
315
  when 2
318
316
  idx_memo = row.map(&:to_s)
317
+ break if code && !idx_memo.include?(code)
318
+
319
319
  idx_memo.each do |r|
320
320
  sum[:credit][r] ||= BigDecimal('0')
321
321
  sum[:credit_count][r] ||= 0
@@ -330,13 +330,19 @@ module LucaBook
330
330
  end
331
331
  end
332
332
  end
333
+ if code
334
+ sum[:debit] = sum[:debit][code] || BigDecimal('0')
335
+ sum[:credit] = sum[:credit][code] || BigDecimal('0')
336
+ sum[:debit_count] = sum[:debit_count][code] || 0
337
+ sum[:credit_count] = sum[:credit_count][code] || 0
338
+ end
333
339
  sum
334
340
  end
335
341
 
336
342
  # netting vouchers in specified term
337
343
  #
338
- def self.net(year, month = nil, code = nil, date_range = nil)
339
- g = gross(year, month, code, date_range)
344
+ def self.net(start_year, start_month, end_year = nil, end_month = nil, code: nil, date_range: nil)
345
+ g = gross(start_year, start_month, end_year, end_month, code: code, date_range: date_range)
340
346
  idx = (g[:debit].keys + g[:credit].keys).uniq.sort
341
347
  count = {}
342
348
  diff = {}.tap do |sum|
@@ -349,23 +355,82 @@ module LucaBook
349
355
  [diff, count]
350
356
  end
351
357
 
352
- # TODO: obsolete in favor of Dict.latest_balance()
353
- def load_start
354
- file = Pathname(LucaSupport::Config::Pjdir) / 'data' / 'balance' / 'start.tsv'
355
- {}.tap do |dict|
356
- LucaRecord::Dict.load_tsv_dict(file).each { |k, v| h[k] = v[:balance] if !v[:balance].nil? }
357
- end
358
+ def render_xbrl(filename = nil)
359
+ set_bs(3, legal: true)
360
+ set_pl(3)
361
+ country_suffix = CONFIG['country'] || 'en'
362
+ @company = CGI.escapeHTML(CONFIG.dig('company', 'name'))
363
+ @balance_sheet_selected = 'true'
364
+ @pl_selected = 'true'
365
+ @capital_change_selected = 'true'
366
+ @issue_date = Date.today
367
+
368
+ prior_bs = @start_balance.filter { |k, _v| /^[9]/.match(k) }
369
+ @xbrl_entries = @bs_data.map{ |k, v| xbrl_line(k, v, prior_bs[k]) }.compact.join("\n")
370
+ @xbrl_entries += @pl_data.map{ |k, v| xbrl_line(k, v) }.compact.join("\n")
371
+ @filename = filename || @issue_date.to_s
372
+
373
+ File.open("#{@filename}.xbrl", 'w') { |f| f.write render_erb(search_template("base-#{country_suffix}.xbrl.erb")) }
374
+ File.open("#{@filename}.xsd", 'w') { |f| f.write render_erb(search_template("base-#{country_suffix}.xsd.erb")) }
375
+ end
376
+
377
+ def xbrl_line(code, amount, prior_amount = nil)
378
+ return nil if /^_/.match(code)
379
+
380
+ context = /^[0-9]/.match(code) ? 'CurrentYearNonConsolidatedInstant' : 'CurrentYearNonConsolidatedDuration'
381
+ tag = @dict.dig(code, :xbrl_id)
382
+ #raise "xbrl_id not found: #{code}" if tag.nil?
383
+ return nil if tag.nil?
384
+ return nil if readable(amount).zero? && prior_amount.nil?
385
+
386
+ prior = prior_amount.nil? ? '' : "<#{tag} decimals=\"0\" unitRef=\"JPY\" contextRef=\"Prior1YearNonConsolidatedInstant\">#{readable(prior_amount)}</#{tag}>\n"
387
+ current = "<#{tag} decimals=\"0\" unitRef=\"JPY\" contextRef=\"#{context}\">#{readable(amount)}</#{tag}>"
388
+
389
+ prior + current
358
390
  end
359
391
 
360
392
  private
361
393
 
394
+ def set_bs(level = 3, legal: false)
395
+ @start_balance.each do |k, v|
396
+ next if /^_/.match(k)
397
+ @monthly.first[k] = (v || 0) + (@monthly.first[k] || 0)
398
+ end
399
+ list = @monthly.map { |data| data.select { |k, _v| k.length <= level } }
400
+ list.map! { |data| code_sum(data).merge(data) } if legal
401
+ @bs_data = list.each_with_object({}) do |month, h|
402
+ month.each do |k, v|
403
+ next if /^_/.match(k)
404
+
405
+ h[k] = (h[k] || BigDecimal('0')) + v
406
+ end
407
+ end
408
+ end
409
+
410
+ def set_pl(level = 2)
411
+ keys = @monthly.inject([]) { |a, data| a + data.keys }
412
+ .compact.select { |k| /^[A-H_].+/.match(k) }
413
+ .uniq.sort
414
+ keys.select! { |k| k.length <= level }
415
+ @pl_data = @monthly.each_with_object({}) do |item, h|
416
+ keys.each do |k|
417
+ h[k] = (h[k] || BigDecimal('0')) + (item[k] || BigDecimal('0')) if /^[^_]/.match(k)
418
+ end
419
+ h['_d'] = 'Period Total'
420
+ end
421
+ end
422
+
362
423
  def legal_items
363
- return [] unless LucaSupport::Config::COUNTRY
424
+ return [] unless CONFIG['country']
364
425
 
365
- case LucaSupport::Config::COUNTRY
426
+ case CONFIG['country']
366
427
  when 'jp'
367
- ['91', '911', '912', '913', '9131', '9132', '914', '9141', '9142', '915', '916', '92', '93']
428
+ ['31', '32', '33', '91', '911', '912', '913', '9131', '9132', '914', '9141', '9142', '915', '916', '92', '93']
368
429
  end
369
430
  end
431
+
432
+ def lib_path
433
+ __dir__
434
+ end
370
435
  end
371
436
  end
@@ -1,57 +1,33 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jpfr-etax-di="http://xml.e-tax.nta.go.jp/jp/fr/etax/o/di/2013-03-25" xmlns:jpfr-oe="http://info.edinet-fsa.go.jp/jp/fr/gaap/o/oe/2012-01-25" xmlns:jppfs_cor="http://disclosure.edinet-fsa.go.jp/taxonomy/jppfs/2019-11-01/jppfs_cor">
3
- <%# eTax spec Begin: conflict with EDINET %>
4
- <xbrli:context_id="CurrentYearNonConsolidatedInstant">
5
- <xbrli:entity>
6
- <xbrli:identifier scheme="http://www.e-tax.nta.go.jp"><%= @company %></xbrli:identifier>
7
- </xbrli:entity>
8
- <xbrli:period>
9
- <xbrli:instant><%= @end_date %></xbrli:instant>
10
- </xbrli:period>
11
- <xbrli:scenario>
12
- <jpfr-oe:NonConsolidated />
13
- </xbrli:scenario>
14
- </xbrli:context>
15
-
16
- <xbrli:context_id="CurrentYearNonConsolidatedDuration">
17
- <xbrli:entity>
18
- <xbrli:identifier scheme="http://www.e-tax.nta.go.jp"><%= @company %></xbrli:identifier>
19
- </xbrli:entity>
20
- <xbrli:period>
21
- <xbrli:startDate><%= @start_date %></xbrli:startDate>
22
- <xbrli:endDate><%= @end_date %></xbrli:endDate>
23
- </xbrli:period>
24
- <xbrli:scenario>
25
- <jpfr-oe:NonConsolidated />
26
- </xbrli:scenario>
27
- </xbrli:context>
2
+ <xbrli:xbrl xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jpfr-etax-di="http://xml.e-tax.nta.go.jp/jp/fr/etax/o/di/2013-03-25" xmlns:jpfr-oe="http://info.edinet-fsa.go.jp/jp/fr/gaap/o/oe/2012-01-25" xmlns:jpfr-t-cte="http://info.edinet-fsa.go.jp/jp/fr/gaap/t/cte/2012-01-25" xmlns:jppfs_cor="http://disclosure.edinet-fsa.go.jp/taxonomy/jppfs/2019-11-01/jppfs_cor" xmlns:jpfr-etax-t-cte="http://xml.e-tax.nta.go.jp/jp/fr/etax/t/cte/2013-03-25">
3
+ <link:schemaRef xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="<%= @filename %>.xsd" />
28
4
 
29
- <xbrli:context_id="Prior1YearNonConsolidatedInstant">
30
- <xbrli:entity>
31
- <xbrli:identifier scheme="http://www.e-tax.nta.go.jp"><%= @company %></xbrli:identifier>
32
- </xbrli:entity>
33
- <xbrli:period>
34
- <xbrli:instant><%= @previous_fy_end_date %></xbrli:instant>
35
- </xbrli:period>
36
- <xbrli:scenario>
37
- <jpfr-oe:NonConsolidated />
38
- </xbrli:scenario>
39
- </xbrli:context>
5
+ <%# eTax spec Begin: conflict with EDINET %>
6
+ <xbrli:context id="Prior1YearNonConsolidatedInstant">
7
+ <xbrli:entity><xbrli:identifier scheme="http://www.e-tax.nta.go.jp/"><%= @company %></xbrli:identifier></xbrli:entity>
8
+ <xbrli:period><xbrli:instant><%= @start_date.prev_day %></xbrli:instant></xbrli:period>
9
+ <xbrli:scenario><jpfr-oe:NonConsolidated /></xbrli:scenario></xbrli:context>
10
+ <xbrli:context id="CurrentYearNonConsolidatedInstant">
11
+ <xbrli:entity><xbrli:identifier scheme="http://www.e-tax.nta.go.jp/"><%= @company %></xbrli:identifier></xbrli:entity>
12
+ <xbrli:period><xbrli:instant><%= @end_date %></xbrli:instant></xbrli:period>
13
+ <xbrli:scenario> <jpfr-oe:NonConsolidated /></xbrli:scenario></xbrli:context>
14
+ <xbrli:context id="CurrentYearNonConsolidatedDuration">
15
+ <xbrli:entity><xbrli:identifier scheme="http://www.e-tax.nta.go.jp/"><%= @company %></xbrli:identifier></xbrli:entity>
16
+ <xbrli:period><xbrli:startDate><%= @start_date %></xbrli:startDate><xbrli:endDate><%= @end_date %></xbrli:endDate></xbrli:period>
17
+ <xbrli:scenario> <jpfr-oe:NonConsolidated /></xbrli:scenario></xbrli:context>
40
18
  <%# eTax spec End %>
41
19
 
20
+ <%# eTax spec Begin: extra items %>
21
+ <xbrli:context id="DocumentInfo">
22
+ <xbrli:entity><xbrli:identifier scheme="http://www.e-tax.nta.go.jp/"><%= @company %></xbrli:identifier></xbrli:entity>
23
+ <xbrli:period><xbrli:instant><%= @issue_date %></xbrli:instant></xbrli:period>
24
+ </xbrli:context>
25
+
42
26
  <xbrli:unit id="JPY">
43
27
  <xbrli:measure>iso4217:JPY</xbrli:measure>
44
28
  </xbrli:unit>
45
29
 
46
- <%# eTax spec Begin: extra items %>
47
- <xbrli:context_id="DocumentInfo">
48
- <xbrli:entity>
49
- <xbrli:identifier scheme="http://www.e-tax.nta.go.jp"><%= @company %></xbrli:identifier>
50
- </xbrli:entity>
51
- <xbrli:period>
52
- <xbrli:instant><%= @issue_date %></xbrli:instant>
53
- </xbrli:period>
54
- </xbrli:context>
30
+ <jpfr-etax-di:EntityName contextRef="DocumentInfo"><%= @company %></jpfr-etax-di:EntityName>
55
31
  <jpfr-etax-di:NonconsolidatedBalanceSheetsDocInfo contextRef="DocumentInfo"><%= @balance_sheet_selected %></jpfr-etax-di:NonconsolidatedBalanceSheetsDocInfo>
56
32
  <jpfr-etax-di:ExtendedLinkRoleLabelBalanceSheets contextRef="DocumentInfo">http://www.xbrl.org/2003/role/link</jpfr-etax-di:ExtendedLinkRoleLabelBalanceSheets>
57
33
  <jpfr-etax-di:ExtendedLinkRolePresentationBalanceSheets contextRef="DocumentInfo">http://xml.e-tax.nta.go.jp/jp/fr/etax/role/NonConsolidatedBalanceSheets</jpfr-etax-di:ExtendedLinkRolePresentationBalanceSheets>
@@ -62,11 +38,10 @@
62
38
  <jpfr-etax-di:ExtendedLinkRolePresentationStatementsOfIncome contextRef="DocumentInfo">http://xml.e-tax.nta.go.jp/jp/fr/etax/role/NonConsolidatedStatementsOfIncome</jpfr-etax-di:ExtendedLinkRolePresentationStatementsOfIncome>
63
39
  <jpfr-etax-di:ContextIDPeriodStatementsOfIncome contextRef="DocumentInfo">CurrentYearNonConsolidatedDuration</jpfr-etax-di:ContextIDPeriodStatementsOfIncome>
64
40
 
65
-
66
41
  <jpfr-etax-di:NonconsolidatedScheduleOfCostOfGoodsManufacturedDocInfo contextRef="DocumentInfo">false</jpfr-etax-di:NonconsolidatedScheduleOfCostOfGoodsManufacturedDocInfo>
67
42
  <jpfr-etax-di:NonconsolidatedNotesDocInfo contextRef="DocumentInfo">false</jpfr-etax-di:NonconsolidatedNotesDocInfo>
68
43
 
69
- <jpfr-etax-di:NonconsolidatedStatementsOfChangesInNetAssetsDocInfo contextRef="DocumentInfo"><%= @balance_sheet_selected %></jpfr-etax-di:NonconsolidatedStatementsOfChangesInNetAssetsDocInfo>
44
+ <jpfr-etax-di:NonconsolidatedStatementsOfChangesInNetAssetsDocInfo contextRef="DocumentInfo"><%= @capital_change_selected %></jpfr-etax-di:NonconsolidatedStatementsOfChangesInNetAssetsDocInfo>
70
45
  <jpfr-etax-di:ExtendedLinkRoleLabelStatementsOfChangesInNetAssets contextRef="DocumentInfo">http://www.xbrl.org/2003/role/link</jpfr-etax-di:ExtendedLinkRoleLabelStatementsOfChangesInNetAssets>
71
46
  <jpfr-etax-di:ExtendedLinkRolePresentationStatementsOfChangesInNetAssets contextRef="DocumentInfo">http://xml.e-tax.nta.go.jp/jp/fr/etax/role/NonConsolidatedStatementsOfChangesInNetAssets</jpfr-etax-di:ExtendedLinkRolePresentationStatementsOfChangesInNetAssets>
72
47
  <jpfr-etax-di:ContextIDBeginningOfPeriodStatementsOfChangesInNetAssets contextRef="DocumentInfo">Prior1YearNonConsolidatedInstant</jpfr-etax-di:ContextIDBeginningOfPeriodStatementsOfChangesInNetAssets>