<?php ob_start();
session_name('CAKEPHP'); session_start();
include("reportconfig.php");
$data='';
$data.="<table width='100%' border='0' cellspacing='2' cellpadding='2'>";
$data.="<tr>";
$data.="<th colspan='10'>Job Work Receipt Register Report</th>";
$data.="</tr>";
$data.="<tr>";
$data.="<th width='6%'>RETURN SLIP NO</th>";
$data.="<th width='9%'>PARTY CHALLAN NO</th>";
$data.="<th width='6%'>RETURN DATE </th>";
$data.="<th width='9%'>VENDOR</th>";
$data.="<th width='8%'>TOTAL QUANTITY </th>";
$data.="</tr>"; 
$data5= $_SESSION['query'];
  $result=mysqli_query($con, $data5);
			
		$num=mysqli_affected_rows($con);
		if($num>0)
	{
		$flag=1;
				$i=0;
			    $totalamount=0;
				while($item_row=mysqli_fetch_array($result))
				{					
				$data.="<tr bgcolor='#FFFFFF'>"; 
      $data.="<td>".$item_row['returnSlipNo'].'===='.$item_row['id']."</td>";  
	  $data.="<td>".$item_row['partyChallanNo']."</td>"; 
	  $data.="<td>".$item_row['returnDate']."</td>"; 
      $data.="<td>".$vendorname=$s->getField('suppliers','vendor_code',$item_row['vendor'],'vendor_name')."</td>";
      	  $data.="<td>";
	  if($_REQUEST['site']!=''){
	  $data.=$item_row['sum(receivedQty)'];
	  	}
else  if($_REQUEST['item']!='')
      {
	$data.=$item_row['receivedQty'];
       }
else {	  
	 $data.=$item_row['receivedQty'];
	  }
	  "</td>";
    $data.="</tr>";
  $i++;
  }
  }
  $data.="</table>";
 // echo $data;
 $header='';  		
 header("Content-type: application/x-msdownload"); 
header("Content-Disposition: attachment; filename=data.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 
print "$header\n$data";  
  ?>
  