tax_jp 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: b6f8c11097e0817501265e5e009bce48b5a8ed49
4
- data.tar.gz: 7cd8e916740f035ee74633865997ee5c494cbfb0
3
+ metadata.gz: 81bebb050011c3c2ca6a48a11e6b7d828bdaf320
4
+ data.tar.gz: 5f7693a7ca21766f944746a8ee177a336b30ba63
5
5
  SHA512:
6
- metadata.gz: 03b3795c246247e44320ef59a82a3288bea9444b9ab37092011ad448d811e70970528668b47fa8b8eed084d169aef87cb97b20bf070f978ba3abf3d1249f2aeb
7
- data.tar.gz: a7d4c85c307c343f3a74288bc84c027a0105c89aa9070c999dd07eef133e74754eac818b4396c312512b419e2e2d61b0abc92c93ce5ccd614a10b4349a481010
6
+ metadata.gz: ef311f32d6add769d48920cf3a87184b78d8cf417d581e9fabaf538dc46a42461d444098eef926dc1498001316b3c2290d4444b735f9a6234b5ae90d10e5e465
7
+ data.tar.gz: 8e9222d3314e41e8f6e7e49d2cecf71e9c1dee8a1be91af19880f1602f3d974edfc7c04b10bbe0ed5e34dd04c57316bdccaff7342f8501900088850e1e40f5a3
@@ -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 30 650000 21670 635000 665000
37
- 36 30 680000 22670 665000 695000
38
- 37 30 710000 23670 695000 730000
39
- 38 30 750000 25000 730000 770000
40
- 39 30 790000 26330 770000 810000
41
- 40 30 830000 27670 810000 855000
42
- 41 30 880000 29330 855000 905000
43
- 42 30 930000 31000 905000 955000
44
- 43 30 980000 32670 955000 1005000
45
- 44 30 1030000 34330 1005000 1055000
46
- 45 30 1090000 36330 1055000 1115000
47
- 46 30 1150000 38330 1115000 1175000
48
- 47 30 1210000 40330 1175000 -
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 -
@@ -1,11 +1,11 @@
1
1
  require 'sqlite3'
2
- require_relative 'grade'
3
- require_relative 'health_insurance'
4
- require_relative 'welfare_pension'
5
2
 
6
3
  module TaxJp
7
4
  module SocialInsurances
8
5
  require_relative 'social_insurances/utils'
6
+ require_relative 'social_insurances/grade'
7
+ require_relative 'social_insurances/health_insurance'
8
+ require_relative 'social_insurances/welfare_pension'
9
9
  end
10
10
 
11
11
  # 社会保険
@@ -22,22 +22,22 @@ module TaxJp
22
22
  attr_reader :welfare_pension
23
23
 
24
24
  def initialize(row)
