\n";
$owners = sqlSelect("iowners", "", "", "full_name");
// if no data is pending, then initiate a search (even if the product doesn't exist)
echo "
\n";
echo " \n";
echo "
\n";
if (!empty($_REQUEST['ref']))
{
if (($pCode = getInventoryReference($_REQUEST['ref'])) == false)
{ echo "Unknown Product Code \n";
}
else
{
echo "\n";
// what is it?
$iDat = getProductInfo($pCode);
echo "{$iDat['vend']} {$iDat['description']} ({$iDat['vsn']})
\n";
// now see if there is any OPEN stock
$q = "item='$pCode' and workorder='' and iloc!='' and status='' and sof=''";
// set up filter
if (!empty($_REQUEST['owner']))
$q .= " and `owner`='{$_REQUEST['owner']}'";
$r = sqlSelect("inventory", $q, "iloc,owner", "iloc,owner");
echo "OPEN Stock \n";
if ($r['n'])
{ // there is OPEN stock - $r contains a list of LOCATIONS with stock
echo "
\n";
while ($loc = mysql_fetch_assoc($r['r']))
{ // get description of location
$l = sqlSelect("iloc", "shortname='{$loc['iloc']}'");
$l = mysql_fetch_assoc($l['r']);
$l = $l['description'];
// get qty of item in this location
$full_name = getFullOwnersName($loc['owner']);
$q = "item='$pCode' and iloc='{$loc['iloc']}' and workorder='' and sof='' and owner='{$loc['owner']}'";
$q = sqlSelect("inventory", $q);
if ($q['n'])
{ echo "
\n";
echo "
{$q['n']}
\n";
echo "
$l
\n";
echo "
[$full_name]
\n";
echo "
\n";
}
}
echo "
\n";
}
else
echo "No OPEN stock available \n";
// check for RESERVED stock
echo " RESERVED Stock \n";
$q = "item='$pCode' and workorder!='' and iloc!='' and status='' and sof=''";
// set up filter
if (!empty($_REQUEST['owner']))
$q .= " and `owner`='{$_REQUEST['owner']}'";
$r = sqlSelect("inventory", $q, "workorder,iloc,owner", "workorder,iloc,owner");
//echo "\n";
if ($r['n'])
{ // there is RESERVED stock - $r contains a list of LOCATIONS with stock
echo "
\n";
while ($loc = mysql_fetch_assoc($r['r']))
{
$full_name = getFullOwnersName($loc['owner']);
$q = "item='$pCode' and owner='{$loc['owner']}' and iloc='{$loc['iloc']}' and workorder='{$loc['workorder']}' and status='' and sof=''";
$q = sqlSelect("inventory", $q);
// get description of location
$l = sqlSelect("iloc", "shortname='{$loc['iloc']}'");
$l = mysql_fetch_assoc($l['r']);
$l = $l['description'];
//$woDat = mysql__query("select * from headers where tid='{$loc['workorder']}'", $mLink);
$woDat = sqlEx("select * from headers where tid='{$loc['workorder']}'");
$woDat = mysql_fetch_assoc($woDat);
echo "