From c7b23bb0071866c5854c22df435f71453c7f6ea3 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Thu, 5 Apr 2001 21:13:53 +0000 Subject: [PATCH] Christian Stimming's report patch. * src/scm/html-table.scm (gnc:html-table-remove-last-row!): Added function. * src/scm/html-utilities.scm (gnc:html-build-acct-table): Added removal of the last empty line above the total sum. * src/scm/html-document.scm: changed rendering of #f from one whitespace to equally arbitrary three whitespaces. FIXME: This should be configurable by a style-sheet. * src/scm/report/pnl.scm: deactivated column headers. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3895 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 14 ++++++++++++++ src/scm/html-document.scm | 2 +- src/scm/html-table.scm | 14 ++++++++++++++ src/scm/html-utilities.scm | 17 ++++++++++++++++- src/scm/report/pnl.scm | 2 +- 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c0576745e..fdd0b3f000 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-04-05 Christian Stimming + + * src/scm/html-table.scm (gnc:html-table-remove-last-row!): Added + function. + + * src/scm/html-utilities.scm (gnc:html-build-acct-table): Added + removal of the last empty line above the total sum. + + * src/scm/html-document.scm: changed rendering of #f from one + whitespace to equally arbitrary three whitespaces. FIXME: This + should be configurable by a style-sheet. + + * src/scm/report/pnl.scm: deactivated column headers. + 2001-04-05 Robert Graham Merkel * src/scm/report/balance-sheet.scm: Relabel summary rows, fix diff --git a/src/scm/html-document.scm b/src/scm/html-document.scm index ed08c5732a..f21db4abd8 100644 --- a/src/scm/html-document.scm +++ b/src/scm/html-document.scm @@ -362,7 +362,7 @@ (lambda (obj doc) (gnc:html-document-render-data doc obj)) ;; if the object is #f, make it a placeholder - (if obj obj " "))) + (if obj obj "   "))) (cond ((gnc:html-text? obj) (set! o (gnc:make-html-object-internal diff --git a/src/scm/html-table.scm b/src/scm/html-table.scm index ed499f6240..96e3e5a4a3 100644 --- a/src/scm/html-table.scm +++ b/src/scm/html-table.scm @@ -338,6 +338,20 @@ (gnc:html-table-set-data! table dd) new-num-rows)) +(define (gnc:html-table-remove-last-row! table) + (if (> (gnc:html-table-num-rows table) 0) + (begin + (gnc:html-table-set-num-rows-internal! + table + (- (gnc:html-table-num-rows table) 1)) + (gnc:html-table-set-data! + table + ;; Note that the rows in html-table-data are stored in + ;; reverse, i.e. the last appended table row is the first + ;; list element. + (cdr (gnc:html-table-data table)))) + '())) + (define (gnc:html-table-prepend-row! table newrow) (let* ((dd (gnc:html-table-data table)) (current-num-rows (gnc:html-table-num-rows table)) diff --git a/src/scm/html-utilities.scm b/src/scm/html-utilities.scm index 7eedd461a3..0c6efabe46 100644 --- a/src/scm/html-utilities.scm +++ b/src/scm/html-utilities.scm @@ -370,7 +370,7 @@ (define (add-group! current-depth groupname subaccounts thisbalance) (begin ;; first the group name - (add-subtotal-row! current-depth groupname #f #f) + (add-subtotal-row! current-depth groupname #f #t) ;; then all the subaccounts (traverse-accounts! subaccounts (+ 1 current-depth)) ;; and now the "total" row @@ -428,6 +428,21 @@ equal? accounts topl-accounts))) ;; No extra grouping. (traverse-accounts! (filter show-acct? topl-accounts) 1)) + + ;; This is kind of a hack: Remove the last appended row iff it has + ;; an empty text field (resulting from the add-group! function + ;; above). Depends on the structure of html-table-data, i.e. if + ;; those are changed then this might break. + (let ((row-head (car (car (gnc:html-table-data table))))) + (if (gnc:html-table-cell? row-head) + (if (car (gnc:html-table-cell-data row-head)) + '() + ;; html-table-cell-data field is #f i.e. empty. + (gnc:html-table-remove-last-row! table)) + (if row-head + '() + ;; html-table-data element is #f in itself. + (gnc:html-table-remove-last-row! table)))) ;; Show the total sum. (if show-total? diff --git a/src/scm/report/pnl.scm b/src/scm/report/pnl.scm index 5fd2e3093f..fb8877fad0 100644 --- a/src/scm/report/pnl.scm +++ b/src/scm/report/pnl.scm @@ -139,7 +139,7 @@ ;; do the processing here (table (gnc:html-build-acct-table from-date-tp to-date-tp - tree-depth show-subaccts? accounts #t + tree-depth show-subaccts? accounts #f #t gnc:accounts-get-comm-total-profit (_ "Profit") do-grouping? do-subtotals? show-fcur? report-currency exchange-fn)))