luca-jp 0.14.2 → 0.16.0

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: 51503b8d2c4e5ff7ec98bead91c34a6972d73a54c145249252f42bbdc9f4bcfe
4
- data.tar.gz: 61741745b41a9ebea245c6c3dbde8dd27d9b5d5eaa74b1836d7cb449088453ab
3
+ metadata.gz: ca379cda7bf415ef81ed4c7c72da443f1565f6b34e1bfad2e93c842aa71c011f
4
+ data.tar.gz: 8b5143397b416820bce2337169f4ff90b936bb712477b28bf3e5b2c457347471
5
5
  SHA512:
6
- metadata.gz: 78168441bdb7700c6359e8e80ee492baa32516ec975b01c67515c318e1c588a478bfac2418f9d78170effd4b14545234645965fe258790c9da12e076232210cc
7
- data.tar.gz: 8077bf6ea387c86108e5ef44f66e405853bc7047037aea1feded14f5cc83ef4c292caab495eb2cc811d5539ac4901f949404c37473ac698a0408a03da3a322de
6
+ metadata.gz: 8e3812b030abf84a467eb10689c6dd9bd15b5265cbfcbf4ba2993a258b0c5a55454c276b69f95e23bdd07be93336d107d2de8360a4c6169559eded86eaecb502
7
+ data.tar.gz: 82f9f7fee16b38b1dbb63980a5a30e1ea9499bedb55608d93c3a759dd2e872df080e0c1a5ac3f776fa201cddc463c4af3fff88ccad3423311870a4591567c170
data/exe/luca-jp CHANGED
@@ -37,7 +37,7 @@ class LucaCmd
37
37
 
38
38
  def self.urikake(args, params)
39
39
  date = "#{args[0]}-#{args[1]}-1"
40
- Luca::Jp::Urikake.new(date).report(params[:total])
40
+ Luca::Jp::Urikake.new(date).report(params[:total], params[:encode])
41
41
  end
42
42
 
43
43
  def self.auto_range(args, params)
@@ -97,6 +97,7 @@ when /urikake/
97
97
  OptionParser.new do |opt|
98
98
  opt.banner = 'Usage: luca-jp urikake [options] yyyy mm'
99
99
  opt.on('--total VAL', '売掛金総額') { |v| params[:total] = v&.to_i }
100
+ opt.on('--utf8', 'UTF-8でファイル生成') { |_v| params[:encode] = 'UTF-8' }
100
101
  args = opt.parse!(ARGV)
101
102
  LucaCmd.urikake(args, params)
102
103
  end
data/lib/luca/jp/aoiro.rb CHANGED
@@ -64,13 +64,14 @@ module Luca
64
64
  @都道府県民税期中増, @都道府県民税期中減 = 未納都道府県民税期中増減
65
65
  @市民税期中増, @市民税期中減 = 未納市民税期中増減
66
66
  @事業税期中増, @事業税期中減 = 未納事業税期中増減
67
- @事業税中間納付 = prepaid_tax('1854') + prepaid_tax('1855') + prepaid_tax('1856') + prepaid_tax('1857') + prepaid_tax('1858')
67
+ @事業税中間納付 = ['1854', '1855', '1856', '1857', '1858']
68
+ .map{ |k| prepaid_tax(k) }.compact.sum
68
69
  @翌期還付法人税 = 中間還付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付)
69
70
  @概況売上 = gaikyo('A0')
70
71
  @form_sec = [
71
72
  'HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 別表七フォーム,
72
73
  'HOE200', 適用額明細フォーム,
73
- 'HOI010', 有価証券内訳フォーム, 買掛金内訳フォーム, 'HOI100', 借入金内訳フォーム, 'HOI141', 地代家賃内訳フォーム,
74
+ 'HOI010', 有価証券内訳フォーム, 買掛金内訳フォーム, 'HOI100', 借入金内訳フォーム, 'HOI141', 地代家賃内訳フォーム, 雑益雑損失内訳フォーム,
74
75
  'HOK010'
75
76
  ].compact.map{ |c| form_rdf(c) }.join('')
76
77
  #@extra_form_sec = ['HOI040']
@@ -78,7 +79,7 @@ module Luca
78
79
  @form_data = [
79
80
  別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表七, 別表十五,
80
81
  適用額明細,
81
- 預貯金内訳, 有価証券内訳, 買掛金内訳, 仮受金内訳, 借入金内訳, 役員報酬内訳, 地代家賃内訳,
82
+ 預貯金内訳, 有価証券内訳, 買掛金内訳, 仮受金内訳, 借入金内訳, 役員報酬内訳, 地代家賃内訳, 雑益雑損失内訳,
82
83
  概況説明
83
84
  ].compact.join("\n")
84
85
  render_erb(search_template('aoiro.xtx.erb'))
@@ -140,11 +141,12 @@ module Luca
140
141
 
141
142
  @当期還付法人税 = refund_tax('1502')
142
143
  @当期還付都道府県住民税 = refund_tax('1503')
143
- @翌期還付都道府県住民税 = readable(@bs_data['1503'])
144
+ @翌期還付都道府県住民税 = readable(@bs_data['1503']) || 0
144
145
  @当期還付市民税 = refund_tax('1505')
145
146
  @翌期還付市民税 = readable(@bs_data['1505']) || 0
146
147
  @事業税期首残高 = 期首未納事業税 > 0 ? 期首未納事業税 : (@当期還付事業税 * -1)
