Re: GnuCash reports via eguile - probably not

2009-01-26 Thread Chris Dennis
Derek Atkins wrote:
> Quoting Derek Atkins :
> [snip]
>>> Can any Guile/Scheme experts help?
> 
> I found some help, and here's some working code:
> 
> ;#! /usr/bin/guile
> (define fred "This is Fred")
> 
> (define (foo bar)
>   (display fred) (newline) (display bar) (newline)
>   (display "and now via eval-string...") (newline)
>   (let ((string1 "(begin (display bar) (newline) (display fred) (newline)
> (display bar) (newline))"))
> (with-input-from-string string1 (lambda () (local-eval (read)
> (the-environment
> ))
> (foo "Actual parameter")
> 
> 
> Note that I added the 'begin' because the 'read' will only read in one
> s-expression.  You could theoretically read in multiple s-expressions
> in a loop if you wanted.  But this was easier.
> 
> This code works for me.
> 
> -derek
> 
> 

I'm making progress with this, but I've hit another snag with 
local-eval.  The following code gives an error (note the extra "(define 
x 42)":

--
;#! /usr/bin/guile
(define fred "This is Fred")
(define (foo bar)
   (let ((string1 "(begin (display fred) (newline) (display bar) \
   (newline) (define x 42) (display x) (newline))"))
 (with-input-from-string string1 (lambda () (local-eval (read) 
(the-environment))
(foo "Actual parameter")
--
gives
--
ERROR: Bad define placement
--

I found a mention of this issue at 
http://www.opensubscriber.com/message/guile-u...@gnu.org/9617568.html
but I'm not sure whether to give up on local-eval, or just make a rule 
that the template code can't include 'define', which would be a bit 
limiting.

Any ideas?

cheers

Chris
-- 
Chris Dennis  cgden...@btinternet.com
Fordingbridge, Hampshire, UK
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: FYO: changing OFX version from 102 to 103 breaks access to citigroup (secureofx2.bankhost.com) credit cards

2009-01-26 Thread Bill Nottingham
Derek Atkins (warl...@mit.edu) said: 
> >> I reported this at https://bugzilla.redhat.com//show_bug.cgi?id=481084
> >> and they say "CANTFIX".
> >
> > Yes - it's fixed in current versions of libofx and aqbanking, but we
> > can't put those versions on Fedora 9 without breaking the ABI.
> 
> Does anything other than GnuCash use it?

kmymoney2 and grisbi, in Fedora. (This problem only exists on Fedora 9,
we have new enough versions on Fedora 10, and too-old versions on Fedora
8 and earlier.)

Bill
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: FYO: changing OFX version from 102 to 103 breaks access to citigroup (secureofx2.bankhost.com) credit cards

2009-01-26 Thread Derek Atkins
Bill Nottingham  writes:

> Archimerged Ark Submedes (archimer...@gmail.com) said: 
>> I reported this at https://bugzilla.redhat.com//show_bug.cgi?id=481084
>> and they say "CANTFIX".
>
> Yes - it's fixed in current versions of libofx and aqbanking, but we
> can't put those versions on Fedora 9 without breaking the ABI.

Does anything other than GnuCash use it?

> Bill

-derek

-- 
   Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
   Member, MIT Student Information Processing Board  (SIPB)
   URL: http://web.mit.edu/warlord/PP-ASEL-IA N1NWH
   warl...@mit.eduPGP key available
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: FYO: changing OFX version from 102 to 103 breaks access to citigroup (secureofx2.bankhost.com) credit cards

2009-01-26 Thread Bill Nottingham
Archimerged Ark Submedes (archimer...@gmail.com) said: 
> I reported this at https://bugzilla.redhat.com//show_bug.cgi?id=481084
> and they say "CANTFIX".

Yes - it's fixed in current versions of libofx and aqbanking, but we
can't put those versions on Fedora 9 without breaking the ABI.

Bill
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Problems testing the sign of a commodity collector.

2009-01-26 Thread Michael McKay
I'm having problems testing the sign of a commodity collector.

I've modified the income statement to show gross margin and EBITDA.  I've
removed the option for multiple columns and put all the results in a single
table.  It all works well except for the following:

The original scm code used this:

   (report-line
   (if standard-order? 
   exp-table 
   inc-table)
   (string-append (_ "Net income") period-for)
   (string-append (_ "Net loss") period-for)
   net-income
   (* 2 (- tree-depth 1)) exchange-fn #f #f
   )


I'd like to replace it with:

  (add-subtotal-line my-table 
(if (gnc-numeric-negative-p (net-income))
  (string-append (_ "Net loss") period-for)
  (string-append (_ "Net income") period-for)
)  
#f net-income)

Net-income is defined as

 (set! net-income (gnc:make-commodity-collector))


Everything works but the if statement. What am I missing?


Thanks in advance.

Michael McKay


Web site: http://mjmhelp.com 
Web log:  http://mjmhelp.com/blog 
 Subscribe

 
 
 
 
 

BEGIN:VCARD
VERSION:2.1
X-MS-SIGNATURE:YES
N;LANGUAGE=en-ca:McKay;Michael;J.;;CD MBA
FN:Michael J. McKay CD MBA
ORG:MJM Consulting
TITLE:Principal
TEL;CELL;VOICE:(613) 724-8169
ADR;WORK;PREF:;;33 Ossington Ave.;Ottawa;ON;K1S 3B3;Canada
LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:33 Ossington Ave.=0D=0A=
Ottawa, ON=0D=0A=
K1S 3B3
X-MS-OL-DEFAULT-POSTAL-ADDRESS:2
URL;WORK:mjmhelp.com
EMAIL;PREF;INTERNET:michael.mc...@mjmhelp.com
PHOTO;TYPE=JPEG;ENCODING=BASE64:
 /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQY
 GBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYa
 KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR
 CABgAEcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAECAwQFBgcICQoL/8QAtRAA
 AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK
 FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG
 h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1N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ZvHGtnXtUZoVMdmhIiTufc+9dM4wpLQxu5vU5nUryfUbkyTHg
 cKvZRUGwx4I+92q35YjUu3QUiREgs33j+lcj13NTQsLoPGEkPzDvRWaMxtlelFdEMXUguVM5
 5YanJ3aP/9k=

X-MS-OL-DESIGN;CHARSET=utf-8:http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards"; ver="1.0" layout="left" bgcolor="ff">Mobile
REV:20081112T144631Z
END:VCARD
___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


RE: Problems testing the sign of a commodity collector.

2009-01-26 Thread Michael McKay
Found the solution. The following seems to work.

  ;; Add the net income / net loss line.
  (add-subtotal-line my-table 
(if (gnc-numeric-negative-p
  (gnc:gnc-monetary-amount
(gnc:sum-collector-commodity 
  net-income report-commodity exchange-fn)))
  (string-append (_ "Net loss") period-for)
  (string-append (_ "Net income") period-for)
)  
#f net-income)


Thanks.

From: Charles Day [mailto:ceda...@gmail.com] 
Sent: January-26-09 4:09 AM
To: michael.mc...@sympatico.ca
Subject: Re: Problems testing the sign of a commodity collector.

...

Shouldn't the argument to gnc-numeric-negative-p be a gnc_numeric type
rather than a commodity collector? The commodity collector (net-income) will
be full of amounts in various currencies; it seems like you'd have to sum
them all all up into the reporting currency first before checking the sign.


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel