r17354 - gnucash/branches/2.2/src/business/business-reports - [r17148] Honor the "used columns" in the balance row (#530924)

Andreas Köhler andi5 at cvs.gnucash.org
Sun Jul 20 19:51:47 EDT 2008


Author: andi5
Date: 2008-07-20 19:51:46 -0400 (Sun, 20 Jul 2008)
New Revision: 17354
Trac: http://svn.gnucash.org/trac/changeset/17354

Modified:
   gnucash/branches/2.2/src/business/business-reports/owner-report.scm
Log:
[r17148] Honor the "used columns" in the balance row (#530924)

Committed by warlord.


Modified: gnucash/branches/2.2/src/business/business-reports/owner-report.scm
===================================================================
--- gnucash/branches/2.2/src/business/business-reports/owner-report.scm	2008-07-20 20:29:57 UTC (rev 17353)
+++ gnucash/branches/2.2/src/business/business-reports/owner-report.scm	2008-07-20 23:51:46 UTC (rev 17354)
@@ -185,21 +185,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")))
 	    )))
@@ -233,29 +256,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)))
 
@@ -263,14 +263,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
@@ -320,7 +321,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