tax_computation 2.0.0 → 2.0.1
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/lib/tax_computation/version.rb +1 -1
- data/lib/tax_computation.rb +41 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 277ed1b0b7b0b268e57155796dd28b01d98ee948602f3efec63197e2065fc2d0
|
4
|
+
data.tar.gz: 0c1f8d0aaa02c07defa9a5ae7c050164a4377c29f3db6d166cf5befa473086ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16e7b6cb71efa1efd8e45643735c236bcc21084063e5df8e662b99118005e2888c0d6e5c2dae1e09670a5a0de1fe37e464a4bae9ad04f8701df3d03bd92378c7
|
7
|
+
data.tar.gz: 8ea81e9c1677741e75a665fbf47b00da6c559fa20cd39edb2eaf5e5dda4bc76575d0b7ea4c1f55997fe44f2232251106815555aa9d6190a9df63e723a2bcd9e7
|
data/lib/tax_computation.rb
CHANGED
@@ -3,31 +3,55 @@
|
|
3
3
|
require_relative "tax_computation/version"
|
4
4
|
|
5
5
|
module TaxComputation
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
RANGES_2021_2022 = {600000.0...1200000.0 => {percentage: 5, fixed_amount: 0, low: 600000},
|
7
|
+
1200000.0...1800000.0 => {percentage: 10, fixed_amount: 30000, low: 1200000},
|
8
|
+
1800000.0...2500000.0 => {percentage: 15, fixed_amount: 90000, low: 1800000},
|
9
|
+
2500000.0...3500000.0 => {percentage: 17.5, fixed_amount: 195000, low: 2500000},
|
10
|
+
3500000.0...5000000.0 => {percentage: 20, fixed_amount: 370000, low: 3500000},
|
11
|
+
5000000.0...8000000.0 => {percentage: 22.5, fixed_amount: 670000, low: 5000000},
|
12
|
+
8000000.0...12000000.0 => {percentage: 25, fixed_amount: 1345000, low: 8000000},
|
13
|
+
12000000.0...30000000.0 => {percentage: 27.5, fixed_amount: 2345000, low: 12000000},
|
14
|
+
30000000.0...50000000.0 => {percentage: 30, fixed_amount: 7295000, low: 30000000},
|
15
|
+
50000000.0...75000000.0 => {percentage: 32.5, fixed_amount: 13295000, low: 50000000},
|
16
|
+
75000000.0..Float::INFINITY => {percentage: 35, fixed_amount: 21420000, low: 75000000}
|
17
|
+
}
|
18
|
+
|
19
|
+
RANGES_2022_2023 = {600000.0...1200000.0 => {percentage: 2.5, fixed_amount: 0, low: 600000.0},
|
20
|
+
1200000.0...2400000.0 => {percentage: 12.5, fixed_amount: 15000, low: 1200000},
|
21
|
+
2400000.0...3600000.0 => {percentage: 20, fixed_amount: 165000, low: 2400000},
|
22
|
+
3600000.0...6000000.0 => {percentage: 25, fixed_amount: 405000, low: 3600000},
|
23
|
+
6000000.0...12000000.0 => {percentage: 32.5, fixed_amount: 1005000, low: 6000000},
|
24
|
+
12000000.0...Float::INFINITY => {percentage: 35, fixed_amount: 2955000, low: 12000000.0}
|
25
|
+
}
|
26
|
+
|
27
|
+
RANGES_2023_2024 = {600000.0...1200000.0 => {percentage: 2.5, fixed_amount: 0, low: 600000},
|
28
|
+
1200000.0...2400000.0 => {percentage: 12.5, fixed_amount: 15000, low: 1200000},
|
29
|
+
2400000.0...3600000.0 => {percentage: 22.5, fixed_amount: 165000, low: 2400000},
|
30
|
+
3600000.0...6000000.0 => {percentage: 27.5, fixed_amount: 435000, low: 3600000},
|
31
|
+
6000000.0...Float::INFINITY => {percentage: 35, fixed_amount: 1095000, low: 6000000}
|
32
|
+
}
|
12
33
|
|
13
34
|
private
|
14
35
|
|
15
|
-
def self.calculate_monthly_tax(salary =
|
36
|
+
def self.calculate_monthly_tax(salary, year=2023)
|
16
37
|
salary = salary * 12
|
17
|
-
|
18
|
-
|
19
|
-
|
38
|
+
if salary <= 600000.0
|
39
|
+
0
|
40
|
+
else
|
41
|
+
calculate(salary, year) / 12.to_f
|
42
|
+
end
|
20
43
|
end
|
21
44
|
|
22
|
-
def self.calculate_yearly_tax(salary =
|
23
|
-
|
24
|
-
|
25
|
-
|
45
|
+
def self.calculate_yearly_tax(salary, year=2023)
|
46
|
+
if salary <= 600000.0
|
47
|
+
0
|
48
|
+
else
|
49
|
+
calculate(2023)
|
50
|
+
end
|
26
51
|
end
|
27
52
|
|
28
|
-
def self.calculate(salary)
|
29
|
-
slabs =
|
30
|
-
|
53
|
+
def self.calculate (salary, year)
|
54
|
+
slabs = eval("RANGES_#{ year }_#{ year + 1 }")
|
31
55
|
range = slabs.select{|range| range === salary}
|
32
56
|
range.values[0][:fixed_amount] + (((salary - range.values[0][:low]) / 100) * range.values[0][:percentage])
|
33
57
|
end
|