$v) { if ($str != "") $str .= ", "; $str .= "$k='$v'"; } $r = sqlRecycle("inventory", $str, "item=''"); break; } } if (!empty($_REQUEST['productCode']) and !empty($_REQUEST['productQty'])) { $iCode = getInventoryReference($_REQUEST['productCode']); $tracked = isTrackable($_REQUEST['owner'], $_REQUEST['productCode'], "vsn"); while ($_REQUEST['productQty'] > 0) { if ($tracked) { $q = "select tid from inventory where item='$iCode' and owner='{$_REQUEST['owner']}' and iloc!='' and workorder='' and transfer='' limit 1"; //$loc = mysql__query($q, $mLink); $loc = sqlEx($q); if (mysql_num_rows($loc)) { $loc = mysql_fetch_assoc($loc); $oldEnt = doITQprefetch($loc['tid']); // $q = "update inventory set workorder='{$_SESSION['jobRef']}' where tid='{$loc['tid']}'"; // my sql_query($q); sqlUpdate("inventory", "workorder='{$_SESSION['jobRef']}'", "tid='{$loc['tid']}'"); $newEnt = doITQprefetch($loc['tid']); doItq($oldEnt, $newEnt, "RES"); } else { $q = "uid='', "; $q .= "qty='1', "; $q .= "item='$iCode', "; $q .= "sn='', "; $q .= "owner='".strtolower($_REQUEST['owner'])."', "; $q .= "iloc='', "; $q .= "workorder='{$_SESSION['jobRef']}', "; $q .= "purchaseorder='', "; $q .= "transfer='', "; $q .= "status='', "; $q .= "sof='', "; $q .= "retail='0.00', "; $q .= "hst='0.00', "; $q .= "gst='0.00', "; $q .= "pst='0.00'"; $r = sqlRecycle("inventory", $q, "item='' and workorder='' and purchaseorder='' and transfer=''"); // ITQ not required } } else { $q = "uid='', "; $q .= "qty='1', "; $q .= "item='$iCode', "; $q .= "sn='', "; $q .= "owner='".strtolower($_REQUEST['owner'])."', "; $q .= "iloc='STOCK', "; $q .= "workorder='{$_SESSION['jobRef']}', "; $q .= "purchaseorder='', "; $q .= "transfer='', "; $q .= "status='', "; $q .= "sof='', "; $q .= "retail='0.00', "; $q .= "hst='0.00', "; $q .= "gst='0.00', "; $q .= "pst='0.00'"; $r = sqlRecycle("inventory", $q, "item='' and workorder='' and purchaseorder='' and transfer=''"); //$oldEnt = array(); $newEnt = doITQprefetch($r['t']); doItq(array(), $newEnt, "ADD"); } $_REQUEST['productQty'] -= 1; } unset($_REQUEST['productCode']); unset($_REQUEST['productQty']); } if (empty($_REQUEST['productQty'])) $_REQUEST['productQty'] = 1; $status = getOrderStatus($_SESSION['jobRef']); if ($status != "CLOSED" and $status != "VOID") { // form is only available if the order is OPEN echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
Qty: Product Code: Owner: \n"; echo "
\n"; } echo "
Assigned Parts

\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; // get a list of all parts assigned to this order $partsList = sqlSelect("inventory", "item!='' and workorder='{$_SESSION['jobRef']}'", "" ,"item"); // and (status='' or status='INS') while ($part = mysql_fetch_assoc($partsList['r'])) { $pDat = getProductInfo($part['item']); //$ownerDat = mysql__query("select * from iowners where short_name='{$part['owner']}'", $mLink); $ownerDat = sqlEx("select * from iowners where short_name='{$part['owner']}'"); $ownerDat = mysql_fetch_assoc($ownerDat); echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ($part['status'] == "" and $part['iloc'] != "" and $pDat['has_serial']) { echo " \n"; } else echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
QtyItemVendVSNSerialLocationAction
{$part['qty']}{$pDat['description']}{$pDat['vend']}{$pDat['vsn']}\n"; echo "
\n"; echo " \n"; echo " \n"; echo "
\n"; echo "
{$part['sn']}\n"; if ($part['status'] == "" and $part['iloc'] == "") { $available = sqlSelect("inventory", "item='{$part['item']}' and iloc!='' and workorder='' and status='' and owner='".strtolower($ownerDat['short_name'])."'", "iloc", "iloc"); //echo "\n"; if ($available['n']) { echo "
\n"; echo "\n"; } else echo "BACKORDER"; } else echo $part['iloc']; echo "
\n"; if ($part['status'] == "") { echo "\n"; echo "\n"; } else { switch ($part['status']) { case "INS": echo "Installed"; break; case "ORD": echo "ORDERED"; break; } } echo "
\n"; ?>