<?php 
$PageSecurity = 2;
$title = _('Employee Master') ;
include('includes/SQL_CommonFunctions.inc');
include('includes/othrs.php');
date_default_timezone_set('Asia/calcutta');
$today=date('d/m/Y');
if(isset($_POST['Submit']))
{
		
		//$EmpName=$_REQUEST['emp_name'];
		//$FirstChar=substr($EmpName,0,1);
		//$FirstChar1=strtoupper($FirstChar);
		//$maxempcode=DB_query("SELECT MAX(emp_code) AS EMPCD FROM empmaster WHERE emp_code LIKE '$FirstChar1%'",$db);
		//$MaxCodeEmp=DB_fetch_array($maxempcode);
		//if($MaxCodeEmp['EMPCD']!='')
		//{
			//$numericval=substr($MaxCodeEmp['EMPCD'],1);
			//$nextdigit=$numericval+1;
			//$FinempCode=$FirstChar1.str_pad($nextdigit,4,"0",STR_PAD_LEFT);
		//}
		//else
		//{
		//	$FinempCode=$FirstChar1.'0001';
                //	
		//}
	
		
		$max_size='2000';
		$flag=0;
		function extension($filename)
		{
			$name_brk=explode('.',$filename);
			return  $name_brk[1];
		}
		
		$name=$_FILES['photo']['name'];
		$type=extension($name);
		
		if($type!='')
		{
		if($type!='jpg' && $type!='jpeg' && $type!='JPEG' && $type!='JPG' && $type!='png' && $type!='gif' && $type!='gif')
		{
			echo "<strong>Invalid Extension! Kindly please check the image before uploading</strong>";
			$flag=1;
		}
		else
		{
			$tmp_name=$_FILES['photo']['tmp_name'];
			$new_name=$FinempCode.'.'.$type;
			$path="uploaded_images/".$new_name;
			$file_copy=copy($tmp_name,$path);
			if(!$file_copy)
			{
				echo "<strong>Copy Unsuccessful</strong>";
				$flag=1;
			}
		}
		}

		$flag=0;
		
	    $qty=$_FILES['docmnt']['name'];
		
		for($i=0;$i<count($qty);$i++)
		{ 
		$name=$_FILES['docmnt']['name'][$i];
		$type=extension($name);
		
			if($type!='')
			{
			if($type!='pdf' && $type!='doc' && $type!='txt' && $type!='docx' && $type!='rtf' && $type!='jpeg'
			&& $type!='jpg' && $type!='jpeg' && $type!='JPEG' && $type!='JPG' && $type!='png' && $type!='gif' && $type!='gif')
			{
				echo "<strong>Invalid Extension! Kindly please check the image before uploading</strong>";
				$flag=1;
			}
			else
			{
				$tmp_name=$_FILES['docmnt']['tmp_name'][$i];
				//echo $_FILES['photo']['size'];
				$new_name2[]=$FinempCode.'_'.$name;
				$path="uploaded_docs/".$new_name2[$i];
				$file_copy=move_uploaded_file($tmp_name,$path);
				if(!$file_copy)
				{
					echo "<strong>Copy Unsuccessful</strong>";
					$flag=1;
				}
			}
			$newname1=implode(",",$new_name2);
			}

		}
		$esi = $_REQUEST['ESI_employer_value'];
		$dataP['emp_site']=$_REQUEST['emp_site'];
		$dataP['employment_type']=$_REQUEST['employment_type'];
		$dataP['employee_type']=$_REQUEST['emp_shift'];
		$dataP['emp_code']=$_REQUEST['emp_code'];
		$dataP['emp_name']=$_REQUEST['emp_name'];
		$dataP['fh_name']=$_REQUEST['fh_name'];
		$dataP['nationality']=$_REQUEST['nationality'];
		$dataP['religion']=$_REQUEST['religion'];
		$dataP['dob']=FormatDateForSQL($_REQUEST['dob']);
		$dataP['bloodgroup']=$_REQUEST['bloodgroup'];
		$dataP['doj']=FormatDateForSQL($_REQUEST['doj']);
		$dataP['dol']=FormatDateForSQL($_REQUEST['dol']);
		$dataP['department']=$_REQUEST['department'];
		$dataP['designation']=$_REQUEST['designation'];
		if(count($_REQUEST['emp_weekly_off'])>1)
		$weekly_off=implode(",",$_REQUEST['emp_weekly_off']);
		else
		$weekly_off=$_REQUEST['emp_weekly_off'][0];	
		$dataP['emp_weekly_off']=$weekly_off;
		$dataP['marital_status']=$_REQUEST['marital_status'];
		$dataP['marriage']=FormatDateForSQL($_REQUEST['marriage']);
		$dataP['wh_name']=$_REQUEST['wh_name'];
		$dataP['sons']=$_REQUEST['sons'];
		$dataP['daughters']=$_REQUEST['daughters'];
		$dataP['sex']=$_REQUEST['sex'];
		$dataP['grade']=$_REQUEST['grade'];
		$dataP['personalEmail']=$_REQUEST['personalEmail'];
		$dataP['offEmail']=$_REQUEST['offEmail'];
		$dataP['PFno']=$_REQUEST['PFno'];
		$dataP['ESIno']=$_REQUEST['ESIno'];
		$dataP['bank_account']=$_REQUEST['bank_account'];
		$dataP['bank_name']=$_REQUEST['bank_name'];
		$dataP['payment_mode']=$_REQUEST['payment_mode'];
		$dataP['leave_eff_date']=FormatDateForSQL($_REQUEST['leave_eff_date']);
		$dataP['bachelor']=$_REQUEST['bachelor'];
		$dataP['bac_college_name']=$_REQUEST['bac_college_name'];
		$dataP['bac_year_passing']=$_REQUEST['bac_year_passing'];
		$dataP['pg_college_name']=$_REQUEST['pg_college_name'];
		$dataP['pg_year_passing']=$_REQUEST['pg_year_passing'];
        $dataP['other_college_name']=$_REQUEST['other_college_name'];
		$dataP['other_year_passing']=$_REQUEST['other_year_passing'];
		$dataP['course1']=$_REQUEST['course1'];
		$dataP['course2']=$_REQUEST['course2'];
		$dataP['course3']=$_REQUEST['course3'];
		$dataP['master']=$_REQUEST['pgcourse'];
		$dataP['other_master']=$_REQUEST['othercourse'];
		$dataP['basic_perc']=$_REQUEST['basic_perc'];
		$dataP['basic_salary']=$_REQUEST['basic_salary'];
		$dataP['pf_Reimbursement_per']=$_REQUEST['pf_Reimbursement_per'];
		$dataP['pf_Reimbursement']=$_REQUEST['pf_Reimbursement'];
		$dataP['medical_Reimbursement_per']=$_REQUEST['medical_Reimbursement_per'];
		$dataP['medical_Reimbursement']=$_REQUEST['medical_Reimbursement'];
		$dataP['allow_tot']=$_REQUEST['allow_tot'];
		$dataP['deduct_tot']=$_REQUEST['deduct_tot'];
		$dataP['gross_sal']=$_REQUEST['gross_sal'];
		$dataP['gross']=$_REQUEST['gross']+$esi;
	///////////....................................//////////////////
		$dataP['net_sal']=$_REQUEST['net_sal'];
		$dataP['eff_sal_date']=FormatDateForSQL($_REQUEST['eff_sal_date']);
		$dataP['pf_calculation']=$_REQUEST['pf_calculation'];
		$dataP['adv_amount']=$_REQUEST['adv_amount'];
		$dataP['adv_date']=FormatDateForSQL($_REQUEST['adv_date']);
		if($_REQUEST['otapplicable']!='')
		$otapplicable='Y';
		else
		$otapplicable='N';
		$datap['otapplicable']=$otapplicable;
		$dataP['ottype']=$_REQUEST['ottype'];
		
		$dataP['over_time']=$_REQUEST['over_time'];
		$dataP['overtime_salary']=$_REQUEST['overtime_salary'];
		$dataP['tenth_standard']=$_REQUEST['tenth_standard'];
		$dataP['tenthplus2_standard']=$_REQUEST['tenthplus2_standard'];
		$dataP['image']=$new_name;
		$dataP['document']=$newname1;
		$dataP['created_by']=$_SESSION['UserID'];
		$dataP['created_date']=FormatDateForSQL(date('d/m/Y'));
		$dataP['pending_wo']=$_REQUEST['weekly_off'];
		$dataP['CompanyId']=$_SESSION['ACGCompanyId'];
		$dataP['multi_site_att']=$_REQUEST['multi_site_att'];
		$dataP['loan_ledger']=$_REQUEST['loan_mapping'];
		$dataP['advance_ledger']=$_REQUEST['advance_mapping'];
		$dataP['yearly_ctc']    =$_REQUEST['yearlyctc'];
		$dataP['monthly_ctc']   =$_REQUEST['monthelyctc'];
		$dataP['pan_no']=$_REQUEST['pan_no'];
		$dataP['incometax']=$_REQUEST['incometax'];
		if($_REQUEST['govt'])
		$govtnom='Y';
		else
		$govtnom='N';
		$dataP['govt_nom_pf']=$govtnom;
	//////////////////////////.....................................................//////////////////////			 
		
		//echo "<pre>";
		//print_r($dataP);
		//exit;
		$s->RecordInsert('empmaster',$dataP);
		$Lastemp_id = DB_Last_Insert_ID($db,'empmaster','id');
				
		if($Lastemp_id!='')
		{
			$dataArr['emp_id']=$Lastemp_id;
			$dataArr['per_address1']=$_REQUEST['per_address1'];
			$dataArr['per_address2']=$_REQUEST['per_address2'];
			$dataArr['per_address3']=$_REQUEST['per_address3'];
			$dataArr['per_country']=$_REQUEST['per_country'];
			$dataArr['per_state']=$_REQUEST['per_state'];
			$dataArr['per_city']=$_REQUEST['per_city'];
			$dataArr['per_pincode']=$_REQUEST['per_pincode'];
			$dataArr['per_mobile']=$_REQUEST['per_mobile'];
			$dataArr['per_phone']=$_REQUEST['per_phone'];
			$dataArr['per_alt_phone']=$_REQUEST['per_alt_phone'];
			$dataArr['per_alt_mobile']=$_REQUEST['per_alt_mobile'];
			$dataArr['pre_address1']=$_REQUEST['pre_address1'];
			$dataArr['pre_address2']=$_REQUEST['pre_address2'];
			$dataArr['pre_address3']=$_REQUEST['pre_address3'];
			$dataArr['pre_country']=$_REQUEST['pre_country'];
			$dataArr['pre_state']=$_REQUEST['pre_state'];
			$dataArr['pre_city']=$_REQUEST['pre_city'];
			$dataArr['pre_pincode']=$_REQUEST['pre_pincode'];
			$dataArr['pre_mobile']=$_REQUEST['pre_mobile'];
			$dataArr['pre_phone']=$_REQUEST['pre_phone'];
			$dataArr['pre_alt_phone']=$_REQUEST['pre_alt_phone'];
			$dataArr['pre_alt_mobile']=$_REQUEST['pre_alt_mobile'];
			
			$s->RecordInsert('employee_address',$dataArr);

			$monthwo=date("n");
			$yearswo=date("Y");
			if($monthwo==01 || $monthwo==1)
			{
				$monthwo1=12;
				$yearwo1=$yearswo-1;
			}
			else
			{
				$monthwo1=$monthwo-1;
				$yearwo1=$yearswo;
			}				
				
			$dataWOff['emp_id']=$Lastemp_id;
			$dataWOff['year']=$yearwo1;
			$dataWOff['month']=$monthwo1;
			$dataWOff['pending_wo']=$_REQUEST['weekly_off'];
			
			$s->RecordInsert('weekly_off_emp',$dataWOff);
			
			for($k=1;$k<$_REQUEST['ctr'];$k++)
			{
				$dataEmpSal['emp_id']=$Lastemp_id;
				$dataEmpSal['allowance_deduction']=$_REQUEST['allid'][$k];
				$dataEmpSal['percentage']=$_REQUEST['aperc'][$k];
				$dataEmpSal['percentage_value']=$_REQUEST['allow'][$k];
				$dataEmpSal['all_ded_prefix']=$_REQUEST['prefix1'];
				$s->RecordInsert('emp_salary',$dataEmpSal);
			}
			
			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='100';
			$dataEmpSpeSal['percentage']='0.00';
			$dataEmpSpeSal['percentage_value']=$_REQUEST['special_allow'];			
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);
			
			
			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='101';
			$dataEmpSpeSal['percentage']=$_REQUEST['ltaper'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['lta'];
			$dataEmpSpeSal['non_taxable_amt']=$_REQUEST['lta_nontaxable'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);
			
			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='102';
			$dataEmpSpeSal['percentage']=$_REQUEST['medicalper'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['medicalamount'];
			$dataEmpSpeSal['non_taxable_amt']=$_REQUEST['medicalamountent'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='104';
			$dataEmpSpeSal['percentage']=$_REQUEST['supperannuation_per'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['supperannuation_amt'];
			$dataEmpSpeSal['non_taxable_amt']=$_REQUEST['supperannuation_nontaxableamt'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='105';
			$dataEmpSpeSal['percentage']=$_REQUEST['medicalpolicyper'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['medicalpolicyamt'];
			$dataEmpSpeSal['non_taxable_amt']=$_REQUEST['medicalpolicyamountent'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='106';
			$dataEmpSpeSal['percentage']=$_REQUEST['gratuity_per'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['gratuity_amt'];
			$dataEmpSpeSal['non_taxable_amt']=$_REQUEST['gratuity_nontaxableamt'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);


			
//////////////////////////////////////////........ESI(Employer)..../////////////////////////////			
			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='103';
			$dataEmpSpeSal['percentage']=$_REQUEST['ESI_employer'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['ESI_employer_value'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='107';
			$dataEmpSpeSal['percentage']=$_REQUEST['pf_ac1'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['pf_ac1_amt'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='108';
			$dataEmpSpeSal['percentage']=$_REQUEST['pf_ac10_per'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['pf_ac10_amt'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='109';
			$dataEmpSpeSal['percentage']=$_REQUEST['pf_ac2_per'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['pf_ac2_amt'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

			$dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='110';
			$dataEmpSpeSal['percentage']=$_REQUEST['pf_ac21_per'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['pf_ac21_amt'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);

            $dataEmpSpeSal['emp_id']=$Lastemp_id;
			$dataEmpSpeSal['allowance_deduction']='111';
			$dataEmpSpeSal['percentage']=$_REQUEST['pf_ac22_per'];
			$dataEmpSpeSal['percentage_value']=$_REQUEST['pf_ac22_amt'];
			$dataEmpSpeSal['all_ded_prefix']='A';
			$s->RecordInsert('emp_salary',$dataEmpSpeSal);
			
			for($K=1;$K<$_REQUEST['dctr'];$K++)
			{
				$dataEmpSalDed['emp_id']=$Lastemp_id; 
				$dataEmpSalDed['allowance_deduction']=$_REQUEST['dedid'][$K];
				$dataEmpSalDed['percentage']=$_REQUEST['dperc'][$K]; 
				$dataEmpSalDed['percentage_value']=$_REQUEST['deduction'][$K]; 
				$dataEmpSalDed['all_ded_prefix']=$_REQUEST['prefix2'];
				$s->RecordInsert('emp_salary',$dataEmpSalDed);
			}
			$cnt=$_REQUEST['cnt'];
			for($CR=0;$CR<$cnt;$CR++)
			{
				$leavetype=$s->getField('leavemaster','id',$_REQUEST['leave_type'][$CR],'leavecode');
				if($leavetype=='ML' && $_REQUEST['sex']=='M'){ continue; }
			    else{				
				$dataLeave['emp_id']=$Lastemp_id;
				$dataLeave['leave_id']=$_REQUEST['leave_type'][$CR];
				$dataLeave['leave_days']=$_REQUEST['leave_days'][$CR];
				$s->RecordInsert('emp_leave',$dataLeave);}

				/*$dataLeave['emp_id']=$Lastemp_id;
				$dataLeave['leave_type']=$_REQUEST['leave_type'][$CR];
				$dataLeave['leave_days']=$_REQUEST['leave_days'][$CR];
				$s->RecordInsert('emp_leave',$dataLeave);*/
			}	
		}
$s->pageLocation("index.php?route=employee_list".$rurl);		
}
?>
<script language="javascript" type="text/javascript" src="js/datetimepicker.js"></script>
<link rel="stylesheet" href="css/new_mxerp.css">
<script type="text/javascript" src="js/function-ajax.js"></script>
<script>
function check_empcode(str)
{
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	  {
	  	var sha = xmlhttp.responseText;
		if(sha != "")
		{
		document.getElementById("empcode_exists").innerHTML=xmlhttp.responseText;
		document.getElementById("emp_code").innerHTML.value="";
		}
	  }
  }
	xmlhttp.open("GET","ajax_getempcode.php?empcode="+str,true);
	xmlhttp.send();	
}		





function cal_esi(str1)
{
	var gross_sal = str1;
	if(gross_sal>=0 && gross_sal<=15000)
	{
		var net_esi = ((4.75*(str1))/100);
		document.getElementById("esimployervalue").value=Math.round(net_esi);
		document.getElementById("ESIemployer").value="4.75";
		document.getElementById("esimployervalue").removeAttribute("readonly"); 
		document.getElementById("ESIemployer").removeAttribute("readonly"); 		
	}
	else
	{
		document.getElementById("esimployervalue").value="0";
		document.getElementById("ESIemployer").value="0";
		document.getElementById("esimployervalue").setAttribute("readonly",true);
		document.getElementById("ESIemployer").setAttribute("readonly",true);
	}
}
function calculate_esi(esi_percentage)
{
	var gross_sal = document.getElementById("allow_tot").value;
	var net_esi = ((esi_percentage*gross_sal)/100);
	document.getElementById("esimployervalue").value=Math.round(net_esi);	
}
function chkbachlor(id){
 			if(id!='')
			{			document.getElementById("other_bachelor").value='';		
			} 
		
	}
	function chkmaster(id){
 			if(id!='')
			{			document.getElementById("other_master").value='';		
			} 
		
	}
	function chkother_master(id){
		  
		if(id!='')
		{
			document.getElementById("masterMA").checked=false
			document.getElementById("masterMSC").checked=false
			document.getElementById("masterMCOM").checked=false
			document.getElementById("masterMBA").checked=false
			document.getElementById("masterME").checked=false
			 
		}else{
			document.getElementById("masterMA").checked=true
			document.getElementById("masterMSC").checked=true
			document.getElementById("masterMCOM").checked=true
			document.getElementById("masterMBA").checked=true
			document.getElementById("masterME").checked=true			 
		}
	}
	function chkother_bachelor(id){
		  
		if(id!='')
		{
			document.getElementById("bachelorBA").checked=false
			document.getElementById("bachelorBSC").checked=false
			document.getElementById("bachelorBCOM").checked=false
			document.getElementById("bachelorBBA").checked=false
			document.getElementById("bachelorLLB").checked=false
			document.getElementById("bachelorBE").checked=false
			 //document.getElementById("other_bachelor").value=id;
		}else{
			document.getElementById("bachelorBA").checked=true
			document.getElementById("bachelorBSC").checked=true
			document.getElementById("bachelorBCOM").checked=true
			document.getElementById("bachelorBBA").checked=true
			document.getElementById("bachelorLLB").checked=true
			document.getElementById("bachelorBE").checked=true			 
		}
	}	
	
</script>

<style type="text/css">

.tab a{
color: #fff;
text-decoration: none;
font-weight: bold; display: block;
background-color:#676767;
padding:5px 10px;
border:#373737 solid 1px; border-top-left-radius: 5px;
    border-top-right-radius: 5px;	
}
.tab a:hover{
color: #171717;
text-decoration: none;
background-color:#fff;
}

#wrapper{
width:100%;
margin:auto;
padding:0 10px;
box-sizing:border-box;
}
.box{
background: #fff;

}
.boxholder{
clear: both;
padding:0px;
padding-bottom:15px;

}
.tab{
float: left;
height: auto;
width: auto;
margin: 0 1px 1px 0;
text-align: center;
/*background: #8DC70A url(images/greentab.jpg) no-repeat;*/
}
.tabtxt{
margin: 0;
color: #fff;
font-size: 12px;
font-weight: bold;
padding: 0px 0 0 0;

}


/****************** Start page styles ********************************************/



#wrap {
	max-width: 600px;
	margin: 30px auto;
	background: #fff;
	border: 4px solid #FFD16F;
	-moz-border-radius: 15px;
	-webkit-border-radius: 15px;
	border-radius: 15px;
	padding: 20px;
    }

.field { 
	padding: 0 0 0;
	width:100%; text-align:center;
	}
.current{color:#FF0000;}

/****************** End page styles ********************************************/
</style>

<link type="text/css" media="screen" rel="stylesheet" href="css/file-upload.css">
<script type="text/javascript" src="js/prototype.lite.js"></script>
<script type="text/javascript" src="js/moo.fx.js"></script>
<script type="text/javascript" src="js/moo.fx.pack.js"></script>
<script type="text/javascript" src="js/min.js"></script>
<script type="text/javascript" src="js/file-upload.js"></script>
<script type="text/javascript">
function init(){
	var stretchers = document.getElementsByClassName('box');
	var toggles = document.getElementsByClassName('tab');
	var myAccordion = new fx.Accordion(
		toggles, stretchers, {opacity: false, height: true, duration: 600}
	);
	//hash functions
	var found = false;
	toggles.each(function(h4, i){
		var div = Element.find(h4, 'nextSibling');
			if (window.location.href.indexOf(h4.title) > 0) {
				myAccordion.showThisHideOpen(div);
				found = true;
			}
		});
		if (!found) myAccordion.showThisHideOpen(stretchers[0]);
}
</script>

<script language="javascript" type="text/javascript">

//*****************FUNCTION FOR ALLOWNCES**********************************************************************




function check_yn(str)
{
	if(str=='NO')
	{
		document.getElementById("adv_amount").disabled=true;
		document.getElementById("adv_date").disabled=true;
	}
	else
	{
		document.getElementById("adv_amount").disabled=false;
		document.getElementById("adv_date").disabled=false;
	}
}
function check_marriage(str)
{
   if(str=='Single')
   {
   		document.getElementById("marriage").disabled=true;
		document.getElementById("wh_name").disabled=true;
		document.getElementById("sons").disabled=true;
		document.getElementById("daughters").disabled=true;
   }
   else if(str=='Married' || str=='000')
   {
   		document.getElementById("marriage").disabled=false;
		document.getElementById("wh_name").disabled=false;
		document.getElementById("sons").disabled=false;
		document.getElementById("daughters").disabled=false;
   }
   
}
function addressInfo(){

	if(document.getElementById("copy_add").checked==true)
	{
		document.getElementById('per_add1').value = document.getElementById('pre_add1').value;
		document.getElementById('per_add2').value = document.getElementById('pre_add2').value;
		document.getElementById('per_add3').value = document.getElementById('pre_add3').value;
		document.getElementById('per_city').value = document.getElementById('pre_city').value;
		document.getElementById('per_state').value = document.getElementById('pre_state').value;
		document.getElementById('per_country').value = document.getElementById('pre_country').value;
		document.getElementById('per_state1').value = document.getElementById('pre_state1').value;
		document.getElementById('per_country1').value = document.getElementById('pre_country1').value;
		document.getElementById('per_pincode').value = document.getElementById('pre_pincode').value;
		document.getElementById('per_mobile').value = document.getElementById('pre_mobile').value;
		document.getElementById('per_phone').value = document.getElementById('pre_phone').value;
		document.getElementById('per_alt_phone').value = document.getElementById('pre_alt_phone').value;
		document.getElementById('per_alt_mobile').value = document.getElementById('pre_alt_mobile').value;
		
	}else{
		document.getElementById('per_add1').value = '';
		document.getElementById('per_add2').value = '';
		document.getElementById('per_add3').value = '';
		document.getElementById('per_city').value = '';
		document.getElementById('per_state').value = '';
		document.getElementById('per_country').value = '';
		document.getElementById('per_state1').value = '';
		document.getElementById('per_country1').value = '';
		document.getElementById('per_pincode').value = '';
		document.getElementById('per_mobile').value = '';
		document.getElementById('per_phone').value = '';
		document.getElementById('per_alt_phone').value = '';
	}
}
function find_state(str)
{
	if(str.length==0)
  {
  document.getElementById("state_id").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("state_id").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","emp_state.php?country="+str,true);
xmlhttp.send();
}

function find_city(str)
{
	var cntry=document.getElementById("pre_country").value;
	if (str.length==0)
  {
  document.getElementById("city_id").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("city_id").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","emp_city.php?state="+str+"&country="+cntry,true);
xmlhttp.send();
}



function displaySalary(str)
{
	if(str=='Yes')
	{
		document.getElementById('overtime_salary').disabled=false;
	}
	else if(str=='No')
	{
		document.getElementById('overtime_salary').disabled=true;
	}
	
	
}
function checkMode(str)
{
	if(str=='Cash')
	{
		document.getElementById("bank_name").disabled=true;
		document.getElementById("bank_account").disabled=true;
	}
	else if(str=='Cheque')
	{
		document.getElementById("bank_name").disabled=false;
		document.getElementById("bank_account").disabled=false;
	}
}



function MekeEmpCode(str)
{
	if(str.length=0)
	{
		document.getElementById("emp_name").innerHTML="";
	}
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
 	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
  	{
  	if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("hid-EmployeeID").innerHTML=xmlhttp.responseText;
    }
  	}
	var branch=document.getElementById("emp_site").value;
	xmlhttp.open("GET","MakeEmpCode.php?EMPName="+str+"&branch="+branch,true);
	xmlhttp.send();
}

function GetSatateCountry(str)
{
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
 	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
  	{
  	if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		var data=xmlhttp.responseText.split("__");
    	document.getElementById("pre_state").value=data[0];
		document.getElementById("pre_country").value=data[1];
		document.getElementById("pre_state1").value=data[2];
		document.getElementById("pre_country1").value=data[3];
    }
  	}
	xmlhttp.open("GET","SateCountryName.php?CityId="+str,true);
	xmlhttp.send();
}


function GetSatateCountry1(str)
{
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
  		xmlhttp=new XMLHttpRequest();
 	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
  	{
  	if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		var data=xmlhttp.responseText.split("__");
    	document.getElementById("per_state").value=data[0];
		document.getElementById("per_country").value=data[1];
		document.getElementById("per_state1").value=data[2];
		document.getElementById("per_country1").value=data[3];
    }
  	}
	xmlhttp.open("GET","SateCountryName.php?CityId="+str,true);
	xmlhttp.send();
}



</script>

<script src="js/function-ajax.js" language="javascript"></script>
<script src="empcal.js" language="javascript"></script>
<style>
.cap{text-transform:capitalize;}
</style>

<div class="body_contain">
<div class="tab_div">
<h1>Employee Master</h1>
  
<form method="post" name="empmasterfrm1" action="" enctype="multipart/form-data">
<p align="center">
  <input type="submit" name="Submit" value="Save" class="search" onclick="return validate()"  />
  <input type="button" name="Cancel" value="Cancel" class="search"  onclick="history.go()" /></p>
<div id="wrapper" style="width:100%;">
	<div id="content">
		<div class="tab" title="first"><h4 class="tabtxt"><a href="#">Employee Details</a></h4></div>
		<div class="tab"><h4 class="tabtxt" title="second"><a href="#">Academic Details</a></h4></div>
		<div class="tab"><h4 class="tabtxt" title="third"><a href="#">Address Details</a></h4></div>
		<div class="tab"><h4 class="tabtxt" title="fourth"><a href="#">Bank Details</a></h4></div>
		<div class="tab"><h4 class="tabtxt" title="fifth"><a href="#">Salary Details</a></h4></div>
		<div class="tab"><h4 class="tabtxt" title="sixth"><a href="#">Leave Details</a></h4></div>
		<div class="tab"><h4 class="tabtxt" title="seventh"><a href="#">Uploads</a></h4></div>
<div class="boxholder">
			<!--Employee Detail box-->
			<?php 
			$query=DB_query("select  * from hr_applcnt_rgstn where id='".$_REQUEST['mainid']."'",$db);
			while($row=DB_fetch_array($query))
			{
				extract($row);
				echo $first_name;
			}
			?>
	<div class="box">
	<h3>General Details</h3>
	<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:0;">
	<tr class="row1">
	<td width="80%" valign="top">
	  <table width="100%" border="0" cellpadding="3" cellspacing="0" align="center">
	  <tr>
		<td><strong>Employment Type <font color="#FF0000" size="-1">*</font></strong></td>
		<td><select name="employment_type" id="employment_type" style="width:98%;">
			<option value="Permanent"<?php echo($employment_type=='Permanent'?'selected':'')?>>Permanent</option>
			<option value="Temporary"<?php echo($employment_type=='Temporary'?'selected':'')?>>Temporary</option>
		  </select>
		</td>
	   <td><strong>Employee Code</strong></td>
	   <td>
	  <div id="hid-EmployeeID">
	   <input type="text" name="emp_code" id="emp_code"  value="" style="width:98%;" onblur="check_empcode(this.value);"/><span id="empcode_exists" style="color:red;"></span></div></td>
		<td><strong>Employee Name <font color="#FF0000" size="-1">*</font></strong></td>
		<td><input type="text" name="emp_name" id="emp_name" class="cap" value="" style="width:98%;"/></td>
		</tr>
		<tr>
		  <td><strong>Nationality<font color="#FF0000" size="-1">*</font></strong></td>
		  <td><input type="text" name="nationality" id="nationality" style="width:98%;" /></td>
		<td><strong>Religion <font color="#FF0000" size="-1">*</font></strong></td>
		<td><input type="text" name="religion" id="religion" style="width:98%;" /></td>		
		<td><strong>Date of Birth <font color="#FF0000" size="-1">*</font></strong></td>
		<td>

 <link rel="stylesheet" href="js/jquery-ui.css">
<script src="js/jquery-1.10.2.js"></script>
<script src="js/jquery-ui.js"></script>
 <script>
 var jss=$.noConflict();
jss(function() {
jss( "#dob" ).datepicker({ dateFormat: 'dd/mm/yy',changeMonth: true,
            changeYear: true,
    yearRange: "1910:2055" });
jss( "#doj" ).datepicker({ dateFormat: 'dd/mm/yy',changeMonth: true,
            changeYear: true,
    yearRange: "1910:2055" });
jss( "#dol" ).datepicker({ dateFormat: 'dd/mm/yy',changeMonth: true,
            changeYear: true,
    yearRange: "1910:2055" });
jss( "#marriage" ).datepicker({ dateFormat: 'dd/mm/yy',changeMonth: true,
            changeYear: true,
    yearRange: "1910:2055" });

jss( "#leave_eff_date" ).datepicker({ dateFormat: 'dd/mm/yy',changeMonth: true,
            changeYear: true,
    yearRange: "1910:2055" });



});
</script>
			
		<input name="dob" type="text" id="dob" class="datepicker"  style="width:98%;"  value="<?php if(isset($dob)){echo $dob;} else {echo date('d/m/Y');}?>">

		<!--onClick="javascript:NewCal(this.id,'ddmmyyyy')"-->	</td>
		</tr>
		<tr>
		  <td><strong>Gender <font color="#FF0000" size="-1">*</font></strong></td>
		  <td>
		  <input type="radio" name="sex" id="sex"  value="M" />Male
		  <input type="radio" name="sex" id="sex1" value="F" />Female
		</td>
		<td><strong>Blood Group <font color="#FF0000" size="-1">*</font></strong></td>
		<td><select name="bloodgroup" id="bloodgroup" style="width:98%;">
			<option value="A">A</option>
			<option value="A+">A+</option>
			<option value="B">B</option>
			<option value="B+">B+</option>
			<option value="AB">AB</option>
			<option value="AB+">AB+</option>
			<option value="O">O</option>
			<option value="O+">O+</option>
		</select></td>
		<td><strong>Date of Joining <font color="#FF0000" size="-1">*</font></strong></td>
		<td><input name="doj" type="text" id="doj" style="width:98%;"  value="<?php if(isset($doj)){echo $doj;} else {echo date('d/m/Y');}?>" >
<!--onClick="javascript:NewCal(this.id,'ddmmyyyy')"-->
		</td>
		</tr>
	<tr>
	  <td><strong>Marital Status <font color="#FF0000" size="-1">*</font></strong></td>
	  <td><select name="marital_status" id="marital_status" onchange="check_marriage(this.value)" style="width:98%;">
		<option value="000">---Select---</option>
		<option value="Single"<?php echo ($marital_status=='Single'?'selected':'');?>>Single</option>
		<option value="Married"<?php echo ($marital_status=='Married'?'selected':'');?>>Married</option>
	  </select></td>
	<?php 
	if($marital_status=='Single')
	{
		$r="disabled";
	}
	else{$r='';}
	?>	
	  <td><strong>Wife's / Husband's <font color="#FF0000" size="-1">*</font></strong></td>
	  <td><input type="text" name="wh_name" id="wh_name" style="width:98%;" value="<?php if($wh_name==''){echo "N/A";}else echo $wh_name;?>" <?php echo $r;?>/></td>
	  <td><strong>Marriage Anniversary<font color="#FF0000" size="-1">*</font></strong></td>
	  <td><input type="text"  name="marriage" id="marriage" style="width:98%;" value="<?php if(isset($marriage)){if($marriage=='00/00/0000'){echo "N/A";}else echo $marriage;} else {echo date('d/m/Y');}?>" <?php echo $r;?> tabindex="18"/>
<!--onClick="javascript:NewCal(this.id,'ddmmyyyy')"-->
	  </td>
	</tr>	
	<tr>
	  <td><strong>Number Of Children</strong></td>
	  <td><input type="text" name="sons" id="sons" style="width:48%; float:left; margin-right:3px;" placeholder="Son" value="<?php if($sons=='0'){echo "Sons - N/A";}else echo $sons;?>" <?php echo $r;?> />
		  <input type="text" name="daughters" id="daughters" style="width:48%; float:left;" placeholder="Daughter" value="<?php if($daughters=='0'){echo "Daughters - N/A";}else echo $daughters;?>" <?php echo $r;?> /></td>
		  <td><strong>Father's Name<font color="#FF0000" size="-1">*</font></strong></td>
		  <td><input type="text" name="fh_name" id="fh_name"  style="width:98%;" /></td>
		<td><strong>Date of leaving</strong></td>
		<td><input name="dol" id="dol" type="text" style="width:98%;" value="<?php if(isset($dol)){echo $dol;} else {echo "";}?>">
			<!-- onClick="javascript:NewCal(this.id,'ddmmyyyy')"-->
		</td>
	</tr>
	  <tr>
	  <td width="13%"><strong>Branch <font color="#FF0000" size="-1">*</font></strong></td>
	  <td width="20%"><select name="emp_site" id="emp_site" style="width:98%;" onchange="ShowDiv(this.value,'hid-staffdiv','Empshift.php');">
	  <option value="000">---Select---</option>
	  <?php 
		$site_sql=DB_query("Select loccode, locationname from locations  where CompanyId='".$_SESSION['ACGCompanyId']."' and loccode in('".$_SESSION['AssignedBranch']."')",$db);
		while($site_row=DB_fetch_array($site_sql))
		{
		?>
	   <option value="<?php echo $site_row['loccode'];?>"<?php echo ($emp_site==$site_row['loccode']?'selected':'')?>><?php echo $site_row['locationname'];?></option>
			<?php } ?>
		  </select></td>
		<td width="13%"><strong>Department <font color="#FF0000" size="-1">*</font></strong></td>	
		<td width="20%"><select name="department" id="department" style="width:98%;" onchange="ShowDiv(this.value,'hid-desig','disp_designation.php')">
		<option value="000">---Select---</option>
		<?php $qdepart=DB_query("select id, deptcode,deptname from deptmaster order by deptname ASC",$db); 
				while($rsdepart=DB_fetch_array($qdepart)){
		 ?>
		<option value="<?php echo $rsdepart['id'];?>"<?php echo($department==$rsdepart['id']?'selected':'')?>><?php echo $rsdepart['deptname'];?></option>
		<?php }?>
		</select></td>
		<td width="13%"><strong>Designation <font color="#FF0000" size="-1">*</font></strong></td>
		<td><div id='hid-desig'><select name="designation" id="designation" style="width:98%;"> 
		<option value="000">---Select---</option>
		<?php $qdesig=DB_query("select id ,desigcode,designame from desigmaster order by designame ASC",$db);
			while ($rsdesig=DB_fetch_array($qdesig)){
		?>
		<option value="<?php echo $rsdesig['id'];?>" <?php echo ($designation==$rsdesig['id']?'selected':'')?>><?php echo $rsdesig['designame'];?></option>
		<?php }?>
		</select></div></td>
		</tr>

	<tr>
	  <td rowspan="2"><strong>Weekly Off <font color="#FF0000" size="-1">*</font></strong></td>
	  <td rowspan="2">
	  <?php 		
	   $arr=array(1=>'Mon','Tue','Wed','Thu','Fri','Sat','Sun');?>
	  <select name="emp_weekly_off[]" id="emp_weekly_off" style="width:98%; hight:90px;" multiple >
	  <?php
	   for($i=1;$i<=count($arr);$i++){
	   $p='';
	   if($i==$emp_weekly_off)
	   $p='selected';
	   ?>
	   <option value="<?php echo $i?>"<?php echo $p?> ><?php echo $arr[$i];?></option>   
	   <?php }
	   ?>
	  </select></td>
		  <td><strong>Grade</strong></td>
		  <td><select name="grade" id="grade" style="width:98%;">
			  <?php $grade_sql=DB_query("Select * from emp_grade",$db);
		while($grade_result=DB_fetch_array($grade_sql))
		{
		?>
			  <option value="<?php echo $grade_result['id'];?>"<?php echo ($grade==$grade_result['id']?'selected':'');?>><?php echo $grade_result['grade_name'];?></option>
			  <?php } ?>
		  </select></td>
		  <td><strong>PAN CARD NUMBER </strong></td>
		  <td><input type="text" name="pan_no" id="pan_no" style="width:98%;" value="" <?php echo $r;?> /></td>
		</tr>
	  <!--<tr>
		<td><strong>Employee Shift <font color="#FF0000" size="-1">*</font></strong></td>
		<td><div id='hid-staffdiv'>
		 <select name="emp_shift" id="emp_shift" style="width:98%;">	 
		<?php 
		if($emp_site!='')
		$emp_shift_sql=DB_query("Select * from shift_master where site='".$emp_site."'",$db);
		while($emp_shift_row=DB_fetch_array($emp_shift_sql))
		{	 
		?>
		<option value="<?php echo $emp_shift_row['id'];?>"<?php echo ($emp_shift==$emp_shift_row['id']?'selected':'')?>><?php echo $emp_shift_row['shift_for'].'('.$emp_shift_row['shift_category'].')-'.$emp_shift_row['shift_start'].$emp_shift_row['start_AMPM'].' to '.$emp_shift_row['shift_end'].$emp_shift_row['end_AMPM']; ?></option>
		<?php } ?>
		</select></div>
		</td>
	  </tr>-->
		<tr>
		  <td><strong>Email Id (Personal) </strong></td>
		  <td><input type="text" name="personalEmail" id="personalEmail" style="width:98%;" value="<?php echo $personalEmail;?>" /></td>
		  <td><strong>Email Id (Official) </strong></td>
		  <td><input type="text" name="offEmail" id="offEmail" style="width:98%;" value="<?php echo $offEmail;?>" /></td>
		</tr>
	<tr>
		  <td><strong>Support Staff</strong></td>
		  <td><input type="checkbox" name="multi_site_att" value="1" /></td>
		  <td><strong>Employee Shift</strong></td>
		  <td><div id='hid-staffdiv'>
		 <select name="emp_shift" id="emp_shift" style="width:98%;">	 
		<?php 
		if($emp_site!='')
		$emp_shift_sql=DB_query("Select * from shift_master where site='".$emp_site."'",$db);
		while($emp_shift_row=DB_fetch_array($emp_shift_sql))
		{	 
		?>
		<option value="<?php echo $emp_shift_row['id'];?>"<?php echo ($emp_shift==$emp_shift_row['id']?'selected':'')?>>
		<?php echo $emp_shift_row['shift_for'].'('.$emp_shift_row['shift_category'].')-'.$emp_shift_row['shift_start'].$emp_shift_row['start_AMPM'].' to '.$emp_shift_row['shift_end'].$emp_shift_row['end_AMPM']; ?></option>
		<?php } ?>
		</select></div>
		</td>
		<td colspan="2"></td>
		</tr>
	</table>
	</td>
	<td valign="top" width="10%">
	<table width="100%" border="0" cellpadding="3" cellspacing="0" style="border:0;">	
			<tr>
			<td style="text-align:center;"><img src="uploaded_images/default.png" width="auto" height="140" id="image1" /></td>
			</tr>
			<tr>
			<td>
			<div class="field">
			<label class="file-upload">
				<span><strong>Upload Image</strong></span>
				<input type="file" style="width:98%;" name="photo" id="photo" onchange="imageURL(this,'image1')" />
			</label>
		</div>
			<input type="hidden" name="image_name" value="<?php echo $uploadimage;?>" /></td>
			</tr>
	</table>
	</td>
	</tr>
	</table>
	</div>
<!--end of Employee Detail box-->

<!--Academic box-->
	<div class="box">
	<h3>Academic Details</h3>
	<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
		<td width="13%"><strong>10th Standard <font color="#FF0000" size="-1">*</font></strong></td>
		<td width="20%"><input type="checkbox" name="tenth_standard" id="tenth_standard" value="true"  /></td>
		<td width="13%"><strong>10+2 Standard <font color="#FF0000" size="-1">*</font></strong></td>
		<td width="20%"><input type="checkbox" name="tenthplus2_standard" id="tenthplus2_standard" value="true" /></td>
		<td colspan="2"></td>
	</tr>
	<tr class="row1">
	   <td><strong>Basic/Graduation <font color="#FF0000" size="-1">*</font></strong></td>
	   <td>
	   <select name="bachelor" id="bachelor" tabindex="30" style="width:98%;">
			<option value="">Select</option>
		<option value="Not Pursuing Graduation"<?php if($bachelor=="Not Pursuing Graduation"){ ?> selected="selected"; <?php }?>>Not Pursuing Graduation</option>
		  <option value="B.A"<?php if($bachelor=="B.A"){ ?> selected="selected"; <?php }?>>B.A</option>
		  <option value="B.Arch"<?php if($bachelor=="B.Arch"){ ?> selected="selected"; <?php }?>>B.Arch</option>
		  <option value="BCA"<?php if($bachelor=="BCA"){ ?> selected="selected"; <?php }?>>BCA</option>
		  <option value="B.B.A"<?php if($bachelor=="B.B.A"){ ?> selected="selected"; <?php }?>>B.B.A</option>
		  <option value="B.Com"<?php if($bachelor=="B.Com"){ ?> selected="selected"; <?php }?>>B.Com</option>
		  <option value="B.Ed"<?php if($bachelor=="B.Ed"){ ?> selected="selected"; <?php }?>>B.Ed</option>
		  <option value="BDS"<?php if($bachelor=="BDS"){ ?> selected="selected"; <?php }?>>BDS</option>
		  <option value="BHM"<?php if($bachelor=="BHM"){ ?> selected="selected"; <?php }?>>BHM</option>
		  <option value="B.Pharma"<?php if($bachelorr=="B.Pharma"){ ?> selected="selected"; <?php }?>>B.Pharma</option>
		  <option value="B.Sc"<?php if($bachelor=="B.Sc"){ ?> selected="selected"; <?php }?>>B.Sc</option>
		  <option value="B.Tech/B.E"<?php if($bachelor=="B.Tech/B.E"){ ?> selected="selected"; <?php }?>>B.Tech/B.E.</option>
		  <option value="LLB"<?php if($bachelor=="LLB"){ ?> selected="selected"; <?php }?>>LLB</option>
		  <option value="MBBS"<?php if($bachelor=="MBBS"){ ?> selected="selected"; <?php }?>>MBBS</option>
		  <option value="Diploma"<?php if($bachelor=="Diploma"){ ?> selected="selected"; <?php }?>>Diploma</option>
		  <option value="BVSC"<?php if($bachelor=="BVSC"){ ?> selected="selected"; <?php }?>>BVSC</option>
		<option value="Other" <?php if($bachelor=="Other"){ ?> selected="selected"; <?php }?>>Other</option>      	
		  </select>
	   </td>
	   <td><strong>College Name</strong></td> 
	   <td><input type="text" name="bac_college_name" id="college_name" style="width:98%;" ></td>
       <td><strong>Year Of Passing</strong></td> 
	   <td><input type="text" name="bac_year_passing" id="bac_year_passing" style="width:98%;" ></td>
	   </tr>
       <tr class="row1">
		<td><strong>Post Graduation</strong></td> 
		<td>
		<select id="pgcourse" name="pgcourse" tabindex="31" style="width:98%;">
	<option value="">Select</option>
	<option value="CA" <?php if($master=="CA"){ ?> selected="selected"; <?php }?> >CA</option>
	<option value="CS" <?php if($master=="CS"){ ?> selected="selected"; <?php }?>>CS</option>
	<option value="ICWA" <?php if($master=="ICWA"){ ?> selected="selected"; <?php }?>>ICWA</option>
	<option value="Integrated PG" <?php if($master=="Integrated PG"){ ?> selected="selected"; <?php }?>>Integrated PG</option>
	<option value="LLM" <?php if($master=="LLM"){ ?> selected="selected"; <?php }?>>LLM</option>
	<option value="M.A" <?php if($master=="M.A"){ ?> selected="selected"; <?php }?>>M.A</option>
	<option value="M.Arch" <?php if($master=="M.Arch"){ ?> selected="selected"; <?php }?>>M.Arch</option>
	<option value="M.Com" <?php if($master=="M.Com"){ ?> selected="selected"; <?php }?>>M.Com</option>
	<option value="M.Ed" <?php if($master=="M.Ed"){ ?> selected="selected"; <?php }?>>M.Ed</option>
	<option value="M.Pharma" <?php if($master=="M.Pharma"){ ?> selected="selected"; <?php }?>>M.Pharma</option>
	<option value="M.Sc" <?php if($master=="M.Sc"){ ?> selected="selected"; <?php }?>>M.Sc</option>
	<option value="M.Tech" <?php if($master=="M.Tech"){ ?> selected="selected"; <?php }?>>M.Tech</option>
	<option value="MBA/PGDM" <?php if($master=="MBA/PGDM"){ ?> selected="selected"; <?php }?>>MBA/PGDM</option>
	<option value="MCA" <?php if($master=="MCA"){ ?> selected="selected"; <?php }?>>MCA</option>
	<option value="MS" <?php if($master=="MS"){ ?> selected="selected"; <?php }?>>MS</option>
	<option value="PG Diploma" <?php if($master=="PG Diploma"){ ?> selected="selected"; <?php }?>>PG Diploma</option>
	<option value="MVSC" <?php if($master=="MVSC"){ ?> selected="selected"; <?php }?>>MVSC</option>
	<option value="MCM" <?php if($master=="MCM"){ ?> selected="selected"; <?php }?>>MCM</option>
	<option value="Other" <?php if($master=="Other"){ ?> selected="selected"; <?php }?>>Other</option>
	</select>
		</td>
		 <td><strong>College Name</strong></td> 
	   <td><input type="text" name="pg_college_name" id="pg_college_name" style="width:98%;" ></td>
       <td><strong>Year Of Passing</strong></td> 
	   <td><input type="text" name="pg_year_passing" id="pg_year_passing" style="width:98%;" ></td>
	</tr>
	<tr class="row1">
		<td width="13%"><strong>Doctorate/Phd.</strong></td>
		<td>
		<select id="othercourse" name="othercourse" tabindex="32" style="width:98%;">
			<option value="">Select</option>
			<option value="Ph.D/Doctorate"<?php if($other_master=="Ph.D/Doctorate"){ ?>selected="selected"; <?php }?>>Ph.D/Doctorate</option>
			<option value="MPHIL"<?php if($other_master=="MPHIL"){ ?>selected="selected"; <?php }?>>MPHIL</option>
			<option value="Other"<?php if($other_master=="Other"){ ?>selected="selected"; <?php }?>>Other</option>
		</select>
		</td>
		 <td><strong>College Name</strong></td> 
	   <td><input type="text" name="other_college_name" id="other_college_name" style="width:98%;" ></td>
       <td><strong>Year Of Passing</strong></td> 
	   <td><input type="text" name="other_year_passing" id="other_year_passing" style="width:98%;" ></td>
	</tr>
	<tr class="row1">
		<td><strong>Certification Course 1</strong></td>
		<td><input type="text" name="course1" id="course1" value="<?php echo $course1; ?>" style="width:98%;" /></td>
		<td><strong>Certification Course 2</strong></td>
		<td><input type="text" name="course2" id="course2" value="<?php echo $course2; ?>"  style="width:98%;" /></td>
		<td><strong>Certification Course 3</strong></td>
		<td><input type="text" name="course3" id="course3" value="<?php echo $course3; ?>" style="width:98%;" /></td>
	</tr>  
	  
	</table>
	</div>
			<!--end of Academic box-->
			
			<!--Address box-->
	<div class="box">
	<h3>Address Details</h3>
	<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr>
		<td width="50%" valign="top">
		<h3><strong>Present Address</strong></h3>
			<table width="100%" border="0" cellpadding="3" cellspacing="0">
				<tr class="row1">
					  <td width="20%" rowspan="3"><strong>Address <font color="#FF0000" size="-1">*</font></strong></td>
					  <td><input name="pre_address1" type="text" id="pre_add1" style="width:98%;"/></td>
				</tr>
				<tr class="row1">
					<td><input name="pre_address2" type="text" id="pre_add2" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><input name="pre_address3" type="text" id="pre_add3" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><strong>City <font color="#FF0000" size="-1">*</font></strong></td>
					 <td>
						<select name="pre_city" id="pre_city" style="width:98%;" onchange="GetSatateCountry(this.value)">
						  <option value="">Select</option>
						  <?php 
						  $city_sql=DB_query("select * from city_master order by city ASC",$db);
						  while($city_row=DB_fetch_array($city_sql)) { ?>
						  <option value="<?php echo $city_row['id'];?>"><?php echo $city_row['city'];?></option>
						  <?php } ?>
						</select>
					 </td>
				</tr>
				<tr class="row1">
					<td><strong>State <font color="#FF0000" size="-1">*</font></strong></td>
					<td><input type="hidden" name="pre_state" id="pre_state" style="width:150px;" />
					<input type="text" name="pre_state1" id="pre_state1" style="width:98%;" />
					</td>
				</tr>
				<tr class="row1">
					<td><strong>Country <font color="#FF0000" size="-1">*</font></strong></td>
					 <td><input type="hidden" name="pre_country" id="pre_country" style="width:150px;" />
					 <input type="text" name="pre_country1" id="pre_country1" style="width:98%;" />
					 </td>
				</tr>
				<tr class="row1">
					<td><strong>Pin Code <font color="#FF0000" size="-1">*</font></strong></td>
					<td><input name="pre_pincode" type="text" id="pre_pincode" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><strong>Mobile <font color="#FF0000" size="-1">*</font></strong></td>
					<td><input name="pre_mobile" type="text" id="pre_mobile" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					 <td><strong>Phone </strong></td>
					<td><input name="pre_phone" type="text" id="pre_phone" style="width:98%;" /></td>
				</tr>
			</table>	
		</td>
		<td valign="top">
		<h3>
	  <strong><input type="checkbox" name="copy_add" id="copy_add" onclick="addressInfo();" /> Check Permanent Address if same as Present Address </strong></h3>
			<table width="100%" border="0" cellpadding="3" cellspacing="0">
				<tr class="row1">
					  <td width="20%" rowspan="3"><strong>Address <font color="#FF0000" size="-1">*</font></strong></td>
					  <td><input name="per_address1" type="text" id="per_add1" style="width:98%;"/></td>
				</tr>
				<tr class="row1">
					<td><input name="per_address2" type="text" id="per_add2" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><input name="per_address3" type="text" id="per_add3" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><strong>City <font color="#FF0000" size="-1">*</font></strong></td>
					  <td>
						<select name="per_city" id="per_city" style="width:98%;" onchange="GetSatateCountry1(this.value)">
						  <option value="">Select</option>
						  <?php 
						  $city_sql=DB_query("select * from city_master order by city ASC",$db);
						  while($city_row=DB_fetch_array($city_sql)) { ?>
						  <option value="<?php echo $city_row['id'];?>"><?php echo $city_row['city'];?></option>
						  <?php } ?>
						</select>
					 </td>
				</tr>
				<tr class="row1">
					<td><strong>State <font color="#FF0000" size="-1">*</font></strong></td>
					<td><input type="hidden" name="per_state" id="per_state" style="width:150px;" />
					<input type="text" name="per_state1" id="per_state1" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><strong>Country <font color="#FF0000" size="-1">*</font></strong></td>
					 <td><input type="hidden" name="per_country" id="per_country" style="width:150px;" />
					 <input type="text" name="per_country1" id="per_country1" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><strong>Pin Code <font color="#FF0000" size="-1">*</font></strong></td>
					<td><input name="per_pincode" type="text" id="per_pincode" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					<td><strong>Mobile <font color="#FF0000" size="-1">*</font></strong></td>
					<td><input name="per_mobile" type="text" id="per_mobile" style="width:98%;" /></td>
				</tr>
				<tr class="row1">
					 <td><strong>Phone </strong></td>
					<td><input name="per_phone" type="text" id="per_phone" style="width:98%;" /></td>
				</tr>
			</table>
		</td>
	</tr>
	</table>
	</div>
			<!--end of Address box-->
			
			
	<div class="box">
	<h3>Bank Details</h3>
	<table width="100%" cellpadding="3" cellspacing="0">
	<tr class="row1">
		<td width="13%"><strong>Payment Mode <font color="#FF0000" size="-1">*</font></strong></td>
		<td width="20%">
		<select name="payment_mode"id="payment_mode" onchange="checkMode(this.value)" style="width:98%;">
		<option value="Cheque">Cheque</option>
		<option value="Cash">Cash</option>
		</select>
		</td>
		<td width="13%"><strong>Bank Name</strong></td>
		<td width="20%">
        <select name="bank_name" id="bank_name" style="width:98%;">
        <option value="">---Select---</option>
	   <?php $actid=$s->GetFieldValue("accountgroupmaster","GroupName like '%Bank Account%'","GroupId");
	$sql=DB_query("select * from accountledger where UnderGroup='".$actid."'",$db);
	while($row_bk=DB_fetch_array($sql)){
		?>
			  <option value="<?php echo $row_bk['AccountsID'];?>"><?php echo $row_bk['AccountName'];?></option>
			  <?php } ?>
		  </select></td>
		<td width="13%"><strong>Bank A/C No.</strong></td>
		<td><input type="text" name="bank_account" id="bank_account" style="width:98%;"  /></td>
		</tr>
		<tr class="row1">
		<td><strong>PF No.</strong></td>
		<td><input type="text" name="PFno" id="PFno" style="width:98%;"/></td>
		<td><strong>ESI No.</strong></td>
		<td><input type="text" name="ESIno" id="ESIno" style="width:98%;" /></td>
		<td colspan="2"></td>
	</tr>
	<tr class="row1">
		<td><strong>Loan Ledger Mapping</strong></td>
		<td><select name="loan_mapping" style="width:98%;">
			<?php
		  $dr_sql=DB_query("SELECT AccountsID,AccountName FROM accountledger WHERE CompanyId='".$_SESSION['ACGCompanyId']."' and ledgertype='loan'
		  ",$db);?>
  <option value="0">-- Select --</option>
  <?php while($dr_row=DB_fetch_array($dr_sql)){?>
  <option value="<?php echo $dr_row['AccountsID'];?>"<?php echo ($_REQUEST['loan_mapping']==$dr_row['AccountsID']?'selected':'')?>><?php echo $dr_row['AccountName'];?></option>
  <?php } ?></select></td>
		<td><strong>Advance Ledger Mapping</strong></td>
		<td><select name="advance_mapping" style="width:98%;">
			<?php
		  $dr_sql1=DB_query("SELECT AccountsID,AccountName FROM accountledger WHERE CompanyId='".$_SESSION['ACGCompanyId']."' and ledgertype='Adv'
		  ",$db);?>
  <option value="0">-- Select --</option>
  <?php while($dr_row1=DB_fetch_array($dr_sql1)){?>
  <option value="<?php echo $dr_row1['AccountsID'];?>"<?php echo ($_REQUEST['advance_mapping']==$dr_row1['AccountsID']?'selected':'')?>><?php echo $dr_row1['AccountName'];?></option>
  <?php } ?>
		   </select></td>
		<td colspan="2"></td>
	</tr>
	</table>
	</div>		
			
			
			<!--Salary box onkeyup="calculate_gross(this)"-->
	<div class="box">
	<h3>Salary Details</h3>
	<table width="100%" border="0" cellpadding="3" cellspacing="0">
	 <tr class="row1">
		<td width="50%" valign="top">
		<h3><strong>Allowances Part (A)</strong></h3>
		<input type="hidden" name="prefix1" id="prefix1" value="A" />
		<table width="100%" border="0" cellpadding="3" cellspacing="0" id="tableDataProduction">
		   <tr class="row1">
			<td width="24%"><strong>Description</strong></td>
			<td width="38%" style="text-align:center;"><strong></strong></td>
			<td style="text-align:center;"><strong>Value</strong></td>
		  </tr>
		  <tr class="row1">
		  <td><strong>BASIC</strong></td>
		  <td></td>
		  <td><input type="text" name="basic_salary" id="basic_salary" value="<?php echo trim($basic_salary);?>" size="10" onkeyup="calculate_basic(this)" class="number" tabindex="3" style="width:98%;" /></td>
		  </tr>
		  <?php
		  $all_sql=DB_query("Select * from allowmaster",$db); 
		  $i=1;
		 	 while($all_row=DB_fetch_array($all_sql))
		  	 {		  		
		     ?>
		  <tr class="row1">
			<td><strong><?php echo $all_row['allowname'];?></strong>
			  <input type="hidden" name="allow_code[<?php echo $i;?>]" id="allow_code_<?php echo $i;?>" value="<?php echo $all_row['allowcode'];?>" />
			  <input type="hidden" name="allid[<?php echo $i;?>]" id="allid_<?php echo $i;?>" value="<?php echo $all_row['id'];?>"  />
			  </td>
			<td></td>
			<td><input name="allow[<?php echo $i;?>]" type="text" id="allow_<?php echo $i;?>" value="<?php echo $conval;?>" size="10" class="number" tabindex="<?php echo $j1=(2+(2*$i));?>" onkeyup="cal_allvalue(this,<?php echo $i;?>);" style="width:98%;" abc="areaSum"  /></td>
			<!--onfocus="reversecal_allvalue(this.value,<?php //echo $i; ?>)" -->
		  </tr>
		  <?php $i++;} ?>
		  <input type="hidden" name="ctr" id="ctr" value="<?php echo $i;?>" />
		 <tr class="row1">
		 <td><strong>Special Allowance</strong></td>
		 <td></td>
		  <td><input type="text" name="special_allow" id="special_allow" value="<?php if(isset($special_allow)){echo $special_allow;}else{ echo '0';} ?>" class="number" size="10"  tabindex="<?php echo $cj=($j1+2);?>" style="width:98%;" /></td>
		 </tr>
		  <tr class="row1">
		 <td><strong>Gross Salary<font color="#FF0000" size="-1">*</font></strong></th>
		  <td><input name="allow_tot" type="text"  id="allow_tot" value="<?php echo $allow_tot;?>" tabindex="<?php echo ($cj+1); ?>"  readonly="true" style="width:98%;" onblur="data_str(this.value);" /></td>	
		 <td><input name="allow_tot_yearly" type="text"  id="allow_tot_yearly" readonly tabindex="<?php echo ($cj+1); ?>"  readonly="true" style="width:98%;"/></td>		
		 </tr>
		 <tr class="row1">
		 <td colspan="3"><h3><strong>Allowances Part (B)</strong></h3></td>
		 </tr>
		 <tr class="row1">
		 	<td><strong>ESIC</strong></td>
			<td><input type="text" name="ESI_employer" id="ESIemployer" style="width:98%;" value="" onkeyup="calculate_esi(this.value);" readonly="" tabindex="<?php echo ($cj+6); ?>"/></td>
			<td><input type="text" name="ESI_employer_value" id="esimployervalue" size="10" value="" readonly="" tabindex="<?php echo ($cj+7); ?>" style="width:98%;" /></td>
		 </tr>
		 <tr class="row1">
		 	<td><strong>PF A/C 1</strong></td>
			<td><input type="text" name="pf_ac1" id="pf_ac1" style="width:98%;" value=""  readonly="" tabindex="<?php echo ($cj+6); ?>"/></td>
			<td><input type="text" name="pf_ac1_amt" id="pf_ac1_amt" size="10" value="" readonly="" tabindex="<?php echo ($cj+7); ?>" style="width:98%;" /></td>
		 </tr>
		  <tr class="row1">
		 	<td><strong>PF A/C 10 </strong></td>
			<td><input type="text" name="pf_ac10_per" id="pf_ac10_per" style="width:98%;" value=""  readonly="" tabindex="<?php echo ($cj+6); ?>"/></td>
			<td><input type="text" name="pf_ac10_amt" id="pf_ac10_amt" size="10" value="" readonly="" tabindex="<?php echo ($cj+7); ?>" style="width:98%;" /></td>
		 </tr>
		  <tr class="row1">
		 	<td><strong>PF A/C 2  </strong></td>
			<td><input type="text" name="pf_ac2_per" id="pf_ac2_per" style="width:98%;" value=""  readonly="" tabindex="<?php echo ($cj+6); ?>"/></td>
			<td><input type="text" name="pf_ac2_amt" id="pf_ac2_amt" size="10" value="" readonly="" tabindex="<?php echo ($cj+7); ?>" style="width:98%;" /></td>
		 </tr>
		  <tr class="row1">
		 	<td><strong>PF A/C 21 </strong></td>
			<td><input type="text" name="pf_ac21_per" id="pf_ac21_per" style="width:98%;" value=""  readonly="" tabindex="<?php echo ($cj+6); ?>"/></td>
			<td><input type="text" name="pf_ac21_amt" id="pf_ac21_amt" size="10" value="" readonly="" tabindex="<?php echo ($cj+7); ?>" style="width:98%;" />

			</td>
		 </tr>	
		  <tr class="row1">
		 	<td><strong>PF A/C 22 </strong></td>
			<td><input type="text" name="pf_ac22_per" id="pf_ac22_per" style="width:98%;" value=""  readonly="" tabindex="<?php echo ($cj+6); ?>"/></td>
			<td><input type="text" name="pf_ac22_amt" id="pf_ac22_amt" size="10" value="" readonly="" tabindex="<?php echo ($cj+7); ?>" style="width:98%;" />

			</td>
		 </tr>		

		<tr class="row1">
		 <td colspan="3"><h3><strong>Allowances Part (C)</strong></h3></td>
		 </tr>
		 <tr class="row1">
		 	<td><strong>LTA</strong></td>
			<td><input type="hidden" name="ltaper" id="ltaper" onkeyup="calltaAll(this)" size="2" value="100" tabindex="<?php echo ($cj+2); ?>"  /><input type="text" name="lta" id="lta" size="10" onkeyup="calltaAll(this)"   value=""  tabindex="<?php echo ($cj+3); ?>" style="width:97%;" /></td>
			<td><input type="text" name="lta_nontaxable" id="lta_nontaxable" size="10"    value=""  tabindex="<?php echo ($cj+3); ?>" style="width:97%;" /></td>
		 </tr>
		 <tr class="row1">
		 	<td><strong>Medical</strong></td>
			<td><input type="hidden" name="medicalper" id="medicalFper" onkeyup="calltaAll1(this)" size="2" value="100" tabindex="<?php echo ($cj+4); ?>" /><input type="text" name="medicalamount" id="medicalamt" onkeyup="calltaAll1(this)"  size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" />
			</td>
			<td><input type="text" name="medicalamountent" id="medicalamountent" onkeyup="calltaAll1(this)"  size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" /></td>
		 </tr>
		  <tr class="row1">
		 	<td><strong>Medical Policy</strong></td>
			<td><input type="hidden" name="medicalpolicyper" id="medicalpolicyper"  size="2" value="100" />
				<input type="text" name="medicalpolicyamt" id="medicalpolicyamt"
			 onkeyup="calltaAll2(this)"  size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" /></td>
			<td><input type="text" name="medicalpolicyamountent" id="medicalpolicyamountent" onkeyup="calltaAll3(this)"  size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" /></td>
		 </tr>
		  <tr class="row1">
		 	<td><strong>Superannuation</strong></td>
			<td><input type="hidden" name="supperannuation_per" id="mediclaimper"  size="2" 
				value="15" readonly tabindex="<?php echo ($cj+4); ?>"  /><input type="text" name="supperannuation_amt" id="mediclaimamt" onkeyup="calltaAll3(this)" size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" /></td>
			<td><input type="text" name="supperannuation_nontaxableamt" id="supperannuation_nontaxableamt"  size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" /></td>
		 </tr>
		  <tr class="row1">
		 	<td><strong>Gratuity</strong></td>
			<td><input type="hidden" name="gratuity_per" id="gratuity_per"  size="2" 
				value="4.81" readonly tabindex="<?php echo ($cj+4); ?>"  /><input type="text" name="gratuity_amt" id="gratuity_amt" onkeyup="calltaAll3(this)" size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" /></td>
			<td><input type="text" name="gratuity_nontaxableamt" id="gratuity_nontaxableamt"  size="10" tabindex="<?php echo ($cj+5); ?>" style="width:97%;" /></td>
		 </tr>
		 	 
		   
		
		</table>
		</td>
		<td valign="top">
		<h3><strong>Deduction(D)</strong></h3>
		<input type="hidden" name="prefix2" id="prefix2" value="D" />
		<table width="100%" border="0" cellpadding="3" cellspacing="0">
		  <tr class="row1">
			<td width="24%"><strong>Description</strong></td>
			<td width="38%" style="text-align:center;"><strong>%</strong></td>
			<td style="text-align:center;"><strong>Value</strong></td>
		  </tr>
		 <?php
		  $ded_sql=DB_query("Select * from deduction_master",$db); 
		 $j=1;
		  while($ded_row=DB_fetch_array($ded_sql))
		  {
		  ?>
	     <tr class="row1">
		<td><strong><?php echo $ded_row['name'];?><?php if($ded_row['code']=='PF'){ ?>	<br />
		<input type="checkbox" name="govt"  id="govt" <?php echo $checked1; ?>	 onclick="cal_dedvalue1(<?php echo $j;?>)" />
		<?php } ?>
	<input name="empdedtype[<?php echo $j;?>]"  id="empdedtype_<?php echo $j;?>" type="hidden" value="<?php echo $ded_row['code'];?>" /></strong>	
	<input type="hidden" name="ded_code[<?php echo $j;?>]" id="ded_code_<?php echo $j;?>" value="<?php echo $ded_row['code'];?>" />
	<input type="hidden" name="dedid[<?php echo $j;?>]" id="dedid_<?php echo $j;?>" value="<?php echo $ded_row['id'];?>" /></td>
	<?php if($ded_row['code']!='PT'){ ?>
	<td><input name="dperc[<?php echo $j;?>]" type="text" id="dperc_<?php echo $j;?>" value="<?php echo $dperc[$j];?>" size="5" onkeyup="cal_dedvalue(this.value,this.id,<?php echo $j;?>)" class="number" tabindex="<?php echo ($mc+$j);?>" style="width:98%;" /></td>
	<?php  } else { ?>
	<td>&nbsp;</td>
	<?php } ?>		
	<td><input name="deduction[<?php echo $j;?>]" type="text" id="deduction_<?php echo $j;?>" value="<?php echo $deduction[$j];?>" size="10" class="number" tabindex="<?php echo $mc1= ($mc+$j+1);?>" style="width:98%;" /></td>
	</tr>
	<?php $j++;} ?>
	<input type="hidden" name="dctr" id="dctr" value="<?php echo $j;?>" />
	 <tr class="row1">
	  <td><strong>Total Deduction </strong></td>
	  <td>&nbsp;</td>
	  <td><input name="deduct_tot" type="text" id="deduct_tot" value="<?php echo $deduct_tot;?>" onfocus="cal_dedtot()" readonly="true" style="width:98%;" tabindex="<?php echo $mc1; ?>"/></td>
	  <td></td>
		 </tr>
		
		 <!-- <tr class="row1">
			<td width="24%"><strong>OT Applicable</strong></td>                      
			<td><input type="checkbox" name="otapplicable" value="Y" <?php if($otapplicable=='Y') {?> checked="checked" <?php } ?>  onclick="showapplicabe();" id="otapplicable" />	
			<?php if($otapplicable=='N')
			$disable="disabled";
			?></td>
		  </tr>
	 	  <tr class="row1">
			<td><strong>Over time Hrs</strong>
			<td><select name="over_time" id="over_time">
              <option value="0">Select</option>
              <?php foreach($othrs as $key=>$value)
					  {
					  $st='';
					  if($key==$over_time)
					  $st="selected";
					  ?>
              <option value="<?php echo $key; ?>" <?php echo $st; ?>   ><?php echo $value; ?></option>
              <?php } ?>
            </select></td>
	 			  </tr>		  
		  <tr class="row1">
		    <td><strong>Single</strong> <input type="radio" name="ottype" id="ottype" value="S" <?php if($ottype=='S') { ?> checked="checked" <?php } ?> /></td>
		    <td><strong>Double</strong> <input type="radio" name="ottype" value="D" id="ottype1" <?php if($ottype=='D') { ?> checked="checked" <?php } ?> /></td>
		  </tr>-->
		<tr class="row1">
		<td><strong>Gross Salary</strong></td>
		<td>&nbsp;</td>
		<td ><input name="gross_sal" type="text" id="gross_sal"  style="width:98%;" onfocus="cal_gross()" tabindex="<?php echo ($mc1+1); ?>" readonly="true" /></td>
		 <td></td>
		</tr>
		<tr class="row1">
		<td><strong>Net Salary (A-D)</strong></td>
		<td>&nbsp;</td>
		<td ><input name="net_sal" type="text" id="net_sal" style="width:98%;" onfocus="cal_net()" tabindex="<?php echo ($mc1+2); ?>" readonly="true" /></td>
		 <td></td>
		</tr>
		<tr class="row1">
		 <td><strong>CTC</strong></td>
		 <td><input type="hidden" name="yearlyctc" id="yearlyctc1"  size="15" tabindex="<?php echo $mc=($cj+9); ?>" style="width:98%;" /></td>
		<td><input type="text" name="monthelyctc" id="monthelyctc1" readonly size="15" tabindex="<?php echo $mc=($cj+8); ?>" style="width:98%;" /></td>
		
		 </tr>
		<tr class="row1">
		<td><strong>Salary Effective From</strong></td>
		<td>&nbsp;</td>
		<td ><input name="eff_sal_date" type="text" class="datepicker" id="eff_sal_date" value="<?php echo date('d/m/Y');?>" style="width:98%;" /></td>
		 <td></td>
		</tr>
		<tr class="row1">
		<td><strong>Income Tax</strong></td>
		<td>&nbsp;</td>
		<td ><input name="incometax" type="text"  id="incometax" value="" style="width:98%;" /></td>
		 <td></td>
		</tr>
		</table></td></tr></table>
		
	</div>
			<!--end of Salary box-->
			
			<!--Leave box-->
	<div class="box">
	<table width="100%" border="0" cellpadding="3" cellspacing="0">
	 <tr class="row1">
		 <td width="20%"><strong>Effective Date<font color="#FF0000" size="-1">*</font></strong></td>
		 <td><input type="text" name="leave_eff_date" id="leave_eff_date" value="<?php if(isset($leave_eff_date)){echo $leave_eff_date;} else {echo date('d/m/Y');}?>" tabindex="66" style="width:98%;" />
		 	<!-- onClick="javascript:NewCal(this.id,'ddmmyyyy')" -->
		 </td>
	   </tr>
	   <tr class="row1" >
		 <td><h3><strong>Leave Type</strong></h3></td>
		 <td><h3><strong>Number of Days</strong></h3></td>
	   </tr>
		<?php 
		$leave_sql="Select * from leavemaster";
	 $leave_res=DB_query($leave_sql,$db);
	  $num=DB_num_rows($leave_res);
	 $i=0;
	 while($leave_row=DB_fetch_array($leave_res))
	   { 
		 $leave_day=$s->GetFieldValue('emp_leave',"emp_id='".$_REQUEST['id']."' and leave_type='".$leave_row['id']."'" ,'leave_days');
	   ?>
	   
	   <tr class="row1">
	   <td><input name="leave_type[<?php echo $i;?>]" id="leave_type_<?php echo $i;?>" type="hidden" value="<?php echo $leave_row['id'];?> " />
	   <strong><?php echo $leave_row['leavename'];?></strong></td>
	   <td><input name="leave_days[<?php echo $i;?>]" type="text" id="leave_days_<?php echo $i;?>" value="<?php echo  $leave_day;?>" size="10" tabindex="67" style="width:98%;" /></td>
	   </tr>
	   <?php    $i++;} ?>
	   <input type="hidden" name="cnt" id="cnt" value="<?php echo $i;?>" />
	</table>
	</div>
			<!--end of Leave box-->
			<!--Uploads box-->
	<div class="box">
	<h3>Uploads</h3>
	<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<tr class="row1">
		<td colspan="3" style="text-align:left;">
		<input type="button" onclick="addRow('dataTable')" class="search" value="Add More" />
		<input type="button" onclick="deleteRow('dataTable')" class="search" value="Delete Row" />
		</td>
	</tr>
	<tbody id="dataTable">
	<tr class="row1">
		<td width="5%"><input type="checkbox" name="chk" /></td>	
		<td width="10%"><strong>Upload Document</strong></td>
		<td><input type="file" name="docmnt[]" id="docmnt" value="" tabindex="69" style="width:98%;" />
		<input type="hidden" name="docmnt1" id="docmnt1" value="<?php echo $document;?>" tabindex="70"/></td>
	</tr>
	</tbody>
	<input type="hidden" id="hiditemcount" />
	</table>
	</div>

</div>
	<div style="clear:both;"></div>
	</div>
</div>
</form>
<script type="text/javascript">
	Element.cleanWhitespace('content');
	init();
</script>
<?php
include('includes/footer.inc');
?>
<script>
function AddPgElements()
{
	document.getElementById("PG_LAYER").style.display='block';
	document.getElementById("pgel").style.display='none';
	
}	
function AddPpgElements()
{
	document.getElementById("doctor").style.display='block';
	document.getElementById("add_ppg").style.display='none';
	
}
function AddDipElements1()
{
	document.getElementById("doctor1").style.display='block';
	document.getElementById("id_addCertAnc1").style.display='none';
	
}
function AddDipElements2()
{
	document.getElementById("doctor2").style.display='block';
	document.getElementById("id_addCertAnc2").style.display='none';
	
}
function AddDipElements3()
{
	document.getElementById("doctor3").style.display='block';
	document.getElementById("id_addCertAnc3").style.display='none';
	
}

	
	function imageURL(input,i) {   

 if (input.files && input.files[0]) {	 
  
           var reader = new FileReader();
            reader.onload = function(e) { 
			  document.getElementById(i).src=e.target.result; 
			 
    			 }
	            reader.readAsDataURL(input.files[0]);
	        }
    }
	
function addRow(tableID) 
{
	if(document)
	var table = document.getElementById(tableID);
	var rowCount = table.rows.length;
	var row = table.insertRow(rowCount);
	document.getElementById("hiditemcount").value=rowCount;
	var colCount = table.rows[0].cells.length;
	for(var i=0; i<colCount; i++) {	
	
	var newcell = row.insertCell(i);
	row.className='row1';
	//newcell.style.background='#e7e7e7';
	newcell.className='tabledata1';
	newcell.innerHTML = table.rows[0].cells[i].innerHTML;
	switch(newcell.childNodes[0].type) 
	{
	case "text":
	newcell.childNodes[0].value = "";
	var nod_id = newcell.childNodes[0].id;
	newcell.childNodes[0].id = newcell.childNodes[0].id+'_'+rowCount;
	break;
	case "hidden":
	newcell.childNodes[0].value = "";
	var nod_id_hidden = newcell.childNodes[0].id;
	newcell.childNodes[0].id = newcell.childNodes[0].id+'_'+rowCount;
	break;
	case "button":
	var nod_id = newcell.childNodes[0].id;
	newcell.childNodes[0].id = newcell.childNodes[0].id+'_'+rowCount;
	break;
	case "checkbox":
	newcell.childNodes[0].checked = false;
	var nod_id_chk = newcell.childNodes[0].id;
	newcell.childNodes[0].id = newcell.childNodes[0].id+'_'+rowCount;
	break;
	case "select-one":
	newcell.childNodes[0].selectedIndex = 0;
	var nod_id = newcell.childNodes[0].id;
	newcell.childNodes[0].id = newcell.childNodes[0].id+'_'+rowCount;
	break;	
	}
		//document.getElementById("stock_perunit_"+rowCount).value=1;
	}
	document.getElementById("stock_perunit_"+rowCount).value='1';
	}


function validate()
{
	if(document.getElementById("emp_site").value=='000')
	{
		alert("Please Select The Site First !");
		document.getElementById("emp_site").focus();
		return false;
	}
	if(document.getElementById("emp_name").value=='')
	{
		alert("Please Fill The Employee Name First !");
		document.getElementById("emp_name").focus();
		return false;
	}
	if(document.getElementById("fh_name").value=='')
	{
		alert("Please Fill The Employee Father Name First !");
		document.getElementById("fh_name").focus();
		return false;
	}
	if(document.getElementById("nationality").value=='')
	{
		alert("Please Fill The Nationality First !");
		document.getElementById("nationality").focus();
		return false;
	}
	if(document.getElementById("religion").value=='')
	{
		alert("Please Fill The Religion First !");
		document.getElementById("religion").focus();
		return false;
	}
	
	var flag=0;
	if(document.getElementById("sex").checked==true || document.getElementById("sex1").checked==true)
	{
		flag=1;
	}
	if(flag==0)
	{
		alert("Please Select Sex First !");
		return false;
	}
	if(document.getElementById("dob").value=='')
	{
		alert("Please Select The Date Of Birth First !");
		document.getElementById("dob").focus();
		return false;
	}

	var flag1=0;
	
	if(document.getElementById("bloodgroup").checked==true || document.getElementById("bloodgroup1").checked==true || document.getElementById("bloodgroup2").checked==true || document.getElementById("bloodgroup3").checked==true || document.getElementById("bloodgroup4").checked==true || document.getElementById("bloodgroup5").checked==true || document.getElementById("bloodgroup6").checked==true || document.getElementById("bloodgroup7").checked==true)
	{
		flag1=1;
	}
	if(flag1==0)
	{
		alert("Please Select Blood Group First !");
		return false;
	}
	
	if(document.getElementById("doj").value=='')
	{
		alert("Please Select The Date Of Joining First !");
		document.getElementById("doj").focus();
		return false;
	}
	
	if(document.getElementById("department").value=='000')
	{
		alert("Please Select The Department First !");
		document.getElementById("department").focus();
		return false;
	}
	if(document.getElementById("designation").value=='000')
	{
		alert("Please Select The Desgination First !");
		document.getElementById("designation").focus();
		return false;
	}
	
	if(document.getElementById("emp_weekly_off").value=='000')
	{
		alert("Please Select The Weekly Off First !");
		document.getElementById("emp_weekly_off").focus();
		return false;
	}
	
	if(document.getElementById("marital_status").value=='000')
	{
		alert("Please Select The Marital Status First !");
		document.getElementById("marital_status").focus();
		return false;
	}
	
	if(document.getElementById("marital_status").value='Married')
	{
		if(document.getElementById("marriage").value=='')
		{
			alert("Please Fill The Marriage Aniversary Date First !");
			document.getElementById("marriage").focus();
			return false;
		}
		if(document.getElementById("wh_name").value=='')
		{
			alert("Please Fill The Wife's/Husband's Name First !");
			document.getElementById("wh_name").focus();
			return false;
		}
	}
	
	if(document.getElementById("tenth_standard").checked==false)
	{
		alert("Please Check 10th Standard First !");
		document.getElementById("tenth_standard").focus();
		return false;
	}
	
	if(document.getElementById("tenthplus2_standard").checked==false)
	{
		alert("Please Check 10+2 Standard First !");
		document.getElementById("tenthplus2_standard").focus();
		return false;
	}
	
	if(document.getElementById("pre_add1").value=='')
	{
		alert("Please Fill The Present Address  First !");
		document.getElementById("pre_add1").focus();
		return false;
	}
	
	if(document.getElementById("pre_city").value=='')
	{
		alert("Please Fill The Present City  First !");
		document.getElementById("pre_city").focus();
		return false;
	}
	
	if(document.getElementById("pre_state1").value=='')
	{
		alert("Please Fill The Present State  First !");
		document.getElementById("pre_state1").focus();
		return false;
	}
	
	if(document.getElementById("pre_country1").value=='')
	{
		alert("Please Fill The Present Country  First !");
		document.getElementById("pre_country1").focus();
		return false;
	}
	
	if(document.getElementById("pre_pincode").value=='')
	{
		alert("Please Fill The Present Pin Code  First !");
		document.getElementById("pre_pincode").focus();
		return false;
	}
	
	if(document.getElementById("pre_mobile").value=='')
	{
		alert("Please Fill The Present Mobile No  First !");
		document.getElementById("pre_mobile").focus();
		return false;
	}
	
	
	if(document.getElementById("per_add1").value=='' || document.getElementById("per_city").value=='' || document.getElementById("per_state1").value=='' || document.getElementById("per_country1").value=='' || document.getElementById("per_pincode").value=='' || document.getElementById("per_mobile").value=='')
	{
		alert("Please Checke If Present Address Same As Permanent Address Or Fill All Permanent Address Details!");
		document.getElementById("copy_add").focus();
		return false;
	}
	
	if(document.getElementById("payment_mode").value=='')
	{
		alert("Please Select The Payment Mode  First !");
		document.getElementById("payment_mode").focus();
		return false;
	}
	
	if(document.getElementById("gross").value=='')
	{
		alert("Please Fill Monthly CTC  First !");
		document.getElementById("gross").focus();
		return false;
	}
	
	
}
function showapplicabe()
{
if(document.getElementById("otapplicable").checked==true)
{
document.getElementById("over_time").disabled =false;
document.getElementById("ottype").disabled =false;
document.getElementById("ottype1").disabled =false;
}
else
{
document.getElementById("over_time").disabled =true;
document.getElementById("ottype").disabled=true;
document.getElementById("ottype1").disabled=true;
}

}


</script>