<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}

include("../opendb.php");
include("../test.php");

$filename ="VehTransfer.xls";
$contents="SrNo \t Part Code \t Part Name \t Rate \t Qty. \t Unit\t Total \n";

$sno=1;
$sq=mysqli_query($db,"select * from veh_trans where brcode='$brcode' and chasis='MC219ERC0DE274258'");
while($re=mysqli_fetch_array($sq))
{


			$contents.=$sno."\t";		
			$contents.=$re[chasis]."\t";
			$contents.=$re[config]."\t";
			$contents.=$re[unit]."\t";
			$contents.=$re[qty]."\t";
			
			$contents.=$netin."\n";
			
			$netin1+=$netin;
			
			
		$sno++;	
		
		
}
$row=mysqli_fetch_array($sq);
$answer = $netin1; 
$contents.="ENGINE NO:\t";

$contents.=$row[17]."\t";
$contents.=$gtfqty."\t";
$contents.=$gttkm."\t";
$contents.=$gtpamt."\t";
$contents.=$gtsamt."\t";
$contents.=$gtdbt."\t";
$contents.=$gtcbt."\t";
$contents.=$gtexp."\t";
$contents.=$vehincom."\t";			
$contents.=$answer."\n";

	
		

		
$contents = strip_tags($contents); 
header('Content-type: application/ms-excel');
header('Content-Disposition: attachment; filename='.$filename);
print $contents;
?>
