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

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


?>
<script language="JavaScript" src="../jscript/md5.min.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/gen_validatorv4_2.js"  type="text/javascript" xml:space="preserve"></script>  


<style>
input.imagebutton{
	background-color:#E1E1E1;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#39A751;
	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:#39A751;
	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;
}

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

#table_display {
	font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
	text-shadow:1px 1px 1px #fff;
    font:bold 12px Arial;
	color:#000;
	font-size:12px;
	
}

</style>

<?php

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

$production_no = $_GET['production_no'];
$design_no = $_GET['design_no'];
$production_date = $_GET['production_date'];
$skips_select = $_GET['skips'];
$product_item_id = $_GET['product_item_id'];

$table_name = $_SESSION['db_prefix']."_product_store";
$item_query = "SELECT  item_name, recycle_qty FROM $table_name WHERE product_item_id = '".$product_item_id."' ";
$item_result = $con->query($item_query);
$row = mysqli_fetch_assoc($item_result);
$item_name = $row['item_name'];
$recycle_qty = $row['recycle_qty'];

?>

<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)
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
</script>

<script>
function qty_check() {
	var available = <?php echo $recycle_qty ?>;
	var qty = document.getElementById('recycled_text').value;
	
	if (qty > available) {
		 alert('The quantity is higher then available.\n   Enter a lower quantity.');
		 document.getElementById('recycled_text').value = 0;
	}
}
</script>

</head>
<body onload="document.getElementById('password_text').value='';">
<form action='../production/production.php' method="GET" name="form2" target="_top" id="form2">
  <table id="table_display">
    <tr>
      <td height="55" colspan="3" align="center">
      <label style="font-size:24px"><?php echo $item_name ?></label><br />
      Quantity available: <?php echo $recycle_qty ?> <br />
      </td>
    </tr>
    
    <tr>
       <script>recycle_id=[];</script>
      <td height="43" colspan="3" align="center">Quantity to recycle: <input type="text" name="recycled_text" id="recycled_text" style=" width:40px;" onkeyup="qty_check();" onfocus = "this.select();"/></td>
    </tr>
    
    <tr>
      <td width="49" align="center">&nbsp;</td>
      <td width="153" height="45" align="center">
      <input name="production_no" type="hidden" value="<?php echo $production_no ?>" />
      <input name="production_date" type="hidden" value="<?php echo $production_date ?>" />
      <input name="design_select" type="hidden" value="<?php echo $design_no ?>" />
      <input name="show" type="hidden" value="1" />
      <input name="e" type="hidden" value="0" />
      <input name="skips" type="hidden" value="<?php echo $skips_select ?>" />
	  <!--<input name="recycle_id_text" id="recycle_id_text" type="hidden" value="" />-->
	  <input name="input" type="submit" value="Add" class="imagebutton"  /></td>
      <td width="75" align="center">&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>