VbzCart/docs/queries/qryRstkReq Item Rcd status: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | queries
Jump to navigation Jump to search
imported>Woozle
(New page: ==Details== * '''Returns''': Information about received shipments for a given Item in a given Restock Request * '''Requires''': {{vbzcart/table|rstk_rcd_line}}, {{vbzcart/table|rstk_rcd}},...)
 
 
(No difference)

Latest revision as of 01:55, 25 February 2024

Details

  • Returns: Information about received shipments for a given Item in a given Restock Request
  • Requires: Template:Vbzcart/table, Template:Vbzcart/table, Template:Vbzcart/table
  • Used by: Template:Vbzcart/query
  • History:
    • 2008-11-21 Created for new restock process
    • 2008-11-23 WhenOrdered -> WhenFirstOrder (MIN), WhenFinalOrder (MAX)
  • Fields:
    • WhenFirstOrder is the timestamp of the earliest open customer order for this item. This is so we know the longest time that anyone has been waiting for this item, and hence how urgent the restock is.
    • WhenFinalOrder is the timestamp of the latest open customer order for this item. This is so we know if there have been further requests for this item, adding further urgency.

SQL

<section begin=sql /><mysql>CREATE OR REPLACE VIEW qryRstkReq_Item_Rcd_status AS SELECT

 rq.ID AS ID_RstkReq,
 MIN(rq.WhenOrdered) AS WhenFirstOrder,
 MAX(rq.WhenOrdered) AS WhenFinalOrder,
 rcl.ID_Item,
 SUM(IFNULL(rcl.QtyFiled,rcl.QtyRecd)) AS QtyRecd

FROM

     (rstk_rcd_line AS rcl
   LEFT JOIN rstk_rcd AS rc ON rcl.ID_RstkRcd=rc.ID)
 LEFT JOIN rstk_req AS rq ON rc.ID_Restock=rq.ID

GROUP BY rq.ID, rcl.ID_Item;</mysql> <section end=sql />