<?php
session_start();

include("config.inc.php");
include("function.inc.php");

$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");


$query1="select grid_color1,grid_color2 from setup";
$result1=mysql_query($query1,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($result1)){
extract($rows);

}


$item   		= $_GET['item']; if ($item == ""){$item = $_POST["item"];}
$frm	   		= $_GET['frm']; if ($frm == ""){$frm = $_POST["frm"];}
$index			= $_GET['index']; if ($index == "") $index = $_POST['index'];
$PHeatNo_Type  	= $_POST["PHeatNo_Type"]; if ($PHeatNo_Type == ""){$PHeatNo_Type = $_GET["PHeatNo_Type"];}
$PHeatNo_No  	= $_POST["PHeatNo_No"]; if ($PHeatNo_No == ""){$PHeatNo_No = $_GET["PHeatNo_No"];}
$HeatNo_No  	= $_POST["HeatNo_No"]; if ($HeatNo_No == ""){$HeatNo_No = $_GET["HeatNo_No"];}



if($_GET['lcode']!=""){

	 

	$_GET['post']="1";

}




?>

<!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=iso-8859-1" />
<title>List of HeatNo</title>

<script type="text/javascript" src="js/grid/UI_DataGrid.js"></script>
<script type="text/javascript" src="js/grid/jquery-1.9.1.js"></script>

<script type="text/javascript" language="javascript">

function clearform()
{
	//document.form1.PHeatNo_Type.value='';
	document.form1.PHeatNo_No.value='';
	document.form1.action='List_HeatNo.php';
	document.form1.submit();
}

function openHeatNoform(){

 win = window.open('./Form_Warehouse.php?mode=insert', 'Form_Warehouse', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=600,top=100,left=100');		
	win.creator = self;
	win.focus();
}
</script>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
}
.style1 {
	color: #333333;
	font-weight: bold;
}
.style2 {
	color: #999999;
	font-weight: bold;
	font-size: 13px;
}
.style3 {color: #999999; font-size: 13px;}
-->
</style></head>

<body>
<form id="form1" name="form1" method="post" action="">
  <table width="800" border="0" cellspacing="1" align="center">
    <tr>
      <th colspan="2" bgcolor="#DDDDDD"><span class="style1"> HeatNo </span></th>
    </tr>
    <tr>
      <td bgcolor="#DDDDDD"> <span style="font-size: 11px; color: #999999; font-weight: bold;">Search for HeatNo  <br> Type / No</span></td>
      <td bgcolor="#DDDDDD">
	    <input type="hidden" name="PHeatNo_Type" value="<?php echo $PHeatNo_Type; ?>"  />
        <input type="text" name="PHeatNo_No"  value="<?php echo $PHeatNo_No; ?>" size='25'/>
        <input name="code1" type="hidden" id="code1"  value="<?php echo $HeatNo_Type; ?>">
		<input name="desc1" type="hidden" id="desc1" value="<?php echo $HeatNo_No; ?>" />
	    <input type="submit" name="Submit" value="Find" style=' background-color:#4069A7; color:#FFFFFF;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'/>
		<input type="button" name="cancelbtn" value="Cancel" onclick='clearform();'style=' background-color:#4069A7; color:#FFFFFF;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'/>
        <input name="item" type="hidden" id="item" value="<?php echo $item; ?>" />
		<input name="frm" type="hidden" id="frm" value="<?php echo $frm; ?>" />
		<input name="index" type="hidden" value="<?php echo $index; ?>">

	<?php 
	//Gilbert 20-11-2013
	/*
	if($FI_WarehouseApp==1 && $FI_Warehouse==1){
		echo"<input type='button' name='addbtn' value='Add Warehouse' onclick='openwarehouseform();'style=' background-color:#4069A7; color:#FFFFFF;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;'/>";
	}*/
	?>
	  </td>
    </tr>
<?php if($_GET['post']=="1") { ?>
<script type="text/javascript" language="javascript">
var FormOption = document.form1.frm.value;
var FormItem   = document.form1.item.value;
var vIndex	   = document.form1.index.value; 

if (FormOption == 1) {
	 
opener.document.getElementById('porderdt_heatno['+vIndex+']').value=document.form1.desc1.value;
	
}
else if (FormOption == 2){
	opener.document.getElementById('purchasedt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 3){
	opener.document.getElementById('purchasedt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 4){
	opener.document.getElementById('transferdt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 5){
	opener.document.getElementById('adjustmentdt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 6) {
	opener.document.getElementById('purchasedt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 7) {
	opener.document.getElementById('deliverydt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 8) {
	opener.document.getElementById('productiondt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 9) {
	opener.document.getElementById('productionfg_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 10) {
	opener.document.getElementById('productionrm_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 11) {
	opener.document.getElementById('purchasedt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 12) {
	opener.document.getElementById('deliverydt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 13) {
	opener.document.getElementById('p_transferdt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 14) {
	opener.document.getElementById('prqstdtheatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 15) {
	opener.document.getElementById('txtAdjDtHeatNo['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 16) {
	opener.document.getElementById('sorderdt_heatno['+vIndex+']').value=document.form1.desc1.value;
}
else if (FormOption == 17) {
	opener.document.getElementById('mreqdtheatno['+vIndex+']').value=document.form1.desc1.value;
}
self.close();

</script>
<?php } ?>
    <tr bgcolor="#E5E5E5">
      <td width="150"><span class="style2">Type </span></td>
      <td width="400"><span class="style2">No </span></td>
    </tr>
<?php
		

$querywarehouse= " select distinct HeatNo.HeatNo_Type, HeatNo_No ".
				 " from HeatNo where 1 = 1 ".
				 " and HeatNo.HeatNo_Type like ".GetSQLValueString($PHeatNo_Type.'%','text')." ".
				 " and HeatNo.HeatNo_No like ".GetSQLValueString('%'.$PHeatNo_No.'%','text')." ".
				 " order by HeatNo.HeatNo_Type";
	//ECHO  $querywarehouse;
	//EXIT;
$resultwarehouse = mysql_query($querywarehouse,$connection) or die(mysql_error());
$rows   = mysql_num_rows($resultwarehouse);
 
			  
$resultwarehouse=mysql_query($querywarehouse,$connection) or die(mysql_error());		
while($rows=mysql_fetch_array($resultwarehouse)){
extract($rows);

$ct+=1;

if($ct%2==0)
{
	$Color="style='color:#0000FF;background-color:".$grid_color1."'";
	
	}else{
		
	$Color="style='color:#0000FF;background-color:".$grid_color2."'";	
}

?>
    <tr <?php echo $Color; ?>>
      <td align="left"><span class="style3"><a href="List_HeatNo.php?lcode=<?php echo $HeatNo_Type; ?>&frm=<?php echo $frm; ?>&PHeatNo_Type=<?php echo $PHeatNo_Type; ?>&PHeatNo_No=<?php echo $HeatNo_No; ?>&HeatNo_No=<?php echo $HeatNo_No; ?>&index=<?php echo $index; ?>"><?php echo $HeatNo_Type; ?></a></span></td>
      <td ><span class="style3"><a href="List_HeatNo.php?lcode=<?php echo $HeatNo_Type; ?>&frm=<?php echo $frm; ?>&PHeatNo_Type=<?php echo $PHeatNo_Type; ?>&PHeatNo_No=<?php echo $HeatNo_No; ?>&HeatNo_No=<?php echo $HeatNo_No; ?>&index=<?php echo $index; ?>"><?php echo $HeatNo_No; ?></a></span></td>
    </tr>
<?php
}
?>
  </table>
</form>
</body>
</html>
