<?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; 
	//print_r($_SESSION['itemarray']);
?>
<title>Contractor Register Report</title>
<link rel="stylesheet" href="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>".'Contactor Register Report'."</h1></td>";
$logo.="</tr>";
$logo.="</table>";
$logo.="</div>";
echo $logo;
$Header1="<p align='center' style='font-size:12px;font-weight:bold;'>".$_SESSION['mess5']."</p>";
echo $Header1;
?>
<!--<div id="foo">
  <p align="center"><input type="button" onclick="javascript:toggle_visibility('foo');" value="Print" /></p>
</div> --> 

<?php 

	
	?>

<div  style="height:800px">
 <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>Date</strong></th>";
      $Header.="<th width='20%'  class='jjrs_tablehead'><strong>Transaction No.</strong></th>";
      $Header.="<th width='10%'  class='jjrs_tablehead'><strong>Against Bill/Challan </strong></th>";
      $Header.="<th width='9%'  class='jjrs_tablehead'><strong>Received Qty </strong></th>";
      $Header.="<th width='9%'  class='jjrs_tablehead'>Issued Qty</th>";
	   $Header.="<th width='9%'  class='jjrs_tablehead'>Bal Qty</th>";
  $Header.="</tr>";
	 echo $Header;
	 $data=$_SESSION['itemarray'];
  //print_r($_SESSION['itemarray']);

	if(count($data)>0)
	{
	//$var=0;
	$i=1;
	$j=0;
	$flag=0;
	$flag;
	$Count=0;
	//echo $Count=count($data);
  //  $t=0;
  	foreach($data as $key=>$value)
	{
	//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 ConvertSQLDate($value['date']);?></td>
	  <td  class="jjrs_tablehead"><?php echo $value['slipno'];?></td>
    <td  class="jjrs_tablehead"><?php echo $value['doc'];?></td>
     
      <td><?php  
	
	  echo $value['reciveqty'];
	   $recieve1[]=$value['reciveqty'];
	  
	  ?></td>
      <td><?php echo $value['issueqty']; $issue1[]=$value['issueqty'];?></td>
      <td><?php
	  
	  $total12=array_sum($recieve1);
	            $total13=array_sum($issue1);
				$opentotal=trim($total13)-trim($total12);
	  
	   echo $opentotal;?></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 }

 }
 ?>	
 <tr><td colspan="4">&nbsp;</td>
 
 <th colspan="2">Total Balance With Contractor</th><th>
 <?php 
     $receivedata2=array_sum($recieve1);
	 $issuedata2=array_sum($issue1);
      $total2=trim($issuedata2)-trim($receivedata2);
 echo $stock1=$total2;
 
  
    ?></th></tr>
 
<?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>

