ajout du retour dans le temps pour la trésorerie + refactoring du code pour l'exemption en septembre

This commit is contained in:
Romain Beuque 2014-09-12 18:49:32 +02:00
parent ddc9ba8a20
commit bb2bd7c1e9
4 changed files with 9 additions and 10 deletions

View File

@ -33,12 +33,6 @@ def disconnect_members_from_residence(admin_user, residence_dn):
if machines_tuples != []:
if not CotisationComputes.is_cotisation_paid(member.dn, admin_user, residence_dn):
#verification de grace pour septembre : si le membre avait cotise en Aout, on lui accorde un delai de paiement pour Septembre, et on ne le deconnecte pas
if date_actuelle.month == 9 and CotisationComputes.is_cotisation_was_paid_last_year(member.dn, admin_user, residence_dn):
#le membre etait a jour en aout, on lui autorise un delai de paiement en septembre - pas de deconnexion
continue
#end if
dhcps = Machine.get_dhcps(admin_user, member.dn)
machine_membre_tag = "machine_membre" # FIXME move to config

View File

@ -28,11 +28,13 @@ class TreasuryController(AuthenticatedBaseController):
""" Affiche les résultats """
@expose("brie.templates.treasury.index")
def index(self):
def index(self, year = None):
residence_dn = self.user.residence_dn
residence = Residences.get_name_by_dn(self.user, self.user.residence_dn)
year = CotisationComputes.current_year()
if year is None:
year = CotisationComputes.current_year()
#end if
all_payments = Cotisation.get_all_payment_by_year(self.user, residence_dn, year)
all_payments_cashed = Cotisation.get_all_cashed_payments_by_year(self.user, residence_dn, year)
total_earned = 0
@ -85,7 +87,8 @@ class TreasuryController(AuthenticatedBaseController):
"admin_totals" : admin_totals,
"admin_payments_received" : admin_payments_received_ordered,
"total_earned" : total_earned,
"total_earned_cashed" : total_earned_cashed
"total_earned_cashed" : total_earned_cashed,
"year" : int(year)
}
#end def

View File

@ -178,7 +178,8 @@ class CotisationComputes:
current_year = CotisationComputes.current_year()
cotisations = Cotisation.cotisations_of_member(user_session, member_dn, current_year)
#end if
return Room.get_by_member_dn(user_session, residence_dn, member_dn) == None or cotisations == []
#en septembre, on ne met pas de membre en old afin que les anciens ne soient pas deconnectes
return Room.get_by_member_dn(user_session, residence_dn, member_dn) == None or datetime.datetime.now().month != 9 or cotisations == []
#end def
@staticmethod

View File

@ -9,6 +9,7 @@
</head>
<body>
<xi:include href="navbar.html" />
<a href="/treasury/index/${year-1}">Année précédente</a> | année scolaire ${year-1}/${year} | <a href="/treasury/index/${year+1}">Année suivante</a>
<div class="section">
<span class="section_name">PAIEMENTS ANNEE EN COURS</span><br />
${total_earned} €<br />