User:Yawaramin
Contents
- 1 Hello
- 2 GnuCash Scheme Report API
- 2.1 Defined Variables
- 2.2 Procedures
- 2.2.1 gnc-account-get-children
- 2.2.2 gnc-account-get-descendants-sorted
- 2.2.3 gnc-account-get-full-name
- 2.2.4 gncAccountGetGUID
- 2.2.5 gnc:accounts-count-splits
- 2.2.6 gnc:accounts-get-all-subaccounts
- 2.2.7 gnc:case-exchange-fn
- 2.2.8 gnc:date-option-absolute-time
- 2.2.9 gnc:filter-accountlist-type
- 2.2.10 gnc-get-current-book
- 2.2.11 gnc-get-current-root-account
- 2.2.12 gnc:gnc-monetary-amount
- 2.2.13 gnc:html-document-set-title!
- 2.2.14 gnc:lookup-option
- 2.2.15 gnc:make-commodity-collector
- 2.2.16 gnc:make-gnc-monetary
- 2.2.17 gnc:make-html-document
- 2.2.18 gnc:make-html-table
- 2.2.19 gnc:make-html-text
- 2.2.20 gnc:make-simple-boolean-option
- 2.2.21 gnc:new-options
- 2.2.22 gnc:option-value
- 2.2.23 gnc:options-add-account-selection!
- 2.2.24 gnc:options-add-currency!
- 2.2.25 gnc:options-add-date-interval!
- 2.2.26 gnc:options-add-price-source!
- 2.2.27 gnc:options-set-default-section
- 2.2.28 gnc-print-date
- 2.2.29 gnc:register-option
- 2.2.30 gnc:report-options
- 2.2.31 gnc:report-percent-done
- 2.2.32 gnc:report-starting
- 2.2.33 gncSplitGetGUID
- 2.2.34 gnc:timepair-end-day-time
- 2.2.35 gnc:timepair-le
- 2.2.36 gnc:timepair-start-day-time
- 2.2.37 xaccAccountGetCommodity
- 2.2.38 xaccAccountGetName
- 2.2.39 xaccAccountGetSplitList
- 2.2.40 xaccAccountLookup
- 2.2.41 xaccSplitGetParent
Hello
I’m a member of the GnuCash Documentation team. You can also find me on:
- GNOME BugZilla: https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=yawar.amin%40gmail.com
- GitHub: https://github.com/yawaramin
GnuCash Scheme Report API
I'm trying to figure out the GnuCash API for reports by examining the GnuCash and Scheme module sources, report sources and the reports they produce one by one.
This document is mostly the result of my educated guesses. Everyone please feel free to change anything that's inaccurate, and move it to a more appropriate place if needed. I just started tonight (5 Sep 2009) so it's definitely a work in progress right now.
All identifiers are in alphabetical order ignoring case and non-alphanumeric characters in the names.
Defined Variables
gnc:pagename-accounts
The name of the accounts page (tab) in the options dialog box
gnc:pagename-general
The name of the general page (tab) in the options dialog box
Procedures
gnc-account-get-children
Returns: A list of immediate children accounts of the given account; not all descendents. For that, see gnc-account-get-descendants-sorted
Arguments:
- The account whose children we want
gnc-account-get-descendants-sorted
Returns: The descendants of the given account
Arguments:
- The account whose descendants we want
gnc-account-get-full-name
Returns: The full name of an account
Arguments:
- An Account object
gncAccountGetGUID
Returns: The GUID of an account
Arguments:
- An Account object
gnc:accounts-count-splits
Returns: The number of splits across all the given accounts
Arguments:
- List of account objects
gnc:accounts-get-all-subaccounts
Returns: List of subaccounts of an account
Arguments:
- An Account object
gnc:case-exchange-fn
Returns: A currency exchange calculator function
Arguments:
- A price source
- The report currency
- The date at which we want to calculate the exchange values
gnc:date-option-absolute-time
Converts a date option value to absolute Unix epoch time
Returns: A date/time object in absolute time (i.e. from the start of the Unix epoch)
Arguments:
- A date option
gnc:filter-accountlist-type
Returns: A list of accounts filtered by their type
Arguments:
- A list of account types to filter by. Accepts, among others: ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-ASSET ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL
- A list of accounts
gnc-get-current-book
Returns: The currently-open GnuCash Book.
gnc-get-current-root-account
Returns: The root account of the book that is currently open
gnc:gnc-monetary-amount
Returns: The amount of a Gnc-Monetary object
Arguments:
- A Gnc-Monetary object. These can be created with gnc:make-gnc-monetary
Defined in: src/engine/gnc-numeric.scm
gnc:html-document-set-title!
Arguments:
- The HTML document object
- String to set as the document title
gnc:lookup-option
Returns: The actual option object (not its value)
Arguments:
- Options object. Can be specified with the gnc:report-options procedure
- Name of page (tab) where the option lives
- Name of the option to look up
gnc:make-commodity-collector
Returns: A commodity collector object. (TODO Explain what this is)
gnc:make-gnc-monetary
Returns: A Gnc-Monetary object, which is a structure consisting of an amount of money and its currency
Arguments:
- A Currency object
- An amount
Defined in: src/engine/gnc-numeric.scm
gnc:make-html-document
Returns: An HTML document object
gnc:make-html-table
Returns: An HTML table object
gnc:make-html-text
Returns: An HTML text object
gnc:make-simple-boolean-option
Creates a checkbox control for yes/no options
Returns: The boolean option object
Arguments:
- Options dialog box tab (page) name where the option lives
- Label for the control
- Order in which the option appears on the page. Can be text from `a' to `z'
- Tooltip for the checkbox control
- Default value
gnc:new-options
Returns: A new Options object. An Options object is a database of user-settable options and their values
gnc:option-value
Returns: The value of the given option
Arguments:
- The option object whose value to get. Can be specified with the gnc:lookup-option procedure
gnc:options-add-account-selection!
Adds a control that allows user to select multiple accounts from the tree of accounts
Arguments:
- Options object
- Options dialog box tab (page) name where the option lives
- Label for the control that sets how many levels of accounts to show
- Label for the control that sets whether to show subaccounts
- Label for the overall control
- Order in which the option appears on the page. Can be text from `a' to `z'
- (TODO Probably the default account display depth)
- A lambda expr that returns a list of accounts to show at first
- (TODO Don't know but set to #f)
gnc:options-add-currency!
Adds a currency selector control to the options dialog box
Arguments:
- Options object
- Options dialog box tab (page) name where the option lives
- Text to use for option label
- Order in which the option appears on the page. Can be text from `a' to `z'
gnc:options-add-date-interval!
Adds a date interval selector control to the options dialog box
Arguments:
- Options object
- Options dialog box tab (page) name where the date option lives
- Text to use to label `From' part of interval
- Text to use to label `To' part of interval
- Order in which the option appears on the page. Can be text from `a' to `z'
gnc:options-add-price-source!
Adds a price source selector option to the options dialog box
Arguments:
- Options object
- Options dialog box tab (page) name where the option lives
- Text to use for option label
- Order in which the option appears on the page. Can be text from `a' to `z'
- Symbol which names the price database to use. E.g. the symbol corresponding to the `Nearest in time' option is 'pricedb-nearest
gnc:options-set-default-section
Sets the options dialog box tab to show when the dialog box appears
Arguments:
- Options object
- Options dialog box tab (page) name to set as the default
gnc-print-date
Returns: A formatted date string
Arguments:
- A date/time object
gnc:register-option
Arguments:
- Options object
- An individual option object, e.g. made with gnc:make-simple-boolean-option
gnc:report-options
Returns: Options object for the report
Arguments:
- Report object
gnc:report-percent-done
Updates the progress bar at the bottom of the screen which shows report creation progress
Arguments:
- A percentage value indicating how much of the report has been done so far
gnc:report-starting
(TODO Probably marks the starting point of the report rendering. Probably used to start the progress bar when a report is (re)loaded)
Arguments:
- Name of the report
gncSplitGetGUID
Returns: The GUID of a split
Arguments:
- A Split object
gnc:timepair-end-day-time
Returns: The Timepair object supplied as the argument but with its time set to the last second of its day.
Arguments:
- A Timepair object. Can come from the gnc:date-option-absolute-time procedure
Defined in: src/app-utils/date-utilities.scm
gnc:timepair-le
Returns: Boolean indicating whether the first Timepair is earlier than or the same as the second Timepair
Arguments:
- A Timepair object
- A Timepair object
Defined in: src/app-utils/date-utilities.scm
gnc:timepair-start-day-time
Returns: The Timepair object supplied as the argument but with its time set to the first second of its day.
Arguments:
- A Timepair object. Can come from the gnc:date-option-absolute-time procedure
Defined in: src/app-utils/date-utilities.scm
xaccAccountGetCommodity
Returns: The commodity (usually the currency, sometimes the fund name) of an account
Arguments:
- An Account object
xaccAccountGetName
Returns: The name of the account
Arguments:
- An Account object
xaccAccountGetSplitList
Returns: A list of the splits in an account
Arguments:
- An Account object
xaccAccountLookup
Returns: An Account object
Arguments:
- The account's GUID as a string
- The Book object in which the Account lives (see gnc-get-current-book to get a Book object)
xaccSplitGetParent
Returns: The parent (TODO account? transaction?) of a split
Arguments:
- A Split object