gnc:html-build-acct-table - can we factor out some parts?

Christian Stimming stimming@tuhh.de
Sun, 1 Apr 2001 09:29:18 -0700


-----BEGIN PGP SIGNED MESSAGE-----

On Sunday 01 April 2001 00:31, Robert Graham Merkel wrote:
> OK, I've spent time experimenting with using gnc:html-build-acct-table
> to do a balance sheet, and in its present form it's just not suitable.
> Basically, the misaligned columns look really ugly, so the contents
> really have to be in one table.

Oh, that's bad, indeed. Hm, if it's (only) for the misaligned columns, you 
could try to append both data fields. Since the number of columns are the 
same, it might work:

(define (gnc:html-table-append-data! table table2)
  (let* ((data2 (gnc:html-table-data table2))
             (dd (gnc:html-table-data table))
	 (current-num-rows (gnc:html-table-num-rows table))
             (other-num-rows (gnc:html-table-num-rows table2))
	 (new-num-rows (+ current-num-rows other-num-rows)))
    (set! dd (cons data2 dd))
    (gnc:html-table-set-num-rows-internal! 
     table 
     new-num-rows)
    (gnc:html-table-set-data! table dd)
    new-num-rows))

If this works, it could be added to src/scm/html-table.scm . 

> However, if one could factor out the part of the above function that
> does the account rows and adds them to a table passed in as an
> argument, that could be used as the basis to build the table up in
> parts, adding headings, totals and other calculated figures
> (retained profits, basically) through other means.

Yes, that would still be relatively easy. We could add an optional 
argument to gnc:html-build-acct-table, namely, an already existing 
html-table, where the rows will be added to instead to a newly created 
one. If you like to get this (in case the above function doesn't work), 
come back to me and I'll implement that.

Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)

iQCVAwUBOsdXcGXAi+BfhivFAQFY+AQAoTIC3tHCU8+LVTkNSx9QsRMTkXiWWBa+
Hzwiv3cjtUAXl8w/lllm79V2xMqOkYuoZ01IFpVrvmqL80n8Bo819BuHWiIc4Jvm
qvfHcK3OmxM7u7s0NOyv6Rb5cipq/9cmJTT9KTRUy2veb7oun8jBWY4Q5fPHJHjb
xK+1uY2I/eQ=
=UCc/
-----END PGP SIGNATURE-----