From f99fd24a550a9c8821a2f8fcc98d2cfa761b9e30 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 14 Jul 2015 13:13:28 +0200 Subject: [PATCH] add payments months to student XLS export --- teleforma/views/crfpa.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index ac8b9527..4fd6870d 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -251,6 +251,17 @@ class UserXLSBook(object): row.write(16, student.total_fees) row.write(17, student.balance) + payments = student.payments.all() + i = 18 + for month in months_choices: + payment = payments.filter(month=month[0]) + if payment: + value = payment[0].value + else: + value = 0 + row.write(i, value) + i += 1 + return counter + 1 else: return counter @@ -276,6 +287,9 @@ class UserXLSBook(object): {'name':"Total reductions", 'width':4000}, {'name':"Balance", 'width':4000}, ] + for month in months_choices: + cols.append({'name': 'Paiement ' + slugify(month[1]), 'width': 4000}) + i = 0 for col in cols: row.write(i, col['name']) -- 2.39.5