WIP: contrôle cotisation

This commit is contained in:
Adrien Bourmault 2022-09-15 00:00:09 +02:00
parent 0784f10954
commit 9f2cd6d774
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 18 additions and 0 deletions

View File

@ -152,6 +152,20 @@ def gestion_get_unpaid():
return unpaid_members_list.copy() return unpaid_members_list.copy()
def gestion_get_amount(member):
request_unpaid = "SELECT amount FROM services_users su " +\
"INNER JOIN membres m ON m.id = su.id_user " +\
"INNER JOIN services s ON s.id = su.id_service " +\
"LEFT JOIN services_fees sf ON sf.id = su.id_fee " +\
"INNER JOIN (SELECT id, MAX(date) " +\
"FROM services_users " +\
"GROUP BY id_user, id_service) " +\
"AS su2 ON su2.id = su.id " +\
"WHERE id_user = {};".format(member)
return gestion_read(request_unpaid)["results"][-1]["id_user"]
def get_member_infos(member): def get_member_infos(member):
request = "SELECT * FROM membres " +\ request = "SELECT * FROM membres " +\
"WHERE id = '{}';".format(member) "WHERE id = '{}';".format(member)
@ -189,6 +203,8 @@ def notify_unpaid(member):
# Get member infos # Get member infos
name, numero, email = get_member_infos(member) name, numero, email = get_member_infos(member)
amount = gestion_get_amount(member)
print(amount)
BUF.append("* {} (numero {}), {}".format(member, numero, name)) BUF.append("* {} (numero {}), {}".format(member, numero, name))
BUF.append(" NOTIFICATION MEMBRE") BUF.append(" NOTIFICATION MEMBRE")
@ -199,6 +215,8 @@ def renotify_unpaid(member):
# Get member infos # Get member infos
name, numero, email = get_member_infos(member) name, numero, email = get_member_infos(member)
amount = gestion_get_amount(member)
print(amount)
BUF.append("* {} (numero {}), {}".format(member, numero, name)) BUF.append("* {} (numero {}), {}".format(member, numero, name))
BUF.append(" RENOTIFICATION MEMBRE") BUF.append(" RENOTIFICATION MEMBRE")