train-tax-calculator 2.0.2 → 2.1.0
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 +1 -1
- data/lib/train/tax/calculator/deductions.rb +35 -0
- data/lib/train/tax/calculator/version.rb +1 -1
- data/lib/train/tax/calculator.rb +8 -29
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b91e87ac4c47739dda0ba2f96eb062a7a3673ba3
|
4
|
+
data.tar.gz: cdd6e712c3a7f441e4e5bc14360caa4742c46b01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44121856e0b75c4be125af628dc4e1c2b1676d8e5f0bf0ef210dfbd38699081cc39c328f8fd4e35e1ba600bbaa16f23573630d13662a29473aa1a4e4c32614be
|
7
|
+
data.tar.gz: 468ca0cadcd0f6d3069099b009b8d5470e700a9a45c9914b3005e38e9afae1edeab74e7fb31a17a87974cecb74e2ec8ba8c0e0d3de49962c5583af9785563b25
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Train
|
2
|
+
module Tax
|
3
|
+
module Calculator
|
4
|
+
class Deductions
|
5
|
+
|
6
|
+
def self.get(basic_salary)
|
7
|
+
new(basic_salary).get
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(basic_salary)
|
11
|
+
@basic_salary = basic_salary
|
12
|
+
end
|
13
|
+
|
14
|
+
def get
|
15
|
+
sss + pagibig + philhealth
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def sss
|
21
|
+
Sss.compute_employee_share(@basic_salary)
|
22
|
+
end
|
23
|
+
|
24
|
+
def pagibig
|
25
|
+
Pagibig.compute(@basic_salary)
|
26
|
+
end
|
27
|
+
|
28
|
+
def philhealth
|
29
|
+
Philhealth.compute(@basic_salary)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/train/tax/calculator.rb
CHANGED
@@ -2,6 +2,7 @@ require "train/tax/calculator/version"
|
|
2
2
|
require "train/tax/calculator/philhealth"
|
3
3
|
require "train/tax/calculator/pagibig"
|
4
4
|
require "train/tax/calculator/sss"
|
5
|
+
require "train/tax/calculator/deductions"
|
5
6
|
|
6
7
|
module Train
|
7
8
|
module Tax
|
@@ -10,12 +11,12 @@ module Train
|
|
10
11
|
def self.call(basic_salary)
|
11
12
|
hash = Hash.new
|
12
13
|
|
13
|
-
hash[:sss]
|
14
|
-
hash[:
|
15
|
-
hash[:
|
16
|
-
hash[:total_deductions] =
|
17
|
-
hash[:withholding_tax]
|
18
|
-
hash[:net_income]
|
14
|
+
hash[:sss] = Sss.compute_employee_share(basic_salary)
|
15
|
+
hash[:pagibig] = Pagibig.compute(basic_salary)
|
16
|
+
hash[:philhealth] = Philhealth.compute(basic_salary)
|
17
|
+
hash[:total_deductions] = Deductions.get(basic_salary)
|
18
|
+
hash[:withholding_tax] = withholding_tax(hash[:total_deductions], basic_salary)
|
19
|
+
hash[:net_income] = basic_salary - hash[:withholding_tax]
|
19
20
|
|
20
21
|
hash
|
21
22
|
end
|
@@ -30,10 +31,8 @@ module Train
|
|
30
31
|
|
31
32
|
class << self
|
32
33
|
|
33
|
-
def withholding_tax(basic_salary)
|
34
|
-
deductions = for_philhealth(basic_salary) + for_pagibig(basic_salary) + for_sss_es(basic_salary)
|
34
|
+
def withholding_tax(deductions, basic_salary)
|
35
35
|
taxable_income = basic_salary - deductions
|
36
|
-
|
37
36
|
compute_withholding_for(taxable_income).round(2)
|
38
37
|
end
|
39
38
|
|
@@ -65,27 +64,7 @@ module Train
|
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
68
|
-
def for_philhealth(basic_salary)
|
69
|
-
Philhealth.compute(basic_salary)
|
70
|
-
end
|
71
|
-
|
72
|
-
def for_pagibig(basic_salary)
|
73
|
-
Pagibig.compute(basic_salary)
|
74
|
-
end
|
75
|
-
|
76
|
-
def for_sss(basic_salary)
|
77
|
-
Sss.compute(basic_salary)
|
78
|
-
end
|
79
|
-
|
80
|
-
def for_sss_es(basic_salary)
|
81
|
-
Sss.compute_employee_share(basic_salary)
|
82
|
-
end
|
83
|
-
|
84
|
-
def for_sss_er(basic_salary)
|
85
|
-
Sss.compute_employer_share(basic_salary)
|
86
|
-
end
|
87
67
|
end
|
88
|
-
|
89
68
|
end
|
90
69
|
end
|
91
70
|
end
|
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.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Chavez
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- bin/console
|
77
77
|
- bin/setup
|
78
78
|
- lib/train/tax/calculator.rb
|
79
|
+
- lib/train/tax/calculator/deductions.rb
|
79
80
|
- lib/train/tax/calculator/pagibig.rb
|
80
81
|
- lib/train/tax/calculator/philhealth.rb
|
81
82
|
- lib/train/tax/calculator/sss.rb
|