Skip to content

Instantly share code, notes, and snippets.

@lovasoa
Last active June 27, 2024 23:26
Show Gist options
  • Save lovasoa/11217ae219f1125fe6c0391a9d0c05ab to your computer and use it in GitHub Desktop.
Save lovasoa/11217ae219f1125fe6c0391a9d0c05ab to your computer and use it in GitHub Desktop.
maretraitenupes.fr.js
function vousrecevrez(pension) {
const csg1 = getCSGRate1(pension) * 0.985 * pension;
const csg2 = getCSGRate2(pension) * 0.985 * pension;
const pensionNet1 = pension; //calculatePensionAfterCSG(pension, getCSGRate1(pension));
const pensionNet2 =
((1 - getCSGRate2(pension)) * pension) / (1 - getCSGRate1(pension)); //calculatePensionAfterCSG(pension, getCSGRate2(pension));
const difference = (pensionNet2 - pensionNet1) * 12;
const pensionBrutte = pension / (1 - getCSGRate1(pension));
const differenceRN = -2544;
return pensionNet2;
}
function getCSGRate1(pension) {
if (pension <= 1386) return 0;
if (pension <= 1607) return 0.038;
if (pension <= 2424) return 0.066;
return 0.083;
}
function getCSGRate2(pension) {
if (pension <= 409) return 0;
if (pension <= 1110) return 0.038;
if (pension <= 1607) return 0.055;
if (pension <= 2485) return 0.075;
if (pension <= 4985) return 0.092;
if (pension <= 6651) return 0.112;
return 0.132;
}
function calculatePensionAfterCSG(pension, csgRate) {
return pension * (1 - csgRate * 0.985);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment