train-tax-calculator 2.2.2 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/train/tax/calculator/version.rb +1 -1
- data/lib/train/tax/calculator/withholding_tax.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c39135038d3544ae9ca29d0a5dd93bfa0738b40f
|
4
|
+
data.tar.gz: dfb5454208487a37552fd4da39c1784ba470ec5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be54a299f92fd4ea5267a1d32035009a5d8dd3cd2afce11205666e10e87c04e8479f0922cbb7abb1d7794828830404ede88166bcd2b00d0426e12798d5db66d8
|
7
|
+
data.tar.gz: 24231d7edeaf8daa7cd9563161ee6d9b85674c7f225f62da765715a2c6868438f96afdcc0c49094011aa80ff10776dc8b8d1702773935b7c14162c64325af234
|
data/Gemfile.lock
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pry'
|
2
|
+
|
1
3
|
module Train::Tax::Calculator
|
2
4
|
module WithholdingTax
|
3
5
|
|
@@ -5,7 +7,7 @@ module Train::Tax::Calculator
|
|
5
7
|
{ lowest: 0.00, highest: 20_833.00, base: 0.00, excess: 0.00 },
|
6
8
|
{ lowest: 20_833.00, highest: 33_333.00, base: 0.00, excess: 0.20 },
|
7
9
|
{ lowest: 33_333.00, highest: 66_667.00, base: 2_500.00, excess: 0.25 },
|
8
|
-
{ lowest: 66_667.
|
10
|
+
{ lowest: 66_667.00, highest: 166_667.00, base: 10_833.33, excess: 0.30 },
|
9
11
|
{ lowest: 166_667.00, highest: 666_667.00, base: 40_833.33, excess: 0.32 },
|
10
12
|
{ lowest: 666_667.00, highest: Float::INFINITY, base: 200_833.33, excess: 0.35 },
|
11
13
|
]
|
@@ -13,12 +15,17 @@ module Train::Tax::Calculator
|
|
13
15
|
def self.compute(basic_salary)
|
14
16
|
taxable_income = basic_salary - Deductions.get(basic_salary)
|
15
17
|
|
18
|
+
if basic_salary > 90_000
|
19
|
+
monthly_taxable = ((basic_salary - 90_000) / 12.00)
|
20
|
+
taxable_income = taxable_income + monthly_taxable
|
21
|
+
end
|
22
|
+
|
16
23
|
tax_bracket = LOOKUP_TABLE.select do |bracket|
|
17
24
|
taxable_income >= bracket[:lowest] &&
|
18
25
|
taxable_income < bracket[:highest]
|
19
26
|
end.first
|
20
27
|
|
21
|
-
withholding_tax =
|
28
|
+
withholding_tax = ((taxable_income - tax_bracket[:lowest]) * tax_bracket[:excess]) + tax_bracket[:base]
|
22
29
|
withholding_tax.round(2)
|
23
30
|
end
|
24
31
|
|