tax_jp 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42dfc90929fc52513a1204a6c156c4c17572af18
4
- data.tar.gz: 698bb64ef722b8cd87ba41e7993291c36e1fc970
3
+ metadata.gz: 20c4fc811b03ea6e993392e85a7697e024b31488
4
+ data.tar.gz: 2d962416d82390e47bb01bb90f1405d4e34cb7b1
5
5
  SHA512:
6
- metadata.gz: 30388638485057e038c1b38a1d8e6896f3ee6e418ad19c78879d13fc087da60d941a8a5fd1e8758ff95c1d56b76f6e7ad4c6171a75371c30ad10b8a119a63d11
7
- data.tar.gz: 75198197dc5e0a765c72c30e454221222b957da55b56aa585c52b9a980887792f2bdafb00615271c8fe60c4d54692bc9c7443c5795b7e1808442ec4bb15c4344
6
+ metadata.gz: 2f25dd1ddfc27988e198b01963fe73eb34d6ba2cef2d5eb1781e247734ce23142099ff3473b3356f871d65bfde0e64a0a76e4659c54bf9c0e09f1afd91376ffb
7
+ data.tar.gz: 6a5d179a84f33c75ecc105a374805286a0c7fec5f1fa889d1cab101791d7b65bb870b441610e46585f7b65142905600bdb2efc0e351f5d97b6f8a9da0bf99a80
data/HISTORY.md CHANGED
@@ -1,4 +1,11 @@
1
- # 開発中
1
+ # バージョン 0.3.1
2
+
3
+ ### 追加
4
+ * 厚生年金の日額の計算
5
+ * 厚生年金の等級30以上の計算
6
+
7
+ ### 修正
8
+ * 2016年3月の健康保険料の間違いを修正
2
9
 
3
10
  # バージョン 0.3.0
4
11
  リリース日: 2016-05-12
@@ -33,16 +33,16 @@
33
33
  32 28 560000 18670 545000 575000
34
34
  33 29 590000 19670 575000 605000
35
35
  34 30 620000 20670 605000 635000
36
- 35 31 650000 21670 635000 665000
37
- 36 31 680000 22670 665000 695000
38
- 37 31 710000 23670 695000 730000
39
- 38 31 750000 25000 730000 770000
40
- 39 31 790000 26330 770000 810000
41
- 40 31 830000 27670 810000 855000
42
- 41 31 880000 29330 855000 905000
43
- 42 31 930000 31000 905000 955000
44
- 43 31 980000 32670 955000 1005000
45
- 44 31 1030000 34330 1005000 1055000
46
- 45 31 1090000 36330 1055000 1115000
47
- 46 31 1150000 38330 1115000 1175000
48
- 47 31 1210000 40330 1175000 -
36
+ 35 - 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 -
@@ -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 0 88000 2930 83000 93000
6
+ 5 1 98000 3270 93000 101000
7
+ 6 2 104000 3470 101000 107000
8
+ 7 3 110000 3670 107000 114000
9
+ 8 4 118000 3930 114000 122000
10
+ 9 5 126000 4200 122000 130000
11
+ 10 6 134000 4470 130000 138000
12
+ 11 7 142000 4730 138000 146000
13
+ 12 8 150000 5000 146000 155000
14
+ 13 9 160000 5330 155000 165000
15
+ 14 10 170000 5670 165000 175000
16
+ 15 11 180000 6000 175000 185000
17
+ 16 12 190000 6330 185000 195000
18
+ 17 13 200000 6670 195000 210000
19
+ 18 14 220000 7330 210000 230000
20
+ 19 15 240000 8000 230000 250000
21
+ 20 16 260000 8670 250000 270000
22
+ 21 17 280000 9330 270000 290000
23
+ 22 18 300000 10000 290000 310000
24
+ 23 19 320000 10670 310000 330000
25
+ 24 20 340000 11330 330000 350000
26
+ 25 21 360000 12000 350000 370000
27
+ 26 22 380000 12670 370000 395000
28
+ 27 23 410000 13670 395000 425000
29
+ 28 24 440000 14670 425000 455000
30
+ 29 25 470000 15670 455000 485000
31
+ 30 26 500000 16670 485000 515000
32
+ 31 27 530000 17670 515000 545000
33
+ 32 28 560000 18670 545000 575000
34
+ 33 29 590000 19670 575000 605000
35
+ 34 30 620000 20670 605000 635000
36
+ 35 - 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 -
@@ -67,13 +67,13 @@ module TaxJp
67
67
  prefecture_code = convert_to_prefecture_code(prefecture)
68
68
 
69
69
  with_database do |db|
70
- sql = 'select g.*, hi.*, wp.* from grades g '
71
- sql << 'inner join health_insurances hi on (hi.valid_from <= ? and hi.valid_until >= ? and (hi.prefecture_code = ? or hi.prefecture_code is null)) '
72
- sql << 'inner join welfare_pensions wp on (wp.valid_from <= ? and wp.valid_until >= ?) '
70
+ sql, params = base_query(date, prefecture_code)
71
+
73
72
  sql << 'where g.valid_from <= ? and g.valid_until >= ? '
