r17513 - gnucash/branches/2.2/src/report/standard-reports - [r17430] Bug #464771: Investment Portfolio report: If there is no price for a particular holding, show a zero price instead of crashing the report.

Andreas Köhler andi5 at cvs.gnucash.org
Sun Sep 14 17:29:55 EDT 2008


Author: andi5
Date: 2008-09-14 17:29:55 -0400 (Sun, 14 Sep 2008)
New Revision: 17513
Trac: http://svn.gnucash.org/trac/changeset/17513

Modified:
   gnucash/branches/2.2/src/report/standard-reports/portfolio.scm
Log:
[r17430] Bug #464771: Investment Portfolio report: If there is no price for a particular holding, show a zero price instead of crashing the report.

Committed by cedayiv.

Modified: gnucash/branches/2.2/src/report/standard-reports/portfolio.scm
===================================================================
--- gnucash/branches/2.2/src/report/standard-reports/portfolio.scm	2008-09-14 21:29:47 UTC (rev 17512)
+++ gnucash/branches/2.2/src/report/standard-reports/portfolio.scm	2008-09-14 21:29:55 UTC (rev 17513)
@@ -127,8 +127,16 @@
                  (units (cadr (unit-collector 'getpair commodity #f)))
 
                  (price-info (price-fn commodity to-date))
-                 
-		 (value (exchange-fn (gnc:make-gnc-monetary commodity units) currency)))
+                 (price (car price-info))
+                 (price-monetary (if price
+                                     (gnc:make-gnc-monetary
+                                      (gnc-price-get-currency price)
+                                      (gnc-price-get-value price))
+                                     (gnc:make-gnc-monetary
+                                      currency
+                                      (cdr price-info))))
+                 (value (exchange-fn (gnc:make-gnc-monetary commodity units)
+                                     currency)))
 
 	    (set! work-done (+ 1 work-done))
 	    (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
@@ -145,10 +153,7 @@
 			       (xaccPrintAmount units share-print-info))
 			      (gnc:make-html-table-header-cell/markup
 			       "number-cell"
-			       (gnc:html-price-anchor
-				(car price-info)
-				(gnc:make-gnc-monetary (gnc-price-get-currency (car price-info))
-						       (gnc-price-get-value (car price-info)))))
+                               (gnc:html-price-anchor price price-monetary))
 			      (gnc:make-html-table-header-cell/markup
 			       "number-cell" value)))
 		       ;;(display (sprintf #f "Shares: %6.6d  " (gnc-numeric-to-double units)))



More information about the gnucash-changes mailing list