luca-jp 0.1.3 → 0.1.4

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: b6d54c44deab442663640f9b11e8abd3e71cf6c9deb5b9e00afd5c059104246d
4
- data.tar.gz: 052d3583d83f6a7ea82df1bc53a75bbfa4b72373d549572eeae3266ccdaf7057
3
+ metadata.gz: 5886bcf2e412190983e76ad28e7f8bd2db42cd7716cd50f2a85c777b067a834c
4
+ data.tar.gz: a5af3fe9b55400dbdff2033acb8c00a8b9289d0a2ed8ebf456664682f5fa2708
5
5
  SHA512:
6
- metadata.gz: 81f56987c7f87af6ae87ac2536118ab9ef58a62b61c133ad8b0b6e3b81704034fbfea485c5fb07382d42791b34c2817224f5354eb7c9076f1e163034bf9a2c9a
7
- data.tar.gz: b2c2edd9429190aaa6617bb4ef316d888be4fb1d85a576d6a5ef09f658c8f8f01c56da656c5c5fc5c2977d4adb67a64f4b4038b8a4e20ef153b9de3b90da1e0c
6
+ metadata.gz: 37780daa7addb21a251c8c7e7f7b887483c48b3315aeb6b4b757b8169e8fdad42fffaf2acb5f9b61d8760a9aca08592d6655ceb887f1d89e28d440e5451244e5
7
+ data.tar.gz: 408768288d8c1b7c3faebfd14fe3227f7d140333f42f060e42f6b7170a3c48b2b898758d60991de771a4c51bcd8e882c10ac47ed77161822b87d43ac752b79a9
data/lib/luca/jp.rb CHANGED
@@ -11,6 +11,7 @@ module Luca
11
11
  autoload :Chihouzei, 'luca/jp/chihouzei'
12
12
  autoload :Common, 'luca/jp/common'
13
13
  autoload :ItPart, 'luca/jp/it_part'
14
+ autoload :Sonshitsu, 'luca/jp/sonshitsu'
14
15
  autoload :Util, 'luca/jp/util'
15
16
  end
16
17
 
data/lib/luca/jp/aoiro.rb CHANGED
@@ -26,6 +26,7 @@ module Luca
26
26
  @issue_date = Date.today
27
27
  @company = CGI.escapeHTML(config.dig('company', 'name'))
28
28
  @software = 'LucaJp'
29
+
29
30
  @税額 = 税額計算
30
31
  @確定法人税額 = @税額.dig(:houjin, :kokuzei)
31
32
  @法人税額 = 中小企業の軽減税額 + 一般区分の税額
@@ -58,10 +59,10 @@ module Luca
58
59
  @事業税期中増, @事業税期中減 = 未納事業税期中増減
59
60
  @納税充当金期中増, @納税充当金期中減 = 納税充当金期中増減
60
61
  @概況売上 = gaikyo('A0')
61
- @form_sec = ['HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 'HOE200', 'HOE990', 'HOI010', 'HOI100', 'HOI141', 'HOK010'].map{ |c| form_rdf(c) }.join('')
62
+ @form_sec = ['HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 別表七フォーム, 'HOE200', 'HOE990', 'HOI010', 'HOI100', 'HOI141', 'HOK010'].compact.map{ |c| form_rdf(c) }.join('')
62
63
  #@extra_form_sec = ['HOI040', 'HOI060', 'HOI090', 'HOI110']
63
64
  @it = it_part
64
- @form_data = [別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表十五, 適用額明細, 預貯金内訳, 仮受金内訳, 役員報酬内訳, 概況説明].join("\n")
65
+ @form_data = [別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表七, 別表十五, 適用額明細, 預貯金内訳, 仮受金内訳, 役員報酬内訳, 概況説明].compact.join("\n")
65
66
  render_erb(search_template('aoiro.xtx.erb'))
66
67
  end
67
68
  end
@@ -129,6 +130,18 @@ module Luca
129
130
  render_erb(search_template('beppyo52.xml.erb'))
130
131
  end
131
132
 
133
+ def 別表七フォーム
134
+ return nil if @繰越損失管理.records.length == 0
135
+
136
+ 'HOB710'
137
+ end
138
+
139
+ def 別表七
140
+ return nil if @繰越損失管理.records.length == 0
141
+
142
+ render_erb(search_template('beppyo7.xml.erb'))
143
+ end
144
+
132
145
  def 別表十五
133
146
  @交際費 = readable(@pl_data.dig('C1B') || 0)
134
147
  @限度額 = @交際費 < 4_000_000 ? @交際費 : 4_000_000
@@ -141,7 +154,7 @@ module Luca
141
154
  next unless /^110[0-9A-Z]/.match(k)
142
155
  next unless readable(v || 0) > 0
143
156
 
144
- h[@dict.dig(k)[:label]] = readable(v)
157
+ h[@@dict.dig(k)[:label]] = readable(v)
145
158
  end
146
159
  render_erb(search_template('yokin-meisai.xml.erb'))
147
160
  end
@@ -212,7 +225,7 @@ module Luca
212
225
  end
213
226
 
214
227
  def 租税公課
215
- readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'C1I')[:debit]) || 0
228
+ readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'C1I')[:debit]['C1I']) || 0
216
229
  end
