<html>
<head>
<title>Edit Stock</title>

<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script language="javascript">
$().ready(function() {
	$("#po").autocomplete("pofind.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});
</script>
</head>
<body style="background-color: #ffffff;background-image:url(rail.jpg);background-repeat: repeat-y">
<center>
<?php include('link.php');?>
</center>
<center><h1>In Stock</h1></center>
<center><a href='http://www.wauhaha.com/karaoke/stock.php'><img src=back.jpg width=50 height=50></a></center>
<center><input type=button name=btn value=Add&nbsp;Po onClick='addrow()'> </center>
<?php


$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
mysql_selectDB("wauhaha_karaoke",$login);

$result = mysql_query("SELECT * FROM porder ");


echo "<form method='post' action='http://www.wauhaha.com/karaoke/instocka.php' onsubmit='getvalue(c);'>

<input type='hidden' id='c' name='c' value=''>


<table  align=center  >
<tr>
	
	<td>Inv No:</td>
	<td><input type=text name=inv size=7></td>
</tr>
<tr>
	
	<td>Po No:</td>
	<td><input type=text name=po id=po size=7></td>
</tr>


</table>

";


mysql_close($login);
?>
<script language="JavaScript"> 


var a=0;
function getvalue(cv){
	var e = cv;
	e.value = a + 1;
}

function addrow() { 
a++;
if(a<20){
var row = activeTable.insertRow(activeTable.rows.length); 
var col = row.insertCell(0); 
var i = row.rowIndex; 

col.innerHTML = "<tr><td width=300> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>"; 
col = row.insertCell(1); 

col.innerHTML = "<td>Po No:</td><td><input type='text' name=po"+a+" id=po"+a+" size='7' value='' style='margin:0 0 0 10'></td>"; 
col = row.insertCell(2); 
col.innerHTML ='<td>&nbsp;<button onClick="delrow()">Delete</button></td></tr>';
col = row.insertCell(3);


$().ready(function() {
	$("#po"+a+"").autocomplete("pofind.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});
}


}
function delrow() { 
var srcName = document.getElementsByTagName("button"); 
var rowIndex = 0; 
for ( i=0;i<srcName.length;i++){ 
if(srcName[i]==event.srcElement) 
rowIndex=i; 
} 
activeTable.deleteRow(rowIndex + 1); 
}

function passvalue(str, z)
{
var p = z;
if (str=="")
  {
  document.getElementById("pr"+p+"").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("pr"+p+"").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getprice.php?q="+str,true);
xmlhttp.send();
}

</script>

<table id=activeTable  align=center> 
<tr></tr>


</table>
<center><input type=submit value=Submit></center>
</form>