train-tax-calculator 1.0.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 188d8a06de7a539d723eefcb115f2f4b1da5a0d0
4
- data.tar.gz: ee1b982993f967509f5a1983f77d5c15a939e36b
3
+ metadata.gz: a99645469acca17aa9b47092ded7c4c1b8f671b7
4
+ data.tar.gz: e76caff248fc86acd6f1838453f498b54c4ec8d8
5
5
  SHA512:
6
- metadata.gz: 4d95d5b1eb9844f7d7920c396ba7bf4783e80f23e6a0153252e6fbb81e8f91cb676f5fbcb215493cbd274ed4f9eda2728a355adb53a9b39e549106cad37288b8
7
- data.tar.gz: 9102873b530de9466b4b77098cbea2eff8af1e2db571c5760d140e001718ec22fc0283b160fe2b57ad786c535f09f8f25984dbb0cc17004f306974df03d2b5ef
6
+ metadata.gz: c9b2f62717b2e700b7954cad69fd1561d6b3808d6d2294e6621e23be2bf89dab4e3b653761e96072668d026a3b804846dd16d22706b62562ec1140b1b594d7d3
7
+ data.tar.gz: 7a745f9940a81427f6fdd053bd2de9817b39f0d6a6315197d63a17b534516d01212715077e5e4680ad99b8c71796efe90f29612238205fc723075f2e9093cb98
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- train-tax-calculator (0.1.0)
4
+ train-tax-calculator (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  train-tax-calculator!
33
33
 
34
34
  BUNDLED WITH
35
- 1.16.0
35
+ 1.16.1
data/README.md CHANGED
@@ -16,21 +16,49 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install train-tax-calculator
18
18
 
19
+ ## References
20
+
21
+ SSS [https://philpad.com/new-sss-contribution-table/](https://philpad.com/new-sss-contribution-table/)
22
+ Philhealth [https://www.philhealth.gov.ph/circulars/2017/circ2017-0024.pdf](https://www.philhealth.gov.ph/circulars/2017/circ2017-0024.pdf)
23
+ Pagibig [https://philpad.com/pagibig-contribution-table/](https://philpad.com/pagibig-contribution-table/)
24
+
19
25
  ## Usage
20
26
 
27
+ If using IRB, require the library first.
28
+
29
+ ```ruby
30
+ require 'train/tax/calculator'
31
+ ```
32
+
33
+ Get Withholding Tax
34
+ ```ruby
35
+ Train::Tax::Calculator.withholding_tax(15_000)
36
+ ```
37
+
38
+ Get Net Income
39
+ ```ruby
40
+ Train::Tax::Calculator.net_income(15_000)
41
+ ```
42
+
21
43
  Get SSS contribution
22
44
  ```ruby
23
- Train::Tax::Calculator.for_sss(15_000) # base salary
45
+ sss = Train::Tax::Calculator.for_sss(15_000) # where 15_000 is the basic salary
46
+
47
+ # employee share
48
+ sss[:es]
49
+
50
+ # employer share
51
+ sss[:er]
24
52
  ```
25
53
 
26
54
  Get Pagibig contribution
27
55
  ```ruby
28
- Train::Tax::Calculator.for_pagibig(15_000) # base salary
56
+ Train::Tax::Calculator.for_pagibig(15_000) # where 15_000 is the basic salary
29
57
  ```
30
58
 
31
59
  Get Philhealth contribution
32
60
  ```ruby
33
- Train::Tax::Calculator.for_philhealth(15_000) # base salary
61
+ Train::Tax::Calculator.for_philhealth(15_000) # where 15_000 is the basic salary
34
62
  ```
35
63
 
36
64
  ## Development
@@ -41,7 +69,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
41
69
 
42
70
  ## Contributing
43
71
 
44
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/train-tax-calculator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
72
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mrkjlchvz/train-tax-calculator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
45
73
 
46
74
  ## Code of Conduct
47
75
 
@@ -7,24 +7,69 @@ module Train
7
7
  module Tax
8
8
  module Calculator
9
9
 
10
- def self.for_philhealth(salary_base)
11
- Philhealth.compute(salary_base)
12
- end
10
+ class << self
13
11
 
14
- def self.for_pagibig(salary_base)
15
- Pagibig.compute(salary_base)
16
- end
12
+ def withholding_tax(basic_salary)
13
+ deductions = for_philhealth(basic_salary) + for_pagibig(basic_salary) + for_sss_es(basic_salary)
14
+ taxable_income = basic_salary - deductions
17
15
 
18
- def self.for_sss(salary_base)
19
- Sss.compute(salary_base)
20
- end
16
+ compute_withholding_for(taxable_income).round(2)
17
+ end
18
+
19
+ def net_income(basic_salary)
20
+ basic_salary - withholding_tax(basic_salary)
21
+ end
22
+
23
+ def for_philhealth(basic_salary)
24
+ Philhealth.compute(basic_salary)
25
+ end
26
+
27
+ def for_pagibig(basic_salary)
28
+ Pagibig.compute(basic_salary)
29
+ end
30
+
31
+ def for_sss(basic_salary)
32
+ Sss.compute(basic_salary)
33
+ end
34
+
35
+ def for_sss_es(basic_salary)
36
+ Sss.compute_employee_share(basic_salary)
37
+ end
38
+
39
+ def for_sss_er(basic_salary)
40
+ Sss.compute_employer_share(basic_salary)
41
+ end
21
42
 
22
- def self.for_sss_es(salary_base)
23
- Sss.compute_employee_share(salary_base)
24
43
  end
25
44
 
26
- def self.for_sss_er(salary_base)
27
- Sss.compute_employer_share(salary_base)
45
+ private
46
+
47
+ def self.compute_withholding_for(income)
48
+ if income >= 666_667.00
49
+
50
+ 200_833.33 + ((income - 666_667.00) * 0.35)
51
+
52
+ elsif income >= 166_667.00
53
+
54
+ 40_833.33 + ((income - 166_667.00) * 0.32)
55
+
56
+ elsif income >= 66_667.00
57
+
58
+ 10_833.33 + ((income - 66_667.00) * 0.30)
59
+
60
+ elsif income >= 33_333.00
61
+
62
+ 2_500.00 + ((income - 33_333.00) * 0.25)
63
+
64
+ elsif income >= 20_833.00
65
+
66
+ 0.00 + ((income - 20_833.00) * 0.20)
67
+
68
+ else
69
+
70
+ 0.00
71
+
72
+ end
28
73
  end
29
74
 
30
75
  end
@@ -1,7 +1,7 @@
1
1
  module Train
2
2
  module Tax
3
3
  module Calculator
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-tax-calculator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-05 00:00:00.000000000 Z
11
+ date: 2018-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.6.14
99
+ rubygems_version: 2.6.12
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: TRAIN Tax Calculator for PH 2018