Skip to content

Instantly share code, notes, and snippets.

@bactisme
Last active February 4, 2022 22:49
Show Gist options
  • Save bactisme/35ef23f3f73a9dd97d00 to your computer and use it in GitHub Desktop.
Save bactisme/35ef23f3f73a9dd97d00 to your computer and use it in GitHub Desktop.
Calcul de l'impot français par tranche (javascript)
// http://www.impots.gouv.fr/portal/dgi/public/popup?espId=1&typePage=cpr02&docOid=documentstandard_6182
// Impots sur revenus 2018
// Voir commentaire du gist pour les années suivantes
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);
}
@destpat
Copy link

destpat commented May 1, 2020

Update For 2020

function impotBareme(montant){
 var impot = 0;
    var tranches = new Array();
    tranches.push([10064, 0]);
    tranches.push([25659, 0.11]);
    tranches.push([73369, 0.30]);
    tranches.push([157806, 0.41]);

    for(var i = 0; i < 3; 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);
    }

@bactisme
Copy link
Author

bactisme commented Jan 2, 2022

Mise à jour 2021 sur revenus 2020 😜

// https://www.service-public.fr/particuliers/actualites/A14556
function impotBareme(montant){
    var impot = 0;

    var tranches = new Array();
    tranches.push([10084, 0]);
    tranches.push([25710, 0.11]);
    tranches.push([73516, 0.30]);
    tranches.push([158122, 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);
}

@bactisme
Copy link
Author

bactisme commented Jan 2, 2022

Mise à jour 2022 sur revenus 2021 😜

// https://www.moneyvox.fr/impot/actualites/86887/impot-sur-le-revenu-le-bareme-pour-2022
function impotBareme(montant){
    var impot = 0;

    var tranches = new Array();
    tranches.push([10225, 0]);
    tranches.push([26070, 0.11]);
    tranches.push([74545, 0.30]);
    tranches.push([160336, 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