2001-05-10 Christian Stimming <stimming@tuhh.de>

* src/scm/report/account-summary.scm, balance-sheet.scm, pnl.scm:
	moved foreign currency display option to display tab.

	* src/scm/html-utilities.scm
	(gnc:html-acct-table-comm-row-helper!): fixed display bug.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4146 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2001-05-10 08:24:37 +00:00
parent f632f3e02d
commit 09945cef3c
5 changed files with 120 additions and 92 deletions

View File

@@ -1,5 +1,11 @@
2001-05-10 Christian Stimming <stimming@tuhh.de>
* src/scm/report/account-summary.scm, balance-sheet.scm, pnl.scm:
moved foreign currency display option to display tab.
* src/scm/html-utilities.scm
(gnc:html-acct-table-comm-row-helper!): fixed display bug.
* src/engine/gnc-pricedb.c (gnc_pricedb_lookup_nearest_in_time):
Fixed this function so that it works properly now.

View File

@@ -192,83 +192,87 @@
current-depth my-name my-commodity balance
reverse-balance? is-stock-account? main-row-style other-rows-style
boldface? group-header-line?)
;; Adds one row to the table. my-name is the html-object
;; displayed in the name column; foreign-balance is the
;; <gnc-monetary> for the foreign column or #f if to be left
;; empty; domestic-balance is the <gnc-monetary> for the
;; domestic column.
(define (commodity-row-helper!
my-name foreign-balance domestic-balance row-style)
(gnc:html-table-append-row/markup!
table
row-style
(append
;; left third of the table
(gnc:html-make-empty-cells (- current-depth 1))
(list (gnc:html-acct-table-cell (+ 1 (- tree-depth current-depth))
my-name boldface?))
;; right two-thirds of the table
(gnc:html-make-empty-cells
(* 2 (- tree-depth (+ current-depth (if group-header-line? 1 0)))))
(if boldface?
(list
(and foreign-balance
(gnc:make-html-text (gnc:html-markup-b foreign-balance)))
(and domestic-balance
(gnc:make-html-text (gnc:html-markup-b domestic-balance))))
(list foreign-balance domestic-balance))
(gnc:html-make-empty-cells (* 2 (- current-depth
(if group-header-line? 0 1)))))))
;;;;;;;;;;
;; the first row for each account: shows the name and the
;; balance in the report-commodity
(if (and (not is-stock-account?)
;; FIXME: need to check whether we really have only one
;; foreign currency if is-stock-account==#t.
(gnc:commodity-equiv? my-commodity report-commodity))
;; usual case: the account balance in terms of report
;; commodity
(commodity-row-helper!
my-name #f
(if balance
(balance 'getmonetary report-commodity reverse-balance?)
#f)
main-row-style)
;; Special case for stock-accounts: then the foreign commodity
;; gets displayed in this line rather then the following lines
;; (loop below). Is also used if is-stock-account? is true.
(let ((my-balance
(if balance (balance 'getmonetary
my-commodity reverse-balance?) #f)))
(let ((already-printed #f))
;; Adds one row to the table. my-name is the html-object
;; displayed in the name column; foreign-balance is the
;; <gnc-monetary> for the foreign column or #f if to be left
;; empty; domestic-balance is the <gnc-monetary> for the
;; domestic column.
(define (commodity-row-helper!
my-name foreign-balance domestic-balance row-style)
(gnc:html-table-append-row/markup!
table
row-style
(append
;; left third of the table
(gnc:html-make-empty-cells (- current-depth 1))
(list (gnc:html-acct-table-cell (+ 1 (- tree-depth current-depth))
my-name boldface?))
;; right two-thirds of the table
(gnc:html-make-empty-cells
(* 2 (- tree-depth (+ current-depth (if group-header-line? 1 0)))))
(if boldface?
(list
(and foreign-balance
(gnc:make-html-text (gnc:html-markup-b foreign-balance)))
(and domestic-balance
(gnc:make-html-text (gnc:html-markup-b domestic-balance))))
(list foreign-balance domestic-balance))
(gnc:html-make-empty-cells (* 2 (- current-depth
(if group-header-line? 0 1)))))))
;;;;;;;;;;
;; the first row for each account: shows the name and the
;; balance in the report-commodity
(if (and (not is-stock-account?)
;; FIXME: need to check whether we really have only one
;; foreign currency if is-stock-account==#t.
(gnc:commodity-equiv? my-commodity report-commodity))
;; usual case: the account balance in terms of report
;; commodity
(commodity-row-helper!
my-name
my-balance
(exchange-fn my-balance report-commodity)
main-row-style)))
;; The additional rows: show no name, but the foreign currency
;; balance and its corresponding value in the
;; report-currency. One row for each non-report-currency.
(if (and balance (not is-stock-account?))
(balance
'format
(lambda (curr val)
(if (gnc:commodity-equiv? curr report-commodity)
'()
(let ((bal
(if reverse-balance?
(gnc:monetary-neg (gnc:make-gnc-monetary curr val))
(gnc:make-gnc-monetary curr val))))
(commodity-row-helper!
;; print no account name
(car (gnc:html-make-empty-cells 1))
;; print the account balance in the respective
;; commodity
bal
(exchange-fn bal report-commodity)
other-rows-style))))
#f)))
my-name #f
(if balance
(balance 'getmonetary report-commodity reverse-balance?)
#f)
main-row-style)
;; Special case for stock-accounts: then the foreign commodity
;; gets displayed in this line rather then the following lines
;; (loop below). Is also used if is-stock-account? is true.
(let ((my-balance
(if balance (balance 'getmonetary
my-commodity reverse-balance?) #f)))
(set! already-printed my-commodity)
(commodity-row-helper!
my-name
my-balance
(exchange-fn my-balance report-commodity)
main-row-style)))
;; The additional rows: show no name, but the foreign currency
;; balance and its corresponding value in the
;; report-currency. One row for each non-report-currency.
(if (and balance (not is-stock-account?))
(balance
'format
(lambda (curr val)
(if (or (gnc:commodity-equiv? curr report-commodity)
(and already-printed
(gnc:commodity-equiv? curr already-printed)))
'()
(let ((bal
(if reverse-balance?
(gnc:monetary-neg (gnc:make-gnc-monetary curr val))
(gnc:make-gnc-monetary curr val))))
(commodity-row-helper!
;; print no account name
(car (gnc:html-make-empty-cells 1))
;; print the account balance in the respective
;; commodity
bal
(exchange-fn bal report-commodity)
other-rows-style))))
#f))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -419,7 +423,8 @@
(gnc:html-acct-table-comm-row-helper!
table tree-depth report-commodity exchange-fn
current-depth my-name my-commodity balance
reverse-balance? is-stock-account? main-row-style other-rows-style boldface? group-header-line?))
reverse-balance? is-stock-account?
main-row-style other-rows-style boldface? group-header-line?))
;; Adds all appropriate rows to the table which belong to one
;; account. Uses the above helper function, i.e. here the
@@ -447,7 +452,8 @@
;; Generalization of add-account-rows! for a subtotal or for the
;; total balance.
(define (add-subtotal-row!
current-depth subtotal-name balance row-style boldface? group-header-line?)
current-depth subtotal-name balance
row-style boldface? group-header-line?)
(if show-other-curr?
(add-commodity-rows! current-depth subtotal-name
report-commodity

View File

@@ -65,10 +65,9 @@
options pagename-general optname-date "a")
;; all about currencies
(gnc:options-add-currency-selection!
(gnc:options-add-currency!
options pagename-general
optname-show-foreign optname-report-currency
"b")
optname-report-currency "b")
;; accounts to work on
(gnc:options-add-account-selection!
@@ -99,6 +98,12 @@
pagename-display optname-show-parent-total
"d" (N_ "Show subtotals for parent accounts") #t))
(gnc:register-option
options
(gnc:make-simple-boolean-option
gnc:pagename-display optname-show-foreign
"e" (N_ "Display the account's foreign currency amount?") #f))
;; Set the general page as default option tab
(gnc:options-set-default-section options pagename-general)
@@ -126,7 +131,7 @@
optname-show-parent-balance))
(show-parent-total? (get-option pagename-display
optname-show-parent-total))
(show-fcur? (get-option pagename-general optname-show-foreign))
(show-fcur? (get-option pagename-display optname-show-foreign))
(report-currency (get-option pagename-general
optname-report-currency))
(date-tp (gnc:timepair-end-day-time

View File

@@ -77,10 +77,10 @@
optname-to-date "a")
;; all about currencies
(gnc:options-add-currency-selection!
(gnc:options-add-currency!
options gnc:pagename-general
optname-show-foreign optname-report-currency
"b")
optname-report-currency "b")
(gnc:options-add-price-source!
options gnc:pagename-general
optname-price-source "c" 'weighted-average)
@@ -110,11 +110,17 @@
gnc:pagename-display optname-show-parent-total
"d" (N_ "Show subtotals for parent accounts") #f))
(gnc:register-option
options
(gnc:make-simple-boolean-option
gnc:pagename-display optname-show-foreign
"e" (N_ "Display the account's foreign currency amount?") #f))
(gnc:register-option
options
(gnc:make-simple-boolean-option
gnc:pagename-display optname-show-rates
"e" (N_ "Show the exchange rates used") #f))
"f" (N_ "Show the exchange rates used") #f))
;; Set the general page as default option tab
(gnc:options-set-default-section options gnc:pagename-general)
@@ -143,7 +149,7 @@
optname-show-parent-balance))
(show-parent-total? (get-option gnc:pagename-display
optname-show-parent-total))
(show-fcur? (get-option gnc:pagename-general
(show-fcur? (get-option gnc:pagename-display
optname-show-foreign))
(report-currency (get-option gnc:pagename-general
optname-report-currency))

View File

@@ -57,10 +57,9 @@
optname-from-date optname-to-date "a")
;; all about currencies
(gnc:options-add-currency-selection!
(gnc:options-add-currency!
options gnc:pagename-general
optname-show-foreign optname-report-currency
"b")
optname-report-currency "b")
;; accounts to work on
(gnc:options-add-account-selection!
@@ -90,11 +89,17 @@
gnc:pagename-display optname-show-parent-total
"d" (N_ "Show subtotals for parent accounts") #t))
(gnc:register-option
options
(gnc:make-simple-boolean-option
gnc:pagename-display optname-show-foreign
"e" (N_ "Display the account's foreign currency amount?") #f))
(gnc:register-option
options
(gnc:make-simple-boolean-option
gnc:pagename-display optname-show-rates
"e" (N_ "Show the exchange rates used") #t))
"f" (N_ "Show the exchange rates used") #t))
;; Set the general page as default option tab
(gnc:options-set-default-section options gnc:pagename-general)
@@ -126,7 +131,7 @@
optname-show-parent-balance))
(show-parent-total? (get-option gnc:pagename-display
optname-show-parent-total))
(show-fcur? (get-option gnc:pagename-general
(show-fcur? (get-option gnc:pagename-display
optname-show-foreign))
(report-currency (get-option gnc:pagename-general
optname-report-currency))