<?php defined('BASEPATH') OR exit('No direct script access allowed');

require_once APPPATH.'modules/generic/controllers/Generic.php';

class Excel extends Generic{
	function __construct() {
		parent::__construct();
		$this->load->model('Mdl_excel');
	}

	function getMessageMaster(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","DATE","NAME","EMAIL","COUNTRY","MOBILE","QUERY","MESSAGE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$message = $this->Mdl_excel->getAllRecords("message");
		$excel_row = 2;
    $i = 1;

		foreach($message as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $date);
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $val->name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->country);
			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->mobile);
			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $val->query);
			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, $val->message);
			
      
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="MESSAGE MASTER DATA.xls"');
		$object_writer->save('php://output');
	}

	function getAdvertiseEnquiry(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","NAME","EMAIL","COUNTRY","MOBILE","COMPANY","DATE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$message = $this->Mdl_excel->getAllRecords("advertise_enquiry");
		$excel_row = 2;
    $i = 1;

		foreach($message as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $val->name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->country);
			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->mobile);
			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->company);
			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $date);
			
      
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="ADVERTISE ENQUIRY MASTER DATA.xls"');
		$object_writer->save('php://output');
	}

	function getExhibitorEnquiery(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","EXHIBITION NAME","NAME","DESIGNATION","COMPANY","EMAIL","MOBILE","CONTACT","COUNTRY","ADDRESS","PRODUCT","HS CODE","AREA","DATE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$message = $this->Mdl_excel->getAllRecords("exhibition_enquiry");
		$excel_row = 2;
    $i = 1;

		foreach($message as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $val->exhibition_name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $val->name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->designation);
			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->company);
			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $val->mobile);
			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, $val->contact);
			$object->getActiveSheet()->setCellValueByColumnAndRow(8, $excel_row, $val->country);
			$object->getActiveSheet()->setCellValueByColumnAndRow(9, $excel_row, $val->address);
			$object->getActiveSheet()->setCellValueByColumnAndRow(10, $excel_row, $val->product);
			$object->getActiveSheet()->setCellValueByColumnAndRow(11, $excel_row, $val->hs_code);
			$object->getActiveSheet()->setCellValueByColumnAndRow(12, $excel_row, $val->area);
			$object->getActiveSheet()->setCellValueByColumnAndRow(13, $excel_row, $date);
			
      
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="EXHIBITION ENQUIRY MASTER DATA.xls"');
		$object_writer->save('php://output');
	}

	function getSeminarEnquiry(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","SEMINAR NAME","NAME","DESIGNATION","COMPANY","EMAIL","MOBILE","CONTACT","COUNTRY","ADDRESS","DATE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$message = $this->Mdl_excel->getAllRecords("seminars_enquiry");
		$excel_row = 2;
    $i = 1;

		foreach($message as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $val->exhibition_name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $val->name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->designation);
			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->company);
			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $val->mobile);
			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, $val->contact);
			$object->getActiveSheet()->setCellValueByColumnAndRow(8, $excel_row, $val->country);
			$object->getActiveSheet()->setCellValueByColumnAndRow(9, $excel_row, $val->address);
			$object->getActiveSheet()->setCellValueByColumnAndRow(10, $excel_row, $date);
			
      
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="SEMINAR ENQUIRY MASTER DATA.xls"');
		$object_writer->save('php://output');
	}

	function getTradeEnquiry(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","TRADE NAME","NAME","DESIGNATION","COMPANY","EMAIL","MOBILE","CONTACT","COUNTRY","ADDRESS","PRODUCT","HS CODE","AREA","DATE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$message = $this->Mdl_excel->getAllRecords("trade_delegation_enquiry");
		$excel_row = 2;
    $i = 1;

		foreach($message as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $val->trade_name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $val->name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->designation);
			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->company);
			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $val->mobile);
			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, $val->contact);
			$object->getActiveSheet()->setCellValueByColumnAndRow(8, $excel_row, $val->country);
			$object->getActiveSheet()->setCellValueByColumnAndRow(9, $excel_row, $val->address);
			$object->getActiveSheet()->setCellValueByColumnAndRow(10, $excel_row, $val->product);
			$object->getActiveSheet()->setCellValueByColumnAndRow(11, $excel_row, $val->hs_code);
			$object->getActiveSheet()->setCellValueByColumnAndRow(12, $excel_row, $val->area);
			$object->getActiveSheet()->setCellValueByColumnAndRow(13, $excel_row, $date);
			
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="TRADE DELEGATION ENQUIRY MASTER DATA.xls"');
		$object_writer->save('php://output');
	}

	function getTradeEnquiryList(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","NAME","COMPANY","EMAIL","CONTACT","ADDRESS","HS CODE","MESSAGE","DATE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$message = $this->Mdl_excel->getAllRecords("trade_enquiry");
		$excel_row = 2;
    $i = 1;

		foreach($message as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $val->name);
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $val->company);
			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->contact);
			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->hs_code);
			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $val->address);
			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, $val->message);
			$object->getActiveSheet()->setCellValueByColumnAndRow(8, $excel_row, $date);
			
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="TRADE ENQUIRY MASTER DATA.xls"');
		$object_writer->save('php://output');
	}

	function getSubscribersMaster(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","EMAIL","DATE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$newsletters = $this->Mdl_excel->getAllRecords("newsletter");
		$excel_row = 2;
    $i = 1;

		foreach($newsletters as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $date);
      
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="NEWSLETTER SUBSCRIBERS MASTER DATA.xls"');
		$object_writer->save('php://output');
	}

	function getJobApplications(){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

		$table_columns = array("SR NO","ROLE","NAME","EXPERIENCE","EMAIL","CONTACT","DATE");

		$column = 0;

		foreach($table_columns as $field){
			$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, $field);
			$column++;
		}

		$jobs = $this->Mdl_excel->getAllRecords("jobs_applications");
		$excel_row = 2;
    $i = 1;

		foreach($jobs as $val){
			$date = date("d-m-Y",strtotime($val->createdDate));

			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, strtoupper($val->role));
			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, strtoupper($val->name));
			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->experience);
			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->email);
			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->contact);
			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $date);
      
      $excel_row++;
      $i++;
		}

		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="JOB APPLICATION MASTER DATA.xls"');
		$object_writer->save('php://output');
	}
	
		function getexhibitionseminarwebinarbookmemberexcel($productheaderid){
		$this->load->model("Mdl_excel");
		$this->load->library("excel");
		$object = new PHPExcel();

		$object->setActiveSheetIndex(0);

	//	$header = array("Booking data");
		$object->getActiveSheet()->setCellValueByColumnAndRow($column, 1, "Booking data");
       $table_columns = array("SR NO","Payment Method","Payment Date","Paid Amount","Company Name","Contact Person Name","EMAIL","Contact No","GST No","Pan No","HS Code"
                                ,"areasqmt","Address","City","State Name","Participants Name","Participants Email","Participants Contact No");
       /* $table_columns = array("SR NO","Payment Method","Payment Date","Paid Amount","Company Name","Contact Person Name","EMAIL","Contact No","GST No","Pan No","HS Code"
                                ,"areasqmt","Address","City","State Name","No of Participants");*/

		$column = 0;

		foreach($table_columns as $field){
		    $object->getActiveSheet()->setCellValueByColumnAndRow($column, 2, $field);
			$column++;
		}
        $statement = 'SELECT * FROM trnproductoders a
                    INNER JOIN trninvoicetomember b on a.productorderid=b.orderid
                    left JOIN webinarandseminar_participantsdetails c on b.memberinvoicesid=c.memberinvoicesid
                    where b.transactionid > 0  and a.productheaderid='.$productheaderid.'
                    ORDER BY b.memberinvoicesid DESC';
                      $message = $this->Mdl_excel->customQuery($statement);
	//	$message = $this->Mdl_excel->getAllRecords("advertise_enquiry");
		$excel_row = 3;
    $i = 1;
	$oldmembername = "";
		foreach($message as $val){
		   $MemberName= $val->MemberName;
		   	$memberinvoicesid=$val->memberinvoicesid;
        		$participants_fname=$val->participants_fname;
                $participants_lname=$val->participants_lname;
                $participants_fullname=$participants_fname." ".$participants_lname;	
                  $paymentmethodtype=$val->paymentmethodtype;
            		if($paymentmethodtype == 0)
            		{
            		    $status   =  'Full Payment';
            		}
            		else if($paymentmethodtype == 1)
            		{
            		    $status    =  'Installment 1st';
            		}
            		else if($paymentmethodtype == 2)
            		{
            		    $status     =  'Installment 3nd';
            		}
            		else if($paymentmethodtype == 3)
            		{
            		    $status    =  'Installment 3rd';
            		}
                if($val->areasqmt !='')
                {
                    	$date = date("d-m-Y",strtotime($val->paymentdate));
            			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $status);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $date);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->InvoiceTotalAmount);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->MemberName);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->ContactPerson);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $val->Email);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, $val->MobileNo);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(8, $excel_row, $val->gstno);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(9, $excel_row, $val->panno);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(10, $excel_row, $val->hscode);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(11, $excel_row, $val->areasqmt);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(12, $excel_row, $val->inv_Add1);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(13, $excel_row, $val->inv_CityName);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(14, $excel_row, $val->inv_StateName);
            			//$object->getActiveSheet()->setCellValueByColumnAndRow(15, $excel_row, $val->noofparticipants);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(16, $excel_row, $participants_fullname);
    			        $object->getActiveSheet()->setCellValueByColumnAndRow(17, $excel_row, $val->participants_email); 
    			        $object->getActiveSheet()->setCellValueByColumnAndRow(18, $excel_row, $val->participants_contactno); 
    			        $i++;
                }
                else
                {
    		   	if($MemberName != $oldmembername) 
    			{
            			$date = date("d-m-Y",strtotime($val->paymentdate));
            			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, $i);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, $status);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, $date);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, $val->InvoiceTotalAmount);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, $val->MemberName);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row, $val->ContactPerson);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, $val->Email);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, $val->MobileNo);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(8, $excel_row, $val->gstno);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(9, $excel_row, $val->panno);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(10, $excel_row, $val->hscode);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(11, $excel_row, $val->areasqmt);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(12, $excel_row, $val->inv_Add1);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(13, $excel_row, $val->inv_CityName);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(14, $excel_row, $val->inv_StateName);
            			//$object->getActiveSheet()->setCellValueByColumnAndRow(15, $excel_row, $val->noofparticipants);
            			$object->getActiveSheet()->setCellValueByColumnAndRow(16, $excel_row, $participants_fullname);
    			        $object->getActiveSheet()->setCellValueByColumnAndRow(17, $excel_row, $val->participants_email); 
    			        $object->getActiveSheet()->setCellValueByColumnAndRow(18, $excel_row, $val->participants_contactno); 
    			        $i++;
    			}
    			else
    			{
    			    	$date = date("d-m-Y",strtotime($val->paymentdate));
            			$object->getActiveSheet()->setCellValueByColumnAndRow(0, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(1, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(2, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(3, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(4, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(5, $excel_row,'');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(6, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(7, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(8, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(9, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(10, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(11, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(12, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(13, $excel_row, '');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(14, $excel_row, '');
            			//$object->getActiveSheet()->setCellValueByColumnAndRow(15, $excel_row,'');
            			$object->getActiveSheet()->setCellValueByColumnAndRow(16, $excel_row, $participants_fullname);
    			        $object->getActiveSheet()->setCellValueByColumnAndRow(17, $excel_row, $val->participants_email); 
    			        $object->getActiveSheet()->setCellValueByColumnAndRow(18, $excel_row, $val->participants_contactno); 
    			}
    			
				$oldmembername = $MemberName;
                }
      $excel_row++;
      
		}
		$object_writer = PHPExcel_IOFactory::createWriter($object, 'Excel5');
		header('Content-Type: application/vnd.ms-excel');
		header('Content-Disposition: attachment;filename="BOOKING DATA.xls"');
		$object_writer->save('php://output');
	}
	

}

















































	