[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importing invoices



Bao Ha wrote:
> The first step is to import AR account. How do I import invoices into
> ledgersmb? I think I have to import customer information into the
> customer table first. Then, import invoices into the invoice table.
> 
> The invoices are based on orders from ZenCart. Perhaps, it is easier
> to dump the tables from ZenCart to a correct format, then import them
> back to Postgres.
> 
> I know enough sql to move things around. But, I am still trying to
> figure out the table structures in ledgersmb, and how they are
> related.

You may find it easier to import Zencart AR Invoices to LedgerSMB Order
Entry Sales Orders. 

Sales Orders can be modified and saved, where invoices are post-only and
will affect inventory levels. Sales Orders can generate corresponding AR
Invoices when you're ready.

In some cases, having closed Sales Orders for history prior to your
LedgerSMB go-live date may be sufficient. You'll have to import payment
details to close out AR Invoices if you go that route.

I found it instructive to diff a plaintext pg_dump before and after
using the LedgerSMB UI to create a sales order. In LedgerSMB branches/1.2
You will find:

1) One insert/update to table oe
2) One or more inserts/updates to table orderitems
3) One insert/update to table transactions
4) Update of the sequences id, orderitemsid
5) Update of the defaults row 'sonumber'

   @@ -765,7 +765,7 @@ ALTER TABLE public.id OWNER TO ledgersmb;
    -- Name: id; Type: SEQUENCE SET; Schema: public; Owner: ledgersmb
    --
    
   -SELECT pg_catalog.setval('id', 10586, true);
   +SELECT pg_catalog.setval('id', 10587, true);
    
    
    --
   @@ -1384,7 +1384,7 @@ ALTER TABLE public.orderitemsid OWNER TO ledgersmb;
    -- Name: orderitemsid; Type: SEQUENCE SET; Schema: public; Owner: ledgersmb
    --
    
   -SELECT pg_catalog.setval('orderitemsid', 1881, true);
   +SELECT pg_catalog.setval('orderitemsid', 1884, true);
    
    --
   @@ -3780,8 +3780,8 @@ COPY defaults (setting_key, value) FROM stdin;
   -sonumber	569
   +sonumber	570
    \.

   @@ -5855,6 +5855,7 @@ COPY oe (id, ordnumber, transdate, vendor_id, customer_id, amount, netamount, re
   +10587	...
   \.
    
   @@ -6681,6 +6682,9 @@ COPY orderitems (id, trans_id, parts_id, description, qty, sellprice, discount,
   +1882	...
   +1883	...
   +1884	...
    \.

   @@ -7285,6 +7289,7 @@ COPY transactions (id, table_name) FROM stdin;
   +10587	oe
    \.