<body background="../i.jpg">
<?php include("../../include/dbconnect.php");


// Get all _POST VALUES HERE..

foreach($_POST as $p=>$t)
{
	$_POST[$p] = trim($t);
}

$myCustomer = $_POST['Customer'];



foreach($_POST as $q=>$r)
{
	$_POST[$q] = trim($r);
}

$myProduct = $_POST['Product'];


?>
<title>Stock Qty Entry</title>
<body background=blater01.gif  topmargin=0>
<center> 
<table cellpadding=0 cellspacing=4 width=590>
  <tr> 
    <td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font face="Verdana, Arial, Helvetica, sans-serif"><b><b>Stock Qty Entry</b></font></td>
  </tr>
  <tr valign="top"> 
    <td colspan=2> <font >&nbsp;</font> </td>
  </tr>
</table>
<table border=0 cellpadding=3 cellspacing=4 width="590">
<tr> 
<td width="139" height="31" align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Customer / Client
  &nbsp;</b></font></td><td>
<?

// Pull all the data from Customer master & populate it

$stQuery = mysql_query("select bcode,name,unit from buy order by name")or die( mysql_error() );


?>
<form name='myForm01' method='POST' action='<?=$_SERVER[PHP_SELF]?>'>
  <SELECT name='Customer' onChange="javascript:submit();">
    <?
echo "<option selected value=\" 0\"> Select Customer";
while($row = mysql_fetch_row($stQuery))
{
	
	$temp = $row[1].'&nbsp;&nbsp;'.$row[2];
	if(isset($myCustomer) && eregi("$myCustomer",$row[0]))
	{
		echo "<option selected value=\"$row[0]\">$temp";
	}
	else{
		echo "<option value=\"$row[0]\">$temp";
	}
}
?>
  </SELECT></td></tr>
  
 
  
</form>
<tr>
<td width="139" height="31" align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Product
  &nbsp;</b></font></td><td>
<?

// Pull all Customers from Customer  based on Selected Customer id and populate it.


$sBuyQuery = mysql_query("SELECT distinct product.record,product.prodname,product.drawing_no FROM product WHERE (bcode ='$myCustomer')  group by product.record  order by product.bcode,product.prodname ") or die(mysql_error());


// This form contain a hidden field CustomerID which can be later used in next  page..
?>
<form name='myForm02' method='POST' action='entry.php' >
<input type="hidden" name="bcode" value=<?echo($myCustomer);?>>


<SELECT name=record  >
<?
while($row1 = mysql_fetch_row($sBuyQuery))
{
	$temp = $row1[1].'&nbsp;(Dr.No.&nbsp;:'.$row1[2].'&nbsp;)';
	echo "<option value=\"$row1[0]\">$temp";
}

?>
</SELECT></td></tr>




<?



$sdt = date(d).'-'.date(m).'-'.date(Y); 
?>



<tr > 
  <td width="139" height="31" align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Stock Date 
    &nbsp;</b></font></td>
  <td width="145" > <input type="text"    onKeyPress="return event.keyCode!=13"   name="today" value= <?php echo($sdt); ?> > 
  </td></tr>

  
  <tr > 
  <td width="139" height="31" align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Qty
    &nbsp;</b></font></td>
  <td width="145" > <input type="text"    onKeyPress="return event.keyCode!=13"   name="qty"  value= '' > 
  </td>
</tr>
 

  
 
  
  
  <table cellpading=0 cellspacing=10 width= 50>
    <tr> 
      <td> <blockquote> <input type =submit name="submit" value = "Submit"></td></blockquote>
  </table>
</table>


<br><br><font size=1><center><a href= "../index.html">Return to index page</a></center></font>
</body></form>
