<?php
/****************************************
/*  Author 	: Kvvaradha
/*  Module 	: Extended HRM
/*  E-mail 	: admin@kvcodes.com
/*  Version : 1.0
/*  Http 	: www.kvcodes.com
*****************************************/
$page_security = 'HR_EML_PROFILE';
$path_to_root = "../../..";
include($path_to_root . "/includes/session.inc");
add_access_extensions();
include($path_to_root . "/modules/ExtendedHRM/includes/Payroll.inc" );
include($path_to_root . "/modules/ExtendedHRM/includes/ui/empl_leave.inc" );
include($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/data_checks.inc");

if (isset($_GET['vw'])){
	$view_id = $_GET['vw'];
	$empl_ow = GetRow('kv_empl_leave_applied', array('id' => $view_id));
    	header("Content-type: application/octet-stream");
    	//header('Content-Length: '.$row['filesize']);
 		header('Content-Disposition: attachment; filename='.$empl_ow['filename']);
 		//display_error( company_path(). "/attachments/empldocs/".$row['unique_name']);
	   	echo file_get_contents(company_path(). "/attachments/empldocs/".$empl_ow['empl_id']."/".$empl_ow['filename']);
    	exit();
	//}		
}

$version_id = get_company_prefs('version_id');

$js = '';
if($version_id['version_id'] == '2.4.1'){
	if ($SysPrefs->use_popup_windows) 
		$js .= get_js_open_window(900, 500);	

	if (user_use_date_picker()) 
		$js .= get_js_date_picker();
	
}else{
	if ($use_popup_windows)
		$js .= get_js_open_window(900, 500);
	if ($use_date_picker)
		$js .= get_js_date_picker();
}

// $empl_row = GetRow('kv_empl_info', array('user_id' => $_SESSION['wa_current_user']->user));
//$user_id = GetRow('users', array('id' => $_SESSION['wa_current_user']->user));
$empl_row = GetRow('kv_empl_info', array('user_id' => $_SESSION['wa_current_user']->user));

if(!empty($empl_row) && isset($empl_row['empl_id']))
	hidden('empl_id' , $empl_row['empl_id']);

if(!$empl_row) {
	page("404 - Profile Not Found");
	display_warning(_("Sorry, No Profile Linked with your User Account. Kindly Contact Administrator to connect it."));
	end_page();
	exit;
}

page($empl_row['empl_firstname']. ' '.$empl_row['empl_lastname'].' - '._("Profile"), @$_REQUEST['popup'], false, "", $js);

if(kv_check_payroll_table_exist()){}else {
	display_error(_("There are no Allowance defined in this system. Kindly Setup")." <a href='".$path_to_root."/modules/ExtendedHRM/manage/allowances.php' target='_blank'>"._("Allowances")."</a>"._("Your Allowances."));
	end_page();
    exit;
}
check_db_has_Departments(_("There is no Department in the system to add employees. Please Add some")." <a href='".$path_to_root."/modules/ExtendedHRM/manage/department.php' target='_blank'>"._("Department")."</a> ");

$new_item = get_post('empl_id')=='' || get_post('cancel') || get_post('clone'); 
//------------------------------------------------------------------------------------

$_POST['empl_id']=$empl_row['empl_id'];

if(list_updated('dept_id'))
	$Ajax->activate('empl_id');
if (list_updated('empl_id')) {
	$empl_id = get_post('empl_id');
    clear_data();
   $_POST['empl_id'] = $_POST['employee_id'] = $empl_id;
	$Ajax->activate('details');
	$Ajax->activate('controls');
	$Ajax->activate('profile');
}
$empl_id = get_post('empl_id');

//------------------------------------------------------------------------------------
function empl_personal_data(&$empl_id) {
	br();
	global $Ajax, $SysPrefs, $path_to_root, $page_nested, $new_item, $pic_height;
	
	if(get_post('empl_id') || list_updated('empl_id'))
		$Ajax->activate('profile');
	
	div_start('profile');
	start_outer_table(TABLESTYLE2);
	table_section(1);
	table_section_title(_("Employee Informations"));	
	if(get_post('empl_id') || ( list_updated('empl_id') && get_post('empl_id') )|| $empl_id)	{ // Must be modifying an existing item
		//if (get_post('employee_id') != $empl_id || get_post('addupdate')) { // first item display
			if(get_post('empl_id'))
				$_POST['employee_id'] = $_POST['empl_id'];
			else
				$_POST['employee_id'] = $empl_id;
		
			$myrow = GetRow('kv_empl_info', array('empl_id' => $_POST['employee_id']));
			$_POST['empl_salutation'] = $myrow["empl_salutation"];
			$_POST['empl_firstname'] = $myrow["empl_firstname"];
			$_POST['empl_lastname'] = $myrow["empl_lastname"];
			$_POST['addr_line1']  = $myrow["addr_line1"];
			$_POST['addr_line2']  = $myrow["addr_line2"];
			$_POST['address2']  = $myrow["address2"];
			$_POST['empl_city']  = $myrow["empl_city"];
			$_POST['country']  = $myrow["country"];
			$_POST['empl_state']  = $myrow["empl_state"];
			$_POST['home_phone']	= $myrow["home_phone"];
			$_POST['mobile_phone']  = $myrow["mobile_phone"];
			$_POST['email']  = $myrow["email"];
			$_POST['gender']  = $myrow["gender"];
			$_POST['report_to']  = $myrow["report_to"];
			$_POST['ice_name']	= $myrow["ice_name"];
			$_POST['ice_phone_no']  = $myrow["ice_phone_no"];

			if(!isset($myrow['date_of_birth']) || $myrow['date_of_birth'] == '0000-00-00')
				$_POST['date_of_birth']=add_years(Today(), -20);
			else
				$_POST['date_of_birth']  = (isset($_POST['date_of_birth']) ? $_POST['date_of_birth'] : sql2date($myrow["date_of_birth"]));
			$_POST['marital_status']  = $myrow["marital_status"];
			if(list_updated('status'))
				$_POST['status'] = get_post('status');
			else
				$_POST['status'] = $myrow["status"];			
			$_POST['empl_pic'] = $myrow["empl_pic"];			
			$_POST['del_image'] = 0;
			$_POST['pic'] = '';

			hidden('old_status', $myrow["status"]);
		if (!isset($_POST['empl_id']) || $new_item) {
			text_row(_("Employee Id")." :", 'employee_id', $_POST['employee_id'], 21, 20);
		}else
			label_row(_("Employee Id*")." :",$_POST['employee_id']);

		hidden('employee_id', $_POST['employee_id']);
		
		set_focus('description');
			
	}  else {
		if(get_hrm_option('empl_ref_type'))
			$_POST['employee_id'] = $employee_id = kv_get_next_empl_id();
		
		if(!isset($_POST['employee_id']))
			$_POST['employee_id'] = '';
			
		text_row(_("Employee Id")." :", 'employee_id', $_POST['employee_id'], 21, 20);		
		//unset($_POST['empl_id']);
		$_POST['inactive'] = 0;
		if(!isset($_POST['empl_firstname']))
			$_POST['empl_firstname'] = '';
		if(!isset($_POST['empl_lastname']))
			$_POST['empl_lastname'] = '';
		if(!isset($_POST['addr_line1']))
			$_POST['addr_line1']= ''; 
		if(!isset($_POST['addr_line2']))
			$_POST['addr_line2']= ''; 
		if(!isset($_POST['empl_city'])) 
			$_POST['empl_city']= ''; 
		if(!isset($_POST['empl_state']))
			$_POST['empl_state']= ''; 
		if(!isset($_POST['date_of_birth']) || $_POST['date_of_birth'] == '0000-00-00')
			$_POST['date_of_birth']=add_years(Today(), -20);
	}

	kv_empl_salutation_list_row( _("Salutation")." :", 'empl_salutation', null,false,true);
	label_row(_("First Name")."* :", $_POST['empl_firstname']);
	label_row(_("Last Name")." :", $_POST['empl_lastname']);
	table_section_title(_("Permanent Address"));
	label_row(_("Line 1")." :", nl2br($_POST['addr_line1']));
	label_row(_("Line 2")." :", nl2br($_POST['addr_line2']));
	label_row(_("City")." :", $_POST['empl_city']);
	label_row(_("State")." :", $_POST['empl_state']);
	if(!isset($_POST['country']))
		$_POST['country'] = GetSingleValue('kv_empl_option','option_value',array('option_name' => 'home_country'));
 	label_row(_("Country")." :",GetSingleValue('kv_empl_country','local_name',array('id' =>$_POST['country'])));

 	table_section_title(_("Residential Address"));
	label_row(_("Residential Address")." :", $_POST['address2']);
	
	table_section_title(_("Contact Details"));
	label_row(_("Home Phone")." :",  $_POST['home_phone']);
	label_row(_("Mobile Phone")."* :",  $_POST['mobile_phone']);
	label_row(_("Email")." :",  $_POST['email']);	

	if (!isset($_POST['empl_id']) || $new_item) {		
		kv_empl_gender_list_row( _("Gender")." :", 'gender', null);
		date_row(_("Date of Birth") . ":", 'date_of_birth', null, null, 0,0,0,null, true);
		if (list_updated('date_of_birth') || $new_item) {
			$_POST['age'] = date_diff(date_create(date2sql($_POST['date_of_birth'])), date_create('today'))->y;
		}
		label_row(_("Age")." :", $_POST['age']);	
		hrm_empl_marital_list_row( _("Marital Status")." :", 'marital_status', null);	
		//check_row(_("Create User Account")."* :", 'register_user_acc', null);			
	/*	table_section_title(_("Job Details"));		
			
		department_list_row( _("Department")." :", 'department', null, false, false, false,false, true);	
		hrm_empl_desig_group(_("Designation Group")."* :", 'desig_group', null);
		designation_list_row(_("Designation")."* :", 'desig', null);
		//text_row(_("Desgination")."* :", 'desig', null,  35, 100);
		//text_row(_("Basic Salary")."* :", 'basic_salary', null, 30, 30);
		date_row(_("Date of Join") . ":", 'joining');
		hrm_empl_type_row(_("Employment Type")."* :", 'empl_type', null);
		workcenter_list_row(_("Working Place")."* :", 'working_place');
		table_section_title(_("KYC IDS"));
		text_row(_("Insurance Number")." :", 'ESIC', null,  30, 100);
		text_row(_("Insurance Company Name")." :", 'PF', null,  30, 100);
		//text_row(_("PAN Card No")."* :", 'PAN', null,  30, 100);*/

	}
		
	hrm_empl_status_list(_("Status")."* :", 'status', null, true,true);
	if(isset($_POST['empl_id']) && list_updated('status')){		
		if($_POST['status'] != 1)
			textarea_row(_("Reason for Leaving")." :", 'reason_status_change', null, 30, 5);

	}
	table_section_title(_("Contact(ICE)"));
		label_row(_("Name")."* :", $_POST['ice_name']);
		label_row(_("Mobile Phone")."* :", $_POST['ice_phone_no']);
	
	table_section(3);
	div_start('payroll_tbl');	// Add image upload for New Item 
	table_section_title(_("Personal Details"));
	$stock_img_link = "";
	$check_remove_image = false;
	if ($empl_id!= '' && file_exists(company_path().'/images/empl/'.$_POST['empl_pic'])){	
		$stock_img_link .= "<img id='empl_profile_pic' alt = '[".$_POST['employee_id'].".jpg"."]' src='".company_path().'/images/empl/'.$_POST['empl_pic']."?nocache=".rand()."'"." height='150' border='1'>";
		$check_remove_image = true;
	} else {
		$stock_img_link .= "<img id='empl_profile_pic' alt = '[".$_POST['employee_id'].".jpg"."]' src='".$path_to_root.'/modules/ExtendedHRM/images/no-image.png'. "?nocache=".rand()."'"." height='150' border='1'>";
	}
	label_row("&nbsp;", $stock_img_link);		
	//kv_hrm_image_row(_("Photo (.jpg)") . ":", 'pic', 'pic');
	//if ($check_remove_image)
	//	check_row(_("Delete Image:"), 'del_image');	 	
	if (isset($_POST['empl_id']) && !$new_item){
		kv_empl_gender_list_row( _("Gender")." :", 'gender', null,false,true);
		label_row(_("Date of Birth") . ":", $_POST['date_of_birth']);
		if (list_updated('date_of_birth') || $new_item|| get_post('date_of_birth')) {
			$_POST['age'] = date_diff(date_create(date2sql($_POST['date_of_birth'])), date_create('today'))->y;
		}
		label_row(_("Age")." :", $_POST['age']);	
		hidden('age', $_POST['age']);
		hrm_empl_marital_list_row( _("Marital Status")." :", 'marital_status', null,false,true);
	}	
	
	hidden('empl_page', 'info') ; 

	if (!isset($_POST['empl_id']) || $new_item) { 
		if(!isset($_POST['currency'])){
			$company_record = get_company_prefs();
			$_POST['currency']  = $company_record["curr_default"];
		}		
		currencies_list_row(_("Currency"), 'currency', null);
		kv_empl_grade_list_row( _("Grade ")." :", 'grade_id', null, false, true);
		$EarAllowance = get_allowances('Earnings', 'Profile Input', 'Percentage', 'Gross Percentage', 0, get_post('grade_id'), 'Formula');

		if(db_num_rows($EarAllowance) > 0){
			$KVAllowance = kv_get_allowances(null, 0, get_post('grade_id'));
			$allowance_var_ar = array();
			foreach($KVAllowance as $single) {
				$allowance_var_ar[$single['id']] = '{$'.$single['unique_name'].'}';	
			}
			$gross = GetRow('kv_empl_allowances', array('gross' => 1));
			$basic_allowed = true;
			if($gross){
				kv_basic_row(get_allowance_name($gross['id']), 'gross', 15, 100, null, true);
			} else {
				$basic = GetRow('kv_empl_allowances', array('basic' => 1));
				kv_basic_row(get_allowance_name($basic['id']), $basic['id'], 15, 100, null, true);
				$basic_allowed = false;
			}
				
			while ($single = db_fetch($EarAllowance)) {	
				if($single['basic'] == 1)
					$basic_id = $single['id'];				
				if(is_numeric($single['formula']))
					$_POST['E_'.$single['id']] = $single['formula'];
				elseif($single['value'] == 'Percentage'  && $single['percentage']>0){		
					$_POST['E_'.$single['id']] = get_post($basic_id)*($single['percentage']/100);
				}elseif( $single['value'] == 'Gross Percentage' && $single['percentage']>0 ) {
					$_POST['E_'.$single['id']] = get_post('gross')*($single['percentage']/100);					
				} elseif($single['formula'] != '' && !is_numeric($single['formula']) && (strpos($single['formula'], '{$ctc}') === false)){
					foreach($allowance_var_ar as $key => $allown){
						$single['formula'] = str_replace($allown,$_POST[$key],strtolower($single['formula']));
					}
					if(strpos($single['formula'], '{$gros}'))
						$single['formula'] = str_replace('{$gros}', $_POST['gross'],strtolower($single['formula']));
					$_POST['E_'.$single['id']] = round(calculate_string($single['formula']),2);					
				}else
					$_POST['E_'.$single['id']] = null;				
			
				if((($single['basic'] != 1 || $basic_allowed ) && $single['gross'] != 1 ) ){
					kv_text_row_ex(_($single['description']." :"), 'E_'.$single['id'], 15, 100, null, null, null, null, true); 
				}
			}
		}
		
		$ReimbursementAllowance = get_allowances('Reimbursement', 'Profile Input', 'Percentage', 'Gross Percentage', 0, get_post('grade_id'));
		if(db_num_rows($ReimbursementAllowance) > 0){
			while ($single = db_fetch($ReimbursementAllowance)){
				if(is_numeric($single['formula']))
					$_POST['E_'.$single['id']] = $single['formula'];
				elseif($single['value'] == 'Percentage'  && $single['percentage']>0){		
					$_POST['E_'.$single['id']] = get_post($basic_id)*($single['percentage']/100);
				}elseif( $single['value'] == 'Gross Percentage' && $single['percentage']>0 ) {
					$_POST['E_'.$single['id']] = get_post('gross')*($single['percentage']/100);					
				} elseif($single['formula'] != '' && !is_numeric($single['formula']) && (strpos($single['formula'], '{$ctc}') === false)){
					foreach($allowance_var_ar as $key => $allown){
						$single['formula'] = str_replace($allown,$_POST[$key],strtolower($single['formula']));
					}
					if(strpos($single['formula'], '{$gros}'))
						$single['formula'] = str_replace('{$gros}', $_POST['gross'],strtolower($single['formula']));
					$_POST['E_'.$single['id']] = round(calculate_string($single['formula']),2);
				} else
					$_POST['E_'.$single['id']] = null;
				
				kv_text_row_ex(_($single['description']." :"), 'E_'.$single['id'], 15, 100, null, null, null, null, true); 		
					
			}
		}
		$CTCAllowance = get_allowances('Employer Contribution', 'Profile Input', 'Percentage', 'Gross Percentage', 0, get_post('grade_id'));	
		if(db_num_rows($CTCAllowance) > 0){	
			while ($single = db_fetch($CTCAllowance)){
				if(is_numeric($single['formula']))
					$_POST['E_'.$single['id']] = $single['formula'];
				elseif($single['value'] == 'Percentage'  && $single['percentage']>0){		
					$_POST['E_'.$single['id']] = get_post($basic_id)*($single['percentage']/100);
				}elseif( $single['value'] == 'Gross Percentage' && $single['percentage']>0 ) {
					$_POST['E_'.$single['id']] = get_post('gross')*($single['percentage']/100);					
				} elseif($single['formula'] != '' && !is_numeric($single['formula']) && (strpos($single['formula'], '{$ctc}') === false)){
					foreach($allowance_var_ar as $key => $allown){
						$single['formula'] = str_replace($allown,$_POST[$key],strtolower($single['formula']));
					}
					if(strpos($single['formula'], '{$gros}'))
						$single['formula'] = str_replace('{$gros}', $_POST['gross'],strtolower($single['formula']));
					$_POST['E_'.$single['id']] = round(calculate_string($single['formula']),2);
				} else
					$_POST['E_'.$single['id']] = null;
				
				kv_text_row_ex(_($single['description']." :"), 'E_'.$single['id'], 15, 100, null, null, null, null, true); 
			}
		}

		$DedAllowance = get_allowances('Deductions', 'Profile Input', 'Percentage', 'Gross Percentage', 0, get_post('grade_id'), 'Formula');
		if(db_num_rows($DedAllowance) > 0){			
			while ($single = db_fetch($DedAllowance)) {				
				if($single['Tax'] != 1 && $single['loan'] != 1){
					if(is_numeric($single['formula'])){
						$_POST['E_'.$single['id']] = $single['formula'];						
					}elseif($single['value'] == 'Percentage'  && $single['percentage']>0){		
						$_POST['E_'.$single['id']] = get_post($basic_id)*($single['percentage']/100);
					}elseif( $single['value'] == 'Gross Percentage' && $single['percentage']>0 ) {
						$_POST['E_'.$single['id']] = get_post('gross')*($single['percentage']/100);					
					} elseif($single['formula'] != '' && !is_numeric($single['formula']) && (strpos($single['formula'], '{$ctc}') === false)){
						foreach($allowance_var_ar as $key => $allown){
							$single['formula'] = str_replace($allown,$_POST[$key],strtolower($single['formula']));
						}
						if(strpos($single['formula'], '{$gros}'))
							$single['formula'] = str_replace('{$gros}', $_POST['gross'],strtolower($single['formula']));
						$_POST['E_'.$single['id']] = round(calculate_string($single['formula']),2);
					}  else
						$_POST['E_'.$single['id']] = null;
					
					kv_text_row_ex(_($single['description']." :"), 'E_'.$single['id'], 15, 100, null, null, null, null, true); 					
				}
			}
		}
		if(!isset($_POST['empl_id']) || $new_item){
			text_row_ex(_("Maximum allowed Limit Percentage")." :", 'expd_percentage_amt', 10, 10, '', null, null, "% for Loan Monthly Pay");
		}
		
	}	
	employee_list_row(_("Report To")." :", 'report_to', null, _("Select an Employee"),false,false,false,true,false,false,true);
	
	/*if(!isset($_POST['empl_id']) || $new_item){
		if(get_hrm_option('enable_employee_access'))
			security_roles_list_cells(_("Access Role")." :". "&nbsp;", 'role', null, false, false, check_value('show_inactive'));
		empl_shifts_list_row(_("Employee Shift"), 'shift', null, _("Company Time"));
		table_section_title(_("Leave Details"));
		$_POST['al'] = $_POST['cl'] = $_POST['ml'] =  0;
		if(get_post('grade_id') || list_updated('grade_id')){
			$leave_values = GetRow('kv_empl_grade', array('id' => get_post('grade_id')));
			$_POST['al'] = round($leave_values['al']);
			$_POST['cl'] = round($leave_values['cl']);
			$_POST['ml'] = round($leave_values['ml']);
		}
		text_row(_('Annual Leave'), 'al', null,  5, 10);
		text_row(_('Medical Leave'), 'ml', null,  5, 10);
		text_row(_('Casual Leave'), 'cl', null,  5, 10);
		table_section_title(_("Unused Existing Leave Details"));
		text_row(_('Annual Leave'), 'ual', null,  5, 10);
		text_row(_('Medical Leave'), 'uml', null,  5, 10);
		text_row(_('Casual Leave'), 'ucl', null,  5, 10);
	} */	
	
	end_outer_table(1);
	div_end();
	div_end();
	br();	
}

//-----------------------------------------------------------------------------------------
function empl_notes($empl_id){
	global $Ajax;
	
	if (isset($_POST['submitNote'])) {
		Update('kv_empl_info', array('empl_id' => $_POST['empl_id']), array('notes' => $_POST['notes']));
		display_notification(_("Note Updated successfully"));
	}

	br();
	$_POST['notes'] = GetSingleValue('kv_empl_info', 'notes', array('empl_id' => $empl_id));
	
	echo '<div style="width: 65%;margin: 0 auto;"> '.htmlspecialchars_decode($_POST['notes']).'</div>';
	
	br(2);	
}
//-------------------------------------------------------------------------------------------- 
start_form(true);

if (db_has_employees()) {
	start_table(TABLESTYLE_NOBORDER);
	start_row();
   
$Ajax->activate('empl_id');
	$new_item = get_post('empl_id')=='';
	end_row();
	end_table();

	if (get_post('_show_inactive_update')) {		
		set_focus('empl_id');
	}
} else {
	hidden('empl_id', get_post('empl_id'));
}

$Mode = 'RESET';
div_start('details');

$empl_id = get_post('empl_id');
if (!$empl_id)
	unset($_POST['_tabs_sel']); // force settings tab for new customer

$tab_cont_ar = array(
		'personal' => array(_("Personal Info"), $empl_id),
		'job' => array(_("Job"), (user_check_access('HR_EML_PROFILE') ? $empl_id : null) ),				
		'leave' => array(_("Attendance"), (user_check_access('HR_EML_LEAVE_INQUIRY') ? $empl_id : null)),
		'empl_leave' => array(_("Leave"), (user_check_access('HR_EML_LEAVE') ? $empl_id : null) ),
		'payroll' => array(_("Payroll History"), (user_check_access('HR_EML_PAYROLL') ? $empl_id : null ) ), 	
		// 'loan' => array(_("Loan History"), (user_check_access('HR_EML_LOAN') ? $empl_id : null )), 
		'loan_req' => array(_("Loan Request"),$empl_id ), 
		'license' => array(_("License"), $empl_id),					
		'education' => array(_("Education"), $empl_id),
		'skills' => array(_("Language"), $empl_id),
		'previous_emplment' => array(_("Employment History"), $empl_id),
		'training' => array(_("Training"), $empl_id),	
		'attachments' => array(_("Attachments"), $empl_id),				
		'family' => array(_("Family"), $empl_id),	
		'note' => array(_("Notes"), $empl_id)			
	);
if(!get_hrm_option('license_mgr'))
		unset($tab_cont_ar['license']);

tabbed_content_start('tabs', $tab_cont_ar);
	
	switch (get_post('_tabs_sel')) {
		default:
		case 'personal':
			empl_personal_data($empl_id); 
			break;
		case 'job':			
			//empl_job_data($empl_id);	
			$_GET['empl_id'] = $empl_id;
			$_GET['popup'] = 1;
			include_once($path_to_root."/modules/ExtendedHRM/employee/add_empl_info_job.php");			
			break;
		// case 'loan':			
		// 	//empl_job_data($empl_id);	
		// 	$_GET['empl_id'] = $empl_id;
		// 	$_GET['page_level'] = 1;
		// 	include_once($path_to_root."/modules/ExtendedHRM/manage/loan_form.php");			
		// 	break;

		case 'loan_req':			
			//empl_job_data($empl_id);	
			$_GET['empl_id'] = $empl_id;
			$_GET['page_level'] = 1;
			include_once($path_to_root."/modules/ExtendedHRM/employee/loan_applied.php");			
			break;

		case 'education':
			$degree = new empl_degree('degree', $empl_id, 'employee');
			$degree->show();	
			break;
		case 'skills':
			$degree = new empl_skill('skills', $empl_id, 'employee');
			$degree->show();	
			break;
		case 'training':
			$training = new empl_training('training', $empl_id, 'employee');
			$training->show();
			break;
		case 'previous_emplment':
			$exp = new empl_experience('previous_emplment', $empl_id, 'employee');
			$exp->show();
			break;
		case 'license':
			$exp = new empl_license('license', $empl_id, 'employee');
			$exp->show();
			break; 
		case 'leave':
			empl_leave_data($empl_id); 
			break;
		case 'payroll':			
			empl_payroll_data($empl_id); 
			break;
		case 'empl_leave':
			$exp = new empl_leave('leave', $empl_id, 'employee');
			$exp->show();
			break;
		case 'attachments':
			$_GET['empl_id'] = $empl_id;
			$_GET['page_level'] = 1;
			include_once($path_to_root."/modules/ExtendedHRM/employee/attachments.php"); 
			break;
		case 'family':
			$_GET['empl_id'] = $empl_id;
			$_GET['page_level'] = 1;
			include_once($path_to_root."/modules/ExtendedHRM/employee/family_data.php"); 
			break;
		case 'note':
			empl_notes($empl_id); 
			break;
	}
br();
tabbed_content_end();
div_end();
end_form();
end_page(@$_REQUEST['popup']);
?>
<style>
#empl_profile_pic { border: 1px solid rgba(128, 128, 128, 0.68);    border-radius: 2px;}
td#kv_gross_amt {	color: #FF9800;    /*background-color: #f9f2bb; */ }
td#kv_ctc_amt{	color: #9C27B0;    /*background-color: rgba(156, 39, 176, 0.23); */ }
td#kv_net_amt{	color: #107B0F;   /* background-color: #B7DBC1; */}
td#kv_ded_amt{	color: #107B0F;   /* background-color: #f55; */}
ul.ajaxtabs li button {      padding: 3px 15px; } 
/*table { width: auto; }*/
table.tablestyle_noborder {
    width: 70%;
}
</style>
