<?php include("../../include/dbconnect.php"); 
$result = mysqli_fetch_array(mysqli_query($conn,"select name from company where compcode = '$compcode' ")) or die(mysqli_error());
$startdt = us($stdt);
?>

<table width=658  border=1 rules="all">
<tr><td align ="center" colspan="100%"><h4><font face="Arial, Helvetica, sans-serif"><?=$result['name']?></font></h4></td></tr>
<tr><td align ="center" colspan="100%"><h4><font face="Arial, Helvetica, sans-serif">Closing Stock as on &nbsp;<?=british($startdt)?></font></h4></td></tr>

<tr>
<td width="46"><font face="Arial, Helvetica, sans-serif">Sl No</font></td>
<td width="418"><font face="Arial, Helvetica, sans-serif">Product</font></td>
<td width="83"  align="right"><font face="Arial, Helvetica, sans-serif">Closing Stock</font></td>
<td width="83"  align="right"><font face="Arial, Helvetica, sans-serif">Minimum Stock</font></td>
</tr>


<?
$temp=' ';
$totvalue=0;
$subtot=0;
$qtytot=0;

$qtyonhand = $prow[0];
$cresult = mysqli_query($conn,"select category from prodcat where  catcode = '$catcode' ");
$crow = mysqli_fetch_row($cresult);
$category=$crow[0];
$sl=1;
?>
<tr>
<td  colspan="100%"><font size="+1" color="#CC0000"><? echo($category);?> </font></td></tr>
<?	


for($ind=0;$ind<count($prodcode);$ind++)
{

	$result = mysqli_query($conn,"select prodcode,prodname,minimum_qty from product where prodcode = '$prodcode[$ind]'  order by prodcode,prodname");
	$row=mysqli_fetch_row($result);
	$prodname=$row[1];
	$minimum_qty=$row[2];


	$qresult = mysqli_query($conn,"select sum(inqty) - sum(outqty) from stktrans where  acctcode = '$prodcode[$ind]' and compcode = '$compcode' and date <= '$startdt' ") or die(mysqli_error());
	$qrow = mysqli_fetch_row($qresult);
	if($qrow[0] != 0 )
	{
	
        if($qrow[0] < $minimum_qty)
		{
			echo("<tr bgcolor=\"#FFCECE\">");
		}
		else
		{
			echo("<tr bgcolor=\"#C184FF\">");		
		}
		?>

		<td width="46"><font face="Arial, Helvetica, sans-serif"><? echo($sl);?>  </font></td>		
		<td width="418"><font face="Arial, Helvetica, sans-serif"><? echo($prodname);?>  </font></td>
		<td width="83" align="right"><font face="Arial, Helvetica, sans-serif"><? echo($qrow[0]);?></font></td>
		<td width="83" align="right"><font face="Arial, Helvetica, sans-serif"><? echo($minimum_qty);?></font></td>
		</tr>

		<?  
		$sl++;
	}
}

?>



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




