The system I set up was back before relational databases, it was on
the mainframe and the database was IDMS. The ideas are the same
however.
There were two key tables. Inventory, keyed by warehouse and SKU,
holds the current inventory as well as some snapshot numbers mentioned
below. In that system it had buckets for available-to-ship and
on-hold (not available to ship). InventoryTransactions had one row
for every change to an audited column, which meant all quantity
columns. Other columns identified the status changed (on-hand or
held), the transaction type (customer shipment, transfer shipment,
receipt, adjustment, etc), and the shipment number or receipt number
or adjustment number of the business transaction making the change.
There were also buckets for the last physical inventory count, and (I
think) the date of that count.
Note that this was not a warehousing system with locator information
by individual unit. That would have required a good bit more
complexity.
If the system is built correctly there should not be any need to
reconstruct the on-hand inventory table. The exception would be if
you needed a point-in-time number that you had not saved as part of
the normal database design and system operation. When I did this we
captured the fiscal month-end inventory and the fiscal day-end
inventory. Since we only captured those two numbers they were kept on
the same inventory record that had the current on-hand. We never
neede any other point-in-time numbers.
There was a daily balance that double-checked the previous net change
against the day's transactions, and a similar test at month-end for
the full month's data. (The auditor who reviewed the system - there
was a lot more than inventory, it was a full order processing system
for a billion doller enterprise - said we had more controls and
cross-checks than he could keep track of.)
Today, with relational databases and triggers, I would be taking the
sort of path you described. The InventoryTransactions table would be
write-only, NO updates or deletions, and an INSERT trigger would do
all updates to the audited columns of the Inventory table. Inventory
would have triggers to block any other updates.
Roy Harvey
Beacon Falls, CT
On Sat, 23 Jun 2007 17:13:08 -0500, "Edgard L. Riba" <elriba at rimith
[quoted text, click to view] dot com> wrote:
>Hi Roy,
>Thanks for responding.
>
>> Of course I don't know how much of an issue these sorts of things are
>> for your application, but it is easy to build it in now and horrible
>> to do it later. It isn't really more work to do it right if you start
>> early enough.
>
>These are the sort of things that got me thinking about this. Right now, I
>need to go through the transactions to reconstruct the "on hand inventory"
>table, and that has proven cumbersome...
>
>Do you use this type of design? Could you share with me how you designe
>this table?
>
>Thanks again,
>Edgard