only amount

Derek Atkins warlord at MIT.EDU
Tue Mar 6 11:41:26 EST 2012


ST <smntov at> writes:

> when I removed "-public" from define it started to work...
> I tried:
> (define (fmtmoneyNoCurrency curr amt)
>   ;; Format a monetary amount in the given currency as HTML
>   (nbsp (gnc:monetary->string (gnc:gnc-monetary-amount amt))))
> but it also produced errors...
> So the questions is - how do I rewrite this function so that it prints
> only amount without currency?

The gnc:monetary->string API expects a <gnc:monetary>.  What you want is
a modification of that API that passes #f instead of #t into
gnc-commodity-print-info.  So something like: 

(define (fmtmoneyNoCurrency value)
   (gnc:gnc-monetary-amount value) 
   (gnc-commodity-print-info (gnc:gnc-monetary-commodity value) #f)))

Then you can use this instead of gnc:monetary->string

> ST


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL:    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list