Invoice Importer

Reuben Cummings reubano at gmail.com
Mon Mar 26 09:39:54 EDT 2012


On Mar 26, 2012, at 11:48 AM, Derek Atkins wrote:

> reubano <reubano at gmail.com> writes:
> 
>> reubano wrote
>>> 
>>> On Wed, Mar 7, 2012 at 6:51 PM, Reuben Cummings <reubano@> wrote:
>>>> On Sun, Mar 4, 2012 at 1:29 PM, Mike Evans <mikee at .co> wrote:
>>>>> 
>>>>> On Sat, 3 Mar 2012 03:55:26 -0800 (PST)
>>>>> reubano <reubano@> wrote:
>>>>> 
>>>>>> gnucash-2.4.10 built from source (applied row-skipping patch) with
>>>>>> MacPorts 2.0.3 on MacOSX 10.7.2
>>>>> The patch has now been applied to 2.4 branch and will be in the next
>>>>> release.
>>>> 
>>>> Thanks! Do you have any suggestion on how to fix the currently
>>>> imported transactions?
>>> 
>>> Or can you point me to a link to the bug/patch so I can try to reverse
>>> engineer the fix?
>>> 
>> 
>> I figured it out. The invoices from the entries table were never entered
>> into the invoices table. I wrote a script to match the invoices with the
>> transaction guids and insert them into the invoices table.
> 
> I don't think I understand this issue.  What do you mean by "The
> invoices from the entries table were never entered into the invoices
> table"?  

I'm referring to tables in the backend database. There are two tables that relate to invoices, i.e., entries and invoices. The two tables are related by the fields entries.invoice = invoice.guid.

> In particular I don't understand what you mean by "invoices
> from the entries table",

This refers to the invoice field of the entries database table, i.e., entries.invoice.

> and I don't understand what you mean by
> "[entries] were never entered into the invoices table."

I guess 'record' is more appropriate. The invoice field of each record in the entries table should have a corresponding record in the invoices table (joined at the guid field). 

> Are you saying that the Entries on an invoice were never added to the
> Invoice?

So, I am saying that the importer created records in the entries table that had no corresponding record in the invoices table. You can view them with the following sql statement.

SELECT
	entries.invoice

	FROM entries
	LEFT OUTER JOIN invoices ON entries.invoice = invoices.guid
	WHERE invoices.guid IS NULL
	GROUP BY entries.invoice

What I did was match these orphan invoices with the appropriate transactions in the transactions table (the invoices and transaction tables are related by the transaction guid) to create the records that needed to be inserted into the invoices table.
 
> -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
>       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list