r21721 - gnucash/branches/2.4/src/report/standard-reports - [21694] Fix table number alignment. BP
Mike Evans
mikee at code.gnucash.org
Mon Dec 12 04:03:03 EST 2011
Author: mikee
Date: 2011-12-12 04:03:02 -0500 (Mon, 12 Dec 2011)
New Revision: 21721
Trac: http://svn.gnucash.org/trac/changeset/21721
Modified:
gnucash/branches/2.4/src/report/standard-reports/net-barchart.scm
Log:
[21694] Fix table number alignment. BP
Modified: gnucash/branches/2.4/src/report/standard-reports/net-barchart.scm
===================================================================
--- gnucash/branches/2.4/src/report/standard-reports/net-barchart.scm 2011-12-12 09:02:45 UTC (rev 21720)
+++ gnucash/branches/2.4/src/report/standard-reports/net-barchart.scm 2011-12-12 09:03:02 UTC (rev 21721)
@@ -5,16 +5,16 @@
;; By Robert Merkel <rgmerk at mira.net>
;; and Christian Stimming <stimming at tu-harburg.de>
;;
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2 of
-;; the License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of
+;; the License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
@@ -54,10 +54,10 @@
(define optname-plot-height (N_ "Plot Height"))
(define (options-generator inc-exp?)
- (let* ((options (gnc:new-options))
+ (let* ((options (gnc:new-options))
;; This is just a helper function for making options.
;; See gnucash/src/scm/options.scm for details.
- (add-option
+ (add-option
(lambda (new-option)
(gnc:register-option options new-option))))
@@ -66,13 +66,13 @@
options gnc:pagename-general
optname-from-date optname-to-date "a")
- (gnc:options-add-interval-choice!
+ (gnc:options-add-interval-choice!
options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
- (gnc:options-add-currency!
+ (gnc:options-add-currency!
options gnc:pagename-general optname-report-currency "c")
-
- (gnc:options-add-price-source!
+
+ (gnc:options-add-price-source!
options gnc:pagename-general
optname-price-source "d" 'weighted-average)
@@ -90,7 +90,7 @@
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
(lambda (accounts)
(list #t
- (filter
+ (filter
(if inc-exp?
gnc:account-is-inc-exp?
(lambda (account)
@@ -101,22 +101,22 @@
;; Display tab
(add-option
(gnc:make-simple-boolean-option
- gnc:pagename-display
+ gnc:pagename-display
(if inc-exp? optname-inc-exp optname-sep-bars)
- "a"
- (if inc-exp?
+ "a"
+ (if inc-exp?
(N_ "Show Income and Expenses?")
(N_ "Show the Asset and the Liability bars?"))
#t))
(add-option
(gnc:make-simple-boolean-option
- gnc:pagename-display
+ gnc:pagename-display
(if inc-exp? optname-show-profit optname-net-bars)
- "b"
+ "b"
(if inc-exp?
(N_ "Show the net profit?")
- (N_ "Show a Net Worth bar?"))
+ (N_ "Show a Net Worth bar?"))
#t))
(add-option
@@ -126,8 +126,8 @@
"c" (N_ "Display a table of the selected data.")
#f))
- (gnc:options-add-plot-size!
- options gnc:pagename-display
+ (gnc:options-add-plot-size!
+ options gnc:pagename-display
optname-plot-width optname-plot-height "d" 500 400)
(gnc:options-set-default-section options gnc:pagename-general)
@@ -144,17 +144,17 @@
;; This is a helper function for looking up option values.
(define (get-option section name)
- (gnc:option-value
+ (gnc:option-value
(gnc:lookup-option (gnc:report-options report-obj) section name)))
(gnc:report-starting reportname)
- (let* ((to-date-tp (gnc:timepair-end-day-time
+ (let* ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
- (get-option gnc:pagename-general
+ (get-option gnc:pagename-general
optname-to-date))))
- (from-date-tp (gnc:timepair-start-day-time
+ (from-date-tp (gnc:timepair-start-day-time
(gnc:date-option-absolute-time
- (get-option gnc:pagename-general
+ (get-option gnc:pagename-general
optname-from-date))))
(interval (get-option gnc:pagename-general optname-stepsize))
(report-currency (get-option gnc:pagename-general
@@ -164,10 +164,10 @@
(accounts (get-option gnc:pagename-accounts optname-accounts))
- (show-sep? (get-option gnc:pagename-display
- (if inc-exp? optname-inc-exp
+ (show-sep? (get-option gnc:pagename-display
+ (if inc-exp? optname-inc-exp
optname-sep-bars)))
- (show-net? (get-option gnc:pagename-display
+ (show-net? (get-option gnc:pagename-display
(if inc-exp? optname-show-profit
optname-net-bars)))
(height (get-option gnc:pagename-display optname-plot-height))
@@ -178,11 +178,11 @@
(dates-list ((if inc-exp? gnc:make-date-interval-list
gnc:make-date-list)
- ((if inc-exp? gnc:timepair-start-day-time
- gnc:timepair-end-day-time) from-date-tp)
+ ((if inc-exp? gnc:timepair-start-day-time
+ gnc:timepair-end-day-time) from-date-tp)
(gnc:timepair-end-day-time to-date-tp)
(gnc:deltasym-to-delta interval)))
- (report-title (get-option gnc:pagename-general
+ (report-title (get-option gnc:pagename-general
gnc:optname-reportname))
(classified-accounts (gnc:decompose-accountlist accounts))
(show-table? (get-option gnc:pagename-display (N_ "Show table")))
@@ -202,8 +202,8 @@
(define (collector->double c date)
(gnc-numeric-to-double
(gnc:gnc-monetary-amount
- (gnc:sum-collector-commodity
- c report-currency
+ (gnc:sum-collector-commodity
+ c report-currency
(lambda (a b) (exchange-fn a b date))))))
;; This calculates the balances for all the 'accounts' for each
@@ -212,7 +212,7 @@
;; settings. Uses the collector->double conversion function
;; above. Returns a list of doubles.
(define (process-datelist accounts dates income?)
- (map
+ (map
(lambda (date)
(collector->double
((if inc-exp?
@@ -220,37 +220,37 @@
gnc:accounts-get-comm-total-income
gnc:accounts-get-comm-total-expense)
gnc:accounts-get-comm-total-assets)
- accounts
+ accounts
(lambda (account)
(if inc-exp?
;; for inc-exp, 'date' is a pair of time values, else
;; it is a time value.
- (gnc:account-get-comm-balance-interval
+ (gnc:account-get-comm-balance-interval
account (first date) (second date) #f)
- (gnc:account-get-comm-balance-at-date
+ (gnc:account-get-comm-balance-at-date
account date #f))))
(if inc-exp? (second date) date)))
dates))
(gnc:report-percent-done 1)
- (set! commodity-list (gnc:accounts-get-commodities
- (append
+ (set! commodity-list (gnc:accounts-get-commodities
+ (append
(gnc:acccounts-get-all-subaccounts accounts)
accounts)
report-currency))
(gnc:report-percent-done 10)
- (set! exchange-fn (gnc:case-exchange-time-fn
- price-source report-currency
+ (set! exchange-fn (gnc:case-exchange-time-fn
+ price-source report-currency
commodity-list to-date-tp
10 40))
(gnc:report-percent-done 50)
- (if
+ (if
(not (null? accounts))
(let* ((assets-list #f)
(liability-list #f)
(net-list #f)
- (date-string-list (map
+ (date-string-list (map
(if inc-exp?
(lambda (date-list-item)
(gnc-print-date
@@ -260,7 +260,7 @@
(set! assets-list
(process-datelist
- (if inc-exp?
+ (if inc-exp?
accounts
(assoc-ref classified-accounts ACCT-TYPE-ASSET))
dates-list #t))
@@ -275,8 +275,8 @@
(set! net-list
(map + assets-list liability-list))
(gnc:report-percent-done 90)
-
- (gnc:html-barchart-set-title!
+
+ (gnc:html-barchart-set-title!
chart report-title)
(gnc:html-barchart-set-subtitle!
chart (sprintf #f
@@ -291,10 +291,10 @@
;; Determine whether we have enough space for horizontal labels
;; -- kind of a hack. Assumptions: y-axis labels and legend
;; require 200 pixels, and each x-axes label needs 60 pixels.
- (gnc:html-barchart-set-row-labels-rotated?!
- chart (< (/ (- width 200)
+ (gnc:html-barchart-set-row-labels-rotated?!
+ chart (< (/ (- width 200)
(length date-string-list)) 60))
-
+
;; Add the data
(if show-sep?
(begin
@@ -307,7 +307,7 @@
(add-column! net-list))
;; Legend labels, colors
- (gnc:html-barchart-set-col-labels!
+ (gnc:html-barchart-set-col-labels!
chart (append
(if show-sep?
(if inc-exp?
@@ -319,13 +319,13 @@
(list (_ "Net Profit"))
(list (_ "Net Worth")))
'())))
- (gnc:html-barchart-set-col-colors!
+ (gnc:html-barchart-set-col-colors!
chart (append
(if show-sep?
'("blue" "red") '())
(if show-net?
'("green") '())))
-
+
;; URLs for income/expense or asset/liabilities bars.
(if show-sep?
(let ((urls
@@ -335,7 +335,7 @@
"Income Over Time"
"Assets Over Time")
report-obj
- (list
+ (list
(list gnc:pagename-display
"Use Stacked Bars" #t)
(list gnc:pagename-general
@@ -348,7 +348,7 @@
"Expense Over Time"
"Liabilities Over Time")
report-obj
- (list
+ (list
(list gnc:pagename-display
"Use Stacked Bars" #t)
(list gnc:pagename-general
@@ -356,15 +356,15 @@
(if inc-exp?
(_ "Expense Chart")
(_ "Liability Chart"))))))))
- (gnc:html-barchart-set-button-1-bar-urls!
+ (gnc:html-barchart-set-button-1-bar-urls!
chart urls)
- (gnc:html-barchart-set-button-1-legend-urls!
+ (gnc:html-barchart-set-button-1-legend-urls!
chart urls)))
-
+
;; Test for all-zero data here.
(if non-zeros
(begin
- (gnc:html-document-add-object! document chart)
+ (gnc:html-document-add-object! document chart)
(if show-table?
(let ((table (gnc:make-html-table)))
(gnc:html-table-set-col-headers!
@@ -397,7 +397,7 @@
(lambda (col)
(gnc:html-table-set-col-style!
table col "td"
- 'attribute (list "align" "right")))
+ 'attribute (list "class" "number-cell")))
'(1 2 3))
(gnc:html-document-add-object! document table))
@@ -406,13 +406,13 @@
document
(gnc:html-make-empty-data-warning
report-title (gnc:report-id report-obj)))))
-
+
;; else no accounts selected
(gnc:html-document-add-object!
document
- (gnc:html-make-no-account-warning
+ (gnc:html-make-no-account-warning
report-title (gnc:report-id report-obj))))
-
+
(gnc:report-finished)
document))
More information about the gnucash-changes
mailing list