SingaporeCPFCalculator
SingaporeCPFCalculator
is the gem PayrollHero.com created and use to calculate for Singapore's
Central Provident Fund (CPF) contributions.
Support
- Year 2023
- Year 2022
- Year 2015
- Singapore Citizens or Singapore Permanent Residents (3rd Year Onwards)
- Singapore Permanent Residents (SPRs) during 1st Year of SPR Status
- Graduated Employer & Employee (G/G) Contribution Rate
- Full Employer & Graduated Employee (F/G) Contribution Rate
- Singapore Permanent Residents (SPRs) during 2nd Year of SPR Status
- Graduated Employer & Employee (G/G) Contribution Rate
- Full Employer & Graduated Employee (F/G) Contribution Rate
- Year 2014
- Singapore Citizens or Singapore Permanent Residents (3rd Year Onwards)
- Singapore Permanent Residents (SPRs) during 2nd Year of SPR Status
- Singapore Permanent Residents (SPRs) during 1st Year of SPR Status
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"
- accepted values :
- spr_start_date : date when Singapore Permanent Residency (SPR) started
- notes:
- this affects how the employee is classified into SPR1, SPR2 or SPR3
- required if the
residency_status
ispermanent_resident
- see: Year of Singapore Permanent Resident (SPR) Status
- notes:
- 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
- accepted values :
- 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
- accepted values :
- **ytd_additional_wages : Year to Date Additional Wages which were subject to CPF
- notes:
- this is for calculating the additional wage ceiling.
- notes:
- **ytd_ow_subject_to_cpf: Year to Date Ordinary Wages which were subject to CPF
- notes:
- this is for calculating the additional wage ceiling.
- notes:
Contributing
- Fork it ( https://github.com/[my-github-username]/singapore_cpf_calculator/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request