tax_jp 0.6.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -7
- data/app/assets/javascripts/tax.js +12 -8
- data/app/views/tax_jp/consumption_taxes/index.html.erb +3 -3
- data/app/views/tax_jp/social_insurances/index.html.erb +13 -13
- data/data//345/205/203/345/217/267.yml +6 -4
- data/data//345/212/264/345/203/215/344/277/235/351/231/272//351/233/207/347/224/250/344/277/235/351/231/272.tsv +1 -1
- data/data//346/266/210/350/262/273/347/250/216.yml +9 -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/201/245/345/272/267/344/277/235/351/231/272-20190301-20200229.tsv +48 -0
- data/data//351/233/207/347/224/250/344/277/235/351/231/272/346/226/231.db +0 -0
- data/lib/tax_jp/consumption_tax.rb +15 -0
- data/lib/tax_jp/gengou.rb +25 -24
- data/lib/tax_jp/utils.rb +5 -1
- data/lib/tax_jp/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c48f4dababdd1406820b05e2d32b68a4c0d5a776bd53f2724ae9ba02f98ebb
|
4
|
+
data.tar.gz: 77023c0b83977e472a36971ea43391cd4fc9cb7b2ca713c86fb7720ab0ae26c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c9b08645697885999325d6ca626e2e0267d594adef02942bfee489eca8a6d3e449dc2355cc98afd2d684bd230dda9014cba31517e44123e27ce0afe263a0ad9
|
7
|
+
data.tar.gz: '06901d6c1e3e911947dec46debf199326a3ce139bc3cb8383738399db19c12d40dd72a3681c5867254963784ec8e797cb5f71e9d0d3a7907bca9000702b20889'
|
data/README.md
CHANGED
@@ -7,25 +7,35 @@
|
|
7
7
|
* 源泉徴収
|
8
8
|
* 減価償却率
|
9
9
|
|
10
|
-
##
|
10
|
+
## インストール
|
11
11
|
|
12
|
-
|
12
|
+
Gemfile に以下の記述を追加
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
gem 'tax_jp'
|
16
16
|
```
|
17
17
|
|
18
|
-
|
18
|
+
bundle を実行
|
19
19
|
|
20
20
|
$ bundle
|
21
21
|
|
22
|
-
|
22
|
+
## 使い方
|
23
23
|
|
24
|
-
|
24
|
+
### Rails-5.2
|
25
25
|
|
26
|
-
|
26
|
+
routes.rb に以下の記述を追加
|
27
27
|
|
28
|
-
|
28
|
+
```ruby
|
29
|
+
mount TaxJp::Engine, at: '/tax_jp', as: 'tax_jp'
|
30
|
+
```
|
31
|
+
|
32
|
+
Railsを起動
|
33
|
+
|
34
|
+
$ rails s
|
35
|
+
|
36
|
+
ブラウザで localhost:3000/tax_jp にアクセス
|
37
|
+
|
38
|
+
![トップページ](https://raw.github.com/wiki/hybitz/tax_jp/images/top.png)
|
29
39
|
|
30
40
|
## Contributing
|
31
41
|
|
@@ -7,9 +7,10 @@ tax.INCLUSIVE = 2; // 内税
|
|
7
7
|
tax.EXCLUSIVE = 3; // 外税
|
8
8
|
|
9
9
|
tax.consumptionTaxes = [
|
10
|
-
{date: Date.parse('
|
11
|
-
{date: Date.parse('
|
12
|
-
{date: Date.parse('
|
10
|
+
{date: Date.parse('2019-10-01'), rate: 0.1, reduced_rate: 0.08},
|
11
|
+
{date: Date.parse('2014-04-01'), rate: 0.08, reduced_rate: 0},
|
12
|
+
{date: Date.parse('1997-04-01'), rate: 0.05, reduced_rate: 0},
|
13
|
+
{date: Date.parse('1989-04-01'), rate: 0.03, reduced_rate: 0},
|
13
14
|
];
|
14
15
|
|
15
16
|
tax.getRateOn = function(date, options) {
|
@@ -20,7 +21,11 @@ tax.getRateOn = function(date, options) {
|
|
20
21
|
|
21
22
|
var ret = 0;
|
22
23
|
for (var i = 0; this.consumptionTaxes.length; i ++) {
|
23
|
-
|
24
|
+
if (options.reduced) {
|
25
|
+
ret = this.consumptionTaxes[i].reduced_rate;
|
26
|
+
} else {
|
27
|
+
ret = this.consumptionTaxes[i].rate;
|
28
|
+
}
|
24
29
|
if (date >= this.consumptionTaxes[i].date) {
|
25
30
|
break;
|
26
31
|
}
|
@@ -29,7 +34,7 @@ tax.getRateOn = function(date, options) {
|
|
29
34
|
if (options.percent) {
|
30
35
|
ret *= 100;
|
31
36
|
}
|
32
|
-
|
37
|
+
|
33
38
|
return ret;
|
34
39
|
};
|
35
40
|
|
@@ -39,9 +44,8 @@ tax.calcTaxAmount = function(taxType, rate, amount) {
|
|
39
44
|
}
|
40
45
|
|
41
46
|
if ( taxType == tax.INCLUSIVE ) {
|
42
|
-
return parseInt(amount
|
43
|
-
}
|
44
|
-
else if ( taxType == tax.EXCLUSIVE ) {
|
47
|
+
return amount - parseInt(amount / (1 + rate));
|
48
|
+
} else if ( taxType == tax.EXCLUSIVE ) {
|
45
49
|
return parseInt(amount * rate);
|
46
50
|
}
|
47
51
|
|
@@ -22,9 +22,9 @@
|
|
22
22
|
<td class="text-center"><%= number_to_currency(ct.national_percent, unit: '', precision: 1) if ct.national_percent > 0 %></td>
|
23
23
|
<td class="text-center"><%= number_to_currency(ct.local_percent, unit: '', precision: 1) if ct.local_percent > 0 %></td>
|
24
24
|
<td class="text-center"><%= number_to_currency(ct.total_percent, unit: '') if ct.total_percent > 0 %></td>
|
25
|
-
<td class="text-center"
|
26
|
-
<td class="text-center"
|
27
|
-
<td class="text-center"
|
25
|
+
<td class="text-center"><%= number_to_currency(ct.national_reduced_percent, unit: '', precision: 2) if ct.national_reduced_percent > 0 %></td>
|
26
|
+
<td class="text-center"><%= number_to_currency(ct.local_reduced_percent, unit: '', precision: 2) if ct.local_reduced_percent > 0 %></td>
|
27
|
+
<td class="text-center"><%= number_to_currency(ct.total_reduced_percent, unit: '') if ct.total_reduced_percent > 0 %></td>
|
28
28
|
</tr>
|
29
29
|
<% end %>
|
30
30
|
</tbody>
|
@@ -30,19 +30,19 @@
|
|
30
30
|
<th class="text-center" colspan="4">厚生年金保険料(厚生年金基金加入員を除く)</th>
|
31
31
|
</tr>
|
32
32
|
<tr>
|
33
|
-
<th class="text-center">等級</th>
|
34
|
-
<th class="text-center">月額</th>
|
35
|
-
<th class="text-center">日額</th>
|
36
|
-
<th class="text-center">円以上</th>
|
37
|
-
<th class="text-center">円未満</th>
|
38
|
-
<th class="text-center">全額</th>
|
39
|
-
<th class="text-center">折半額</th>
|
40
|
-
<th class="text-center
|
41
|
-
<th class="text-center
|
42
|
-
<th class="text-center">全額</th>
|
43
|
-
<th class="text-center">折半額</th>
|
44
|
-
<th class="text-center
|
45
|
-
<th class="text-center
|
33
|
+
<th class="text-center align-middle">等級</th>
|
34
|
+
<th class="text-center align-middle">月額</th>
|
35
|
+
<th class="text-center align-middle">日額</th>
|
36
|
+
<th class="text-center align-middle">円以上</th>
|
37
|
+
<th class="text-center align-middle">円未満</th>
|
38
|
+
<th class="text-center align-middle">全額</th>
|
39
|
+
<th class="text-center align-middle">折半額</th>
|
40
|
+
<th class="text-center align-middle">全額<br>(介護保険2号)</th>
|
41
|
+
<th class="text-center align-middle">折半額<br>(介護保険2号)</th>
|
42
|
+
<th class="text-center align-middle">全額</th>
|
43
|
+
<th class="text-center align-middle">折半額</th>
|
44
|
+
<th class="text-center align-middle">全額<br>(坑内員/船員)</th>
|
45
|
+
<th class="text-center align-middle">折半額<br>(坑内員/船員)</th>
|
46
46
|
</tr>
|
47
47
|
</thead>
|
48
48
|
<tbody>
|
@@ -4,4 +4,4 @@
|
|
4
4
|
2010-04-01 2012-03-31 0.006 0.0095 0.007 0.0105 0.007 0.0115
|
5
5
|
2012-04-01 2016-03-31 0.005 0.0085 0.006 0.0095 0.006 0.0105
|
6
6
|
2016-04-01 2017-03-31 0.004 0.007 0.005 0.008 0.005 0.009
|
7
|
-
2017-04-01
|
7
|
+
2017-04-01 2020-03-31 0.003 0.006 0.004 0.007 0.004 0.008
|
@@ -2,14 +2,23 @@
|
|
2
2
|
national: 0.03
|
3
3
|
local: 0.00
|
4
4
|
total: 0.03
|
5
|
+
national_reduced: 0
|
6
|
+
local_reduced: 0
|
7
|
+
total_reduced: 0
|
5
8
|
1997-04-01:
|
6
9
|
national: 0.04
|
7
10
|
local: 0.01
|
8
11
|
total: 0.05
|
12
|
+
national_reduced: 0
|
13
|
+
local_reduced: 0
|
14
|
+
total_reduced: 0
|
9
15
|
2014-04-01:
|
10
16
|
national: 0.063
|
11
17
|
local: 0.017
|
12
18
|
total: 0.08
|
19
|
+
national_reduced: 0
|
20
|
+
local_reduced: 0
|
21
|
+
total_reduced: 0
|
13
22
|
2019-10-01:
|
14
23
|
national: 0.078
|
15
24
|
local: 0.022
|
Binary file
|
@@ -0,0 +1,48 @@
|
|
1
|
+
都道府県 一般保険料率(%) 介護保険料率(%) 特定保険料率(%) 基本保険料率(%)
|
2
|
+
北海道 10.31 1.73 3.51 6.8
|
3
|
+
青森県 9.87 1.73 3.51 6.36
|
4
|
+
岩手県 9.8 1.73 3.51 6.29
|
5
|
+
宮城県 10.1 1.73 3.51 6.59
|
6
|
+
秋田県 10.14 1.73 3.51 6.63
|
7
|
+
山形県 10.03 1.73 3.51 6.52
|
8
|
+
福島県 9.74 1.73 3.51 6.23
|
9
|
+
茨城県 9.84 1.73 3.51 6.33
|
10
|
+
栃木県 9.92 1.73 3.51 6.41
|
11
|
+
群馬県 9.84 1.73 3.51 6.33
|
12
|
+
埼玉県 9.79 1.73 3.51 6.28
|
13
|
+
千葉県 9.81 1.73 3.51 6.3
|
14
|
+
東京都 9.9 1.73 3.51 6.39
|
15
|
+
神奈川県 9.91 1.73 3.51 6.4
|
16
|
+
新潟県 9.63 1.73 3.51 6.12
|
17
|
+
富山県 9.71 1.73 3.51 6.2
|
18
|
+
石川県 9.99 1.73 3.51 6.48
|
19
|
+
福井県 9.88 1.73 3.51 6.37
|
20
|
+
山梨県 9.9 1.73 3.51 6.39
|
21
|
+
長野県 9.69 1.73 3.51 6.18
|
22
|
+
岐阜県 9.86 1.73 3.51 6.35
|
23
|
+
静岡県 9.75 1.73 3.51 6.24
|
24
|
+
愛知県 9.9 1.73 3.51 6.39
|
25
|
+
三重県 9.9 1.73 3.51 6.39
|
26
|
+
滋賀県 9.87 1.73 3.51 6.36
|
27
|
+
京都府 10.03 1.73 3.51 6.52
|
28
|
+
大阪府 10.19 1.73 3.51 6.68
|
29
|
+
兵庫県 10.14 1.73 3.51 6.63
|
30
|
+
奈良県 10.07 1.73 3.51 6.56
|
31
|
+
和歌山県 10.15 1.73 3.51 6.64
|
32
|
+
鳥取県 10 1.73 3.51 6.49
|
33
|
+
島根県 10.13 1.73 3.51 6.62
|
34
|
+
岡山県 10.22 1.73 3.51 6.71
|
35
|
+
広島県 10 1.73 3.51 6.49
|
36
|
+
山口県 10.21 1.73 3.51 6.7
|
37
|
+
徳島県 10.3 1.73 3.51 6.79
|
38
|
+
香川県 10.31 1.73 3.51 6.8
|
39
|
+
愛媛県 10.02 1.73 3.51 6.51
|
40
|
+
高知県 10.21 1.73 3.51 6.7
|
41
|
+
福岡県 10.24 1.73 3.51 6.73
|
42
|
+
佐賀県 10.75 1.73 3.51 7.24
|
43
|
+
長崎県 10.24 1.73 3.51 6.73
|
44
|
+
熊本県 10.18 1.73 3.51 6.67
|
45
|
+
大分県 10.21 1.73 3.51 6.7
|
46
|
+
宮崎県 10.02 1.73 3.51 6.51
|
47
|
+
鹿児島県 10.16 1.73 3.51 6.65
|
48
|
+
沖縄県 9.95 1.73 3.51 6.44
|
Binary file
|
@@ -7,12 +7,16 @@ module TaxJp
|
|
7
7
|
|
8
8
|
attr_reader :valid_from
|
9
9
|
attr_reader :national, :local, :total
|
10
|
+
attr_reader :national_reduced, :local_reduced, :total_reduced
|
10
11
|
|
11
12
|
def initialize(valid_from, values)
|
12
13
|
@valid_from = valid_from
|
13
14
|
@national = values['national']
|
14
15
|
@local = values['local']
|
15
16
|
@total = values['total']
|
17
|
+
@national_reduced = values['national_reduced']
|
18
|
+
@local_reduced = values['local_reduced']
|
19
|
+
@total_reduced = values['total_reduced']
|
16
20
|
end
|
17
21
|
|
18
22
|
def self.all
|
@@ -53,5 +57,16 @@ module TaxJp
|
|
53
57
|
total * 100
|
54
58
|
end
|
55
59
|
|
60
|
+
def national_reduced_percent
|
61
|
+
national_reduced * 100
|
62
|
+
end
|
63
|
+
|
64
|
+
def local_reduced_percent
|
65
|
+
local_reduced * 100
|
66
|
+
end
|
67
|
+
|
68
|
+
def total_reduced_percent
|
69
|
+
total_reduced * 100
|
70
|
+
end
|
56
71
|
end
|
57
72
|
end
|
data/lib/tax_jp/gengou.rb
CHANGED
@@ -4,40 +4,41 @@ module TaxJp
|
|
4
4
|
class Gengou
|
5
5
|
@@_gengou = TaxJp::Utils.load_yaml('元号.yml')
|
6
6
|
|
7
|
-
def self.to_seireki(gengou,
|
8
|
-
target_gengou =
|
9
|
-
@@_gengou.invert.keys.each do |start_gengou|
|
10
|
-
if start_gengou == gengou.to_s
|
11
|
-
target_gengou = start_gengou
|
12
|
-
break
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
7
|
+
def self.to_seireki(gengou, date_jp)
|
8
|
+
target_gengou = @@_gengou.invert.keys.find{|start_gengou| start_gengou == gengou.to_s }
|
16
9
|
return nil unless target_gengou
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
|
11
|
+
start_date = @@_gengou.invert[target_gengou]
|
12
|
+
Date.new(start_date.year + date_jp.year - 1, date_jp.month, date_jp.day)
|
20
13
|
end
|
21
14
|
|
22
|
-
def self.to_wareki(
|
23
|
-
return nil unless
|
15
|
+
def self.to_wareki(date, only_date: false, format: '%y年%m月%d日')
|
16
|
+
return nil unless date.present?
|
24
17
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
date = TaxJp::Utils.convert_to_date(date)
|
19
|
+
|
20
|
+
target_date = nil
|
21
|
+
@@_gengou.keys.each do |start_date|
|
22
|
+
target_date = TaxJp::Utils.convert_to_date(start_date)
|
23
|
+
break if date >= target_date
|
29
24
|
end
|
30
25
|
|
31
|
-
return nil unless
|
26
|
+
return nil unless target_date
|
32
27
|
|
33
|
-
|
34
|
-
|
28
|
+
target_date = Date.strptime(target_date)
|
29
|
+
year, month, day = *(date.split('-').map{|x| x.to_i})
|
30
|
+
year_jp = year - target_date.year + 1
|
35
31
|
|
36
|
-
|
37
|
-
|
32
|
+
ret = Date.new(year_jp, month, day)
|
33
|
+
if only_date
|
34
|
+
ret = ret.strftime(format)
|
38
35
|
else
|
39
|
-
gengou
|
36
|
+
gengou = @@_gengou[target_date]
|
37
|
+
year_jp = year_jp == 1 ? '元' : year_jp.to_s
|
38
|
+
ret = ret.strftime(format.gsub('%y', "#{gengou}#{year_jp}"))
|
40
39
|
end
|
40
|
+
|
41
|
+
ret
|
41
42
|
end
|
42
43
|
|
43
44
|
end
|
data/lib/tax_jp/utils.rb
CHANGED
@@ -42,7 +42,11 @@ module TaxJp
|
|
42
42
|
if value.is_a?(Date)
|
43
43
|
ret = value.strftime('%Y-%m-%d')
|
44
44
|
elsif value.is_a?(String)
|
45
|
-
|
45
|
+
if value =~ /[0-9]{4}-[0-9]{2}-[0-9]{2}/
|
46
|
+
ret = value
|
47
|
+
else
|
48
|
+
raise ArgumentError.new(value)
|
49
|
+
end
|
46
50
|
else
|
47
51
|
raise TypeError.new(value.class)
|
48
52
|
end
|
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:
|
4
|
+
version: 1.1.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: 2019-
|
12
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bootstrap
|
@@ -79,28 +79,28 @@ dependencies:
|
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 5.2
|
82
|
+
version: '5.2'
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 5.2
|
89
|
+
version: '5.2'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: sqlite3
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.3.6
|
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:
|
103
|
+
version: 1.3.6
|
104
104
|
description: 税金計算ライブラリ
|
105
105
|
email:
|
106
106
|
- ichylinux@gmail.com
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- data/社会保険料/健康保険-20160301-20170228.tsv
|
179
179
|
- data/社会保険料/健康保険-20170301-20180228.tsv
|
180
180
|
- data/社会保険料/健康保険-20180301-20190228.tsv
|
181
|
+
- data/社会保険料/健康保険-20190301-20200229.tsv
|
181
182
|
- data/社会保険料/厚生年金.tsv
|
182
183
|
- data/社会保険料/旧健康保険.tsv
|
183
184
|
- data/社会保険料/等級-20001001-20080831.tsv
|
@@ -236,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
237
|
- !ruby/object:Gem::Version
|
237
238
|
version: '0'
|
238
239
|
requirements: []
|
239
|
-
|
240
|
-
rubygems_version: 2.7.6
|
240
|
+
rubygems_version: 3.0.3
|
241
241
|
signing_key:
|
242
242
|
specification_version: 4
|
243
243
|
summary: 税金計算ライブラリ
|