";
if (count($job))
{ echo "Order ".$job['jobNo'];
foreach ($job as $k => $v)
$_REQUEST[$k] = $v;
}
else
echo "New Order";
echo " Details
\n";
if ($job['status'] == "CLOSED" or $job['status'] == "VOID")
$da = " DISABLED";
else
$da = "";
$_REQUEST['formDisable'] = $da;
if (!empty($_REQUEST['delComment']))
{ $r = sqlUpdate("logents", "eType='D'", "tid='{$_REQUEST['commentRef']}'");
echo "\n";
unset($_REQUEST['commentRef']);
unset($_REQUEST['tagLine']);
unset($_REQUEST['delComment']);
}
// later, there is an option to "correct" client data master copy - this should only be allowed if the current
// client data currently matches the master record (otherwise, it is presumed that the client reference is to
// a "bill to". to accomplish this, we need to know if there IS a match
$isSameClient = 0;
if (!empty($_REQUEST['cCode']))
{ $isSameClient = 1;
$clientdat = sqlSelect("clientdat", "cCode = '".$_REQUEST['cCode']."'");
$clientdat = mysql_fetch_assoc($clientdat['r']);
if (is_array($clientdat))
{ foreach ($clientdat as $k => $v)
{ //echo "[$k] -> $v; REQUEST[$k] -> {$_REQUEST[$k]} -->\n";
if ($k != "pc" and $k != "tid" and $k != "lastmod" and $k != "csid" and $_REQUEST[$k] != $v)
{ $isSameClient = 0;
//echo "\n";
}
else
{ //echo "\n";
}
//$_REQUEST[$k] = $v;
}
}
}
if (!empty($_REQUEST['clientRef']))
{ $isSameClient = 0;
$clientdat = sqlSelect("clientdat", "tid = '".$_REQUEST['clientRef']."'");
$clientdat = mysql_fetch_assoc($clientdat['r']);
foreach ($clientdat as $k => $v)
$_REQUEST[$k] = $v;
}
// get a list of clients for quick selection
// store these in an array so we can easily reuse them
$clientList = sqlSelect("clientdat", "cCode != ''", "", "lName, fName");
while ($clientdat = mysql_fetch_assoc($clientList['r']))
$clientArray[$clientdat['cCode']] = $clientdat;
unset($clientdat);
unset($clientList);
// get a list of all open order for later ...
if (!empty($_REQUEST['jobNo']))
{ $openOrders = sqlSelect("headers", "status!='CLOSED' and status!='VOID' and jobNo!='' and cCode!='' and jobNo!='{$_REQUEST['jobNo']}'","lName,fName");
while ($oo = mysql_fetch_assoc($openOrders['r']))
$openOrderList[] = $oo['tid']."|".$oo['jobNo']." - ".fixName($oo['fName'],$oo['lName']);
unset($openOrders);
unset($oo);
}
else
$openOrderList = array();
if (empty($_REQUEST['jobRef']) and empty($_REQUEST['jobNo']))
{ $_REQUEST['iniDate'] = date("Ymd");
echo "