217
230
 
218
231
  def 別表四還付事業税
@@ -240,8 +253,8 @@ module Luca
240
253
  def 納税充当金期中増減
241
254
  r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '515')
242
255
  [
243
- readable(r[:credit] || 0) + @法人税期中増 + @都道府県民税期中増 + @市民税期中増 + @事業税期中増,
244
- readable(r[:debit] || 0) + @法人税期中減 + @都道府県民税期中減 + @市民税期中減 + @事業税期中減
256
+ readable(r[:credit]['515'] || 0) + @法人税期中増 + @都道府県民税期中増 + @市民税期中増 + @事業税期中増,
257
+ readable(r[:debit]['515'] || 0) + @法人税期中減 + @都道府県民税期中減 + @市民税期中減 + @事業税期中減
245
258
  ]
246
259
  end
247
260
 
@@ -255,7 +268,7 @@ module Luca
255
268
 
256
269
  def 未納法人税期中増減
257
270
  r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5151')
258
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
271
+ [readable(r[:credit]['5151'] || 0), readable(r[:debit]['5151'] || 0)]
259
272
  end
260
273
 
261
274
  # 中間納付した金額のうち税額とならず、還付されるべき額
@@ -284,7 +297,7 @@ module Luca
284
297
 
285
298
  def 未納都道府県民税期中増減
286
299
  r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5153')
287
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
300
+ [readable(r[:credit]['5153'] || 0), readable(r[:debit]['5153'] || 0)]
288
301
  end
289
302
 
290
303
  def 都道府県民税仮払納付
@@ -292,7 +305,7 @@ module Luca
292
305
  end
293
306
 
294
307
  def 都道府県民税損金納付
295
- [確定都道府県住民税, @都道府県民税中間納付].min
308
+ [[確定都道府県住民税, 0].max, @都道府県民税中間納付].min
296
309
  end
297
310
 
298
311
  def 確定市民税
@@ -309,7 +322,7 @@ module Luca
309
322
 
310
323
  def 未納市民税期中増減
311
324
  r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5154')
312
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
325
+ [readable(r[:credit]['5154'] || 0), readable(r[:debit]['5154'] || 0)]
313
326
  end
314
327
 
315
328
  def 市民税仮払納付
@@ -317,7 +330,7 @@ module Luca
317
330
  end
318
331
 
319
332
  def 市民税損金納付
320
- [@市民税中間納付, 確定市民税].min
333
+ [@市民税中間納付, [確定市民税, 0].max].min
321
334
  end
322
335
 
323
336
  def 別表五一期首差引金額
@@ -336,6 +349,29 @@ module Luca
336
349
  期末繰越損益 + @納税充当金期中増 - @法人税期中増 - @都道府県民税期中増 - @市民税期中増
337
350
  end
338
351
 
352
+ def 別表七各期青色損失
353
+ tags = @繰越損失管理.records
354
+ .filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
355
+ .map do |record|
356
+ deduction = record['decrease']&.filter{ |r| r['date'] >= @start_date }&.dig(0, 'val') || 0
357
+ next if deduction == 0 && record['amount'] == 0
358
+
359
+ %Q(<MCB00110>
360
+ <MCB00120>
361
+ #{render_attr('MCB00130', etax_date(record['start_date']))}
362
+ #{render_attr('MCB00140', etax_date(record['end_date']))}
363
+ </MCB00120>
364
+ <MCB00150>
365
+ <MCB00160><kubun_CD>1</kubun_CD></MCB00160>
366
+ </MCB00150>
367
+ #{render_attr('MCB00190', deduction + record['amount'])}
368
+ #{render_attr('MCB00200', deduction)}
369
+ #{render_attr('MCB00210', record['amount'])}
370
+ </MCB00110)
371
+ end
372
+ tags.compact.join("\n")
373
+ end
374
+
339
375
  def 期首資本金
340
376
  readable(@start_balance.dig('911')) || 0
341
377
  end
@@ -362,7 +398,7 @@ module Luca
362
398
 
363
399
  def 未納消費税期中増減
364
400
  r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '516')
365
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
401
+ [readable(r[:credit]['516'] || 0), readable(r[:debit]['516'] || 0)]
366
402
  end
367
403
 
368
404
  def 概況月(idx)
@@ -387,13 +423,13 @@ module Luca
387
423
 
388
424
  def 概況月源泉徴収(idx)
389
425
  target = @start_date.next_month(idx)
390
- readable(LucaBook::State.gross(target.year, target.month, code: '5191')[:credit] || 0)
391
- + readable(LucaBook::State.gross(target.year, target.month, code: '5193')[:credit] || 0)
426
+ readable(LucaBook::State.gross(target.year, target.month, code: '5191')[:credit]['5191'] || 0)
427
+ + readable(LucaBook::State.gross(target.year, target.month, code: '5193')[:credit]['5193'] || 0)
392
428
  end
393
429
 
394
430
  def 概況源泉徴収
395
- readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5191')[:credit] || 0)
396
- + readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5193')[:credit] || 0)
431
+ readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5191')[:credit]['5191'] || 0)
432
+ + readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5193')[:credit]['5193'] || 0)
397
433
  end
398
434
 
399
435
  def gaikyo(code)
@@ -62,9 +62,9 @@ module Luca
62
62
  else
63
63
  @procedure_code = 'R0102100'
64
64
  @procedure_name = '法人都道府県民税・事業税・特別法人事業税又は地方法人特別税 確定申告'
65
- @form_sec = ['R0102AA190', 'R0102AG120'].map{ |c| form_attr(c) }.join('')
65
+ @form_sec = ['R0102AA190', 'R0102AG120', 別表九フォーム].compact.map{ |c| form_attr(c) }.join('')
66
66
  @user_inf = render_erb(search_template('el-userinf.xml.erb'))
67
- @form_data = [第六号, 別表四三].join("\n")
67
+ @form_data = [第六号, 別表四三, 別表九].compact.join("\n")
68
68
  render_erb(search_template('eltax.xml.erb'))
69
69
  end
70
70
  end
@@ -113,6 +113,18 @@ module Luca
113
113
  render_erb(search_template('el-no6-43.xml.erb'))
114
114
  end
115
115
 
116
+ def 別表九フォーム
117
+ return nil if @繰越損失管理.records.length == 0
118
+
119
+ 'R0102AM190'
120
+ end
121
+
122
+ def 別表九
123
+ return nil if @繰越損失管理.records.length == 0
124
+
125
+ render_erb(search_template('el-no6-9.xml.erb'))
126
+ end
127
+
116
128
  private
117
129
 
118
130
  def 法人税割課税標準
@@ -124,6 +136,36 @@ module Luca
124
136
  @所得割中間納付
125
137
  end
126
138
 
139
+ # TODO: 損失の区分
140
+ #
141
+ def 別表九各期青色損失
142
+ tags = @繰越損失管理.records
143
+ .filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
144
+ .map do |record|
145
+ deduction = record['decrease']&.filter{ |r| r['date'] >= @start_date }&.dig(0, 'val') || 0
146
+ next if deduction == 0 && record['amount'] == 0
147
+
148
+ %Q(<AMB00200>
149
+ <AMB00210>#{etax_date(@start_date)}</AMB00210>
150
+ <AMB00220>#{etax_date(@end_date)}</AMB00220>
151
+ <AMB00225 />
152
+ #{render_attr('AMB00230', deduction + record['amount'])}
153
+ #{render_attr('AMB00240', deduction)}
154
+ #{render_attr('AMB00250', record['amount'])}
155
+ </AMB00200>)
156
+ end
157
+ return tags.compact.join("\n") if tags.length > 0
158
+
159
+ %Q(<AMB00200>
160
+ <AMB00210><gen:era /><gen:yy /><gen:mm /><gen:dd /></AMB00210>
161
+ <AMB00220><gen:era /><gen:yy /><gen:mm /><gen:dd /></AMB00220>
162
+ <AMB00225 />
163
+ <AMB00230 />
164
+ <AMB00240 />
165
+ <AMB00250 />
166
+ </AMB00200>)
167
+ end
168
+
127
169
  def form_attr(code)
