commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r133 - in gnue-invoice: . schema


From: kilo
Subject: r133 - in gnue-invoice: . schema
Date: Wed, 24 Nov 2004 06:17:25 -0600 (CST)

Author: kilo
Date: 2004-11-24 06:17:24 -0600 (Wed, 24 Nov 2004)
New Revision: 133

Modified:
   gnue-invoice/news
   gnue-invoice/schema/invoice.gcd
Log:
GNUe Invoice.
Pythonized sum code, thx to johannesV.

Modified: gnue-invoice/news
===================================================================
--- gnue-invoice/news   2004-11-24 11:33:06 UTC (rev 132)
+++ gnue-invoice/news   2004-11-24 12:17:24 UTC (rev 133)
@@ -4,6 +4,7 @@
 *************************
 New features / changes by 2004.11.24
 * Display lovely goat icon on main form.
+* Pythonized code in counting totals.
 
 New features / changes by 2004.11.23
 * Display the product/service unit value upon selecting it from dropdown.

Modified: gnue-invoice/schema/invoice.gcd
===================================================================
--- gnue-invoice/schema/invoice.gcd     2004-11-24 11:33:06 UTC (rev 132)
+++ gnue-invoice/schema/invoice.gcd     2004-11-24 12:17:24 UTC (rev 133)
@@ -76,39 +76,24 @@
 
     <property name="valueTotalNet"  type="number(10,2)" >
       items = find('INV_Item', {'INV_head':self.gnue_id}, [], ['INV_valueNet'])
-
-      total = 0.0
-      if len(items):
-        #total = sum(items)
-        for a in items:
-          total += a.INV_valueNet
-
+      total = sum([i.INV_valueNet for i in items])
+      
       print 'INV_Head::valueTotalNet #item:%d total:%f' % (len(items),total)
       return total
     </property>
 
     <property name="valueTotalVAT"  type="number(10,2)" >
       items = find('INV_Item', {'INV_head':self.gnue_id}, [], ['INV_valueVAT'])
-
-      total = 0.0
-      if len(items):
-        #total = sum(items)
-        for a in items:
-          total += a.INV_valueVAT
-
+      total = sum([i.INV_valueVAT for i in items])
+      
       print 'INV_Head::valueTotalVAT #item:%d total:%f' % (len(items),total)
       return total
     </property>
 
     <property name="valueTotalGross"    type="number(10,2)" >
       items = find('INV_Item', {'INV_head':self.gnue_id}, [], 
['INV_valueGross'])
-
-      total = 0.0
-      if len(items):
-        #total = sum(items)
-        for a in items:
-          total += a.INV_valueGross
-
+      total = sum([i.INV_valueGross for i in items])
+      
       print 'INV_Head::valueTotalGross #item:%d total:%f' % (len(items),total)
       return total
     </property>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]