<?php
$id=$_GET['id'];
$idd=explode('//',$id);

$dump_date=$idd[0];
$dump_date1=$idd[1];
include("database_connection2.php");

  function cleanData($str)
  {
    $str = preg_replace("/\t/", "\\t", $str);
    $str = preg_replace("/\r?\n/", "\\n", $str);
    if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"';
  }

  // filename for download
  $filename = "ICICI RCU REPORT FROM" .$id.  ".xls";

 	header("Content-Disposition: attachment; filename=\"$filename\"");
  	header("Content-Type: application/vnd.ms-excel");

  $flag = false;
 ?><table border="1">
	<tr> 
		<th>Sr No</th>
		<th>Date</th>
		<th>Ref No</th>
		<th>Branch</th>
		<th>Location</th>
		<th>Applicant Name</th>
		<th>Docs Check</th>
		<th>Final Status</th>
		<th ><b>Docs  1</b></th>
		<th ><b>Docs Status</b></th>
		<th class="center"><b>Docs  2</b></th>
		<th class="center"><b>Docs Status</b></th>
		<th class="center"><b>Docs  3</b></th>
		<th class="center"><b>Docs Status</b></th>
		<th class="center"><b>Docs  4</b></th>
		<th class="center"><b>Docs Status</b></th>
		<th class="center"><b>Docs  5</b></th>
		<th class="center"><b>Docs Status</b></th>

		
	</tr><?php
	
	if($dump_date and $dump_date1)
		{
		
	$queryr="SELECT  * from  rcu_tbl where dump_date between '$dump_date' and '$dump_date1'    order by id asc";
	$resultr = MYSQL_QUERY($queryr);
	}	
	 $j=1;
	while($data=mysql_fetch_array($resultr)) {
	
 ?>
	
	<tr  >
	<td><?php echo trim(strtoupper($j));?></td>	
	<td><b><?php echo $data['date'];?></b></td>
	<td><b><?php echo $data['ref_no'];?></b></td>
	<td><b><?php echo $data['branch'];?></b></td>
	<td><b><?php echo $data['location'];?></b></td>
	<td><b><?php echo $data['applicant_name'];?></b></td>
	<td><b><?php echo $data['doc_check'];?></b></td>
	<td><b><?php echo $data['final_status'];?></b></td>	
	<td><b><?php echo $data['status_heading1'];?></b></td>	
	<td><b><?php echo $data['status1'];?></b></td>
	<td><b><?php echo $data['status_heading2'];?></b></td>	
	<td><b><?php echo $data['status2'];?></b></td>
	<td><b><?php echo $data['status_heading3'];?></b></td>	
	<td><b><?php echo $data['status3'];?></b></td>
	<td><b><?php echo $data['status_heading4'];?></b></td>	
	<td><b><?php echo $data['status4'];?></b></td>
	<td><b><?php echo $data['status_heading5'];?></b></td>	
	<td><b><?php echo $data['status5'];?></b></td>
	</tr>
	<?php
	$j++; }  ?>
	 
</table>