128
170
  "<FORM_ATTR><FORM_ID>#{code}</FORM_ID><FORM_NAME></FORM_NAME><FORM_FILE_NAME></FORM_FILE_NAME><FORM_XSL_NAME></FORM_XSL_NAME></FORM_ATTR>"
129
171
  end
@@ -31,6 +31,8 @@ module Luca
31
31
 
32
32
  def 中小企業の軽減税率対象所得(所得 = nil)
33
33
  所得 ||= 所得金額
34
+ return 0 if 所得 <= 0
35
+
34
36
  if 所得 >= 8_000_000
35
37
  8_000_000
36
38
  elsif 所得 < 0
@@ -41,11 +43,13 @@ module Luca
41
43
  end
42
44
 
43
45
  def 中小企業の軽減税額(所得 = nil)
44
- 中小企業の軽減税率対象所得(所得) * 15 / 100
46
+ 中小企業の軽減税率対象所得(所得) * 15 / 100
45
47
  end
46
48
 
47
49
  def 中小企業の軽減税率対象を超える所得(所得 = nil)
48
50
  所得 ||= 所得金額
51
+ return 0 if 所得 <= 0
52
+
49
53
  if 所得 <= 8_000_000
50
54
  0
51
55
  else
@@ -61,15 +65,48 @@ module Luca
61
65
  (地方法人税課税標準 * 10.3 / 100).to_i
62
66
  end
63
67
 
68
+ # 繰越損失適用後の所得金額
69
+ #
70
+ def 所得金額
71
+ @繰越損失管理 = Sonshitsu.load(@end_date).update(当期所得金額).save if @繰越損失管理.nil?
72
+ @繰越損失管理.profit
73
+ end
74
+
64
75
  # 税引前当期利益をもとに計算
65
76
  # 消費税を租税公課に計上している場合、控除済みの金額
66
77
  # 未払/未収事業税は精算時に認識
67
78
  #
68
- def 所得金額
79
+ def 当期所得金額
69
80
  _, 納付事業税 = 未納事業税期中増減
70
81
  LucaSupport::Code.readable(@pl_data.dig('GA') - 納付事業税 + 還付事業税)
71
82
  end
72
83
 
84
+ # -----------------------------------------------------
85
+ # :section: 繰越損失の計算
86
+ # -----------------------------------------------------
87
+
88
+ def 期首繰越損失
89
+ @繰越損失管理.records
90
+ .filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
91
+ .inject(0) { |sum, record| sum + (record['amount'] || 0) }
92
+ end
93
+
94
+ def 当期控除計
95
+ @繰越損失管理.deduction
96
+ end
97
+
98
+ def 翌期繰越損失
99
+ @繰越損失管理.records
100
+ .filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
101
+ .inject(0) { |sum, record| sum + (record['amount'] || 0) }
102
+ end
103
+
104
+ def 当期繰越損失
105
+ @繰越損失管理.records
106
+ .filter { |record| record['start_date'] == @start_date }.dig(0, 'increase') || 0
107
+ end
108
+
109
+
73
110
  # -----------------------------------------------------
74
111
  # :section: 地方税額の計算
75
112
  # -----------------------------------------------------
@@ -161,12 +198,12 @@ module Luca
161
198
  end
162
199
 
163
200
  def 還付事業税
164
- LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '1504')[:credit]
201
+ LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '1504')[:credit]['1504']
165
202
  end
166
203
 
167
204
  def 未納事業税期中増減
168
205
  r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5152')
169
- [LucaSupport::Code.readable(r[:credit] || 0), LucaSupport::Code.readable(r[:debit] || 0)]
206
+ [LucaSupport::Code.readable(r[:credit]['5152'] || 0), LucaSupport::Code.readable(r[:debit]['5152'] || 0)]
170
207
  end
171
208
  end
172
209
  end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'date'
4
+ require 'pathname'
5
+ require 'yaml'
6
+ require 'luca_book'
7
+ require 'luca_support/config'
8
+
9
+ module Luca
10
+ module Jp
11
+ # 青色申告に基く繰越損失の計算
12
+ #
13
+ class Sonshitsu
14
+ # 当期控除額
15
+ attr_reader :deduction
16
+ # 控除後所得
17
+ attr_reader :profit
18
+ # 各期繰越損失
19
+ attr_reader :records
20
+
21
+ def initialize(records, date)
22
+ @records = records
23
+ @report_date = date
24
+ net_amount
25
+ @deduction = 0
26
+ @profit = 0
27
+ end
28
+
29
+ # sonshitsu format is as bellows:
30
+ #
31
+ # - start_date: 2020-01-01
32
+ # end_date: 2020-12-31
33
+ # increase: 1000000
34
+ # - start_date: 2021-01-01
35
+ # end_date: 2021-12-31
36
+ # decrease: 800000
37
+ #
38
+ def self.load(this_year)
39
+ records = if File.exist?(record_file)
40
+ YAML.load_file(record_file)
41
+ .filter { |record| record['start_date'] > this_year.prev_year(11) && record['end_date'] < this_year }
42
+ .sort { |a, b| a['start_date'] <=> b['start_date'] }
43
+ else
44
+ []
45
+ end
46
+ new(records, this_year)
47
+ end
48
+
49
+ def save
50
+ File.open(self.class.record_file, 'w') { |f| f.puts YAML.dump(@records)}
51
+ self
52
+ end
53
+
54
+ def update(profit_or_loss)
55
+ return self if profit_or_loss == 0
56
+
57
+ if profit_or_loss < 0
58
+ start_date, end_date = LucaBook::Util.current_fy(@report_date)
59
+ @records << {
60
+ 'start_date' => start_date,
61
+ 'end_date' => end_date,
62
+ 'increase' => profit_or_loss.abs
63
+ }
64
+ @profit = profit_or_loss
65
+ return self
66
+ end
67
+
68
+ @records.each do |record|
69
+ next if profit_or_loss <= 0
70
+ next if record['amount'] <= 0
71
+
72
+ decrease_amount = [record['amount'], profit_or_loss].min
73
+ record['decrease'] ||= []
74
+ record['decrease'] << { 'date' => @report_date, 'val' => decrease_amount }
75
+ record['amount'] -= decrease_amount
76
+ profit_or_loss -= decrease_amount
77
+ @deduction += decrease_amount
78
+ end
79
+ @profit = profit_or_loss
80
+ self
81
+ end
82
+
83
+ def net_amount
84
+ @records.each do |record|
85
+ record['amount'] = record['increase'] - past_decreased(record['decrease'])
86
+ record['decrease'] = record['decrease']&.reject { |decrease_record| decrease_record['date'] > @report_date.prev_year }
87
+ end
88
+ end
89
+
90
+ def past_decreased(decrease_records)
91
+ return 0 if decrease_records.nil?
92
+
93
+ decrease_records.filter { |record| record['date'] <= @report_date.prev_year }
94
+ .map { |record| record['val'] }.sum || 0
95
+ end
96
+
97
+ def self.record_file
98
+ Pathname(LucaSupport::PJDIR) / 'data' / 'balance' / 'sonshitsu.yml'
99
+ end
100
+ end
101
+ end
102
+ end
@@ -12,6 +12,7 @@ module Luca
12
12
  module Jp
13
13
  class Syouhizei < LucaBook::State
14
14
  include LucaSupport::View
15
+ include Luca::Jp::ItPart
15
16
  include Luca::Jp::Util
16
17
 
17
18
  @dirname = 'journals'
@@ -44,11 +44,13 @@
44
44
  <%= render_attr('BGB00200', @法人税中間納付) %>
45
45
  <%= render_attr('BGB00210', 納付税額(@確定法人税額, @法人税中間納付)) %>
46
46
  <BGB00320>
47
- <%= render_attr('BGB00340', 中間還付税額(@確定法人税額, @法人税中間納付)) %>
47
+ <%= render_attr('BGB00340', 中間還付税額(@確定法人税額, @法人税中間納付)) %>
48
48
  <BGB00380>
49
49
  <%= render_attr('BGB00400', 中間還付税額(@確定法人税額, @法人税中間納付)) %>
50
50
  </BGB00380>
51
51
  </BGB00320>
52
+ <%= render_attr('BGB00460', 当期控除計) %>
53
+ <%= render_attr('BGB00470', 翌期繰越損失 + 当期繰越損失) %>
52
54
  </BGB00000>
53
55
  <BGC00000>
54
56
  <BGC00010>
@@ -55,8 +55,12 @@
55
55
  <%= render_attr('ARS00010', @別表四調整所得) %>
56
56
  <%= render_attr('ARS00020', @別表四調整所得) %>
57
57
  </ARS00000>
58
+ <ART00000>
59
+ <%= render_attr('ART00010', @繰越損失管理.deduction) %>
60
+ <%= render_attr('ART00020', @繰越損失管理.deduction) %>
61
+ </ART00000>
58
62
  <ARV00000>
59
- <%= render_attr('ARV00010', @別表四調整所得) %>
60
- <%= render_attr('ARV00020', @別表四調整所得) %>
63
+ <%= render_attr('ARV00010', @別表四調整所得 - @繰越損失管理.deduction) %>
64
+ <%= render_attr('ARV00020', @別表四調整所得 - @繰越損失管理.deduction) %>
61
65
  </ARV00000>
62
66
  </HOA420>
@@ -0,0 +1,31 @@
1
+ <HOB710 page="1" VR="11.0" id="HOB710" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
+ <MCA00000>
3
+ <MCA00010>
4
+ <MCA00020 IDREF="JIGYO_NENDO_FROM"/>
5
+ <MCA00030 IDREF="JIGYO_NENDO_TO"/>
6
+ </MCA00010>
7
+ <MCA00040 IDREF="NOZEISHA_NM"/>
8
+ </MCA00000>
9
+ <MCB00000>
10
+ <%= render_attr('MCB00002', 当期所得金額) %>
11
+ <MCB00004>
12
+ <%= render_attr('MCB00008', [当期所得金額, 0].max) %>
13
+ </MCB00004>
14
+ <%= 別表七各期青色損失 %>
15
+ <MCB00220>
16
+ <%= render_attr('MCB00230', 期首繰越損失) %>
17
+ <%= render_attr('MCB00240', 当期控除計) %>
18
+ <%= render_attr('MCB00250', 翌期繰越損失) %>
19
+ </MCB00220>
20
+ <MCB00260>
21
+ <%= render_attr('MCB00270', 当期繰越損失) %>
22
+ <MCB00280>
23
+ <MCB00330>
24
+ <%= render_attr('MCB00340', 当期繰越損失) %>
25
+ <%= render_attr('MCB00360', 当期繰越損失) %>
26
+ </MCB00330>
27
+ </MCB00280>
28
+ </MCB00260>
29
+ <%= render_attr('MCB00370', 翌期繰越損失 + 当期繰越損失) %>
30
+ </MCB00000>
31
+ </HOB710>
@@ -0,0 +1,51 @@
1
+ <R0102AM190 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="190" page="" seiseiSoft="<%= @software %>" seiseiVr="" seiseiDay="" seiseiNM="" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
2
+ <AMA_JIGYO_SDATE idref="SDATE">
3
+ <gen:era></gen:era><gen:yy></gen:yy><gen:mm></gen:mm><gen:dd></gen:dd>
4
+ <gen:yyyymmdd></gen:yyyymmdd>
5
+ </AMA_JIGYO_SDATE>
6
+ <AMA_JIGYO_EDATE idref="EDATE">
7
+ <gen:era></gen:era><gen:yy></gen:yy><gen:mm></gen:mm><gen:dd></gen:dd>
8
+ <gen:yyyymmdd></gen:yyyymmdd>
9
+ </AMA_JIGYO_EDATE>
10
+ <AMA_NAME idref="NAME"></AMA_NAME>
11
+ <%= render_attr('AMA00100', 当期所得金額) %>
12
+ <%= render_attr('AMA00200', [当期所得金額, 0].max) %>
13
+ <AMB00110>
14
+ <gen:era />
15
+ <gen:yy />
16
+ <gen:mm />
17
+ <gen:dd />
18
+ </AMB00110>
19
+ <AMB00120>
20
+ <gen:era />
21
+ <gen:yy />
22
+ <gen:mm />
23
+ <gen:dd />
24
+ </AMB00120>
25
+ <AMB00125 />
26
+ <AMB00130 />
27
+ <AMB00140 />
28
+ <%= 別表九各期青色損失 %>
29
+ <%= render_attr('AMB00430', 期首繰越損失) %>
30
+ <%= render_attr('AMB00440', 当期控除計) %>
31
+ <%= render_attr('AMB00450', 翌期繰越損失) %>
32
+ <AMB00325 />
33
+ <%= render_attr('AMB00330', 当期繰越損失) %>
34
+ <AMB00360 />
35
+ <AMB00365 />
36
+ <%= render_attr('AMB00370', 当期繰越損失) %>
37
+ <%= render_attr('AMB00380', 当期繰越損失) %>
38
+ <%= render_attr('AMB00500', 翌期繰越損失 + 当期繰越損失) %>
39
+ <AMC00100 />
40
+ <AMC00200 />
41
+ <AMC00300 />
42
+ <AMC00400 />
43
+ <AMC00500>
44
+ <gen:era />
45
+ <gen:yy />
46
+ <gen:mm />
47
+ <gen:dd />
48
+ </AMC00500>
49
+ <AMC00600 />
50
+ <AMC00700 />
51
+ </R0102AM190>
@@ -87,7 +87,7 @@
87
87
  <AAB02300><%= 納付税額(@確定法人税割, @法人税割中間納付) + 納付税額(@均等割, @均等割中間納付) %></AAB02300>
