]> git.parisson.com Git - teleforma.git/commitdiff
add payments months to student XLS export
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 14 Jul 2015 11:13:28 +0000 (13:13 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 14 Jul 2015 11:13:28 +0000 (13:13 +0200)
teleforma/views/crfpa.py

index ac8b952784960a057f69fdde6f3d2807a76d58c6..4fd6870d8b40651c1ca9264d1fb9aa19855ec4b0 100644 (file)
@@ -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'])