25
- @grade = TaxJp::Grade.new(
25
+ @grade = TaxJp::SocialInsurances::Grade.new(
26
26
  :valid_from => row[0], :valid_until => row[1],
27
27
  :grade => row[2], :pension_grade => row[3],
28
28
  :monthly_standard => row[4], :daily_standard => row[5],
29
29
  :salary_from => row[6], :salary_to => row[7])
30
30
 
31
- @health_insurance = TaxJp::HealthInsurance.new(
31
+ @health_insurance = TaxJp::SocialInsurances::HealthInsurance.new(
32
+ :grade => @grade,
32
33
  :valid_from => row[8], :valid_until => row[9],
33
- :monthly_standard => row[4],
34
34
  :prefecture => Prefecture.find_by_code(row[10]),
35
35
  :general => row[11], :care => row[12],
36
36
  :particular => row[13], :basic => row[14])
37
37
 
38
- @welfare_pension = TaxJp::WelfarePension.new(
38
+ @welfare_pension = TaxJp::SocialInsurances::WelfarePension.new(
39
+ :grade => @grade,
39
40
  :valid_from => row[15], :valid_until => row[16],
40
- :monthly_standard => row[4],
41
41
  :general => row[17], :particular => row[18],
42
42
  :child_support => row[19])
43
43
  end
@@ -0,0 +1,20 @@
1
+ # 等級
2
+ class TaxJp::SocialInsurances::Grade
3
+
4
+ attr_reader :valid_from, :valid_until
5
+ attr_reader :grade, :pension_grade
6
+ attr_reader :monthly_standard, :daily_standard
7
+ attr_reader :salary_from, :salary_to
8
+
9
+ def initialize(attrs = {})
10
+ @valid_from = attrs[:valid_from]
11
+ @valid_until = attrs[:valid_until]
12
+ @grade = attrs[:grade]
13
+ @pension_grade = attrs[:pension_grade]
14
+ @monthly_standard = attrs[:monthly_standard]
15
+ @daily_standard = attrs[:daily_standard]
16
+ @salary_from = attrs[:salary_from]
17
+ @salary_to = attrs[:salary_to]
18
+ end
19
+
20
+ end
@@ -0,0 +1,46 @@
1
+ # 健康年金
2
+ class TaxJp::SocialInsurances::HealthInsurance
3
+ attr_reader :grade
4
+ attr_reader :valid_from, :valid_until
5
+ attr_reader :prefecture
6
+ attr_reader :general, :care
7
+ attr_reader :particular, :basic
8
+
9
+ def initialize(attrs = {})
10
+ @grade = attrs[:grade]
11
+ @valid_from = attrs[:valid_from]
12
+ @valid_until = attrs[:valid_until]
13
+ @prefecture = attrs[:prefecture]
14
+ @general= attrs[:general]
15
+ @care = attrs[:care]
16
+ @particular= attrs[:particular]
17
+ @basic = attrs[:basic]
18
+ end
19
+
20
+ def general_amount
21
+ floor_amount(monthly_standard * general)
22
+ end
23
+
24
+ def general_amount_half
25
+ floor_amount(monthly_standard * general / 2)
26
+ end
27
+
28
+ def general_amount_care
29
+ floor_amount(monthly_standard * (general + care))
30
+ end
31
+
32
+ def general_amount_care_half
33
+ floor_amount(monthly_standard * (general + care) / 2)
34
+ end
35
+
36
+ private
37
+
38
+ def monthly_standard
39
+ grade.grade > 0 ? grade.monthly_standard : 0
40
+ end
41
+
42
+ def floor_amount(amount)
43
+ (amount * 10).floor * 0.1
44
+ end
45
+
46
+ end
@@ -0,0 +1,44 @@
1
+ # 厚生年金
2
+ class TaxJp::SocialInsurances::WelfarePension
3
+ attr_reader :grade
4
+ attr_reader :valid_from, :valid_until
5
+ attr_reader :general, :particular
6
+ attr_reader :child_support
7
+
8
+ def initialize(attrs = {})
9
+ @grade = attrs[:grade]
10
+ @valid_from = attrs[:valid_from]
11
+ @valid_until = attrs[:valid_until]
12
+ @general= attrs[:general]
13
+ @particular= attrs[:particular]
14
+ @child_support = attrs[:child_support]
15
+ end
16
+
17
+ def general_amount
18
+ floor_amount(monthly_standard * general)
19
+ end
20
+
21
+ def general_amount_half
22
+ floor_amount(monthly_standard * general / 2)
23
+ end
24
+
25
+ def particular_amount
26
+ floor_amount(monthly_standard * particular)
27
+ end
28
+
29
+ def particular_amount_half
30
+ floor_amount(monthly_standard * particular / 2)
31
+ end
32
+
33
+ private
34
+
35
+ def monthly_standard
36
+ return 0 unless grade.pension_grade >= 1 and grade.pension_grade <= 30
37
+ grade.monthly_standard
38
+ end
39
+
40
+ def floor_amount(amount)
41
+ (amount * 100).floor * 0.01
42
+ end
43
+
44
+ end
@@ -1,3 +1,3 @@
1
1
  module TaxJp
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
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.2.1
4
+ version: 0.2.2
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: 2015-07-25 00:00:00.000000000 Z
12
+ date: 2015-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sqlite3
@@ -134,17 +134,17 @@ files:
134
134
  - lib/tax_jp.rb
135
135
  - lib/tax_jp/const.rb
136
136
  - lib/tax_jp/consumption_tax.rb
137
- - lib/tax_jp/grade.rb
138
- - lib/tax_jp/health_insurance.rb
139
137
  - lib/tax_jp/prefecture.rb
140
138
  - lib/tax_jp/rails/engine.rb
141
139
  - lib/tax_jp/rails/railtie.rb
142
140
  - lib/tax_jp/social_insurance.rb
143
141
  - lib/tax_jp/social_insurances/db_builder.rb
142
+ - lib/tax_jp/social_insurances/grade.rb
143
+ - lib/tax_jp/social_insurances/health_insurance.rb
144
144
  - lib/tax_jp/social_insurances/utils.rb
145
+ - lib/tax_jp/social_insurances/welfare_pension.rb
145
146
  - lib/tax_jp/utils.rb
146
147
  - lib/tax_jp/version.rb
147
- - lib/tax_jp/welfare_pension.rb
148
148
  - lib/tax_jp/withheld_tax.rb
149
149
  - lib/tax_jp/withheld_taxes/db_builder.rb
150
150
  - tax_jp.gemspec
data/lib/tax_jp/grade.rb DELETED
@@ -1,22 +0,0 @@
1
- module TaxJp
2
-
3
- # 等級
4
- class Grade
5
- attr_reader :valid_from, :valid_until
6
- attr_reader :grade, :pension_grade
7
- attr_reader :monthly_standard, :daily_standard
8
- attr_reader :salary_from, :salary_to
9
-
10
- def initialize(attrs = {})
11
- @valid_from = attrs[:valid_from]
12
- @valid_until = attrs[:valid_until]
13
- @grade = attrs[:grade]
14
- @pension_grade = attrs[:pension_grade]
15
- @monthly_standard = attrs[:monthly_standard]
16
- @daily_standard = attrs[:daily_standard]
17
- @salary_from = attrs[:salary_from]
18
- @salary_to = attrs[:salary_to]
19
- end
20
-
21
- end
22
- end
@@ -1,46 +0,0 @@
1
- module TaxJp
2
-
3
- # 健康年金
4
- class HealthInsurance
5
- attr_reader :valid_from, :valid_until
6
- attr_reader :monthly_standard
7
- attr_reader :prefecture
8
- attr_reader :general, :care
9
- attr_reader :particular, :basic
10
-
11
- def initialize(attrs = {})
12
- @valid_from = attrs[:valid_from]
13
- @valid_until = attrs[:valid_until]
14
- @monthly_standard = attrs[:monthly_standard]
15
- @prefecture = attrs[:prefecture]
16
- @general= attrs[:general]
17
- @care = attrs[:care]
18
- @particular= attrs[:particular]
19
- @basic = attrs[:basic]
20
- end
21
-
22
- def general_amount
23
- floor_amount(monthly_standard * general)
24
- end
25
-
26
- def general_amount_half
27
- floor_amount(monthly_standard * general / 2)
28
- end
29
-
30
- def general_amount_care
31
- floor_amount(monthly_standard * (general + care))
32
- end
33
-
34
- def general_amount_care_half
35
- floor_amount(monthly_standard * (general + care) / 2)
36
- end
37
-
38
- private
39
-
40
- def floor_amount(amount)
41
- (amount * 10).floor * 0.1
42
- end
43
-
44
- end
45
-
46
- end
@@ -1,43 +0,0 @@
1
- module TaxJp
2
-
3
- # 厚生年金
4
- class WelfarePension
5
- attr_reader :valid_from, :valid_until
6
- attr_reader :monthly_standard
7
- attr_reader :general, :particular
8
- attr_reader :child_support
9
-
10
- def initialize(attrs = {})
11
- @valid_from = attrs[:valid_from]
12
- @valid_until = attrs[:valid_until]
13
- @monthly_standard = attrs[:monthly_standard]
14
- @general= attrs[:general]
15
- @particular= attrs[:particular]
16
- @child_support = attrs[:child_support]
17
- end
18
-
19
- def general_amount
20
- floor_amount(monthly_standard * general)
21
- end
22
-
23
- def general_amount_half
24
- floor_amount(monthly_standard * general / 2)
25
- end
26
-
27
- def particular_amount
28
- floor_amount(monthly_standard * particular)
29
- end
30
-
31
- def particular_amount_half
32
- floor_amount(monthly_standard * particular / 2)
33
- end
34
-
35
- private
36
-
37
- def floor_amount(amount)
38
- (amount * 100).floor * 0.01
39
- end
40
-
41
- end
42
-
43
- end