<? ob_start();
session_start();
 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='stk_slct' method='POST' action='stkreg_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>


  </td></tr>
<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>





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

<td>

<?


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


?>
<SELECT name=compcode  >
<?

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="25%" align="center" valign="top"><span id="lbl_from_date">From Date </span></td>
              <td width="26%">
                        <?
						 // 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.stk_slct.from_date,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0"></A> 
			  </td>
              <td width="22%" valign="top"><span id="lbl_to_date">To Date </span></td>
              <td width="27%">
                         <? 
						//    echo $to_date;
						   if(empty($to_date))
						    {
						      $to_date =strftime ("%d/%m/%Y", mktime (0,0,0,date("m"),date("d")+6,date("Y"))); 
						    }
						 ?> 
						  <INPUT NAME="to_date" TYPE="text" class="text_box_button" VALUE="<?=$to_date;?>" SIZE="15" onBlur="return diff(document.stk_slct.from_date.value,this.value);" readonly>
                          <A HREF="#" onClick="cal.select(document.stk_slct.to_date,'anchor2','dd/MM/yyyy'); return false;"NAME="anchor2" ID="anchor2"><img src="../../images/cal.gif" border="0"></A> 
			  </td>
              </tr></table>





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

<center><font color="#000080"><font size="+1"><a href="/wilson/stores.html">Exit </a></font></center>

</body>
</form>
