AUDIT: r16729 - gnucash/trunk/src/business/business-reports - Show the balance row for all transactions before the "from" date.
Derek Atkins
warlord at cvs.gnucash.org
Tue Dec 25 22:28:10 EST 2007
Author: warlord
Date: 2007-12-25 22:28:09 -0500 (Tue, 25 Dec 2007)
New Revision: 16729
Trac: http://svn.gnucash.org/trac/changeset/16729
Modified:
gnucash/trunk/src/business/business-reports/owner-report.scm
Log:
Show the balance row for all transactions before the "from" date.
Patch by Jeff Green
BP
Modified: gnucash/trunk/src/business/business-reports/owner-report.scm
===================================================================
--- gnucash/trunk/src/business/business-reports/owner-report.scm 2007-12-26 03:14:22 UTC (rev 16728)
+++ gnucash/trunk/src/business/business-reports/owner-report.scm 2007-12-26 03:28:09 UTC (rev 16729)
@@ -185,6 +185,27 @@
table))
;;
+;; 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)
+ (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))))
+ (row-style (if odd-row? "normal-row" "alternate-row")))
+ (gnc:html-table-append-row/markup! table row-style row)
+ (set! odd-row? (not odd-row?))
+ (set! row-style (if odd-row? "normal-row" "alternate-row")))
+ )))
+ printed?)
+
+;;
;; Make sure the caller checks the type first and only calls us with
;; invoice and payment transactions. we don't verify it here.
;;
@@ -240,20 +261,10 @@
(if (gnc:timepair-later start-date date)
(begin
-
- ; Maybe print out the 'balance' row
- (if (not printed?)
- (begin
- (set! printed? #t)
- (if (not (gnc-numeric-zero-p total))
- (let ((row (make-row start-date #f "" (_ "Balance") "" total))
- (row-style (if odd-row? "normal-row" "alternate-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")))
- )))
+ ; Adds 'balance' row if needed
+ (set! printed? (add-balance-row table txn odd-row? printed? start-date total))
+
; Now print out the invoice row
(if (not (null? invoice))
(set! due-date (gncInvoiceGetDateDue invoice)))
@@ -305,7 +316,12 @@
(set! total (gnc-numeric-add-fixed total (cadr result)))
(set! odd-row? (caddr result))
))))
- txns))
+ txns)
+ ;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)
+ ))
(gnc:html-table-append-row/markup!
table
More information about the gnucash-changes
mailing list