Skip to content

Instantly share code, notes, and snippets.

@lricoy
Last active February 7, 2018 00:43
Show Gist options
  • Save lricoy/e0dcf0411cb378b70fb2844a2255657a to your computer and use it in GitHub Desktop.
Save lricoy/e0dcf0411cb378b70fb2844a2255657a to your computer and use it in GitHub Desktop.
Over simplified way to calculate IRRF/netSalary
const calculateIRRF = baseAmount => {
if (baseAmount <= 1903.98) {
return 0;
}
let value = 0;
if (baseAmount <= 2826.65) {
value = baseAmount * 0.075 - 142.8;
} else if (baseAmount <= 3751.05) {
value = baseAmount * 0.15 - 354.8;
} else if (baseAmount <= 4664.68) {
value = baseAmount * 0.225 - 636.13;
} else {
value = baseAmount * 0.275 - 869.36;
}
return value.toFixed(2);
};
export const calculateNetSalary = base => base - calculateIRRF(base);
@lricoy
Copy link
Author

lricoy commented Feb 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment