<?php include("../../include/dbconnect.php");
// Get all _POST VALUES HERE..

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

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

<title>Group Ledger</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>Select Product</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 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>


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

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


    $sBuyQuery = mysql_query("select prodcode,prodname from rawmaterial where matcatcode = '$myGroup' order by prodname");


// This form contain a hidden field GroupID which can be later used in next  page..
?>

  <form name='myForm02' method='POST' action='clstk_prnt.php' >
  <input type="hidden" name="matcat" value=<?echo($myGroup);?>>
  <SELECT name=prodcode[] multiple  size="10" >

<?
     while($row1 = mysql_fetch_row($sBuyQuery))
    {
         echo "<option value=\"$row1[0]\">$row1[1]";
    }

?>
  </SELECT>





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

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


