ajout de la vision de la tresorerie actuelle

This commit is contained in:
Romain Beuque 2013-10-06 15:03:51 +02:00
parent 6d47839f14
commit 855a97b733
3 changed files with 30 additions and 1 deletions

View File

@ -33,6 +33,17 @@ class TreasuryController(AuthenticatedBaseController):
residence = Residences.get_name_by_dn(self.user, self.user.residence_dn)
year = CotisationComputes.current_year()
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
total_earned_cashed = 0
for onepayment in all_payments:
total_earned += float(onepayment.get('x-amountPaid').first())
#end for
for onepayment in all_payments_cashed:
total_earned_cashed += float(onepayment.get('x-amountPaid').first())
#end for
pending_payments = Cotisation.get_all_pending_payments(self.user, residence_dn, year)
admin_totals = dict()
@ -72,7 +83,9 @@ class TreasuryController(AuthenticatedBaseController):
"residence" : residence,
"user" : self.user,
"admin_totals" : admin_totals,
"admin_payments_received" : admin_payments_received_ordered
"admin_payments_received" : admin_payments_received_ordered,
"total_earned" : total_earned,
"total_earned_cashed" : total_earned_cashed
}
#end def

View File

@ -411,12 +411,23 @@ class Cotisation:
return user_session.ldap_bind.search(dn, "(&(&(objectClass=aurorePayment)(x-year=" + str(year) + "))(!(x-paymentCashed=TRUE)))")
#end def
@staticmethod
def get_all_cashed_payments_by_year(user_session, residence_dn, year):
dn = ldap_config.username_base_dn + residence_dn
return user_session.ldap_bind.search(dn, "(&(&(objectClass=aurorePayment)(x-year=" + str(year) + "))(x-paymentCashed=TRUE))")
#end def
@staticmethod
def get_pending_payments_of_admin(user_session, residence_dn, user_dn, year):
dn = ldap_config.username_base_dn + residence_dn
return user_session.ldap_bind.search(dn, "(&(&(&(objectClass=aurorePayment)(x-year=" + str(year) + "))(!(x-paymentCashed=TRUE)))(x-action-user=" + user_dn + "))")
#end def
@staticmethod
def get_all_payments_of_admin(user_session, residence_dn, user_dn, year):
dn = ldap_config.username_base_dn + residence_dn
return user_session.ldap_bind.search(dn, "(&(&(&(objectClass=aurorePayment)(x-year=" + str(year) + ")))(x-action-user=" + user_dn + "))")
#end def
#end class

View File

@ -9,6 +9,11 @@
</head>
<body>
<xi:include href="navbar.html" />
<div class="section">
<span class="section_name">PAIEMENTS ANNEE EN COURS</span><br />
${total_earned} €<br />
${total_earned_cashed} € déjà encaissés
</div>
<div class="section">
<span class="section_name">PAIEMENTS EN ATTENTE</span><br />
</div>