On Thu, 27 Apr 2000, Robert Graham Merkel wrote:
> Bryan,
> thanks for your new transaction report. It's a
> great improvement on my original.
>
> However, the original printed amounts over two columns (credits
> in one, debits in the other), while the new version prints them in
> one, with parentheses or other indication of negative amounts.
>
> How difficult would it be to add an option giving the choice
> between the one-column and two-column formats?
Not too tough. Quick tutorial on the new report format:
To output a report, you give the html-generator a list of somethings (in this
case Split*'s) and a list of report-spec-structure's. Each item in the list of
report-spec-structure's specifies one column in the report.
The most important items in the report-spec-structure are the value-getter, the
html-proc and the total-proc.
The value-getter is a function that gets a value from a something (Split*). In
this case, we pass in gnc:split-get-value.
The html-proc is a function that converts a value into html. Right now, we
pass in (lambda (value) (html-right-cell (html-currency value))).
For something that prints only credits, we'd use something like
(lambda (value) (if (< value 0.0) (html-right-cell (html-currency (- 0 value)))
html-blank-cell))
The total-proc is a function that creates a total. Right now, we pass in +.
For something that totals only credits, we'd use something like
(lambda (a b) (if (< value 0.0) (- a b) a)). I'm not sure this will work, this
is not a symmetrical function like +, but a little trial and error would fix
this up.
If you remove my amount column and replace it with debit and credit columns
you no longer have an amount total. So it'd be useful to add an "extended
total" column. Pass in gnc:split-get-value as the getter, #f as the html-proc
and + as the total function. This way it won't print the amounts, but it will
total them, and print the totals.
The second part of the question is: how hard is it to give an option between
the two styles? Answer: simple. If you want single column, add my old amount
report-spec to the report-spec list. If you want the new format, add the three
new report-specs to the report-spec list.
While you're fixing that, here's the rest of the todo list:
1) the "Other Account" logic should be fixed to: if there isn't another
account, return "". If there's one other account, return it. If there are
more than one other account, return "Split".
2) Internationalize.
3) Use Bill Gribble's new query rather than getting the list of Split*'s
ourselves.
4) Get a good set of query formats. It's ok to let the user switch on and off
stuff like "Description", but it'd be nice to automatically flick on "Other
Account" and flick off "Account" when they select single-line mode and vice
versa for the other two modes.
5) pick some colours that aren't ugly. :)
6) add a mechanism to save "Favourite Reports". As well as the parameters, you
should be able save relative dates as well as absolute dates. IOW, "the
current month" rather than "April 1/2000 to April 30/2000".
Bryan
--
-------------
Bryan Larsen, Senior Software Engineer & fall guy
Phone: 306 664 2087 x29. Fax: 306 664 4446
Analog Design Automation: Analog Circuit Synthesis? Problem Solved.
--
Gnucash Developer's List
To unsubscribe send empty email to: [EMAIL PROTECTED]