<body background="i.jpg">
<?php include("../../include/dbconnect.php");
// Get all _POST VALUES HERE..

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

  $myGroup = $_POST['Group'];
?>


<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>
<title>Opening Balance Entry of  Materials</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>Opening Balance Entry  of Materials</b></font></td>
  </tr>
  <tr valign="top"> 
    <td colspan=2> <font >&nbsp;</font> </td>
  </tr>
</table>
<table cellpadding=0 cellspacing=4 width=590>
     <tr > 
        <td width="139" height="31" align="right" ><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#003366">Select Group
          &nbsp;</font></b></font></td><td>

<?
// Pull all the data from Group master & populate it

$result = mysql_query("select distinct catcode,category from matprodcat order by category") or die(mysql_error());

?>
  <form name='myForm01' method='POST' action='<?=$_SERVER[PHP_SELF]?>'>
  <SELECT name='Group' onChange="javascript:submit();">
    <?
echo "<option selected value=\" 0\"> Select Group";
while($row = mysql_fetch_row($result))
{

	

	if(isset($myGroup) && eregi("$myGroup",$row[0]))
	{
		echo "<option selected value=\"$row[0]\">$row[1]";
	}
	else{
		echo "<option value=\"$row[0]\">$row[1]";
	}
}
?>
  </SELECT>
  </td></tr> 

</form>
  <form name='issue_mat' method='POST' action='open_post.php' >
  <input type="hidden" name="matcat" value=<?echo($myGroup);?>>


<?

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





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

<tr>
<td width="177" height="31" align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Company
  &nbsp;</b></font></td>

<td width="399">

<?


$sBuyQuery = mysql_query("SELECT  compcode,name from company order by name ") or die(mysql_error());


?>
<SELECT name="compcode" >
<?
echo "<option selected value=\" 0\"> Select Company";
while($row1 = mysql_fetch_row($sBuyQuery))
{
	$temp = $row1[1];
	echo "<option value=\"$row1[0]\">$temp";
}

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

</table>



<table border=0 cellpadding=3 cellspacing=4 width="590">



            <tr class="small_site_font_black">
              <td width="31%" align="right" valign="top"><span id="lbl_from_date"><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>From Date </font></span></td>
              <td width="69%">
                        <?
						 // echo $from_date;
						  if(empty($from_date))
						  {
						   $from_date=strftime ("%d/%m/%Y", mktime (0,0,0,date("m"),date("d"),date("Y"))); 
						  }
						?>
						  <INPUT NAME="from_date" TYPE="text" class="text_box_button" VALUE="<?=$from_date?>" SIZE="15" readonly  >
                          <A HREF="#" onClick="cal.select(document.issue_mat.from_date,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0"></A> 
			  </td>

</tr>
</table>













<table border=0 cellpadding=3 cellspacing=4 width="375">
  <tr> 
    <td width="340" height="25" align="center" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Product  </b></font></td>
 	
    <td align="center" width="92" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Quantity<blink>(Unit as Per stock register)</blank></b></font></td>
    <td align="center" width="92" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Quantity<blink><blink>(Nos If Required)</blank></b></font></td>	
    </tr>
  <?

for($ind=0;$ind<10;$ind++)
{

	// Pull all the data from Standard master & populate it
	
	$result = mysql_query("select distinct rawmaterial.prodcode, rawmaterial.prodname  from  rawmaterial  where  matcatcode = '$myGroup'  order by rawmaterial.prodname") or die(mysql_error());
	
	?>
	  <tr> 
		<td> <SELECT name='prodcode[<? echo($ind);?>]' >
			<?
	echo "<option selected value=\" 0\"> Product & Stock";
	while($row = mysql_fetch_row($result))
	{
		if($row[3]>0)
		{
			$temp= $row[1];		
		}
		else
		{
			$temp= $row[1].'&nbsp;('.$row[2].'&nbsp;'.')';
		}
		
		echo "<option value=\"$row[0]\">$temp";
	
	}
	?>
      </SELECT> </td>
    <td width="92" > <input  size="10" type="text" name="accepted_qty[<? echo($ind);?>]" > </td>
    <td width="92" > <input  size="10" type="text" name="qty_nos[<? echo($ind);?>]" > </td>	
  </tr>
  <?
}
?>
  </table>

<table width="373">
  <tr> 
    <td align="right" width="354" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Update 
      Stock</b></font></td>

  <tr> 
    <td width="354" ></td>

    <td width="437" > <input type="radio"    onKeyPress="return event.keyCode!=13"   name="upd" value = "No" checked> <font class="sbd"><b>Not 
      Confirm </b></font>&nbsp;</td>
  </tr>
  <tr> 
    <td width="354" ></td>

    <td width="437" > <input type="radio"    onKeyPress="return event.keyCode!=13"   name="upd" value = "Yes"> <font class="sbd"><b>Confirm 
      </b></font>&nbsp;</td>
  </tr>
  </table>


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

</table>
<center><a href="/wilson/stores.html">  Return to Index page</a>  
</center>

</body>
</form>
