<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<?php

include('../include/db.php');
include('../include/session.php');		


$q = "SELECT productId, productName FROM nam_products WHERE category ='Tiles and Accessories' AND isRemoved != '1' ORDER BY productName ASC";
	$arrId = array ();
	$arrName = array ();
	$result = execsql($q);
	$num = mysql_num_rows($result);
	$a = 0;
	while ($a < $num) {
		$arrId[$a] = mysql_result($result, $a, "productId");
		$arrName[$a] = mysql_result($result, $a, "productName");
		$a++;
	}

		
$line_no  = $_GET['line_no'];
$i = $line_no;
$quantity = $_GET['quantity'];
$productId = $_GET['productId'];
$productName = 	 $_GET['productName'];
$orderNo = 	 $_GET['OrderNoText'];
$saleId = $_GET['saleId']; 
$reserved = $_GET['reserved'];


?>
<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>

 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
</head>

<?php if  (($quantity-$reserved)!=0) { ?><br />
<br />
<div id="coloredContainer2" ><div align="center">
	<label class="std">Part of this order has been delivered allready.</label><br />
<label class="std">You cannot change it anymore.</label><br />
<br /></div>
</div><br />
<br />

<div align="center">
<input name="button" type="button" id="button" class="imagebutton" onclick="MM_goToURL('parent','editOrder.php?OrderNoText=<?php echo $orderNo ?>&edit=0');return document.MM_returnValue" value="OK" />
</div>
<?php } else { ?>
<form action="editOrder.php" method="get" name="form1" target="_top" id="form1">
<body><table width="290" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="290">
    <p class="wizard3">
<label class="std"> To change select a new product and/or change the quantity.</label><br />
<label class="std"> <font color=red>To remove, make quantity zero. </font></label>
</p>

<p class="wizard3"><label class='std'>product:</label> 
      <select name="ProductSelect">
        <option value="<?php echo $productId?>" selected="selected"><?php echo $productName ?></option>
        <?php
        	for ($i = 0; $i < count($arrId); $i++) {
    		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
	}
?>
      </select>
    </p>
    <p class="wizard3"><label class='std'>quantity:</label>
      <input name="QuantityText" type="text" id="QuantityText" size="10" value="<?php echo $quantity ?>" onfocus = "this.select();"/>
    
  </p>
   </td>
  </tr>
  <tr>
    <td align="center"><input name="input" type="submit" value="Change" class="imagebutton"  />
      <input name="button2" type="button" id="button2" class="imagebutton" onclick="MM_goToURL('parent','editOrder.php?OrderNoText=<?php echo $orderNo ?>&edit=0');return document.MM_returnValue" value="Cancel" />
      <input name="OrderNoText" type="hidden" id="OrderNoText" value="<?php echo $orderNo ?>" />
      <input name="edit" type="hidden" id="edit" value="2" />
      <input name="saleId" type="hidden" id="saleId" value="<?php echo $saleId ?>" /></td>
  </tr>
</table>
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("ProductSelect","req","Please select a product.");
  frmvalidator.addValidation("QuantityText","req","Please enter the quantity.");
<?php } ?>    
    
    
   


  
</script>
</body>
</html>