luca-jp 0.16.3 → 0.17.1

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: fa9b6007a2a529b1d17eaca40694c831f8c1be63343571c5c3d7e926b7f52949
4
- data.tar.gz: cb198bc844cc2d905ac9aab9c6bb35693f0b16de1d57331aac58c31c5f5a2300
3
+ metadata.gz: 58d494de7a0afaeba64b0fa3e863d29d58d18c4d388c3fc242cf0dbf15e7ac47
4
+ data.tar.gz: d508e3aed40438c2976ca54163177d4c70063f2cc817ff8f0a527bc5db718ac2
5
5
  SHA512:
6
- metadata.gz: ef9754c6618cfe2eaeb27f0e14a0a6f3b302853e73f4138128a23b1e688a33a715a11cef549ac98f942e759430ea11f0af2e134875590bcea4aba497a0a23f36
7
- data.tar.gz: 56827cd19f691db069c42503ee2175477763f164abcdfbc46dea99ae3f942cc025c47aed8abf28b9f7f546a2f7bec709e915f10bebecefbb17df7a23895093ea
6
+ metadata.gz: 4423973592ddda83bf2bf59335e97912cd1629b22ab02e701081d885ebb37f5e105176748ff0695648cefe518fed3d482dd41e0d01e8aa9648442a74c5304a8c
7
+ data.tar.gz: a20cfa2fb819a2775173715c2dd71820c7ae5c1140f4354a8a62bebe6306a18c6b59ed27fc941a63ae9cec6cb995f09bbc088b1dd638b75eb3862204dc007c95
data/exe/luca-jp CHANGED
@@ -6,6 +6,7 @@ require 'luca/jp'
6
6
  require 'luca_salary/jp_payreport'
7
7
  require 'luca_cmd'
8
8
  require 'luca_support/const'
9
+ require 'yaml'
9
10
 
10
11
  EXT_CONF = 'config-lucajp.yml'
11
12
 
@@ -19,17 +20,19 @@ class LucaCmd
19
20
  end
20
21
 
21
22
  def self.houjinzei(args, params)
23
+ ext_config = params[:extra] ? YAML.load_file(params[:extra]) : nil
22
24
  if params[:export]
23
- Luca::Jp::Aoiro.range(*auto_range(args, params)).export_json
25
+ puts Luca::Jp::Aoiro.range(*auto_range(args, params)).export_json(ext_config: ext_config)
24
26
  else
25
- puts Luca::Jp::Aoiro.range(*auto_range(args, params)).kani
27
+ puts Luca::Jp::Aoiro.range(*auto_range(args, params)).kani(ext_config: ext_config)
26
28
  end
27
29
  end
28
30
 
29
31
  def self.chihouzei(args, params)
32
+ ext_config = params[:extra] ? YAML.load_file(params[:extra]) : nil
30
33
  if params[:export]
31
34
  accounts = Luca::Jp::Util.eltax_config('reports').map do |report|
32
- Luca::Jp::Chihouzei.range(*auto_range(args, params)).export_json(report)
35
+ Luca::Jp::Chihouzei.range(*auto_range(args, params)).export_json(report, ext_config: ext_config)
33
36
  end
34
37
  puts JSON.dump(accounts)
35
38
  else
@@ -76,6 +79,7 @@ case cmd
76
79
  when 'h', /hou?jinzei/
77
80
  OptionParser.new do |opt|
78
81
  opt.banner = 'Usage: luca-jp h|houjinzei [options] [yyyy mm yyyy mm]'
82
+ opt.on('-x VAL', 'extra config') { |v| params[:extra] = v }
79
83
  opt.on('--export', 'export json') { |_v| params[:export] = true }
80
84
  opt.on('--lastyear', 'report on last Financial year') { |_v| params[:lastyear] = true }
81
85
  args = opt.parse!(ARGV)
@@ -96,6 +100,7 @@ when 's', /s[yh]ou?hizei/
96
100
  when 'c', /chihou?zei/
97
101
  OptionParser.new do |opt|
98
102
  opt.banner = 'Usage: luca-jp c|chihouzei [options] [yyyy mm yyyy mm]'
103
+ opt.on('-x VAL', 'extra config') { |v| params[:extra] = v }
99
104
  opt.on('--export', 'export json') { |_v| params[:export] = true }
100
105
  opt.on('--lastyear', 'report on last Financial year') { |_v| params[:lastyear] = true }
101
106
  args = opt.parse!(ARGV)
data/lib/luca/jp/aoiro.rb CHANGED
@@ -20,7 +20,7 @@ module Luca
20
20
  @dirname = 'journals'
21
21
  @record_type = 'raw'
22
22
 
23
- def kani(export: false)
23
+ def kani(ext_config: nil, export: false)
24
24
  set_pl(4)
25
25
  set_bs(4)
26
26
  @issue_date = Date.today
@@ -28,12 +28,14 @@ module Luca
28
28
  @software = 'LucaJp'
29
29
  @shinkoku_kbn = '30' # 確定申告
30
30
 
31
+ 別表四所得調整(ext_config)
31
32
  @税額 = 税額計算
32
33
  @確定法人税額 = @税額.dig(:houjin, :kokuzei)
33
34
  @法人税額 = 中小企業の軽減税額 + 一般区分の税額
34
35
  @地方法人税課税標準 = (@法人税額 / 1000).floor * 1000
35
36
  @地方法人税額 = 地方法人税額(@地方法人税課税標準)
36
37
  @確定地方法人税額 = @税額.dig(:houjin, :chihou)
38
+
37
39
  @法人税中間納付 = prepaid_tax('1851')
38
40
  @地方法人税中間納付 = prepaid_tax('1852')
39
41
 
@@ -63,8 +65,6 @@ module Luca
63
65
  @都道府県民税期中増, @都道府県民税期中減 = 未納都道府県民税期中増減
64
66
  @市民税期中増, @市民税期中減 = 未納市民税期中増減
65
67
  @事業税期中増, @事業税期中減 = 未納事業税期中増減
66
- @事業税中間納付 = ['1854', '1855', '1856', '1857', '1858']
67
- .map{ |k| prepaid_tax(k) }.compact.sum
68
68
  @翌期還付法人税 = 中間還付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付)
69
69
  @概況売上 = gaikyo('A0')
70
70
  @form_sec = [
@@ -85,35 +85,35 @@ module Luca
85
85
  end
86
86
  end
87
87
 
88
- def export_json
89
- dat = kani(export: true)
90
- [].tap do |res|
91
- item = {}
92
- item['date'] = @end_date
93
- item['debit'] = []
94
- item['credit'] = []
95
- if dat[:kokuzei][:chukan] > 0
96
- item['credit'] << { 'label' => '仮払法人税', 'amount' => dat[:kokuzei][:chukan] }
97
- end
98
- if dat[:kokuzei][:chukan] > dat[:kokuzei][:zeigaku]
99
- item['debit'] << { 'label' => '未収法人税', 'amount' => dat[:kokuzei][:chukan] - dat[:kokuzei][:zeigaku] }
100
- else
101
- item['credit'] << { 'label' => '未払法人税', 'amount' => dat[:kokuzei][:zeigaku] - dat[:kokuzei][:chukan] }
102
- end
103
- item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:kokuzei][:zeigaku] } if dat[:kokuzei][:zeigaku] > 0
104
- if dat[:chihou][:chukan] > 0
105
- item['credit'] << { 'label' => '仮払法人税(地方)', 'amount' => dat[:chihou][:chukan] }
106
- end
107
- if dat[:chihou][:chukan] > dat[:chihou][:zeigaku]
108
- item['debit'] << { 'label' => '未収法人税', 'amount' => dat[:chihou][:chukan] - dat[:chihou][:zeigaku] }
109
- else
110
- item['credit'] << { 'label' => '未払法人税', 'amount' => dat[:chihou][:zeigaku] - dat[:chihou][:chukan] }
111
- end
112
- item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:chihou][:zeigaku] } if dat[:chihou][:zeigaku] > 0
113
- item['x-editor'] = 'LucaJp'
114
- res << item
115
- puts JSON.dump(res)
88
+ def export_json(ext_config: nil, raw: false)
89
+ dat = kani(export: true, ext_config: ext_config)
90
+ res = []
91
+ item = {}
92
+ item['date'] = @end_date
93
+ item['debit'] = []
94
+ item['credit'] = []
95
+ if dat[:kokuzei][:chukan] > 0
96
+ item['credit'] << { 'label' => '仮払法人税', 'amount' => dat[:kokuzei][:chukan] }
97
+ end
98
+ if dat[:kokuzei][:chukan] > dat[:kokuzei][:zeigaku]
99
+ item['debit'] << { 'label' => '未収法人税', 'amount' => dat[:kokuzei][:chukan] - dat[:kokuzei][:zeigaku] }
100
+ else
101
+ item['credit'] << { 'label' => '未払法人税', 'amount' => dat[:kokuzei][:zeigaku] - dat[:kokuzei][:chukan] }
102
+ end
103
+ item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:kokuzei][:zeigaku] }
104
+ if dat[:chihou][:chukan] > 0
105
+ item['credit'] << { 'label' => '仮払法人税(地方)', 'amount' => dat[:chihou][:chukan] }
116
106
  end
107
+ if dat[:chihou][:chukan] > dat[:chihou][:zeigaku]
108
+ item['debit'] << { 'label' => '未収法人税', 'amount' => dat[:chihou][:chukan] - dat[:chihou][:zeigaku] }
109
+ else
110
+ item['credit'] << { 'label' => '未払法人税', 'amount' => dat[:chihou][:zeigaku] - dat[:chihou][:chukan] }
111
+ end
112
+ item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:chihou][:zeigaku] } if dat[:chihou][:zeigaku] > 0
113
+ item['x-editor'] = 'LucaJp'
114
+ res << item
115
+
116
+ raw ? res : JSON.dump(res)
117
117
  end
118
118
 
119
119
  def 別表一
@@ -130,28 +130,74 @@ module Luca
130
130
  render_erb(search_template('beppyo2.xml.erb'))
131
131
  end
132
132
 
133
+ # NOTE: 別表四所得調整に依存
133
134
  def 別表四簡易
134
135
  @当期純損益 = readable(@pl_data.dig('HA'))
135
- @法人税等 = readable(@pl_data.dig('H0'))
136
- _, @納付事業税 = 未納事業税期中増減
137
- @当期還付事業税 = 還付事業税
138
- @翌期還付事業税 = 中間還付税額(確定事業税, @事業税中間納付)
139
- @別表四調整所得 = @当期純損益 + @法人税等 - @納付事業税 - @翌期還付事業税 + @当期還付事業税
140
136
 
