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

Re: Inderesting Postgres/LSMB issue?



Richard:

Inserting a part involves considerably more than a simple
interaction with the parts table.  Take a look at the perl
module, LedgerSMB::API, for some indication of how to interact
with the LedgerSMB code base itself, which could avoid some
wheel re-invention.  See particularly: t/13-lsmb-api-ic-part.t
for a minimal record necessary to populate a row of your
parts table.

It includes:

%fields = (
                     item => 'part',
                 orphaned => 1,
              taxaccounts => '2150',
           selectcurrency => 'USD',
               partnumber => $partnumber,
              description => 'Widget, single',
                IC_income => '4410--General Sales',
               IC_expense => '5020--Purchases',
             IC_inventory => '1520--Inventory',
              IC_tax_2150 => 1,
  IC_tax_2150_description => '2150--Sales Tax',
              priceupdate => $date,
                sellprice => '0.25',
                listprice => '',
                 lastcost => '0.098',
                   markup => '',
               weightunit => 'lbs',
            customer_rows => 1,
           makemodel_rows => 1,
            assembly_rows => 1,
                    login => 'lsmb_api_test',
                     path => 'bin/mozilla',
                );

To get a clear sense of what all happens when a new part is
inserted through the web interface, use pg_dump to take before
and after snapshots of your dataset sandwiched around your
create a part interaction in the browser.  Then diff those
two data dumps and study what changed.

You might also grep one of those dumps for the table name
'parts' and find out how often some referential integrity rule
from the other tables mentions it.

As for extracting that data from one dataset and using it to
seed an new dataset:

The chart table is a fairly atomic unit with more depending
on it, than it depends on.  I have before taken a snapshot of
chart to accomplish this purpose.

But the parts table is hard to segregate from the payables to
vendors which put those parts into your database.  And the
chart of accounts and the entries that make their way into
partscustomer, partsgroup, partstax, partsvendor, pricegroup
and perhaps other tables.

LedgerSMB::API is not yet complete.  Others who have a similar
itch to scratch are invited to join the effort.  But it is
successfully handling parts already.  It will provide some
(but not complete) guidance in addressing your issue.

-- Hugh Esco

P.S.  I am currently seeking gainful employment: short
term projects, contract work or full time positions are all
considered.  I have strong Perl / SQL development skills,
as well as systems administration experience.  I am willing
to relocate and welcome any leads folks might share with me.

--
Hugh Esco
770-250-5192 x21
http://www.CampaignFoundations.com/
Providing Application Hosting,
Telephony and IT Development Services
to Green Candidates, Green Parties and
the non profits working for a just and sustainable future.


From: ..hidden..
Subject: Ledger-smb-users Digest, Vol 35, Issue 1
To: ..hidden..
Date: Wed, 08 Jul 2009 20:10:48 +0000

Today's Topics:

   4. Inderesting Postgres/LSMB issue? (beamends)
   5. Exporting data (beamends)

----------------------------------------------------------------------

Message: 4
Date: Mon, 06 Jul 2009 15:09:42 +0100
From: beamends <..hidden..>
Subject: [Ledger-smb-users] Inderesting Postgres/LSMB issue?
To: LedgerMSB <..hidden..>
Message-ID: <..hidden..>
Content-Type: text/plain

Hi all,
I've been trying to create new rows from a C program. I can see the new
rows from phppgadmin ok, but the records are not visible form LSMB (yes,
I am using the right dbase!).

Any ideas? Am I missing some vital field or something?

The SQL is:

INSERT INTO parts (id, partnumber, lastcost, sellprice, drawing,
description, microfiche, income_accno_id, expense_accno_id,
unit)
VALUES (27791, '1013938', 1.86, 3.00, 'LAND ROVER800', 'PLUG - OIL
DRAIN', '800', 10023, 10075, '1')

Cheers
Richard

------------------------------

Message: 5
Date: Wed, 08 Jul 2009 10:33:52 +0100
From: beamends <..hidden..>
Subject: [Ledger-smb-users] Exporting data
To: LedgerMSB <..hidden..>
Message-ID: <..hidden..>
Content-Type: text/plain

Hi All,
I need to create a new company using all the parts records, chart of
accounts etc from an existing one, but without the actual accounting
info (invoices and such) - starting with a clean sheet so to speak.

Is this possible?

Cheers
Richard

_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users

End of Ledger-smb-users Digest, Vol 35, Issue 1
***********************************************