-- Group: frozenItemSites
-- Name: detail
-- Notes: used by dspFrozenItemSites
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.

SELECT itemsite_id, warehous_code, item_number,
        (item_descrip1 || ' ' || item_descrip2) AS descrip,
        COALESCE((SELECT invcnt_tagnumber
                  FROM invcnt
                  WHERE ((NOT invcnt_posted)
                          AND (invcnt_itemsite_id=itemsite_id)) LIMIT 1), '') AS cnttag
FROM itemsite, item, whsinfo
WHERE ( (itemsite_item_id=item_id)
    AND (itemsite_warehous_id=warehous_id)
    AND (itemsite_freeze)
<? if exists("warehous_id") ?>
    AND (itemsite_warehous_id=<? value("warehous_id") ?>)
<? endif ?>
      )
ORDER BY warehous_code, item_number;
