tax_jp 1.1.5 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/tax_jp/social_insurances/index.html.erb +18 -5
- data/data//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216/346/234/210/351/241/{215-20200101-20201231.tsv → 215-20200101-20211231.tsv} +0 -0
- data/data//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216/350/263/236/344/270/{216-20200101-20201231.tsv → 216-20200101-20211231.tsv} +0 -0
- data/data//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216/346/234/210/351/241/215.db +0 -0
- data/data//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216/350/263/236/344/270/216.db +0 -0
- data/data//347/244/276/344/274/232/344/277/235/351/231/272/346/226/231.db +0 -0
- data/data//347/244/276/344/274/232/344/277/235/351/231/272/346/226/231//345/216/232/347/224/237/345/271/264/351/207/221.tsv +7 -3
- data/data//347/244/276/344/274/232/344/277/235/351/231/272/346/226/231//347/255/211/347/264/{232-20161001-20991231.tsv → 232-20161001-20200831.tsv} +0 -0
- data/data//347/244/276/344/274/232/344/277/235/351/231/272/346/226/231//347/255/211/347/264/232-20200901-20991231.tsv +51 -0
- data/lib/tax_jp/social_insurance.rb +22 -5
- data/lib/tax_jp/social_insurances/db_builder.rb +1 -9
- data/lib/tax_jp/social_insurances/health_insurance.rb +3 -1
- data/lib/tax_jp/social_insurances/welfare_pension.rb +4 -4
- data/lib/tax_jp/utils.rb +4 -2
- data/lib/tax_jp/version.rb +1 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7d42c0d30f8962046150ff590931aca2efc51f486a5dc608e9cb37739e199f0
|
4
|
+
data.tar.gz: 0b6bb0e88bf75b4d88c74a0402e5be240e45742aefd46b36e975f8716976747d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0945a23e7ec872e809385e732097ed82a944a883d3b0b523c82df2eeb01357d2f079e56d0f3d8d84f0ed99f1d8cd44b9b18f9acb0072baf49ab73ee082d4977b'
|
7
|
+
data.tar.gz: 5cac757e1b2bb9061df31cfe4f5aa9b32c2783a16a83498682dec99b9dabb282a119bd8be4b37bc45c64ca0774c95a0ea5d765e053851c97c8f2d49b8957f105
|
@@ -48,7 +48,12 @@
|
|
48
48
|
<tbody>
|
49
49
|
<% @social_insurances.each do |si| %>
|
50
50
|
<tr>
|
51
|
-
|
51
|
+
<% if [0, TaxJp::INTEGER_MAX].exclude?(si.grade.pension_grade) %>
|
52
|
+
<td class="text-center"><%= si.grade.grade %>(<%= si.grade.pension_grade %>)</td>
|
53
|
+
<% else %>
|
54
|
+
<td class="text-center"><%= si.grade.grade %></td>
|
55
|
+
<% end %>
|
56
|
+
|
52
57
|
<td class="text-right"><%= si.grade.monthly_standard.to_s(:delimited) %></td>
|
53
58
|
<td class="text-right"><%= si.grade.daily_standard.to_s(:delimited) %></td>
|
54
59
|
<td class="text-right"><%= si.grade.salary_from.to_s(:delimited) %></td>
|
@@ -57,10 +62,18 @@
|
|
57
62
|
<td class="text-right"><%= si.health_insurance.general_amount_half.to_s(:delimited) %></td>
|
58
63
|
<td class="text-right"><%= si.health_insurance.general_amount_care.to_s(:delimited) %></td>
|
59
64
|
<td class="text-right"><%= si.health_insurance.general_amount_care_half.to_s(:delimited) %></td>
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
65
|
+
|
66
|
+
<% if [0, TaxJp::INTEGER_MAX].exclude?(si.grade.pension_grade) %>
|
67
|
+
<td class="text-right"><%= number_to_currency(si.welfare_pension.general_amount, unit: '', precision: 2) if si.welfare_pension.general_amount > 0 %></td>
|
68
|
+
<td class="text-right"><%= number_to_currency(si.welfare_pension.general_amount_half, unit: '', precision: 2) if si.welfare_pension.general_amount_half > 0 %></td>
|
69
|
+
<td class="text-right"><%= number_to_currency(si.welfare_pension.particular_amount, unit: '', precision: 2) if si.welfare_pension.particular_amount > 0 %></td>
|
70
|
+
<td class="text-right"><%= number_to_currency(si.welfare_pension.particular_amount_half, unit: '', precision: 2) if si.welfare_pension.particular_amount_half > 0 %></td>
|
71
|
+
<% else %>
|
72
|
+
<td></td>
|
73
|
+
<td></td>
|
74
|
+
<td></td>
|
75
|
+
<td></td>
|
76
|
+
<% end %>
|
64
77
|
</tr>
|
65
78
|
<% end %>
|
66
79
|
</tbody>
|
File without changes
|
File without changes
|
data/data//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216/346/234/210/351/241/215.db
CHANGED
Binary file
|
data/data//346/272/220/346/263/211/345/276/264/345/217/216/347/250/216/350/263/236/344/270/216.db
CHANGED
Binary file
|
Binary file
|
@@ -8,6 +8,10 @@
|
|
8
8
|
2012-09-01 2013-08-31 16.766 17.192 0.15
|
9
9
|
2013-09-01 2014-08-31 17.12 17.4 0.15
|
10
10
|
2014-09-01 2015-08-31 17.474 17.688 0.15
|
11
|
-
2015-09-01 2016-
|
12
|
-
2016-
|
13
|
-
|
11
|
+
2015-09-01 2016-03-31 17.828 17.936 0.15
|
12
|
+
2016-04-01 2016-08-31 17.828 17.936 0.2
|
13
|
+
2016-09-01 2017-08-31 18.182 18.184 0.2
|
14
|
+
2017-09-01 2018-03-31 18.3 18.3 0.23
|
15
|
+
2018-04-01 2019-03-31 18.3 18.3 0.29
|
16
|
+
2019-04-01 2020-03-31 18.3 18.3 0.34
|
17
|
+
2020-04-01 2099-12-31 18.3 18.3 0.36
|
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
等級(健康保険) 等級(厚生年金) 標準報酬月額 標準報酬日額 報酬月額(以上) 報酬月額(未満)
|
2
|
+
1 0 58000 1930 0 63000
|
3
|
+
2 0 68000 2270 63000 73000
|
4
|
+
3 0 78000 2600 73000 83000
|
5
|
+
4 1 88000 2930 83000 93000
|
6
|
+
5 2 98000 3270 93000 101000
|
7
|
+
6 3 104000 3470 101000 107000
|
8
|
+
7 4 110000 3670 107000 114000
|
9
|
+
8 5 118000 3930 114000 122000
|
10
|
+
9 6 126000 4200 122000 130000
|
11
|
+
10 7 134000 4470 130000 138000
|
12
|
+
11 8 142000 4730 138000 146000
|
13
|
+
12 9 150000 5000 146000 155000
|
14
|
+
13 10 160000 5330 155000 165000
|
15
|
+
14 11 170000 5670 165000 175000
|
16
|
+
15 12 180000 6000 175000 185000
|
17
|
+
16 13 190000 6330 185000 195000
|
18
|
+
17 14 200000 6670 195000 210000
|
19
|
+
18 15 220000 7330 210000 230000
|
20
|
+
19 16 240000 8000 230000 250000
|
21
|
+
20 17 260000 8670 250000 270000
|
22
|
+
21 18 280000 9330 270000 290000
|
23
|
+
22 19 300000 10000 290000 310000
|
24
|
+
23 20 320000 10670 310000 330000
|
25
|
+
24 21 340000 11330 330000 350000
|
26
|
+
25 22 360000 12000 350000 370000
|
27
|
+
26 23 380000 12670 370000 395000
|
28
|
+
27 24 410000 13670 395000 425000
|
29
|
+
28 25 440000 14670 425000 455000
|
30
|
+
29 26 470000 15670 455000 485000
|
31
|
+
30 27 500000 16670 485000 515000
|
32
|
+
31 28 530000 17670 515000 545000
|
33
|
+
32 29 560000 18670 545000 575000
|
34
|
+
33 30 590000 19670 575000 605000
|
35
|
+
34 31 620000 20670 605000 635000
|
36
|
+
35 32 650000 21670 635000 665000
|
37
|
+
36 - 680000 22670 665000 695000
|
38
|
+
37 - 710000 23670 695000 730000
|
39
|
+
38 - 750000 25000 730000 770000
|
40
|
+
39 - 790000 26330 770000 810000
|
41
|
+
40 - 830000 27670 810000 855000
|
42
|
+
41 - 880000 29330 855000 905000
|
43
|
+
42 - 930000 31000 905000 955000
|
44
|
+
43 - 980000 32670 955000 1005000
|
45
|
+
44 - 1030000 34330 1005000 1055000
|
46
|
+
45 - 1090000 36330 1055000 1115000
|
47
|
+
46 - 1150000 38330 1115000 1175000
|
48
|
+
47 - 1210000 40330 1175000 1235000
|
49
|
+
48 - 1270000 42330 1235000 1295000
|
50
|
+
49 - 1330000 44330 1295000 1355000
|
51
|
+
50 - 1390000 46330 1355000 -
|
@@ -85,18 +85,19 @@ module TaxJp
|
|
85
85
|
prefecture_code = convert_to_prefecture_code(prefecture)
|
86
86
|
salary = salary.to_i
|
87
87
|
|
88
|
-
ret = nil
|
89
|
-
|
90
88
|
TaxJp::Utils.with_database(DB_PATH) do |db|
|
91
89
|
sql, params = base_query(date, prefecture_code)
|
92
90
|
|
93
91
|
sql << 'where g.valid_from <= ? and g.valid_until >= ? and g.salary_from <= ? and g.salary_to > ? '
|
94
92
|
params += [date, date, salary, salary]
|
95
93
|
|
96
|
-
|
97
|
-
|
98
|
-
|
94
|
+
row = db.execute(sql, params).first
|
95
|
+
ret = TaxJp::SocialInsurance.new(row)
|
96
|
+
|
97
|
+
if ret.welfare_pension.grade.pension_grade == TaxJp::INTEGER_MAX
|
98
|
+
ret.welfare_pension.grade = find_max_pension_grade_by_date(date)
|
99
99
|
end
|
100
|
+
|
100
101
|
ret
|
101
102
|
end
|
102
103
|
end
|
@@ -137,6 +138,22 @@ module TaxJp
|
|
137
138
|
end
|
138
139
|
end
|
139
140
|
|
141
|
+
def self.find_max_pension_grade_by_date(date)
|
142
|
+
date = TaxJp::Utils.convert_to_date(date)
|
143
|
+
|
144
|
+
TaxJp::Utils.with_database(DB_PATH, results_as_hash: true) do |db|
|
145
|
+
sql = 'select * from grades '
|
146
|
+
sql << 'where valid_from <= ? and valid_until >= ? and pension_grade = ( '
|
147
|
+
sql << ' select max(pension_grade) from grades '
|
148
|
+
sql << ' where valid_from <= ? and valid_until >= ? and pension_grade < ? '
|
149
|
+
sql << ') '
|
150
|
+
params = [date, date, date, date, TaxJp::INTEGER_MAX]
|
151
|
+
|
152
|
+
row = db.execute(sql, params).first.with_indifferent_access
|
153
|
+
TaxJp::SocialInsurances::Grade.new(row)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
140
157
|
def self.find_welfare_pension_by_date_and_salary(date, salary)
|
141
158
|
date = TaxJp::Utils.convert_to_date(date)
|
142
159
|
|
@@ -14,7 +14,7 @@ class TaxJp::SocialInsurances::DbBuilder < TaxJp::DbBuilder
|
|
14
14
|
|
15
15
|
CSV.foreach(filename, :col_sep => "\t") do |row|
|
16
16
|
next if row[0].to_i == 0 and row[1].to_i == 0
|
17
|
-
db.execute(insert_sql_grade, [valid_from, valid_until] + row.map{|col| normalize_amount(col)})
|
17
|
+
db.execute(insert_sql_grade, [valid_from, valid_until] + row.map{|col| TaxJp::Utils.normalize_amount(col)})
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -105,14 +105,6 @@ class TaxJp::SocialInsurances::DbBuilder < TaxJp::DbBuilder
|
|
105
105
|
ret
|
106
106
|
end
|
107
107
|
|
108
|
-
def normalize_amount(amount, options = {})
|
109
|
-
if amount.to_s == '-'
|
110
|
-
ret = 2147483647
|
111
|
-
else
|
112
|
-
ret = amount.to_s.gsub(',', '').to_i
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
108
|
def filename_to_date(filename)
|
117
109
|
title, valid_from, valid_until = File.basename(filename).split('.').first.split('-')
|
118
110
|
valid_from = Date.strptime(valid_from, '%Y%m%d')
|
@@ -6,9 +6,11 @@ class TaxJp::SocialInsurances::HealthInsurance
|
|
6
6
|
attr_reader :general, :care
|
7
7
|
attr_reader :particular, :basic
|
8
8
|
|
9
|
-
|
9
|
+
attr_writer :salary
|
10
10
|
|
11
11
|
def initialize(attrs)
|
12
|
+
@salary = nil
|
13
|
+
|
12
14
|
if attrs.is_a?(Hash)
|
13
15
|
@grade = attrs[:grade]
|
14
16
|
@valid_from = attrs[:valid_from]
|
@@ -1,13 +1,15 @@
|
|
1
1
|
# 厚生年金
|
2
2
|
class TaxJp::SocialInsurances::WelfarePension
|
3
|
-
attr_reader :grade
|
4
3
|
attr_reader :valid_from, :valid_until
|
5
4
|
attr_reader :general, :particular
|
6
5
|
attr_reader :child_support
|
7
6
|
|
8
|
-
attr_accessor :
|
7
|
+
attr_accessor :grade
|
8
|
+
attr_writer :salary
|
9
9
|
|
10
10
|
def initialize(attrs)
|
11
|
+
@salary = nil
|
12
|
+
|
11
13
|
if attrs.is_a?(Hash)
|
12
14
|
@grade = attrs[:grade]
|
13
15
|
@valid_from = attrs[:valid_from]
|
@@ -49,14 +51,12 @@ class TaxJp::SocialInsurances::WelfarePension
|
|
49
51
|
def monthly_standard
|
50
52
|
raise '等級が指定されていません' unless grade
|
51
53
|
return 0 if grade.pension_grade == 0
|
52
|
-
return 0 if grade.pension_grade > 99
|
53
54
|
grade.monthly_standard
|
54
55
|
end
|
55
56
|
|
56
57
|
def daily_standard
|
57
58
|
raise '等級が指定されていません' unless grade
|
58
59
|
return 0 if grade.pension_grade == 0
|
59
|
-
return 0 if grade.pension_grade > 99
|
60
60
|
grade.daily_standard
|
61
61
|
end
|
62
62
|
|
data/lib/tax_jp/utils.rb
CHANGED
@@ -27,8 +27,10 @@ module TaxJp
|
|
27
27
|
File.write(dest, ERB.new(File.read(src), 0, '-').result)
|
28
28
|
end
|
29
29
|
|
30
|
-
def with_database(db_path)
|
30
|
+
def with_database(db_path, results_as_hash: false)
|
31
31
|
db = SQLite3::Database.new(db_path)
|
32
|
+
db.results_as_hash = results_as_hash
|
33
|
+
|
32
34
|
begin
|
33
35
|
yield db
|
34
36
|
ensure
|
@@ -67,7 +69,7 @@ module TaxJp
|
|
67
69
|
end
|
68
70
|
|
69
71
|
def filename_to_date(filename)
|
70
|
-
|
72
|
+
_, valid_from, valid_until = File.basename(filename).split('.').first.split('-')
|
71
73
|
valid_from = Date.strptime(valid_from, '%Y%m%d')
|
72
74
|
valid_until = Date.strptime(valid_until, '%Y%m%d')
|
73
75
|
[valid_from.strftime('%Y-%m-%d'), valid_until.strftime('%Y-%m-%d')]
|
data/lib/tax_jp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tax_jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ichylinux
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bootstrap
|
@@ -65,14 +65,14 @@ dependencies:
|
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.
|
68
|
+
version: '4.4'
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.
|
75
|
+
version: '4.4'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: rails
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,14 +93,14 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.3
|
96
|
+
version: '1.3'
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.3
|
103
|
+
version: '1.3'
|
104
104
|
description: 税金計算ライブラリ
|
105
105
|
email:
|
106
106
|
- ichylinux@gmail.com
|
@@ -161,9 +161,9 @@ files:
|
|
161
161
|
- data/源泉徴収税/源泉徴収税月額-20130101-20151231.tsv
|
162
162
|
- data/源泉徴収税/源泉徴収税月額-20160101-20161231.tsv
|
163
163
|
- data/源泉徴収税/源泉徴収税月額-20170101-20191231.tsv
|
164
|
-
- data/源泉徴収税/源泉徴収税月額-20200101-
|
164
|
+
- data/源泉徴収税/源泉徴収税月額-20200101-20211231.tsv
|
165
165
|
- data/源泉徴収税/源泉徴収税賞与-20180101-20191231.tsv
|
166
|
-
- data/源泉徴収税/源泉徴収税賞与-20200101-
|
166
|
+
- data/源泉徴収税/源泉徴収税賞与-20200101-20211231.tsv
|
167
167
|
- data/源泉徴収税月額.db
|
168
168
|
- data/源泉徴収税賞与.db
|
169
169
|
- data/社会保険料.db
|
@@ -187,7 +187,8 @@ files:
|
|
187
187
|
- data/社会保険料/等級-20001001-20080831.tsv
|
188
188
|
- data/社会保険料/等級-20080901-20160331.tsv
|
189
189
|
- data/社会保険料/等級-20160401-20160930.tsv
|
190
|
-
- data/社会保険料/等級-20161001-
|
190
|
+
- data/社会保険料/等級-20161001-20200831.tsv
|
191
|
+
- data/社会保険料/等級-20200901-20991231.tsv
|
191
192
|
- data/都道府県.yml
|
192
193
|
- data/雇用保険料.db
|
193
194
|
- lib/build_tasks/build.rake
|
@@ -233,14 +234,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
233
234
|
requirements:
|
234
235
|
- - "~>"
|
235
236
|
- !ruby/object:Gem::Version
|
236
|
-
version: '2.
|
237
|
+
version: '2.5'
|
237
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
239
|
requirements:
|
239
240
|
- - ">="
|
240
241
|
- !ruby/object:Gem::Version
|
241
242
|
version: '0'
|
242
243
|
requirements: []
|
243
|
-
rubygems_version: 3.
|
244
|
+
rubygems_version: 3.1.4
|
244
245
|
signing_key:
|
245
246
|
specification_version: 4
|
246
247
|
summary: 税金計算ライブラリ
|