mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[c++options] Convert remaining reports and tests to new API.
This commit is contained in:
parent
cec27308d8
commit
40c55899bc
@ -82,7 +82,7 @@
|
||||
(define-public (gnc:color-option->hex-string opt)
|
||||
(format #f "~a" (GncOption-get-value opt)))
|
||||
|
||||
(define-public (gnc:option-get-value book category key)
|
||||
(define-public (gnc:book-get-option-value book category key)
|
||||
(define acc (if (pair? key) cons list))
|
||||
(qof-book-get-option book (acc category key)))
|
||||
|
||||
@ -408,11 +408,11 @@
|
||||
|
||||
(define (gnc:company-info book key)
|
||||
;; Access company info from key-value pairs for current book
|
||||
(gnc:option-get-value book gnc:*business-label* key))
|
||||
(gnc:book-get-option-value book gnc:*business-label* key))
|
||||
|
||||
(define (gnc:fancy-date-info book key)
|
||||
;; Access fancy date info from key-value pairs for current book
|
||||
(gnc:option-get-value book gnc:*business-label* (list gnc:*fancy-date-label* key)))
|
||||
(gnc:book-get-option-value book gnc:*business-label* (list gnc:*fancy-date-label* key)))
|
||||
|
||||
|
||||
|
||||
|
@ -52,91 +52,78 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define (options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
;; register a configuration option for the report
|
||||
(register-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
;; General tab
|
||||
(gnc:options-add-date-interval!
|
||||
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)
|
||||
|
||||
;; Report's currency
|
||||
(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)
|
||||
|
||||
;; Account tab
|
||||
(register-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-subacct
|
||||
"a" (N_ "Include sub-accounts of all selected accounts.") #t))
|
||||
"a" (N_ "Include sub-accounts of all selected accounts.") #t)
|
||||
|
||||
(register-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-internal
|
||||
"b"
|
||||
(N_ "Exclude transactions that only involve two accounts, both of which are selected below. This only affects the profit and loss columns of the table.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
;; account(s) to do report on
|
||||
(register-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts (N_ "Accounts")
|
||||
"c" (N_ "Do transaction report on this account.")
|
||||
(lambda ()
|
||||
;; FIXME : gnc:get-current-accounts disappeared
|
||||
(let ((current-accounts '()))
|
||||
;; If some accounts were selected, use those
|
||||
(cond ((not (null? current-accounts))
|
||||
current-accounts)
|
||||
(else
|
||||
;; otherwise get some accounts -- here as an
|
||||
;; example we get the asset and liability stuff
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
|
||||
ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE)
|
||||
;; or: (list ACCT-TYPE-BANK ACCT-TYPE-CASH
|
||||
;; ACCT-TYPE-CHECKING ACCT-TYPE-SAVINGS ACCT-TYPE-STOCK
|
||||
;; ACCT-TYPE-MUTUAL ACCT-TYPE-MONEYMRKT)
|
||||
(gnc-account-get-children-sorted (gnc-get-current-root-account)))))))
|
||||
#f #t))
|
||||
(let ((current-accounts '()))
|
||||
;; If some accounts were selected, use those
|
||||
(cond ((not (null? current-accounts))
|
||||
current-accounts)
|
||||
(else
|
||||
;; otherwise get some accounts -- here as an
|
||||
;; example we get the asset and liability stuff
|
||||
(gnc-account-list-from-types (gnc-get-current-book)
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
|
||||
ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE)
|
||||
;; or: (list ACCT-TYPE-BANK ACCT-TYPE-CASH
|
||||
;; ACCT-TYPE-CHECKING ACCT-TYPE-SAVINGS ACCT-TYPE-STOCK
|
||||
;; ACCT-TYPE-MUTUAL ACCT-TYPE-MONEYMRKT)
|
||||
)))))
|
||||
|
||||
;; Display tab
|
||||
(register-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Show table")
|
||||
"a" (N_ "Display a table of the selected data.") #f))
|
||||
"a" (N_ "Display a table of the selected data.") #f)
|
||||
|
||||
(register-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Show plot")
|
||||
"b" (N_ "Display a graph of the selected data.") #t))
|
||||
"b" (N_ "Display a graph of the selected data.") #t)
|
||||
|
||||
(register-option
|
||||
(gnc:make-list-option
|
||||
(gnc-register-list-option options
|
||||
gnc:pagename-display (N_ "Plot Type")
|
||||
"c" (N_ "The type of graph to generate.") (list 'AvgBalPlot)
|
||||
"c" (N_ "The type of graph to generate.") "AvgBalPlot"
|
||||
(list
|
||||
(vector 'AvgBalPlot (N_ "Average"))
|
||||
(vector 'GainPlot (N_ "Profit"))
|
||||
(vector 'GLPlot (N_ "Gain/Loss")))))
|
||||
(vector 'GLPlot (N_ "Gain/Loss"))))
|
||||
|
||||
(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" (cons 'percent 100.0) (cons 'percent 100.0))
|
||||
|
||||
;; Set the general page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
|
||||
(GncOptionDBPtr-set-default-section options gnc:pagename-general)
|
||||
|
||||
options))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -273,8 +260,7 @@
|
||||
(define (renderer report-obj)
|
||||
|
||||
(define (get-option section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
(let* ((report-title (get-option gnc:pagename-general
|
||||
|
@ -66,47 +66,35 @@
|
||||
;; is the list of account types that the account selection option
|
||||
;; accepts.
|
||||
(define (options-generator account-types)
|
||||
(let* ((options (gnc:new-options))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general
|
||||
optname-from-date optname-to-date "a")
|
||||
|
||||
(gnc:options-add-currency!
|
||||
(gnc:options-add-currency!
|
||||
options gnc:pagename-general optname-report-currency "b")
|
||||
|
||||
(gnc:options-add-price-source!
|
||||
|
||||
(gnc:options-add-price-source!
|
||||
options gnc:pagename-general
|
||||
optname-price-source "c" 'weighted-average)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-subacct
|
||||
"a" (N_ "Include sub-accounts of all selected accounts.") #t))
|
||||
"a" (N_ "Include sub-accounts of all selected accounts.") #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-limited-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
(N_ "Report on these accounts, if chosen account level allows.")
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
account-types
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
(lambda (accounts)
|
||||
(list #t
|
||||
(gnc:filter-accountlist-type
|
||||
account-types
|
||||
accounts)))
|
||||
#t))
|
||||
(gnc:filter-accountlist-type
|
||||
account-types
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
|
||||
account-types)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-total
|
||||
"b" (N_ "Show the total balance in legend?") #t))
|
||||
"b" (N_ "Show the total balance in legend?") #t)
|
||||
|
||||
(gnc:options-add-plot-size!
|
||||
options gnc:pagename-display
|
||||
@ -126,9 +114,8 @@
|
||||
account-types)
|
||||
;; This is a helper function for looking up option values.
|
||||
(define (get-option section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) section name))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -37,14 +37,10 @@
|
||||
;; This function will generate a set of options that GnuCash
|
||||
;; will use to display a dialog where the user can select
|
||||
;; values for your report's parameters.
|
||||
(define (options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
;; This is just a helper function for making options.
|
||||
;; See libgnucash/app-utils/options.scm for details.
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
|
||||
(define (options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(optiondb (options #t))) ;; Hack to get the optiondb from options
|
||||
|
||||
;; This is a boolean option. It is in Section 'Hello, World!'
|
||||
;; and is named 'Boolean Option'. Its sorting key is 'a',
|
||||
;; thus it will come before options with sorting keys
|
||||
@ -52,155 +48,123 @@
|
||||
;; is #t (true). The phrase 'This is a boolean option'
|
||||
;; will be displayed as help text when the user puts
|
||||
;; the mouse pointer over the option.
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(N_ "Hello, World!") (N_ "Boolean Option")
|
||||
"a" (N_ "This is a boolean option.") #t))
|
||||
|
||||
;; This is a multichoice option. The user can choose between
|
||||
;; the values 'first, 'second, 'third, or 'fourth. These are guile
|
||||
;; symbols. The value 'first will be displayed as "First Option"
|
||||
;; and have a help string of "Help for first option.". The default
|
||||
;; value is 'third.
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-simple-boolean-option optiondb
|
||||
(N_ "Hello, World!") (N_ "Boolean Option")
|
||||
"a" (N_ "This is a boolean option.") #t)
|
||||
|
||||
;; This is a multichoice option. The user can choose between the
|
||||
;; values 'first, 'second, 'third, or 'fourth. These are guile
|
||||
;; symbols. The value 'first will be displayed as "First Option".
|
||||
;; The default value is 'third. Note that multichoice option is a
|
||||
;; special case where we need an intermediate scheme function to
|
||||
;; interpret the default value--'third in this case--because it
|
||||
;; can be either a symbol or a number.
|
||||
(gnc-register-multichoice-option optiondb
|
||||
(N_ "Hello, World!") (N_ "Multi Choice Option")
|
||||
"b" (N_ "This is a multi choice option.") 'third
|
||||
"b" (N_ "This is a multi choice option.") "third"
|
||||
(list (vector 'first (N_ "First Option"))
|
||||
(vector 'second (N_ "Second Option"))
|
||||
(vector 'third (N_ "Third Option"))
|
||||
(vector 'fourth (N_ "Fourth Options")))))
|
||||
|
||||
(vector 'fourth (N_ "Fourth Options"))))
|
||||
|
||||
;; This is a string option. Users can type anything they want
|
||||
;; as a value. The default value is "Hello, World". This is
|
||||
;; in the same section as the option above. It will be shown
|
||||
;; after the option above because its key is 'b' while the
|
||||
;; other key is 'a'.
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option optiondb
|
||||
(N_ "Hello, World!") (N_ "String Option")
|
||||
"c" (N_ "This is a string option.") (N_ "Hello, World")))
|
||||
|
||||
;; This is a date/time option. The user can pick a date and,
|
||||
;; possibly, a time. Times are stored as an integer specifying
|
||||
;; number of seconds measured from Jan 1, 1970, i.e.,
|
||||
;; Unix time. The last option is false, so the user can only
|
||||
;; select a date, not a time. The default value is the current
|
||||
;; time.
|
||||
(add-option
|
||||
(gnc:make-date-option
|
||||
"c" (N_ "This is a string option.") (N_ "Hello, World"))
|
||||
|
||||
;; The following are date options. There are three here reflecting
|
||||
;; the trhee types of date controls that can be displayed in the
|
||||
;; options dialog: Absolute, Relative, or Both. You'll usually
|
||||
;; want to use Both, which is the middle example. Other than the
|
||||
;; usual strings the two paramters are a list of relative date
|
||||
;; types and a boolean to indicate whether you want a Both date
|
||||
;; control. Note that to get an absolute control you pass a
|
||||
;; one-item list containing 'absolute and #f. If you pass (list
|
||||
;; 'absolute) #t you'll get a Both but the relative listbox will
|
||||
;; be empty. That will irritate users so avoid doing that.
|
||||
(gnc-register-date-option-set optiondb
|
||||
(N_ "Hello, World!") (N_ "Just a Date Option")
|
||||
"d" (N_ "This is a date option.")
|
||||
(lambda () (cons 'absolute (current-time)))
|
||||
#f 'absolute #f ))
|
||||
|
||||
(add-option
|
||||
(gnc:make-date-option
|
||||
(list 'absolute) #f )
|
||||
|
||||
(gnc-register-date-option-set optiondb
|
||||
(N_ "Hello, World!") (N_ "Combo Date Option")
|
||||
"y" (N_ "This is a combination date option.")
|
||||
(lambda () (cons 'relative 'start-cal-year))
|
||||
#f 'both '(start-cal-year start-prev-year end-prev-year) ))
|
||||
|
||||
(add-option
|
||||
(gnc:make-date-option
|
||||
'(start-cal-year start-prev-year end-prev-year) #t)
|
||||
|
||||
(gnc-register-date-option-set optiondb
|
||||
(N_ "Hello, World!") (N_ "Relative Date Option")
|
||||
"x" (N_ "This is a relative date option.")
|
||||
(lambda () (cons 'relative 'start-cal-year))
|
||||
#f 'relative '(start-cal-year start-prev-year end-prev-year) ))
|
||||
|
||||
'(start-cal-year start-prev-year end-prev-year) #f)
|
||||
|
||||
;; This is a number range option. The user can enter a number
|
||||
;; between a lower and upper bound given below. There are also
|
||||
;; arrows the user can click to go up or down, the amount changed
|
||||
;; by a single click is given by the step size.
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
;; arrows or + and - buttons depending on the icon theme that the
|
||||
;; user can click to go up or down, the amount changed by a single
|
||||
;; click is given by the step size.
|
||||
(gnc-register-number-range-option optiondb
|
||||
(N_ "Hello, World!") (N_ "Number Option")
|
||||
"ee" (N_ "This is a number option.")
|
||||
1500.0 ;; default
|
||||
0.0 ;; lower bound
|
||||
10000.0 ;; upper bound
|
||||
2.0 ;; number of decimals
|
||||
0.01 ;; step size
|
||||
))
|
||||
|
||||
;; This is a color option, defined by rgba values. A color value
|
||||
;; is a list where the elements are the red, green, blue, and
|
||||
;; alpha channel values respectively. The penultimate argument
|
||||
;; (255) is the allowed range of rgba values. The final argument
|
||||
;; (#f) indicates the alpha value should be ignored. You can get
|
||||
;; a color string from a color option with gnc:color-option->html,
|
||||
;; which will scale the values appropriately according the range.
|
||||
(add-option
|
||||
(gnc:make-color-option
|
||||
)
|
||||
|
||||
;; This is a color option, defined by rgb values. A color value is
|
||||
;; a string representing a 3-byte hex number with the bytes
|
||||
;; representing red, blue, and green values.
|
||||
(gnc-register-color-option optiondb
|
||||
(N_ "Hello, World!") (N_ "Background Color")
|
||||
"f" (N_ "This is a color option.")
|
||||
(list #xf6 #xff #xdb #xff)
|
||||
255
|
||||
#f))
|
||||
|
||||
;; This is an account list option. The user can select one
|
||||
;; or (possibly) more accounts from the list of accounts
|
||||
;; in the current file. Values are scheme handles to actual
|
||||
;; C pointers to accounts.
|
||||
;; The #f value indicates that any account will be accepted.
|
||||
;; Instead of a #f values, you could provide a function that
|
||||
;; accepts a list of account values and returns a pair. If
|
||||
;; the first element is #t, the second element is the list
|
||||
;; of accounts actually accepted. If the first element is
|
||||
;; #f, the accounts are rejected and the second element is
|
||||
;; and error string. The last argument is #t which means
|
||||
;; the user is allowed to select more than one account.
|
||||
;; The default value for this option is the currently
|
||||
;; selected account in the main window, if any.
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
"f6ffdb")
|
||||
|
||||
;; This is an account list option. The user can select one or more
|
||||
;; accounts from the list of accounts in the current file. Values
|
||||
;; are GUIDs of the selected accounts. Since those depend on the
|
||||
;; book in use you'll probably want to create a list from the
|
||||
;; account types as we've done here. There's another function
|
||||
;; gnc-register-account-list-limited-option which takes as a
|
||||
;; second argument a list of account types; only accounts of the
|
||||
;; types in the list, similar to the list passed to
|
||||
;; gnc-account-list-from-types in this example, will be available
|
||||
;; for selection.
|
||||
|
||||
(gnc-register-account-list-option optiondb
|
||||
(N_ "Hello Again") (N_ "An account list option")
|
||||
"g" (N_ "This is an account list option.")
|
||||
;; FIXME : this used to be gnc:get-current-accounts, but
|
||||
;; that doesn't exist any more.
|
||||
(lambda () '())
|
||||
#f #t))
|
||||
|
||||
(gnc-account-list-from-types
|
||||
(gnc-get-current-book)
|
||||
(list ACCT-TYPE-ASSET ACCT-TYPE-EQUITY ACCT-TYPE-LIABILITY)))
|
||||
|
||||
;; This is a list option. The user can select one or (possibly)
|
||||
;; more values from a list. The list of acceptable values is
|
||||
;; the same format as a multichoice option. The value of the
|
||||
;; option is a list of symbols.
|
||||
(add-option
|
||||
(gnc:make-list-option
|
||||
(gnc-register-list-option optiondb
|
||||
(N_ "Hello Again") (N_ "A list option")
|
||||
"h" (N_ "This is a list option.")
|
||||
'(good)
|
||||
(symbol->string 'good)
|
||||
(list (vector 'good (N_ "The Good"))
|
||||
(vector 'bad (N_ "The Bad"))
|
||||
(vector 'ugly (N_ "The Ugly")))))
|
||||
|
||||
(vector 'ugly (N_ "The Ugly"))))
|
||||
|
||||
;; This option is for testing. When true, the report generates
|
||||
;; an exception.
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option optiondb
|
||||
(N_ "Testing") (N_ "Crash the report")
|
||||
"a"
|
||||
"a"
|
||||
(N_ "This is for testing. \
|
||||
Your reports probably shouldn't have an \
|
||||
option like this.")
|
||||
#f))
|
||||
option like this.")
|
||||
#f)
|
||||
|
||||
;; This is a Radio Button option. The user can only select one
|
||||
;; value from the list of buttons.
|
||||
(add-option
|
||||
(gnc:make-radiobutton-option
|
||||
(N_ "Hello Again") "A Radio Button option" "z" (N_ "This is a Radio Button option.") 'good
|
||||
(list (vector 'good
|
||||
(N_ "The Good")
|
||||
(N_ "Good option."))
|
||||
(vector 'bad
|
||||
(N_ "The Bad")
|
||||
(N_ "Bad option."))
|
||||
(vector 'ugly
|
||||
(N_ "The Ugly")
|
||||
(N_ "Ugly option.")))))
|
||||
|
||||
(gnc:options-set-default-section options "Hello, World!")
|
||||
(GncOptionDBPtr-set-default-section optiondb "Hello, World!")
|
||||
;; We still need to return the function wrapper instead of the GncOptionDBPtr bfor all of the options functions in the reports system.
|
||||
options))
|
||||
|
||||
;; This is the rendering function. It accepts a database of options
|
||||
@ -210,12 +174,10 @@ option like this.")
|
||||
;; to the function is one created by the options-generator function
|
||||
;; defined above.
|
||||
(define (hello-world-renderer report-obj)
|
||||
;; These are some helper functions for looking up option values.
|
||||
(define (get-op section name)
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name))
|
||||
|
||||
;; Helper function for looking up option values.
|
||||
(define (op-value section name)
|
||||
(gnc:option-value (get-op section name)))
|
||||
(gnc-optiondb-lookup-value ((gnc:report-options report-obj) 'lookup)
|
||||
section name))
|
||||
|
||||
;; The first thing we do is make local variables for all the specific
|
||||
;; options in the set of options given to the function. This set will
|
||||
@ -230,7 +192,7 @@ option like this.")
|
||||
(combo-date-val (gnc:date-option-absolute-time
|
||||
(op-value "Hello, World!" "Combo Date Option")))
|
||||
(num-val (op-value "Hello, World!" "Number Option"))
|
||||
(bg-color-op (get-op "Hello, World!" "Background Color"))
|
||||
(bg-color (op-value "Hello, World!" "Background Color"))
|
||||
(accounts (op-value "Hello Again" "An account list option"))
|
||||
(list-val (op-value "Hello Again" "A list option"))
|
||||
(radio-val (op-value "Hello Again" "A Radio Button option"))
|
||||
@ -287,7 +249,7 @@ option like this.")
|
||||
|
||||
(gnc:html-document-set-style!
|
||||
document "body"
|
||||
'attribute (list "bgcolor" (gnc:color-option->html bg-color-op)))
|
||||
'attribute (list "bgcolor" (format #f "#~a" bg-color)))
|
||||
|
||||
;; the title of the report will be rendered by the
|
||||
;; selected style sheet. All we have to do is set it in the
|
||||
|
@ -117,7 +117,7 @@
|
||||
chart))
|
||||
|
||||
(define (options-generator)
|
||||
(gnc:new-options))
|
||||
(gnc-new-optiondb))
|
||||
|
||||
;; This is the rendering function. It accepts a database of options
|
||||
;; and generates an object of type <html-document>. See the file
|
||||
@ -126,13 +126,6 @@
|
||||
;; to the function is one created by the options-generator function
|
||||
;; defined above.
|
||||
(define (test-graphing-renderer report-obj)
|
||||
;; These are some helper functions for looking up option values.
|
||||
(define options (gnc:report-options report-obj))
|
||||
(define (get-op section name)
|
||||
(gnc:lookup-option options section name))
|
||||
(define (op-value section name)
|
||||
(gnc:option-value (get-op section name)))
|
||||
|
||||
(let ((document (gnc:make-html-document)))
|
||||
|
||||
(gnc:html-document-set-title! document (G_ reportname))
|
||||
|
@ -30,7 +30,7 @@
|
||||
(use-modules (gnucash report))
|
||||
|
||||
(define (options)
|
||||
(gnc:new-options))
|
||||
(gnc-new-optiondb))
|
||||
|
||||
(define (renderer report-obj)
|
||||
(let ((doc (gnc:make-html-document)))
|
||||
|
@ -137,20 +137,17 @@
|
||||
(define tax-qtr-real-qtr-year 0)
|
||||
|
||||
(define (tax-options-generator)
|
||||
(define options (gnc:new-options))
|
||||
(define (gnc:register-tax-option new-option)
|
||||
(gnc:register-option options new-option))
|
||||
(define options (gnc-new-optiondb))
|
||||
|
||||
;; date at which to report
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general
|
||||
(N_ "From") (N_ "To") "a")
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general (N_ "Alternate Period")
|
||||
"c" (N_ "Override or modify From: & To:.")
|
||||
(if after-tax-day 'from-to 'last-year)
|
||||
(if after-tax-day "from-to" "last-year")
|
||||
(list (vector 'from-to (N_ "Use From - To"))
|
||||
(vector '1st-est (N_ "1st Est Tax Quarter (Jan 1 - Mar 31)"))
|
||||
(vector '2nd-est (N_ "2nd Est Tax Quarter (Apr 1 - May 31)"))
|
||||
@ -160,24 +157,20 @@
|
||||
(vector '1st-last (N_ "Last Yr 1st Est Tax Qtr (Jan 1 - Mar 31)"))
|
||||
(vector '2nd-last (N_ "Last Yr 2nd Est Tax Qtr (Apr 1 - May 31)"))
|
||||
(vector '3rd-last (N_ "Last Yr 3rd Est Tax Qtr (Jun 1 - Aug 31)"))
|
||||
(vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)")))))
|
||||
(vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)"))))
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts (N_ "Select Accounts (none = all)")
|
||||
"d" (N_ "Select accounts.")
|
||||
(lambda () '())
|
||||
#f #t))
|
||||
'())
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Suppress $0.00 values")
|
||||
"f" (N_ "$0.00 valued Accounts won't be printed.") #t))
|
||||
"f" (N_ "$0.00 valued Accounts won't be printed.") #t)
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Print Full account names")
|
||||
"g" (N_ "Print all Parent account names.") #f))
|
||||
"g" (N_ "Print all Parent account names.") #f)
|
||||
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
|
||||
@ -451,9 +444,8 @@
|
||||
tax-mode?)
|
||||
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
;; the number of account generations: children, grandchildren etc.
|
||||
(define (num-generations account gen)
|
||||
@ -748,7 +740,7 @@
|
||||
(to-year (gnc-print-time64 to-value "%Y"))
|
||||
(today-date (gnc-print-time64 (time64CanonicalDayTime (current-time))
|
||||
"%d.%m.%Y"))
|
||||
(tax-nr (gnc:option-get-value book gnc:*tax-label* gnc:*tax-nr-label*)))
|
||||
(tax-nr (gnc:book-get-option-value book gnc:*tax-label* gnc:*tax-nr-label*)))
|
||||
|
||||
;; Now, the main body
|
||||
;; Reset all the balance collectors
|
||||
|
@ -167,20 +167,17 @@
|
||||
(define tax-qtr-real-qtr-year 10000)
|
||||
|
||||
(define (tax-options-generator)
|
||||
(define options (gnc:new-options))
|
||||
(define (gnc:register-tax-option new-option)
|
||||
(gnc:register-option options new-option))
|
||||
(define options (gnc-new-optiondb))
|
||||
|
||||
;; date at which to report
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general
|
||||
(N_ "From") (N_ "To") "a")
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general (N_ "Alternate Period")
|
||||
"c" (N_ "Override or modify From: & To:.")
|
||||
(if after-tax-day 'from-to 'last-year)
|
||||
(if after-tax-day "from-to" "last-year")
|
||||
(list (vector 'from-to (N_ "Use From - To"))
|
||||
(vector '1st-est (N_ "1st Est Tax Quarter (Jan 1 - Mar 31)"))
|
||||
(vector '2nd-est (N_ "2nd Est Tax Quarter (Apr 1 - May 31)"))
|
||||
@ -196,65 +193,53 @@
|
||||
;; actual year's quarters! See the definition of
|
||||
;; tax-qtr-real-qtr-year variable above.
|
||||
(vector '3rd-last (N_ "Last Yr 3rd Est Tax Qtr (Jun 1 - Aug 31)"))
|
||||
(vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)")))))
|
||||
(vector '4th-last (N_ "Last Yr 4th Est Tax Qtr (Sep 1 - Dec 31)"))))
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts (N_ "Select Accounts (none = all)")
|
||||
"d" (N_ "Select accounts.")
|
||||
(lambda () '())
|
||||
#f #t))
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
'())
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Suppress $0.00 values")
|
||||
"f" (N_ "$0.00 valued Tax codes won't be printed.") #f))
|
||||
"f" (N_ "$0.00 valued Tax codes won't be printed.") #f)
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Do not print full account names")
|
||||
"g" (N_ "Do not print all Parent account names.") #f))
|
||||
"g" (N_ "Do not print all Parent account names.") #f)
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Print all Transfer To/From Accounts")
|
||||
"h" (N_ "Print all split details for multi-split transactions.") #f))
|
||||
"h" (N_ "Print all split details for multi-split transactions.") #f)
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Print TXF export parameters")
|
||||
"i" (N_ "Show TXF export parameters for each TXF code/account on report.") #f))
|
||||
"i" (N_ "Show TXF export parameters for each TXF code/account on report.") #f)
|
||||
|
||||
(if (qof-book-use-split-action-for-num-field (gnc-get-current-book))
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Do not print T-Num:Memo data")
|
||||
"j" (N_ "Do not print T-Num:Memo data for transactions.") #f))
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"j" (N_ "Do not print T-Num:Memo data for transactions.") #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Do not print Action:Memo data")
|
||||
"j" (N_ "Do not print Action:Memo data for transactions.") #f)))
|
||||
"j" (N_ "Do not print Action:Memo data for transactions.") #f))
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Do not print transaction detail")
|
||||
"k" (N_ "Do not print transaction detail for accounts.") #f))
|
||||
"k" (N_ "Do not print transaction detail for accounts.") #f)
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (N_ "Do not use special date processing")
|
||||
"l" (N_ "Do not print transactions out of specified dates.") #f))
|
||||
"l" (N_ "Do not print transactions out of specified dates.") #f)
|
||||
|
||||
(gnc:register-tax-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-display (N_ "Currency conversion date")
|
||||
"m" (N_ "Select date to use for PriceDB lookups.")
|
||||
'conv-to-tran-date
|
||||
"conv-to-tran-date"
|
||||
(list (list->vector
|
||||
(list 'conv-to-tran-date (N_ "Nearest to transaction date")))
|
||||
(list->vector
|
||||
(list 'conv-to-report-date (N_ "Nearest to report date")))
|
||||
)))
|
||||
))
|
||||
|
||||
#t
|
||||
|
||||
@ -1658,9 +1643,8 @@
|
||||
tax-mode?)
|
||||
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(define tax-entity-type (gnc-get-current-book-tax-type))
|
||||
|
||||
|
@ -85,10 +85,7 @@ balance at a given time"))
|
||||
;; is the list of account types that the account selection option
|
||||
;; accepts.
|
||||
(define (options-generator account-types do-intervals? depth-based?)
|
||||
(let* ((options (gnc:new-options))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
(if do-intervals?
|
||||
(gnc:options-add-date-interval!
|
||||
@ -98,39 +95,31 @@ balance at a given time"))
|
||||
options gnc:pagename-general
|
||||
optname-to-date "a"))
|
||||
|
||||
(gnc:options-add-currency!
|
||||
(gnc:options-add-currency!
|
||||
options gnc:pagename-general optname-report-currency "b")
|
||||
|
||||
(gnc:options-add-price-source!
|
||||
|
||||
(gnc:options-add-price-source!
|
||||
options gnc:pagename-general
|
||||
optname-price-source "c" 'pricedb-nearest)
|
||||
|
||||
(if do-intervals?
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-averaging
|
||||
"f" opthelp-averaging
|
||||
'None
|
||||
"None"
|
||||
(list (vector 'None (N_ "No Averaging"))
|
||||
(vector 'YearDelta (N_ "Yearly"))
|
||||
(vector 'MonthDelta (N_ "Monthly"))
|
||||
(vector 'WeekDelta (N_ "Weekly"))))))
|
||||
(vector 'WeekDelta (N_ "Weekly")))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-limited-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
(N_ "Report on these accounts, if chosen account level allows.")
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
account-types
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
(lambda (accounts)
|
||||
(list #t
|
||||
(gnc:filter-accountlist-type
|
||||
account-types
|
||||
accounts)))
|
||||
#t))
|
||||
(gnc:filter-accountlist-type
|
||||
account-types
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
|
||||
account-types)
|
||||
|
||||
(if depth-based?
|
||||
(gnc:options-add-account-levels!
|
||||
@ -138,38 +127,34 @@ balance at a given time"))
|
||||
(N_ "Maximum number of levels in the account tree displayed.")
|
||||
2))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-fullname
|
||||
"a"
|
||||
(if depth-based?
|
||||
(N_ "Show the full account name in legend?")
|
||||
(N_ "Show the full security name in the legend?"))
|
||||
#f))
|
||||
#f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-total
|
||||
"b" (N_ "Show the total balance in legend?") #t))
|
||||
"b" (N_ "Show the total balance in legend?") #t)
|
||||
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-percent
|
||||
"b" (N_ "Show the percentage in legend?") #t))
|
||||
"b" (N_ "Show the percentage in legend?") #t)
|
||||
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-display optname-slices
|
||||
"c" (N_ "Maximum number of slices in pie.") 7
|
||||
2 24 0 1))
|
||||
2 24 1)
|
||||
|
||||
(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" (cons 'percent 100.0) (cons 'percent 100.0))
|
||||
|
||||
(gnc:options-add-sort-method!
|
||||
(gnc:options-add-sort-method!
|
||||
options gnc:pagename-display
|
||||
optname-sort-method "e" 'amount)
|
||||
|
||||
@ -307,10 +292,9 @@ balance at a given time"))
|
||||
|
||||
;; This is a helper function for looking up option values.
|
||||
(define (get-option section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) section name)))
|
||||
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) section name))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
;; Get all options
|
||||
@ -478,9 +462,8 @@ balance at a given time"))
|
||||
(gnc:options-copy-values (gnc:report-options report-obj)
|
||||
options)
|
||||
;; and set the destination accounts
|
||||
(gnc:option-set-value
|
||||
(gnc:lookup-option options gnc:pagename-accounts
|
||||
optname-accounts)
|
||||
(gnc-option-set-value
|
||||
options gnc:pagename-accounts optname-accounts
|
||||
(map cadr finish))
|
||||
(set! id (gnc:make-report report-guid options))
|
||||
;; set the URL.
|
||||
|
@ -142,13 +142,12 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define (accsum-options-generator sx? reportname)
|
||||
(let* ((options (gnc:new-options))
|
||||
(odb (gnc:optiondb options)))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
(gnc-register-string-option odb
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname))
|
||||
(gnc-register-string-option odb
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-party-name
|
||||
"b" opthelp-party-name "")
|
||||
;; this should default to company name in (gnc-get-current-book)
|
||||
@ -163,7 +162,7 @@
|
||||
options gnc:pagename-general optname-date "c"))
|
||||
|
||||
;; accounts to work on
|
||||
(gnc-register-account-list-option odb
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
@ -179,7 +178,7 @@
|
||||
options gnc:pagename-accounts optname-depth-limit
|
||||
"b" opthelp-depth-limit 3)
|
||||
|
||||
(gnc-register-multichoice-option odb
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-accounts optname-bottom-behavior
|
||||
"c" opthelp-bottom-behavior "summarize"
|
||||
(list
|
||||
@ -196,19 +195,19 @@
|
||||
options pagename-commodities
|
||||
optname-price-source "b" 'pricedb-nearest)
|
||||
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #t)
|
||||
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"d" opthelp-show-rates #f)
|
||||
|
||||
;; what to show for zero-balance accounts
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zb-accts
|
||||
"a" opthelp-show-zb-accts #t)
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-omit-zb-bals
|
||||
"b" opthelp-omit-zb-bals #f)
|
||||
;; what to show for non-leaf accounts
|
||||
@ -218,26 +217,26 @@
|
||||
"c")
|
||||
|
||||
;; some detailed formatting options
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-links
|
||||
"e" opthelp-account-links #t)
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-use-rules
|
||||
"f" opthelp-use-rules #f)
|
||||
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-bals
|
||||
"g" opthelp-show-bals #t)
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-code
|
||||
"h" opthelp-show-code #t)
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-desc
|
||||
"i" opthelp-show-desc #f)
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-type
|
||||
"j" opthelp-show-type #f)
|
||||
(gnc-register-simple-boolean-option odb
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-notes
|
||||
"k" opthelp-show-notes #f)
|
||||
|
||||
@ -252,9 +251,8 @@
|
||||
|
||||
(define (accsum-renderer report-obj sx? reportname)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -59,12 +59,7 @@ by preventing negative stock balances.<br/>")
|
||||
(define units-denom 100000000)
|
||||
|
||||
(define (options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
;; This is just a helper function for making options.
|
||||
;; See libgnucash/scm/options.scm for details.
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
;; General Tab
|
||||
;; date at which to report balance
|
||||
@ -75,88 +70,71 @@ by preventing negative stock balances.<br/>")
|
||||
(gnc:options-add-currency!
|
||||
options gnc:pagename-general (N_ "Report's currency") "c")
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-price-source
|
||||
"d" (N_ "The source of price information.") 'pricedb-nearest
|
||||
"d" (N_ "The source of price information.") "pricedb-nearest"
|
||||
(list (vector 'pricedb-latest (N_ "Most recent"))
|
||||
(vector 'pricedb-nearest (N_ "Nearest to report date")))))
|
||||
(vector 'pricedb-nearest (N_ "Nearest to report date"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-basis-method
|
||||
"e" (N_ "Basis calculation method.") 'average-basis
|
||||
"e" (N_ "Basis calculation method.") "average-basis"
|
||||
(list (vector 'average-basis (N_ "Average cost of all shares"))
|
||||
(vector 'fifo-basis (N_ "First-in first-out"))
|
||||
(vector 'filo-basis (N_ "Last-in first-out")))))
|
||||
(vector 'filo-basis (N_ "Last-in first-out"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-prefer-pricelist "f"
|
||||
(N_ "Prefer use of price editor pricing over transactions, where applicable.")
|
||||
#t))
|
||||
#t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-brokerage-fees
|
||||
"g" (N_ "How to report commissions and other brokerage fees.") 'include-in-basis
|
||||
"g" (N_ "How to report commissions and other brokerage fees.")
|
||||
"include-in-basis"
|
||||
(list (vector 'include-in-basis (N_ "Include in basis"))
|
||||
(vector 'include-in-gain (N_ "Include in gain/loss"))
|
||||
(vector 'ignore-brokerage (N_ "Omit from report")))))
|
||||
(vector 'ignore-brokerage (N_ "Omit from report"))))
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-symbol "a"
|
||||
(N_ "Display the ticker symbols.")
|
||||
#t))
|
||||
#t)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-listing "b"
|
||||
(N_ "Display exchange listings.")
|
||||
#t))
|
||||
#t)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-shares "c"
|
||||
(N_ "Display numbers of shares in accounts.")
|
||||
#t))
|
||||
#t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-display optname-shares-digits
|
||||
"d" (N_ "The number of decimal places to use for share numbers.") 2
|
||||
0 9 0 1))
|
||||
0 9 1)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-price "e"
|
||||
(N_ "Display share prices.")
|
||||
#t))
|
||||
#t)
|
||||
|
||||
;; Account tab
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-limited-option options
|
||||
gnc:pagename-accounts (N_ "Accounts")
|
||||
"b"
|
||||
(N_ "Stock Accounts to report on.")
|
||||
(lambda () (filter gnc:account-is-stock?
|
||||
(gnc-account-get-descendants-sorted
|
||||
(gnc-get-current-root-account))))
|
||||
(lambda (accounts) (list #t
|
||||
(filter gnc:account-is-stock? accounts)))
|
||||
#t))
|
||||
(filter gnc:account-is-stock?
|
||||
(gnc-account-get-descendants-sorted
|
||||
(gnc-get-current-root-account)))
|
||||
(list ACCT-TYPE-STOCK))
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-zero-shares "e"
|
||||
(N_ "Include accounts that have a zero share balances.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
options))
|
||||
@ -176,11 +154,8 @@ by preventing negative stock balances.<br/>")
|
||||
(warn-price-dirty #f))
|
||||
|
||||
;; These are some helper functions for looking up option values.
|
||||
(define (get-op section name)
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name))
|
||||
|
||||
(define (get-option section name)
|
||||
(gnc:option-value (get-op section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(define (split-account-type? split type)
|
||||
(eq? type (xaccAccountGetType (xaccSplitGetAccount split))))
|
||||
|
@ -70,17 +70,14 @@ date point, a projected minimum balance including scheduled transactions."))
|
||||
|
||||
; Options generator
|
||||
(define (options-generator)
|
||||
(let* ((options (gnc:new-options)))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
; Account selector
|
||||
(gnc:register-option options
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts "a" opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH)
|
||||
(gnc-account-get-descendants-sorted
|
||||
(gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH)
|
||||
(gnc-account-get-descendants-sorted
|
||||
(gnc-get-current-root-account))))
|
||||
|
||||
; Date range
|
||||
(gnc:options-add-date-interval! options
|
||||
@ -100,29 +97,29 @@ date point, a projected minimum balance including scheduled transactions."))
|
||||
optname-plot-width optname-plot-height "a"
|
||||
(cons 'percent 100.0) (cons 'percent 100.0))
|
||||
; Markers
|
||||
(gnc:register-option options (gnc:make-simple-boolean-option
|
||||
gnc:pagename-display optname-show-markers "b" opthelp-show-markers #f))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-markers "b" opthelp-show-markers #f)
|
||||
; Reserve line
|
||||
(gnc:register-option options (gnc:make-complex-boolean-option
|
||||
gnc:pagename-display optname-show-reserve "c" opthelp-show-reserve #f #f
|
||||
(gnc-register-complex-boolean-option options
|
||||
gnc:pagename-display optname-show-reserve "c" opthelp-show-reserve #f
|
||||
(lambda (x)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
options gnc:pagename-display optname-reserve x))))
|
||||
(gnc:register-option options (gnc:make-number-range-option
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options gnc:pagename-display optname-reserve x)))
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-display optname-reserve "d" opthelp-reserve
|
||||
0 -10E9 10E9 2 0.01))
|
||||
0 -10E9 10E9 0.01)
|
||||
; Purchasing power target
|
||||
(gnc:register-option options (gnc:make-complex-boolean-option
|
||||
gnc:pagename-display optname-show-target "e" opthelp-show-target #f #f
|
||||
(gnc-register-complex-boolean-option options
|
||||
gnc:pagename-display optname-show-target "e" opthelp-show-target #f
|
||||
(lambda (x)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
options gnc:pagename-display optname-target x))))
|
||||
(gnc:register-option options (gnc:make-number-range-option
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options gnc:pagename-display optname-target x)))
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-display optname-target "f" opthelp-target
|
||||
0 -10E9 10E9 2 0.01))
|
||||
0 -10E9 10E9 0.01)
|
||||
; Future minimum
|
||||
(gnc:register-option options (gnc:make-simple-boolean-option
|
||||
gnc:pagename-display optname-show-minimum "g" opthelp-show-minimum #f))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-minimum "g" opthelp-show-minimum #f)
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
options)
|
||||
)
|
||||
@ -131,8 +128,8 @@ date point, a projected minimum balance including scheduled transactions."))
|
||||
(define (document-renderer report-obj)
|
||||
; Option-getting helper function.
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
(define report-title
|
||||
(get-option gnc:pagename-general gnc:optname-reportname))
|
||||
|
||||
|
@ -144,43 +144,34 @@
|
||||
|
||||
;; options generator
|
||||
(define (balance-sheet-options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(let* ((options (gnc-new-optiondb))
|
||||
(book (gnc-get-current-book)))
|
||||
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname)))
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
"a" opthelp-report-title (G_ reportname))
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-party-name
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
|
||||
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
|
||||
|
||||
;; date at which to report balance
|
||||
(gnc:options-add-report-date!
|
||||
options gnc:pagename-general optname-date "c")
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-general optname-report-form
|
||||
"d" opthelp-report-form #t))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-report-form
|
||||
"d" opthelp-report-form #t)
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-standard-order
|
||||
"dd" opthelp-standard-order #t))
|
||||
"dd" opthelp-standard-order #t)
|
||||
|
||||
;; accounts to work on
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
|
||||
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
|
||||
@ -188,43 +179,37 @@
|
||||
ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
|
||||
ACCT-TYPE-TRADING)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
(gnc:options-add-account-levels!
|
||||
options gnc:pagename-accounts optname-depth-limit
|
||||
"b" opthelp-depth-limit 3)
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-bottom-behavior
|
||||
"c" opthelp-bottom-behavior #f))
|
||||
|
||||
"c" opthelp-bottom-behavior #f)
|
||||
|
||||
;; all about currencies
|
||||
(gnc:options-add-currency!
|
||||
options pagename-commodities
|
||||
optname-report-commodity "a")
|
||||
|
||||
(gnc:options-add-price-source!
|
||||
|
||||
(gnc:options-add-price-source!
|
||||
options pagename-commodities
|
||||
optname-price-source "b" 'pricedb-nearest)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #t))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #t)
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"d" opthelp-show-rates #f))
|
||||
|
||||
"d" opthelp-show-rates #f)
|
||||
|
||||
;; what to show for zero-balance accounts
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zb-accts
|
||||
"a" opthelp-show-zb-accts #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"a" opthelp-show-zb-accts #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-omit-zb-bals
|
||||
"b" opthelp-omit-zb-bals #f))
|
||||
"b" opthelp-omit-zb-bals #f)
|
||||
;; what to show for non-leaf accounts
|
||||
(gnc:options-add-subtotal-view!
|
||||
options gnc:pagename-display
|
||||
@ -232,45 +217,37 @@
|
||||
"c")
|
||||
|
||||
;; some detailed formatting options
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-links
|
||||
"e" opthelp-account-links #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"e" opthelp-account-links #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-use-rules
|
||||
"f" opthelp-use-rules #f))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"f" opthelp-use-rules #f)
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-assets
|
||||
"g" opthelp-label-assets #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"g" opthelp-label-assets #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-assets
|
||||
"h" opthelp-total-assets #t))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"h" opthelp-total-assets #t)
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-liabilities
|
||||
"i" opthelp-label-liabilities #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"i" opthelp-label-liabilities #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-liabilities
|
||||
"j" opthelp-total-liabilities #t))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"j" opthelp-total-liabilities #t)
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-equity
|
||||
"k" opthelp-label-equity #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"k" opthelp-label-equity #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-equity
|
||||
"l" opthelp-total-equity #t))
|
||||
|
||||
"l" opthelp-total-equity #t)
|
||||
|
||||
;; Set the accounts page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-accounts)
|
||||
|
||||
|
||||
options))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -282,9 +259,8 @@
|
||||
|
||||
(define (balance-sheet-renderer report-obj)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -189,59 +189,66 @@
|
||||
|
||||
;; options generator
|
||||
(define (balsheet-options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
;; Accounts options
|
||||
(add-option (gnc:make-simple-boolean-option accounts-page optname-omit-zb-accts
|
||||
"a" opthelp-omit-zb-accts #f))
|
||||
(add-option (gnc:make-simple-boolean-option accounts-page optname-account-links
|
||||
"b" opthelp-account-links #t))
|
||||
(gnc-register-simple-boolean-option options
|
||||
accounts-page optname-omit-zb-accts
|
||||
"a" opthelp-omit-zb-accts #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
accounts-page optname-account-links
|
||||
"b" opthelp-account-links #t)
|
||||
(gnc:options-add-account-levels! options accounts-page optname-depth-limit
|
||||
"c" opthelp-depth-limit 'all)
|
||||
(add-option (gnc:make-simple-boolean-option accounts-page optname-flatten?
|
||||
"d" opthelp-flatten? #f))
|
||||
(gnc-register-simple-boolean-option options
|
||||
accounts-page optname-flatten?
|
||||
"d" opthelp-flatten? #f)
|
||||
|
||||
;; Commodity options
|
||||
(gnc:options-add-currency! options commodities-page optname-report-commodity "a")
|
||||
(gnc:options-add-price-source! options commodities-page
|
||||
optname-price-source "b" 'average-cost)
|
||||
(add-option (gnc:make-simple-boolean-option commodities-page optname-show-foreign
|
||||
"c" opthelp-show-foreign #t))
|
||||
(gnc-register-simple-boolean-option options
|
||||
commodities-page optname-show-foreign
|
||||
"c" opthelp-show-foreign #t)
|
||||
|
||||
;; Display options
|
||||
(add-option (gnc:make-multichoice-option
|
||||
display-page optname-columns
|
||||
"a" opthelp-columns 'onecol
|
||||
(list (vector 'autocols (N_ "Adjust the layout to fit the width of the screen or page"))
|
||||
(vector 'onecol (N_ "Display liabilities and equity below assets"))
|
||||
(vector 'twocols (N_ "Display assets on the left, liabilities and equity on the right")))))
|
||||
(add-option (gnc:make-multichoice-option
|
||||
display-page optname-neg-format
|
||||
"b" opthelp-neg-format 'negsign
|
||||
(list (vector 'negsign (N_ "Sign: -$10.00"))
|
||||
(vector 'negbrackets (N_ "Brackets: ($10.00)")))))
|
||||
(gnc-register-multichoice-option options
|
||||
display-page optname-columns
|
||||
"a" opthelp-columns "onecol"
|
||||
(list (vector 'autocols (N_ "Adjust the layout to fit the width of the screen or page"))
|
||||
(vector 'onecol (N_ "Display liabilities and equity below assets"))
|
||||
(vector 'twocols (N_ "Display assets on the left, liabilities and equity on the right"))))
|
||||
(gnc-register-multichoice-option options
|
||||
display-page optname-neg-format
|
||||
"b" opthelp-neg-format "negsign"
|
||||
(list (vector 'negsign (N_ "Sign: -$10.00"))
|
||||
(vector 'negbrackets (N_ "Brackets: ($10.00)"))))
|
||||
|
||||
(add-option (gnc:make-string-option display-page optname-font-family "c"
|
||||
opthelp-font-family "sans"))
|
||||
(add-option (gnc:make-string-option display-page optname-font-size "d"
|
||||
opthelp-font-size "medium"))
|
||||
(add-option (gnc:make-string-option display-page optname-template-file "e"
|
||||
opthelp-template-file "balsheet-eg.eguile.scm"))
|
||||
(add-option (gnc:make-string-option display-page optname-css-file "f"
|
||||
opthelp-css-file "balsheet-eg.css"))
|
||||
(gnc-register-string-option options
|
||||
display-page optname-font-family "c"
|
||||
opthelp-font-family "sans")
|
||||
(gnc-register-string-option options
|
||||
display-page optname-font-size "d"
|
||||
opthelp-font-size "medium")
|
||||
(gnc-register-string-option options
|
||||
display-page optname-template-file "e"
|
||||
opthelp-template-file "balsheet-eg.eguile.scm")
|
||||
(gnc-register-string-option options
|
||||
display-page optname-css-file "f"
|
||||
opthelp-css-file "balsheet-eg.css")
|
||||
|
||||
;; General options
|
||||
(add-option (gnc:make-string-option general-page optname-report-title
|
||||
"a" opthelp-report-title reportname))
|
||||
(gnc-register-string-option options
|
||||
general-page optname-report-title
|
||||
"a" opthelp-report-title reportname)
|
||||
(gnc:options-add-report-date! options general-page optname-date "b")
|
||||
|
||||
;; Notes options
|
||||
(add-option (gnc:make-text-option notes-page optname-extra-notes
|
||||
"a" opthelp-extra-notes
|
||||
(N_ "(Development version -- don't rely on the numbers on this report without double-checking them.<br>Change the 'Extra Notes' option to get rid of this message)")))
|
||||
(gnc-register-text-option options
|
||||
notes-page optname-extra-notes
|
||||
"a" opthelp-extra-notes
|
||||
(N_ "(Development version -- don't rely on the numbers on this report without double-checking them.<br>Change the 'Extra Notes' option to get rid of this message)"))
|
||||
|
||||
;; Set the accounts page as default option tab
|
||||
(gnc:options-set-default-section options general-page)
|
||||
@ -253,9 +260,8 @@
|
||||
(define (balsheet-renderer report-obj)
|
||||
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
(let* (
|
||||
|
@ -136,20 +136,16 @@ also show overall period profit & loss."))
|
||||
|
||||
;; options generator
|
||||
(define (multicol-report-options-generator report-type)
|
||||
(let* ((options (gnc:new-options))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
;; date at which to report balance
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general optname-startdate optname-enddate "c")
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-callback-option
|
||||
(gnc-register-multichoice-callback-option options
|
||||
gnc:pagename-general optname-period
|
||||
"c2" opthelp-period
|
||||
'disabled
|
||||
"disabled"
|
||||
(list
|
||||
(vector 'disabled (G_ "Disabled"))
|
||||
(vector 'YearDelta (G_ "One Year"))
|
||||
@ -158,67 +154,59 @@ also show overall period profit & loss."))
|
||||
(vector 'MonthDelta (G_ "One Month"))
|
||||
(vector 'TwoWeekDelta (G_ "Two Weeks"))
|
||||
(vector 'WeekDelta (G_ "One Week")))
|
||||
#f
|
||||
(lambda (x)
|
||||
(let ((x (not (eq? x 'disabled))))
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options
|
||||
gnc:pagename-general optname-disable-amount-indent
|
||||
(not x))
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options
|
||||
gnc:pagename-general optname-dual-columns
|
||||
(not x))
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options gnc:pagename-general optname-reverse-chrono x)
|
||||
(case report-type
|
||||
((balsheet)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options gnc:pagename-general optname-include-chart x)
|
||||
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options gnc:pagename-general optname-startdate x))
|
||||
|
||||
((pnl)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
options gnc:pagename-general optname-include-overall-period x)))))))
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options gnc:pagename-general optname-include-overall-period x))))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-disable-amount-indent
|
||||
"c3" opthelp-disable-amount-indent #f))
|
||||
"c3" opthelp-disable-amount-indent #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-include-chart
|
||||
"c5" opthelp-include-chart #f))
|
||||
"c5" opthelp-include-chart #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-dual-columns
|
||||
"c4" opthelp-dual-columns #t))
|
||||
"c4" opthelp-dual-columns #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-reverse-chrono
|
||||
"c5" opthelp-reverse-chrono #t))
|
||||
"c5" opthelp-reverse-chrono #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-options-summary
|
||||
"d" opthelp-options-summary
|
||||
'never
|
||||
"never"
|
||||
(list (vector 'always (G_ "Always"))
|
||||
(vector 'never (G_ "Never")))))
|
||||
(vector 'never (G_ "Never"))))
|
||||
|
||||
;; accounts to work on
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
|
||||
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
|
||||
@ -226,7 +214,6 @@ also show overall period profit & loss."))
|
||||
ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
|
||||
ACCT-TYPE-TRADING)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
|
||||
;; the depth-limit option is not well debugged; it may be better
|
||||
;; to disable it altogether
|
||||
@ -235,19 +222,18 @@ also show overall period profit & loss."))
|
||||
"b" opthelp-depth-limit 'all)
|
||||
|
||||
;; all about currencies
|
||||
(add-option
|
||||
(gnc:make-complex-boolean-option
|
||||
(gnc-register-complex-boolean-option options
|
||||
pagename-commodities optname-common-currency
|
||||
"b" opthelp-common-currency #f #f
|
||||
"b" opthelp-common-currency #f
|
||||
(lambda (x)
|
||||
(for-each
|
||||
(lambda (optname)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options pagename-commodities optname x))
|
||||
(list optname-report-commodity
|
||||
optname-show-rates
|
||||
optname-show-foreign
|
||||
optname-price-source)))))
|
||||
optname-price-source))))
|
||||
|
||||
(gnc:options-add-currency!
|
||||
options pagename-commodities
|
||||
@ -257,62 +243,51 @@ also show overall period profit & loss."))
|
||||
options pagename-commodities
|
||||
optname-price-source "d" 'pricedb-nearest)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"e" opthelp-show-foreign #t))
|
||||
"e" opthelp-show-foreign #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"f" opthelp-show-rates #t))
|
||||
"f" opthelp-show-rates #t)
|
||||
|
||||
;; what to show for zero-balance accounts
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zb-accts
|
||||
"a" opthelp-show-zb-accts #t))
|
||||
"a" opthelp-show-zb-accts #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-omit-zb-bals
|
||||
"b" opthelp-omit-zb-bals #f))
|
||||
"b" opthelp-omit-zb-bals #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-parent-balance-mode
|
||||
"c" opthelp-parent-balance-mode #t))
|
||||
"c" opthelp-parent-balance-mode #t)
|
||||
|
||||
;; some detailed formatting options
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-links
|
||||
"e" opthelp-account-links #t))
|
||||
"e" opthelp-account-links #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-amount-links
|
||||
"e5" opthelp-amount-links #t))
|
||||
"e5" opthelp-amount-links #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-full-name
|
||||
"f" opthelp-account-full-name #f))
|
||||
"f" opthelp-account-full-name #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-display optname-label-sections "g" opthelp-label-sections #t))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-sections "g" opthelp-label-sections #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-display optname-total-sections "h" opthelp-total-sections #t))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-sections "h" opthelp-total-sections #t)
|
||||
|
||||
(when (eq? report-type 'pnl)
|
||||
;; include overall period column?
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-include-overall-period
|
||||
"c6" opthelp-include-overall-period #f)))
|
||||
"c6" opthelp-include-overall-period #f))
|
||||
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
|
||||
@ -651,9 +626,8 @@ also show overall period profit & loss."))
|
||||
|
||||
(define (multicol-report-renderer report-obj report-type)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting (get-option gnc:pagename-general gnc:optname-reportname))
|
||||
|
||||
|
@ -113,82 +113,67 @@
|
||||
|
||||
;; options generator
|
||||
(define (budget-balance-sheet-options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
gnc:pagename-general optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname)))
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
gnc:pagename-general optname-party-name
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-general optname-report-form
|
||||
"c" opthelp-report-form #t))
|
||||
(let* ((options (gnc-new-optiondb))
|
||||
(book (gnc-get-current-book)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-budget-option
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname))
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-party-name
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-report-form
|
||||
"c" opthelp-report-form #t)
|
||||
|
||||
(gnc-register-budget-option options
|
||||
gnc:pagename-general optname-budget
|
||||
"d" opthelp-budget))
|
||||
"d" opthelp-budget (gnc-budget-get-default book))
|
||||
|
||||
;; accounts to work on
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
|
||||
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
|
||||
ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE
|
||||
ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
|
||||
(gnc:options-add-account-levels!
|
||||
options gnc:pagename-accounts optname-depth-limit
|
||||
"b" opthelp-depth-limit 3)
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-bottom-behavior
|
||||
"c" opthelp-bottom-behavior #f))
|
||||
"c" opthelp-bottom-behavior #f)
|
||||
|
||||
;; all about currencies
|
||||
(gnc:options-add-currency!
|
||||
options pagename-commodities
|
||||
optname-report-commodity "a")
|
||||
|
||||
optname-report-commodity "a")
|
||||
(gnc:options-add-price-source!
|
||||
options pagename-commodities
|
||||
optname-price-source "b" 'pricedb-nearest)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #t))
|
||||
"c" opthelp-show-foreign #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"d" opthelp-show-rates #f))
|
||||
"d" opthelp-show-rates #f)
|
||||
|
||||
;; what to show for zero-balance accounts
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zb-accts
|
||||
"a" opthelp-show-zb-accts #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"a" opthelp-show-zb-accts #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-omit-zb-bals
|
||||
"b" opthelp-omit-zb-bals #f))
|
||||
"b" opthelp-omit-zb-bals #f)
|
||||
;; what to show for non-leaf accounts
|
||||
(gnc:options-add-subtotal-view!
|
||||
options gnc:pagename-display
|
||||
@ -196,46 +181,37 @@
|
||||
"c")
|
||||
|
||||
;; some detailed formatting options
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-links
|
||||
"d" opthelp-account-links #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"d" opthelp-account-links #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-use-rules
|
||||
"e" opthelp-use-rules #f))
|
||||
"e" opthelp-use-rules #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-assets
|
||||
"f" opthelp-label-assets #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"f" opthelp-label-assets #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-assets
|
||||
"g" opthelp-total-assets #t))
|
||||
"g" opthelp-total-assets #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-liabilities
|
||||
"h" opthelp-label-liabilities #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"h" opthelp-label-liabilities #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-liabilities
|
||||
"i" opthelp-total-liabilities #t))
|
||||
"i" opthelp-total-liabilities #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-equity
|
||||
"j" opthelp-label-equity #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"j" opthelp-label-equity #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-equity
|
||||
"k" opthelp-total-equity #t))
|
||||
"k" opthelp-total-equity #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-new-existing
|
||||
"l" opthelp-new-existing #t))
|
||||
"l" opthelp-new-existing #t)
|
||||
|
||||
;; Set the accounts page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-accounts)
|
||||
@ -251,9 +227,8 @@
|
||||
|
||||
(define (budget-balance-sheet-renderer report-obj)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(define (get-budget-account-budget-balance budget account)
|
||||
(let ((bal (gnc:budget-account-get-net budget account #f #f)))
|
||||
|
@ -70,79 +70,69 @@
|
||||
(vector 'manual (N_ "Manual period selection"))))
|
||||
|
||||
(define (options-generator)
|
||||
(let ((options (gnc:new-options))
|
||||
(let ((options (gnc-new-optiondb))
|
||||
(book (gnc-get-current-book))
|
||||
(ui-start-period-type 'current)
|
||||
(ui-end-period-type 'next))
|
||||
|
||||
(define (add-option new-option)
|
||||
(gnc:register-option options new-option))
|
||||
|
||||
(define (set-option-enabled options page opt-name enabled)
|
||||
(gnc-option-db-set-option-selectable-by-name options page opt-name enabled))
|
||||
(gnc-optiondb-set-option-selectable-by-name options page opt-name enabled))
|
||||
|
||||
;; Option to select Budget
|
||||
(add-option
|
||||
(gnc:make-budget-option
|
||||
gnc:pagename-general optname-budget "a" (N_ "Budget to use.")))
|
||||
(gnc-register-budget-option options
|
||||
gnc:pagename-general optname-budget "a"
|
||||
(N_ "Budget to use.")
|
||||
(gnc-budget-get-default book))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-callback-option
|
||||
(gnc-register-multichoice-callback-option options
|
||||
gnc:pagename-general optname-budget-period-start
|
||||
"g1.1" opthelp-budget-period-start 'current period-options #f
|
||||
"g1.1" opthelp-budget-period-start "current" period-options
|
||||
(lambda (new-val)
|
||||
(set-option-enabled options gnc:pagename-general
|
||||
optname-budget-period-start-exact (eq? 'manual new-val))
|
||||
(set! ui-start-period-type new-val))))
|
||||
(set! ui-start-period-type new-val)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-budget-period-start-exact
|
||||
"g1.2" opthelp-budget-period-start-exact
|
||||
1 1 60 0 1))
|
||||
1 1 60 1)
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-callback-option
|
||||
(gnc-register-multichoice-callback-option options
|
||||
gnc:pagename-general optname-budget-period-end
|
||||
"g2.1" opthelp-budget-period-end 'next period-options #f
|
||||
"g2.1" opthelp-budget-period-end "next" period-options
|
||||
(lambda (new-val)
|
||||
(set-option-enabled options gnc:pagename-general
|
||||
optname-budget-period-end-exact (eq? 'manual new-val))
|
||||
(set! ui-end-period-type new-val))))
|
||||
(set! ui-end-period-type new-val)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-budget-period-end-exact
|
||||
"g2.2" opthelp-budget-period-end-exact
|
||||
1 1 60 0 1))
|
||||
1 1 60 1)
|
||||
|
||||
;; Option to select the accounts to that will be displayed
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"c" (N_ "Report on these accounts.")
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
|
||||
(gnc:options-add-account-levels!
|
||||
options gnc:pagename-accounts optname-depth-limit "d" opthelp-depth-limit 6)
|
||||
|
||||
;; Display tab
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-running-sum "a"
|
||||
(N_ "Calculate as running sum?") #t))
|
||||
(N_ "Calculate as running sum?") #t)
|
||||
|
||||
;; Display tab
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-display optname-chart-type "b"
|
||||
(N_ "Select which chart type to use.") 'bars
|
||||
(N_ "Select which chart type to use.") "bars"
|
||||
(list
|
||||
(vector 'bars (N_ "Bar Chart"))
|
||||
(vector 'lines (N_ "Line Chart")))))
|
||||
(vector 'lines (N_ "Line Chart"))))
|
||||
|
||||
(gnc:options-add-plot-size!
|
||||
options gnc:pagename-display
|
||||
@ -242,8 +232,8 @@
|
||||
|
||||
;; This is a helper function for looking up option values.
|
||||
(define (get-option section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) section name))
|
||||
|
||||
;; This is a helper function to find out the level of the account
|
||||
;; with in the account tree
|
||||
|
@ -46,19 +46,16 @@
|
||||
|
||||
;; options generator
|
||||
(define (budget-report-options-generator)
|
||||
(let ((options (gnc:new-options)))
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
;; Option to select Budget
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-budget-option
|
||||
(gnc-register-budget-option options
|
||||
gnc:pagename-general optname-budget
|
||||
"a" (N_ "Budget to use.")))
|
||||
"a" (N_ "Budget to use.")
|
||||
(gnc-budget-get-default (gnc-get-current-book)))
|
||||
|
||||
;; Option to select Period of selected Budget
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-periods
|
||||
;; FIXME: It would be nice if the max number of budget periods (60) was
|
||||
;; defined globally somewhere so we could reference it here. However, it
|
||||
@ -67,7 +64,7 @@
|
||||
;; FIXME: It would be even nicer if the max number of budget
|
||||
;; periods was determined by the number of periods in the
|
||||
;; currently selected budget
|
||||
"b" (N_ "Period number.") 1 1 60 0 1))
|
||||
"b" (N_ "Period number.") 1 1 60 1)
|
||||
|
||||
;; Option to select the currency the report will be shown in
|
||||
(gnc:options-add-currency!
|
||||
@ -79,15 +76,11 @@
|
||||
options gnc:pagename-general optname-price-source "c" 'pricedb-latest)
|
||||
|
||||
;;Option to select the accounts to that will be displayed
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
(string-append "a" "c")
|
||||
(N_ "Report on these accounts.")
|
||||
(lambda ()
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
|
||||
#f #t))
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
|
||||
|
||||
;; Set the general page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
@ -255,9 +248,8 @@
|
||||
|
||||
;; Helper function retrieves options
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
;; Update progress bar
|
||||
(gnc:report-starting reportname)
|
||||
|
@ -131,86 +131,74 @@
|
||||
|
||||
;; options generator
|
||||
(define (budget-income-statement-options-generator-internal reportname)
|
||||
(let* ((options (gnc:new-options))
|
||||
(book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(let* ((options (gnc-new-optiondb))
|
||||
(book (gnc-get-current-book)))
|
||||
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname)))
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
"a" opthelp-report-title (G_ reportname))
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-party-name
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
|
||||
|
||||
(add-option
|
||||
(gnc:make-budget-option
|
||||
(gnc-register-budget-option options
|
||||
gnc:pagename-general optname-budget
|
||||
"c" opthelp-budget))
|
||||
"c" opthelp-budget
|
||||
(gnc-budget-get-default book))
|
||||
|
||||
(add-option
|
||||
(gnc:make-complex-boolean-option
|
||||
(gnc-register-complex-boolean-option options
|
||||
gnc:pagename-general
|
||||
optname-use-budget-period-range
|
||||
"d"
|
||||
opthelp-use-budget-period-range
|
||||
#f
|
||||
#f
|
||||
;; Make budget-period-start and budget-period-end option widgets
|
||||
;; selectable only when we are running the report for a budget period
|
||||
;; range.
|
||||
(lambda (value)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options
|
||||
gnc:pagename-general
|
||||
optname-budget-period-start
|
||||
value)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options
|
||||
gnc:pagename-general
|
||||
optname-budget-period-end
|
||||
value))))
|
||||
value)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-budget-period-start
|
||||
"e" opthelp-budget-period-start
|
||||
;; FIXME: It would be nice if the max number of budget periods (60) was
|
||||
;; defined globally somewhere so we could reference it here. However, it
|
||||
;; only appears to be defined currently in src/gnome/glade/budget.glade.
|
||||
1 1 60 0 1))
|
||||
1 1 60 1)
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-budget-period-end
|
||||
"f" opthelp-budget-period-end
|
||||
;; FIXME: It would be nice if the max number of budget periods (60) was
|
||||
;; defined globally somewhere so we could reference it here. However, it
|
||||
;; only appears to be defined currently in src/gnome/glade/budget.glade.
|
||||
1 1 60 0 1))
|
||||
1 1 60 1)
|
||||
|
||||
;; accounts to work on
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
;; select, by default, only income and expense accounts
|
||||
(list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
|
||||
(gnc:options-add-account-levels!
|
||||
options gnc:pagename-accounts optname-depth-limit
|
||||
"b" opthelp-depth-limit 3)
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-bottom-behavior
|
||||
"c" opthelp-bottom-behavior #f))
|
||||
"c" opthelp-bottom-behavior #f)
|
||||
|
||||
;; all about currencies
|
||||
(gnc:options-add-currency!
|
||||
@ -221,25 +209,21 @@
|
||||
options pagename-commodities
|
||||
optname-price-source "b" 'pricedb-nearest)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #t))
|
||||
"c" opthelp-show-foreign #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"d" opthelp-show-rates #f))
|
||||
"d" opthelp-show-rates #f)
|
||||
|
||||
;; what to show for zero-balance accounts
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zb-accts
|
||||
"a" opthelp-show-zb-accts #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"a" opthelp-show-zb-accts #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-omit-zb-bals
|
||||
"b" opthelp-omit-zb-bals #f))
|
||||
"b" opthelp-omit-zb-bals #f)
|
||||
;; what to show for non-leaf accounts
|
||||
(gnc:options-add-subtotal-view!
|
||||
options gnc:pagename-display
|
||||
@ -247,42 +231,34 @@
|
||||
"c")
|
||||
|
||||
;; some detailed formatting options
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-links
|
||||
"d" opthelp-account-links #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"d" opthelp-account-links #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-use-rules
|
||||
"e" opthelp-use-rules #f))
|
||||
"e" opthelp-use-rules #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-revenue
|
||||
"f" opthelp-label-revenue #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"f" opthelp-label-revenue #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-revenue
|
||||
"g" opthelp-total-revenue #t))
|
||||
"g" opthelp-total-revenue #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-expense
|
||||
"h" opthelp-label-expense #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"h" opthelp-label-expense #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-expense
|
||||
"i" opthelp-total-expense #t))
|
||||
"i" opthelp-total-expense #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-two-column
|
||||
"j" opthelp-two-column #f))
|
||||
"j" opthelp-two-column #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-standard-order
|
||||
"k" opthelp-standard-order #t))
|
||||
"k" opthelp-standard-order #t)
|
||||
|
||||
;; Set the accounts page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-accounts)
|
||||
@ -296,9 +272,8 @@
|
||||
|
||||
(define (budget-income-statement-renderer-internal report-obj reportname)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(define (get-assoc-account-balances-budget
|
||||
budget accountlist period-start period-end get-balance-fn)
|
||||
|
@ -94,19 +94,15 @@
|
||||
|
||||
;;List of common helper functions, that is not bound only to options generation or report evaluation
|
||||
(define (get-option-val options pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options pagename optname)))
|
||||
(gnc-optiondb-lookup-value options pagename optname))
|
||||
|
||||
(define (set-option-enabled options page opt-name enabled)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options page opt-name enabled))
|
||||
|
||||
;; options generator
|
||||
(define (budget-report-options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option)))
|
||||
(let* ((options (gnc-new-optiondb))
|
||||
(period-options
|
||||
(list (vector 'first (N_ "First budget period"))
|
||||
(vector 'previous (N_ "Previous budget period"))
|
||||
@ -118,21 +114,18 @@
|
||||
(ui-start-period-type 'current)
|
||||
(ui-end-period-type 'next))
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-budget-option
|
||||
(gnc-register-budget-option options
|
||||
gnc:pagename-general optname-budget
|
||||
"a" (N_ "Budget to use.")))
|
||||
"a" (N_ "Budget to use.")
|
||||
(gnc-budget-get-default (gnc-get-current-book)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-accumulate
|
||||
"b" opthelp-accumulate #f))
|
||||
"b" opthelp-accumulate #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-complex-boolean-option
|
||||
(gnc-register-complex-boolean-option options
|
||||
gnc:pagename-general optname-use-budget-period-range
|
||||
"f" opthelp-use-budget-period-range #f #f
|
||||
"f" opthelp-use-budget-period-range #f
|
||||
(lambda (value)
|
||||
(for-each
|
||||
(lambda (opt)
|
||||
@ -148,56 +141,50 @@
|
||||
optname-budget-period-end-exact
|
||||
(and value (eq? 'manual ui-end-period-type)))
|
||||
|
||||
(set! ui-use-periods value))))
|
||||
(set! ui-use-periods value)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-callback-option
|
||||
(gnc-register-multichoice-callback-option options
|
||||
gnc:pagename-general optname-budget-period-start
|
||||
"g1.1" opthelp-budget-period-start 'current period-options #f
|
||||
"g1.1" opthelp-budget-period-start "current" period-options
|
||||
(lambda (new-val)
|
||||
(set-option-enabled options gnc:pagename-general
|
||||
optname-budget-period-start-exact
|
||||
(and ui-use-periods (eq? 'manual new-val)))
|
||||
(set! ui-start-period-type new-val))))
|
||||
(set! ui-start-period-type new-val)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-budget-period-start-exact
|
||||
"g1.2" opthelp-budget-period-start-exact
|
||||
;; FIXME: It would be nice if the max number of budget periods (60) was
|
||||
;; defined globally somewhere so we could reference it here. However, it
|
||||
;; only appears to be defined currently in src/gnome/glade/budget.glade.
|
||||
1 1 60 0 1))
|
||||
1 1 60 1)
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-callback-option
|
||||
(gnc-register-multichoice-callback-option options
|
||||
gnc:pagename-general optname-budget-period-end
|
||||
"g2.1" opthelp-budget-period-end 'next period-options #f
|
||||
"g2.1" opthelp-budget-period-end "next" period-options
|
||||
(lambda (new-val)
|
||||
(set-option-enabled options gnc:pagename-general
|
||||
optname-budget-period-end-exact
|
||||
(and ui-use-periods (eq? 'manual new-val)))
|
||||
(set! ui-end-period-type new-val))))
|
||||
(set! ui-end-period-type new-val)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-budget-period-end-exact
|
||||
"g2.2" opthelp-budget-period-end-exact
|
||||
;; FIXME: It would be nice if the max number of budget periods (60) was
|
||||
;; defined globally somewhere so we could reference it here. However, it
|
||||
;; only appears to be defined currently in src/gnome/glade/budget.glade.
|
||||
1 1 60 0 1))
|
||||
1 1 60 1)
|
||||
;; accounts to work on
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-period-collapse-before
|
||||
"g3" opthelp-period-collapse-before #t))
|
||||
"g3" opthelp-period-collapse-before #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-period-collapse-after
|
||||
"g4" opthelp-period-collapse-after #t))
|
||||
"g4" opthelp-period-collapse-after #t)
|
||||
|
||||
(gnc:options-add-account-selection!
|
||||
options gnc:pagename-accounts optname-display-depth
|
||||
@ -209,38 +196,31 @@
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-bottom-behavior
|
||||
"c" opthelp-bottom-behavior #f))
|
||||
"c" opthelp-bottom-behavior #f)
|
||||
|
||||
;; columns to display
|
||||
(add-option
|
||||
(gnc:make-complex-boolean-option
|
||||
(gnc-register-complex-boolean-option options
|
||||
gnc:pagename-display optname-show-budget
|
||||
"s1" opthelp-show-budget #t #f
|
||||
"s1" opthelp-show-budget #t
|
||||
(lambda (x)
|
||||
(set-option-enabled options gnc:pagename-display optname-show-notes x))))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(set-option-enabled options gnc:pagename-display optname-show-notes x)))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-notes
|
||||
"s15" opthelp-show-notes #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"s15" opthelp-show-notes #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-actual
|
||||
"s2" opthelp-show-actual #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"s2" opthelp-show-actual #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-difference
|
||||
"s3" opthelp-show-difference #f))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"s3" opthelp-show-difference #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-totalcol
|
||||
"s4" opthelp-show-totalcol #f))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"s4" opthelp-show-totalcol #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zb-accounts
|
||||
"s5" opthelp-show-zb-accounts #t))
|
||||
"s5" opthelp-show-zb-accounts #t)
|
||||
|
||||
;; Set the general page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
;; options generator
|
||||
(define (cash-flow-options-generator)
|
||||
(let ((options (gnc:new-options)))
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
;; date interval
|
||||
(gnc:options-add-date-interval!
|
||||
@ -70,17 +70,13 @@
|
||||
options gnc:pagename-general
|
||||
optname-price-source "c" 'pricedb-nearest)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-show-rates
|
||||
"d" (N_ "Show the exchange rates used.") #f))
|
||||
"d" (N_ "Show the exchange rates used.") #f)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-show-full-names
|
||||
"e" (N_ "Show full account names (including parent accounts).") #t))
|
||||
"e" (N_ "Show full account names (including parent accounts).") #t)
|
||||
|
||||
;; accounts to work on
|
||||
(gnc:options-add-account-selection!
|
||||
@ -95,11 +91,9 @@
|
||||
#f)
|
||||
|
||||
;; Trading accounts?
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-include-trading-accounts
|
||||
"b" (N_ "Include transfers to and from Trading Accounts in the report.") #f))
|
||||
"b" (N_ "Include transfers to and from Trading Accounts in the report.") #f)
|
||||
|
||||
;; Set the general page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
@ -113,9 +107,8 @@
|
||||
|
||||
(define (cash-flow-renderer report-obj)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -61,10 +61,7 @@
|
||||
|
||||
;; options generator function
|
||||
(define (cashflow-barchart-options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
;; General tab
|
||||
(gnc:options-add-date-interval!
|
||||
@ -82,47 +79,34 @@
|
||||
optname-price-source "d" 'pricedb-nearest)
|
||||
|
||||
;; Accounts tab
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a" (N_ "Report on these accounts.")
|
||||
(lambda () ; account getter
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-ASSET
|
||||
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-include-trading-accounts
|
||||
"b" (N_ "Include transfers to and from Trading Accounts in the report.") #f))
|
||||
"b" (N_ "Include transfers to and from Trading Accounts in the report.") #f)
|
||||
|
||||
;; Display tab
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-in
|
||||
"a" (N_ "Show money in?") #t))
|
||||
"a" (N_ "Show money in?") #t)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-out
|
||||
"b" (N_ "Show money out?") #t))
|
||||
"b" (N_ "Show money out?") #t)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-net
|
||||
"c" (N_ "Show net money flow?") #t))
|
||||
"c" (N_ "Show net money flow?") #t)
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-table
|
||||
"d" (N_ "Display a table of the selected data.") #f))
|
||||
"d" (N_ "Display a table of the selected data.") #f)
|
||||
|
||||
;; Plot size options
|
||||
(gnc:options-add-plot-size!
|
||||
@ -141,9 +125,8 @@
|
||||
|
||||
(define (cashflow-barchart-renderer report-obj)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -94,10 +94,7 @@ developing over time"))
|
||||
(define opthelp-averaging (N_ "Select whether the amounts should be shown over the full time period or rather as the average e.g. per month."))
|
||||
|
||||
(define (options-generator account-types do-intervals?)
|
||||
(let* ((options (gnc:new-options))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
;; General tab
|
||||
(gnc:options-add-date-interval!
|
||||
@ -115,31 +112,25 @@ developing over time"))
|
||||
optname-price-source "d" 'weighted-average)
|
||||
|
||||
(if do-intervals?
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-averaging
|
||||
"e" opthelp-averaging
|
||||
'None
|
||||
"None"
|
||||
(list (vector 'None (N_ "No Averaging"))
|
||||
(vector 'MonthDelta (N_ "Monthly"))
|
||||
(vector 'WeekDelta (N_ "Weekly"))
|
||||
(vector 'DayDelta (N_ "Daily"))))))
|
||||
(vector 'DayDelta (N_ "Daily")))))
|
||||
|
||||
|
||||
;; Accounts tab
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-limited-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
(N_ "Report on these accounts, if chosen account level allows.")
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
account-types
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
(lambda (accounts)
|
||||
(list #t
|
||||
(gnc:filter-accountlist-type account-types accounts)))
|
||||
#t))
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
|
||||
account-types)
|
||||
|
||||
(gnc:options-add-account-levels!
|
||||
options gnc:pagename-accounts optname-levels "c"
|
||||
@ -147,47 +138,41 @@ developing over time"))
|
||||
2)
|
||||
|
||||
;; Display tab
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-fullname
|
||||
"a" (N_ "Show the full account name in legend?") #f))
|
||||
"a" (N_ "Show the full account name in legend?") #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-display optname-chart-type
|
||||
"b" "Select which chart type to use."
|
||||
'barchart
|
||||
"barchart"
|
||||
(list (vector 'barchart (N_ "Bar Chart"))
|
||||
(vector 'linechart (N_ "Line Chart")))))
|
||||
(vector 'linechart (N_ "Line Chart"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-stacked
|
||||
"c"
|
||||
(N_ "Show charts as stacked charts?")
|
||||
#t))
|
||||
#t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-display optname-slices
|
||||
"d" (N_ "Maximum number of stacks in the chart.") 8
|
||||
2 24 0 1))
|
||||
2 24 1)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display
|
||||
(N_ "Show table")
|
||||
"e" (N_ "Display a table of the selected data.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
;; contributed by https://github.com/exxus
|
||||
;; https://github.com/Gnucash/gnucash/pull/1272
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display
|
||||
(N_ "Percentage chart")
|
||||
"e1" (N_ "Display account contributions as a percentage of the total value for the period.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
(gnc:options-add-plot-size!
|
||||
options gnc:pagename-display
|
||||
@ -218,9 +203,7 @@ developing over time"))
|
||||
export-type)
|
||||
;; A helper functions for looking up option values.
|
||||
(define (get-option section name)
|
||||
(gnc-option-value
|
||||
(gnc:optiondb
|
||||
(gnc:report-options report-obj)) section name))
|
||||
(gnc-option-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
(let* ((to-date-t64 (gnc:time64-end-day-time
|
||||
@ -567,10 +550,9 @@ Please deselect the accounts with negative balances."))
|
||||
(gnc:options-copy-values
|
||||
(gnc:report-options report-obj) options)
|
||||
;; and set the destination accounts
|
||||
(gnc:option-set-value
|
||||
(gnc:lookup-option options gnc:pagename-accounts
|
||||
optname-accounts)
|
||||
(map car finish))
|
||||
(gnc-set-option options gnc:pagename-accounts
|
||||
optname-accounts
|
||||
(map car finish))
|
||||
;; Set the URL to point to this report.
|
||||
(set! other-anchor
|
||||
(gnc:report-anchor-text
|
||||
@ -745,4 +727,3 @@ Please deselect the accounts with negative balances."))
|
||||
(list ACCT-TYPE-LIABILITY ACCT-TYPE-PAYABLE ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-CREDITLINE)
|
||||
#f menuname-liabilities menutip-liabilities #t category-barchart-liability-uuid)))
|
||||
|
||||
|
@ -79,74 +79,59 @@
|
||||
|
||||
|
||||
(define (options-generator)
|
||||
(define options (gnc:new-options))
|
||||
|
||||
(define (add-option new-option)
|
||||
(gnc:register-option options new-option))
|
||||
(define options (gnc-new-optiondb))
|
||||
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general optname-from-date optname-to-date "b")
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
pagename-incomeaccounts optname-incomeaccounts
|
||||
"b" opthelp-incomeaccounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-INCOME)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-INCOME)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
pagename-expenseaccounts optname-expenseaccounts
|
||||
"b" opthelp-expenseaccounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-EXPENSE)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-EXPENSE)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-display optname-sortkey
|
||||
"a" opthelp-sortkey
|
||||
'customername
|
||||
"customername"
|
||||
(list
|
||||
(vector 'customername (N_ "Customer Name"))
|
||||
(vector 'profit (N_ "Profit"))
|
||||
(vector 'markup (N_ "Markup (which is profit amount divided by sales)"))
|
||||
(vector 'sales (N_ "Sales"))
|
||||
(vector 'expense (N_ "Expense")))))
|
||||
(vector 'expense (N_ "Expense"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-display optname-sortascending
|
||||
"b" opthelp-sortascending
|
||||
'ascend
|
||||
"ascend"
|
||||
(list
|
||||
(vector 'ascend (N_ "Ascending"))
|
||||
(vector 'descend (N_ "Descending")))))
|
||||
(vector 'descend (N_ "Descending"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-own-address
|
||||
"d" opthelp-show-own-address #t))
|
||||
"d" opthelp-show-own-address #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zero-lines
|
||||
"e" opthelp-show-zero-lines #f))
|
||||
"e" opthelp-show-zero-lines #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-inactive
|
||||
"f" opthelp-show-inactive #f))
|
||||
"f" opthelp-show-inactive #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-column-expense
|
||||
"g" opthelp-show-column-expense #t))
|
||||
"g" opthelp-show-column-expense #t)
|
||||
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
|
||||
@ -231,8 +216,7 @@
|
||||
|
||||
(define (reg-renderer report-obj)
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(let* ((document (gnc:make-html-document))
|
||||
(report-title (opt-val gnc:pagename-general gnc:optname-reportname))
|
||||
|
@ -46,8 +46,7 @@
|
||||
(options (gnc:report-options (gnc-report-find view))))
|
||||
|
||||
(define (set-option! section name value)
|
||||
(gnc:option-set-value
|
||||
(gnc:lookup-option options section name) value))
|
||||
(gnc-set-option (gnc:optiondb options) section name value))
|
||||
|
||||
(set-option! "General" "Report name" (G_ "Dashboard"))
|
||||
(set-option! "General" "Number of columns" 2)
|
||||
|
@ -98,20 +98,15 @@
|
||||
|
||||
;; options generator
|
||||
(define (equity-statement-options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb))
|
||||
(book (gnc-get-current-book)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
(N_ "General") optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname)))
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
"a" opthelp-report-title (G_ reportname))
|
||||
(gnc-register-string-option options
|
||||
(N_ "General") optname-party-name
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
|
||||
|
||||
;; date at which to report balance
|
||||
(gnc:options-add-date-interval!
|
||||
@ -119,13 +114,11 @@
|
||||
optname-start-date optname-end-date "c")
|
||||
|
||||
;; accounts to work on
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
|
||||
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
|
||||
@ -133,7 +126,6 @@
|
||||
ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
|
||||
ACCT-TYPE-TRADING)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
|
||||
;; all about currencies
|
||||
(gnc:options-add-currency!
|
||||
@ -144,38 +136,32 @@
|
||||
options pagename-commodities
|
||||
optname-price-source "b" 'pricedb-nearest)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #t))
|
||||
"c" opthelp-show-foreign #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"d" opthelp-show-rates #f))
|
||||
"d" opthelp-show-rates #f)
|
||||
|
||||
;; some detailed formatting options
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-use-rules
|
||||
"f" opthelp-use-rules #f))
|
||||
"f" opthelp-use-rules #f)
|
||||
|
||||
;; closing entry match criteria
|
||||
;;
|
||||
;; N.B.: transactions really should have a field where we can put
|
||||
;; transaction types like "Adjusting/Closing/Correcting Entries"
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
pagename-entries optname-closing-pattern
|
||||
"a" opthelp-closing-pattern (G_ "Closing Entries")))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"a" opthelp-closing-pattern (G_ "Closing Entries"))
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-closing-casing
|
||||
"b" opthelp-closing-casing #f))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"b" opthelp-closing-casing #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-closing-regexp
|
||||
"c" opthelp-closing-regexp #f))
|
||||
"c" opthelp-closing-regexp #f)
|
||||
|
||||
;; Set the accounts page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-accounts)
|
||||
@ -209,9 +195,8 @@
|
||||
|
||||
(define (equity-statement-renderer report-obj)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -46,8 +46,8 @@
|
||||
(query (qof-query-create-for-splits)))
|
||||
|
||||
(define (set-option! section name value)
|
||||
(gnc:option-set-default-value
|
||||
(gnc:lookup-option options section name) value))
|
||||
(GncOption-set-default-value
|
||||
(gnc-lookup-option (gnc:optiondb options) section name) value))
|
||||
|
||||
;; Match, by default, all non-void transactions ever recorded in
|
||||
;; all accounts.... Whether or not to match void transactions,
|
||||
|
@ -77,10 +77,7 @@ commissions in cumulative average cost and gain/loss after commission")
|
||||
the split action field to detect capitalized fees on stock activity")
|
||||
|
||||
(define (options-generator)
|
||||
(let ((options (gnc:new-options)))
|
||||
|
||||
(define (add-option new-option)
|
||||
(gnc:register-option options new-option))
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general optname-startdate optname-enddate " ")
|
||||
@ -88,46 +85,37 @@ the split action field to detect capitalized fees on stock activity")
|
||||
(gnc:options-add-currency!
|
||||
options gnc:pagename-general optname-report-currency "a")
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-sel-limited-option
|
||||
(gnc-register-account-sel-limited-option options
|
||||
gnc:pagename-general optname-stock-acct "b" "Stock Account"
|
||||
#f #f (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)))
|
||||
'() (list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-sel-limited-option
|
||||
(gnc-register-account-sel-limited-option options
|
||||
gnc:pagename-general optname-proceeds-acct "c" "Proceeds Account"
|
||||
#f #f (list ACCT-TYPE-ASSET ACCT-TYPE-BANK)))
|
||||
'() (list ACCT-TYPE-ASSET ACCT-TYPE-BANK))
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-sel-limited-option
|
||||
(gnc-register-account-sel-limited-option options
|
||||
gnc:pagename-general optname-dividend-acct "c" "Dividend Account"
|
||||
#f #f (list ACCT-TYPE-INCOME)))
|
||||
'() (list ACCT-TYPE-INCOME))
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-sel-limited-option
|
||||
(gnc-register-account-sel-limited-option options
|
||||
gnc:pagename-general optname-capgains-acct "d" "Cap Gains Account"
|
||||
#f #f (list ACCT-TYPE-INCOME)))
|
||||
'() (list ACCT-TYPE-INCOME))
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-sel-limited-option
|
||||
(gnc-register-account-sel-limited-option options
|
||||
gnc:pagename-general optname-fees-acct "c5" "Fees Account"
|
||||
#f #f (list ACCT-TYPE-EXPENSE)))
|
||||
'() (list ACCT-TYPE-EXPENSE))
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
gnc:pagename-general optname-cap-fee-action "d5" opthelp-cap-fee-action "Fee"))
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-cap-fee-action "d5" opthelp-cap-fee-action "Fee")
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-general optname-format-cells "e" opthelp-format-cells #t))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-format-cells "e" opthelp-format-cells #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-general optname-format-short "f" opthelp-format-short #t))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-format-short "f" opthelp-format-short #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-general optname-cap-purch-costs "g" opthelp-cap-purch-costs #t))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-cap-purch-costs "g" opthelp-cap-purch-costs #t)
|
||||
|
||||
options))
|
||||
|
||||
@ -297,8 +285,8 @@ the split action field to detect capitalized fees on stock activity")
|
||||
|
||||
(define (ifrs-cost-basis-renderer report-obj)
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) section name))
|
||||
|
||||
(define opt-startdate (opt-val gnc:pagename-general optname-startdate))
|
||||
(define opt-enddate (opt-val gnc:pagename-general optname-enddate))
|
||||
|
@ -136,20 +136,15 @@
|
||||
|
||||
;; options generator
|
||||
(define (income-statement-options-generator-internal reportname)
|
||||
(let* ((options (gnc:new-options))
|
||||
(book (gnc-get-current-book)) ; XXX Find a way to get the book that opened the report
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(let* ((options (gnc-new-optiondb))
|
||||
(book (gnc-get-current-book)))
|
||||
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname)))
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
"a" opthelp-report-title (G_ reportname))
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-party-name
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
|
||||
|
||||
;; period over which to report income
|
||||
(gnc:options-add-date-interval!
|
||||
@ -157,24 +152,21 @@
|
||||
optname-start-date optname-end-date "c")
|
||||
|
||||
;; accounts to work on
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
;; select, by default, only income and expense accounts
|
||||
(list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
|
||||
(gnc:options-add-account-levels!
|
||||
options gnc:pagename-accounts optname-depth-limit
|
||||
"b" opthelp-depth-limit 3)
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-bottom-behavior
|
||||
"c" opthelp-bottom-behavior #f))
|
||||
"c" opthelp-bottom-behavior #f)
|
||||
|
||||
;; all about currencies
|
||||
(gnc:options-add-currency!
|
||||
@ -184,26 +176,22 @@
|
||||
(gnc:options-add-price-source!
|
||||
options pagename-commodities
|
||||
optname-price-source "b" 'pricedb-nearest)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #t))
|
||||
"c" opthelp-show-foreign #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"d" opthelp-show-rates #f))
|
||||
|
||||
"d" opthelp-show-rates #f)
|
||||
|
||||
;; what to show for zero-balance accounts
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-show-zb-accts
|
||||
"a" opthelp-show-zb-accts #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"a" opthelp-show-zb-accts #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-omit-zb-bals
|
||||
"b" opthelp-omit-zb-bals #f))
|
||||
"b" opthelp-omit-zb-bals #f)
|
||||
;; what to show for non-leaf accounts
|
||||
(gnc:options-add-subtotal-view!
|
||||
options gnc:pagename-display
|
||||
@ -211,68 +199,55 @@
|
||||
"c")
|
||||
|
||||
;; some detailed formatting options
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-links
|
||||
"e" opthelp-account-links #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"e" opthelp-account-links #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-use-rules
|
||||
"f" opthelp-use-rules #f))
|
||||
"f" opthelp-use-rules #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-revenue
|
||||
"g" opthelp-label-revenue #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"g" opthelp-label-revenue #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-revenue
|
||||
"h" opthelp-total-revenue #t))
|
||||
"h" opthelp-total-revenue #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-trading
|
||||
"h1" opthelp-label-trading #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"h1" opthelp-label-trading #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-trading
|
||||
"h2" opthelp-total-trading #t))
|
||||
"h2" opthelp-total-trading #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-label-expense
|
||||
"i" opthelp-label-expense #t))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"i" opthelp-label-expense #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-total-expense
|
||||
"j" opthelp-total-expense #t))
|
||||
"j" opthelp-total-expense #t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-two-column
|
||||
"k" opthelp-two-column #f))
|
||||
"k" opthelp-two-column #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-standard-order
|
||||
"l" opthelp-standard-order #t))
|
||||
"l" opthelp-standard-order #t)
|
||||
|
||||
;; closing entry match criteria
|
||||
;;
|
||||
;; N.B.: transactions really should have a field where we can put
|
||||
;; transaction types like "Adjusting/Closing/Correcting Entries"
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
pagename-entries optname-closing-pattern
|
||||
"a" opthelp-closing-pattern (G_ "Closing Entries")))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"a" opthelp-closing-pattern (G_ "Closing Entries"))
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-closing-casing
|
||||
"b" opthelp-closing-casing #f))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"b" opthelp-closing-casing #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-closing-regexp
|
||||
"c" opthelp-closing-regexp #f))
|
||||
"c" opthelp-closing-regexp #f)
|
||||
|
||||
;; Set the accounts page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-accounts)
|
||||
@ -286,9 +261,8 @@
|
||||
|
||||
(define (income-statement-renderer-internal report-obj reportname)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -69,8 +69,7 @@
|
||||
|
||||
(define (build-column-used options)
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
(vector
|
||||
(opt-val "Display Columns" "Date")
|
||||
(opt-val "Display Columns" "Description")
|
||||
@ -167,218 +166,178 @@
|
||||
(gnc:multiline-to-html-text str))
|
||||
|
||||
(define (options-generator variant)
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
(define gnc:*report-options* (gnc:new-options))
|
||||
(gnc-register-invoice-option options
|
||||
gnc:pagename-general
|
||||
gnc:optname-invoice-number "x" "" '())
|
||||
|
||||
(define (gnc:register-inv-option new-option)
|
||||
(gnc:register-option gnc:*report-options* new-option))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-invoice-option gnc:pagename-general gnc:optname-invoice-number "x" ""
|
||||
(lambda () '()) #f))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general (N_ "Custom Title")
|
||||
"z" (N_ "A custom string to replace Invoice, Bill or Expense Voucher.")
|
||||
""))
|
||||
"")
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-text-option
|
||||
(gnc-register-text-option options
|
||||
(N_ "Layout") (N_ "CSS") "zz" (N_ "CSS code. This field specifies the CSS code \
|
||||
for styling the invoice. Please see the exported report for the CSS class names.")
|
||||
(keylist-get-info variant-list variant 'css)))
|
||||
(keylist-get-info variant-list variant 'css))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-pixmap-option
|
||||
(gnc-register-pixmap-option options
|
||||
(N_ "Layout") (N_ "Picture Location") "zy" (N_ "Location for Picture")
|
||||
""))
|
||||
"")
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Date")
|
||||
"b" (N_ "Display the date?") #t))
|
||||
"b" (N_ "Display the date?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Description")
|
||||
"d" (N_ "Display the description?") #t))
|
||||
"d" (N_ "Display the description?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Action")
|
||||
"g" (N_ "Display the action?") #t))
|
||||
"g" (N_ "Display the action?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Quantity")
|
||||
"ha" (N_ "Display the quantity of items?") #t))
|
||||
"ha" (N_ "Display the quantity of items?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Price")
|
||||
"hb" (N_ "Display the price per item?") #t))
|
||||
"hb" (N_ "Display the price per item?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Discount")
|
||||
"k" (N_ "Display the entry's discount?") #t))
|
||||
"k" (N_ "Display the entry's discount?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Taxable")
|
||||
"l" (N_ "Display the entry's taxable status?") #t))
|
||||
"l" (N_ "Display the entry's taxable status?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Tax Amount")
|
||||
"m" (N_ "Display each entry's total total tax?") #f))
|
||||
"m" (N_ "Display each entry's total total tax?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") (N_ "Total")
|
||||
"n" (N_ "Display the entry's value?") #t))
|
||||
"n" (N_ "Display the entry's value?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Due Date")
|
||||
"c" (N_ "Display due date?") #t))
|
||||
"c" (N_ "Display due date?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Subtotal")
|
||||
"d" (N_ "Display the subtotals?") #t))
|
||||
"d" (N_ "Display the subtotals?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-complex-boolean-option
|
||||
(gnc-register-complex-boolean-option options
|
||||
(N_ "Display") (N_ "Payable to")
|
||||
"ua1" (N_ "Display the Payable to: information.") #f #f
|
||||
"ua1" (N_ "Display the Payable to: information.") #f
|
||||
(lambda (x)
|
||||
(gnc-option-db-set-option-selectable-by-name
|
||||
gnc:*report-options* "Display" "Payable to string" x))))
|
||||
(gnc-optiondb-set-option-selectable-by-name
|
||||
options "Display" "Payable to string" x)))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-text-option
|
||||
(gnc-register-text-option options
|
||||
(N_ "Display") (N_ "Payable to string")
|
||||
"ua2" (N_ "The phrase for specifying to whom payments should be made.")
|
||||
(G_ "Please make all checks payable to")))
|
||||
(G_ "Please make all checks payable to"))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-complex-boolean-option
|
||||
(gnc-register-complex-boolean-option options
|
||||
(N_ "Display") (N_ "Company contact")
|
||||
"ub1" (N_ "Display the Company contact information.") #f #f
|
||||
(lambda (x) (gnc-option-db-set-option-selectable-by-name
|
||||
gnc:*report-options* "Display" "Company contact string" x))))
|
||||
"ub1" (N_ "Display the Company contact information.") #f
|
||||
(lambda (x) (gnc-optiondb-set-option-selectable-by-name
|
||||
options "Display" "Company contact string" x)))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-text-option
|
||||
(gnc-register-text-option options
|
||||
(N_ "Display") (N_ "Company contact string")
|
||||
"ub2" (N_ "The phrase used to introduce the company contact.")
|
||||
(G_ "Please direct all enquiries to")))
|
||||
(G_ "Please direct all enquiries to"))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
(N_ "Display") (N_ "Minimum # of entries")
|
||||
"zz" (N_ "The minimum number of invoice entries to display.") 1
|
||||
0 23 0 1))
|
||||
0 23 1)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Use Detailed Tax Summary")
|
||||
"o" (N_ "Display all tax categories separately (one per line) instead of one single tax line.?") #f))
|
||||
"o" (N_ "Display all tax categories separately (one per line) instead of one single tax line.?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "References")
|
||||
"s" (N_ "Display the invoice references?") #t))
|
||||
"s" (N_ "Display the invoice references?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Billing Terms")
|
||||
"t" (N_ "Display the invoice billing terms?") #t))
|
||||
"t" (N_ "Display the invoice billing terms?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Billing ID")
|
||||
"ta" (N_ "Display the billing id?") #t))
|
||||
"ta" (N_ "Display the billing id?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Invoice owner ID")
|
||||
"tam" (N_ "Display the customer/vendor id?") #f))
|
||||
"tam" (N_ "Display the customer/vendor id?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Invoice Notes")
|
||||
"tb" (N_ "Display the invoice notes?") #f))
|
||||
"tb" (N_ "Display the invoice notes?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Payments")
|
||||
"tc" (N_ "Display the payments applied to this invoice?") #t))
|
||||
"tc" (N_ "Display the payments applied to this invoice?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Job Details")
|
||||
"td" (N_ "Display the job name for this invoice?") #f))
|
||||
"td" (N_ "Display the job name for this invoice?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-text-option
|
||||
(gnc-register-text-option options
|
||||
(N_ "Display") (N_ "Extra Notes")
|
||||
"u" (N_ "Extra notes to put on the invoice.")
|
||||
(G_ "Thank you for your patronage!")))
|
||||
(G_ "Thank you for your patronage!"))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Layout") (N_ "Row 1 Left")
|
||||
"1a" "1st row, left"
|
||||
(keylist-get-info variant-list variant '1a)
|
||||
(keylist->vectorlist layout-key-list)))
|
||||
(symbol->string (keylist-get-info variant-list variant '1a))
|
||||
(keylist->vectorlist layout-key-list))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Layout") (N_ "Row 1 Right")
|
||||
"1b" "1st row, right"
|
||||
(keylist-get-info variant-list variant '1b)
|
||||
(keylist->vectorlist layout-key-list)))
|
||||
(symbol->string (keylist-get-info variant-list variant '1b))
|
||||
(keylist->vectorlist layout-key-list))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Layout") (N_ "Row 2 Left")
|
||||
"2a" "2nd row, left"
|
||||
(keylist-get-info variant-list variant '2a)
|
||||
(keylist->vectorlist layout-key-list)))
|
||||
(symbol->string (keylist-get-info variant-list variant '2a))
|
||||
(keylist->vectorlist layout-key-list))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Layout") (N_ "Row 2 Right")
|
||||
"2b" "2nd row, right"
|
||||
(keylist-get-info variant-list variant '2b)
|
||||
(keylist->vectorlist layout-key-list)))
|
||||
(symbol->string (keylist-get-info variant-list variant '2b))
|
||||
(keylist->vectorlist layout-key-list))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Layout") (N_ "Row 3 Left")
|
||||
"3a" "3rd row, left"
|
||||
(keylist-get-info variant-list variant '3a)
|
||||
(keylist->vectorlist layout-key-list)))
|
||||
(symbol->string (keylist-get-info variant-list variant '3a))
|
||||
(keylist->vectorlist layout-key-list))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Layout") (N_ "Row 3 Right")
|
||||
"3b" "3rd row, right"
|
||||
(keylist-get-info variant-list variant '3b)
|
||||
(keylist->vectorlist layout-key-list)))
|
||||
(symbol->string (keylist-get-info variant-list variant '3b))
|
||||
(keylist->vectorlist layout-key-list))
|
||||
|
||||
(gnc:options-set-default-section gnc:*report-options* "General")
|
||||
|
||||
gnc:*report-options*)
|
||||
(gnc:options-set-default-section options "General")
|
||||
|
||||
options))
|
||||
|
||||
(define (make-entry-table invoice options cust-doc? credit-note?)
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
|
||||
(let ((show-payments (opt-val "Display" "Payments"))
|
||||
(display-all-taxes (opt-val "Display" "Use Detailed Tax Summary"))
|
||||
@ -574,8 +533,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
|
||||
(define (make-invoice-details-table invoice options)
|
||||
;; dual-column. invoice date/due, billingID, terms, job name/number
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
(let* ((invoice-details-table (gnc:make-html-table))
|
||||
(book (gncInvoiceGetBook invoice))
|
||||
(date-format (gnc:options-fancy-date book))
|
||||
@ -648,8 +606,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
|
||||
|
||||
(define (make-client-table owner orders options)
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
;; this is a single-column table.
|
||||
(let ((table (gnc:make-html-table)))
|
||||
|
||||
@ -702,7 +659,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
|
||||
(fax (gnc:company-info book gnc:*company-fax*))
|
||||
(email (gnc:company-info book gnc:*company-email*))
|
||||
(url (gnc:company-info book gnc:*company-url*))
|
||||
(taxnr (gnc:option-get-value book gnc:*tax-label* gnc:*tax-nr-label*))
|
||||
(taxnr (gnc:book-get-option-value book gnc:*tax-label* gnc:*tax-nr-label*))
|
||||
(taxid (gnc:company-info book gnc:*company-id*)))
|
||||
|
||||
(if (and name (not (string-null? name)))
|
||||
@ -750,7 +707,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
|
||||
(define (reg-renderer report-obj)
|
||||
(let* ((document (gnc:make-html-document))
|
||||
(options (gnc:report-options report-obj))
|
||||
(opt-val (lambda (section name) (gnc:option-value (gnc:lookup-option options section name))))
|
||||
(opt-val (lambda (section name) (gnc-optiondb-lookup-value options section name)))
|
||||
(invoice (opt-val gnc:pagename-general gnc:optname-invoice-number))
|
||||
(references? (opt-val "Display" "References"))
|
||||
(custom-title (opt-val gnc:pagename-general "Custom Title")))
|
||||
|
@ -44,25 +44,20 @@
|
||||
(cons TXN-TYPE-LINK "Link")))
|
||||
|
||||
(define (options-generator)
|
||||
(let ((options (gnc:new-options)))
|
||||
|
||||
(define (add-option new-option)
|
||||
(gnc:register-option options new-option))
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
;; General tab
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general
|
||||
optname-from-date optname-to-date "a")
|
||||
|
||||
(add-option
|
||||
(gnc:make-account-sel-option
|
||||
(gnc-register-account-sel-limited-option options
|
||||
gnc:pagename-general optname-account "b"
|
||||
(N_ "The account to search for lots.")
|
||||
#f #f))
|
||||
'() '())
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
gnc:pagename-general optname-desc-filter "b" "Description Filter" ""))
|
||||
(gnc-register-string-option options
|
||||
gnc:pagename-general optname-desc-filter "b" "Description Filter" "")
|
||||
|
||||
options))
|
||||
|
||||
@ -70,8 +65,7 @@
|
||||
|
||||
;; This is a helper function for looking up option values.
|
||||
(define (get-option section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(define (get-all-lots splits)
|
||||
(define lots-seen (make-hash-table))
|
||||
|
@ -62,12 +62,7 @@
|
||||
(define optname-y-grid (N_ "Grid"))
|
||||
|
||||
(define (options-generator inc-exp? linechart?)
|
||||
(let* ((options (gnc:new-options))
|
||||
;; This is just a helper function for making options.
|
||||
;; See libgnucash/scm/options.scm for details.
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
;; General tab
|
||||
(gnc:options-add-date-interval!
|
||||
@ -85,54 +80,44 @@
|
||||
optname-price-source "d" 'weighted-average)
|
||||
|
||||
;; Account tab
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
(N_ "Report on these accounts, if chosen account level allows.")
|
||||
(lambda ()
|
||||
(filter
|
||||
(if inc-exp?
|
||||
gnc:account-is-inc-exp?
|
||||
(lambda (account) (not (gnc:account-is-inc-exp? account))))
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
(lambda (accounts)
|
||||
(list #t
|
||||
(filter
|
||||
(if inc-exp?
|
||||
gnc:account-is-inc-exp?
|
||||
(lambda (account)
|
||||
(not (gnc:account-is-inc-exp? account))))
|
||||
accounts)))
|
||||
#t))
|
||||
|
||||
(gnc-register-account-list-option
|
||||
options gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
(N_ "Report on these accounts, if chosen account level allows.")
|
||||
(if inc-exp?
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
|
||||
|
||||
(filter
|
||||
(lambda (account) (not (gnc:account-is-inc-exp? account)))
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))))
|
||||
|
||||
;; Display tab
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display
|
||||
(if inc-exp? optname-inc-exp optname-sep-bars)
|
||||
"a"
|
||||
(if inc-exp?
|
||||
(N_ "Show Income and Expenses?")
|
||||
(N_ "Show the Asset and the Liability bars?"))
|
||||
#t))
|
||||
#t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display
|
||||
(if inc-exp? optname-show-profit optname-net-bars)
|
||||
"b"
|
||||
(if inc-exp?
|
||||
(N_ "Show the net profit?")
|
||||
(N_ "Show a Net Worth bar?"))
|
||||
#t))
|
||||
#t)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display
|
||||
(N_ "Show table")
|
||||
"c" (N_ "Display a table of the selected data.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
(gnc:options-add-plot-size!
|
||||
options gnc:pagename-display
|
||||
@ -141,30 +126,25 @@
|
||||
(if linechart?
|
||||
(begin
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-display optname-line-width
|
||||
"e" opthelp-line-width
|
||||
1.5 0.5 5 1 0.1 ))
|
||||
1.5 0.5 5 0.1 )
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-y-grid
|
||||
"f" (N_ "Add grid lines.")
|
||||
#t))
|
||||
#t)
|
||||
|
||||
;;(add-option
|
||||
;; (gnc:make-simple-boolean-option
|
||||
;;(gnc-register-simple-boolean-option options
|
||||
;; gnc:pagename-display optname-x-grid
|
||||
;; "g" (N_ "Add vertical grid lines.")
|
||||
;; #f))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-markers
|
||||
"g" (N_ "Display a mark for each data point.")
|
||||
#t))
|
||||
|
||||
#t)
|
||||
))
|
||||
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
@ -181,8 +161,7 @@
|
||||
|
||||
;; This is a helper function for looking up option values.
|
||||
(define (get-option section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(gnc:report-starting "INC/EXP & A/L Charts")
|
||||
(let* ((to-date-t64 (gnc:time64-end-day-time
|
||||
|
@ -76,60 +76,55 @@ exist but have no suitable transactions."))
|
||||
(qof-query-set-sort-increasing query #t #t #t))
|
||||
|
||||
(define (aging-options-generator options)
|
||||
(let* ((add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
|
||||
(gnc:options-add-report-date!
|
||||
options gnc:pagename-general optname-to-date "a")
|
||||
|
||||
;; Use a default report date of 'today'
|
||||
(gnc:option-set-default-value
|
||||
(gnc:lookup-option options gnc:pagename-general optname-to-date)
|
||||
(GncOption-set-default-value
|
||||
(gnc-lookup-option options gnc:pagename-general optname-to-date)
|
||||
(cons 'relative 'today))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
gnc:pagename-general optname-sort-by "i" (N_ "Sort companies by.") 'name
|
||||
(gnc-register-multichoice-option
|
||||
options
|
||||
gnc:pagename-general optname-sort-by "i" (N_ "Sort companies by.")
|
||||
"name"
|
||||
(list
|
||||
(vector 'name (N_ "Name of the company"))
|
||||
(vector 'total (N_ "Total amount owed to/from Company"))
|
||||
(vector 'oldest-bracket (N_ "Bracket Total Owed")))))
|
||||
(vector 'oldest-bracket (N_ "Bracket Total Owed"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
gnc:pagename-general optname-sort-order "ia" (N_ "Sort order.") 'increasing
|
||||
(list
|
||||
(vector 'increasing (N_ "Ascending"))
|
||||
(vector 'decreasing (N_ "Descending")))))
|
||||
(gnc-register-multichoice-option
|
||||
options gnc:pagename-general optname-sort-order "ia" (N_ "Sort order.")
|
||||
"increasing"
|
||||
(list
|
||||
(vector 'increasing (N_ "Ascending"))
|
||||
(vector 'decreasing (N_ "Descending"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-general optname-show-zeros "j"
|
||||
(N_ "Show all vendors/customers even if they have a zero balance.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
gnc:pagename-general optname-date-driver "k" (N_ "Leading date.") 'duedate
|
||||
(gnc-register-multichoice-option
|
||||
options gnc:pagename-general optname-date-driver "k" (N_ "Leading date.")
|
||||
"duedate"
|
||||
(list
|
||||
(vector 'duedate (N_ "Due Date"))
|
||||
(vector 'postdate (N_ "Post Date")))))
|
||||
(vector 'postdate (N_ "Post Date"))))
|
||||
|
||||
(gnc:options-set-default-section options "General")
|
||||
|
||||
(for-each
|
||||
(lambda (opt)
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
gnc:pagename-display (car opt) (cadr opt) (caddr opt) #f)))
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display (car opt) (cadr opt) (caddr opt) #f))
|
||||
addr-options-list)
|
||||
|
||||
options))
|
||||
options)
|
||||
|
||||
(define (options->address options receivable? owner)
|
||||
(define (op-value name)
|
||||
(gnc:option-value (gnc:lookup-option options gnc:pagename-display name)))
|
||||
(gnc-optiondb-lookup-value options gnc:pagename-display name))
|
||||
(let* ((address-list-names (map car addr-options-list))
|
||||
(address-list-options (map op-value address-list-names))
|
||||
(addr-source (if receivable? (op-value optname-addr-source) 'billing))
|
||||
@ -173,7 +168,7 @@ exist but have no suitable transactions."))
|
||||
(define (aging-renderer report-obj receivable)
|
||||
(define options (gnc:report-options report-obj))
|
||||
(define (op-value section name)
|
||||
(gnc:option-value (gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
|
||||
(define make-heading-list
|
||||
(list (G_ "Company")
|
||||
@ -390,19 +385,18 @@ exist but have no suitable transactions."))
|
||||
document))
|
||||
|
||||
(define (payable-options-generator)
|
||||
(aging-options-generator (gnc:new-options)))
|
||||
(aging-options-generator (gnc-new-optiondb)))
|
||||
|
||||
(define (receivable-options-generator)
|
||||
(let ((options (aging-options-generator (gnc:new-options))))
|
||||
(define (add-option new-option)
|
||||
(gnc:register-option options new-option))
|
||||
(let ((options (aging-options-generator (gnc-new-optiondb))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
gnc:pagename-display optname-addr-source "a" (N_ "Address source.") 'billing
|
||||
(list
|
||||
(vector 'billing (N_ "Billing address"))
|
||||
(vector 'shipping (N_ "Shipping address")))))
|
||||
(gnc-register-multichoice-option
|
||||
options gnc:pagename-display optname-addr-source "a"
|
||||
(N_ "Address source.")
|
||||
"billing"
|
||||
(list
|
||||
(vector 'billing (N_ "Billing address"))
|
||||
(vector 'shipping (N_ "Shipping address"))))
|
||||
options))
|
||||
|
||||
(define (payables-renderer report-obj)
|
||||
@ -433,19 +427,17 @@ exist but have no suitable transactions."))
|
||||
'in-menu? #t)
|
||||
|
||||
(define (receivables-report-create-internal acct title show-zeros?)
|
||||
(let* ((options (gnc:make-report-options receivables-aging-guid))
|
||||
(zero-op (gnc:lookup-option options gnc:pagename-general optname-show-zeros))
|
||||
(title-op (gnc:lookup-option options gnc:pagename-general gnc:optname-reportname)))
|
||||
(when title (gnc:option-set-value title-op title))
|
||||
(gnc:option-set-value zero-op show-zeros?)
|
||||
(let* ((options (gnc:make-report-options receivables-aging-guid)))
|
||||
(when title (gnc-set-option-set-value
|
||||
options gnc:pagename-general gnc:optname-reportname title))
|
||||
(gnc-set-option options gnc:pagename-general optname-show-zeros show-zeros?)
|
||||
(gnc:make-report receivables-aging-guid options)))
|
||||
|
||||
(define (payables-report-create-internal acct title show-zeros?)
|
||||
(let* ((options (gnc:make-report-options payables-aging-guid))
|
||||
(zero-op (gnc:lookup-option options gnc:pagename-general optname-show-zeros))
|
||||
(title-op (gnc:lookup-option options gnc:pagename-general gnc:optname-reportname)))
|
||||
(when title (gnc:option-set-value title-op title))
|
||||
(gnc:option-set-value zero-op show-zeros?)
|
||||
(let* ((options (gnc:make-report-options payables-aging-guid)))
|
||||
(when title (gnc-set-option
|
||||
options gnc:pagename-general gnc:optname-reportname title))
|
||||
(gnc-set-option options gnc:pagename-general optname-show-zeros show-zeros?)
|
||||
(gnc:make-report payables-aging-guid options)))
|
||||
|
||||
(define (gnc:receivables-create-internal
|
||||
|
@ -186,8 +186,7 @@
|
||||
|
||||
(define (build-column-used options)
|
||||
(define (opt-val name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options "Display Columns" name)))
|
||||
(gnc-optiondb-lookup-value options "Display Columns" name))
|
||||
(list->vector
|
||||
(map opt-val
|
||||
(list date-header due-date-header reference-header type-header
|
||||
@ -856,79 +855,62 @@ and do not match the transaction."))))))))
|
||||
sale))))))
|
||||
|
||||
(define (options-generator owner-type)
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
(define gnc:*report-options* (gnc:new-options))
|
||||
|
||||
(define (gnc:register-inv-option new-option)
|
||||
(gnc:register-option gnc:*report-options* new-option))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-owner-option
|
||||
(gnc-register-owner-option options
|
||||
owner-page (owner-string owner-type) "v"
|
||||
(N_ "The company for this report.")
|
||||
(lambda () '()) #f owner-type))
|
||||
(N_ "The company for this report.") '() owner-type)
|
||||
|
||||
(gnc:options-add-date-interval!
|
||||
gnc:*report-options* gnc:pagename-general
|
||||
options gnc:pagename-general
|
||||
optname-from-date optname-to-date "a")
|
||||
|
||||
;; Use a default report date of 'today'
|
||||
(gnc:option-set-default-value
|
||||
(gnc:lookup-option gnc:*report-options* gnc:pagename-general optname-to-date)
|
||||
(GncOption-set-default-value
|
||||
(gnc-lookup-option options gnc:pagename-general optname-to-date)
|
||||
(cons 'relative 'today))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") date-header
|
||||
"b" (N_ "Display the transaction date?") #t))
|
||||
"b" (N_ "Display the transaction date?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") due-date-header
|
||||
"c" (N_ "Display the transaction date?") #t))
|
||||
"c" (N_ "Display the transaction date?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") reference-header
|
||||
"d" (N_ "Display the transaction reference?") #t))
|
||||
"d" (N_ "Display the transaction reference?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") type-header
|
||||
"g" (N_ "Display the transaction type?") #t))
|
||||
"g" (N_ "Display the transaction type?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") desc-header
|
||||
"ha" (N_ "Display the transaction description?") #t))
|
||||
"ha" (N_ "Display the transaction description?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") sale-header
|
||||
"haa" (N_ "Display the sale amount column?") #f))
|
||||
"haa" (N_ "Display the sale amount column?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") tax-header
|
||||
"hab" (N_ "Display the tax column?") #f))
|
||||
"hab" (N_ "Display the tax column?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") debit-header
|
||||
"hac" (N_ "Display the period debits column?") #t))
|
||||
"hac" (N_ "Display the period debits column?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") credit-header
|
||||
"had" (N_ "Display the period credits column?") #t))
|
||||
"had" (N_ "Display the period credits column?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") balance-header
|
||||
"hb" (N_ "Display a running balance?") #t))
|
||||
"hb" (N_ "Display a running balance?") #t)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Display Columns") linked-txns-header
|
||||
"hc"
|
||||
(string-join
|
||||
@ -938,27 +920,25 @@ and do not match the transaction."))))))))
|
||||
(G_ "Invoices show if paid, payments show invoice numbers.")
|
||||
(G_ "Invoices show list of payments, payments show list of invoices and amounts."))
|
||||
"\n* ")
|
||||
'none
|
||||
"none"
|
||||
(list (vector 'none (N_ "Disabled"))
|
||||
(vector 'simple (N_ "Simple"))
|
||||
(vector 'detailed (N_ "Detailed")))))
|
||||
(vector 'detailed (N_ "Detailed"))))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display Columns") doclink-header
|
||||
"hd" (N_ "Display document link?") #f))
|
||||
"hd" (N_ "Display document link?") #f)
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-date-driver "k"
|
||||
(N_ "Leading date.") 'duedate
|
||||
(N_ "Leading date.") "duedate"
|
||||
(list
|
||||
(vector 'duedate (N_ "Due Date"))
|
||||
(vector 'postdate (N_ "Post Date")))))
|
||||
(vector 'postdate (N_ "Post Date"))))
|
||||
|
||||
(gnc:options-set-default-section gnc:*report-options* "General")
|
||||
(gnc:options-set-default-section options "General")
|
||||
|
||||
gnc:*report-options*)
|
||||
options))
|
||||
|
||||
(define (setup-query q owner accounts end-date job?)
|
||||
(let ((guid (gncOwnerReturnGUID (if job? owner (gncOwnerGetEndOwner owner))))
|
||||
@ -1020,8 +1000,7 @@ and do not match the transaction."))))))))
|
||||
(define (reg-renderer report-obj type)
|
||||
(define options (gnc:report-options report-obj))
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
|
||||
(let* ((start-date (gnc:time64-start-day-time
|
||||
(gnc:date-option-absolute-time
|
||||
@ -1032,9 +1011,7 @@ and do not match the transaction."))))))))
|
||||
(book (gnc-get-current-book))
|
||||
(date-format (gnc:options-fancy-date (gnc-get-current-book)))
|
||||
(used-columns (build-column-used options))
|
||||
(link-option
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options "Display Columns" linked-txns-header)))
|
||||
(link-option (opt-val "Display Columns" linked-txns-header))
|
||||
(owner-descr (owner-string type))
|
||||
(date-type (opt-val gnc:pagename-general optname-date-driver))
|
||||
(owner (opt-val owner-page owner-descr))
|
||||
@ -1221,13 +1198,12 @@ and do not match the transaction."))))))))
|
||||
|
||||
|
||||
(define (owner-report-create-internal report-guid owner owner-type enddate)
|
||||
(let* ((options (gnc:make-report-options report-guid))
|
||||
(owner-op (gnc:lookup-option options owner-page (owner-string owner-type)))
|
||||
(date-op (gnc:lookup-option options gnc:pagename-general optname-to-date)))
|
||||
(let* ((options (gnc:make-report-options report-guid)))
|
||||
|
||||
(gnc:option-set-value owner-op owner)
|
||||
(gnc-set-option options owner-page (owner-string owner-type) owner)
|
||||
(when enddate
|
||||
(gnc:option-set-value date-op (cons 'absolute enddate)))
|
||||
(gnc-set-option options gnc:pagename-general optname-to-date
|
||||
(cons 'absolute enddate)))
|
||||
(gnc:make-report report-guid options)))
|
||||
|
||||
(define (owner-report-create-with-enddate owner account enddate)
|
||||
|
@ -37,12 +37,7 @@
|
||||
(define optname-zero-shares (N_ "Include accounts with no shares"))
|
||||
|
||||
(define (options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
;; This is just a helper function for making options.
|
||||
;; See libgnucash/scm/options.scm for details.
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
;; General Tab
|
||||
;; date at which to report balance
|
||||
@ -57,31 +52,25 @@
|
||||
options gnc:pagename-general
|
||||
optname-price-source "d" 'pricedb-latest)
|
||||
|
||||
(add-option
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
gnc:pagename-general optname-shares-digits
|
||||
"e" (N_ "The number of decimal places to use for share numbers.") 2
|
||||
0 9 0 1))
|
||||
0 9 1)
|
||||
|
||||
;; Account tab
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-limited-option options
|
||||
gnc:pagename-accounts (N_ "Accounts")
|
||||
"b"
|
||||
(N_ "Stock Accounts to report on.")
|
||||
(lambda () (filter gnc:account-is-stock?
|
||||
(gnc-account-get-descendants-sorted
|
||||
(gnc-get-current-root-account))))
|
||||
(lambda (accounts) (list #t
|
||||
(filter gnc:account-is-stock? accounts)))
|
||||
#t))
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
|
||||
(list ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL))
|
||||
|
||||
(gnc:register-option
|
||||
options
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-accounts optname-zero-shares "e"
|
||||
(N_ "Include accounts that have a zero share balances.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
options))
|
||||
@ -98,11 +87,9 @@
|
||||
(work-to-do 0))
|
||||
|
||||
;; These are some helper functions for looking up option values.
|
||||
(define (get-op section name)
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name))
|
||||
|
||||
(define (get-option section name)
|
||||
(gnc:option-value (get-op section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(define (table-add-stock-rows table accounts to-date currency
|
||||
exchange-fn price-fn include-empty collector)
|
||||
|
@ -49,11 +49,7 @@
|
||||
(define optname-plot-height (N_ "Plot Height"))
|
||||
|
||||
(define (options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
;; This is just a helper function for making options.
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
|
||||
(gnc:options-add-date-interval!
|
||||
options gnc:pagename-general
|
||||
@ -65,28 +61,25 @@
|
||||
(gnc:options-add-currency!
|
||||
options pagename-price optname-report-currency "d")
|
||||
|
||||
(add-option
|
||||
(gnc:make-commodity-option
|
||||
(gnc-register-commodity-option options
|
||||
pagename-price optname-price-commodity
|
||||
"e"
|
||||
(N_ "Calculate the price of this commodity.")
|
||||
(gnc-locale-default-iso-currency-code)))
|
||||
(gnc-locale-default-iso-currency-code))
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
pagename-price optname-price-source
|
||||
"f" (N_ "The source of price information.")
|
||||
'actual-transactions
|
||||
"actual-transactions"
|
||||
(list (vector 'weighted-average (N_ "Weighted Average"))
|
||||
(vector 'actual-transactions (N_ "Actual Transactions"))
|
||||
(vector 'pricedb (N_ "Price Database")))))
|
||||
(vector 'pricedb (N_ "Price Database"))))
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-price optname-invert
|
||||
"g"
|
||||
(N_ "Plot commodity per currency rather than currency per commodity.")
|
||||
#f))
|
||||
#f)
|
||||
|
||||
|
||||
(gnc:options-add-plot-size!
|
||||
@ -97,13 +90,11 @@
|
||||
options gnc:pagename-display
|
||||
optname-marker "a" 'filledsquare)
|
||||
|
||||
(add-option
|
||||
(gnc:make-color-option
|
||||
(gnc-register-color-option options
|
||||
gnc:pagename-display optname-markercolor
|
||||
"b"
|
||||
(N_ "Color of the marker.")
|
||||
(list #xb2 #x22 #x22 #xff)
|
||||
255 #f))
|
||||
"b22222")
|
||||
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
|
||||
@ -115,8 +106,7 @@
|
||||
|
||||
;; This is a helper function for looking up option values.
|
||||
(define (get-option section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(define intervals
|
||||
(list (list 'DayDelta (G_ "Days") 86400)
|
||||
|
@ -66,88 +66,85 @@
|
||||
|
||||
(define (options-generator)
|
||||
;; Options
|
||||
(define report-options (gnc:new-options))
|
||||
(define (add-option new-option)
|
||||
(gnc:register-option report-options new-option))
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-invoice-option ; defined in gnucash/scm/business-options.scm
|
||||
generalpage gnc:optname-invoice-number
|
||||
"a" "" (lambda () '()) #f))
|
||||
(gnc-register-invoice-option
|
||||
options generalpage gnc:optname-invoice-number "a" "" '())
|
||||
|
||||
;; Display options
|
||||
(add-option (gnc:make-string-option displaypage optname-template-file "a"
|
||||
(N_ "The file name of the eguile template part of this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
|
||||
"receipt.eguile.scm"))
|
||||
(add-option (gnc:make-string-option displaypage optname-css-file "b"
|
||||
(gnc-register-string-option
|
||||
options displaypage optname-template-file "a"
|
||||
(N_ "The file name of the eguile template part of this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
|
||||
"receipt.eguile.scm")
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-css-file "b"
|
||||
(N_ "The file name of the CSS stylesheet to use with this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
|
||||
"receipt.css"))
|
||||
(add-option (gnc:make-font-option
|
||||
"receipt.css")
|
||||
(gnc-register-font-option options
|
||||
displaypage optname-heading-font "c"
|
||||
(N_ "Font to use for the main heading.") "Sans Bold 14"))
|
||||
(add-option (gnc:make-font-option
|
||||
(N_ "Font to use for the main heading.") "Sans Bold 14")
|
||||
(gnc-register-font-option options
|
||||
displaypage optname-text-font "d"
|
||||
(N_ "Font to use for everything else.") "Sans 10"))
|
||||
(add-option (gnc:make-pixmap-option
|
||||
(N_ "Font to use for everything else.") "Sans 10")
|
||||
(gnc-register-pixmap-option options
|
||||
displaypage optname-logofile-header "e"
|
||||
(N_ "Name of a file containing a logo to be used on the header of the report")
|
||||
"Receipt_header.jpg"))
|
||||
(add-option (gnc:make-string-option
|
||||
displaypage optname-logo-width-header "f" (N_ "Width of the header logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm"))
|
||||
(add-option (gnc:make-pixmap-option
|
||||
"Receipt_header.jpg")
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-logo-width-header "f" (N_ "Width of the header logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm")
|
||||
(gnc-register-pixmap-option options
|
||||
displaypage optname-logofile-footer "g"
|
||||
(N_ "Name of a file containing a logo to be used on the footer of the report")
|
||||
"Receipt_footer.jpg"))
|
||||
(add-option (gnc:make-string-option
|
||||
displaypage optname-logo-width-footer "h" (N_ "Width of the footer logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm"))
|
||||
"Receipt_footer.jpg")
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-logo-width-footer "h" (N_ "Width of the footer logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "72mm")
|
||||
|
||||
(add-option (gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-date-format "i"
|
||||
(N_ "The format for the date->string conversion for today's date.")
|
||||
;; Translators: Boost::date_time format string
|
||||
;; "%l:%M %P, %e %B %Y" means " 9:56 pm, 19 June 2019"
|
||||
(G_ "%l:%M %P, %e %B %Y")))
|
||||
(G_ "%l:%M %P, %e %B %Y"))
|
||||
|
||||
;; Heading options
|
||||
(add-option (gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
; page / name / orderkey / tooltip / default
|
||||
headingpage optname-report-title "a" "" (G_ "Invoice")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-units "b" "" (G_ "Units")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-qty "c" "" (G_ "Qty")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-unit-price "d" "" (G_ "Unit Price")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-disc-rate "e" "" (G_ "Discount Rate")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-disc-amount "f" "" (G_ "Discount Amount")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-net-price "g" "" (G_ "Net Price")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-tax-rate "h" "" (G_ "Tax Rate")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-tax-amount "i" "" (G_ "Tax Amount")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-total-price "j" "" (G_ "Total Price")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage2 optname-subtotal "a" "" (G_ "Sub-total")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage2 optname-amount-due "b" "" (G_ "Amount Due")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-report-title "a" "" (G_ "Invoice"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-units "b" "" (G_ "Units"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-qty "c" "" (G_ "Qty"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-unit-price "d" "" (G_ "Unit Price"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-disc-rate "e" "" (G_ "Discount Rate"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-disc-amount "f" "" (G_ "Discount Amount"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-net-price "g" "" (G_ "Net Price"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-tax-rate "h" "" (G_ "Tax Rate"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-tax-amount "i" "" (G_ "Tax Amount"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-total-price "j" "" (G_ "Total Price"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-subtotal "a" "" (G_ "Sub-total"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-amount-due "b" "" (G_ "Amount Due"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-payment-recd "c" ""
|
||||
(G_ "Payment received, thank you!")))
|
||||
(G_ "Payment received, thank you!"))
|
||||
|
||||
(add-option (gnc:make-text-option
|
||||
(gnc-register-text-option options
|
||||
notespage optname-extra-notes "a"
|
||||
(N_ "Notes added at end of invoice -- may contain HTML markup")
|
||||
""))
|
||||
"")
|
||||
;(N_ "(Development version -- don't rely on the numbers on this report without double-checking them.<br/>Change the 'Extra Notes' option to get rid of this message)")))
|
||||
|
||||
(gnc:options-set-default-section
|
||||
report-options generalpage)
|
||||
(gnc:options-set-default-section options generalpage)
|
||||
|
||||
report-options)
|
||||
options))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; Create the report
|
||||
@ -156,10 +153,7 @@
|
||||
;; Create and return the report as either an HTML string
|
||||
;; or an <html-document>
|
||||
(define (opt-value section name)
|
||||
; wrapper for option routines
|
||||
(define (get-opt section name)
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name))
|
||||
(gnc:option-value (get-opt section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
; Get all the options
|
||||
(let* ((document (gnc:make-html-document))
|
||||
|
@ -72,8 +72,7 @@
|
||||
|
||||
(define (build-column-used options)
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
(define (make-set-col col-vector)
|
||||
(let ((col 0))
|
||||
(lambda (used? index)
|
||||
@ -86,7 +85,7 @@
|
||||
(let* ((col-vector (make-vector columns-used-size #f))
|
||||
(set-col (make-set-col col-vector)))
|
||||
(set-col (opt-val "Display" "Date") 0)
|
||||
(set-col (if (gnc:lookup-option options "Display" "Num")
|
||||
(set-col (if (gnc-lookup-option options "Display" "Num")
|
||||
(opt-val "Display" "Num")
|
||||
(opt-val "Display" "Num/Action")) 1)
|
||||
(set-col
|
||||
@ -323,104 +322,86 @@
|
||||
|
||||
|
||||
(define (options-generator)
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
(define gnc:*report-options* (gnc:new-options))
|
||||
(gnc-register-query-option options
|
||||
"__reg" "query" '())
|
||||
(gnc-register-internal-option options
|
||||
"__reg" "journal" #f)
|
||||
(gnc-register-internal-option options
|
||||
"__reg" "ledger-type" #f)
|
||||
(gnc-register-internal-option options
|
||||
"__reg" "double" #f)
|
||||
(gnc-register-internal-option options
|
||||
"__reg" "debit-string" (G_ "Debit"))
|
||||
(gnc-register-internal-option options
|
||||
"__reg" "credit-string" (G_ "Credit"))
|
||||
|
||||
(define (gnc:register-reg-option new-option)
|
||||
(gnc:register-option gnc:*report-options* new-option))
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-query-option "__reg" "query" '()))
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-internal-option "__reg" "journal" #f))
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-internal-option "__reg" "ledger-type" #f))
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-internal-option "__reg" "double" #f))
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-internal-option "__reg" "debit-string" (G_ "Debit")))
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-internal-option "__reg" "credit-string" (G_ "Credit")))
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
(N_ "General") (N_ "Title")
|
||||
"a" (N_ "The title of the report.")
|
||||
(N_ "Register Report")))
|
||||
(N_ "Register Report"))
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Date")
|
||||
"b" (N_ "Display the date?") #t))
|
||||
"b" (N_ "Display the date?") #t)
|
||||
|
||||
(if (qof-book-use-split-action-for-num-field (gnc-get-current-book))
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Num/Action")
|
||||
"c" (N_ "Display the check number/action?") #t))
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"c" (N_ "Display the check number/action?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Num")
|
||||
"c" (N_ "Display the check number?") #t)))
|
||||
"c" (N_ "Display the check number?") #t))
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Description")
|
||||
"d" (N_ "Display the description?") #t))
|
||||
"d" (N_ "Display the description?") #t)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Memo")
|
||||
"e" (N_ "Display the memo?") #t))
|
||||
"e" (N_ "Display the memo?") #t)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Account")
|
||||
"g" (N_ "Display the account?") #t))
|
||||
"g" (N_ "Display the account?") #t)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Shares")
|
||||
"ha" (N_ "Display the number of shares?") #f))
|
||||
"ha" (N_ "Display the number of shares?") #f)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Lot")
|
||||
"hb" (N_ "Display the name of lot the shares are in?") #f))
|
||||
"hb" (N_ "Display the name of lot the shares are in?") #f)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Price")
|
||||
"hc" (N_ "Display the shares price?") #f))
|
||||
"hc" (N_ "Display the shares price?") #f)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
(N_ "Display") (N_ "Amount")
|
||||
"ia" (N_ "Display the amount?")
|
||||
'double
|
||||
"double"
|
||||
(list
|
||||
(vector 'single (N_ "Single Column"))
|
||||
(vector 'double (N_ "Two Columns")))))
|
||||
(vector 'double (N_ "Two Columns"))))
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Value")
|
||||
"ib" (N_ "Display the value in transaction currency?") #f))
|
||||
"ib" (N_ "Display the value in transaction currency?") #f)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Running Balance")
|
||||
"k" (N_ "Display a running balance?") #t))
|
||||
"k" (N_ "Display a running balance?") #t)
|
||||
|
||||
(gnc:register-reg-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
(N_ "Display") (N_ "Totals")
|
||||
"l" (N_ "Display the totals?") #t))
|
||||
"l" (N_ "Display the totals?") #t)
|
||||
|
||||
|
||||
(gnc:options-set-default-section gnc:*report-options* "General")
|
||||
(gnc:options-set-default-section options "General")
|
||||
|
||||
gnc:*report-options*)
|
||||
options))
|
||||
|
||||
;; -----------------------------------------------------------------
|
||||
;; create the report result
|
||||
@ -432,7 +413,7 @@
|
||||
;; local helper
|
||||
;; ----------------------------------
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value (gnc:lookup-option options section name)))
|
||||
(gnc-optiondb-lookup-value options section name))
|
||||
(define (reg-report-journal?)
|
||||
(opt-val "__reg" "journal"))
|
||||
(define (reg-report-ledger-type?)
|
||||
@ -623,8 +604,7 @@
|
||||
|
||||
(define (reg-renderer report-obj)
|
||||
(define (opt-val section name)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
(let* ((document (gnc:make-html-document))
|
||||
(query-scm (opt-val "__reg" "query"))
|
||||
@ -674,7 +654,7 @@
|
||||
double? title debit-string credit-string)
|
||||
(define options (gnc:make-report-options register-report-guid))
|
||||
(define (set-option section name val)
|
||||
(gnc:option-set-value (gnc:lookup-option options section name) val))
|
||||
(gnc-set-option options section name val))
|
||||
|
||||
(when invoice?
|
||||
(issue-deprecation-warning "gnc:register-report-create-internal: invoice \
|
||||
|
@ -114,102 +114,120 @@
|
||||
|
||||
(define (options-generator)
|
||||
;; Options
|
||||
(define report-options (gnc:new-options))
|
||||
(define (add-option new-option)
|
||||
(gnc:register-option report-options new-option))
|
||||
(let ((options (gnc-new-optiondb)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-invoice-option ; defined in gnucash/scm/business-options.scm
|
||||
gnc:pagename-general gnc:optname-invoice-number
|
||||
"a" "" (lambda () '()) #f))
|
||||
(gnc-register-invoice-option options
|
||||
gnc:pagename-general gnc:optname-invoice-number
|
||||
"a" "" '())
|
||||
|
||||
;; Elements page options
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-col-date "a" (N_ "Display the date?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-col-taxrate "b" (N_ "Display the Tax Rate?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-col-units "c" (N_ "Display the Units?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-row-contact "d" (N_ "Display the contact?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-row-address "e" (N_ "Display the address?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-row-invoice-number "f" (N_ "Display the Invoice Number?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-row-company-name "g" (N_ "Display the Company Name?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-invnum-next-to-title "h" (N_ "Invoice Number next to title?") #f))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-jobname-show "i" (N_ "Display Job name?") #t))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-jobnumber-show "j" (N_ "Invoice Job number?") #f))
|
||||
(add-option (gnc:make-simple-boolean-option elementspage optname-netprice "k" (N_ "Show net price?") #f))
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-col-date "a" (N_ "Display the date?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-col-taxrate "b" (N_ "Display the Tax Rate?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-col-units "c" (N_ "Display the Units?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-row-contact "d" (N_ "Display the contact?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-row-address "e" (N_ "Display the address?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-row-invoice-number "f" (N_ "Display the Invoice Number?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-row-company-name "g" (N_ "Display the Company Name?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-invnum-next-to-title "h" (N_ "Invoice Number next to title?") #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-jobname-show "i" (N_ "Display Job name?") #t)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-jobnumber-show "j" (N_ "Invoice Job number?") #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
elementspage optname-netprice "k" (N_ "Show net price?") #f)
|
||||
|
||||
;; Display options
|
||||
(add-option (gnc:make-string-option displaypage optname-template-file "a"
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-template-file "a"
|
||||
(N_ "The file name of the eguile template part of this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
|
||||
"taxinvoice.eguile.scm"))
|
||||
(add-option (gnc:make-string-option displaypage optname-css-file "b"
|
||||
"taxinvoice.eguile.scm")
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-css-file "b"
|
||||
(N_ "The file name of the CSS stylesheet to use with this report. This file should either be in your .gnucash directory, or else in its proper place within the GnuCash installation directories.")
|
||||
"taxinvoice.css"))
|
||||
(add-option (gnc:make-font-option
|
||||
"taxinvoice.css")
|
||||
(gnc-register-font-option options
|
||||
displaypage optname-heading-font "c"
|
||||
(N_ "Font to use for the main heading.") "Sans Bold 18"))
|
||||
(add-option (gnc:make-font-option
|
||||
(N_ "Font to use for the main heading.") "Sans Bold 18")
|
||||
(gnc-register-font-option options
|
||||
displaypage optname-text-font "d"
|
||||
(N_ "Font to use for everything else.") "Sans 10"))
|
||||
(add-option (gnc:make-pixmap-option
|
||||
(N_ "Font to use for everything else.") "Sans 10")
|
||||
(gnc-register-pixmap-option options
|
||||
displaypage optname-logofile "e"
|
||||
(N_ "Name of a file containing a logo to be used on the report.")
|
||||
""))
|
||||
(add-option (gnc:make-string-option
|
||||
displaypage optname-logo-width "f" (N_ "Width of the logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") ""))
|
||||
(add-option (gnc:make-simple-boolean-option displaypage optname-border-collapse "g" (N_ "Border-collapse?") #f))
|
||||
(add-option (gnc:make-string-option displaypage optname-border-color-th "h" (N_ "CSS color.") "black"))
|
||||
(add-option (gnc:make-string-option displaypage optname-border-color-td "i" (N_ "CSS color.") "black"))
|
||||
"")
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-logo-width "f" (N_ "Width of the logo in CSS format, e.g. 10% or 32px. Leave blank to display the logo at its natural width. The height of the logo will be scaled accordingly.") "")
|
||||
(gnc-register-simple-boolean-option options
|
||||
displaypage optname-border-collapse "g" (N_ "Border-collapse?") #f)
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-border-color-th "h" (N_ "CSS color.") "black")
|
||||
(gnc-register-string-option options
|
||||
displaypage optname-border-color-td "i" (N_ "CSS color.") "black")
|
||||
|
||||
;; Heading options
|
||||
(add-option (gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
; page / name / orderkey / tooltip / default
|
||||
headingpage optname-report-title "a" "" (G_ "Invoice")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-units "b" "" (G_ "Units")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-qty "c" "" (G_ "Qty")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-unit-price "d" "" (G_ "Unit Price")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-disc-rate "e" "" (G_ "Discount Rate")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-disc-amount "f" "" (G_ "Discount Amount")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-net-price "g" "" (G_ "Net Price")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-tax-rate "h" "" (G_ "Tax Rate")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-tax-amount "i" "" (G_ "Tax Amount")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-total-price "j" "" (G_ "Total Price")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage2 optname-subtotal "a" "" (G_ "Sub-total")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage2 optname-amount-due "b" "" (G_ "Amount Due")))
|
||||
(add-option (gnc:make-string-option
|
||||
headingpage optname-report-title "a" "" (G_ "Invoice"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-units "b" "" (G_ "Units"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-qty "c" "" (G_ "Qty"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-unit-price "d" "" (G_ "Unit Price"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-disc-rate "e" "" (G_ "Discount Rate"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-disc-amount "f" "" (G_ "Discount Amount"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-net-price "g" "" (G_ "Net Price"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-tax-rate "h" "" (G_ "Tax Rate"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-tax-amount "i" "" (G_ "Tax Amount"))
|
||||
(gnc-register-string-option options
|
||||
headingpage optname-total-price "j" "" (G_ "Total Price"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-subtotal "a" "" (G_ "Sub-total"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-amount-due "b" "" (G_ "Amount Due"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-payment-recd "c" ""
|
||||
(G_ "Payment received, thank you!")))
|
||||
(add-option (gnc:make-string-option headingpage2 optname-invoice-number-text
|
||||
"d" "" (G_ "Invoice number:")))
|
||||
(add-option (gnc:make-string-option headingpage2 optname-to-text
|
||||
"e" "" (G_ "To:")))
|
||||
(add-option (gnc:make-string-option headingpage2 optname-ref-text
|
||||
"f" "" (G_ "Your ref:")))
|
||||
(add-option (gnc:make-string-option headingpage2 optname-jobnumber-text
|
||||
"g" "" (G_ "Job number:")))
|
||||
(add-option (gnc:make-string-option headingpage2 optname-jobname-text
|
||||
"h" "" (G_ "Job name:")))
|
||||
(G_ "Payment received, thank you!"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-invoice-number-text
|
||||
"d" "" (G_ "Invoice number:"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-to-text
|
||||
"e" "" (G_ "To:"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-ref-text
|
||||
"f" "" (G_ "Your ref:"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-jobnumber-text
|
||||
"g" "" (G_ "Job number:"))
|
||||
(gnc-register-string-option options
|
||||
headingpage2 optname-jobname-text
|
||||
"h" "" (G_ "Job name:"))
|
||||
|
||||
(add-option (gnc:make-text-option
|
||||
(gnc-register-text-option options
|
||||
notespage optname-extra-notes "a"
|
||||
(G_ "Notes added at end of invoice -- may contain HTML markup.")
|
||||
(G_ "Thank you for your patronage!")))
|
||||
(G_ "Thank you for your patronage!"))
|
||||
|
||||
(add-option (gnc:make-text-option notespage optname-extra-css "b"
|
||||
(N_ "Embedded CSS.") "h1.coyname { text-align: left; }"))
|
||||
(gnc:options-set-default-section
|
||||
report-options gnc:pagename-general)
|
||||
(gnc-register-text-option options
|
||||
notespage optname-extra-css "b"
|
||||
(N_ "Embedded CSS.") "h1.coyname { text-align: left; }")
|
||||
(gnc:options-set-default-section options gnc:pagename-general)
|
||||
|
||||
report-options)
|
||||
options))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; Create the report
|
||||
@ -218,10 +236,7 @@
|
||||
;; Create and return the report as either an HTML string
|
||||
;; or an <html-document>
|
||||
(define (opt-value section name)
|
||||
; wrapper for option routines
|
||||
(define (get-opt section name)
|
||||
(gnc:lookup-option (gnc:report-options report-obj) section name))
|
||||
(gnc:option-value (get-opt section name)))
|
||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||
|
||||
; Get all the options
|
||||
(let* ((document (gnc:make-html-document))
|
||||
@ -294,8 +309,7 @@
|
||||
|
||||
(define (au-tax-options-generator)
|
||||
(define (set-opt options page name value)
|
||||
(let ((option (gnc:lookup-option options page name)))
|
||||
(gnc:option-set-value option value)))
|
||||
(gnc-set-option options page name value))
|
||||
|
||||
(let ((options (options-generator)))
|
||||
(set-opt options headingpage optname-report-title (G_ "Tax Invoice"))
|
||||
|
@ -23,7 +23,7 @@
|
||||
(test-end "test-average-balance"))
|
||||
|
||||
(define (set-option! options page tag value)
|
||||
((gnc:option-setter (gnc:lookup-option options page tag)) value))
|
||||
(gnc-set-option options page tag value))
|
||||
|
||||
(define (teardown)
|
||||
(gnc-clear-current-session))
|
||||
|
@ -174,20 +174,15 @@
|
||||
|
||||
;; options generator
|
||||
(define (trial-balance-options-generator)
|
||||
(let* ((options (gnc:new-options))
|
||||
(book (gnc-get-current-book))
|
||||
(add-option
|
||||
(lambda (new-option)
|
||||
(gnc:register-option options new-option))))
|
||||
(let* ((options (gnc-new-optiondb))
|
||||
(book (gnc-get-current-book)))
|
||||
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
(N_ "General") optname-report-title
|
||||
"a" opthelp-report-title (G_ reportname)))
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
"a" opthelp-report-title (G_ reportname))
|
||||
(gnc-register-string-option options
|
||||
(N_ "General") optname-party-name
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) "")))
|
||||
"b" opthelp-party-name (or (gnc:company-info book gnc:*company-name*) ""))
|
||||
|
||||
;; the period over which to collect adjusting/closing entries and
|
||||
;; date at which to report the balance
|
||||
@ -195,22 +190,19 @@
|
||||
options gnc:pagename-general
|
||||
optname-start-date optname-end-date "c")
|
||||
|
||||
(add-option
|
||||
(gnc:make-multichoice-option
|
||||
(gnc-register-multichoice-option options
|
||||
gnc:pagename-general optname-report-variant
|
||||
"d" opthelp-report-variant
|
||||
'current
|
||||
"current"
|
||||
(list (vector 'current (N_ "General journal exact balances"))
|
||||
(vector 'pre-adj (N_ "No adjusting/closing entries"))
|
||||
(vector 'work-sheet (N_ "Full end-of-period work sheet")))))
|
||||
(vector 'work-sheet (N_ "Full end-of-period work sheet"))))
|
||||
|
||||
;; accounts to work on
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
gnc:pagename-accounts optname-accounts
|
||||
"a"
|
||||
opthelp-accounts
|
||||
(lambda ()
|
||||
(gnc:filter-accountlist-type
|
||||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT
|
||||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
|
||||
@ -219,30 +211,24 @@
|
||||
ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE
|
||||
ACCT-TYPE-TRADING)
|
||||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
|
||||
#f #t))
|
||||
(gnc:options-add-account-levels!
|
||||
options gnc:pagename-accounts optname-depth-limit
|
||||
"b" opthelp-depth-limit 1)
|
||||
|
||||
;; options for merchandising business work sheets
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
(gnc-register-account-list-option options
|
||||
pagename-merchandising optname-gross-adjustment-accounts
|
||||
"c"
|
||||
opthelp-gross-adjustment-accounts
|
||||
(lambda ()
|
||||
;; Here, it would be useful to have an inventory account type.
|
||||
;; Lacking that, just select no accounts by default.
|
||||
'())
|
||||
#f #t))
|
||||
(add-option
|
||||
(gnc:make-account-list-option
|
||||
;; Here, it would be useful to have an inventory account type.
|
||||
;; Lacking that, just select no accounts by default.
|
||||
'())
|
||||
|
||||
(gnc-register-account-list-option options
|
||||
pagename-merchandising optname-income-summary-accounts
|
||||
"d"
|
||||
opthelp-income-summary-accounts
|
||||
(lambda ()
|
||||
'())
|
||||
#f #t))
|
||||
'())
|
||||
|
||||
;; all about currencies
|
||||
(gnc:options-add-currency!
|
||||
@ -253,56 +239,46 @@
|
||||
options pagename-commodities
|
||||
optname-price-source "b" 'average-cost)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-foreign
|
||||
"c" opthelp-show-foreign #f))
|
||||
"c" opthelp-show-foreign #f)
|
||||
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-commodities optname-show-rates
|
||||
"d" opthelp-show-rates #f))
|
||||
"d" opthelp-show-rates #f)
|
||||
|
||||
;; adjusting/closing entry match criteria
|
||||
;;
|
||||
;; N.B.: transactions really should have a field where we can put
|
||||
;; transaction types like "Adjusting/Closing/Correcting Entries"
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
(gnc-register-string-option options
|
||||
pagename-entries optname-adjusting-pattern
|
||||
"a" opthelp-adjusting-pattern (G_ "Adjusting Entries")))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"a" opthelp-adjusting-pattern (G_ "Adjusting Entries"))
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-adjusting-casing
|
||||
"b" opthelp-adjusting-casing #f))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"b" opthelp-adjusting-casing #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-adjusting-regexp
|
||||
"c" opthelp-adjusting-regexp #f))
|
||||
(add-option
|
||||
(gnc:make-string-option
|
||||
"c" opthelp-adjusting-regexp #f)
|
||||
(gnc-register-string-option options
|
||||
pagename-entries optname-closing-pattern
|
||||
"d" opthelp-closing-pattern (G_ "Closing Entries")))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"d" opthelp-closing-pattern (G_ "Closing Entries"))
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-closing-casing
|
||||
"e" opthelp-closing-casing #f))
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"e" opthelp-closing-casing #f)
|
||||
(gnc-register-simple-boolean-option options
|
||||
pagename-entries optname-closing-regexp
|
||||
"f" opthelp-closing-regexp #f))
|
||||
"f" opthelp-closing-regexp #f)
|
||||
|
||||
;; what to show for zero-balance accounts
|
||||
;;(add-option
|
||||
;; (gnc:make-simple-boolean-option
|
||||
;;(gnc-register-simple-boolean-option options
|
||||
;; gnc:pagename-display optname-show-zb-accts
|
||||
;; "a" opthelp-show-zb-accts #t))
|
||||
;; "a" opthelp-show-zb-accts #t)
|
||||
|
||||
;; some detailed formatting options
|
||||
(add-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(gnc-register-simple-boolean-option options
|
||||
gnc:pagename-display optname-account-links
|
||||
"e" opthelp-account-links #t))
|
||||
"e" opthelp-account-links #t)
|
||||
|
||||
;; Set the accounts page as default option tab
|
||||
(gnc:options-set-default-section options gnc:pagename-display)
|
||||
@ -318,9 +294,8 @@
|
||||
|
||||
(define (trial-balance-renderer report-obj)
|
||||
(define (get-option pagename optname)
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
(gnc:report-options report-obj) pagename optname)))
|
||||
(gnc-optiondb-lookup-value
|
||||
(gnc:report-options report-obj) pagename optname))
|
||||
|
||||
(gnc:report-starting reportname)
|
||||
|
||||
|
@ -36,31 +36,24 @@
|
||||
(use-modules (gnucash html))
|
||||
|
||||
(define (make-options)
|
||||
(let* ((options (gnc:new-options))
|
||||
(opt-register
|
||||
(lambda (opt)
|
||||
(gnc:register-option options opt))))
|
||||
(let* ((options (gnc-new-optiondb)))
|
||||
;; the report-list is edited by a special add-on page for the
|
||||
;; options editor.
|
||||
(gnc-register-report-placement-option (gnc:optiondb options) "__general" "report-list")
|
||||
(gnc-register-report-placement-option options "__general" "report-list")
|
||||
|
||||
(opt-register
|
||||
(gnc:make-number-range-option
|
||||
(gnc-register-number-range-option options
|
||||
(N_ "General") (N_ "Number of columns") "a"
|
||||
(N_ "Number of columns before wrapping to a new row.")
|
||||
1 0 20 0 1))
|
||||
1 0 20 1)
|
||||
|
||||
options))
|
||||
|
||||
(define (render-view report)
|
||||
(let* ((view-doc (gnc:make-html-document))
|
||||
(options (gnc:report-options report))
|
||||
(report-opt (gnc:lookup-option options "__general" "report-list"))
|
||||
(reports (gnc:option-value report-opt))
|
||||
(reports (gnc-optiondb-lookup-value options "__general" "report-list"))
|
||||
(table-width
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option
|
||||
options (N_ "General") (N_ "Number of columns"))))
|
||||
(gnc-optiondb-lookup-value options (N_ "General") (N_ "Number of columns")))
|
||||
(column-allocs (make-hash-table 11))
|
||||
(column-tab (gnc:make-html-table))
|
||||
(current-row '())
|
||||
@ -168,8 +161,7 @@
|
||||
(define (options-changed-cb report)
|
||||
(let* ((options (gnc:report-options report))
|
||||
(reports
|
||||
(gnc:option-value
|
||||
(gnc:lookup-option options "__general" "report-list"))))
|
||||
(gnc-optiondb-lookup-value options "__general" "report-list")))
|
||||
(for-each
|
||||
(lambda (child)
|
||||
(gnc:report-set-dirty?! (gnc-report-find (car child)) #t))
|
||||
@ -177,10 +169,10 @@
|
||||
|
||||
(define (cleanup-options report)
|
||||
(let* ((options (gnc:report-options report))
|
||||
(report-opt (gnc:lookup-option options "__general" "report-list")))
|
||||
(let loop ((reports (gnc:option-value report-opt)) (new-reports '()))
|
||||
(report-opt (gnc-lookup-option options "__general" "report-list")))
|
||||
(let loop ((reports (GncOption-get-value report-opt)) (new-reports '()))
|
||||
(match reports
|
||||
(() (gnc:option-set-value report-opt (reverse new-reports)))
|
||||
(() (GncOption-set-value report-opt (reverse new-reports)))
|
||||
(((child rowspan colspan _) . rest)
|
||||
(loop rest (cons (list child rowspan colspan #f) new-reports)))))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user