88
88
  <AAC00100><%= @法人税割課税標準 %></AAC00100>
89
89
  <AAC00200>7.0</AAC00200>
90
- <AAC00210><%= 法人税割 %></AAC00210>
90
+ <AAC00210><%= 法人税割[0] %></AAC00210>
91
91
  <AAC00300 />
92
92
  <AAC00400 />
93
93
  <AAC00410 />
@@ -102,7 +102,7 @@
102
102
  <AAE00410>7.0</AAE00410>
103
103
  <AAE00420><%= 所得割800万超 %></AAE00420>
104
104
  <AAE00500><%= 所得400万以下 + 所得800万以下 + 所得800万超 %></AAE00500>
105
- <AAE00510><%= @所得割 %></AAE00510>
105
+ <%= render_attr('AAE00510', @所得割) %>
106
106
  <AAE00600 />
107
107
  <AAE00610 />
108
108
  <AAE00620 />
@@ -118,12 +118,12 @@
118
118
  <AAE00800 />
119
119
  <AAE00810 />
120
120
  <AAE00820 />
121
- <AAE00900><%= @所得割 %></AAE00900>
121
+ <%= render_attr('AAE00900', @所得割) %>
122
122
  <AAE00950 />
123
123
  <AAE00960 />
124
124
  <AAE01000 />
125
125
  <AAE01050 />
126
- <AAE01100><%= 事業税中間納付 %></AAE01100>
126
+ <%= render_attr('AAE01100', 事業税中間納付) %>
127
127
  <AAE01200 />
128
128
  <AAE01300><%= @所得割 - 事業税中間納付 %></AAE01300>
129
129
  <AAE01310><%= @所得割 - 事業税中間納付 %></AAE01310>
@@ -132,28 +132,28 @@
132
132
  <AAE01340 />
133
133
  <AAE01400 />
134
134
  <AAE01500><%= @所得割 - 事業税中間納付 %></AAE01500>
135
- <AAK00100><%= @所得割 %></AAK00100>
136
- <AAK00200>37</AAK00200>
137
- <AAK00300><%= 地方法人特別税(@所得割) %></AAK00300>
135
+ <%= render_attr('AAK00100', @所得割) %>
136
+ <%= render_attr('AAK00200', 37) %>
137
+ <%= render_attr('AAK00300', 地方法人特別税(@所得割)) %>
138
138
  <AAK00400 />
139
139
  <AAK00500 />
140
140
  <AAK00600 />
141
- <AAK00700><%= 地方法人特別税(@所得割) %></AAK00700>
141
+ <%= render_attr('AAK00700', 地方法人特別税(@所得割)) %>
142
142
  <AAK00800 />
143
- <AAK00850><%= 地方法人特別税(@所得割) %></AAK00850>
144
- <AAK00900><%= @地方特別法人事業税中間納付 %></AAK00900>
143
+ <%= render_attr('AAK00850', 地方法人特別税(@所得割)) %>
144
+ <%= render_attr('AAK00900', @地方特別法人事業税中間納付) %>
145
145
  <AAK01000 />
146
146
  <AAK01100><%= 地方法人特別税(@所得割) - @地方特別法人事業税中間納付 %></AAK01100>
147
147
  <AAK01200 />
148
148
  <AAK01300><%= 地方法人特別税(@所得割) - @地方特別法人事業税中間納付 %></AAK01300>
149
- <AAF00100><%= 所得金額 %></AAF00100>
149
+ <%= render_attr('AAF00100', 当期所得金額) %>
150
150
  <AAF00200 />
