Algorithm for allocating payments

marcus.wolschon at googlemail.com marcus.wolschon at googlemail.com
Mon Nov 9 05:17:48 EST 2009


On Mon, 09 Nov 2009 05:29:57 +0200, Graham Leggett <minfrin at sharp.fm>
wrote:
> Hi all,
> 
> I am currently trying to create some code to add a payment to a gnucash
> xml file in java, and I am struggling to find a proper description of
> the procedure I need to create the lots that link the transaction in A/R
> with the customer who made the payment.

Why write it yourself?

That code already exists in jGnucashLib.
https://sourceforge.net/projects/jgnucashlib/

I remember that I wrote code to mark transactions
as being the payment for invoices and for adding
and posting new invoices from java.

> Is there a definitive description anywhere of the link between
> transactions, lots and customers?

transaction and invoice have the same lot-number.
orders have invoices.
customers have order.

> So far, my attempts at loading in the modified file into gnucash have
> shown the transaction, but no link between the transaction and the
> customer. Resaving the file in gnucash shows that the transaction and
> lot are present, but no link exists between them.
> 
> Is there a way to get gnucash to output any parsing errors while it
> attempts to laod a file? So far despite the errors in the file, gnucash
> silently loads the file, not revealing that anything is wrong with the
> file. Is this possible?

jGnucashLib does a validation against an XML-Schema on every read and
every write.

Marcus



More information about the gnucash-devel mailing list