No description, website, or topics provided.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
LICENSE.txt
README.md
Rakefile
circle.yml
singapore_cpf_calculator.gemspec

README.md

SingaporeCPFCalculator

Gem Version Code Climate Test Coverage

Circle CI

SingaporeCPFCalculator is the gem PayrollHero.com created and use to calculate for Singapore's Central Provident Fund (CPF) contributions.

Support

Installation

Add this line to your application's Gemfile:

gem 'singapore_cpf_calculator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install singapore_cpf_calculator

Usage

Use {SingaporeCPFCalculator.calculate} to calculate for CPF contribution. The method returns a {SingaporeCPFCalculator::CPFContribution} object responding to {SingaporeCPFCalculator::CPFContribution#employee}, {SingaporeCPFCalculator::CPFContribution#employer}, {SingaporeCPFCalculator::CPFContribution#total}, {SingaporeCPFCalculator::CPFContribution#ow_subject_to_cpf} and {SingaporeCPFCalculator::CPFContribution#aw_subject_to_cpf}.

  require "singapore_cpf_calculator"

  result = SingaporeCPFCalculator.calculate date: Date.new(2014, 11, 15),
                                            birthdate: Date.new(1982, 2, 18),
                                            residency_status: "permanent_resident",
                                            spr_start_date: Date.new(2014, 11, 15),
                                            ordinary_wages: 700.00,
                                            additional_wages: 252.00,
                                            employee_contribution_type: "full",
                                            employer_contribution_type: "full",
                                            ytd_additional_wages: 20_000,
                                            ytd_ow_subject_to_cpf: 80_000

  result # => #<SingaporeCPFCalculator::CPFContribution ...>
  result.employee # => 190.00
  result.employer # => 153.00
  result.total # => 343.00
  result.ow_subject_to_cpf # => 700.0 (the ordinary wages which were under the wage cap)
  result.aw_subject_to_cpf # => 252.0 (the additional wages which were under the additional wage ceiling)

The following parameters needs to be specified:

  • date : current date when the CPF is being calculated for
  • birthdate : birthdate of the employee
  • residency_status : residency status of the employee
    • accepted values : "citizen", "permanent_resident"
  • spr_start_date : date when Singapore Permanent Residency (SPR) started
  • ordinary_wages :
  • additional_wages :
  • employee_contribution_type : type of rates to use for the employee's contribution
    • accepted values : "full", "graduated"
    • note: full rates is not supported if the employer's contribution type is graduated
  • employer_contribution_type : type of rates to use
    • accepted values : "full", "graduated" type of rates to use for the employer's contribution
    • note: graduated rates is not supported if the employee's contribution type is full
  • **ytd_additional_wages : Year to Date Additional Wages which were subject to CPF
    • notes:
      • this is for calculating the additional wage ceiling.
  • **ytd_ow_subject_to_cpf: Year to Date Ordinary Wages which were subject to CPF
    • notes:
      • this is for calculating the additional wage ceiling.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/singapore_cpf_calculator/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request