<!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" />

  

<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4_2.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/go_to_url.js"  type="text/javascript"></script> 

<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />

<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<?php


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

;
$job_no=$_GET['job_no'];
$bill_id = $_GET['bill_id'];
$class = $_GET['class'];



$table_name = $_SESSION['db_prefix']."_store_items";
$dropDownQuery = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory='timber' AND class='".$class."' AND width > '50' AND depth < '50' ORDER BY depth, width";
$dropDownResult = execsql($dropDownQuery);
	$num = mysql_num_rows($dropDownResult);
	$a = 0;
	$arrId = array ();
	$arrName = array ();
	while ($a < $num) {
		$arrId[$a] = mysql_result($dropDownResult, $a, "store_item_id");
		$arrName[$a] = mysql_result($dropDownResult, $a, "item_name");
		$arrUnit[$a] = mysql_result($dropDownResult, $a, "unit");
		
		$a++;
	}

//$store_item_id = $_GET['store_item_id'];
//$table_name = $_SESSION['db_prefix']."_store_items";
//$categoryQuery = "SELECT category, subCategory FROM $table_name WHERE store_item_id ='". $store_item_id. "' ";
//$categoryResult = execsql($categoryQuery);
//$category = mysql_result($categoryResult, 0, "category");
//$sub_category = mysql_result($categoryResult, 0, "subCategory");
	

?>

<style>
label.label_std{
	margin-left:5px;
    line-height:20px;
	padding-top:6px;
    color:#000;
    text-shadow:1px 1px 1px #fff;
    font:bold 12px Arial;
}

input.imagebutton{
	background-color:#E1E1E1;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#FB6808;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow:0px 0px 0px #CCC;
	-webkit-box-shadow:0px 0px 0px #CCC;
	box-shadow:0px 0px 0px #CCC;
	
}

input.imagebutton:hover{
	background-color:#E4E4E4;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:2px;
	border-color:#FB6808;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow:5px 5px 5px #666;
	-webkit-box-shadow:5px 5px 5px #666;
	box-shadow:5px 5px 5px #666;
	
}
</style>
<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>
</head>
<body>
<form action="timber_edit_add_save.php" method="get" name="form2" id="form2" target="_top">

    <table width="450" border="0" align="left" cellpadding="0" cellspacing="0" class="list2" id="select_table">
    <tr>
      <td height="38" align="center"><label class="label_std">Select timber and enter quantity</label>&nbsp;<br />
      <br />
        <select name="store_item_select" id="store_item_select" style="width:150px;" >
          <option value=" " selected="selected"> </option>
          
          <?php
    	for ($i = 0; $i < count($arrId); $i++) {
		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
		$_SESSION['productName'] = $arrName[$i];
		//foreach($arrId as $key=>$value){
			//echo "<option value=\"delivery.php?store_item_id=".$arrId[$i]."&cat=$cat&formEnabled2=1&date=$date" . "\"" . ">" . $arrName[$i] . "</option>";	
	    }
     ?>
        </select>
        <br />
        <br />
       
      </span></td>
    </tr>
    <tr>
      <td align="center"><label class="label_std">Quantity:&nbsp;
  <input name="quantity_text" type="text" id="quantity_text" size="15" onkeypress="return numbersonly(this, event)" autocomplete="off"/>
      </label></td>
      </tr>
    <tr>
      <td align="center"><br />
        <input name="input" type="submit" value="Add" class="imagebutton"  />
        <input name="cancel_button" type="button" class="imagebutton" id="cancel_button" onclick="needToConfirm = false;MM_goToURL('parent','../production/cutting_bill_edit.php?&amp;job_no=<?php echo $job_no?>&amp;screen=0&amp;sub_category=&amp;edit=1');return document.MM_returnValue"  value="Cancel" />
        <input name="job_no" type="hidden" value="<?php echo $job_no?>" />
      <input name="bill_id" type="hidden" value="<?php echo $bill_id?>" /></td>
    </tr>
  </table>
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form2");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("store_item_select","req","Please select an item.");
  frmvalidator.addValidation("quantity_text","req","Please enter quantity.");
  
</script>
</body>
</html>