Here is a brief article entitled "Using Python to Load Binary Files into
Postgres".
http://iamtgc.com/2007/08/04/using-python-to-load-binary-files-into-postgres/
The article suggests using the Binary method of |psycopg2,a Python
module for interfacing with Postgres.| The method wraps the binary
representation of the image.
|curs.execute(||"UPDATE usertable SET avatar_image = %s WHERE username =
%s"||, (psycopg2.Binary(binary), sys.argv[||2||]))|
||
I realize that LedgerSMB is written Perl. Perhaps there is some
equivalent to |psycopg2| in Perl?
Thanks.
Brian
------------------------------------------------------------------------
Brian Wolf
Activus Technologies
Phone: 410.367.2958
Email: [email protected]
Try out Activus Secure Payments^(TM), our recurring payments application.
Demo at http://demo.activustech.com
------------------------------------------------------------------------
On 07/19/2012 05:47 PM, Erik Huelsmann wrote:
Hi Brian,
Regarding the accounts to be used: you should be able to work with the
standard income accounts. If you want to differentiate between
different types of income, that's when you start creating multiple
income accounts. So, you should be able to work with 4010. The
Purchases 5010 account doesn't work: the account should be used for
things bought. This is not what happens with the parts. Let's consider
an example.
You buy 500 items of part p10. Your buying price is 1$ each. So,
immediately after delivery of the items you have paid 500$. These 500$
have been turned into inventory, but you didn't actually earn anything
yet. Say your selling price is 2$ and you have a single customer who
buys 100 items from you every month.
Now, using the "Cost of goods sold" (COGS) method what happens is
this: every month you sell 100 items, leading to 200$ in earnings. At
the same time your inventory is reduced by 100$ because you're
transferring inventory to your customer. The reduction in inventory is
accounted for in your PNL as expenses on the COGS account. The result
is that your profit (earnings minus cost) are 100$ each month.
Usually the COGS expenses are posted on a COGS expense account.
Hope that explains it. If not, don't hesitate to ask.
Setting the partsgroup together with seeding the database shouldn't be
much of a problem: it only requires that you seed the partsgroup table
as well as the parts table.... Uploading the pictures is the more
difficult part, although even that is quite manageable.
The strategy I used to seed a parts table I had to seed is: create a
temporary table in the database you want to seed the parts table in.
Then upload the original data in that table. Create columns in the
temp table to hold the IDs used in the parts and other tables. Then,
use INSERT ... SELECT ...; statements to insert data into the parts
and other tables until satisfied. As the last step, drop the temporary
tables.
Hope that helps.
Bye,
Erik.
On Thu, Jul 19, 2012 at 11:14 PM, Brian Wolf <[email protected]
<mailto:[email protected]>> wrote:
Erik,
Thanks for responding. You got the two questions right. I need
to populate the parts table, and assign each part to a category
(partsgroup) along the way. My accounting background is rather
slim..... should new income and expense accounts be created? Or,
use existing (eg, Sales 4010 and Purchases 5010)? There are no
services at this point for the company.
I'd be happy to write it with you. I'm also new to Perl; I've
been using Python for years and was going to write the load script
using a tool like SQLAlchemy.
Thanks.
Brian
------------------------------------------------------------------------
Brian Wolf
Activus Technologies
Phone: 410.367.2958 <tel:410.367.2958>
Email: [email protected] <mailto:[email protected]>
Try out Activus Secure Payments^(TM), our recurring payments
application.
Demo at http://demo.activustech.com
------------------------------------------------------------------------
On 07/19/2012 04:49 PM, Erik Huelsmann wrote:
Hi Brian,
On Thu, Jul 19, 2012 at 3:09 PM, Brian Wolf
<[email protected] <mailto:[email protected]>> wrote:
What is the best way to insert an associated photo in the
file_part table? Meaning, is there a way of duplicating the
upload feature?
Looks like there are three account numbers that should be
supplied. How are these determined?
inventory_accno_id integer,
income_accno_id integer,
expense_accno_id integer,
Am I correct to read at least two questions here?
1. How can I upload multiple parts (or maybe: how can I create an
initially seeded parts table)?
2. Once I have a parts table filled, how can I insert the
pictures belonging to these parts into the file_part table?
In order to be able to do (1) you indeed need to identify the
accounts to book inventory, income and COGS on. These IDs
correspond to the ID column from the 'account' table. If you
intend to set up services, you don't need to fill the
'inventory_accno_id' column.
As far as the upload of pictures goes: that's a bit tough,
because the data is encoded before it's sent to the database.
You'd need to duplicate the encoding (I think it's base64, but
not sure) and do the upload yourself... But maybe it's more
practical that we write the upload script together to allow you
to write a script to drive a web based upload to achieve the same
purpose, much like the CSV uploads for gl accounts and some other
items that I wrote for 1.4?
Bye,
Erik.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ledger-smb-users mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond.
Discussions
will include endpoint security, mobile security and the latest in
malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ledger-smb-users mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ledger-smb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ledger-smb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users