<?php
ob_start();error_reporting(0);
session_name('CAKEPHP'); session_start();
include("reportconfig.php");
$data=''; 

$data.="<table width='100%' border='0' cellspacing='1' cellpadding='2'>";
$data.="<tr>";
$data.="<th colspan='2'><strong>ITEM</strong></th>";
$data.=" <th ><strong>STOCK</strong></th>";
$data.=" <th scope='col'><strong>CLOSING</strong></th>";
$data.="  <th><strong>OPENING</strong></th>";

$data.="<th><strong>RECEIVED</strong></th>";
$data.="<th><strong>ISSUED</strong></th>";
$data.="</tr>";
$data.="<tr>";
$data.="<th><strong>CODE</strong></th>";
$data.="<th><strong>DESCRIPTION</strong></th>";
$data.="<th><strong>UNIT</strong></th>";
$data.="<th><strong>STOCK QTY. </strong></th>";
$data.="<th><strong>STOCK QTY. </strong></th>";
$data.="<th><strong>STOCK QTY. </strong></th>";
$data.="<th><strong>STOCK QTY. </strong></th>";
$data.="</tr>";
$sql=$_SESSION['data'];
$result = mysqli_query($con, $sql);
if(mysqli_num_rows($result) > 0)
	{
		while($myrow = mysqli_fetch_array($result))
{
$data.="<tr bgcolor='#FFFFFF'>";
$data.="<td>";
$data.=$myrow['itemcode'];
$data.="</td>";
$data.="<td>";
$data.=$myrow['description'];
$data.="</td>";
$data.="<td>";
$data.="</td>";
$data.="<td>";
$data.="</td>";
$data.="<td>";
$data.="</td>";
$data.="<td>";
$data.="<input name='received' type='text' id='received' value='' size='10' readonly='true'/>";

$data.="<td>";
$data.="</td>";
$data.="</tr>";
}}
else
	{
	echo '<td><div align="center"><font color="#FF0000"> Record Not Found </font></div></td>';}

      
$data.="</table>";
 header("Content-type: application/x-msdownload"); 
header("Content-Disposition: attachment; filename=data1.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 
print "$header\n$data";  

?>