train-tax-calculator 2.2.1 → 2.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 +4 -4
- data/Gemfile.lock +6 -0
- data/lib/train/tax/calculator.rb +1 -1
- data/lib/train/tax/calculator/version.rb +1 -1
- data/lib/train/tax/calculator/withholding_tax.rb +5 -5
- data/train-tax-calculator.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6be25d58a16495863debdd71469a9f163ef350e3
|
|
4
|
+
data.tar.gz: 2d1419204944bd53465a11b75c93c1116cb06bd1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b1176e270784bb87072307719354a3b081c9f01432dc5eb8ab9f0124e4b7d677aed313c6ff51f3038f35582e58b7bf3f1b88d085b564d62f5fdd0b792569fb2
|
|
7
|
+
data.tar.gz: d59bb390586d8281ebfd7495bade04be0ab37864925ffa7a5e3b633c2885ecb469bebaad3a93b6f84f101593a065bb0e673eba03ebea8b1448516ee4b56c192a
|
data/Gemfile.lock
CHANGED
|
@@ -6,7 +6,12 @@ PATH
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
+
coderay (1.1.2)
|
|
9
10
|
diff-lcs (1.3)
|
|
11
|
+
method_source (0.9.0)
|
|
12
|
+
pry (0.11.3)
|
|
13
|
+
coderay (~> 1.1.0)
|
|
14
|
+
method_source (~> 0.9.0)
|
|
10
15
|
rake (10.5.0)
|
|
11
16
|
rspec (3.7.0)
|
|
12
17
|
rspec-core (~> 3.7.0)
|
|
@@ -27,6 +32,7 @@ PLATFORMS
|
|
|
27
32
|
|
|
28
33
|
DEPENDENCIES
|
|
29
34
|
bundler (~> 1.16)
|
|
35
|
+
pry
|
|
30
36
|
rake (~> 10.0)
|
|
31
37
|
rspec (~> 3.0)
|
|
32
38
|
train-tax-calculator!
|
data/lib/train/tax/calculator.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Train
|
|
|
16
16
|
hash[:pagibig] = Pagibig.compute(basic_salary)
|
|
17
17
|
hash[:philhealth] = Philhealth.compute(basic_salary)
|
|
18
18
|
hash[:total_deductions] = Deductions.get(basic_salary)
|
|
19
|
-
hash[:withholding_tax] = WithholdingTax.compute(
|
|
19
|
+
hash[:withholding_tax] = WithholdingTax.compute(basic_salary)
|
|
20
20
|
hash[:net_income] = basic_salary - hash[:withholding_tax]
|
|
21
21
|
|
|
22
22
|
hash
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
module Train::Tax::Calculator
|
|
2
2
|
module WithholdingTax
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
LOOKUP_TABLE = [
|
|
5
5
|
{ lowest: 0.00, highest: 20_833.00, base: 0.00, excess: 0.00 },
|
|
6
6
|
{ lowest: 20_833.00, highest: 33_333.00, base: 0.00, excess: 0.20 },
|
|
7
7
|
{ lowest: 33_333.00, highest: 66_667.00, base: 2_500.00, excess: 0.25 },
|
|
8
8
|
{ lowest: 66_667.000, highest: 166_667.00, base: 10_833.33, excess: 0.30 },
|
|
9
9
|
{ lowest: 166_667.00, highest: 666_667.00, base: 40_833.33, excess: 0.32 },
|
|
10
|
-
{ lowest: 666_667.00, highest:
|
|
10
|
+
{ lowest: 666_667.00, highest: Float::INFINITY, base: 200_833.33, excess: 0.35 },
|
|
11
11
|
]
|
|
12
12
|
|
|
13
|
-
def self.compute(
|
|
14
|
-
taxable_income = basic_salary -
|
|
13
|
+
def self.compute(basic_salary)
|
|
14
|
+
taxable_income = basic_salary - Deductions.get(basic_salary)
|
|
15
15
|
|
|
16
|
-
tax_bracket =
|
|
16
|
+
tax_bracket = LOOKUP_TABLE.select do |bracket|
|
|
17
17
|
taxable_income >= bracket[:lowest] &&
|
|
18
18
|
taxable_income < bracket[:highest]
|
|
19
19
|
end.first
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: train-tax-calculator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mark Chavez
|
|
@@ -55,6 +55,20 @@ dependencies:
|
|
|
55
55
|
- - "~>"
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
57
|
version: '3.0'
|
|
58
|
+
- !ruby/object:Gem::Dependency
|
|
59
|
+
name: pry
|
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
|
61
|
+
requirements:
|
|
62
|
+
- - ">="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: '0'
|
|
65
|
+
type: :development
|
|
66
|
+
prerelease: false
|
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '0'
|
|
58
72
|
description: Computes withholding tax and net income
|
|
59
73
|
email:
|
|
60
74
|
- markchav3z@gmail.com
|