<?php include("../../include/dbconnect.php");?>  
<title>Stock Register Printing</title>
<body bgcolor="#ffffff"  topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font class="Wf"><b>Closing Stock Printing</b></font></td>
</tr><tr valign="top"><td colspan=2>
<font class="Wf">&nbsp;</font>
</td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>
<?
foreach($_POST as $q=>$r)
{
	$_POST[$q] = $r;
}

$myCompany = $_POST['Company'];



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

$myGroup = $_POST['Group'];

foreach($_POST as $h=>$i)
{
	$_POST[$h] = trim($i);
}

$myTax = $_POST['Tax'];
?>
<form name='myForm02' method='POST' action='<?=$_SERVER['PHP_SELF']?>'>
<table border=0 cellpadding=3 cellspacing=4 width="603" bgcolor="#E6E6FF">

<?
$result= mysqli_query($conn," select distinct compcode,name from company  order by name")or die( mysqli_error() );
?>
<tr > 
<td width="201" height="31" align="left" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Company </b></font></td>
<td width="378">
 <SELECT name='Company' onChange="javascript:submit();">
<?php 
	 echo "<option selected value=\" 0\"> Select Company";	  
      while ( $row1= mysqli_fetch_row($result))
      {
	  	if(isset($myCompany) && preg_match("/" . preg_quote($myCompany, '/') . "/", $row1[0]))
		{
			echo "<option selected value=\"$row1[0]\">$row1[1]";
	  	}
	  	else
	  	{
			echo "<option value=\"$row1[0]\">$row1[1]";
	  	}
	}
?>
</select></td></tr>




<tr>
<td width="201" height="31" align="left" ><strong><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Item Group</font></strong></td>
<td>
<?
$stQuery = mysqli_query($conn," select catcode, category from prodcat  order by category")or die( mysqli_error() );
?>
  <SELECT name='Group' onChange="javascript:submit();">
    <?
echo "<option selected value=\" 0\"> Select Group";
while($row = mysqli_fetch_row($stQuery))
{
	
	if(isset($myGroup) && preg_match("/" . preg_quote($myGroup, '/') . "/", $row[0]))
	{
		echo "<option selected value=\"$row[0]\">$row[1]";
	}
	else{
		echo "<option value=\"$row[0]\">$row[1]";
	}
}
?>
</SELECT></td>


  
</form>
<form name="regform" action="clstk_prnt.php" method="post" target="_blank">
    <td width="201" height="31" align="left" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Item</b></font></td>	
<td> <SELECT name='prodcode[]' multiple size="10" >
	<?
	echo "<option selected value=\" 0\"> Item";
	$prodresult = mysqli_query($conn,"select prodcode,prodname from product   where substring(prodcode,1,2)= '$myGroup'  ");
	while($prow = mysqli_fetch_row($prodresult))
	{
	if(isset($accthead) && preg_match("/" . preg_quote($accthead, '/') . "/", $prow[0]))
	{
		echo "<option selected value=\"$prow[0]\">$prow[1]";
	}
	else{
		echo "<option value=\"$prow[0]\">$prow[1]";
	}
	}		
	?>
</SELECT> </td></tr>
</table>

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



<input type="hidden" name="compcode" value="<?=$myCompany?>">


<tr>
  <td ><font class="sbd">Date</font></td><td>
		<?
		$stdt = $mystartdt;
		$stdt=strftime ("%d/%m/%Y", mktime(0,0,0,date("m"),date("d"),date("Y"))); ?>
		<input name="stdt" type="text" onKeyPress="return event.keyCode!=13" class="text_box_button" value="<?=$stdt?>" size="10"   > 
		<a href="#" onClick="cal.select(document.regform.stdt,'anchor1','dd/MM/yyyy'); return false;"name="anchor1" id="anchor1"><img  src="../../images/cal.gif" border="0"></a> 
		</td>


 

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

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