AUDIT: r17148 - gnucash/trunk/src/business/business-reports - Honor the "used columns" in the balance row (#530924)

Derek Atkins warlord at cvs.gnucash.org
Thu May 1 18:21:53 EDT 2008


Author: warlord
Date: 2008-05-01 18:21:53 -0400 (Thu, 01 May 2008)
New Revision: 17148
Trac: http://svn.gnucash.org/trac/changeset/17148

Modified:
   gnucash/trunk/src/business/business-reports/owner-report.scm
Log:
Honor the "used columns" in the balance row (#530924)
BP

Modified: gnucash/trunk/src/business/business-reports/owner-report.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/owner-report.scm	2008-05-01 21:20:56 UTC (rev 17147)
+++ gnucash/trunk/src/business/business-reports/owner-report.scm	2008-05-01 22:21:53 UTC (rev 17148)
@@ -190,21 +190,44 @@
     table))
 		 
 ;;
+;; Make a row list based on the visible columns
+;;
+(define (make-row column-vector date due-date num type-str memo monetary)
+  (let ((row-contents '()))
+    (if (date-col column-vector)
+	(addto! row-contents (gnc-print-date date)))
+    (if (date-due-col column-vector)
+	(addto! row-contents 
+		(if (and due-date
+			 (not (equal? due-date (cons 0 0))))
+		    (gnc-print-date due-date)
+		    "")))
+    (if (num-col column-vector)
+	(addto! row-contents num))
+    (if (type-col column-vector)
+	(addto! row-contents type-str))
+    (if (memo-col column-vector)
+	(addto! row-contents memo))
+    (if (value-col column-vector)
+	(addto! row-contents
+		(gnc:make-html-table-cell/markup "number-cell" monetary)))
+    row-contents))
+
+;;
 ;; Adds the 'Balance' row to the table if it has not been printed and
 ;; total is not zero
 ;;
 ;; Returns printed? 
 ;;
-(define (add-balance-row table txn odd-row? printed? start-date total)
+(define (add-balance-row table column-vector txn odd-row? printed? start-date total)
   (if (not printed?)
       (begin
 	(set! printed? #t)
 	(if (not (gnc-numeric-zero-p total))
-	    (let ((row (list (gnc-print-date start-date) "" "" "Balance" ""
-			(gnc:make-html-table-cell/markup "number-cell" 
-				(gnc:make-gnc-monetary (xaccTransGetCurrency txn) total))))
+	    (let ((row (make-row column-vector start-date #f "" (_ "Balance") ""
+				 (gnc:make-gnc-monetary (xaccTransGetCurrency txn) total)))
 		  (row-style (if odd-row? "normal-row" "alternate-row")))
-	      (gnc:html-table-append-row/markup! table row-style row)
+	      (gnc:html-table-append-row/markup! table row-style (reverse row))
 	      (set! odd-row? (not odd-row?))
 	      (set! row-style (if odd-row? "normal-row" "alternate-row")))
 	    )))
@@ -238,29 +261,6 @@
 	   (else (_ "Unknown"))))
 	 )
 
-    (define (make-row date due-date num type-str memo value)
-      (let ((row-contents '()))
-	(if (date-col column-vector)
-	    (addto! row-contents (gnc-print-date date)))
-	(if (date-due-col column-vector)
-	    (addto! row-contents 
-		    (if (and due-date
-			     (not (equal? due-date (cons 0 0))))
-			(gnc-print-date due-date)
-			"")))
-	(if (num-col column-vector)
-	    (addto! row-contents num))
-	(if (type-col column-vector)
-	    (addto! row-contents type-str))
-	(if (memo-col column-vector)
-	    (addto! row-contents memo))
-	(if (value-col column-vector)
-	    (addto! row-contents
-		    (gnc:make-html-table-cell/markup "number-cell"
-						     (gnc:make-gnc-monetary
-						      currency value))))
-	row-contents))
-
     (if reverse?
 	(set! value (gnc-numeric-neg value)))
 
@@ -268,14 +268,15 @@
 	(begin
 	  
 	  ; Adds 'balance' row if needed
-	  (set! printed? (add-balance-row table txn odd-row? printed? start-date total))
+	  (set! printed? (add-balance-row table column-vector txn odd-row? printed? start-date total))
 	  
 	  ; Now print out the invoice row
 	  (if (not (null? invoice))
 	      (set! due-date (gncInvoiceGetDateDue invoice)))
 
-	  (let ((row (make-row date due-date (xaccTransGetNum txn)
-			       type-str (xaccSplitGetMemo split) value))
+	  (let ((row (make-row column-vector date due-date (xaccTransGetNum txn)
+			       type-str (xaccSplitGetMemo split)
+			       (gnc:make-gnc-monetary currency value)))
 		(row-style (if odd-row? "normal-row" "alternate-row")))
 
 	    (gnc:html-table-append-row/markup! table row-style
@@ -325,7 +326,7 @@
 	  ;Balance row may not have been added if all transactions were before
 	  ;start-date (and no other rows would be added either) so add it now
       (if (not (null? txns))
-	  (add-balance-row table (car txns) odd-row? printed? start-date total)
+	  (add-balance-row table used-columns (car txns) odd-row? printed? start-date total)
 		))
 
     (gnc:html-table-append-row/markup! 



More information about the gnucash-changes mailing list