141
- @当期還付法人税 = refund_tax('1502')
142
- @当期還付都道府県住民税 = refund_tax('1503')
143
- @翌期還付都道府県住民税 = readable(@bs_data['1503']) || 0
144
- @当期還付市民税 = refund_tax('1505')
145
- @翌期還付市民税 = readable(@bs_data['1505']) || 0
146
- @事業税期首残高 = 期首未納事業税 > 0 ? 期首未納事業税 : (@当期還付事業税 * -1)
147
- @仮払税金 = [@翌期還付法人税, @翌期還付都道府県住民税, @翌期還付事業税, @翌期還付市民税]
148
- .compact.sum
137
+ ### 損金不算入額の計算
138
+
139
+ @損金経理をした法人税及び地方法人税 = 法人税損金納付額
140
+ @損金経理をした道府県民税及び市町村民税 = [
141
+ 都道府県民税損金納付,
142
+ 市民税損金納付,
143
+ ].compact.sum
144
+ @損金経理をした納税充当金 = 当期納税充当金
145
+ @損金不算入額 = [
146
+ @損金不算入額税額未確定,
147
+ @損金経理をした法人税及び地方法人税,
148
+ @損金経理をした道府県民税及び市町村民税,
149
+ @損金経理をした納税充当金,
150
+ ].compact.sum
151
+ @損金不算入額留保 = [
152
+ @減価償却の償却超過額,
153
+ @当期還付事業税,
154
+ @損金経理をした法人税及び地方法人税,
155
+ @損金経理をした道府県民税及び市町村民税,
156
+ @損金経理をした納税充当金,
157
+ ].compact.sum
158
+ @損金不算入額社外流出 = [
159
+ @役員給与の損金不算入額,
160
+ @交際費等の損金不算入額,
161
+ # TODO: 附帯税
162
+ ].compact.sum
163
+
164
+ ### 益金不算入額の計算
165
+ STDERR.puts "別表八「受取配当等の益金算入に関する明細書」の追加作成が必要" if @受取配当金の益金不算入額
166
+
167
+ @翌期還付事業税 = ['1504', '1854', '1855', '1856', '1857', '1858']
168
+ .map{ |code| readable(@bs_data[code]) }
169
+ .compact.sum
170
+ @益金不算入額 = [
171
+ @益金不算入額税額未確定,
172
+ # NOTE: 確定税額は会計上も費用認識しているため相殺
173
+ (@事業税中間納付 * -1),
174
+ @翌期還付事業税
175
+ ].compact.sum
176
+ @益金不算入額留保 = [
177
+ @納付事業税,
178
+ @減価償却超過額の当期認容額,
179
+ @翌期還付事業税
180
+ ].compact.sum
181
+ @益金不算入額社外流出 = [
182
+ # TODO: 欠損金繰戻還付、欠損金当期控除
183
+ @受取配当金の益金不算入額,
184
+ @受贈益の益金不算入額,
185
+ ].compact.sum
186
+ @別表四調整所得留保 = @当期純損益 + @損金不算入額留保 - @益金不算入額留保
187
+ @別表四調整所得社外流出 = @当期純損益 + @損金不算入額社外流出 - @益金不算入額社外流出
188
+ # TODO: 寄付金、所得税額控除、外国法人税の損金不算入調整
149
189
 
150
190
  render_erb(search_template('beppyo4.xml.erb'))
151
191
  end
152
192
 
153
193
  def 別表五一
154
- @期首資本金 = readable(@start_balance.dig('911'))
194
+ @当期還付法人税 = refund_tax('1502')
195
+ @当期還付都道府県住民税 = refund_tax('1503')
196
+ @当期還付市民税 = refund_tax('1505')
197
+ @翌期還付都道府県住民税 = readable(@bs_data['1503']) || 0
198
+ @翌期還付市民税 = readable(@bs_data['1505']) || 0
199
+
200
+ @期首資本金 = readable(@start_balance.dig('911')) || 0
155
201
  @資本金期中減, @資本金期中増 = 純資産期中増減('911')
156
202
  @期首資本準備金, @期末資本準備金 = 期首期末残高('9131')
157
203
  @資本準備金期中減, @資本準備金期中増 = 純資産期中増減('9131')
@@ -169,6 +215,7 @@ module Luca
169
215
  @当期還付消費税 = refund_tax('1501')
170
216
  @消費税期首残高 = 期首未納消費税 > 0 ? 期首未納消費税 : (@当期還付消費税 * -1)
171
217
  @翌期還付消費税 = 中間還付税額(@消費税期中増, @消費税中間納付額)
218
+ @事業税期首残高 = 期首未納事業税 > 0 ? 期首未納事業税 : (@当期還付事業税 * -1)
172
219
  @その他事業税 = 租税公課 - @消費税期中増
173
220
  render_erb(search_template('beppyo52.xml.erb'))
174
221
  end
@@ -374,21 +421,18 @@ module Luca
374
421
  "<ARC00220><ARC00230>仮払事業税消却(未収計上した還付事業税)</ARC00230>#{render_attr('ARC00240', @当期還付事業税)}#{render_attr('ARC00250', @当期還付事業税)}</ARC00220>\n"
375
422
  end
376
423
 
