Forked from bactisme/Calcul de l'impot français par tranche.js
Created
February 15, 2017 21:31
-
-
Save HugoHeneault/e7f4e43ea129d4f85727dcc0309cd200 to your computer and use it in GitHub Desktop.
Calcul de l'impot français par tranche (javascript)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.impots.gouv.fr/portal/dgi/public/popup?espId=1&typePage=cpr02&docOid=documentstandard_6182 | |
function impotBareme(montant){ | |
var impot = 0; | |
var tranches = new Array(); | |
tranches.push([6011, 0]); | |
tranches.push([11991, 0.055]); | |
tranches.push([26631, 0.14]); | |
tranches.push([71397, 0.30]); | |
tranches.push([151200, 0.41]); | |
for(var i = 0; i < 4; i++){ | |
if (montant >= tranches[i][0]){ | |
danslatranche = tranches[i][0]; | |
impot += danslatranche * tranches[i][1]; | |
montant = montant - tranches[i][0]; | |
}else if (montant < tranches[i][0]){ | |
impot += montant*tranches[i][1]; | |
montant = 0; | |
break; | |
} | |
} | |
if (montant > 0) | |
impot += montant*0.45; | |
return Math.round(impot, 2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment