Skip to content

Commit

Permalink
Add barème 1985 for CNRPS
Browse files Browse the repository at this point in the history
  • Loading branch information
benjello committed Nov 19, 2024
1 parent b8bb98d commit ba13806
Show file tree
Hide file tree
Showing 10 changed files with 215 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@ brackets:
value: 0.005
- threshold:
1959-02-01:
value: null
1985-01-01:
value: 40
rate:
1959-02-01:
value: null
1985-01-01:
value: 0.0075
- threshold:
1959-02-01:
value: null
1985-01-01:
value: 80
rate:
1959-02-01:
value: null
1985-01-01:
value: 0.005
- threshold:
1959-02-01:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: Taux d'annuité par trimestre validé
description: Taux d'annuité par trimestre validé du régime des salariés non agricoles (RSNA) de la CNSS
brackets:
- threshold:
1960-01-01:
Expand All @@ -21,3 +21,6 @@ brackets:
metadata:
threshold_unit: trimestre
rate_unit: /1
reference:
1960-01-01:
title: Loi n°60-33 du 14 Décembre 1960 instituant un régime d'invalidité de vieillesse et de survie et un régime d'allocation de vieillesse et de survie dans le secteur non agricole.
24 changes: 24 additions & 0 deletions openfisca_tunisia_pension/regimes/cnrps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@
from openfisca_tunisia_pension.tools import make_mean_over_largest


# Avant 1985

# La pension d’ancienneté pour cette modalité le droit est acquis lorsque la double condition
# - de 60 ans d’âge
# - et 30ans de services effectifs civils ou militaires est remplie.
# Sont dispensés de la condition d’âge les agents :
# - admis à la retraite d’office ;
# - révoqués sans suspension des droits à la pension ;
# - licenciés pour suppression d’emplois;
# - admis à la retraite pour incapacité physique ;
# - admis à la retraite pour insuffisance professionnelle.

# La pension proportionnelle, dont le droit est acquis :
# - Sans conditions d’âge ni de durée de services aux agents mis à la retraite pour incapacité physique imputable et non imputable aux services ;
# - Sans conditions de durée de services :
# - aux agents mis à la retraite pour limite d’âge ;
# - licenciés pour suppression d’emploi et ayant plus de 15ans de services ;
# - aux femmes mères de 3 enfants âgés de moins de 16 ans ;
# - Sans conditions d’âge
# - aux agents licenciés pour insuffisance professionnelle ;
# - Sur demande ou d’office aux agents de plus de 50 ans et plus de 20 ans de services.


class RegimeCNRPS(AbstractRegimeEnAnnuites):
name = 'Régime des salariés non agricoles'
variable_prefix = 'cnrps'
Expand All @@ -30,6 +53,7 @@ class salaire_reference(Variable):
label = 'Salaires de référence du régime de la CNRPS'
definition_period = YEAR

# TODO: Il semblerait que c'était les 6 deniers mois en 2011 voir manuel CNRPS
def formula(individu, period):
'''3 dernières rémunérations ou les 2 plus élevées sur demande.'''
n = 40
Expand Down
37 changes: 37 additions & 0 deletions openfisca_tunisia_pension/regimes/regime.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,25 @@ def formula(individu, period):
majoration_pension_au_31_decembre = individu('regime_name_majoration_pension_au_31_decembre', period)
return pension_brute_au_31_decembre + majoration_pension_au_31_decembre

class pension_brute(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension brute'

def formula(individu, period, parameters):
taux_de_liquidation = individu('regime_name_taux_de_liquidation', period)
salaire_de_reference = individu('regime_name_salaire_de_reference', period)
pension_minimale = individu('regime_name_pension_minimale', period)
pension_maximale = individu('regime_name_pension_maximale', period)
return min_(
pension_maximale,
max_(
taux_de_liquidation * salaire_de_reference,
pension_minimale
)
)

class pension_brute_au_31_decembre(Variable):
value_type = float
entity = Individu
Expand All @@ -185,6 +204,24 @@ def formula(individu, period, parameters):
period,
)

class pension_maximale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension maximale'

def formula(individu, period, parameters):
NotImplementedError

class pension_minimale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension minimale'

def formula(individu, period, parameters):
NotImplementedError

class pension_servie(Variable):
value_type = float
entity = Individu
Expand Down
30 changes: 29 additions & 1 deletion openfisca_tunisia_pension/regimes/rsna.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ class RegimeRSNA(AbstractRegimeEnAnnuites):
variable_prefix = 'rsna'
parameters_prefix = 'rsna'

