<?php
ob_start();
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
include('includes/session.inc');
$Title = _('Print Roster for GFS');
include('includes/SQL_CommonFunctions.inc');

include('includes/header.inc');
echo '<p> </p> <p></p><p class="page_title_text"><img alt="" src="'.$RootPath.'/css/'.$Theme.
		'/images/printer.png" title="' .// Icon image.
		_('Outstanding Approved Job Costing ') . '" /> ' .// Icon title.
		_('Choose below the GFS Roster to Print. Locked Rosters are not shown') . '</p>';// Page title.
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
	echo '<div class="col-sm-10">';// div class=?
	echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<table class="table">';

echo '<td>' . _('Select Roster to Print ') . ':</td>
							<td><select name="RosterPeriod">';
							
							$SQL = "SELECT rosterid,
											
											start_date,
				                            end_date,
											sectors,
											patrol_location,
											account_number,
											department,
											status
		                            FROM rostering
		                            WHERE status = 'approved'
									
									";

$result=DB_query($SQL);
//echo '<option value="0">0 - ' . _('None Available') . '</option>';
 echo '<option value="0">0 - ' . _('Print All') . '</option>';
while ($myrow=DB_fetch_array($result)){
	
	$SQLpatrol = "SELECT 
											patrollocation,
											debtorno,
											account_number
											
		                            FROM guardforceclient
		                            WHERE clientid ='" . $myrow['patrol_location']."' ";
	$resultP=DB_query($SQLpatrol);
	
	
	$SQLsectors = "SELECT 
											
											name
											
		                            FROM sectors
		                            WHERE id ='" . $myrow['sectors']."' ";
	$resultQ=DB_query($SQLsectors);
	
	
	
	
	while (($myrowP=DB_fetch_array($resultP)) && ($myrowQ=DB_fetch_array($resultQ))) {
		
		$SQLdebtors = "SELECT 
											
											name
											
		                            FROM debtorsmaster
		                            WHERE debtorno ='" . $myrowP['debtorno']."' ";
	$resultR=DB_query($SQLdebtors);
	
	while ($myrowR=DB_fetch_array($resultR)) {
		
	if (isset($_POST['RosterPeriod']) AND $_POST['RosterPeriod']==$myrow['rosterid']){
	    
		echo '<option selected="selected" value="' . $myrow['rosterid'] . '">' . $myrow['rosterid'] . ' - ' .$myrow['start_date'] . ' - ' .$myrow['end_date'] .' -' .$myrowQ['name'] .' -' .$myrowR['name'] .' -'  .$myrowP['patrollocation'] .' -' .$myrow['department'] . '-' .$myrow['status'] .'</option>';
	} else {
			echo '<option value="' . $myrow['rosterid'] . '">' . $myrow['rosterid'] . ' - ' .$myrow['start_date'] . ' - ' .$myrow['end_date'] .' -' .$myrowQ['name'] .' -' .$myrowR['name'] .' -'  .$myrowP['patrollocation'] .' -' .$myrow['department'] . '-' .$myrow['status'] .'</option>';
	}
	
	}
	}
}
echo '</select>';


echo '<input type="submit" name="PrintRoster" value="' ._('Print Roster') . '" />
		</div>
		';



echo '</div>';

echo '</div>';
$rosterid = $_POST['RosterPeriod'];

$printdate = date("d-m-Y");


	if (isset($_POST['PrintRoster']) && ($_POST['RosterPeriod'] == 0)){


	echo ' <b><font style="color: red">all rosters will be printed. </font></b>';	
		
	}

