def surcote(self, data, trimesters, trimesters_tot, trim_maj_tot, date_start_surcote): """ Détermination de la surcote à appliquer aux pensions """ P = reduce(getattr, self.param_name.split("."), self.P) P_long = reduce(getattr, self.param_name.split("."), self.P_longit) taux_surcote = P.surcote.taux plafond = P.surcote.nb_trim_max selected_date = P_long.surcote.dates trim_surcote = nb_trim_surcote(trimesters, selected_date, date_start_surcote) trim_surcote = minimum(trim_surcote, plafond) return taux_surcote * trim_surcote
def surcote(self, data, trimesters, trimesters_tot, trim_maj_tot, date_start_surcote): ''' Détermination de la surcote à appliquer aux pensions ''' P = reduce(getattr, self.param_name.split('.'), self.P) P_long = reduce(getattr, self.param_name.split('.'), self.P_longit) taux_surcote = P.surcote.taux plafond = P.surcote.nb_trim_max selected_date = P_long.surcote.dates trim_surcote = nb_trim_surcote(trimesters, selected_date, date_start_surcote) trim_surcote = minimum(trim_surcote, plafond) return taux_surcote * trim_surcote
def surcote(self, data, trimesters, trimesters_tot, date_start_surcote): ''' Détermination de la surcote à appliquer aux pensions.''' P = reduce(getattr, self.param_name.split('.'), self.P) P_long = reduce(getattr, self.param_name.split('.'), self.P_longit) # dispositif de type 0 n_trim = array(P.plein.n_trim, dtype=float) trim_tot = trimesters_tot.sum(axis=1) surcote = P.surcote.dispositif0.taux * (trim_tot - n_trim) * (trim_tot > n_trim) # Note surcote = 0 après 1983 # dispositif de type 1 if P.surcote.dispositif1.taux > 0: trick = P.surcote.dispositif1.date_trick trick = str(int(trick)) selected_dates = getattr(P_long.surcote.dispositif1, 'dates' + trick) if sum(selected_dates) > 0: surcote += P.surcote.dispositif1.taux * \ nb_trim_surcote(trimesters, selected_dates, date_start_surcote) # dispositif de type 2 P2 = P.surcote.dispositif2 if P2.taux0 > 0: selected_dates = P_long.surcote.dispositif2.dates basic_trim = nb_trim_surcote(trimesters, selected_dates, date_start_surcote) maj_age_trim = nb_trim_surcote(trimesters, selected_dates, 12 * P2.age_majoration) # date_start_surcote_65 = self._date_start_surcote(trimesters_tot, # trim_maj, age, age_start_surcote) # TODO: why it doesn't equal date_start_surcote ? basic_trim = basic_trim - maj_age_trim trim_with_majo = (basic_trim - P2.trim_majoration) * \ ((basic_trim - P2.trim_majoration) >= 0) basic_trim = basic_trim - trim_with_majo surcote += P2.taux0*basic_trim + \ P2.taux_maj_trim*trim_with_majo + \ P2.taux_maj_age*maj_age_trim return surcote
def surcote(self, data, trimesters, trimesters_tot, date_start_surcote): ''' Détermination de la surcote à appliquer aux pensions.''' P = reduce(getattr, self.param_name.split('.'), self.P) P_long = reduce(getattr, self.param_name.split('.'), self.P_longit) # dispositif de type 0 n_trim = array(P.plein.n_trim, dtype=float) trim_tot = trimesters_tot.sum(axis=1) surcote = P.surcote.dispositif0.taux*(trim_tot - n_trim)*(trim_tot > n_trim) # Note surcote = 0 après 1983 # dispositif de type 1 if P.surcote.dispositif1.taux > 0: trick = P.surcote.dispositif1.date_trick trick = str(int(trick)) selected_dates = getattr(P_long.surcote.dispositif1, 'dates' + trick) if sum(selected_dates) > 0: surcote += P.surcote.dispositif1.taux * \ nb_trim_surcote(trimesters, selected_dates, date_start_surcote) # dispositif de type 2 P2 = P.surcote.dispositif2 if P2.taux0 > 0: selected_dates = P_long.surcote.dispositif2.dates basic_trim = nb_trim_surcote(trimesters, selected_dates, date_start_surcote) maj_age_trim = nb_trim_surcote(trimesters, selected_dates, 12*P2.age_majoration) # date_start_surcote_65 = self._date_start_surcote(trimesters_tot, # trim_maj, age, age_start_surcote) # TODO: why it doesn't equal date_start_surcote ? basic_trim = basic_trim - maj_age_trim trim_with_majo = (basic_trim - P2.trim_majoration) * \ ((basic_trim - P2.trim_majoration) >= 0) basic_trim = basic_trim - trim_with_majo surcote += P2.taux0*basic_trim + \ P2.taux_maj_trim*trim_with_majo + \ P2.taux_maj_age*maj_age_trim return surcote