From: Guillaume Pellerin Date: Tue, 14 Jul 2015 11:13:28 +0000 (+0200) Subject: add payments months to student XLS export X-Git-Tag: 1.1~223 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f99fd24a550a9c8821a2f8fcc98d2cfa761b9e30;p=teleforma.git add payments months to student XLS export --- 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'])