income-tax 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/income_tax/countries/germany.rb +5 -3
- data/lib/income_tax/version.rb +1 -1
- data/readme.md +1 -1
- data/spec/income_tax/countries/germany_spec.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca8c930d2bfb251a1e03a6f51920008f6952bcd6
|
4
|
+
data.tar.gz: b8c9ee09d3564038a777e45deb5890b1dcbed778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6c87405c8526020703d49855875f29f6ee786c7cbf344b4dc2fd41f1644b38adcc34ebceb35bb5ec4ff372d437110d22126d80caf4e0d49bbb7ce82bb03fd47
|
7
|
+
data.tar.gz: 5456b7c26fbf3f3ef1e1371dd108091fdb6c3a29658b4e7bfc69e3f0a6b7d5610b57d91684924b19acd5c2c556cbe326e2459168beabe25e068e2c88203e8e14
|
@@ -18,9 +18,11 @@ module IncomeTax
|
|
18
18
|
SOLIDARITY = Rate("5.5%")
|
19
19
|
|
20
20
|
def net_taxes(income, lower, upper, lower_taxes, lower_rate, upper_rate, upper_taxes)
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
lower_income = lower - lower_taxes
|
22
|
+
upper_income = upper - upper_taxes
|
23
|
+
step = (upper_rate - lower_rate) / (upper_income - lower_income)
|
24
|
+
steps = income - lower_income
|
25
|
+
rate = lower_rate + Rate(step * steps)
|
24
26
|
rate.net_taxes(steps).to_i + lower_taxes
|
25
27
|
end
|
26
28
|
|
data/lib/income_tax/version.rb
CHANGED
data/readme.md
CHANGED
@@ -54,7 +54,7 @@ Things not considered separate countries:
|
|
54
54
|
|
55
55
|
* Sovereign entities without any actual territory (The Holy See, Sovereign Military Order of Malta).
|
56
56
|
* States with very limited recognition (like Northern Cyprus, South Ossetia).
|
57
|
-
* Scotland, Wales, England and Northern
|
57
|
+
* Scotland, Wales, England and Northern Ireland (they are collectively treated as one country).
|
58
58
|
* Unclaimed or heavily disputed territories.
|
59
59
|
* Antartica.
|
60
60
|
|
@@ -63,27 +63,27 @@ describe IncomeTax::Countries::Germany do
|
|
63
63
|
describe "from net income of 10000" do
|
64
64
|
let(:type) { :net }
|
65
65
|
let(:income) { 10000 }
|
66
|
-
its(:rate) { should be == Rational(
|
67
|
-
its(:gross_income) { should be == "
|
66
|
+
its(:rate) { should be == Rational(69, 862) }
|
67
|
+
its(:gross_income) { should be == "10870.010582010582".to_d }
|
68
68
|
its(:net_income) { should be == 10000 }
|
69
|
-
its(:taxes) { should be == "
|
69
|
+
its(:taxes) { should be == "870.010582010582".to_d }
|
70
70
|
end
|
71
71
|
|
72
72
|
describe "from net income of 100000" do
|
73
73
|
let(:type) { :net }
|
74
74
|
let(:income) { 100000 }
|
75
|
-
its(:rate) { should be == Rational(
|
76
|
-
its(:gross_income) { should be == "
|
75
|
+
its(:rate) { should be == Rational(199, 510) }
|
76
|
+
its(:gross_income) { should be == "163989.10582010582".to_d }
|
77
77
|
its(:net_income) { should be == 100000 }
|
78
|
-
its(:taxes) { should be == "
|
78
|
+
its(:taxes) { should be == "63989.10582010582".to_d }
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "from net income of 100000000" do
|
82
82
|
let(:type) { :net }
|
83
83
|
let(:income) { 100000000 }
|
84
|
-
its(:rate) { should be == Rational(
|
85
|
-
its(:gross_income) { should be == "
|
84
|
+
its(:rate) { should be == Rational(99, 212) }
|
85
|
+
its(:gross_income) { should be == "187609588.82010582".to_d }
|
86
86
|
its(:net_income) { should be == 100000000 }
|
87
|
-
its(:taxes) { should be == "
|
87
|
+
its(:taxes) { should be == "87609588.82010582".to_d }
|
88
88
|
end
|
89
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: income-tax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Estimate Income Tax for different Countries
|
14
14
|
email: income-tax-gem@rkh.im
|