377
- def 別表五一仮払税金
378
- 未収仮払税金 = ['1502', '1503', '1504', '1505']
379
- .map { |k| @start_balance[k] }.compact.sum
380
- 還付税金 = [@当期還付法人税, @当期還付都道府県住民税, @当期還付事業税, @当期還付市民税].compact.sum
381
- return '' if 未収仮払税金 == 0 && 還付税金 == 0 && @仮払税金 == 0
424
+ def 別表五一仮払事業税
425
+ return '' if @当期還付事業税 == 0 && @翌期還付事業税 == 0
382
426
 
383
427
  %Q(<ICB00140>
384
- #{render_attr('ICB00150', '仮払税金')}
385
- #{render_attr('ICB00160', readable(未収仮払税金) * -1)}
386
- <ICB00170>
387
- #{render_attr('ICB00190', readable(還付税金) * -1)}
388
- #{render_attr('ICB00200', @仮払税金 * -1)}
389
- </ICB00170>
390
- #{render_attr('ICB00210', @仮払税金 * -1)}
391
- </ICB00140>)
428
+ #{render_attr('ICB00150', '仮払事業税')}
429
+ #{render_attr('ICB00160', @当期還付事業税 * -1)}
430
+ <ICB00170>
431
+ #{render_attr('ICB00190', @当期還付事業税 * -1)}
432
+ #{render_attr('ICB00200', @翌期還付事業税 * -1)}
433
+ </ICB00170>
434
+ #{render_attr('ICB00210', @翌期還付事業税 * -1)}
435
+ </ICB00140>)
392
436
  end
393
437
 
394
438
  def 別表五一還付法人税
@@ -448,7 +492,12 @@ module Luca
448
492
  end
449
493
 
450
494
  def 当期納税充当金
451
- readable(@pl_data.dig('H0')) - [法人税損金納付額, 都道府県民税損金納付, 市民税損金納付, 事業税損金納付].compact.sum
495
+ r = credit_amount('515', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
496
+ readable(r)
497
+ end
498
+
499
+ def 期末納税充当金
500
+ readable(@bs_data.dig('515')) || 0
452
501
  end
453
502
 
454
503
  def 期首未納法人税
@@ -465,6 +514,7 @@ module Luca
465
514
  end
466
515
 
467
516
  # 中間納付した金額のうち税額とならず、還付されるべき額
517
+ # 決算後において、未収法人税・仮払法人税・仮払法人税(地方)の合計金額の想定
468
518
  #
469
519
  def 法人税仮払納付額
470
520
  [(@法人税中間納付 + @地方法人税中間納付 - @確定法人税額 - @確定地方法人税額), 0].max
@@ -489,8 +539,15 @@ module Luca
489
539
  [確定都道府県住民税, readable(r)]
490
540
  end
491
541
 
542
+ # 決算後において、仮払地方税法人税割・仮払地方税均等割の金額は
543
+ # 本来都道府県と市区町村に区分すべきだが、全額市民税とみなしている
544
+ #
492
545
  def 都道府県民税仮払納付
493
- readable(@bs_data['1503']) || 0
546
+ [
547
+ readable(@bs_data['1503']),
548
+ readable(@bs_data['1859']),
549
+ readable(@bs_data['185A']),
550
+ ].compact.sum
494
551
  end
495
552
 
496
553
  # 期末納付済金額のうち税額として確定したもの
@@ -499,6 +556,10 @@ module Luca
499
556
  @都道府県民税均等割中間納付 + @都道府県民税法人税割中間納付 - 都道府県民税仮払納付
500
557
  end
501
558
 
559
+ def 期末未納都道府県民税
560
+ readable(@bs_data.dig('5153')) || 0
561
+ end
562
+
502
563
  def 確定市民税
503
564
  readable(@pl_data['H113']) || 0
504
565
  end
@@ -517,7 +578,11 @@ module Luca
517
578
  end
518
579
 
519
580
  def 市民税仮払納付
520
- readable(@bs_data['1505']) || 0
581
+ [
582
+ readable(@bs_data['1505']),
583
+ readable(@bs_data['185D']),
584
+ readable(@bs_data['185E']),
585
+ ].compact.sum
521
586
  end
522
587
 
523
588
  # 期末納付済金額のうち税額として確定したもの
@@ -534,8 +599,18 @@ module Luca
534
599
  [@事業税中間納付, 確定事業税].min
535
600
  end
536
601
 
602
+ def 期末未納事業税
603
+ readable(@bs_data['5152']) || 0
604
+ end
605
+
537
606
  def 別表五一期首差引金額
538
- [期首繰越損益, 期首納税充当金].compact.sum - [
607
+ [
608
+ @当期還付法人税,
609
+ @当期還付都道府県住民税,
610
+ @当期還付市民税,
611
+ 期首繰越損益,
612
+ 期首納税充当金
613
+ ].compact.sum - [
539
614
  期首未納法人税,
540
615
  期首未納都道府県民税,
541
616
  期首未納市民税,
@@ -544,16 +619,28 @@ module Luca
544
619
  end
545
620
 
546
621
  def 別表五一期末差引金額
547
- [期末繰越損益, 当期納税充当金].compact.sum - [
622
+ [
623
+ @翌期還付法人税,
624
+ @翌期還付都道府県住民税,
625
+ @翌期還付市民税,
626
+ 期末繰越損益,
627
+ 期末納税充当金
628
+ ].compact.sum - [
548
629
  期末未納法人税,
549
- 確定都道府県住民税,
550
- 確定市民税,
630
+ 期末未納都道府県民税,
631
+ 期末未納市民税,
551
632
  @翌期還付事業税
552
633
  ].compact.sum
553
634
  end
554
635
 
555
636
  def 別表五一期中減差引金額
556
- [期首繰越損益, 納税充当金期中減].compact.sum - [
637
+ [
638
+ @当期還付法人税,
639
+ @当期還付都道府県住民税,
640
+ @当期還付市民税,
641
+ 期首繰越損益,
642
+ 納税充当金期中減
643
+ ].compact.sum - [
557
644
  @法人税期中減,
558
645
  @都道府県民税期中減,
559
646
  @市民税期中減,
@@ -566,11 +653,20 @@ module Luca
566
653
  end
567
654
 
568
655
  def 別表五一期中増差引金額
569
- [期末繰越損益, 納付税額(確定事業税, @事業税中間納付)].compact.sum - [
656
+ [
657
+ @翌期還付法人税,
658
+ @翌期還付都道府県住民税,
659
+ @翌期還付市民税,
660
+ 期末繰越損益,
661
+ 期末納税充当金
662
+ ].compact.sum - [
570
663
  @法人税中間納付,
571
664
  @地方法人税中間納付,
665
+ 期末未納法人税,
572
666
  @都道府県民税中間納付,
667
+ 期末未納都道府県民税,
573
668
  @市民税中間納付,
669
+ 期末未納市民税,
574
670
  @翌期還付事業税
575
671
  ].compact.sum
576
672
  end
@@ -701,12 +797,14 @@ module Luca
701
797
  end
702
798
 
703
799
  def proc_version
704
- if @end_date >= Date.parse('2022-4-1')
705
- { 'proc' => '22.0.3', 'HOA112' => '4.0', 'HOA116' => '3.0', 'HOA420' => '21.0', 'HOA511' => '14.0', 'HOA522' => '8.0', 'HOB710' => '12.0', 'HOE200' => '14.0', 'HOE990' => '6.1', 'HOK010' => '6.0' }
800
+ if @end_date >= Date.parse('2023-4-1')
801
+ { 'proc' => '23.0.2', 'HOA112' => '5.0', 'HOA116' => '4.0', 'HOA201' => '5.0', 'HOA420' => '22.0', 'HOA511' => '14.0', 'HOA522' => '9.0', 'HOB710' => '13.0', 'HOE200' => '14.0', 'HOE990' => '7.0', 'HOK010' => '6.0' }
802
+ elsif @end_date >= Date.parse('2022-4-1')
803
+ { 'proc' => '22.0.3', 'HOA112' => '4.0', 'HOA116' => '3.0', 'HOA201' => '4.0', 'HOA420' => '21.0', 'HOA511' => '14.0', 'HOA522' => '8.0', 'HOB710' => '12.0', 'HOE200' => '14.0', 'HOE990' => '6.1', 'HOK010' => '6.0' }
706
804
  elsif @end_date >= Date.parse('2021-4-1')
707
- { 'proc' => '21.0.2', 'HOA112' => '3.1', 'HOA116' => '2.0', 'HOA420' => '20.0', 'HOA511' => '13.0', 'HOA522' => '7.0', 'HOB710' => '11.0', 'HOE200' => '13.0', 'HOE990' => '5.0', 'HOK010' => '6.0' }
805
+ { 'proc' => '21.0.2', 'HOA112' => '3.1', 'HOA116' => '2.0', 'HOA201' => '4.0', 'HOA420' => '20.0', 'HOA511' => '13.0', 'HOA522' => '7.0', 'HOB710' => '11.0', 'HOE200' => '13.0', 'HOE990' => '5.0', 'HOK010' => '6.0' }
708
806
  else
709
- { 'proc' => '20.0.2', 'HOA112' => '2.0', 'HOA116' => '1.0', 'HOA420' => '19.0', 'HOA511' => '13.0', 'HOA522' => '6.0', 'HOB710' => '11.0', 'HOE200' => '13.0', 'HOE990' => '5.0', 'HOK010' => '5.0' }
807
+ { 'proc' => '20.0.2', 'HOA112' => '2.0', 'HOA116' => '1.0', 'HOA201' => '4.0', 'HOA420' => '19.0', 'HOA511' => '13.0', 'HOA522' => '6.0', 'HOB710' => '11.0', 'HOE200' => '13.0', 'HOE990' => '5.0', 'HOK010' => '5.0' }
710
808
  end
711
809
  end
712
810
 
@@ -17,7 +17,7 @@ module Luca
17
17
  @dirname = 'journals'
18
18
  @record_type = 'raw'
19
19
 
20
- def kani(report_cfg, export: false)
20
+ def kani(report_cfg, export: false, ext_config: nil)
21
21
  set_pl(4)
22
22
  set_bs(4)
23
23
  @issue_date = Date.today
@@ -32,28 +32,25 @@ module Luca
32
32
  @shotoku401 = report_cfg['shotoku401']
33
33
  @shotoku801 = report_cfg['shotoku801']
34
34
 
35
+ 別表四所得調整(ext_config)
35
36
  @税額 = 税額計算
36
37
  jichitai = @report_category == 'city' ? :shimin : :kenmin
37
38
  @均等割 = report_cfg['kintouwari'] || @税額.dig(jichitai, :kintou)
38
39
  @確定法人税割 = @税額.dig(jichitai, :houjinzei)
39
40
  @地方特別法人事業税中間納付 = prepaid_tax('1854', @jimusho_name)
40
41
  @所得割中間納付 = prepaid_tax('1855', @jimusho_name)
41
- @法人税割中間納付 = prepaid_tax('1859', @jimusho_name)
42
- @均等割中間納付 = prepaid_tax('185A', @jimusho_name)
42
+ @法人税割中間納付 = prepaid_tax(
43
+ @report_category == 'city' ? '185D' :'1859',
44
+ @jimusho_name
45
+ )
46
+ @均等割中間納付 = prepaid_tax(
47
+ @report_category == 'city' ? '185E' : '185A',
48
+ @jimusho_name
49
+ )
43
50
  @所得割 = @税額.dig(:kenmin, :shotoku)
44
51
  if export
45
52
  {
46
53
  customer: @jimusho_name,
47
- jigyouzei: {
48
- shotoku: {
49
- zeigaku: @所得割,
50
- chukan: @所得割中間納付
51
- },
52
- tokubetsu: {
53
- zeigaku: @税額.dig(:kenmin, :tokubetsu),
54
- chukan: @地方特別法人事業税中間納付
55
- },
56
- },
57
54
  juminzei: {
58
55
  kinto: {
59
56
  zeigaku: @均等割,
@@ -64,7 +61,20 @@ module Luca
64
61
  chukan: @法人税割中間納付
65
62
  }
66
63
  }
67
- }
64
+ }.tap do |record|
65
+ if @report_category != 'city'
66
+ record[:jigyouzei] = {
67
+ shotoku: {
68
+ zeigaku: @所得割,
69
+ chukan: @所得割中間納付
70
+ },
71
+ tokubetsu: {
72
+ zeigaku: @税額.dig(:kenmin, :tokubetsu),
73
+ chukan: @地方特別法人事業税中間納付
74
+ },
75
+ }
76
+ end
77
+ end
68
78
  else
69
79
  @company = CGI.escapeHTML(config.dig('company', 'name'))
70
80
  @form_vers = proc_version
@@ -99,8 +109,8 @@ module Luca
99
109
  end
100
110
  end
101
111
 
102
- def export_json(report_cfg)
103
- records = kani(report_cfg, export: true)
112
+ def export_json(report_cfg, ext_config: nil)
113
+ records = kani(report_cfg, export: true, ext_config: ext_config)
104
114
  label = @report_category == 'city' ? '市町村住民税' : '都道府県住民税'
105
115
  {}.tap do |item|
106
116
  item['date'] = @end_date
@@ -109,7 +119,7 @@ module Luca
109
119
  unless @report_category == 'city'
110
120
  records[:jigyouzei].each do |k, dat|
111
121
  if dat[:chukan] > 0
112
- item['credit'] << { 'label' => karibarai_label(k), 'amount' => dat[:chukan] }
122
+ item['credit'] << { 'label' => karibarai_label(k, @report_category), 'amount' => dat[:chukan] }
113
123
  end
114
124
  if dat[:chukan] > dat[:zeigaku]
115
125
  item['debit'] << { 'label' => '未収地方事業税', 'amount' => dat[:chukan] - dat[:zeigaku] }
@@ -121,7 +131,7 @@ module Luca
121
131
  end
122
132
  records[:juminzei].each do |k, dat|
123
133
  if dat[:chukan] > 0
124
- item['credit'] << { 'label' => karibarai_label(k), 'amount' => dat[:chukan] }
134
+ item['credit'] << { 'label' => karibarai_label(k, @report_category), 'amount' => dat[:chukan] }
125
135
  end
126
136
  if dat[:chukan] > dat[:zeigaku]
127
137
  item['debit'] << { 'label' => "未収#{label}", 'amount' => dat[:chukan] - dat[:zeigaku] }
@@ -229,22 +239,31 @@ module Luca
229
239
  "<FORM_ATTR><FORM_ID>#{code}</FORM_ID><FORM_NAME>#{name}</FORM_NAME><FORM_FILE_NAME></FORM_FILE_NAME><FORM_XSL_NAME></FORM_XSL_NAME></FORM_ATTR>"
230
240
  end
231
241
 
232
- def karibarai_label(key)
233
- case key
234
- when :tokubetsu
235
- '仮払地方税特別法人事業税'
236
- when :shotoku
237
- '仮払地方税所得割'
238
- when :syunyu
239
- '仮払地方税収入割'
240
- when :shihon
241
- '仮払地方税資本割'
242
- when :fukakachi
243
- '仮払地方税付加価値割'
244
- when :houjinzei
245
- '仮払地方税法人税割'
246
- when :kinto
247
- '仮払地方税均等割'
242
+ def karibarai_label(key, category)
243
+ if category == 'city'
244
+ case key
245
+ when :houjinzei
246
+ '仮払市民税法人税割'
247
+ when :kinto
248
+ '仮払市民税均等割'
249
+ end
250
+ else
251
+ case key
252
+ when :tokubetsu
253
+ '仮払地方税特別法人事業税'
254
+ when :shotoku
255
+ '仮払地方税所得割'
256
+ when :syunyu
257
+ '仮払地方税収入割'
258
+ when :shihon
259
+ '仮払地方税資本割'
260
+ when :fukakachi
261
+ '仮払地方税付加価値割'
262
+ when :houjinzei
263
+ '仮払地方税法人税割'
264
+ when :kinto
265
+ '仮払地方税均等割'
266
+ end
248
267
  end
249
268
  end
250
269