mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-04-13 Christian Stimming <stimming@tuhh.de>
* src/scm/report/balance-sheet.scm: Cleanup code. Use new funcs from html-utilities. * src/scm/report/stylesheet-{plain,fancy}.scm: Added some styles for table-cells. * src/scm/html-utilities.scm (gnc:html-acct-table-cell), (gnc:html-acct-table-row-helper!), (gnc:html-acct-table-comm-row-helper!): Added functions i.e. moved them out of gnc:html-build-acct-table. Use table-cell-markup instead of direct markup-b. * Several reports: Added option page "Account" or "Display" so that every report has those. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3959 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
fb383a89dd
commit
d07f9e2041
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2001-04-13 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/scm/report/balance-sheet.scm: Cleanup code. Use new funcs
|
||||
from html-utilities.
|
||||
|
||||
* src/scm/report/stylesheet-{plain,fancy}.scm: Added some styles
|
||||
for table-cells.
|
||||
|
||||
* src/scm/html-utilities.scm (gnc:html-acct-table-cell),
|
||||
(gnc:html-acct-table-row-helper!),
|
||||
(gnc:html-acct-table-comm-row-helper!): Added functions i.e. moved
|
||||
them out of gnc:html-build-acct-table. Use table-cell-markup
|
||||
instead of direct markup-b.
|
||||
|
||||
* Several reports: Added option page "Account" or "Display" so
|
||||
that every report has those.
|
||||
|
||||
2001-04-12 Bill Gribble <grib@billgribble.com>
|
||||
|
||||
* Lots and lots of changes to support Gnome MDI. And I thought it
|
||||
|
@ -113,6 +113,144 @@
|
||||
(gnc:make-html-table-cell/size
|
||||
1 colspan (gnc:make-html-text (gnc:html-markup-hr))))))
|
||||
|
||||
;; Creates a table cell with some text in it. The cell will be created
|
||||
;; with the colspan 'colspan' (the rowspan==1), the content 'content'
|
||||
;; and in boldface if 'boldface?' is true. 'content' may be #f, or a
|
||||
;; string, or a <html-text> object. Returns a <html-table-cell>
|
||||
;; object.
|
||||
(define (gnc:html-acct-table-cell colspan content boldface?)
|
||||
(gnc:make-html-table-cell/size/markup
|
||||
1 colspan
|
||||
;; instead of html-markup-b, just use the right html-table-styles.
|
||||
(if boldface? "total-label-cell" "text-cell")
|
||||
content))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; function for account table without foreign commodities
|
||||
|
||||
;; Adds one row to the table. current-depth determines the number
|
||||
;; of empty cells, my-name is the html-object to be displayed as
|
||||
;; name, my-balance is a gnc-monetary to be displayed in the
|
||||
;; balance column, and if reverse-balance? is #t the balance will
|
||||
;; be displayed with the sign reversed.
|
||||
(define (gnc:html-acct-table-row-helper!
|
||||
table tree-depth
|
||||
current-depth my-name my-balance
|
||||
reverse-balance? boldface? group-header-line?)
|
||||
;; just a stupid little helper
|
||||
(define (identity a)
|
||||
a)
|
||||
|
||||
(gnc:html-table-append-row!
|
||||
table
|
||||
(append
|
||||
;; left half 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 half of the table
|
||||
(gnc:html-make-empty-cells
|
||||
(- tree-depth (+ current-depth (if group-header-line? 1 0))))
|
||||
;; the account balance
|
||||
(list (and my-balance
|
||||
(gnc:make-html-text
|
||||
((if boldface? gnc:html-markup-b identity)
|
||||
((if reverse-balance? gnc:monetary-neg identity)
|
||||
my-balance)))))
|
||||
(gnc:html-make-empty-cells (- current-depth
|
||||
(if group-header-line? 0 1))))))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; function for account table with foreign commodities visible
|
||||
|
||||
;; Adds all appropriate rows to the table which belong to one
|
||||
;; balance, i.e. one row for each commodity. (Note: Multiple
|
||||
;; commodities come e.g. from subaccounts with different
|
||||
;; commodities.) my-name (a html-object) is the name to be printed
|
||||
;; in the appropriate name column. my-commodity (a
|
||||
;; <gnc:commodity*>) is the "natural" balance of the current
|
||||
;; account. balance (a commodity-collector) is the balance to be
|
||||
;; printed. If reverse-balance? == #t then the balance's signs get
|
||||
;; reversed.
|
||||
(define (gnc:html-acct-table-comm-row-helper!
|
||||
table tree-depth
|
||||
current-depth my-name my-commodity balance
|
||||
reverse-balance? is-stock-account? 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)
|
||||
(gnc:html-table-append-row!
|
||||
table
|
||||
(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))
|
||||
;; 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)))
|
||||
(commodity-row-helper!
|
||||
my-name
|
||||
my-balance
|
||||
(exchange-fn my-balance report-commodity))))
|
||||
|
||||
;; 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)))))
|
||||
#f)))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; gnc:html-build-acct-table
|
||||
@ -124,14 +262,14 @@
|
||||
;;
|
||||
;; Reporting period -- start-date, end-date
|
||||
;;
|
||||
;; Selected accounts -- tree-depth, show-subaccts?, accounts,
|
||||
;; do-subtot? - FIXME: the last one changed.
|
||||
;; Selected accounts -- tree-depth, show-subaccts?, accounts
|
||||
;;
|
||||
;; Foreign currency -- show-other-curr?, report-commodity,
|
||||
;; exchange-fn
|
||||
;;
|
||||
;; Output fine-tuning -- show-col-headers?, show-total? (with
|
||||
;; total-name, get-total-fn), group-types?
|
||||
;; total-name, get-total-fn), group-types?,
|
||||
;; show-parent-balance?, show-parent-total?
|
||||
;;
|
||||
;; Note: The returned table object will have 2*tree-depth columns if
|
||||
;; show-other-curr?==#f, else it will have 3*tree-depth columns.
|
||||
@ -163,8 +301,12 @@
|
||||
;; <bool> group-types?: Specify whether to group the accounts
|
||||
;; according to their types and show a subtotal for each group.
|
||||
;;
|
||||
;; <bool> do-subtot?: Specify whether to include sub-account balances
|
||||
;; in each account's balance. -- FIXME: that no longer exists.
|
||||
;; <bool> show-parent-balance?: Specify whether to show balances of
|
||||
;; non-leaf accounts seperately.
|
||||
;;
|
||||
;; <bool> show-parent-total?: Whether to show a line with the label
|
||||
;; e.g. "Total My-Assets" and the subtotal for this account and its
|
||||
;; children.
|
||||
;;
|
||||
;; <bool> show-other-curr?, <gnc:commodity*> report-commodity,
|
||||
;; #<procedure ...> exchange-fn: The rightmost column always shows
|
||||
@ -183,8 +325,6 @@
|
||||
total-name group-types? show-parent-balance? show-parent-total?
|
||||
show-other-curr? report-commodity exchange-fn)
|
||||
(let ((table (gnc:make-html-table))
|
||||
(do-subtot? #t) ;; FIXME: this should go away once the
|
||||
;; variable won't be needed anymore.
|
||||
(topl-accounts (gnc:group-get-account-list
|
||||
(gnc:get-current-group))))
|
||||
|
||||
@ -228,33 +368,6 @@
|
||||
(string<? (gnc:account-get-code a)
|
||||
(gnc:account-get-code b)))))
|
||||
|
||||
;; just a stupid little helper
|
||||
(define (identity a)
|
||||
a)
|
||||
|
||||
;; another helper -- is xor really missing?
|
||||
(define (xor a b)
|
||||
(or (and (not a) b) (and a (not b))))
|
||||
|
||||
;; Creates the table cell with given colspan (and rowspan=1), with
|
||||
;; the content content and in boldface if boldface? is
|
||||
;; true. content may be #f, or a string, or a html-text
|
||||
;; object. Returns a html-table-cell object.
|
||||
(define (my-table-cell colspan content boldface?)
|
||||
(gnc:make-html-table-cell/size
|
||||
1 colspan
|
||||
(and content ;; if content == #f, just use #f
|
||||
(if boldface?
|
||||
;; Further improvement: use some other table cell
|
||||
;; style here ("grand-total") instead of the direct
|
||||
;; markup-b.
|
||||
(gnc:make-html-text
|
||||
(if (gnc:html-text? content)
|
||||
(apply gnc:html-markup-b
|
||||
(gnc:html-text-body content))
|
||||
(gnc:html-markup-b content)))
|
||||
content))))
|
||||
|
||||
;; Remove the last appended row iff *all* its fields are empty
|
||||
;; (==#f) or have an html-table-cell which in turn is empty
|
||||
;; (resulting from the add-group! function above). Note: This
|
||||
@ -270,127 +383,23 @@
|
||||
(gnc:html-table-remove-last-row! table)))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; function for table without foreign commodities
|
||||
|
||||
;; Adds one row to the table. current-depth determines the number
|
||||
;; of empty cells, my-name is the html-object to be displayed as
|
||||
;; name, my-balance is a gnc-monetary to be displayed in the
|
||||
;; balance column, and if reverse-balance? is #t the balance will
|
||||
;; be displayed with the sign reversed.
|
||||
;; Wrapper for gnc:html-acct-table-row-helper!
|
||||
(define (add-row-helper!
|
||||
current-depth my-name my-balance
|
||||
reverse-balance? boldface? group-header-line?)
|
||||
(gnc:html-table-append-row!
|
||||
table
|
||||
(append
|
||||
;; left half of the table
|
||||
(gnc:html-make-empty-cells (- current-depth 1))
|
||||
(list (my-table-cell (+ 1 (- tree-depth current-depth))
|
||||
my-name boldface?))
|
||||
;; right half of the table
|
||||
(gnc:html-make-empty-cells
|
||||
(- tree-depth (+ current-depth (if group-header-line? 1 0))))
|
||||
;; the account balance
|
||||
(list (and my-balance
|
||||
(gnc:make-html-text
|
||||
((if boldface? gnc:html-markup-b identity)
|
||||
((if reverse-balance? gnc:monetary-neg identity)
|
||||
my-balance)))))
|
||||
(gnc:html-make-empty-cells (- current-depth
|
||||
(if group-header-line? 0 1))))))
|
||||
(gnc:html-acct-table-row-helper!
|
||||
table tree-depth
|
||||
current-depth my-name my-balance
|
||||
reverse-balance? boldface? group-header-line?))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; function for table with foreign commodities visible
|
||||
|
||||
;; Adds all appropriate rows to the table which belong to one
|
||||
;; balance, i.e. one row for each commodity. (Note: Multiple
|
||||
;; commodities come e.g. from subaccounts with different
|
||||
;; commodities.) my-name (a html-object) is the name to be printed
|
||||
;; in the appropriate name column. my-commodity (a
|
||||
;; <gnc:commodity*>) is the "natural" balance of the current
|
||||
;; account. balance (a commodity-collector) is the balance to be
|
||||
;; printed. If reverse-balance? == #t then the balance's signs get
|
||||
;; reversed.
|
||||
;; Wrapper
|
||||
(define (add-commodity-rows!
|
||||
current-depth my-name my-commodity balance
|
||||
reverse-balance? is-stock-account? 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)
|
||||
(gnc:html-table-append-row!
|
||||
table
|
||||
(append
|
||||
;; left third of the table
|
||||
(gnc:html-make-empty-cells (- current-depth 1))
|
||||
(list (my-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?)
|
||||
(or (gnc:commodity-equiv? my-commodity report-commodity)
|
||||
do-subtot?))
|
||||
;; 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))
|
||||
;; special case if do-subtot? was false and it is in a
|
||||
;; different commodity than the report: 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)))
|
||||
(commodity-row-helper!
|
||||
my-name
|
||||
my-balance
|
||||
(exchange-fn my-balance report-commodity))))
|
||||
|
||||
;; 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. Is
|
||||
;; only used when do-subtot? == #f (otherwise this balance has
|
||||
;; only one commodity).
|
||||
(if (and do-subtot? (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)))))
|
||||
#f)))
|
||||
(gnc:html-acct-table-comm-row-helper!
|
||||
table tree-depth
|
||||
current-depth my-name my-commodity balance
|
||||
reverse-balance? is-stock-account? 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 +456,7 @@
|
||||
;; and now the "total" row
|
||||
(if group-total-line?
|
||||
(begin
|
||||
;; (remove-last-empty-row) FIXME: do this here or not?
|
||||
(remove-last-empty-row) ;; FIXME: do this here or not?
|
||||
(add-subtotal-row!
|
||||
current-depth
|
||||
(let ((total-text (gnc:make-html-text (_ "Total") " ")))
|
||||
@ -546,16 +555,10 @@
|
||||
(* 2 tree-depth)
|
||||
tree-depth)
|
||||
(_ "Balance")))))
|
||||
|
||||
;; there are tree-depth account name columns.
|
||||
(let loop ((col 0))
|
||||
(gnc:html-table-set-col-style!
|
||||
table col "td" 'attribute '("align" "left"))
|
||||
(gnc:html-table-set-col-style!
|
||||
table col "th" 'attribute '("align" "left"))
|
||||
(if (< col (- tree-depth 1))
|
||||
(loop (+ col 1))))
|
||||
|
||||
|
||||
;; No extra alignment here because that's already done in
|
||||
;; html-acct-table-cell.
|
||||
|
||||
table))
|
||||
|
||||
|
||||
|
@ -45,6 +45,8 @@
|
||||
(pagename-accounts (N_ "Accounts"))
|
||||
(optname-show-subaccounts (N_ "Always show sub-accounts"))
|
||||
(optname-accounts (N_ "Account"))
|
||||
|
||||
(pagename-display (N_ "Display"))
|
||||
(optname-group-accounts (N_ "Group the accounts"))
|
||||
(optname-show-parent-balance (N_ "Show balances for parent accounts"))
|
||||
(optname-show-parent-total (N_ "Show subtotals")))
|
||||
@ -82,19 +84,19 @@
|
||||
|
||||
;; with or without grouping
|
||||
(gnc:options-add-group-accounts!
|
||||
options pagename-accounts optname-group-accounts "b" #t)
|
||||
options pagename-display optname-group-accounts "b" #t)
|
||||
|
||||
;; new options here
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-accounts optname-show-parent-balance
|
||||
pagename-display optname-show-parent-balance
|
||||
"c" (N_ "Show balances for parent accounts") #t))
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-accounts optname-show-parent-total
|
||||
pagename-display optname-show-parent-total
|
||||
"d" (N_ "Show subtotals for parent accounts") #t))
|
||||
|
||||
;; Set the general page as default option tab
|
||||
@ -118,11 +120,11 @@
|
||||
(show-subaccts? (get-option pagename-accounts
|
||||
optname-show-subaccounts))
|
||||
(accounts (get-option pagename-accounts optname-accounts))
|
||||
(do-grouping? (get-option pagename-accounts
|
||||
(do-grouping? (get-option pagename-display
|
||||
optname-group-accounts))
|
||||
(show-parent-balance? (get-option pagename-accounts
|
||||
(show-parent-balance? (get-option pagename-display
|
||||
optname-show-parent-balance))
|
||||
(show-parent-total? (get-option pagename-accounts
|
||||
(show-parent-total? (get-option pagename-display
|
||||
optname-show-parent-total))
|
||||
(show-fcur? (get-option pagename-general optname-show-foreign))
|
||||
(report-currency (get-option pagename-general
|
||||
|
@ -14,6 +14,7 @@
|
||||
(gnc:depend "date-utilities.scm")
|
||||
|
||||
(let ((pagename-general (N_ "General"))
|
||||
(pagename-accounts (N_ "Accounts"))
|
||||
(pagename-display (N_ "Display"))
|
||||
(optname-subacct (N_ "Include Sub-Accounts"))
|
||||
(optname-report-currency (N_ "Report Currency")))
|
||||
@ -34,7 +35,7 @@
|
||||
;; account(s) to do report on
|
||||
(register-option
|
||||
(gnc:make-account-list-option
|
||||
pagename-general (N_ "Accounts")
|
||||
pagename-accounts (N_ "Accounts")
|
||||
"d" (N_ "Do transaction report on this account")
|
||||
(lambda ()
|
||||
;; FIXME : gnc:get-current-accounts disappeared
|
||||
@ -57,7 +58,7 @@
|
||||
|
||||
(register-option
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-general optname-subacct
|
||||
pagename-accounts optname-subacct
|
||||
"e" (N_ "Include sub-accounts of all selected accounts") #t))
|
||||
|
||||
;; Report currency
|
||||
@ -245,8 +246,8 @@
|
||||
(gnc:date-option-absolute-time
|
||||
(opt-val pagename-general (N_ "To")))))
|
||||
(stepsize (eval (opt-val pagename-general (N_ "Step Size"))))
|
||||
(accounts (opt-val pagename-general (N_ "Accounts")))
|
||||
(dosubs? (opt-val pagename-general optname-subacct))
|
||||
(accounts (opt-val pagename-accounts (N_ "Accounts")))
|
||||
(dosubs? (opt-val pagename-accounts optname-subacct))
|
||||
(report-currency (opt-val pagename-general optname-report-currency))
|
||||
(plot-type (opt-val pagename-display (N_ "Plot Type")))
|
||||
(show-plot? (opt-val pagename-display (N_ "Show plot")))
|
||||
|
@ -39,10 +39,11 @@
|
||||
(optname-display-depth (N_ "Account Display Depth"))
|
||||
(optname-show-subaccounts (N_ "Always show sub-accounts"))
|
||||
(optname-accounts (N_ "Account"))
|
||||
|
||||
(pagename-display (N_ "Display"))
|
||||
(optname-show-parent-balance (N_ "Show balances for parent accounts"))
|
||||
(optname-show-parent-total (N_ "Show subtotals"))
|
||||
|
||||
;; (pagename-currencies (N_ "Currencies")) too little options :)
|
||||
(pagename-currencies pagename-general)
|
||||
(optname-show-foreign (N_ "Show Foreign Currencies"))
|
||||
(optname-report-currency (N_ "Report's currency")))
|
||||
@ -59,26 +60,6 @@
|
||||
t1 (+ (gnc:html-table-num-rows t1)
|
||||
(gnc:html-table-num-rows t2)))))
|
||||
|
||||
;; Copied from html-utilities.scm.
|
||||
;; Creates the table cell with given colspan (and rowspan=1), with
|
||||
;; the content content and in boldface if boldface? is true. content
|
||||
;; may be #f (empty cell), or a string, or a html-text
|
||||
;; object. Returns a html-table-cell object.
|
||||
(define (my-table-cell colspan content boldface?)
|
||||
(gnc:make-html-table-cell/size
|
||||
1 colspan
|
||||
(and content ;; if content == #f, just use #f
|
||||
(if boldface?
|
||||
;; Further improvement: use some other table cell
|
||||
;; style here ("grand-total") instead of the direct
|
||||
;; markup-b.
|
||||
(gnc:make-html-text
|
||||
(if (gnc:html-text? content)
|
||||
(apply gnc:html-markup-b
|
||||
(gnc:html-text-body content))
|
||||
(gnc:html-markup-b content)))
|
||||
content))))
|
||||
|
||||
(define (accountlist-get-comm-balance-at-date accountlist date)
|
||||
(let ((collector (gnc:make-commodity-collector)))
|
||||
(for-each (lambda (account)
|
||||
@ -119,14 +100,14 @@
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-accounts optname-show-parent-balance
|
||||
"c" (N_ "Show balances for parent accounts") #f))
|
||||
pagename-display optname-show-parent-balance
|
||||
"c" (N_ "Show balances for parent accounts") #t))
|
||||
|
||||
;; have a subtotal for each parent account?
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-accounts optname-show-parent-total
|
||||
pagename-display optname-show-parent-total
|
||||
"d" (N_ "Show subtotals for parent accounts") #f))
|
||||
|
||||
;; Set the general page as default option tab
|
||||
@ -152,9 +133,9 @@
|
||||
optname-show-subaccounts))
|
||||
(accounts (get-option pagename-accounts
|
||||
optname-accounts))
|
||||
(show-parent-balance? (get-option pagename-accounts
|
||||
(show-parent-balance? (get-option pagename-display
|
||||
optname-show-parent-balance))
|
||||
(show-parent-total? (get-option pagename-accounts
|
||||
(show-parent-total? (get-option pagename-display
|
||||
optname-show-parent-total))
|
||||
(show-fcur? (get-option pagename-currencies
|
||||
optname-show-foreign))
|
||||
@ -166,15 +147,10 @@
|
||||
|
||||
;; decompose the account list
|
||||
(split-up-accounts (gnc:decompose-accountlist accounts))
|
||||
;;(dummy (gnc:warn "split-up-accounts" split-up-accounts))
|
||||
(asset-accounts
|
||||
(assoc-ref split-up-accounts 'asset))
|
||||
(liability-accounts
|
||||
(assoc-ref split-up-accounts 'liability))
|
||||
; (liability-account-names
|
||||
; (map gnc:account-get-name liability-accounts))
|
||||
; (dummy2
|
||||
; (gnc:warn "liability-account-names" liability-account-names))
|
||||
(equity-accounts
|
||||
(assoc-ref split-up-accounts 'equity))
|
||||
(income-expense-accounts
|
||||
@ -195,43 +171,23 @@
|
||||
(gnc:account-get-comm-balance-at-date
|
||||
account to-date-tp #f))))
|
||||
|
||||
;; Wrapper to call the right html-utility function.
|
||||
(define (add-subtotal-line table label balance)
|
||||
(if show-fcur?
|
||||
;; FIXME: The multi-currency format is not yet adapted to
|
||||
;; take tree-depth into account. Instead of coding that
|
||||
;; here it would definitely be better to extract the
|
||||
;; necessary function out of html-build-acct-table into
|
||||
;; the global namespace.
|
||||
(let ((first-row #t))
|
||||
(balance 'format
|
||||
(lambda (commodity amount)
|
||||
(html-table-append-row!
|
||||
(list (if first-row
|
||||
(begin
|
||||
(set! first-row #f)
|
||||
label)
|
||||
#f)
|
||||
(gnc:make-gnc-monetary
|
||||
commodity amount))))
|
||||
#f))
|
||||
(gnc:html-table-append-row!
|
||||
table (append
|
||||
;; FIXME: is it possible to get rid of my private
|
||||
;; definition of my-table-cell? Maybe as another
|
||||
;; extracted funtion from html-build-acct-tree.
|
||||
(list (my-table-cell tree-depth label #t))
|
||||
(gnc:html-make-empty-cells (- tree-depth 1))
|
||||
(list (and balance
|
||||
(gnc:make-html-text
|
||||
;; FIXME: this markup-b can go away as
|
||||
;; soon as we have styles here.
|
||||
(gnc:html-markup-b
|
||||
(gnc:sum-collector-commodity
|
||||
balance report-currency exchange-fn)))))))))
|
||||
|
||||
(gnc:html-acct-table-comm-row-helper!
|
||||
table tree-depth 1 label
|
||||
report-currency (gnc:sum-collector-stocks
|
||||
balance report-currency exchange-fn)
|
||||
#f #f #t #f)
|
||||
(gnc:html-acct-table-row-helper!
|
||||
table tree-depth 1 label
|
||||
(gnc:sum-collector-commodity
|
||||
balance report-currency exchange-fn)
|
||||
#f #t #f)))
|
||||
|
||||
;;(gnc:warn "account names" liability-account-names)
|
||||
(gnc:html-document-set-title!
|
||||
;; FIXME: Use magic sprintf code (which one?).
|
||||
;; FIXME: Use magic sprintf code (goonie: which one?).
|
||||
doc (sprintf #f (_ "Balance sheet at %s")
|
||||
(gnc:timepair-to-datestring to-date-tp)))
|
||||
|
||||
@ -262,9 +218,7 @@
|
||||
#f to-date-tp
|
||||
tree-depth show-subaccts?
|
||||
asset-accounts
|
||||
#f #f #f #f
|
||||
;;gnc:accounts-get-comm-total-assets (_ "Assets")
|
||||
#f
|
||||
#f #f #f #f #f
|
||||
show-parent-balance? show-parent-total?
|
||||
show-fcur? report-currency exchange-fn))
|
||||
(liability-table
|
||||
@ -272,9 +226,7 @@
|
||||
#f to-date-tp
|
||||
tree-depth show-subaccts?
|
||||
liability-accounts
|
||||
#f #f #f #f
|
||||
;;gnc:accounts-get-comm-total-assets (_ "Liabilities")
|
||||
#f
|
||||
#f #f #f #f #f
|
||||
show-parent-balance? show-parent-total?
|
||||
show-fcur? report-currency exchange-fn))
|
||||
(equity-table
|
||||
@ -282,9 +234,7 @@
|
||||
#f to-date-tp
|
||||
tree-depth show-subaccts?
|
||||
equity-accounts
|
||||
#f #f #f #f
|
||||
;;gnc:accounts-get-comm-total-assets (_ "Equity")
|
||||
#f
|
||||
#f #f #f #f #f
|
||||
show-parent-balance? show-parent-total?
|
||||
show-fcur? report-currency exchange-fn)))
|
||||
|
||||
@ -311,9 +261,9 @@
|
||||
;; append-something because we have to prepend.
|
||||
(gnc:html-table-prepend-row!
|
||||
asset-table
|
||||
(list (my-table-cell (* (if show-fcur? 3 2)
|
||||
tree-depth)
|
||||
(_ "Assets") #t)))
|
||||
(list (gnc:html-acct-table-cell (* (if show-fcur? 3 2)
|
||||
tree-depth)
|
||||
(_ "Assets") #t)))
|
||||
|
||||
(add-subtotal-line
|
||||
asset-table (_ "Assets") asset-balance)
|
||||
|
@ -11,10 +11,12 @@
|
||||
(let ((pagename-general (N_ "General"))
|
||||
(optname-from-date (N_ "From"))
|
||||
(optname-to-date (N_ "To"))
|
||||
(optname-accounts (N_ "Accounts"))
|
||||
(optname-stepsize (N_ "Step Size"))
|
||||
(optname-report-currency (N_ "Report's currency"))
|
||||
|
||||
(pagename-accounts (N_ "Accounts"))
|
||||
(optname-accounts (N_ "Accounts"))
|
||||
|
||||
(pagename-display (N_ "Display"))
|
||||
(optname-inc-exp (N_ "Show Income/Expense"))
|
||||
(optname-show-profit (N_ "Show Net Profit"))
|
||||
@ -39,7 +41,7 @@
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
pagename-general optname-accounts
|
||||
pagename-accounts optname-accounts
|
||||
"c"
|
||||
(N_ "Report on these accounts, if chosen account level allows.")
|
||||
(lambda ()
|
||||
@ -121,7 +123,7 @@
|
||||
(vector-ref (op-value pagename-general
|
||||
optname-from-date) 1)))
|
||||
(interval (op-value pagename-general optname-stepsize))
|
||||
(accounts (op-value pagename-general optname-accounts))
|
||||
(accounts (op-value pagename-accounts optname-accounts))
|
||||
(report-currency (op-value pagename-general
|
||||
optname-report-currency))
|
||||
|
||||
|
@ -11,10 +11,12 @@
|
||||
(let ((pagename-general (N_ "General"))
|
||||
(optname-from-date (N_ "From"))
|
||||
(optname-to-date (N_ "To"))
|
||||
(optname-accounts (N_ "Accounts"))
|
||||
(optname-stepsize (N_ "Step Size"))
|
||||
(optname-report-currency (N_ "Report's currency"))
|
||||
|
||||
(pagename-accounts (N_ "Accounts"))
|
||||
(optname-accounts (N_ "Accounts"))
|
||||
|
||||
(pagename-display (N_ "Display"))
|
||||
(optname-sep-bars (N_ "Show Asset & Liability bars"))
|
||||
(optname-net-bars (N_ "Show net worth bars"))
|
||||
@ -38,7 +40,7 @@
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
pagename-general optname-accounts
|
||||
pagename-accounts optname-accounts
|
||||
"c"
|
||||
(N_ "Report on these accounts, if chosen account level allows.")
|
||||
(lambda ()
|
||||
@ -127,7 +129,7 @@
|
||||
(vector-ref (op-value pagename-general
|
||||
optname-from-date) 1)))
|
||||
(interval (op-value pagename-general optname-stepsize))
|
||||
(accounts (op-value pagename-general optname-accounts))
|
||||
(accounts (op-value pagename-accounts optname-accounts))
|
||||
(classified-accounts (gnc:decompose-accountlist accounts))
|
||||
(asset-accounts
|
||||
(assoc-ref classified-accounts 'asset))
|
||||
|
@ -40,11 +40,11 @@
|
||||
(optname-show-subaccounts (N_ "Always show sub-accounts"))
|
||||
(optname-accounts (N_ "Account"))
|
||||
|
||||
(pagename-display (N_ "Display"))
|
||||
(optname-group-accounts (N_ "Group the accounts"))
|
||||
(optname-show-parent-balance (N_ "Show balances for parent accounts"))
|
||||
(optname-show-parent-total (N_ "Show subtotals"))
|
||||
|
||||
;; (pagename-currencies (N_ "Currencies")) too little options :)
|
||||
(pagename-currencies pagename-general)
|
||||
(optname-show-foreign (N_ "Show Foreign Currencies"))
|
||||
(optname-report-currency (N_ "Report's currency")))
|
||||
@ -77,19 +77,19 @@
|
||||
|
||||
;; with or without grouping
|
||||
(gnc:options-add-group-accounts!
|
||||
options pagename-accounts optname-group-accounts "b" #t)
|
||||
options pagename-display optname-group-accounts "b" #t)
|
||||
|
||||
;; FIXME: new options here
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-accounts optname-show-parent-balance
|
||||
pagename-display optname-show-parent-balance
|
||||
"c" (N_ "Show balances for parent accounts") #f))
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-accounts optname-show-parent-total
|
||||
pagename-display optname-show-parent-total
|
||||
"d" (N_ "Show subtotals for parent accounts") #t))
|
||||
|
||||
;; Set the general page as default option tab
|
||||
@ -115,11 +115,11 @@
|
||||
optname-show-subaccounts))
|
||||
(accounts (get-option pagename-accounts
|
||||
optname-accounts))
|
||||
(do-grouping? (get-option pagename-accounts
|
||||
(do-grouping? (get-option pagename-display
|
||||
optname-group-accounts))
|
||||
(show-parent-balance? (get-option pagename-accounts
|
||||
(show-parent-balance? (get-option pagename-display
|
||||
optname-show-parent-balance))
|
||||
(show-parent-total? (get-option pagename-accounts
|
||||
(show-parent-total? (get-option pagename-display
|
||||
optname-show-parent-total))
|
||||
(show-fcur? (get-option pagename-currencies
|
||||
optname-show-foreign))
|
||||
|
@ -160,6 +160,21 @@
|
||||
'attribute (list "cellspacing" spacing)
|
||||
'attribute (list "cellpadding" padding))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "text-cell"
|
||||
'tag "td"
|
||||
'attribute (list "align" "left"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-number-cell"
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-label-cell"
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "left"))
|
||||
|
||||
;; don't surround marked-up links with <a> </a>
|
||||
(if (not links?)
|
||||
(gnc:html-document-set-style!
|
||||
|
@ -110,6 +110,11 @@
|
||||
'tag "th"
|
||||
'attribute (list "align" "right"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "text-cell"
|
||||
'tag "td"
|
||||
'attribute (list "align" "left"))
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-number-cell"
|
||||
'tag '("td" "b")
|
||||
@ -117,8 +122,9 @@
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
ssdoc "total-label-cell"
|
||||
'tag '("td" "b"))
|
||||
|
||||
'tag '("td" "b")
|
||||
'attribute (list "align" "left"))
|
||||
|
||||
;; don't surround marked-up links with <a> </a>
|
||||
(if (not links?)
|
||||
(gnc:html-document-set-style!
|
||||
|
Loading…
Reference in New Issue
Block a user