147
- @仮払税金 = @翌期還付法人税 + @翌期還付都道府県住民税 + @翌期還付事業税 + @翌期還付市民税
148
+ @仮払税金 = [@翌期還付法人税, @翌期還付都道府県住民税, @翌期還付事業税, @翌期還付市民税]
149
+ .compact.sum
148
150
 
149
151
  render_erb(search_template('beppyo4.xml.erb'))
150
152
  end
@@ -186,6 +188,7 @@ module Luca
186
188
 
187
189
  def 別表十五
188
190
  @交際費 = readable(@pl_data.dig('C1B') || 0)
191
+ STDERR.puts "別表十五: 交際費計上額なし。必要に応じて帳票削除" if @交際費 == 0
189
192
  @限度額 = @交際費 < 4_000_000 ? @交際費 : 4_000_000
190
193
  @不算入額 = @交際費 < 4_000_000 ? 0 : @交際費 - 4_000_000
191
194
  render_erb(search_template('beppyo15.xml.erb'))
@@ -198,7 +201,13 @@ module Luca
198
201
  end
199
202
 
200
203
  def 適用額明細
201
- return nil if @確定法人税額 == 0
204
+ if 期末資本金 <= 10_000_000
205
+ STDERR.puts "適用額明細: 必要に応じて「少額減価償却資産の損金算入」(67条の5第1項, 00277。別表16[7])の確認が必要"
206
+ end
207
+ if @確定法人税額 == 0
208
+ STDERR.puts "別表一:適用額明細書の有無の確認が必要"
209
+ return nil
210
+ end
202
211
 
203
212
  render_erb(search_template('tekiyougaku.xml.erb'))
204
213
  end
@@ -209,7 +218,7 @@ module Luca
209
218
  @概況給料 = gaikyo('C12')
210
219
  @概況交際費 = gaikyo('C1B')
211
220
  @概況減価償却 = gaikyo('C1P')
212
- @概況地代租税 = gaikyo('C1E') + gaikyo('C1I')
221
+ @概況地代租税 = ['C1E', 'C1I'].map { |k| gaikyo(k) }.compact.sum
213
222
  @概況営業損益 = gaikyo('CA')
214
223
  @概況特別利益 = gaikyo('F0')
215
224
  @概況特別損失 = gaikyo('G0')
@@ -219,10 +228,10 @@ module Luca
219
228
  @概況受取手形 = gaikyo('120')
220
229
  @概況売掛金 = gaikyo('130')
221
230
  @概況棚卸資産 = gaikyo('160')
222
- @概況貸付金 = gaikyo('140') + gaikyo('333')
231
+ @概況貸付金 = ['140', '333'].map { |k| gaikyo(k) }.compact.sum
223
232
  @概況建物 = gaikyo('311')
224
233
  @概況機械 = gaikyo('313')
225
- @概況車船 = gaikyo('314') + gaikyo('318')
234
+ @概況車船 = ['314', '318'].map { |k| gaikyo(k) }.compact.sum
226
235
  @概況土地 = gaikyo('316')
227
236
  @概況負債計 = gaikyo('8ZZ')
228
237
  @概況支払手形 = gaikyo('510')
@@ -232,9 +241,9 @@ module Luca
232
241
  @概況純資産 = gaikyo('9ZZ')
233
242
  @代表者報酬 = gaikyo('C11')
234
243
  @代表者借入 = gaikyo('5121')
235
- @概況仕入 = gaikyo('B11') + gaikyo('B12')
244
+ @概況仕入 = ['B11', 'B12'].map { |k| gaikyo(k) }.compact.sum
236
245
  @概況外注費 = gaikyo('C1O')
237
- @概況人件費 = gaikyo('C11') + gaikyo('C12') + gaikyo('C13')
246
+ @概況人件費 = ['C11', 'C12', 'C13'].map { |k| gaikyo(k) }.compact.sum
238
247
  render_erb(search_template('gaikyo.xml.erb'))
239
248
  end
240
249
 
@@ -367,7 +376,8 @@ module Luca
367
376
  end
368
377
 
369
378
  def 別表五一仮払税金
370
- 未収仮払税金 = [@start_balance['1502'], @start_balance['1503'], @start_balance['1504'], @start_balance['1505']].compact.sum
379
+ 未収仮払税金 = ['1502', '1503', '1504', '1505']
380
+ .map { |k| @start_balance[k] }.compact.sum
371
381
  還付税金 = [@当期還付法人税, @当期還付都道府県住民税, @当期還付事業税, @当期還付市民税].compact.sum
372
382
  return '' if 未収仮払税金 == 0 && 還付税金 == 0 && @仮払税金 == 0
373
383
 
@@ -571,7 +581,7 @@ module Luca
571
581
  end
572
582
 
573
583
  def 別表五一期首資本
574
- readable(@start_balance.dig('911')||0 + @start_balance.dig('913')||0)
584
+ readable(['911', '913', '916'].map { |k| @start_balance.dig(k) }.compact.sum)
575
585
  end
576
586
 
577
587
  # 資本金、資本準備金、その他資本剰余金、自己株式(控除)の合算
@@ -648,11 +658,13 @@ module Luca
648
658
  end
649
659
 
650
660
  def 概況月仕入(idx)
