Datestamp on Reports
Michael Hendry
hendry.michael at gmail.com
Wed Oct 9 15:04:57 EDT 2013
On 9 Oct 2013, at 07:48, mcmurchy1917-gnucash at yahoo.co.uk wrote:
> My view is that would indicate a syntax error. The probable reason is that the date routines aren't available to your script.
>
> Try this quick test
>
> Start up a command line interface for bash or ksh or whatever is your favourite scripting environment. At the command line prompt type
>
> guile
Thanks, mcmurchy1917.
It took me some time to find guile on my iMac, as it doesn't appear in the path, and isn't accessible via the Finder's Search feature.
I eventually found it here...
/Applications/LilyPond.app/Contents/Resources/bin/guile
and your suggestions below were all accurate.
>
> then at the guile prompt type
>
> (display (date->string (current-date) "Printed at ~d/~m/~Y ~H:~M:~S"))
>
> If the date routines aren't available you should get this error -
>
> Backtrace:
> In standard input:
> 1: 0* [display ...
> 1: 1* (date->string (current-date) "Printed at ~d/~m/~Y ~H:~M:~S")
>
> standard input:1:10: In expression (date->string (current-date) "Printed at ~d/~m/~Y ~H:~M:~S"):
> standard input:1:10: Unbound variable: date->string
> ABORT: (unbound-variable)
>
>
> Now include the date routines by typing at the guile prompt
>
> (use-modules (srfi srfi-19)) ; for extra date functions
>
> and try again
>
> (display (date->string (current-date) "Printed at ~d/~m/~Y ~H:~M:~S"))
>
> It should work this time. To get out of guile use ctrl-d
>
>
> To include the date routine in my script I have this line in my version of "balsheet-eg.scm" -
>
> (use-modules (srfi srfi-19)) ; for extra date functions
This worked, too.
>
>
> I hope this helps.
Certainly did!
Now that you've shown me the way, I expect I'll spend many more (marginally) productive hours tweaking GnuCash reports!
Michael
>
>
>
>
>
>
> On Tuesday 08 Oct 2013 16:42:01 Michael Hendry wrote:
> > On 8 Oct 2013, at 08:42, Michael Hendry <hendry.michael at gmail.com> wrote:
> > > On 7 Oct 2013, at 21:54, mcmurchy1917-gnucash at yahoo.co.uk wrote:
> > >> In my customised Balance report called balsheet-eg.eguile.scm
> > >>
> > >> I have this code -
> > >>
> > >> <br clear="both">
> > >> <center>
> > >> <p><?scm:d opt-extra-notes ?>
> > >> <p><?scm
> > >> (display (date->string (current-date) "Printed at ~d/~m/~Y ~H:~M:~S"))
> > >> ?>
> > >> </center>
> > >> <?scm (if (not css?) (begin ?>
> > >> </table> <!-- hack for GTKHTML -->
> > >> <?scm )) ?>
> > >>
> > >> </body>
> > >> </html>
> > >>
> > >> <?scm
> > >> ) ; enclosing let
> > >> ?>
> > >>
> > >>
> > >> Regards
> > >
> > > Thanks - that looks like the best route.
> > >
> > > Trying to avoid hacking, and use the tools provided, I'd been looking into
> > > making adjustments to the Stylesheets - in particular the Footer one.
> > >
> > > I found that simple HTML could be included, such as enclosing a string in
> > > <B>…</B> to make it appear in bold print, but then ran into the buffers
> > > when I found that HTML code couldn't be used to generate the current
> > > date, and that I couldn't readily use server-side code such as Javascript
> > > or PHP without putting my gnucash-generated HTML on a server.
> > >
> > > I shall study your code fragment, and once I understand what it's doing,
> > > I'll see if I get it to work for me.
> > >
> > > Regards
> > >
> > > Michael
> >
> > PS
> >
> > I've inserted the additional lines as above, but I get the following at the
> > bottom of the report...
> >
> > (Development version -- don't rely on the numbers on this report without
> > double-checking them. Change the 'Extra Notes' option to get rid of this
> > message)
> >
> > An error occurred when processing the template:
> >
> > ERROR: Unbound variable: date->string
> > In current input:
> > 30: 53* (let* (#) (letrec # # # ...))
> > ?: 54 (letrec # # # ...)
> > 307: 55* [display ...
> > 307: 56* (date->string (current-date) "Printed at ~d/~m/~Y ~H:~M:~S")
> >
> > …and I'm afraid the error messages don't mean a lot to me!
> >
> > Michael
More information about the gnucash-user
mailing list