scheme to retrieve the customer associated with a transaction

Macho Philipovich macho at resist.ca
Thu Mar 3 13:23:06 EST 2016


(As an aside while I'm thinking of it: is there something I can do so that my
posts to this list aren't always a whitespace disaster? I'm using Thunderbird
and I've tried delivery formats of "auto" as well as "plain-text only", but
neither seem to make a difference. I haven't had problems with any other
list.)

I'm not sure what you mean by "whitespace disaster".  Your post looks
fine to me.

   When my posts return to me there is no space between paragraphs, even
   if I've entered several line breaks, and I don't like the way quoted
   text is indented with spaces rather than with ">" characters. But I
   guess I can live with it.

     You can also look at the "owner-report.scm" which shows how to
     detect if it's a payment or invoice. You might need to go through
     the Lot, which requires having access to the Split from the A/R
     and/or A/P account and not necessarily the transaction itself.

   Perfect, thanks! This got me on to the right track. It ended up that
   the split I had wasn't directly associated with the lot, so I had to
   track down the other splits in the transaction using (split-list
   (xaccTransGetSplitList (xaccSplitGetParent split))). Once I find the
   "right" split, retrieving the job name is just a matter of doing
   (gncJobGetName (gncOwnerGetJob (gncInvoiceGetOwner
   (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot correct-split))))).

If I could access the invoice, I suspect I could also resolve my final
remaining problem, which is that for expenses this approach returns the
vendor, while what I am after is the chargeback customer.

Hmm... THAT might be a bit harder.

   My next challenge! Alas, that means you may hear from me about this
   again …
   Thanks so much again!
   Macho


More information about the gnucash-user mailing list