luca-jp 0.20.3 → 0.20.5

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: 827562f80bb3c45d9b0058ba94e99c08e537c6e05288d695970b2b25420abf6d
4
- data.tar.gz: c7b1dc9f95b4d5a0a0430a312d32eb17e679e8ca0e9a7679f0b28fb8d754b7fd
3
+ metadata.gz: c08c93c99340c765ef5a6f54e7d32a08da995925a42d9217b987e432b3a83cde
4
+ data.tar.gz: b1bfd83cec6fc56050f7a70a0578de2942fcf74e539249faef30bc1da6f05ddb
5
5
  SHA512:
6
- metadata.gz: d48e2910162d833838b007ba484490f24db49b8ad22917cea36eb76abfa59366db5df2f674a17f80c602d12278b3cc02b2ed03c8b4856e1ca7f2caafa7ac265f
7
- data.tar.gz: 2d14ba140686ec2957cd0d8b09e887aa9cc7dfc4816c4e9a9ebeeb9b96f43975576e5ab4d96d350c5efad30068495fef1ed5ed27533db29fb88f6b2f4127039e
6
+ metadata.gz: 504a1bdfcccdf1e2b1881b44c928a8b62ab5cd640eb262d6082a9ff290c1d73184575540a9e661a0b88fd126fdeb397bc7ef56dc4f5ca268f5d42d1cd16c4d68
7
+ data.tar.gz: cb95c8d8bca2d4aee9442f6253b7159ae9b8c24df12dd255d887de889a00312c894af39608772a38191f999db215d7a0846ad78c70ada84c755accfef632f1fc
data/lib/luca/jp/util.rb CHANGED
@@ -21,6 +21,10 @@ module Luca
21
21
  end
22
22
  end
23
23
 
24
+ def alphadigit_ja(str)
25
+ str.tr('A-Z0-9\- ', 'A-Z0-9ー ')
26
+ end
27
+
24
28
  # TODO: customerオプションを適切に扱うには
25
29
  # 納付時にx-customerを付加していないケースの考慮が必要
26
30
  def prepaid_tax(code, customer = nil)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.20.3'
5
+ VERSION = '0.20.5'
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaSalaryJp
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.2'
5
5
  end
@@ -43,8 +43,8 @@ class LucaSalary::Jp < LucaSalary::Base
43
43
  payment.tap do |p|
44
44
  p['901'] = 給与等の金額
45
45
  p['911'] = JpNationalTax::IncomeTax.basic_deduction(給与等の金額, date)
46
- p['916'] = 配偶者控除の金額(p['1'], profile['spouse'], date)
47
- p['917'] = 配偶者特別控除の金額(p['1'], profile['spouse'], date)
46
+ p['916'] = 配偶者控除の金額(給与等の金額, profile['spouse'], date)
47
+ p['917'] = 配偶者特別控除の金額(給与等の金額, profile['spouse'], date)
48
48
  p['918'] = 扶養控除の金額(profile['family'], date)
49
49
  p['912'] = ['201', '202', '204', '205'].map{ |cd| p[cd] }.compact.sum
50
50
  課税給与所得金額 = 給与等の金額 - ['911', '912', '916', '917', '918'].map{ |cd| p[cd] }.compact.sum
@@ -65,68 +65,23 @@ class LucaSalary::Jp < LucaSalary::Base
65
65
  end
66
66
  end
67
67
 
68
- def self.配偶者控除の金額(income, spouse, date)
69
- puts spouse
68
+ def self.配偶者控除の金額(salary, spouse, date)
70
69
  return nil if spouse.nil?
71
70
 
72
- puts spouse
73
71
  spouse_salary = JpNationalTax::IncomeTax.year_salary_taxable(spouse['income'][date.year.to_s] || 0, date)
74
- return 0 if spouse_salary > 480_000
75
-
76
- salary = JpNationalTax::IncomeTax.year_salary_taxable(income || 0, date)
77
- birth_date = spouse['birth_date'] || date
78
- if salary <= 9_000_000
79
- birth_date <= date.prev_year(70) ? 480_000 : 380_000
80
- elsif salary <= 9_500_000
81
- birth_date <= date.prev_year(70) ? 320_000 : 260_000
82
- elsif salary <= 10_000_000
83
- birth_date <= date.prev_year(70) ? 160_000 : 130_000
84
- else
85
- 0
86
- end
72
+ return 0 if spouse_salary > 580_000
73
+
74
+ JpNationalTax::IncomeTax.spouse_deduction(salary, spouse_salary, date, spouse['birth_date'])
87
75
  end
88
76
 
89
- def self.配偶者特別控除の金額(income, spouse, date)
77
+ def self.配偶者特別控除の金額(salary, spouse, date)
90
78
  return nil if spouse.nil?
91
-
92
- salary = JpNationalTax::IncomeTax.year_salary_taxable(income || 0, date)
93
79
  return 0 if salary > 10_000_000
94
80
 
95
81
  spouse_salary = JpNationalTax::IncomeTax.year_salary_taxable(spouse['income'][date.year.to_s] || 0, date)
96
- return 0 if spouse_salary <= 480_000
97
- return 0 if spouse_salary > 1_330_000
98
-
99
- if salary <= 9_000_000
100
- return 380_000 if spouse_salary <= 950_000
101
- return 360_000 if spouse_salary <= 1_000_000
102
- return 310_000 if spouse_salary <= 1_050_000
103
- return 260_000 if spouse_salary <= 1_100_000
104
- return 210_000 if spouse_salary <= 1_150_000
105
- return 160_000 if spouse_salary <= 1_200_000
106
- return 110_000 if spouse_salary <= 1_250_000
107
- return 60_000 if spouse_salary <= 1_300_000
108
- return 30_000
109
- elsif salary <= 9_500_000
110
- return 260_000 if spouse_salary <= 950_000
111
- return 240_000 if spouse_salary <= 1_000_000
112
- return 210_000 if spouse_salary <= 1_050_000
113
- return 180_000 if spouse_salary <= 1_100_000
114
- return 140_000 if spouse_salary <= 1_150_000
115
- return 110_000 if spouse_salary <= 1_200_000
116
- return 80_000 if spouse_salary <= 1_250_000
117
- return 40_000 if spouse_salary <= 1_300_000
118
- return 20_000
119
- else
120
- return 130_000 if spouse_salary <= 950_000
121
- return 120_000 if spouse_salary <= 1_000_000
122
- return 110_000 if spouse_salary <= 1_050_000
123
- return 90_000 if spouse_salary <= 1_100_000
124
- return 70_000 if spouse_salary <= 1_150_000
125
- return 60_000 if spouse_salary <= 1_200_000
126
- return 40_000 if spouse_salary <= 1_250_000
127
- return 20_000 if spouse_salary <= 1_300_000
128
- return 10_000
129
- end
82
+ return 0 if spouse_salary <= 580_000
83
+
84
+ JpNationalTax::IncomeTax.spouse_deduction(salary, spouse_salary, date, spouse['birth_date'])
130
85
  end
131
86
 
132
87
  def self.扶養控除の金額(family, date)
@@ -139,15 +94,8 @@ class LucaSalary::Jp < LucaSalary::Base
139
94
  birth_date = person['birth_date']
140
95
  return 0 if birth_date.nil?
141
96
 
142
- if birth_date > date.prev_year(16)
143
- 0
144
- elsif birth_date <= date.prev_year(70)
145
- person['live_with'] ? 580_000 : 480_000 # 老人扶養親族
146
- elsif birth_date <= date.prev_year(19) and birth_date > date.prev_year(23)
147
- 630_000 # 特定扶養親族
148
- else
149
- 380_000
150
- end
97
+ salary = JpNationalTax::IncomeTax.year_salary_taxable(person.dig('income', date.year.to_s) || 0, date)
98
+ JpNationalTax::IncomeTax.family_deduction(birth_date, date, salary, live_with: person['live_with'])
151
99
  end
152
100
 
153
101
  def self.扶養控除対象者の数(family, date)
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  require 'luca_salary'
3
3
  require 'luca_support/const'
4
+ require 'luca/jp/util'
5
+
4
6
  require 'csv'
5
7
  require 'open3'
6
8
 
@@ -39,7 +41,7 @@ end
39
41
  private
40
42
 
41
43
  def 給与支払報告明細行(slip, company, year)
42
- [
44
+ record = [
43
45
  315, # 法定資料の種類
44
46
  提出義務者(company),
45
47
  0, # 提出区分(新規0, 追加1, 訂正2, 取消3)
@@ -49,18 +51,20 @@ def 給与支払報告明細行(slip, company, year)
49
51
  支払を受ける者の詳細(slip, year),
50
52
  company['tax_id'], # 法人番号
51
53
  支払を受ける者の扶養情報(slip['profile'], year),
52
- slip['911'] == 480_000 ? nil : slip['911'], # 基礎控除の額、48万の場合記載しない
54
+ (year <= 2024 && slip['911'] == 480_000) ? nil : slip['911'], # 基礎控除の額
53
55
  nil, # 所得金額調整控除額 TODO: 未実装 措法41の3の3
54
56
  nil, # ひとり親
55
- 提出先判定(slip), # 必須:作成区分(国税のみ0, 地方のみ1, 両方2)
56
- ].flatten
57
+ ]
58
+ record << [nil, nil, nil] if year >= 2025 # 特定親族控除 TODO: 未実装
59
+ record << 提出先判定(slip) # 必須:作成区分(国税のみ0, 地方のみ1, 両方2)
60
+ record.flatten
57
61
  end
58
62
 
59
63
  def 提出義務者(company)
60
64
  [
61
65
  nil, # 整理番号1
62
66
  nil, # 本支店等区分番号
63
- ['address', 'address2'].map { |attr| company[attr] }
67
+ ['address', 'address2'].map { |attr| Luca::Jp::Util.alphadigit_ja(company[attr]) }
64
68
  .compact.join(' '), # 必須:住所又は所在地
65
69
  company['name'], # 必須:氏名又は名称
66
70
  company['tel'], # 電話番号
@@ -72,7 +76,7 @@ end
72
76
 
73
77
  def 支払を受ける者(profile)
74
78
  [
75
- ['address', 'address2'].map { |attr| profile[attr] }
79
+ ['address', 'address2'].map { |attr| Luca::Jp::Util.alphadigit_ja(profile[attr]) }
76
80
  .compact.join(' '), # 必須:住所又は居所
77
81
  nil, # 国外住所表示(国内は"0"、国外は"1")
78
82
  profile['name'], # 必須:氏名
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.3
4
+ version: 0.20.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-09 00:00:00.000000000 Z
11
+ date: 2026-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucabook
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.3
75
+ version: 0.3.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.1.3
82
+ version: 0.3.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement