<!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 language="JavaScript" src="../jscript/gen_validatorv4_2.js"  type="text/javascript" xml:space="preserve"></script>

<?php

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

$truss_id=$_GET['truss_id'];

$table_name = $_SESSION['db_prefix']."_trusses_temp";
$truss_query = "SELECT * FROM $table_name WHERE truss_id = '".$truss_id."' ";

$truss_result = mySQL_query($truss_query);
$type_1 = mysql_result($truss_result, 0, "type_1");
$type_2 = mysql_result($truss_result, 0, "type_2");
$type_3 = mysql_result($truss_result, 0, "type_3");
$qty = mysql_result($truss_result, 0, "qty");
$span = mysql_result($truss_result, 0, "span");
$press_points = mysql_result($truss_result, 0, "press_points");

$table_name = $_SESSION['db_prefix']."_list_truss_type_1"; 
$type_1_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
$arrId1 = array ();
$arrName1 = array ();
$type_1_result = execsql($type_1_query);
$type_1_num = mysql_num_rows($type_1_result);
$a = 0;
while ($a < $type_1_num) {
		$arrId1[$a] = mysql_result($type_1_result, $a, "item_name");
		$arrName1[$a] = mysql_result($type_1_result, $a, "item_name");
		$a++;
	}
	
$table_name = $_SESSION['db_prefix']."_list_truss_type_2"; 
$type_2_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
$arrId2 = array ();
$arrName2 = array ();
$type_2_result = execsql($type_2_query);
$type_2_num = mysql_num_rows($type_2_result);
$a = 0;
while ($a < $type_2_num) {
		$arrId2[$a] = mysql_result($type_2_result, $a, "item_name");
		$arrName2[$a] = mysql_result($type_2_result, $a, "item_name");
		$a++;
	}
	
$table_name = $_SESSION['db_prefix']."_list_truss_type_3"; 
$type_3_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
$arrId3 = array ();
$arrName3 = array ();
$type_3_result = execsql($type_3_query);
$type_3_num = mysql_num_rows($type_3_result);
$a = 0;
while ($a < $type_3_num) {
		$arrId3[$a] = mysql_result($type_3_result, $a, "item_name");
		$arrName3[$a] = mysql_result($type_3_result, $a, "item_name");
		$a++;
	}
	

?>
<script type="text/javascript">
function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
}
document.onkeypress = stopRKey;
</script> 

<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]+"'");
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</script>

<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>


 


</head>
<body >
<form action="../production/trussesJobWizbase.php" method="get" name="form1" target="_top" id="form1">

<table width="460" border="0" align="center" cellpadding="0" cellspacing="0" class="list2">
  <tr>
    <td  align="center">
     
      <table width="430" border="0">
        <tr>
          <td height="46" colspan="4"><label class="label_std">Truss type:</label>
            <select name="type_1_text" id="type_1_text" class="select200" >
              <option value="<?php echo $type_1 ?>" selected="selected"><?php echo $type_1 ?></option>
              <?php
    	for ($i = 0; $i < count($arrId1); $i++) {
		echo "<option value=" . "\"" . $arrId1[$i] . "\"" . ">" . $arrName1[$i] . "</option>";
		
		}
     ?>
            </select>
            
            <label for="select2"></label>
            <label for="select3">
              <select name="type_2_text" id="type_2_text" class="select200" >
              <option value="<?php echo $type_2 ?>" selected="selected"><?php echo $type_2 ?></option>
                <option value=""></option>
                <?php
    	for ($i = 0; $i < count($arrId2); $i++) {
		echo "<option value=" . "\"" . $arrId2[$i] . "\"" . ">" . $arrName2[$i] . "</option>";
		
		}
     ?>
              </select>
              <select name="type_3_text" id="type_3_text" class="select200" >
              <option value="<?php echo $type_3 ?>" selected="selected"><?php echo $type_3 ?></option>
                <option value=""></option>
                <?php
    	for ($i = 0; $i < count($arrId3); $i++) {
		echo "<option value=" . "\"" . $arrId3[$i] . "\"" . ">" . $arrName3[$i] . "</option>";
		
		}
     ?>
              </select>
            </label></td>
          </tr>
        <tr>
          <td width="101" height="33"><label class="label_std">No of trusses:</label></td>
          <td width="99"><label for="textfield"></label>
            <input name="qty_text" type="text" id="qty_text" size="10" value="<?php echo $qty ?>" onkeypress="return numbersonly(this, event)"/></td>
          <td width="118"><label class="label_std">No of FT:</label></td>
          <td width="94"><input name="press_points_text" type="text" id="press_points_text" size="10" value="<?php echo $press_points ?>" onkeypress="return numbersonly(this, event)"/></td>
        </tr>
        <tr>
          <td height="30">&nbsp;</td>
          <td>&nbsp;</td>
          <td><label class="label_std">Span:</label></td>
          <td><input name="span_text" type="text" id="span_text" size="10" value="<?php echo $span ?>" onkeypress="return numbersonly(this, event)"/></td>
        </tr>
        </table>
      <?php $line_no = $_SESSION['line_no'] ?>
      <input name="truss_id" type="hidden" value="<?php echo $truss_id?>" />      
      <input name="p" type="hidden" value="2" />
      <input name="s" type="hidden" value="11" />
      </td>
  </tr>
  <tr>
    <td height="45" align="center"><br />
      <input name="input" type="submit" value="Edit" class="imagebutton"  />
      <input name="button" type="button" class="imagebutton" id="button" onclick="MM_goToURL('parent','../production/trussesJobWizbase.php?p=2&s=');return document.MM_returnValue"  value="Cancel" />      
    </td>
  </tr>
</table>
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("type_1_text","req","Please enter truss type.");
  frmvalidator.addValidation("type_2_text","req","Please enter truss type.");
  frmvalidator.addValidation("qty_text","req","Please enter number of trusses."); 
  frmvalidator.addValidation("press_points_text","req","Please enter number of FT."); 
  frmvalidator.addValidation("span_text","req","Please enter number span of the truss.");    
</script>
</body>
</html>