73
+ params += [date, date]
74
74
 
75
75
  ret = []
76
- db.execute(sql, [date, date, prefecture_code, date, date, date, date]) do |row|
76
+ db.execute(sql, params) do |row|
77
77
  ret << TaxJp::SocialInsurance.new(row)
78
78
  end
79
79
  ret
@@ -85,20 +85,51 @@ module TaxJp
85
85
  prefecture_code = convert_to_prefecture_code(prefecture)
86
86
  salary = salary.to_i
87
87
 
88
+ ret = nil
89
+
88
90
  with_database do |db|
89
- sql = 'select g.*, hi.*, wp.* from grades g '
90
- sql << 'inner join health_insurances hi on (hi.valid_from <= ? and hi.valid_until >= ? and (hi.prefecture_code = ? or hi.prefecture_code is null)) '
91
- sql << 'inner join welfare_pensions wp on (wp.valid_from <= ? and wp.valid_until >= ?) '
91
+ sql, params = base_query(date, prefecture_code)
92
+
92
93
  sql << 'where g.valid_from <= ? and g.valid_until >= ? and g.salary_from <= ? and g.salary_to > ? '
94
+ params += [date, date, salary, salary]
93
95
 
94
96
  ret = nil
95
- db.execute(sql, [date, date, prefecture_code, date, date, date, date, salary, salary]) do |row|
97
+ db.execute(sql, params) do |row|
96
98
  ret = TaxJp::SocialInsurance.new(row)
97
99
  end
98
100
  ret
99
101
  end
100
102
  end
101
103
 
104
+ def self.find_by_date_and_prefecture_and_pension_grade(date, prefecture, pension_grade)
105
+ date = TaxJp::Utils.convert_to_date(date)
106
+ prefecture_code = convert_to_prefecture_code(prefecture)
107
+
108
+ with_database do |db|
109
+ sql, params = base_query(date, prefecture_code)
110
+
111
+ sql << 'where g.valid_from <= ? and g.valid_until >= ? and g.pension_grade = ? '
112
+ params += [date, date, pension_grade]
113
+
114
+ ret = nil
115
+ db.execute(sql, params) do |row|
116
+ ret = TaxJp::SocialInsurance.new(row)
117
+ end
118
+ ret
119
+ end
120
+ end
121
+
122
+ def self.base_query(date, prefecture_code)
123
+ sql = 'select g.*, hi.*, wp.* from grades g '
124
+ sql << 'inner join health_insurances hi on (hi.valid_from <= ? and hi.valid_until >= ? and (hi.prefecture_code = ? or hi.prefecture_code is null)) '
125
+ sql << 'inner join welfare_pensions wp on (wp.valid_from <= ? and wp.valid_until >= ?) '
126
+
127
+ params = [date, date, prefecture_code, date, date]
128
+
129
+ return sql, params
130
+ end
131
+ private_class_method :base_query
132
+
102
133
  def self.with_database
103
134
  db = SQLite3::Database.new(DB_PATH)
104
135
  begin
@@ -107,6 +138,8 @@ module TaxJp
107
138
  db.close
108
139
  end
109
140
  end
141
+ private_class_method :with_database
142
+
110
143
  end
111
144
 
112
145
  end
@@ -33,10 +33,17 @@ class TaxJp::SocialInsurances::WelfarePension
33
33
  private
34
34
 
35
35
  def monthly_standard
36
- return 0 unless grade.pension_grade >= 1 and grade.pension_grade <= 30
36
+ return 0 if grade.pension_grade == 0
37
+ return 0 if grade.pension_grade > 30
37
38
  grade.monthly_standard
38
39
  end
39
40
 
41
+ def daily_standard
42
+ return 0 if grade.pension_grade == 0
43
+ return 0 if grade.pension_grade > 30
44
+ grade.daily_standard
45
+ end
46
+
40
47
  def floor_amount(amount)
41
48
  (amount * 100).floor * 0.01
42
49
  end
@@ -1,3 +1,3 @@
1
1
  module TaxJp
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
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: 0.3.0
4
+ version: 0.3.1
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: 2016-05-11 00:00:00.000000000 Z
12
+ date: 2016-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
@@ -127,11 +127,12 @@ files:
127
127
  - data/社会保険料/健康保険-20120301-20130228.tsv
128
128
  - data/社会保険料/健康保険-20130301-20140228.tsv
129
129
  - data/社会保険料/健康保険-20140301-20150331.tsv
130
- - data/社会保険料/健康保険-20150401-20160331.tsv
131
- - data/社会保険料/健康保険-20160401-20170331.tsv
130
+ - data/社会保険料/健康保険-20150401-20160229.tsv
131
+ - data/社会保険料/健康保険-20160301-20170228.tsv
132
132
  - data/社会保険料/厚生年金.tsv
133
133
  - data/社会保険料/旧健康保険.tsv
134
- - data/社会保険料/等級-20080901-20991231.tsv
134
+ - data/社会保険料/等級-20080901-20160331.tsv
135
+ - data/社会保険料/等級-20160401-20991231.tsv
135
136
  - data/都道府県.yml
136
137
  - features/.gitignore
137
138
  - features/01.都道府県.feature