Difference between revisions of "VbzCart/tables/stk lines"
Jump to navigation
Jump to search
(extracted from VbzCart/tables) |
(note about usage and future of WhenRemoved field, which is now deprecated) |
||
Line 2: | Line 2: | ||
* '''Purpose''': listing of what is now and what used to be in stock | * '''Purpose''': listing of what is now and what used to be in stock | ||
* '''Refers to''': {{vbzcart/table|stk_bins}}, {{vbzcart/table|cat_items}} | * '''Refers to''': {{vbzcart/table|stk_bins}}, {{vbzcart/table|cat_items}} | ||
+ | * '''Notes''': In early versions of VbzCart, this table was partly used as a sort of klugey stock-log. If a row containing qty>1 had less than qty removed from it, a new row was "split off" from the existing row and then the WhenRemoved timestamp was set, rather than setting qty to 0. | ||
+ | * '''Fields''': | ||
+ | ** '''WhenRemoved''': DEPRECATED. Keep setting it properly until it is removed completely, but don't use it. | ||
+ | * '''Future''': For all existing data where WhenRemoved is set and Qty>0, create stock log entries showing the removal and set Qty to 0. Finally, remove the WhenRemoved field altogether. Code which uses WhenRemoved as a flag should check the Qty field instead ("WhenRemoved IS NULL" -> "Qty > 0", "WhenRemoved IS NOT NULL" -> "Qty == 0"). | ||
==SQL== | ==SQL== | ||
<section begin=sql /><mysql>DROP TABLE IF EXISTS `stk_items`; | <section begin=sql /><mysql>DROP TABLE IF EXISTS `stk_items`; |
Revision as of 15:36, 17 June 2010
About
- Purpose: listing of what is now and what used to be in stock
- Refers to:
- REDIRECT Template:l/vc/table, cat_items
- Notes: In early versions of VbzCart, this table was partly used as a sort of klugey stock-log. If a row containing qty>1 had less than qty removed from it, a new row was "split off" from the existing row and then the WhenRemoved timestamp was set, rather than setting qty to 0.
- Fields:
- WhenRemoved: DEPRECATED. Keep setting it properly until it is removed completely, but don't use it.
- Future: For all existing data where WhenRemoved is set and Qty>0, create stock log entries showing the removal and set Qty to 0. Finally, remove the WhenRemoved field altogether. Code which uses WhenRemoved as a flag should check the Qty field instead ("WhenRemoved IS NULL" -> "Qty > 0", "WhenRemoved IS NOT NULL" -> "Qty == 0").
SQL
<mysql>DROP TABLE IF EXISTS `stk_items`; CREATE TABLE `stk_items` (
`ID` INT NOT NULL AUTO_INCREMENT, `ID_Bin` INT DEFAULT NULL COMMENT 'stk_bins.ID: which bin these items are in', `ID_Item` INT DEFAULT NULL COMMENT 'cat_items.ID: which exact type of item', `Qty` INT DEFAULT NULL, `WhenAdded` DATETIME DEFAULT NULL COMMENT 'when stock record was created for this item', `WhenChanged` DATETIME DEFAULT NULL COMMENT "when the quantity for this record was last altered (e.g. stock rmvd, or a split)", `WhenCounted` DATETIME DEFAULT NULL COMMENT "when this stock record was last verified by hand-count", `WhenRemoved` DATETIME DEFAULT NULL COMMENT "if not NULL, item is no longer in stock", `Cost` INT DEFAULT NULL COMMENT "what we paid (each) for these particular items in stock", `CatNum` varchar(63) DEFAULT NULL COMMENT "catalog number on tag (official cat# can change over time)", `Notes` TEXT, PRIMARY KEY(`ID`) ) ENGINE = MYISAM;</mysql>