class RSNATypesRaisonDepartAnticipe(Enum):
__order__ = 'non_concerne licenciement_economique usure_prematuree_organisme mere_3_enfants convenance_personnelle'
non_concerne = 'Non concerné'
# A partir de 50 ans :
licenciement_economique = 'Licenciement économique avec au minimum 60 mois de cotisations (20 trimestres)'
usure_prematuree_organisme = "Usure prématurée de l'organisme médicalement constatée avec au minimum 60 mois de cotisations (20 trimestres)"
mere_3_enfants = "Femme salariée, mère de 3 enfants en vie, justifiant d'au moins 180 mois de cotisations (60 trimestres)"
# A partir de 55 ans :
convenance_personnelle = 'Convenance personnelle, avec 360 mois de cotisations (120 trimestres)'

class salaire_reference(Variable):
value_type = float
entity = Individu
Expand Down Expand Up @@ -62,7 +72,6 @@ def formula(individu, period, parameters):
rsna = parameters(period).retraite.regime_name
taux_annuite_base = rsna.taux_annuite_base
taux_annuite_supplementaire = rsna.taux_annuite_supplementaire
duree_stage = rsna.stage_derog
age_eligible = rsna.age_dep_anticip
periode_remplacement_base = rsna.periode_remplacement_base
plaf_taux_pension = rsna.plaf_taux_pension
Expand All @@ -71,6 +80,7 @@ def formula(individu, period, parameters):
pension_min_sup = rsna.pension_minimale.sup
pension_min_inf = rsna.pension_minimale.inf

duree_stage = rsna.stage_derog
stage = duree_assurance > 4 * duree_stage
pension_minimale = (
stage * pension_min_sup + not_(stage) * pension_min_inf
Expand All @@ -91,3 +101,21 @@ def formula(individu, period, parameters):
# plafonnement
montant_pension_percu = max_(montant, pension_minimale * smig)
return eligibilite * montant_pension_percu

class pension_maximale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension maximale'

def formula(individu, period, parameters):
NotImplementedError

class pension_minimale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension minimale'

def formula(individu, period, parameters):
NotImplementedError
24 changes: 23 additions & 1 deletion openfisca_tunisia_pension/variables/cnrps.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ class cnrps_pension_brute(Variable):
label = 'Pension brute'

def formula(individu, period, parameters):
NotImplementedError
taux_de_liquidation = individu('cnrps_taux_de_liquidation', period)
salaire_de_reference = individu('cnrps_salaire_de_reference', period)
pension_minimale = individu('cnrps_pension_minimale', period)
pension_maximale = individu('cnrps_pension_maximale', period)
return min_(pension_maximale, max_(taux_de_liquidation * salaire_de_reference, pension_minimale))

class cnrps_pension_brute_au_31_decembre(Variable):
value_type = float
Expand All @@ -138,6 +142,24 @@ def formula(individu, period, parameters):
pension_brute = individu('cnrps_pension_brute', period)
return revalorise(pension_brute_au_31_decembre_annee_precedente, pension_brute, annee_de_liquidation, revalorisation, period)

class cnrps_pension_maximale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension maximale'

def formula(individu, period, parameters):
NotImplementedError

class cnrps_pension_minimale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension minimale'

def formula(individu, period, parameters):
NotImplementedError

class cnrps_pension_servie(Variable):
value_type = float
entity = Individu
Expand Down
1 change: 1 addition & 0 deletions openfisca_tunisia_pension/variables/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@



def pension_from_bareme_annuite(bareme_annuite_en_trimestres)


def pension_generique(duree_assurance, sal_ref, taux_annuite_base, taux_annuite_supplementaire, duree_stage,
Expand Down
24 changes: 23 additions & 1 deletion openfisca_tunisia_pension/variables/rsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ class rsa_pension_brute(Variable):
label = 'Pension brute'

def formula(individu, period, parameters):
NotImplementedError
taux_de_liquidation = individu('rsa_taux_de_liquidation', period)
salaire_de_reference = individu('rsa_salaire_de_reference', period)
pension_minimale = individu('rsa_pension_minimale', period)
pension_maximale = individu('rsa_pension_maximale', period)
return min_(pension_maximale, max_(taux_de_liquidation * salaire_de_reference, pension_minimale))

class rsa_pension_brute_au_31_decembre(Variable):
value_type = float
Expand All @@ -136,6 +140,24 @@ def formula(individu, period, parameters):
pension_brute = individu('rsa_pension_brute', period)
return revalorise(pension_brute_au_31_decembre_annee_precedente, pension_brute, annee_de_liquidation, revalorisation, period)

class rsa_pension_maximale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension maximale'

def formula(individu, period, parameters):
NotImplementedError

class rsa_pension_minimale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension minimale'

def formula(individu, period, parameters):
NotImplementedError

class rsa_pension_servie(Variable):
value_type = float
entity = Individu
Expand Down
34 changes: 32 additions & 2 deletions openfisca_tunisia_pension/variables/rsna.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
from openfisca_tunisia_pension.tools import make_mean_over_largest
from openfisca_tunisia_pension.variables.helpers import pension_generique

class rsna_RSNATypesRaisonDepartAnticipe(Enum):
__order__ = 'non_concerne licenciement_economique usure_prematuree_organisme mere_3_enfants convenance_personnelle'
non_concerne = 'Non concerné'
licenciement_economique = 'Licenciement économique avec au minimum 60 mois de cotisations (20 trimestres)'
usure_prematuree_organisme = "Usure prématurée de l'organisme médicalement constatée avec au minimum 60 mois de cotisations (20 trimestres)"
mere_3_enfants = "Femme salariée, mère de 3 enfants en vie, justifiant d'au moins 180 mois de cotisations (60 trimestres)"
convenance_personnelle = 'Convenance personnelle, avec 360 mois de cotisations (120 trimestres)'

class rsna_cotisation(Variable):
value_type = float
entity = Individu
Expand Down Expand Up @@ -87,13 +95,13 @@ def formula(individu, period, parameters):
rsna = parameters(period).retraite.rsna
taux_annuite_base = rsna.taux_annuite_base
taux_annuite_supplementaire = rsna.taux_annuite_supplementaire
duree_stage = rsna.stage_derog
age_eligible = rsna.age_dep_anticip
periode_remplacement_base = rsna.periode_remplacement_base
plaf_taux_pension = rsna.plaf_taux_pension
smig = parameters(period).marche_travail.smig_48h
pension_min_sup = rsna.pension_minimale.sup
pension_min_inf = rsna.pension_minimale.inf
duree_stage = rsna.stage_derog
stage = duree_assurance > 4 * duree_stage
pension_minimale = stage * pension_min_sup + not_(stage) * pension_min_inf
montant = pension_generique(duree_assurance, salaire_reference, taux_annuite_base, taux_annuite_supplementaire, duree_stage, age_eligible, periode_remplacement_base, plaf_taux_pension)
Expand All @@ -120,7 +128,11 @@ class rsna_pension_brute(Variable):
label = 'Pension brute'

def formula(individu, period, parameters):
NotImplementedError
taux_de_liquidation = individu('rsna_taux_de_liquidation', period)
salaire_de_reference = individu('rsna_salaire_de_reference', period)
pension_minimale = individu('rsna_pension_minimale', period)
pension_maximale = individu('rsna_pension_maximale', period)
return min_(pension_maximale, max_(taux_de_liquidation * salaire_de_reference, pension_minimale))

class rsna_pension_brute_au_31_decembre(Variable):
value_type = float
Expand All @@ -138,6 +150,24 @@ def formula(individu, period, parameters):
pension_brute = individu('rsna_pension_brute', period)
return revalorise(pension_brute_au_31_decembre_annee_precedente, pension_brute, annee_de_liquidation, revalorisation, period)

class rsna_pension_maximale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension maximale'

def formula(individu, period, parameters):
NotImplementedError

class rsna_pension_minimale(Variable):
value_type = float
entity = Individu
definition_period = YEAR
label = 'Pension minimale'

def formula(individu, period, parameters):
NotImplementedError

class rsna_pension_servie(Variable):
value_type = float
entity = Individu
Expand Down
34 changes: 34 additions & 0 deletions tests/formulas/cnrps/taux_de_liquidation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,37 @@
cnrps_duree_assurance: 50 * 4
output:
cnrps_taux_de_liquidation: .9

# Avant 1985

- name: "21 ans de trimetres CNRPS"
period: 1980
absolute_error_margin: 1e-10
input:
cnrps_duree_assurance: 21 * 4
output:
cnrps_taux_de_liquidation: .42

- name: "31 ans de trimetres CNRPS"
period: 1980
absolute_error_margin: 1e-10
input:
cnrps_duree_assurance: 31 * 4
output:
cnrps_taux_de_liquidation: .62

- name: "40 ans de trimetres CNRPS"
period: 1980
absolute_error_margin: 1e-10
input:
cnrps_duree_assurance: 40 * 4
output:
cnrps_taux_de_liquidation: .8

- name: "45 ans de trimetres CNRPS"
period: 1980
absolute_error_margin: 1e-10
input:
cnrps_duree_assurance: 45 * 4
output:
cnrps_taux_de_liquidation: .8

0 comments on commit ba13806

Please sign in to comment.