651
- gaikyo_month(idx, 'B11') + gaikyo_month(idx, 'B12')
661
+ ['B11', 'B12']
662
+ .map { |k| gaikyo_month(idx, k) }.compact.sum
652
663
  end
653
664
 
654
665
  def 概況月人件費(idx)
655
- gaikyo_month(idx, 'C11') + gaikyo_month(idx, 'C12') + gaikyo_month(idx, 'C13') + gaikyo_month(idx, 'C14')
666
+ ['C11', 'C12', 'C13', 'C14']
667
+ .map { |k| gaikyo_month(idx, k) }.compact.sum
656
668
  end
657
669
 
658
670
  def 概況月外注費(idx)
@@ -690,10 +702,12 @@ module Luca
690
702
  end
691
703
 
692
704
  def proc_version
693
- if @end_date >= Date.parse('2021-4-1')
694
- { 'proc' => '21.0.2', 'HOA112' => '3.1', 'HOA116' => '2.0', 'HOA420' => '20.0', 'HOA522' => '7.0', 'HOK010' => '6.0' }
705
+ if @end_date >= Date.parse('2022-4-1')
706
+ { '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' }
707
+ elsif @end_date >= Date.parse('2021-4-1')
708
+ { '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' }
695
709
  else
696
- { 'proc' => '20.0.2', 'HOA112' => '2.0', 'HOA116' => '1.0', 'HOA420' => '19.0', 'HOA522' => '6.0', 'HOK010' => '5.0' }
710
+ { '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' }
697
711
  end
698
712
  end
699
713
 
@@ -82,7 +82,7 @@ module Luca
82
82
  ["R0102AA#{@form_vers['R0102AA']}", 別表九フォーム]
83
83
  .compact.map{ |c| form_attr(c) }.join('')
84
84
  when '23ku'
85
- ["R0102AA#{@form_vers['R0102AA']}", "R0102AG120", 別表九フォーム]
85
+ ["R0102AA#{@form_vers['R0102AA']}", "R0102AG#{@form_vers['R0102AG']}", 別表九フォーム]
86
86
  .compact.map{ |c| form_attr(c) }.join('')
87
87
  when 'city'
88
88
  ["R0504AA180"].compact.map{ |c| form_attr(c) }.join('')
@@ -138,7 +138,7 @@ module Luca
138
138
 
139
139
  def 第六号
140
140
  @資本金準備金 = readable(['911', '9131'].map { |cd| @bs_data.dig(cd) }.compact.sum)
141
- STDERR.puts "第六号様式: 「決算確定の日」「国外関連者」などの追記が必要"
141
+ STDERR.puts "第六号様式: 「決算確定の日」などの追記が必要。「国外関連者」の確認が必要"
142
142
  render_erb(search_template('el-no6.xml.erb'))
143
143
  end
144
144
 
@@ -180,7 +180,7 @@ module Luca
180
180
  @所得割中間納付
181
181
  end
182
182
 
183
- # TODO: 損失の区分
183
+ # 災害損失は考慮していない
184
184
  #
185
185
  def 別表九各期青色損失
186
186
  tags = @繰越損失管理.records
@@ -192,7 +192,7 @@ module Luca
192
192
  %Q(<AMB00200>
193
193
  <AMB00210>#{etax_date(@start_date)}</AMB00210>
194
194
  <AMB00220>#{etax_date(@end_date)}</AMB00220>
195
- <AMB00225 />
195
+ <AMB00225>1</AMB00225>
196
196
  #{render_attr('AMB00230', deduction + record['amount'])}
197
197
  #{render_attr('AMB00240', deduction)}
198
198
  #{render_attr('AMB00250', record['amount'])}
@@ -250,10 +250,12 @@ module Luca
250
250
  end
251
251
 
252
252
  def proc_version
253
- if @start_date >= Date.parse('2020-4-1')
254
- { 'R0102AA' => '200', 'R0102AM' => '200' }
253
+ if @end_date >= Date.parse('2022-4-1')
254
+ { 'R0102AA' => '211', 'R0102AG' => '211', 'R0102AM' => '211' }
255
+ elsif @start_date >= Date.parse('2020-4-1')
256
+ { 'R0102AA' => '200', 'R0102AG' => '120','R0102AM' => '200' }
255
257
  else
256
- { 'R0102AA' => '190', 'R0102AM' => '190' }
258
+ { 'R0102AA' => '190', 'R0102AG' => '120', 'R0102AM' => '190' }
257
259
  end
258
260
  end
259
261
 
@@ -30,4 +30,7 @@
30
30
  <%= render_attr('QHC00050', 地方法人税額(@地方法人税課税標準)) %>
31
31
  </QHC00030>
32
32
  </QHC00000>
33
+ <%# QHD00000 この申告が修正申告である場合の計算 %>
34
+ <%# QHF00000 土地譲渡税額の内訳 %>
35
+ <%# QHG00000 外国税額の控除額の計算 %>
33
36
  </HOA116>
@@ -38,7 +38,8 @@
38
38
  <BGB00000>
39
39
  <%= render_attr('BGB00010', 所得金額) %>
40
40
  <%= render_attr('BGB00020', @法人税額) %>
41
- <%= render_attr('BGB00040', @法人税額) %>
41
+ <%= render_attr('BGB00040', @法人税額) if @form_vers['HOA112'].to_f < 4.0 %>
42
+ <%# BGB00055 税額控除超過額相当額の加算額 %>
42
43
  <BGB00120>
43
44
  <%= render_attr('BGB00150', @法人税額) %>
44
45
  </BGB00120>
@@ -62,12 +63,21 @@
62
63
  <%= render_attr('BGC00050', @地方法人税課税標準) %>
63
64
  </BGC00010>
64
65
  <%= render_attr('BGC00060', @地方法人税額) %>
66
+ <%# BGC00065 税額控除超過額相当額の加算額 %>
65
67
  <%= render_attr('BGC00080', @地方法人税額) %>
66
68
  <%= render_attr('BGC00120', @確定地方法人税額) %>
67
69
  <%= render_attr('BGC00130', @地方法人税中間納付) %>
68
70
  <%= render_attr('BGC00140', 納付税額(@確定地方法人税額, @地方法人税中間納付)) %>
69
71
  <BGC00150>
70
- <%= render_attr('BGC00170', 中間還付税額(@確定地方法人税額, @地方法人税中間納付)) %>
72
+ <% if @form_vers['HOA112'].to_f >= 4.0 %>
73
+ <%# BGC00240 外国税額の還付金額 %>
74
+ <%= render_attr('BGC00250', 中間還付税額(@確定地方法人税額, @地方法人税中間納付)) %>
75
+ <BGC00260>
76
+ <%= render_attr('BGC00280', 中間還付税額(@確定地方法人税額, @地方法人税中間納付)) %>
77
+ </BGC00260>
78
+ <% else %>
79
+ <%= render_attr('BGC00170', 中間還付税額(@確定地方法人税額, @地方法人税中間納付)) %>
80
+ <% end %>
71
81
  </BGC00150>
72
82
  </BGC00000>
73
83
  </HOA112>
@@ -1,4 +1,4 @@
1
- <HOE200 page="1" VR="13.0" id="HOE200" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
1
+ <HOE200 page="1" VR="<%= @form_vers['HOE200'] %>" id="HOE200" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
2
  <EGA00000>
3
3
  <EGA00010>
4
4
  <EGA00020 IDREF="JIGYO_NENDO_FROM"/>
@@ -28,13 +28,14 @@
28
28
  <% end %>
29
29
  </ARC00100>
30
30
  <%= 別表四還付事業税 %>
31
+ <%# ARC00360 通算法人に係る加算額 %>
31
32
  <% if (@当期還付法人税 + @当期還付都道府県住民税 + @当期還付市民税) > 0 %>
32
- <ARC00220>
33
- <%= render_attr('ARC00230', '前期仮払税金否認') %>
34
- <% ['ARC00240', 'ARC00250'].each do |code| %>
33
+ <ARC00275>
34
+ <%= render_attr('ARC00280', '前期仮払税金否認') %>
35
+ <% ['ARC00290', 'ARC00300'].each do |code| %>
35
36
  <%= render_attr(code, [@当期還付法人税, @当期還付都道府県住民税, @当期還付市民税].compact.sum) %>
36
37
  <% end %>
37
- </ARC00220>
38
+ </ARC00275>
38
39
  <% end %>
39
40
  <ARC00325>
40
41
  <% ['ARC00330', 'ARC00340'].each do |code| %>
@@ -53,6 +54,7 @@
53
54
  <%= render_attr(code, [@当期還付法人税, @当期還付都道府県住民税, @当期還付市民税].compact.sum) %>
54
55
  <% end %>
55
56
  </ARD00100>
57
+ <%# ARD00400 通算法人に係る減算額 %>
56
58
  <% if (法人税仮払納付額 + 都道府県民税仮払納付 + 市民税仮払納付) > 0 %>
57
59
  <ARD00215>
58
60
  <%= render_attr('ARD00220', '仮払税金認定損') %>
@@ -100,6 +102,13 @@
100
102
  <%= render_attr(code, @別表四調整所得) %>
101
103
  <% end %>
102
104
  </ARS00000>
105
+ <%# ARS10000 更生欠損金又は民事再生等評価換えが行われる場合の再生等欠損金の損金算入額 %>
106
+ <%# ARS20000 通算対象欠損金額の損金算入額又は通算対象所得金額の益金算入額 %>
107
+ <ARS50000>
108
+ <% ['ARS50010', 'ARS50020'].each do |code| %>
109
+ <%= render_attr(code, @別表四調整所得) %>
110
+ <% end %>
111
+ </ARS50000>
103
112
  <ART00000>
104
113
  <% ['ART00010', 'ART00020'].each do |code| %>
105
114
  <%= render_attr(code, @繰越損失管理.deduction) %>
@@ -1,4 +1,4 @@
1
- <HOA511 page="1" VR="13.0" id="HOA511" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
1
+ <HOA511 page="1" VR="<%= @form_vers['HOA511'] %>" id="HOA511" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
2
  <ICA00000>
3
3
  <ICA00010>
4
4
  <ICA00020 IDREF="JIGYO_NENDO_FROM"/>
@@ -39,6 +39,7 @@
39
39
  </ICB00550>
40
40
  <%= render_attr('ICB00610', 期末未納法人税) %>
41
41
  </ICB00530>
42
+ <%# ICB00860 未払通算税効果額 %>
42
43
  <ICB00620>
43
44
  <%= render_attr('ICB00630', 期首未納都道府県民税) %>
44
45
  <ICB00640>
@@ -272,4 +272,5 @@
272
272
  </IEG00080>
273
273
  <%= render_attr('IEG00190', 当期納税充当金) %>
274
274
  </IEG00000>
275
+ <%# IEI00000 通算法人の通算税効果額又は連結法人税個別帰属額及び連結地方法人税個別帰属額の発生状況等の明細 %>
275
276
  </HOA522>
@@ -1,4 +1,4 @@
1
- <HOB710 page="1" VR="11.0" id="HOB710" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
1
+ <HOB710 page="1" VR="<%= @form_vers['HOB710'] %>" id="HOB710" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
2
  <MCA00000>
3
3
  <MCA00010>
4
4
  <MCA00020 IDREF="JIGYO_NENDO_FROM"/>
@@ -1,4 +1,4 @@
1
- <R0102AG120 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="120" page="" seiseiSoft="<%= @software %>" seiseiVr="1" seiseiDay="<%= Date.today.strftime('%Y%m%d') %>" seiseiNM="<%= it_part_config('nozeisha_nm') %>" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
1
+ <R0102AG<%= @form_vers['R0102AG'] %> xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="<%= @form_vers['R0102AG'] %>" page="" seiseiSoft="<%= @software %>" seiseiVr="1" seiseiDay="<%= Date.today.strftime('%Y%m%d') %>" seiseiNM="<%= it_part_config('nozeisha_nm') %>" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
2
2
  <AGA_JIGYO_SDATE idref="SDATE">
3
3
  <gen:era></gen:era><gen:yy></gen:yy><gen:mm></gen:mm><gen:dd></gen:dd>
4
4
  <gen:yyyymmdd></gen:yyyymmdd>
@@ -142,37 +142,41 @@
142
142
  <AGF00800 />
143
143
  <AGF00900><%= "12" if @employee <= 50 %></AGF00900>
144
144
  <AGF01000><%= @均等割 if @employee <= 50 %></AGF01000>
145
- <AGF01100 />
146
- <AGF01200 />
147
- <AGF01300 />
148
- <AGF01400 />
149
- <AGF01500 />
150
- <AGF01600 />
151
- <AGF01700 />
152
- <AGF01800 />
153
- <AGF01900 />
154
- <AGF02000 />
155
- <AGF02100 />
156
- <AGF02200 />
157
- <AGF02300 />
158
- <AGF02400 />
145
+ <AGF01050>
146
+ <AGF01100 />
147
+ <AGF01200 />
148
+ <AGF01300 />
149
+ <AGF01400 />
150
+ <AGF01500 />
151
+ <AGF01600 />
152
+ <AGF01700 />
153
+ <AGF01800 />
154
+ <AGF01900 />
155
+ <AGF02000 />
156
+ <AGF02100 />
157
+ <AGF02200 />
158
+ <AGF02300 />
159
+ <AGF02400 />
160
+ </AGF01050>
159
161
  <AGF02500 />
160
162
  <AGF02600 />
161
163
  <AGF02700 />
162
- <AGF02800 />
163
- <AGF02900 />
164
- <AGF03000 />
165
- <AGF03100 />
166
- <AGF03200 />
167
- <AGF03300 />
168
- <AGF03400 />
169
- <AGF03500 />
170
- <AGF03600 />
171
- <AGF03700 />
172
- <AGF03800 />
173
- <AGF03900 />
174
- <AGF04000 />
175
- <AGF04100 />
164
+ <AGF02750>
165
+ <AGF02800 />
166
+ <AGF02900 />
167
+ <AGF03000 />
168
+ <AGF03100 />
169
+ <AGF03200 />
170
+ <AGF03300 />
171
+ <AGF03400 />
172
+ <AGF03500 />
173
+ <AGF03600 />
174
+ <AGF03700 />
175
+ <AGF03800 />
176
+ <AGF03900 />
177
+ <AGF04000 />
178
+ <AGF04100 />
179
+ </AGF02750>
176
180
  <AGF04200><%= @均等割 %></AGF04200>
177
181
  <AGG00100 />
178
- </R0102AG120>
182
+ </R0102AG<%= @form_vers['R0102AG'] %>>
@@ -70,6 +70,7 @@
70
70
  <AAB00800><%= 法人税割税率[0] unless tokyo23? %></AAB00800>
71
71
  <AAB00810><%= 法人税割[0] %></AAB00810>
72
72
  <AAB00820 />
73
+ <AAB00830 />
73
74
  <AAB00850 />
74
75
  <AAB00900 />
75
76
  <AAB01000 />
@@ -194,7 +195,7 @@
194
195
  <AAI00400>1</AAI00400>
195
196
  <AAI00450><%= @税額.dig(:houjin, :kokuzei) %></AAI00450>
196
197
  <AAI00700><%= @税額.dig(:houjin, :kokuzei) > 200000 ? 1 : 2 %></AAI00700>
197
- <AAI00800 />
198
+ <AAI00800>2</AAI00800>
198
199
  <AAJ_DAIRI_NAME></AAJ_DAIRI_NAME>
199
200
  <AAJ_DAIRI_TEL_NUM></AAJ_DAIRI_TEL_NUM>
200
201
  </R0102AA<%= @form_vers['R0102AA'] %>>
@@ -1,4 +1,4 @@
1
- <HOE990 page="1" VR="5.0" id="HOE990" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
1
+ <HOE990 page="1" VR="<%= @form_vers['HOE990'] %>" id="HOE990" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
2
  <MAA00000>
3
3
  <MAA00010>
4
4
  <MAA00020 IDREF="JIGYO_NENDO_FROM"/>
@@ -22,7 +22,7 @@
22
22
  </MAA00140>
23
23
  <MAA00170 IDREF="JIGYO_NAIYO"/>
24
24
  </MAA00000>
25
- <% if 所得金額 > 0 %>
25
+ <% if 所得金額 > 0 && 期末資本金 <= 100_000_000 %>
26
26
  <MAB00000>
27
27
  <MAB00010>
28
28
  <%= render_attr('MAB00020', 42) %>
@@ -1,4 +1,13 @@
1
1
  <HOI141 page="1" VR="5.0" id="HOI141" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
+ <ILA00000>
3
+ <ILA00010>
4
+ <ILA00025><kubun_CD>01</kubun_CD></ILA00025>
5
+ <ILA00030><%= it_part_config('daihyo_nm') %></ILA00030>
6
+ <ILA00045><kubun_CD>01</kubun_CD></ILA00045>
7
+ <ILA00050><%= it_part_config('daihyo_adr') %></ILA00050>
8
+ <ILA00060><kubun_CD>1</kubun_CD></ILA00060>
9
+ </ILA00010>
10
+ </ILA00000>
2
11
  <ILB00000>
3
12
  <ILB00010>
4
13
  <%= render_attr('ILB00020', @役員報酬) %>
@@ -0,0 +1,16 @@
1
+ <HOI160 page="1" VR="3.0" id="HOI160" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
+ <% @雑益.each do |profit| %>
3
+ <HPB00000>
4
+ <HPB00100>雑収入</HPB00100>
5
+ <%= render_attr('HPB00200', profit[:note]) %>
6
+ <%= render_attr('HPB00500', profit[:amount]) %>
7
+ </HPB00000>
8
+ <% end %>
9
+ <% @雑損失.each do |loss| %>
10
+ <HPC00000>
11
+ <HPC00100>雑損失</HPC00100>
12
+ <%= render_attr('HPC00200', loss[:note]) %>
13
+ <%= render_attr('HPC00500', loss[:amount]) %>
14
+ </HPC00000>
15
+ <% end %>
16
+ </HOI160>
@@ -169,6 +169,7 @@ module Luca #:nodoc:
169
169
  account_codes = uchiwake_account_config('C1E').map { |account| account['code'].to_s }
170
170
  return nil if account_codes.length == 0
171
171
 
172
+ STDERR.puts "勘定科目内訳書(地代家賃)の支払対象期間の追記が必要"
172
173
  @地代家賃 = @bs_data.each.with_object({}) do |(k, v), h|
173
174
  next unless account_codes.include?(k)
174
175
  next unless readable(v || 0) > 0
@@ -191,10 +192,66 @@ module Luca #:nodoc:
191
192
  end
192
193
 
193
194
  def 役員報酬内訳
195
+ STDERR.puts "勘定科目内訳書(役員報酬)の個人別金額の追記が必要"
194
196
  @役員報酬 = readable(@pl_data.dig('C11') || 0)
195
197
  @給料 = readable(@pl_data.dig('C12') || 0)
196
198
  render_erb(search_template('yakuin-meisai.xml.erb'))
197
199
  end
200
+
201
+ # 雑収入のうち、10万円以上または未収入金とのセット仕訳
202
+ # 雑収入の補助科目のうち、10万円以上
203
+ # 雑損失とその補助科目のうち、10万円以上の仕訳
204
+ #
205
+ def 雑益雑損失内訳フォーム
206
+ @雑益 = LucaBook::List.term(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'D16')
207
+ .data
208
+ .map { |journal| {
209
+ note: journal[:note],
210
+ amount: readable(journal[:credit].select { |entry| entry[:code] == 'D16' }
211
+ .map { |entry| entry[:amount] }.compact.sum),
212
+ tax_refund: journal[:credit].index { |entry| entry[:code] =~ /^150/ }
213
+ } }
214
+ .select { |obj| obj[:amount] >= 100_000 || obj[:tax_refund] }
215
+ @pl_data.keys
216
+ .select { |k| k =~ /^D16[0-9A-Z]+/ && @pl_data[k] >= 100_000 }
217
+ .each do |k|
218
+ @雑益.push({
219
+ note: self.class.dict.dig(k)[:label],
220
+ amount: @pl_data[k]
221
+ })
222
+ end
223
+ @雑益 = @雑益.sort_by{ |obj| obj[:amount] }
224
+ .reverse.take(10)
225
+
226
+ @雑損失 = LucaBook::List.term(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'E16')
227
+ .data
228
+ .map { |journal| {
229
+ note: journal[:note],
230
+ amount: readable(journal[:debit].select { |entry| entry[:code] == 'E16' }
231
+ .map { |entry| entry[:amount] }.compact.sum)
232
+ } }
233
+ .select { |obj| obj[:amount] >= 100_000 }
234
+ @pl_data.keys
235
+ .select { |k| k =~ /^E16[0-9A-Z]+/ && @pl_data[k] >= 100_000 }
236
+ .each do |k|
237
+ @雑損失.push({
238
+ note: self.class.dict.dig(k)[:label],
239
+ amount: @pl_data[k]
240
+ })
241
+ end
242
+ @雑損失 = @雑損失.sort_by{ |obj| obj[:amount] }
243
+ .reverse.take(10)
244
+ return nil if @雑益.empty? && @雑損失.empty?
245
+
246
+ 'HOI160'
247
+ end
248
+
249
+ def 雑益雑損失内訳
250
+ return nil if @雑益.empty? && @雑損失.empty?
251
+
252
+ STDERR.puts "勘定科目内訳書(雑益雑損失)の内容確認"
253
+ render_erb(search_template('zatsueki-meisai.xml.erb'))
254
+ end
198
255
  end
199
256
  end
200
257
  end
@@ -12,9 +12,10 @@ module Luca
12
12
  class Urikake < LucaDeal::Invoice
13
13
  @dirname = 'invoices'
14
14
 
15
- def report(total = nil)
15
+ def report(total = nil, encoding = nil)
16
16
  listed_amount = 0
17
- str = CSV.generate(String.new, headers: false, col_sep: ',', encoding: 'UTF-8') do |f|
17
+ encoding ||= 'SJIS'
18
+ str = CSV.generate(String.new, headers: false, col_sep: ',', encoding: encoding) do |f|
18
19
  list.map do |invoice|
19
20
  amount = readable(invoice.dig('subtotal', 0, 'items') + invoice.dig('subtotal', 0, 'tax'))
20
21
  listed_amount += amount
@@ -23,6 +24,8 @@ module Luca
23
24
  if total
24
25
  f << ['3', '0', '売掛金', 'その他', nil, total - listed_amount, nil ]
25
26
  f << ['3', '1', nil, nil, nil, total, nil ]
27
+ else
28
+ f << ['3', '1', nil, nil, nil, listed_amount, nil ]
26
29
  end
27
30
  end
28
31
  File.open('HOI030_3.0.csv', 'w') { |f| f.write(str) }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.14.2'
5
+ VERSION = '0.16.0'
6
6
  end
7
7
  end
@@ -16,13 +16,15 @@ class LucaSalary::Jp < LucaSalary::Base
16
16
  __dir__
17
17
  end
18
18
 
19
- def calc_payment(profile)
19
+ def calc_payment(profile, date)
20
+ 配偶者控除 = profile.include?('spouse')
21
+ 扶養控除 = self.class.扶養控除対象者の数(profile['family'], Date.new(date.year, 12, 31))
20
22
  {}.tap do |h|
21
23
  select_code(profile, '1').each { |k, v| h[k] = v }
22
24
  h['201'] = @insurance.health_insurance_salary(insurance_rank(profile))
23
25
  h['202'] = @insurance.pension_salary(pension_rank(profile))
24
26
  tax_base = self.class.sum_code(h, '1', income_tax_exception) - h['201'] - h['202']
25
- h['203'] = JpNationalTax::IncomeTax.calc_kouran(tax_base, Date.today, true)
27
+ h['203'] = JpNationalTax::IncomeTax.calc_kouran(tax_base, Date.today, 配偶者控除, 扶養控除)
26
28
  h['211'] = resident_tax(profile)
27
29
  select_code(profile, '3').each { |k, v| h[k] = v }
28
30
  select_code(profile, '4').each { |k, v| h[k] = v }
@@ -31,13 +33,17 @@ class LucaSalary::Jp < LucaSalary::Base
31
33
  end
32
34
  end
33
35
 
34
- def self.year_total(payment, date)
36
+ def self.year_total(profile, payment, date)
37
+ raise '年末調整の対象となりません' if payment['1'] == 0
38
+
35
39
  payment.tap do |p|
36
40
  p['911'] = JpNationalTax::IncomeTax.basic_deduction(p['1'], date)
37
- p['916'] = partner_deduction(p['1'])
41
+ p['916'] = 配偶者控除の金額(p['1'], profile['spouse'], date)
42
+ p['917'] = 配偶者特別控除の金額(p['1'], profile['spouse'], date)
43
+ p['918'] = 扶養控除の金額(profile['family'], date)
38
44
  p['912'] = ['201', '202', '204', '205'].map{ |cd| p[cd] }.compact.sum
39
45
  p['901'] = JpNationalTax::IncomeTax.year_salary_taxable(p['1'], date)
40
- p['941'] = p['901'] - p['911'] - p['912'] - p['916']
46
+ p['941'] = p['901'] - ['911', '912', '916', '917', '918'].map{ |cd| p[cd] }.compact.sum
41
47
  p['961'] = JpNationalTax::IncomeTax.year_tax(p['941'], date)
42
48
  diff = p['961'] - p['203']
43
49
  if diff.positive?
@@ -54,18 +60,95 @@ class LucaSalary::Jp < LucaSalary::Base
54
60
  end
55
61
  end
56
62
 
57
- def self.partner_deduction(income)
58
- if income <= 9_000_000
59
- 380_000
60
- elsif income <= 9_500_000
61
- 260_000
62
- elsif income <= 10_000_000
63
- 130_000
63
+ def self.配偶者控除の金額(income, spouse, date)
64
+ puts spouse
65
+ return nil if spouse.nil?
66
+
67
+ puts spouse
68
+ spouse_salary = JpNationalTax::IncomeTax.year_salary_taxable(spouse['income'][date.year.to_s] || 0, date)
69
+ return 0 if spouse_salary > 480_000
70
+
71
+ salary = JpNationalTax::IncomeTax.year_salary_taxable(income || 0, date)
72
+ birth_date = spouse['birth_date'] || date
73
+ if salary <= 9_000_000
74
+ birth_date <= date.prev_year(70) ? 480_000 : 380_000
75
+ elsif salary <= 9_500_000
76
+ birth_date <= date.prev_year(70) ? 320_000 : 260_000
77
+ elsif salary <= 10_000_000
78
+ birth_date <= date.prev_year(70) ? 160_000 : 130_000
64
79
  else
65
80
  0
66
81
  end
67
82
  end
68
83
 
84
+ def self.配偶者特別控除の金額(income, spouse, date)
85
+ return nil if spouse.nil?
86
+
87
+ salary = JpNationalTax::IncomeTax.year_salary_taxable(income || 0, date)
88
+ return 0 if salary > 10_000_000
89
+
90
+ spouse_salary = JpNationalTax::IncomeTax.year_salary_taxable(spouse['income'][date.year.to_s] || 0, date)
91
+ return 0 if spouse_salary <= 480_000
92
+ return 0 if spouse_salary > 1_330_000
93
+
94
+ if salary <= 9_000_000
95
+ return 380_000 if spouse_salary <= 950_000
96
+ return 360_000 if spouse_salary <= 1_000_000
97
+ return 310_000 if spouse_salary <= 1_050_000
98
+ return 260_000 if spouse_salary <= 1_100_000
99
+ return 210_000 if spouse_salary <= 1_150_000
100
+ return 160_000 if spouse_salary <= 1_200_000
101
+ return 110_000 if spouse_salary <= 1_250_000
102
+ return 60_000 if spouse_salary <= 1_300_000
103
+ return 30_000
104
+ elsif salary <= 9_500_000
105
+ return 260_000 if spouse_salary <= 950_000
106
+ return 240_000 if spouse_salary <= 1_000_000
107
+ return 210_000 if spouse_salary <= 1_050_000
108
+ return 180_000 if spouse_salary <= 1_100_000
109
+ return 140_000 if spouse_salary <= 1_150_000
110
+ return 110_000 if spouse_salary <= 1_200_000
111
+ return 80_000 if spouse_salary <= 1_250_000
112
+ return 40_000 if spouse_salary <= 1_300_000
113
+ return 20_000
114
+ else
115
+ return 130_000 if spouse_salary <= 950_000
116
+ return 120_000 if spouse_salary <= 1_000_000
117
+ return 110_000 if spouse_salary <= 1_050_000
118
+ return 90_000 if spouse_salary <= 1_100_000
119
+ return 70_000 if spouse_salary <= 1_150_000
120
+ return 60_000 if spouse_salary <= 1_200_000
121
+ return 40_000 if spouse_salary <= 1_250_000
122
+ return 20_000 if spouse_salary <= 1_300_000
123
+ return 10_000
124
+ end
125
+ end
126
+
127
+ def self.扶養控除の金額(family, date)
128
+ return if family.nil?
129
+
130
+ family.map { |person| 各家族の扶養控除の額(person, date) }.sum
131
+ end
132
+
133
+ def self.各家族の扶養控除の額(person, date)
134
+ birth_date = person['birth_date']
135
+ return 0 if birth_date.nil?
136
+
137
+ if birth_date > date.prev_year(16)
138
+ 0
139
+ elsif birth_date <= date.prev_year(70)
140
+ person['live_with'] ? 580_000 : 480_000 # 老人扶養親族
141
+ elsif birth_date <= date.prev_year(19) and birth_date > date.prev_year(23)
142
+ 630_000 # 特定扶養親族
143
+ else
144
+ 380_000
145
+ end
146
+ end
147
+
148
+ def self.扶養控除対象者の数(family, date)
149
+ family.map { |person| 各家族の扶養控除の額(person, date) > 0 ? 1 : 0 }.sum
150
+ end
151
+
69
152
  def income_tax_exception
70
153
  %w[116 118 119 11A 11B]
71
154
  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.14.2
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-17 00:00:00.000000000 Z
11
+ date: 2024-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucabook
@@ -157,6 +157,7 @@ files:
157
157
  - lib/luca/jp/templates/tekiyougaku.xml.erb
158
158
  - lib/luca/jp/templates/yakuin-meisai.xml.erb
159
159
  - lib/luca/jp/templates/yokin-meisai.xml.erb
160
+ - lib/luca/jp/templates/zatsueki-meisai.xml.erb
160
161
  - lib/luca/jp/uchiwake.rb
161
162
  - lib/luca/jp/urikake.rb
162
163
  - lib/luca/jp/util.rb
@@ -173,7 +174,7 @@ metadata:
173
174
  homepage_uri: https://github.com/chumaltd/luca-jp
174
175
  source_code_uri: https://github.com/chumaltd/luca-jp
175
176
  changelog_uri: https://github.com/chumaltd/luca-jp/CHANGELOG.md
176
- post_install_message:
177
+ post_install_message:
177
178
  rdoc_options: []
178
179
  require_paths:
179
180
  - lib
@@ -188,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  - !ruby/object:Gem::Version
189
190
  version: '0'
190
191
  requirements: []
191
- rubygems_version: 3.3.5
192
- signing_key:
192
+ rubygems_version: 3.4.10
193
+ signing_key:
193
194
  specification_version: 4
194
195
  summary: JP tax extension for Luca
195
196
  test_files: []