]> git.parisson.com Git - teleforma.git/commitdiff
add payements to XLS export
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 11 May 2015 22:58:44 +0000 (00:58 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 11 May 2015 22:58:44 +0000 (00:58 +0200)
teleforma/admin.py
teleforma/models/crfpa.py
teleforma/views/crfpa.py

index 2fa3d4cbf73a6a089291d46f3038cdc909c7fe25..bd7f5c0034d9b533b42ab10f918d58f8612ea56d 100644 (file)
@@ -72,9 +72,6 @@ class StudentAdmin(admin.ModelAdmin):
     def student_name(self, instance):
         return instance.user.last_name + ' ' + instance.user.first_name
 
-    def balance(self, instance):
-        return  round(instance.total_payments - instance.total_fees, 2)
-
     # def queryset(self, request):
     #     qs = super(StudentAdmin, self).queryset(request)
     #     qs = qs.annotate(models.Count('warehouse__amount'))
index ccab76108d5bf26555c650a216cec048aa8691b5..98f6e95ae33041d325770f4605927e11b076b0f6 100644 (file)
@@ -162,6 +162,10 @@ class Student(Model):
             amount += payment.value
         return amount
 
+    @property
+    def balance(self):
+        return  round(self.total_payments - self.total_fees, 2)
+
     class Meta(MetaCore):
         db_table = app_label + '_' + 'student'
         verbose_name = _('Student')
index 6c5b396bef3c6bb1d0ab5d0bcf9537be6ff698dd..bb6824cdf32a6678481bcb048e42ba5f72e205ba 100644 (file)
@@ -244,6 +244,11 @@ class UserXLSBook(object):
                 row.write(12, profile.city)
                 row.write(13, profile.telephone)
                 row.write(14, user.date_joined.strftime("%d/%m/%Y"))
+
+            row.write(15, student.total_payments)
+            row.write(16, student.total_fees)
+            row.write(17, student.balance)
+
             return counter + 1
         else:
             return counter
@@ -264,7 +269,10 @@ class UserXLSBook(object):
                 {'name':'CP', 'width':2500},
                 {'name':'VILLE', 'width':5000},
                 {'name':'TEL', 'width':5000},
-                {'name':"Date d'inscription", 'width':5000}
+                {'name':"Date d'inscription", 'width':5000},
+                {'name':"Total paiements", 'width':4000},
+                {'name':"Total reductions", 'width':4000},
+                {'name':"Balance", 'width':4000},
                 ]
         i = 0
         for col in cols: