VbzCart/queries/qryRstkItms expected
< VbzCart | queries
Jump to navigation
Jump to search
Revision as of 21:48, 4 December 2008 by Woozle (talk | contribs) (VbzCart/queries/qryRstkItms en route moved to VbzCart/queries/qryRstkItms expected: reorganized terminology)
Details
- Returns: Restock items requested, not yet received, but possibly expected because the restock request hasn't been closed or orphaned.
- Requires:
- REDIRECT Template:l/vc/table, rstk_rcd,
- REDIRECT Template:l/vc/query
- History:
- 2008-11-19 Created for new restock process
- 2008-11-24 QtyRecd falls back on QtyFiled if null
SQL
<mysql>CREATE OR REPLACE VIEW qryRstkItms_en_route AS SELECT
rqi.ID_Restock, rqi.ID_Item, SUM(rqi.QtyOrd) AS QtyOrd, SUM(IFNULL(rcl.QtyRecd,rcl.QtyFiled)) AS QtyRecd
FROM
(rstk_rcd_line AS rcl LEFT JOIN rstk_rcd AS rc ON rcl.ID_RstkRcd=rc.ID) LEFT JOIN qryRstkItms_active AS rqi ON (rc.ID_Restock=rqi.ID_Restock) AND (rcl.ID_Item=rqi.ID_Item)
GROUP BY rqi.ID_Restock, rqi.ID_Item HAVING IFNULL(QtyOrd,0)-IFNULL(QtyRecd,0);</mysql>