<?php require "_header.php"; 
error_reporting(1);?>
<div id="main-report" align="center">
<center><h4>Employee Personal Detail</h4></center>
<?php
  if($_SESSION["cCompany_id"]=="")
 	{
	?>
		<script language="javascript" type="text/javascript">
			location.href='report-form-employee.php';
		</script>
	<?php
    }elseif($_SESSION["cCompany_id"]!="" && isset($_SESSION["cCompany_id"]))
    {	
	
			$date = new Date();
			
			$limit=0;
			$start=0;
			$condition="";
			$order_field="";
			$order_type="";
			
			$header_row_string="Employee Personal Detail";
			$employee_id = Escape($_REQUEST["ID"]);
			
			if(isset($employee_id)){   
				if($employee_id!=""){
					$condition.=" and employee_id = '$employee_id'";
				}
			}	
			$objEmp = new EmployeeMgmt();
			$out = $objEmp->getAllRecords($limit,$start,$condition,$order_field,$order_type);
			if(dbRows($out)) {
			   ob_start(); //starting for 
				while($row=dbArray($out)) {
					extract($row);
					if($employee_photo=="")
					$imgfile = $SiteImagePath."default.gif";
					else
					$imgfile = $EmployeeImagePath .$employee_photo;
					
				
		?>
		<table width="60%" align="center" class="report">
		  <tr>
			<th align="left" width="33%">Employee Full Name : </th>
			<td width="59%"><?php print $employee_name; ?></td>
			<td rowspan="2" width="8%" align="center" style="padding:5px;" valign="top"><img src=<?php echo $imgfile;?> width="<?php echo $SiteImageWidth ?>" height="<?php echo $SiteImageHeight ?>" /></td>
		  </tr>
		  <tr>
			<th align="left">Current Address :</td>
			<td><?php print $employee_address; ?> </td>
		  </tr>
		 
		  <tr>
			<th align="left">Phone No.:</th>
			<td colspan="2"><?php print $employee_phone;?>  </td>
		  </tr>
		  <tr>
			<th align="left">Mobile NO.:</th>
			<td colspan="2"><?php print $employee_mobile;?> </td>
		  </tr>
		  <tr>
			<th align="left">BirthDate</th>
			<td colspan="2"><?php print $date->format("d/m/Y",$employee_birthdate); ?> </td>
		  </tr>
		  <tr>
			<th align="left">Email :</th>
			<td colspan="2"><?php print $employee_email;?> </td>
		  </tr>
		  <tr>
			<th align="left">Sallary :</th>
			<td colspan="2"><?php print $employee_salary;?> </td>
		  </tr>
		 
		  <tr>
			 <th align="left">Designation :</th>
			<td colspan="2"><?php print $designation_name; ?></td>
		  </tr>
		  <tr>
			<th align="left">Dept. Joing Date :</th>
			<td colspan="2"><?php print $date->format("d/m/Y",$employee_joindate);?></td>
		  </tr>
		 
		  	
  </table>
  <br/>
		<?php } //while loop over
			  $HtmlCode= ob_get_contents();
			  ob_end_flush();
			  $HtmlUrl 	=	"employee-personal-detail-report-". $_SESSION["cUserId"].".html";
			  $HtmlPath 	=	"report/".$HtmlUrl;		
			  createHTMLReportPage($header_row_string,$HtmlUrl,$HtmlPath,$HtmlCode,false);  ?>
		<br/>
		<form name="frm" id="frm" action="" method="post">		
			<input type="hidden" name="txtFile" id="txtFile" value="<?php echo $HtmlUrl ;?>" />
			<input type="button" name="btnPdf" id="btnPdf" value="Print" onClick="SetPageAction('PRINT');" />
			<input type="button" name="btnPdf" id="btnPdf" value="Create PDF" onclick="SetPageAction('PDF');"/>
			<input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onclick="SetPageAction('HTML');"/>
			<input type="button" name="btnWord" id="btnWord" value="Create WORD" onclick="SetPageAction('WORD');"/>
			<input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onclick="SetPageAction('Excel');"/>
		</form>
		<script language="javascript" type="text/javascript">
			function SetPageAction(varAction) {
				if (varAction == "PRINT") {
                    document.frm.action = "print/create-print.php";
                    document.frm.target = "_blank";
                    document.frm.submit();
                }
				if(varAction=="PDF"){			
					document.frm.action="convertpdf/create-pdf.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if(varAction=="HTML"){
					document.frm.action="<?php echo $HtmlPath ;?>";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if(varAction=="WORD"){
					document.frm.action="convertword/create-word.php";
					document.frm.target="_blank";
					document.frm.submit();
				}
				else if(varAction=="Excel"){
					document.frm.action="convertword/create-excel.php";
					document.frm.target="_blank";
					document.frm.submit();
				}
			}
		</script>
		    <br/><br/>   
		<?php	} else {
			         echo "<center><b> No Records Found.</b></center>";
                   } 
    }
	
	else {
	        echo "Session Expired";
	      }	
	?>
</div>
<?php require "_footer.php";?>