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

<?php

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


$job_no = $_GET['job_no'];

$table_name3 = $_SESSION['db_prefix']."_captured_mitek";
$mitek_query = "SELECT * FROM $table_name3 WHERE cap_job = '".$job_no."' ";
$mitek_result = mySQL_query($mitek_query);
$mitek_num = mysql_num_rows($mitek_result);

?>
<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;
	
}

#table_details_display {
	font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
	color:#000;
	font-size:12px;
	cellpadding:5px;
	border-collapse:collapse;
	border:1px solid #999;
	-moz-border-radius: 0px;
    -webkit-border-radius: 0px;
    border-radius: 0px;
    -moz-box-shadow:0px 0px 0px #aaa;
    -webkit-box-shadow:0px 0px 0px #aaa;
    box-shadow:0px 0px 0px #aaa;
}

#table_details_display tr td{
	font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
	color:#000;
	border-collapse:collapse;
	background-color:#FFF;
    border:1px solid #999;
	padding-left:5px;
	padding-right:2px;
	text-align:left;
	
}

</style>



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

<table width="470" border="0" align="center" cellpadding="0" cellspacing="0" class="list2">
  <tr>
              <th>&nbsp;</th>
              <th>&nbsp;</th>
              <th>&nbsp;</th>
              <th>&nbsp;</th>
              <th>&nbsp;</td>
            </tr>
  <tr>
    <td align="center">  
    <div align="left"><label class="label_std">eCo products on this delivery:</label></div>  
      <table width="469" border="0">
      
        <tr>
          <td width="463" height="46">
          <table width="396" align="center" id="table_details_display">
          <tr>
              <th>product</th>
              <th>to deliver</th>
              <th>delivered</th>
              <th>balance</th>
              <th>quantity</th>
            </tr>
            <?php 
	$i=0;
	while ($i<$mitek_num) {
		$cap_item_id = mysql_result($mitek_result, $i, "cap_item_id");
			$table_name4 = $_SESSION['db_prefix']."_store_items";
			$item_query = "SELECT item_name FROM $table_name4 WHERE store_item_id = '".$cap_item_id."' ";
			$item_result = mySQL_query($item_query);
			$item_name = mysql_result($item_result, 0, "item_name");
		$cap_quantity = mysql_result($mitek_result, $i, "cap_quantity");
	?>
            <tr>
              <td width="83"><?php echo $item_name ?></td>
              <td width="59"><?php echo $cap_quantity ?></td>
              <td width="65">&nbsp;</td>
              <td width="69">&nbsp;</td>
              <td width="96"><input name="quantity<?php echo $i?>" type="text" id="quantity<?php echo $i?>" size="10" maxlength="10" onkeypress="return numbersonly(this, event)" /><input name="product_id<?php echo $i ?>" type="hidden" value="<?php echo $cap_item_id ?>" /> </td>
            </tr>
            <?php
	$i++;
	}
	?>
          </table></td>
          </tr>
        </table>
        <?php $line_no = $i; ?>
      <input name="job_no" type="hidden" value="<?php echo $job_no ?>" />
      <input name="line_no" type="hidden" value="<?php echo $line_no ?>" />
      </td>
  </tr>
  <tr>
    <td height="45" align="center"><br />
      <input name="input" type="submit" value="Add" class="imagebutton"  />
      <input name="button" type="button" class="imagebutton" id="button" onclick="MM_goToURL('parent','../production/deliver_job.php?job_no=<?php echo $job_no?>');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("ply_text","req","Please enter number of plies.");  
  frmvalidator.addValidation("height_text","req","Please enter truss height.");  
  frmvalidator.addValidation("press_points_text","req","Please enter number of FT.");    
</script>
</body>
</html>