custom reports - negative numbers in red

Carsten Rinke carsten.rinke at gmx.de
Fri Apr 5 01:44:10 EDT 2013


Hi Gus,

sorry to say, but I think I cannot help you with the style sheets as I 
did not explore them yet.
I am still stuck with writing the clumsy scheme phrases ;-)

Once that you find a good way forward, please document your experiences in
http://wiki.gnucash.org/wiki/Custom_Reports
(and I'd appreciate if you sent an update notification to this list 
after that)

Kind regards,
Carsten


On 04/04/2013 06:35 PM, Lt. Goose wrote:
> Thanks for your help, Carsten.
> I was able to display red text for negative amounts (they came from a 
> commodity-collector, by the way). However, though the result displays 
> right, the generated html overhead can be a bit heavy (depending on 
> the time-interval and the number of accounts, and the scheme code 
> turns even more unreadable ;-) ). I tried with something like this, 
> changing the value to a formatted html-text:
>
> (gnc:make-html-table-cell/markup "number-cell" (gnc:make-html-text 
> (gnc:html-markup "b" (gnc:html-markup "font color=red" 
> (gnc:make-gnc-monetary (gnc-default-currency) act-bal))))))
>
> Of course, using html-text and html-markup, I can render almost any 
> html code (I'm still struggling to change the background color of a 
> cell), though it would be nicer if I could just use something like the 
> "number-cell" markup used for the whole cell (the <td> tag) and let 
> the CSS stylesheet do the formatting. In other words, is it possible 
> to dynamically modify/add styles to the report stylesheet (I mean 
> within the report options or report code, for example)?
>
> I'd rather include something like this in the report (this is taken 
> from the html-exported report):
>
> <style type="text/css">
> td.number-cell { font-family: Segoe UI; font-size: 10pt;  }
> td.number-header { text-align: right; font-family: Segoe UI; 
> font-size: 10pt;  }
> td.neg { color: red;  }
> </style>
>
> For example, adding a new style for cells:
> td.neg-number-cell { font-family: Segoe UI; font-size: 10pt; color: red }
>
> Is there a way to define such a style? Some kind of 
> gnc:make-html-style interface?
>
> Also, notice the "td.neg" style defined in the stylesheet, that I 
> haven't been able to use. How should I do it?
>
> Thanks again in advance for your comments.
> Gus.
>
>
> 2013/4/3 Carsten Rinke <carsten.rinke at gmx.de 
> <mailto:carsten.rinke at gmx.de>>
>
>     Hi Gus,
>
>     for text I would start playing around with something like this:
>
>              (gnc:make-html-text
>                (gnc:html-markup "color=red" "negative amount")
>              )
>
>     or similar (not sure about the font color commands in HTML).
>
>     If this works for tables I don't know.
>
>     What is the HTML code that you want to achieve?
>
>     Kind regards,
>     Carsten
>
>
>
>     On 04/02/2013 06:06 PM, Lt. Goose wrote:
>
>         Hi all,
>         I've been using gnucash for some months and lately I've been
>         trying to
>         create my own reports (learning a bit of scheme in the
>         meantime). I've
>         managed to render a table with the data I need (some kind of
>         cash-flow
>         report that reports several accounts in columns, sorted by the
>         date where
>         at least one transaction took place - so that you know your
>         total balance
>         change everyday any transaction happened). I've got it running
>         now after
>         some investigation.
>
>         Anyhow, what I'm trying to do now is to format the output in a
>         fancier way,
>         but I cannot find the way to format a html-cell with a
>         negative number
>         (using the option to display negative numbers in red). For
>         instance, I'm
>         writing this and I'm getting a normal cell:
>
>               (total-value (gnc:make-html-table-cell/markup
>         "total-number-cell" (car
>         value)))
>
>         I've tried other markup texts like "neg-total-number-cell" or
>         simply "neg"
>         but to no avail. Does anybody know how to format this?
>
>         And it'd be fantastic to have a reference of predefined markup
>         texts that
>         are configured in the style sheets.
>
>         Thanks in advance.
>
>         Gus.
>         _______________________________________________
>         gnucash-user mailing list
>         gnucash-user at gnucash.org <mailto:gnucash-user at gnucash.org>
>         https://lists.gnucash.org/mailman/listinfo/gnucash-user
>         -----
>         Please remember to CC this list on all your replies.
>         You can do this by using Reply-To-List or Reply-All.
>
>
>



More information about the gnucash-user mailing list