elseif (isset($_POST['PrintRoster']) && ($_POST['RosterPeriod'] == $rosterid)){
		
	
	
	
if (PHP_SAPI == 'cli')
	die('This example should only be run from a Web Browser');

/** Include PHPExcel */
//include_once('Classes/PHPExcel.php');


include_once('Classes/PHPExcel/IOFactory.php');

$inputFileName = 'printing/rostergfs.xlsx';
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory;
PHPExcel_Settings::setCacheStorageMethod($cacheMethod);


/*check point*/

// Read the existing excel file
//$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(false);
$objPHPExcel = $objReader->load($inputFileName);

// Set active sheet index to the first sheet, so Excel opens this as the first sheet
//$objPHPExcel->setActiveSheetIndex();

// Add months and till date information derived from above
//$objPHPExcel->getActiveSheet()->duplicateStyle($objPHPExcel-‌​>getActiveSheet()->g‌​etStyle('B2'), 'B3:B20');

	//header
	
			$SQL = "SELECT rosterid,
											
											start_date,
				                            end_date,
											sectors,
											patrol_location,
											account_number,
											department,
											status
		                            FROM rostering
		                            WHERE rosterid = '" . $rosterid."' 
									
									";

$result=DB_query($SQL);
	
	$myrow50=DB_fetch_array($result);
	
	
	
	$timenow = date('Y-m-d H:i:s');
	
	$SQLpatrol = "SELECT 
											patrollocation,
											debtorno,
											account_number
											
		                            FROM guardforceclient
		                            WHERE clientid ='" . $myrow50['patrol_location']."' ";
	$resultP=DB_query($SQLpatrol);
	
		$myrow100=DB_fetch_array($resultP);
	$SQLsectors = "SELECT 
											
											name
											
		                            FROM sectors
		                            WHERE id ='" . $myrow50['sectors']."' ";
	$resultQ=DB_query($SQLsectors);
	
	$myrow200=DB_fetch_array($resultQ);
	$SQLdebtors = "SELECT 
											
											name
											
		                            FROM debtorsmaster
		                            WHERE debtorno ='" . $myrow100['debtorno']."' ";
	$resultR=DB_query($SQLdebtors);
	
	
	$myrow300=DB_fetch_array($resultR);
	
	//clear or empty needed cells first
	
	$empty = '';
	
	  $objPHPExcel->getActiveSheet()->setCellValue('B2', $empty );
		$objPHPExcel->getActiveSheet()->setCellValue('D2',  $empty );
		$objPHPExcel->getActiveSheet()->setCellValue('F2', $empty );
		$objPHPExcel->getActiveSheet()->setCellValue('B3', $empty );
		$objPHPExcel->getActiveSheet()->setCellValue('D3', $empty );
		$objPHPExcel->getActiveSheet()->setCellValue('B4', $empty );
		$objPHPExcel->getActiveSheet()->setCellValue('D4', $empty );
		$objPHPExcel->getActiveSheet()->setCellValue('J4', $empty );
	    $objPHPExcel->getActiveSheet()->setCellValue('B5', $empty );
	
	//delete other cells in ranges
	
	




	$cellcount = 8;	
while ($cellcount < 36 ) {
	
		
	
		
		
	
		
	    $objPHPExcel->getActiveSheet()->setCellValue('A'.$cellcount, $empty);
		
		$objPHPExcel->getActiveSheet()->setCellValue('B'.$cellcount, $empty);
		$objPHPExcel->getActiveSheet()->setCellValue('C'.$cellcount, $empty);
		$objPHPExcel->getActiveSheet()->setCellValue('D'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('E'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('F'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('G'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('H'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('I'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('J'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('K'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('L'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('M'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('N'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('O'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('P'.$cellcount, $empty);
	$objPHPExcel->getActiveSheet()->setCellValue('Q'.$cellcount, $empty);
	
		$cellcount++;
		
			
	
	
}

	
	
	
	//now write to this
	
        $objPHPExcel->getActiveSheet()->setCellValue('B2',  ConvertSQLDate($myrow50['start_date']));
		$objPHPExcel->getActiveSheet()->setCellValue('D2',  ConvertSQLDate($myrow50['end_date']));
		$objPHPExcel->getActiveSheet()->setCellValue('F2', $timenow);
		$objPHPExcel->getActiveSheet()->setCellValue('B3', $myrow300['name']);
		$objPHPExcel->getActiveSheet()->setCellValue('D3', $myrow100['patrollocation']);
		$objPHPExcel->getActiveSheet()->setCellValue('B4', $myrow100['account_number']);
		$objPHPExcel->getActiveSheet()->setCellValue('D4', $myrow50['department']);
		$objPHPExcel->getActiveSheet()->setCellValue('J4', $myrow50['rosterid']);
	    $objPHPExcel->getActiveSheet()->setCellValue('B5', $myrow200['name']);
	
	
	   
	
// Generate an updated excel file
// Redirect output to a client’s web browser (Excel2007)
	//employee schedules

  $SQL = "SELECT rosteringtimesheet.*,
  				
                  employeemaster.first_name
				  
				  
				FROM rosteringtimesheet INNER JOIN employeemaster
				ON rosteringtimesheet.employeeid = employeemaster.employeeid 
				WHERE rosteringtimesheet.rosterid='" . $myrow50['rosterid']."'
				";

  
  			

	$AccountsResult = DB_query($SQL);

	

$num= DB_num_rows($AccountsResult);


$rowCount= 0;
	
while ($rowCount< $num) {
	$cellcount = 8;	
	$cellcount2 = 9;	
	while ($myrow3=DB_fetch_array($AccountsResult)) {
		
		
	
		 $employee = $myrow3['employeeid'].''.$myrow3['first_name'];
	    
		 
		
		$objPHPExcel->getActiveSheet()->setCellValue('A'.$cellcount, $employee);
		
	if (round($myrow3['mon_hrs'] == 0)){
			
			$mon == $myrow3['montime_in'].'-'.$myrow3['montime_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('B'.$cellcount, $mon);
		$objPHPExcel->getActiveSheet()->setCellValue('C'.$cellcount, round($myrow3['mon_hrs']));
		
			
		}
		elseif (round($myrow3['mon_hrs'] > 0)){
			$mon == $myrow3['montime_in'].'-'.$myrow3['montime_out'].'-'.round($myrow3['mon_hrs']).'h';
		 $objPHPExcel->getActiveSheet()->setCellValue('B'.$cellcount, $mon);
		$objPHPExcel->getActiveSheet()->setCellValue('C'.$cellcount, round($myrow3['mon_hrs']));
		
		 
		}
		elseif (round($myrow3['mon_hrs2'] == 0)){
			
			
			$mon1 == $myrow3['montime_in1'].'-'.$myrow3['montime_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('B'.$cellcount2, $mon1);
		$objPHPExcel->getActiveSheet()->setCellValue('C'.$cellcount2, round($myrow3['mon_hrs2']));
		
		}
		elseif (round($myrow3['mon_hrs2'] > 0)){
			
		
		 $mon1 == $myrow3['montime_in1'].'-'.$myrow3['montime_out1'].'-'.round($myrow3['mon_hrs2']).'h';
			 $objPHPExcel->getActiveSheet()->setCellValue('B'.$cellcount2, $mon1);
		$objPHPExcel->getActiveSheet()->setCellValue('C'.$cellcount2, round($myrow3['mon_hrs2']));
		
		}
		
	
		elseif (round($myrow3['tues_hrs'] == 0)){
			
			$tues == $myrow3['tuestime_in'].'-'.$myrow3['tuestime_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('D'.$cellcount, $tues);
		$objPHPExcel->getActiveSheet()->setCellValue('E'.$cellcount, round($myrow3['tues_hrs']));
		
			
		}
		elseif (round($myrow3['tues_hrs'] > 0)){
			$tues == $myrow3['tuestime_in'].'-'.$myrow3['tuestime_out'].'-'.round($myrow3['tues_hrs']).'h';
		 $objPHPExcel->getActiveSheet()->setCellValue('D'.$cellcount, $tues);
		$objPHPExcel->getActiveSheet()->setCellValue('E'.$cellcount, round($myrow3['tues_hrs']));
		
		 
		}
		elseif (round($myrow3['tues_hrs2'] == 0)){
			
			
			$tues1 == $myrow3['tuestime_in1'].'-'.$myrow3['tuestime_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('D'.$cellcount2, $tues1);
		$objPHPExcel->getActiveSheet()->setCellValue('E'.$cellcount2, round($myrow3['tues_hrs2']));
		
		}
		elseif (round($myrow3['tues_hrs2'] > 0)){
			
		
		 $tues1 == $myrow3['tuestime_in1'].'-'.$myrow3['tuestime_out1'].'-'.round($myrow3['tues_hrs2']).'h';
			 $objPHPExcel->getActiveSheet()->setCellValue('D'.$cellcount2, $tues1);
		$objPHPExcel->getActiveSheet()->setCellValue('E'.$cellcount2, round($myrow3['tues_hrs2']));
		
		}


		elseif (round($myrow3['wed_hrs'] == 0)){
			
			$wed == $myrow3['wedtime_in'].'-'.$myrow3['wedtime_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('F'.$cellcount, $wed);
		$objPHPExcel->getActiveSheet()->setCellValue('G'.$cellcount, round($myrow3['wed_hrs']));
		
			
		}
		elseif (round($myrow3['wed_hrs'] > 0)){
			$wed == $myrow3['wedtime_in'].'-'.$myrow3['wedtime_out'].'-'.round($myrow3['wed_hrs']).'h';
		 $objPHPExcel->getActiveSheet()->setCellValue('F'.$cellcount, $wed);
		$objPHPExcel->getActiveSheet()->setCellValue('G'.$cellcount, round($myrow3['wed_hrs']));
		
		 
		}
		elseif (round($myrow3['wed_hrs2'] == 0)){
			
			
			$wed1 == $myrow3['wedtime_in1'].'-'.$myrow3['wedtime_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('F'.$cellcount2, $wed1);
		$objPHPExcel->getActiveSheet()->setCellValue('G'.$cellcount2, round($myrow3['wed_hrs2']));
		
		}
		elseif (round($myrow3['wed_hrs2'] > 0)){
			
		
		 $wed1 == $myrow3['wedtime_in1'].'-'.$myrow3['wedtime_out1'].'-'.round($myrow3['wed_hrs2']).'h';
			 $objPHPExcel->getActiveSheet()->setCellValue('F'.$cellcount2, $wed1);
		$objPHPExcel->getActiveSheet()->setCellValue('G'.$cellcount2, round($myrow3['wed_hrs2']));
		
		}

		elseif (round($myrow3['thurs_hrs'] == 0)){
			
			$thurs == $myrow3['thurstime_in'].'-'.$myrow3['thurstime_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('H'.$cellcount, $thurs);
		$objPHPExcel->getActiveSheet()->setCellValue('I'.$cellcount, round($myrow3['thurs_hrs']));
		
			
		}
		elseif (round($myrow3['thurs_hrs'] > 0)){
			$thurs == $myrow3['thurstime_in'].'-'.$myrow3['thurstime_out'].'-'.round($myrow3['thurs_hrs']).'h';
		 $objPHPExcel->getActiveSheet()->setCellValue('H'.$cellcount, $thurs);
		$objPHPExcel->getActiveSheet()->setCellValue('I'.$cellcount, round($myrow3['thurs_hrs']));
		
		 
		}
		elseif (round($myrow3['thurs_hrs2'] == 0)){
			
			
			$thurs1 == $myrow3['thurstime_in1'].'-'.$myrow3['thurstime_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('H'.$cellcount2, $thurs1);
		$objPHPExcel->getActiveSheet()->setCellValue('I'.$cellcount2, round($myrow3['thurs_hrs2']));
		
		}
		elseif (round($myrow3['thurs_hrs2'] > 0)){
			
		
		 $thurs1 == $myrow3['thurstime_in1'].'-'.$myrow3['thurstime_out1'].'-'.round($myrow3['thurs_hrs2']).'h';
			 $objPHPExcel->getActiveSheet()->setCellValue('H'.$cellcount2, $thurs1);
		$objPHPExcel->getActiveSheet()->setCellValue('I'.$cellcount2, round($myrow3['thurs_hrs2']));
		
		}
       
		
				elseif (round($myrow3['fri_hrs'] == 0)){
			
			$fri == $myrow3['fritime_in'].'-'.$myrow3['fritime_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('J'.$cellcount, $fri);
		$objPHPExcel->getActiveSheet()->setCellValue('K'.$cellcount, round($myrow3['fri_hrs']));
		
			
		}
		elseif (round($myrow3['fri_hrs'] > 0)){
			$fri == $myrow3['fritime_in'].'-'.$myrow3['fritime_out'].'-'.round($myrow3['fri_hrs']).'J';
		 $objPHPExcel->getActiveSheet()->setCellValue('J'.$cellcount, $fri);
		$objPHPExcel->getActiveSheet()->setCellValue('K'.$cellcount, round($myrow3['fri_hrs']));
		
		 
		}
		elseif (round($myrow3['fri_hrs2'] == 0)){
			
			
			$fri1 == $myrow3['fritime_in1'].'-'.$myrow3['fritime_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('J'.$cellcount2, $fri1);
		$objPHPExcel->getActiveSheet()->setCellValue('K'.$cellcount2, round($myrow3['fri_hrs2']));
		
		}
		elseif (round($myrow3['fri_hrs2'] > 0)){
			
		
		 $fri1 == $myrow3['fritime_in1'].'-'.$myrow3['fritime_out1'].'-'.round($myrow3['fri_hrs2']).'J';
			 $objPHPExcel->getActiveSheet()->setCellValue('J'.$cellcount2, $fri1);
		$objPHPExcel->getActiveSheet()->setCellValue('K'.$cellcount2, round($myrow3['fri_hrs2']));
		
		}

		elseif (round($myrow3['sat_hrs'] == 0)){
			
			$sat == $myrow3['sattime_in'].'-'.$myrow3['sattime_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('L'.$cellcount, $sat);
		$objPHPExcel->getActiveSheet()->setCellValue('M'.$cellcount, round($myrow3['sat_hrs']));
		
			
		}
		elseif (round($myrow3['sat_hrs'] > 0)){
			$sat == $myrow3['sattime_in'].'-'.$myrow3['sattime_out'].'-'.round($myrow3['sat_hrs']).'L';
		 $objPHPExcel->getActiveSheet()->setCellValue('L'.$cellcount, $sat);
		$objPHPExcel->getActiveSheet()->setCellValue('M'.$cellcount, round($myrow3['sat_hrs']));
		
		 
		}
		elseif (round($myrow3['sat_hrs2'] == 0)){
			
			
			$sat1 == $myrow3['sattime_in1'].'-'.$myrow3['sattime_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('L'.$cellcount2, $sat1);
		$objPHPExcel->getActiveSheet()->setCellValue('M'.$cellcount2, round($myrow3['sat_hrs2']));
		
		}
		elseif (round($myrow3['sat_hrs2'] > 0)){
			
		
		 $sat1 == $myrow3['sattime_in1'].'-'.$myrow3['sattime_out1'].'-'.round($myrow3['sat_hrs2']).'L';
			 $objPHPExcel->getActiveSheet()->setCellValue('L'.$cellcount2, $sat1);
		$objPHPExcel->getActiveSheet()->setCellValue('M'.$cellcount2, round($myrow3['sat_hrs2']));
		
		}

				elseif (round($myrow3['sun_hrs'] == 0)){
			
			$sun == $myrow3['sunttime_in'].'-'.$myrow3['sunttime_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('N'.$cellcount, $sun);
		$objPHPExcel->getActiveSheet()->setCellValue('O'.$cellcount, round($myrow3['sun_hrs']));
		
			
		}
		elseif (round($myrow3['sun_hrs'] > 0)){
			$sun == $myrow3['sunttime_in'].'-'.$myrow3['sunttime_out'].'-'.round($myrow3['sun_hrs']).'N';
		 $objPHPExcel->getActiveSheet()->setCellValue('N'.$cellcount, $sun);
		$objPHPExcel->getActiveSheet()->setCellValue('O'.$cellcount, round($myrow3['sun_hrs']));
		
		 
		}
		elseif (round($myrow3['sun_hrs2'] == 0)){
			
			
			$sun1 == $myrow3['suntime_in1'].'-'.$myrow3['suntime_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('N'.$cellcount2, $sun1);
		$objPHPExcel->getActiveSheet()->setCellValue('O'.$cellcount2, round($myrow3['sun_hrs2']));
		
		}
		elseif (round($myrow3['sun_hrs2'] > 0)){
			
		
		 $sun1 == $myrow3['suntime_in1'].'-'.$myrow3['suntime_out1'].'-'.round($myrow3['sun_hrs2']).'N';
			 $objPHPExcel->getActiveSheet()->setCellValue('N'.$cellcount2, $sun1);
		$objPHPExcel->getActiveSheet()->setCellValue('O'.$cellcount2, round($myrow3['sun_hrs2']));
		
		}

				elseif (round($myrow3['mon2_hrs'] == 0)){
			
			$mon2 == $myrow3['mon2time_in'].'-'.$myrow3['mon2time_out'];
			 $objPHPExcel->getActiveSheet()->setCellValue('P'.$cellcount, $mon2);
		$objPHPExcel->getActiveSheet()->setCellValue('Q'.$cellcount, round($myrow3['mon2_hrs']));
		
			
		}
		elseif (round($myrow3['mon2_hrs'] > 0)){
			$mon2 == $myrow3['mon2time_in'].'-'.$myrow3['mon2time_out'].'-'.round($myrow3['mon2_hrs']).'P';
		 $objPHPExcel->getActiveSheet()->setCellValue('P'.$cellcount, $mon2);
		$objPHPExcel->getActiveSheet()->setCellValue('Q'.$cellcount, round($myrow3['mon2_hrs']));
		
		 
		}
		elseif (round($myrow3['mon2_hrs2'] == 0)){
			
			
			$mon21 == $myrow3['mon2time_in1'].'-'.$myrow3['mon2time_out1'];
			 $objPHPExcel->getActiveSheet()->setCellValue('P'.$cellcount2, $mon21);
		$objPHPExcel->getActiveSheet()->setCellValue('Q'.$cellcount2, round($myrow3['mon2_hrs2']));
		
		}
		elseif (round($myrow3['mon2_hrs2'] > 0)){
			
		
		 $mon21 == $myrow3['mon2time_in1'].'-'.$myrow3['mon2time_out1'].'-'.round($myrow3['mon2_hrs2']).'P';
			 $objPHPExcel->getActiveSheet()->setCellValue('P'.$cellcount2, $mon21);
		$objPHPExcel->getActiveSheet()->setCellValue('Q'.$cellcount2, round($myrow3['mon2_hrs2']));
		
		}







		
		
		
		$cellcount+=2;
		$cellcount2+=2;

		
	}
		
		$rowCount++;
	
	
}
   
// Generate an updated excel file
// Redirect output to a client’s web browser (Excel2007)



//save the file to the server (Excel2007)

//include('includes/header.inc');
	


$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
//$objWriter->save($inputFileName);
$objWriter->save($inputFileName);


    
    //<?php
	
echo '<br /><p></p><p></p> <p></p> <p></p> <p></p>  <p class="page_title_text"><a href="' . $inputFileName . '">' . _('File generated o.k. Click to view this  excel File ') . '</p>';




//echo $AccountCode;



$objPHPExcel->disconnectWorksheets();
unset($objPHPExcel);
		
				
}

			
		
			
		
			
		
		
		
			    
		
	
//echo 'Quotation Created Successfully'. $jobno.'!';




//echo 'Quotation Created Successfully'. $jobno.'!';
echo '</div>';
echo '</div>';

//include('includes/footer.inc'); 

?>

