Skip to content

Commit

Permalink
[Les ptits loups] Ajout des arrondis sur période d'adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
bsongis committed May 25, 2016
1 parent 6d0a8bb commit 689b23e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions doc_facture_mensuelle.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ def FillRecapSection(self, section, facture):
details = " (%s)" % GetHeureString(facture.jours_absence_non_prevenue[date])
elif date in facture.jours_presence_selon_contrat:
state = PRESENT
details = " (%s)" % GetHeureString(facture.jours_presence_selon_contrat[date])
details = " (%s)" % GetHeureString(facture.jours_presence_selon_contrat[date][1])
elif date in facture.jours_supplementaires:
state = SUPPLEMENT
details = " (%s)" % GetHeureString(facture.jours_supplementaires[date])
details = " (%s)" % GetHeureString(facture.jours_supplementaires[date][1])
elif date in facture.jours_maladie:
state = MALADE
elif facture.inscrit.IsDateConge(date):
Expand Down
4 changes: 2 additions & 2 deletions facture.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ def __init__(self, inscrit, annee, mois, options=0):
self.CalculeSupplement(cotisation, heures_supplementaires_facturees)

if affectation_jours_supplementaires:
self.jours_supplementaires[date] = heures_realisees
self.jours_supplementaires[date] = heures_realisees, heures_facturees
else:
self.jours_presence_selon_contrat[date] = heures_realisees
self.jours_presence_selon_contrat[date] = heures_realisees, heures_facturees

if cotisation.majoration_journaliere:
self.supplement += cotisation.majoration_journaliere
Expand Down
1 change: 1 addition & 0 deletions panel_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ def CreateRedemarrageSizer(widget):
sizer.AddMany([CreateLabelTuple(u"Mode de facturation des périodes d'adaptation :"), (AutoChoiceCtrl(self, creche, 'facturation_periode_adaptation', modes_facturation_adaptation), 1, wx.EXPAND)])
sizer.AddMany([CreateLabelTuple(u"Mode d'arrondi des horaires des enfants :"), (AutoChoiceCtrl(self, creche, 'arrondi_heures', modes_arrondi_horaires_enfants), 0, wx.EXPAND)])
sizer.AddMany([CreateLabelTuple(u"Mode d'arrondi de la facturation des enfants :"), (AutoChoiceCtrl(self, creche, 'arrondi_facturation', modes_arrondi_factures_enfants), 0, wx.EXPAND)])
sizer.AddMany([CreateLabelTuple(u"Mode d'arrondi de la facturation des enfants pendant les périodes d'adaptation :"), (AutoChoiceCtrl(self, creche, 'arrondi_facturation_periode_adaptation', modes_arrondi_factures_enfants), 0, wx.EXPAND)])
sizer.AddMany([CreateLabelTuple(u"Mode d'arrondi des horaires des salariés :"), (AutoChoiceCtrl(self, creche, 'arrondi_heures_salaries', modes_arrondi_horaires_salaries), 0, wx.EXPAND)])
sizer.AddMany([CreateLabelTuple(u"Mode d'arrondi des semaines des contrats :"), (AutoChoiceCtrl(self, creche, 'arrondi_semaines', [(u"Arrondi à la semaine supérieure", ARRONDI_SEMAINE_SUPERIEURE), (u"Arrondi à la semaine la plus proche", ARRONDI_SEMAINE_PLUS_PROCHE)]), 0, wx.EXPAND)])
sizer.AddMany([CreateLabelTuple(u"Mode d'arrondi des mensualisations en Euros :"), (AutoChoiceCtrl(self, creche, 'arrondi_mensualisation_euros', [(u"Pas d'arrondi", SANS_ARRONDI), (u"Arrondi à l'euro le plus proche", ARRONDI_EURO_PLUS_PROCHE)]), 0, wx.EXPAND)])
Expand Down
16 changes: 11 additions & 5 deletions sqlobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def GetState(self):
return PRESENT | PREVISIONNEL
return state

def GetNombreHeures(self, facturation=False):
def GetNombreHeures(self, facturation=False, adaptation=False):
# if self.last_heures is not None:
# return self.last_heures
self.last_heures = 0.0
Expand All @@ -222,7 +222,9 @@ def GetNombreHeures(self, facturation=False):
self.last_heures = 0.0
return self.last_heures
elif value == 0 or value == PREVISIONNEL:
if facturation:
if facturation and adaptation:
mode_arrondi = creche.arrondi_facturation_periode_adaptation
elif facturation:
mode_arrondi = creche.arrondi_facturation
else:
mode_arrondi = eval('creche.' + self.mode_arrondi)
Expand Down Expand Up @@ -1872,7 +1874,7 @@ def GetDatesFromReference(self, index):
def IsInPeriodeAdaptation(self, date):
if self.debut is None or self.fin_periode_adaptation is None:
return False
return date >= self.debut and date <= self.fin_periode_adaptation
return self.debut <= date <= self.fin_periode_adaptation

def GetListeActivites(self, activite=0):
result = []
Expand Down Expand Up @@ -2353,8 +2355,12 @@ def GetState(self, date):
heures_realisees += tranche * GetDureeArrondie(creche.arrondi_heures, start, end)

union = GetUnionHeures(journee, reference)
for start, end in union:
heures_facturees += tranche * GetDureeArrondie(creche.arrondi_facturation, start, end)
if inscription.IsInPeriodeAdaptation(date):
for start, end in union:
heures_facturees += tranche * GetDureeArrondie(creche.arrondi_facturation_periode_adaptation, start, end)
else:
for start, end in union:
heures_facturees += tranche * GetDureeArrondie(creche.arrondi_facturation, start, end)

return State(PRESENT, heures_reference, heures_realisees, heures_facturees)
else:
Expand Down

0 comments on commit 689b23e

Please sign in to comment.