<?php error_reporting(0);  
	$PageSecurity = 3;
	include ('includes/session.inc');
	include ('includes/function_lib.php');
	include('includes/fun-php.php');
	include('includes/fun-HRClass.php');
 	global $db; 
?>
<title>Stock Ledger Report</title>
<link rel="stylesheet" href="css/css/purchase_requision_print.css">
<div class="body_contain">
<div class="tab_div">

<?php  
$logo="<div>";
$logo.="<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
$logo.="<tr>";
$logo.="<td align='left'><img src='images/cloud_logo.jpg' /></td>";
$logo.="<td align='right'><img src='images/right_img.jpg' /></td>";
$logo.="</tr>";
$logo.="<tr>";
$logo.="<td colspan='2'><h1>".'Stock Ledger Report'."</h1></td>";
$logo.="</tr>";
$logo.="</table>";
$logo.="</div>";
echo $logo;
$Header1="<p align='center' style='font-size:12px;font-weight:bold;'>".$_SESSION['mess1']."</p>";
echo $Header1;
?>
<!--<div id="foo">
  <p align="center"><input type="button" onclick="javascript:toggle_visibility('foo');" value="Print" /></p>
</div> --> 
   
 </table>
<p>

<?php 
  $sql=$_SESSION['item_query1']; 
 	$result=DB_query($sql,$db);
	
	?>

<div  style="height:800px">
 <p align="left"><input type="button" onclick="javascript:toggle_visibility('foo');" value="Print" id="foo" /></p>
 <table width="100%" border="1" cellpadding="5" cellspacing="1" bgcolor="#000000" style="border:#000000 solid 1px; background:#999999; font-size:12px;">
    <?php 

	
	
$Header="<tr>";
	 $Header.="<th width='5%'  class='jjrs_tablehead' ><strong>S.R</strong></th>";
      $Header.="<th width='5%'  class='jjrs_tablehead'><strong>Item Code</strong></th>";
      $Header.="<th width='31%'  class='jjrs_tablehead'><strong>Item /Shade Name</strong></th>";
      $Header.="<th width='20%'  class='jjrs_tablehead'><strong>Description</strong></th>";
      $Header.="<th width='10%'  class='jjrs_tablehead'><strong>Main Category </strong></th>";
      $Header.="<th width='9%'  class='jjrs_tablehead'><strong>Sub Category </strong></th>";
     
  $Header.="</tr>";
	 echo $Header;
	 
	if(DB_num_rows($result)>0)
	{
	$i=1;
	$j=0;
	$flag=0;
	$flag;
	$Count=0;
	//echo $Count=count($data);
  //  $t=0;
	while($myrow=DB_fetch_array($result))
	{
	//echo $Count=count($data);
	if($flag==0)
	{
	$k=22;
	}
//	 echo $flag."--flag........";
//	echo $j."--j........";
//	echo $k."--k.......";
//	 echo $i."--i<br /><br />";
	
	
	$bgcolor='#FFFFFF';
	
	 $j++; 
	 $flag;
	?>		
	<tr bgcolor="<?php echo $bgcolor; ?>">
	<td  class="jjrs_tablehead"><?php echo $i++;?></td>
	<td  class="jjrs_tablehead"><?php echo $myrow['StockID'];?></td>
	<td  class="jjrs_tablehead"><?php echo $myrow['item_name'];?></td>
    <td  class="jjrs_tablehead"><?php echo $myrow['item_desc'];?></td>
    <td  class="jjrs_tablehead"><?php 
$main_sql=DB_query("select stockmaincategoryname from stockmaincategory where id='".$myrow['CategoryID']."'",$db);
$main_res=DB_fetch_array($main_sql);
	echo $main_res['stockmaincategoryname'] ;?></td>
     
      <td><?php 
	$Sub_sql=DB_query("select categorydescription from stockcategory where id='".$myrow['SubCategoryID']."'",$db);
	$sub_res=DB_fetch_array($Sub_sql);
	echo $sub_res['categorydescription'] ;?></td>
     
    </tr>
 <?php  

  
  // $x=$j%$k;
   //echo "x---".$x;
  //echo $k;
 if($j%$k==0)
 {
 $k=$k+27;
 $flag=$j;
?>
 </table>
 </div>
 </p>
 </div>
 </div>
 <div class="body_contain">
<div class="tab_div">

<?php echo $Header1; ?>
<div style="height:970px;">
 <table width="100%" border="1" cellpadding="5" cellspacing="1" bgcolor="#000000" style="border:#000000 solid 1px; background:#999999; font-size:12px;">
<?php echo $Header; ?>
<?php } 

 }
 ?>
  


<?php } else { ?>
<tr bgcolor="#FFFFFF">
<td  colspan="8"  class="jjrs_tablehead">No Records</td></tr>

<?php  } ?>
 </table>
 </div>
<script type="text/javascript" language="javascript">
  function toggle_visibility(id) {
       var e = document.getElementById(id);
	      e.style.display = 'none';
		       //alert(e.style.display);
			   window.print();
    }
  
</script>

