luca-jp 0.20.3 → 0.20.4

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: ea7c42dee2cf6b8002de5606bf2056714154a68bd4212762580029644f2f6607
4
+ data.tar.gz: f759cb53bf48adfe8148eb5f68f6f95a71c8b2decc103d63cfb6e4dce3fac2c9
5
5
  SHA512:
6
- metadata.gz: d48e2910162d833838b007ba484490f24db49b8ad22917cea36eb76abfa59366db5df2f674a17f80c602d12278b3cc02b2ed03c8b4856e1ca7f2caafa7ac265f
7
- data.tar.gz: 2d14ba140686ec2957cd0d8b09e887aa9cc7dfc4816c4e9a9ebeeb9b96f43975576e5ab4d96d350c5efad30068495fef1ed5ed27533db29fb88f6b2f4127039e
6
+ metadata.gz: 3a5e412b5cb291bd2be9e39350385969e7ad6bb9f13b8f67c62b52bdc23a5f8aa226eee59cba6684d9d787bb0e6dff14b6b711113f9e5d2291d2e467419f7c7e
7
+ data.tar.gz: 92333c73665f5e7a06a6830a4e79f4cf67ee82b3f04f715efcd1136fe66ebdb3daee355693ceecfec1199b6f8c763ecd95c5af9d2907b0a6aefdfaf2ad10236e
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.20.3'
5
+ VERSION = '0.20.4'
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.1'
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)
metadata CHANGED
@@ -1,7 +1,7 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
@@ -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