tax_jp 1.8.3 → 1.8.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 +4 -4
- 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 +1 -1
- data/lib/tax_jp/corporate_taxes/db_builder.rb +1 -1
- data/lib/tax_jp/depreciation_rates/db_builder.rb +1 -1
- data/lib/tax_jp/social_insurance.rb +18 -17
- data/lib/tax_jp/social_insurances/db_builder.rb +4 -4
- data/lib/tax_jp/social_insurances/health_insurance.rb +12 -0
- data/lib/tax_jp/social_insurances/welfare_pension.rb +0 -3
- data/lib/tax_jp/version.rb +1 -1
- data/lib/tax_jp/withheld_taxes/monthly_db_builder.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25e29bba13829686dc4da5a5a422ed82438a38e203ee22f93642f9bd2facabcf
|
|
4
|
+
data.tar.gz: 351e969326a36f9f41afbd46e626309dd86cfcdaab872dd405dd098904397e76
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17add79329ce4f5acb07f5c6a9ce01bf43be5e96df7725d917bb11c46e40e42298ba0b1b94e2c7345094198fd51466b404145d5d30f1d66679dbfa9f9d64bb37
|
|
7
|
+
data.tar.gz: 51fcb4c96422e6942aeb9135db917f8f21a927ddaebc323c71ce0acf16390585e55b8fd923460dae6edd2040d5a161622c58fb47318618c9d16c421b3afc3876
|
|
@@ -12,7 +12,7 @@ class TaxJp::CorporateTaxes::DbBuilder
|
|
|
12
12
|
Dir.glob(File.join(TaxJp::Utils.data_dir, '法人税', '区分番号-*.tsv')).each do |filename|
|
|
13
13
|
valid_from, valid_until = TaxJp::Utils.filename_to_date(filename)
|
|
14
14
|
|
|
15
|
-
CSV.foreach(filename, :
|
|
15
|
+
CSV.foreach(filename, col_sep: "\t", headers: true) do |row|
|
|
16
16
|
next if row[0].to_s.strip.empty?
|
|
17
17
|
|
|
18
18
|
values = []
|
|
@@ -11,7 +11,7 @@ class TaxJp::DepreciationRates::DbBuilder
|
|
|
11
11
|
Dir.glob(File.join(TaxJp::Utils.data_dir, '減価償却率', '減価償却率-*.tsv')).each do |filename|
|
|
12
12
|
valid_from, valid_until = TaxJp::Utils.filename_to_date(filename)
|
|
13
13
|
|
|
14
|
-
CSV.foreach(filename, :
|
|
14
|
+
CSV.foreach(filename, col_sep: "\t") do |row|
|
|
15
15
|
next if row[0].to_i == 0
|
|
16
16
|
db.execute(insert_sql, [valid_from, valid_until] + row)
|
|
17
17
|
end
|
|
@@ -21,24 +21,24 @@ module TaxJp
|
|
|
21
21
|
|
|
22
22
|
def initialize(row)
|
|
23
23
|
@grade = TaxJp::SocialInsurances::Grade.new(
|
|
24
|
-
:
|
|
25
|
-
:
|
|
26
|
-
:
|
|
27
|
-
:
|
|
24
|
+
valid_from: row[0], valid_until: row[1],
|
|
25
|
+
grade: row[2], pension_grade: row[3],
|
|
26
|
+
monthly_standard: row[4], daily_standard: row[5],
|
|
27
|
+
salary_from: row[6], salary_to: row[7])
|
|
28
28
|
|
|
29
29
|
@health_insurance = TaxJp::SocialInsurances::HealthInsurance.new(
|
|
30
|
-
:
|
|
31
|
-
:
|
|
32
|
-
:
|
|
33
|
-
:
|
|
34
|
-
:
|
|
30
|
+
grade: @grade,
|
|
31
|
+
valid_from: row[8], valid_until: row[9],
|
|
32
|
+
prefecture: Prefecture.find_by_code(row[10]),
|
|
33
|
+
general: row[11], care: row[12],
|
|
34
|
+
particular: row[13], basic: row[14],
|
|
35
|
+
child_and_childcare_support: row[20])
|
|
35
36
|
|
|
36
37
|
@welfare_pension = TaxJp::SocialInsurances::WelfarePension.new(
|
|
37
|
-
:
|
|
38
|
-
:
|
|
39
|
-
:
|
|
40
|
-
:
|
|
41
|
-
:child_and_childcare_support => row[20])
|
|
38
|
+
grade: @grade,
|
|
39
|
+
valid_from: row[15], valid_until: row[16],
|
|
40
|
+
general: row[17], particular: row[18],
|
|
41
|
+
child_support: row[19])
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def valid_from
|
|
@@ -126,9 +126,10 @@ module TaxJp
|
|
|
126
126
|
prefecture_code = convert_to_prefecture_code(prefecture)
|
|
127
127
|
|
|
128
128
|
TaxJp::Utils.with_database(DB_PATH) do |db|
|
|
129
|
-
sql = String.new('select
|
|
130
|
-
sql << '
|
|
131
|
-
|
|
129
|
+
sql = String.new('select hi.*, wp.child_and_childcare_support from health_insurances hi ')
|
|
130
|
+
sql << 'inner join welfare_pensions wp on (wp.valid_from <= ? and wp.valid_until >= ?) '
|
|
131
|
+
sql << 'where hi.valid_from <= ? and hi.valid_until >= ? and (hi.prefecture_code = ? or hi.prefecture_code is null) '
|
|
132
|
+
params = [date, date, date, date, prefecture_code]
|
|
132
133
|
|
|
133
134
|
ret = nil
|
|
134
135
|
db.execute(sql, params) do |row|
|
|
@@ -12,14 +12,14 @@ class TaxJp::SocialInsurances::DbBuilder < TaxJp::DbBuilder
|
|
|
12
12
|
Dir.glob(File.join(TaxJp::Utils.data_dir, '社会保険料', '等級-*.tsv')).each do |filename|
|
|
13
13
|
valid_from, valid_until = filename_to_date(filename)
|
|
14
14
|
|
|
15
|
-
CSV.foreach(filename, :
|
|
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
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
|
|
|
21
21
|
Dir.glob(File.join(TaxJp::Utils.data_dir, '社会保険料', '旧健康保険.tsv')).each do |filename|
|
|
22
|
-
CSV.foreach(filename, :
|
|
22
|
+
CSV.foreach(filename, col_sep: "\t") do |row|
|
|
23
23
|
next unless row[2].to_f > 0
|
|
24
24
|
values = []
|
|
25
25
|
values << row[0]
|
|
@@ -36,7 +36,7 @@ class TaxJp::SocialInsurances::DbBuilder < TaxJp::DbBuilder
|
|
|
36
36
|
Dir.glob(File.join(TaxJp::Utils.data_dir, '社会保険料', '健康保険-*.tsv')).each do |filename|
|
|
37
37
|
valid_from, valid_until = filename_to_date(filename)
|
|
38
38
|
|
|
39
|
-
CSV.foreach(filename, :
|
|
39
|
+
CSV.foreach(filename, col_sep: "\t") do |row|
|
|
40
40
|
next unless row[1].to_f > 0
|
|
41
41
|
values = []
|
|
42
42
|
values << valid_from
|
|
@@ -51,7 +51,7 @@ class TaxJp::SocialInsurances::DbBuilder < TaxJp::DbBuilder
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
Dir.glob(File.join(TaxJp::Utils.data_dir, '社会保険料', '厚生年金.tsv')).each do |filename|
|
|
54
|
-
CSV.foreach(filename, :
|
|
54
|
+
CSV.foreach(filename, col_sep: "\t") do |row|
|
|
55
55
|
next unless row[2].to_f > 0
|
|
56
56
|
values = []
|
|
57
57
|
values << row.shift
|
|
@@ -5,6 +5,8 @@ class TaxJp::SocialInsurances::HealthInsurance
|
|
|
5
5
|
attr_reader :prefecture
|
|
6
6
|
attr_reader :general, :care
|
|
7
7
|
attr_reader :particular, :basic
|
|
8
|
+
# 子ども・子育て支援金
|
|
9
|
+
attr_reader :child_and_childcare_support
|
|
8
10
|
|
|
9
11
|
attr_writer :salary
|
|
10
12
|
|
|
@@ -20,6 +22,7 @@ class TaxJp::SocialInsurances::HealthInsurance
|
|
|
20
22
|
@care = attrs[:care]
|
|
21
23
|
@particular= attrs[:particular]
|
|
22
24
|
@basic = attrs[:basic]
|
|
25
|
+
@child_and_childcare_support = attrs[:child_and_childcare_support]
|
|
23
26
|
elsif attrs.is_a?(Array)
|
|
24
27
|
@valid_from = attrs[0]
|
|
25
28
|
@valid_until = attrs[1]
|
|
@@ -28,6 +31,7 @@ class TaxJp::SocialInsurances::HealthInsurance
|
|
|
28
31
|
@care = attrs[4]
|
|
29
32
|
@particular= attrs[5]
|
|
30
33
|
@basic = attrs[6]
|
|
34
|
+
@child_and_childcare_support = attrs[7]
|
|
31
35
|
end
|
|
32
36
|
end
|
|
33
37
|
|
|
@@ -47,6 +51,14 @@ class TaxJp::SocialInsurances::HealthInsurance
|
|
|
47
51
|
(general_amount_care / 2).floor(1)
|
|
48
52
|
end
|
|
49
53
|
|
|
54
|
+
def child_and_childcare_support_amount
|
|
55
|
+
(salary * child_and_childcare_support).round(1)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def child_and_childcare_support_amount_half
|
|
59
|
+
(child_and_childcare_support_amount / 2).floor(1)
|
|
60
|
+
end
|
|
61
|
+
|
|
50
62
|
def salary
|
|
51
63
|
@salary || monthly_standard
|
|
52
64
|
end
|
|
@@ -3,7 +3,6 @@ class TaxJp::SocialInsurances::WelfarePension
|
|
|
3
3
|
attr_reader :valid_from, :valid_until
|
|
4
4
|
attr_reader :general, :particular
|
|
5
5
|
attr_reader :child_support
|
|
6
|
-
attr_reader :child_and_childcare_support
|
|
7
6
|
|
|
8
7
|
attr_accessor :grade
|
|
9
8
|
attr_writer :salary
|
|
@@ -18,14 +17,12 @@ class TaxJp::SocialInsurances::WelfarePension
|
|
|
18
17
|
@general= attrs[:general]
|
|
19
18
|
@particular= attrs[:particular]
|
|
20
19
|
@child_support = attrs[:child_support]
|
|
21
|
-
@child_and_childcare_support = attrs[:child_and_childcare_support]
|
|
22
20
|
elsif attrs.is_a?(Array)
|
|
23
21
|
@valid_from = attrs[0]
|
|
24
22
|
@valid_until = attrs[1]
|
|
25
23
|
@general= attrs[2]
|
|
26
24
|
@particular= attrs[3]
|
|
27
25
|
@child_support = attrs[4]
|
|
28
|
-
@child_and_childcare_support = attrs[5]
|
|
29
26
|
end
|
|
30
27
|
end
|
|
31
28
|
|
data/lib/tax_jp/version.rb
CHANGED
|
@@ -12,7 +12,7 @@ class TaxJp::WithheldTaxes::MonthlyDbBuilder < TaxJp::DbBuilder
|
|
|
12
12
|
Dir.glob(File.join(TaxJp::Utils.data_dir, '源泉徴収税', '源泉徴収税月額-*.tsv')).each do |filename|
|
|
13
13
|
valid_from, valid_until = TaxJp::Utils.filename_to_date(filename)
|
|
14
14
|
|
|
15
|
-
CSV.foreach(filename, :
|
|
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
17
|
values = row.map{|col| TaxJp::Utils.normalize_amount(col)}
|
|
18
18
|
db.execute(insert_sql, [valid_from.to_s, valid_until.to_s] + values)
|
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.8.
|
|
4
|
+
version: 1.8.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ichylinux
|
|
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
233
233
|
- !ruby/object:Gem::Version
|
|
234
234
|
version: '0'
|
|
235
235
|
requirements: []
|
|
236
|
-
rubygems_version: 3.
|
|
236
|
+
rubygems_version: 3.7.2
|
|
237
237
|
specification_version: 4
|
|
238
238
|
summary: 税金計算ライブラリ
|
|
239
239
|
test_files: []
|