Difference between revisions of "VbzCart/queries/qryItems needed forStock"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
("returns" explanation)
(obsolete)
Line 1: Line 1:
 
==About==
 
==About==
 +
* '''Obsolete''': use VCA_Items::SQL_forNeeded_forStock() instead
 
* '''Returns''': catalog items we need to order more of in order to satisfy stock minima
 
* '''Returns''': catalog items we need to order more of in order to satisfy stock minima
 
** Items may be needed for other reasons, but they will not be listed here unless they satisfy that criterion.
 
** Items may be needed for other reasons, but they will not be listed here unless they satisfy that criterion.
 
* '''History''':
 
* '''History''':
 
** '''2010-01-02''' Created
 
** '''2010-01-02''' Created
 +
** '''2015-12-30''' Replaced with PHP-generated SQL
 
* '''Used by''': VbzAdminStkItems::Needed() - restock request creation in VbzAdmin
 
* '''Used by''': VbzAdminStkItems::Needed() - restock request creation in VbzAdmin
 
* '''Requires''': {{vbzcart/query|qryStkItms_for_sale}}
 
* '''Requires''': {{vbzcart/query|qryStkItms_for_sale}}
 
==SQL==
 
==SQL==
<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryItems_needed_forStock AS
+
<mysql>CREATE OR REPLACE VIEW qryItems_needed_forStock AS
 
SELECT
 
SELECT
 
   i.ID,
 
   i.ID,
Line 16: Line 18:
 
   ON s.ID_Item=i.ID
 
   ON s.ID_Item=i.ID
 
WHERE i.isForSale AND ((i.QtyMin_Stk - s.QtyForSale) > 0);</mysql>
 
WHERE i.isForSale AND ((i.QtyMin_Stk - s.QtyForSale) > 0);</mysql>
<section end=sql />
 

Revision as of 02:16, 31 December 2015

About

  • Obsolete: use VCA_Items::SQL_forNeeded_forStock() instead
  • Returns: catalog items we need to order more of in order to satisfy stock minima
    • Items may be needed for other reasons, but they will not be listed here unless they satisfy that criterion.
  • History:
    • 2010-01-02 Created
    • 2015-12-30 Replaced with PHP-generated SQL
  • Used by: VbzAdminStkItems::Needed() - restock request creation in VbzAdmin
  • Requires:
  1. REDIRECT Template:l/vc/query

SQL

<mysql>CREATE OR REPLACE VIEW qryItems_needed_forStock AS SELECT

 i.ID,
 i.QtyMin_Stk,
 s.QtyForSale

FROM cat_items AS i

 LEFT JOIN qryStkItms_for_sale AS s
 ON s.ID_Item=i.ID

WHERE i.isForSale AND ((i.QtyMin_Stk - s.QtyForSale) > 0);</mysql>