Skip to content

Commit

Permalink
fix calcul
Browse files Browse the repository at this point in the history
  • Loading branch information
clallemand committed Sep 16, 2024
1 parent a36e95d commit d191403
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ def compute_allegement_general(individu, period, parameters):
# Be careful ! Period is several months
first_month = period.first_month

assiette = individu('assiette_allegement', period, options = [ADD])
smic_proratise = individu('smic_proratise', period, options = [ADD])
effectif_entreprise = individu('effectif_entreprise', first_month)
assiette = individu('assiette_allegement', period)
smic_proratise = individu('smic_proratise', period)
effectif_entreprise = individu('effectif_entreprise', period)

# Calcul du taux
# Le montant maximum de l’allègement dépend de l’effectif de l’entreprise.
Expand Down Expand Up @@ -480,8 +480,8 @@ def compute_allegement_cotisation_allocations_familiales_base(individu, period,
'''
La réduction du taux de la cotisation d’allocations familiales
'''
assiette = individu('assiette_allegement', period, options = [ADD])
smic_proratise = individu('smic_proratise', period, options = [ADD])
assiette = individu('assiette_allegement', period)
smic_proratise = individu('smic_proratise', period)
law = parameters(period).prelevements_sociaux.reductions_cotisations_sociales.allegement_cotisation_allocations_familiales
taux_reduction = law.reduction
if period.start.year < 2024:
Expand Down Expand Up @@ -541,12 +541,12 @@ def compute_allegement_cotisation_maladie_base(individu, period, parameters):
'''
allegement_mmid = parameters(period).prelevements_sociaux.reductions_cotisations_sociales.alleg_gen.mmid

assiette_allegement = individu('assiette_allegement', period, options = [ADD])
smic_proratise = individu('smic_proratise', period, options = [ADD])
assiette_allegement = individu('assiette_allegement', period)
smic_proratise = individu('smic_proratise', period)
if period.start.year < 2024:
plafond_allegement_mmid = allegement_mmid.plafond * smic_proratise
else:
coefficient_proratisation = individu('coefficient_proratisation', period, options = [ADD])
coefficient_proratisation = individu('coefficient_proratisation', period)
parameters_smic_2023_12 = parameters('2023-12').marche_travail.salaire_minimum.smic
smic_horaire_brut_2023_12 = parameters_smic_2023_12.smic_b_horaire
nbh_travail_2023_12 = parameters_smic_2023_12.nb_heures_travail_mensuel
Expand Down Expand Up @@ -586,7 +586,10 @@ def compute_allegement_annuel(individu, period, parameters, variable_name, compu
if period.start.month < 12:
return 0
if period.start.month == 12:
return compute_function(individu, period.this_year, parameters)
return sum(
compute_function(individu, sub_period, parameters)
for sub_period in period.this_year.get_subperiods(MONTH)
)


def compute_allegement_anticipe(individu, period, parameters, variable_name, compute_function):
Expand All @@ -596,9 +599,10 @@ def compute_allegement_anticipe(individu, period, parameters, variable_name, com
cumul = individu(
variable_name,
Period(('month', period.start.offset('first-of', 'year'), 11)), options = [ADD])
return compute_function(
individu, period.this_year, parameters
) - cumul
return sum(
compute_function(individu, sub_period, parameters)
for sub_period in period.this_year.get_subperiods(MONTH)
) - cumul


def compute_allegement_progressif(individu, period, parameters, variable_name, compute_function):
Expand All @@ -609,7 +613,10 @@ def compute_allegement_progressif(individu, period, parameters, variable_name, c
up_to_this_month = Period(('month', period.start.offset('first-of', 'year'), period.start.month))
up_to_previous_month = Period(('month', period.start.offset('first-of', 'year'), period.start.month - 1))
cumul = individu(variable_name, up_to_previous_month, options = [ADD])
return compute_function(individu, up_to_this_month, parameters) - cumul
return sum(
compute_function(individu, sub_period, parameters)
for sub_period in up_to_this_month.get_subperiods(MONTH)
) - cumul


def taux_exo_cice(assiette_allegement, smic_proratise, cice):
Expand Down
4 changes: 2 additions & 2 deletions tests/formulas/allegement_cotisation_maladie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
2021-09: 0
2021-10: 0
2021-11: 0
2021-12: 93.27 * 9 # 0.06 * 1554.58 * 9 mois de salaire
2021-12: 93.27 * 9 # 0.06 * 1554.58 * 9 mois de salaire

- name: Taux complet de cotisation maladie recouvrée progressivement pour rémunération > 2.5xSmic
period: 2021-03
Expand Down Expand Up @@ -84,4 +84,4 @@
contrat_de_travail_fin: 2024-12-31
effectif_entreprise: 1
output:
allegement_cotisation_maladie: 254.44
allegement_cotisation_maladie: 254.44

0 comments on commit d191403

Please sign in to comment.