VbzCart/tables/ord pkg lines

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to: navigation, search

About

  • Purpose: What's in an order package (
  1. REDIRECT Template:l/vc/table)
  • Refers to: ord_pkgs (parent), ord_lines, cat_items
  • Fields:
    • QtyFromStock may be an obsolete field, as all package quantities should now come from stock.

Rules

  • across all packages, for a given item:
    • quantity ordered - (QtyShipped + QtyNotAvail + QtyKilled) + QtyReturned = quantity we still need to ship
  • When a return package is first created, QtyShipped and QtyReturned will be the same. When the items are returned to stock, QtyShipped will be zero but QtyReturned will be unchanged.
  • If QtyShipped and QtyReturned are both zero, then the line is void and may be reused.

History

  • 2010-10-19 Adding CostShItm and CostSale fields to record prices charged (parallels ChgShipItm and ChgShipPkg in ord_pkgs)
    • Those fields didn't exist until I created them just now (because I thought certain other fields were serving that function), but it's better to have too much data than too little for critical things like packages.
  • 2011-10-08 Added WhenVoided field so we have a quick way of removing lines from the package to put them back into stock (while still keeping a record of what was there).
  • 2014-06-14
    • Added QtyReturned so we can keep track of what was in a return-package.
    • Doing away with:
      • QtyExtra: This should be indicated by setting CostSale and CostShItm to zero.
        • If a given item has some units that are freebies and some that are not, then create separate lines.
      • QtyFromStock All units now must be entered into stock before they can be shipped.
      • WhenVoided - This was not really ever used, and I can't think of a reason it should exist.
  • 2014-06-15 Adding CostShPkg so totals can be recalculated solely from package line data.

SQL

<mysql>CREATE TABLE `ord_pkg_lines` (

 `ID`           INT NOT NULL AUTO_INCREMENT,
 `ID_Pkg`       INT NOT NULL COMMENT "ord_pkgs.ID",
 `ID_Item`      INT NOT NULL COMMENT "cat_items.ID",
 `ID_OrdLine`   INT COMMENT "ord_lines.ID",
 `QtyShipped`   INT COMMENT "quantity included in this package",
 `QtyNotAvail`  INT COMMENT "quantity which can't be filled",
 `QtyKilled`    INT COMMENT "quantity fulfilled by being cancelled",
 `QtyReturned`  INT COMMENT "quantity returned by customer",
 `CostSale`     DECIMAL(9,2) DEFAULT NULL COMMENT "price charged for this item",
 `CostShItm`    DECIMAL(9,2) DEFAULT NULL COMMENT "per-item shipping cost charged",
 `CostShPkg`    DECIMAL(9,2) DEFAULT NULL COMMENT "per-package shipping cost minimum for this item",
 `Notes`        VARCHAR(255),
 PRIMARY KEY(`ID`)

) ENGINE = MYISAM;</mysql>