(Thank you, both Teddy and Fred.)
Quote:
|
Originally Posted by Teddy
You will need to move more to an "invoice" based system than inventory. Whereas the same item CAN come in twice at different cost, you need to track invoices to get accurate pricing. What gets funny is when you need to pull from two different invoices of the same item to accomplish one print job because you ran out of quantity...
That's assuming you require a total cost per job instead of total operating costs to date.
|
Yes, it is becoming trickier than I thought, and yes, we do want a
per job cost.
Any suggestions on how to implement what you described? Is there an elegant, easy way to pull the price from the correct invoice? My guess so far is that the database front-end calculates the total lifetime quantity used of (for example) blue paper. Then, the front-end subtracts the quantity from invoices until it finds the oldest invoice with remaining quantity.
For each inventory item per invoice, should I "cache" the available quantity? For example:
INVOICE
* invoice_id
* date
INVOICE_ITEMS (links a vendor invoice with inventory)
* invoice_item_id
* invoice_id
* inventory_id
* units_purchased
* units_available (cached/calculated value)
* price_per_unit
INVENTORY_ITEMS
* inventory_id
* description
JOB_ITEMS (items in each job)
* job_item_id
* job_id
* invoice_id (
changed from inventory_id)
* quantity
JOBS
* job_id
* date