Brian Rosenthal's Weblog

2/23/2005

The wrong way to build accounting and inventory management systems

Filed under: — brian @ 2:36 pm

Well, I have spent two years now doing nothing but building back-end e-commerce technology, and I wanted to just briefly say a few of the thing I learned, which will save you time, if you are trying to build back-end technology that tracks financial transactions, or inventory transactions.

Accounting is a really important concept to understand before you begin building these systems. The reason is that accounting theory specifies how to build a system where you can never have contradictory information.

Here is the first wrong way to build an accounting system:

1. Have a table for products, with a “quantity” field that you update when you change the quantity of the product.

Now, you say, well, I’ll keep a log of changes, and then I’ll know why the inventory changed.

Really? What will you do if the changes do not add up to the quantity field?

Well, you say, I’ll adjust the quantity field then.

Well, then, why would you have the field in the first place?

It’s redundant. Completely redundant, and completely unable to be audited.

2. Build an e-commerce system without a centralized ledger

Wrong. Wrong. Wrong. Wrong.

No matter how you try to build an e-commerce system, if you don’t have a centralized ledger, you won’t be able to have a good idea of what’s going on in your system.

Having a ledger is actually quite easy. You have two tables: “transactions” and “ledger".

You define a set of account types, where an account is a combination of an account type and an account id.

For example, the account storing how much customer store credit someone has is ("ACCT_TYPE_STORE_CREDIT", customer_id).

Now, the transaction model is a transaction is a (type, from_entries, to_entries, args)

You negate the from_entries when you enter them in the ledger, but they have to be positive before they are negated.

Hmmm…. feel free to contact me to talk about this if you’re doing it… we spent a year and a half learning how to do this one right.

Comments »

The URI to TrackBack this entry is: http://blog.brianrosenthal.org/2005/02/23/the-wrong-way-to-build-accounting-and-inventory-management-systems/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)

(required)


Powered by WordPress