luca-jp 0.20.0 → 0.20.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba1a44cc2c4fb3c68846033a3f74f4791a298a9d0c4efcd0786d9cebc75954ce
4
- data.tar.gz: 30ab64d9b5a8a733848ca07968f545958e8f28584ad68425763b0e7e13e8250e
3
+ metadata.gz: a73bee2f25ed4af12e32ccc92d1c0ab5348c2bcac591c8a7607b0fb9a053c7c8
4
+ data.tar.gz: f955ad158c4d83234e838411f9de681318a13dbba546f1b0fe79d6e0cba3cb98
5
5
  SHA512:
6
- metadata.gz: 47ced553bf51ef56c53875947c421ca42ff76d28aa29a8f1239c7b88908dcaf9a0d8e61491b69ec2e62e249d7d34e5c2329e158a4b086a359565f295217eec3c
7
- data.tar.gz: 217197462328275f4ccf4a59ec706d5515196036b1eb3f0950bd701a0017d24ba0a79f695170e11e7ca463c6aa23ef9c00aed5e570e92ed8279da2584b79f5d1
6
+ metadata.gz: 7521797d4b074badbbc3e2c7f6a8e4a9469acb05df1e7a1acacef7e3570fbadbbcf167ce109de06171eb0c18d3a519907a9c233fb3c90a98611e9bd045c65aee
7
+ data.tar.gz: 2aca672676e1fafe39865b4724ff259b99c191cfb049a99bcdc364d7ace00ba85724ad7931d95db4602a0b7fbe80af55f102a6b88f7fcd4c79776f735702ebf9
data/lib/luca/jp/aoiro.rb CHANGED
@@ -333,19 +333,16 @@ module Luca
333
333
  end
334
334
 
335
335
  def 適用額明細フォーム
336
- return nil if @確定法人税額 == 0
336
+ return nil if 中小企業の軽減税率対象所得(所得金額) == 0
337
337
 
338
338
  'HOE990'
339
339
  end
340
340
 
341
341
  def 適用額明細
342
- if 期末資本金 <= 10_000_000
342
+ unless 軽減税率不適用法人
343
343
  STDERR.puts "適用額明細: 必要に応じて「少額減価償却資産の損金算入」(67条の5第1項, 00277。別表16[7])の確認が必要"
344
344
  end
345
- if @確定法人税額 == 0
346
- STDERR.puts "別表一:適用額明細書の有無の確認が必要"
347
- return nil
348
- end
345
+ return nil if 適用額明細フォーム.nil?
349
346
 
350
347
  render_erb(search_template('tekiyougaku.xml.erb'))
351
348
  end
@@ -30,13 +30,13 @@ module Luca
30
30
  # -----------------------------------------------------
31
31
 
32
32
  def 中小企業の軽減税率対象所得(所得 = nil)
33
+ return 0 if 軽減税率不適用法人
34
+
33
35
  所得 ||= 所得金額
34
36
  return 0 if 所得 <= 0
35
37
 
36
38
  if 所得 >= 8_000_000
37
39
  8_000_000
38
- elsif 所得 < 0
39
- 0
40
40
  else
41
41
  (所得 / 1000).floor * 1000
42
42
  end
@@ -48,16 +48,19 @@ module Luca
48
48
 
49
49
  def 中小企業の軽減税率対象を超える所得(所得 = nil)
50
50
  所得 ||= 所得金額
51
- return 0 if 所得 <= 0
51
+ return 0 if 所得 <= 8_000_000
52
52
 
53
- if 所得 <= 8_000_000
54
- 0
55
- else
56
- ((所得 - 8_000_000) / 1000).floor * 1000
57
- end
53
+ ((所得 - 8_000_000) / 1000).floor * 1000
58
54
  end
59
55
 
60
56
  def 一般区分の税額(所得 = nil)
57
+ 所得 ||= 所得金額
58
+ return 0 if 所得 <= 0
59
+
60
+ if 軽減税率不適用法人
61
+ return ((所得 / 1000).floor * 1000 * 23.2 / 100).to_i
62
+ end
63
+
61
64
  (中小企業の軽減税率対象を超える所得(所得) * 23.2 / 100).to_i
62
65
  end
63
66
 