151
151
  <AAF00300 />
152
152
  <AAF00500 />
153
153
  <AAF00600 />
154
- <AAF00800><%= 所得金額 %></AAF00800>
155
- <AAF00700 />
156
- <AAG00100 />
154
+ <%= render_attr('AAF00800', 当期所得金額) %>
155
+ <%= render_attr('AAF00700', @繰越損失管理.deduction) %>
156
+ <%= render_attr('AAG00100', 所得金額) %>
157
157
  <AAH00100 />
158
158
  <AAH00200 />
159
159
  <AAH00400>
@@ -34,6 +34,7 @@
34
34
  <%= render_attr('ABI00110', @中間納付額) %>
35
35
  <%= render_attr('ABI00120', 納付税額(@税額, @中間納付額)) %>
36
36
  <%= render_attr('ABI00130', 中間還付税額(@税額, @中間納付額)) %>
37
+ <%= render_attr('ABI00170', LucaSupport::Code.readable(@sales)) %>
37
38
  </ABI00000>
38
39
  <ABJ00000>
39
40
  <ABJ00010>
@@ -45,7 +46,7 @@
45
46
  <%= render_attr('ABJ00070', @地方税中間納付額) %>
46
47
  <%= render_attr('ABJ00080', 納付税額(@譲渡割額, @地方税中間納付額)) %>
47
48
  <%= render_attr('ABJ00090', 中間還付税額(@譲渡割額, @地方税中間納付額)) %>
48
- <%= render_attr('ABJ00130', 納付税額(@税額, @中間納付額) + 納付税額(@譲渡割額, @地方税中間納付額)) %>
49
+ <%= render_attr('ABJ00130', (@税額 - @中間納付額) + (@譲渡割額 - @地方税中間納付額)) %>
49
50
  </ABJ00000>
50
51
  <ABK00000>
51
52
  <ABK00010><kubun_CD>2</kubun_CD></ABK00010>
@@ -56,6 +57,7 @@
56
57
  <ABL00000>
57
58
  <ABL00010><kubun_CD>2</kubun_CD></ABL00010>
58
59
  <ABL00020><%= 事業区分 %></ABL00020>
60
+ <ABL00210><kubun_CD>2</kubun_CD></ABL00210>
59
61
  </ABL00000>
60
62
  </SHA020-1>
61
63
  <SHA020-2 page="1">
data/lib/luca/jp/util.rb CHANGED
@@ -22,7 +22,10 @@ module Luca
22
22
  end
23
23
 
24
24
  def prepaid_tax(code)
25
- LucaSupport::Code.readable(@bs_data.dig(code) || 0)
25
+ #LucaSupport::Code.readable(@bs_data.dig(code) || 0)
26
+ search_end = @end_date.prev_month # exclude year end adjustment
27
+ amount, _ = self.class.net(@start_date.year, @start_date.month, search_end.year, search_end.month, code: code)
28
+ LucaSupport::Code.readable(amount[code] || 0)
26
29
  end
27
30
 
28
31
  def 納付税額(税額, 中間納付額)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luca-jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucabook
@@ -85,6 +85,7 @@ files:
85
85
  - lib/luca/jp/common.rb
86
86
  - lib/luca/jp/it_part.rb
87
87
  - lib/luca/jp/kessan.rb
88
+ - lib/luca/jp/sonshitsu.rb
88
89
  - lib/luca/jp/syouhizei.rb
89
90
  - lib/luca/jp/templates/aoiro.xtx.erb
90
91
  - lib/luca/jp/templates/beppyo1-next.xml.erb
@@ -94,8 +95,10 @@ files:
94
95
  - lib/luca/jp/templates/beppyo4.xml.erb
95
96
  - lib/luca/jp/templates/beppyo51.xml.erb
96
97
  - lib/luca/jp/templates/beppyo52.xml.erb
98
+ - lib/luca/jp/templates/beppyo7.xml.erb
97
99
  - lib/luca/jp/templates/consumption.xtx.erb
98
100
  - lib/luca/jp/templates/el-no6-43.xml.erb
101
+ - lib/luca/jp/templates/el-no6-9.xml.erb
99
102
  - lib/luca/jp/templates/el-no6.xml.erb
100
103
  - lib/luca/jp/templates/eltax.xml.erb
101
104
  - lib/luca/jp/templates/fuhyo43.xml.erb