diff --git a/application/controllers/Employeedetails.php b/application/controllers/Employeedetails.php
index cfb6e031..e9ceb323 100644
--- a/application/controllers/Employeedetails.php
+++ b/application/controllers/Employeedetails.php
@@ -72,8 +72,16 @@ class Employeedetails extends BaseController
$this->loadThis();
}
else
- {
-
+ {
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('eduqualifaction','Enter Qualification','trim|required');
+ if($this->form_validation->run() == FALSE)
+ {
+ $this->addemployee();
+ }
+ else
+ {
$Picture = $this->add();
$FirstName = $this->input->post('FirstName');
@@ -112,7 +120,14 @@ class Employeedetails extends BaseController
$DOB = $this->getDateformat($DateofBirth);
$DOJ = $this->getDateformat($dateofjoining);
+ if($ValidTill != '')
+ {
$Valid = $this->getDateformat($ValidTill);
+ }
+ else
+ {
+ $Valid = null;
+ }
//echo $DOB;
$Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName,'Gender'=>$Gender,'DateofBirth'=>$DOB,'ContactNumber'=>$ContactNumber,'EmailId'=>$EmailId,'BloodGroup'=>$BloodGroup,'MartialStatus'=>$MartialStatus,'DateofJoining'=>$DOJ,'PreviousYearsOfExp'=>$Previousexperience,'Designation'=>$desigination,'Departmentcode'=>$departmentCode,'PresentAddress'=>$CurrentAddress,'PermanentAddress'=>$permanentaddress,'EmergencyContactName'=>$emergencycontactname,'EmergencyContactNumber'=>$emergencycontactnumber,'Edu_Qualification'=>$eduqualifaction,'Additional_Qualification'=>$addqualification,'AadharNo'=>$aadharno,'PANNo'=>$panno,'BankAccountNo'=>$accountno,'IFSCCode'=>$ifsccode,'BankBranchName'=>$bankbranchname,'BankAddress'=>$bankaddress,'PassportNo'=>$passportno,'Passport_Valid_till'=>$Valid,'IsActive'=>$IsActive,'ProfilePic'=>$Picture,'Reference_Name'=>$referredby,'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'CreatedBy'=>$createdby);
@@ -122,15 +137,17 @@ class Employeedetails extends BaseController
if($result > 0)
{
+ echo "";
$this->session->set_flashdata('Success', 'New Employee created successfully!');
}
else
{
+ echo "";
$this->session->set_flashdata('Error', 'New Employee details not saved');
}
redirect('employeeListing');
-
+ }
}
}
@@ -222,6 +239,138 @@ class Employeedetails extends BaseController
return $picture ;
}
+
+ function ViewEmployee()
+ {
+ if($this->isAdmin() == TRUE)
+ {
+ $this->loadThis();
+ }
+ else
+ {
+ $EmpID = $_GET['EmpID'];
+
+ $GenderConfigID = 'C013';
+ $MartialConfigID = 'C012';
+ $QualificationConfigID = 'C014';
+ $DesignationConfigID = 'C010';
+ $BloodGroupConfigID = 'C011';
+ $this->load->model('employeedetails_model');
+ $data['GenderList'] = $this->employeedetails_model->getConfigValue($GenderConfigID);
+ $data['MartialList'] = $this->employeedetails_model->getConfigValue($MartialConfigID);
+ $data['QualificationList'] = $this->employeedetails_model->getConfigValue($QualificationConfigID);
+ $data['DesignationList'] = $this->employeedetails_model->getConfigValue($DesignationConfigID);
+ $data['BloodGroupList'] = $this->employeedetails_model->getConfigValue($BloodGroupConfigID);
+
+ $data['DepartmentList'] = $this->employeedetails_model->getDepartment();
+ $data['EmpDetails'] = $this->employeedetails_model->viewemployee($EmpID);
+ $this->global['pageTitle'] = 'Siddharth : View Employee';
+
+ $this->loadViews("editEmployee", $this->global, $data, NULL);
+
+ }
+ }
+ function UpdateEmployee()
+ {
+ if($this->isAdmin() == TRUE)
+ {
+ $this->loadThis();
+ }
+ else
+ {
+ $this->load->model('Employeedetails_model');
+ $EmpId = $this->input->post('employeeid');
+ $PictureName = $this->input->post('Image');
+
+ if ($PictureName != '')
+ {
+ //echo 'Exists';
+ $Picture = $PictureName;
+ }
+ else
+ {
+ //echo 'Not Exists';
+ $Picture = $this->add();
+ }
+ //echo $Picture;
+
+ $FirstName = $this->input->post('FirstName');
+ $LastName = $this->input->post('LastName');
+ $FatherName = $this->input->post('FatherName');
+ $DateofBirth = $this->input->post('DateofBirth');
+ $ContactNumber = $this->input->post('ContactNumber');
+ $EmailId = $this->input->post('emailid');
+ $Gender = $this->input->post('gender');
+ $MartialStatus = $this->input->post('MartialStatus');
+ $BloodGroup = $this->input->post('bloodgroup');
+ $CurrentAddress = $this->input->post('currentaddress');
+ $permanentaddress = $this->input->post('permanentaddress');
+ $emergencycontactname = $this->input->post('emergencycontactname');
+ $emergencycontactnumber = $this->input->post('emergencycontactnumber');
+ $desigination = $this->input->post('desigination');
+ $departmentCode = $this->input->post('departmentname');
+ $dateofjoining = $this->input->post('dateofjoining');
+ $Previousexperience = $this->input->post('Previousexperience');
+ $eduqualifaction = $this->input->post('eduqualifaction');
+ $addqualification = $this->input->post('addqualification');
+ $referredby = $this->input->post('referredby');
+ $referrercontno = $this->input->post('referrercontno');
+ $accountno = $this->input->post('accountno');
+ $ifsccode = $this->input->post('ifsccode');
+ $bankbranchname = $this->input->post('bankbranchname');
+ $bankaddress = $this->input->post('bankaddress');
+ $aadharno = $this->input->post('aadharno');
+ $panno = $this->input->post('panno');
+ $passportno = $this->input->post('passportno');
+ $ValidTill = $this->input->post('ValidTill');
+ $addinfo = $this->input->post('addinfo');
+
+ $chked = $this->input->post('isactive');
+ // echo 'chkvalue'. $chked ;
+ if( $chked != '')
+ {
+ $IsActive = '1';
+ }
+ else
+ {
+ $IsActive = '0';
+ }
+ // echo 'chkvalue'. $IsActive ;
+ $UpdatedBY = $this->session->userdata ( 'userId' );
+
+
+ $DOB = $this->getDateformat($DateofBirth);
+ $DOJ = $this->getDateformat($dateofjoining);
+ if($ValidTill != '')
+ {
+ $Valid = $this->getDateformat($ValidTill);
+ }
+ else
+ {
+ $Valid = null;
+ }
+
+ //echo $DOB;
+ $Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName,'Gender'=>$Gender,'DateofBirth'=>$DOB,'ContactNumber'=>$ContactNumber,'EmailId'=>$EmailId,'BloodGroup'=>$BloodGroup,'MartialStatus'=>$MartialStatus,'DateofJoining'=>$DOJ,'PreviousYearsOfExp'=>$Previousexperience,'Designation'=>$desigination,'Departmentcode'=>$departmentCode,'PresentAddress'=>$CurrentAddress,'PermanentAddress'=>$permanentaddress,'EmergencyContactName'=>$emergencycontactname,'EmergencyContactNumber'=>$emergencycontactnumber,'Edu_Qualification'=>$eduqualifaction,'Additional_Qualification'=>$addqualification,'AadharNo'=>$aadharno,'PANNo'=>$panno,'BankAccountNo'=>$accountno,'IFSCCode'=>$ifsccode,'BankBranchName'=>$bankbranchname,'BankAddress'=>$bankaddress,'PassportNo'=>$passportno,'Passport_Valid_till'=>$Valid,'IsActive'=>$IsActive,'ProfilePic'=>$Picture,'Reference_Name'=>$referredby,'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'UpdatedBY'=>$UpdatedBY);
+
+
+ $result = $this->Employeedetails_model->UpdateEmployee($Employee,$EmpId);
+
+ if($result > 0)
+ {
+ echo "";
+ $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!');
+ }
+ else
+ {
+ echo "";
+ $this->session->set_flashdata('Error', $EmpId.'Employee details not saved');
+ }
+
+ redirect('employeeListing');
+
+ }
+ }
}
?>
\ No newline at end of file