@@ -26,7 +26,7 @@
26
26
  <BGA00260><kubun_CD>1</kubun_CD></BGA00260>
27
27
  </BGA00210>
28
28
  <%= render_attr('BGA00290', @概況売上) %>
29
- <BGA00300><kubun_CD>1</kubun_CD></BGA00300>
29
+ <BGA00300><kubun_CD><%= 適用額明細フォーム ? "1" : "2" -%></kubun_CD></BGA00300>
30
30
  <BGA00330>
31
31
  <BGA00340 IDREF="JIGYO_NENDO_FROM"/>
32
32
  <BGA00350 IDREF="JIGYO_NENDO_TO"/>
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.20.0'
5
+ VERSION = '0.20.2'
6
6
  end
7
7
  end
@@ -23,8 +23,11 @@ class InsuranceJP < LucaRecord::Base
23
23
  load_data(File.open(file_path))
24
24
  end
25
25
 
26
- def health_insurance_salary(rank)
27
- round6(select_health_insurance(rank).dig('insurance_elder_salary'))
26
+ def health_insurance_salary(rank, elder)
27
+ return nil if elder.nil?
28
+
29
+ category = elder ? 'insurance_elder_salary' : 'insurance_younger_salary'
30
+ round6(select_health_insurance(rank).dig(category))
28
31
  end
29
32
 
30
33
  def pension_salary(rank)
@@ -21,7 +21,10 @@ class LucaSalary::Jp < LucaSalary::Base
21
21
  扶養控除 = self.class.扶養控除対象者の数(profile['family'], Date.new(date.year, 12, 31))
22
22
  {}.tap do |h|
23
23
  select_code(profile, '1').each { |k, v| h[k] = v }
24
- h['201'] = @insurance.health_insurance_salary(insurance_rank(profile))
24
+ h['201'] = @insurance.health_insurance_salary(
25
+ insurance_rank(profile),
26
+ 介護保険?(profile['birth_date'])
27
+ )
25
28
  h['202'] = @insurance.pension_salary(pension_rank(profile))
26
29
  tax_base = self.class.sum_code(h, '1', income_tax_exception) - h['201'] - h['202']
27
30
  h['203'] = JpNationalTax::IncomeTax.calc_kouran(tax_base, Date.today, 配偶者控除, 扶養控除)
@@ -29,7 +32,7 @@ class LucaSalary::Jp < LucaSalary::Base
29
32
  select_code(profile, '3').each { |k, v| h[k] = v }
30
33
  select_code(profile, '4').each { |k, v| h[k] = v }
31
34
  h.merge!(amount_by_code(h))
32
- h['id'] = profile.dig('id')
35
+ h['id'] = profile.fetch('id')
33
36
  end
34
37
  end
35
38
 
@@ -149,14 +152,32 @@ class LucaSalary::Jp < LucaSalary::Base
149
152
  family.map { |person| 各家族の扶養控除の額(person, date) > 0 ? 1 : 0 }.sum
150
153
  end
151
154
 
152
- def income_tax_exception
153
- %w[116 118 119 11A 11B]
155
+ private
156
+
157
+ # 満40歳に達したときより徴収が始まり、満65歳に達したときより徴収されなくなる
158
+ #
159
+ def 介護保険?(birth_date)
160
+ return nil if birth_date.nil?
161
+
162
+ due_init = birth_date.next_year(40).prev_day
163
+ return false if @date.year < due_init.year
164
+ return false if @date.year == due_init.year && @date.month < due_init.month
165
+
166
+ due_last = birth_date.next_year(65).prev_day
167
+ return false if @date.year > due_last.year
168
+ return false if @date.year == due_last.year && @date.month >= due_last.month
169
+
170
+ true
154
171
  end
155
172
 
156
173
  def insurance_rank(dat)
157
174
  dat.dig('insurance', 'rank')
158
175
  end
159
176
 
177
+ def income_tax_exception
178
+ %w[116 118 119 11A 11B]
179
+ end
180
+
160
181
  def pension_rank(dat)
161
182
  dat.dig('pension', 'rank')
162
183
  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.20.0
4
+ version: 0.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-21 00:00:00.000000000 Z
11
+ date: 2025-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucabook