<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -30,7 +30,7 @@ class ProjectInvoiceInline(admin.TabularInline):
     model = ProjectInvoice
 
 class ProjectAdmin(admin.ModelAdmin):
-    list_display = ('name','start_date')
+    list_display = ('name','start_date', 'total_invoiced', 'total_cost', 'profit')
     inlines = [ProjectInvoiceInline,]
     
 class ProjectTimeAdmin(admin.ModelAdmin):</diff>
      <filename>beancounter/admin.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 import datetime
+import decimal
 
 from django.db import models
 from django.contrib.localflavor.us.models import PhoneNumberField
@@ -118,6 +119,24 @@ class Project(models.Model):
 
     def __unicode__(self):
         return self.name
+        
+    def total_invoiced(self):
+        #TODO aggregate support
+        total = decimal.Decimal(&quot;0.00&quot;)
+        for invoice in self.projectinvoice_set.all():
+            total += invoice.amount
+        return total
+    
+    def total_cost(self):
+        #TODO aggregate support
+        total = decimal.Decimal(&quot;0.00&quot;)
+        for time in self.projecttime_set.all():
+            total += time.cost_converted
+        return total
+    
+    def profit(self):
+        return self.total_invoiced() - self.total_cost()
+            
 
 class ProjectInvoice(models.Model):
     &quot;&quot;&quot;</diff>
      <filename>beancounter/models.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e4ceba0f2e7b7cb07b007110926bc02104c52120</id>
    </parent>
  </parents>
  <author>
    <name>Peter Baumgartner</name>
    <email>pete@lincolnloop.com</email>
  </author>
  <url>http://github.com/lincolnloop/django-beancounter/commit/1c4c5ca68bda347f824ba4c41b41a8025e664750</url>
  <id>1c4c5ca68bda347f824ba4c41b41a8025e664750</id>
  <committed-date>2009-01-04T18:15:06-08:00</committed-date>
  <authored-date>2009-01-04T18:15:06-08:00</authored-date>
  <message>some helper functions for project tracking</message>
  <tree>8730dce53b70f547b7428c2d5ff680b7f6cfa199</tree>
  <committer>
    <name>Peter Baumgartner</name>
    <email>pete@lincolnloop.com</email>
  </committer>
</commit>
