From 87e40e75733f5fcdd90ef3f01c42179a411acc4f Mon Sep 17 00:00:00 2001 From: sriramv Date: Fri, 14 Jul 2017 11:47:58 +0530 Subject: [PATCH] add and edit page for Employee details --- application/controllers/employeedetails.php | 39 ++++- application/views/addemployee.php | 159 ++++++++++++----- application/views/editEmployee.php | 179 +++++++++++++++----- 3 files changed, 292 insertions(+), 85 deletions(-) diff --git a/application/controllers/employeedetails.php b/application/controllers/employeedetails.php index 0b7ee897..af95a1c2 100755 --- a/application/controllers/employeedetails.php +++ b/application/controllers/employeedetails.php @@ -170,6 +170,7 @@ class employeedetails extends BaseController $this->form_validation->set_rules('ContactNumber', 'ContactNumber', 'trim|required|min_length[10]|max_length[10]'); $this->form_validation->set_rules('emailid', 'emailid', 'trim|required|valid_email'); + $this->form_validation->set_rules('comemailid', 'emailid', 'trim|required|valid_email'); $this->form_validation->set_rules('gender', 'gender', 'callback_Gender_validate'); $this->form_validation->set_rules('MartialStatus', 'MartialStatus', 'callback_Martial_validate'); @@ -203,6 +204,7 @@ class employeedetails extends BaseController $DateofBirth = $this->input->post('DateofBirth'); $ContactNumber = $this->input->post('ContactNumber'); $EmailId = $this->input->post('emailid'); + $comEmailId = $this->input->post('comemailid'); $Gender = $this->input->post('gender'); $MartialStatus = $this->input->post('MartialStatus'); @@ -229,7 +231,11 @@ class employeedetails extends BaseController $ValidTill = $this->input->post('ValidTill'); $addinfo = $this->input->post('addinfo'); $IsActive = '1'; + $driverlicense = $this->input->post ( 'driverlicense' ); + $licenseExpiryDate = $this->input->post ( 'licenseExpiryDate' ); + $VoterID = $this->input->post ( 'voterID' ); $createdby = $this->session->userdata ( 'userId' ); + $licenseExpiryDate = $this->getDateformat($licenseExpiryDate); $DOB = $this->getDateformat($DateofBirth); @@ -244,8 +250,8 @@ class employeedetails extends BaseController } //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); - + $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,'personalEmailId'=>$comEmailId,'DriverLicense'=>$driverlicense,'LicenseValidtill'=>$licenseExpiryDate,'VoterID'=>$VoterID); + //print_r($Employee);die(); $this->load->model('employeedetails_model'); $result = $this->employeedetails_model->addNewemployee($Employee); @@ -473,6 +479,7 @@ echo ""; $DateofBirth = $this->input->post('DateofBirth'); $ContactNumber = $this->input->post('ContactNumber'); $EmailId = $this->input->post('emailid'); + $comEmailId = $this->input->post('comemailid'); $Gender = $this->input->post('gender'); $MartialStatus = $this->input->post('MartialStatus'); $BloodGroup = $this->input->post('bloodgroup'); @@ -497,7 +504,9 @@ echo ""; $passportno = $this->input->post('passportno'); $ValidTill = $this->input->post('ValidTill'); $addinfo = $this->input->post('addinfo'); - + $driverlicense = $this->input->post ( 'Driverlicense' ); + $licenseExpiryDate = $this->input->post ( 'LicenseExpiryDate' ); + $VoterID = $this->input->post ( 'VoterID' ); $chked = $this->input->post('isactive'); // echo 'chkvalue'. $chked ; if( $chked != '') @@ -511,7 +520,7 @@ echo ""; // echo 'chkvalue'. $IsActive ; $UpdatedBY = $this->session->userdata ( 'userId' ); - + $licenseExpiryDate = $this->getDateformat($licenseExpiryDate); $DOB = $this->getDateformat($DateofBirth); $DOJ = $this->getDateformat($dateofjoining); if($ValidTill != '') @@ -524,9 +533,9 @@ echo ""; } //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); + $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,'personalEmailId'=>$comEmailId,'DriverLicense'=>$driverlicense,'LicenseValidtill'=>$licenseExpiryDate,'VoterID'=>$VoterID); - + //print_r($Employee);die(); $result = $this->employeedetails_model->UpdateEmployee($Employee,$EmpId); if($result > 0) @@ -597,7 +606,10 @@ echo ""; $this->excel->getActiveSheet()->setCellValue('AI5', 'UpdatedBY'); $this->excel->getActiveSheet()->setCellValue('AJ5', 'PF_Balance'); $this->excel->getActiveSheet()->setCellValue('AK5', 'PF_Bal_On'); - //$this->excel->getActiveSheet()->setCellValue('AK5', 'Date OF Birth'); + $this->excel->getActiveSheet()->setCellValue('AL5', 'Official Email ID'); + $this->excel->getActiveSheet()->setCellValue('AM5', 'Driving License'); + $this->excel->getActiveSheet()->setCellValue('AN5', 'Driving License Expiry Date'); + $this->excel->getActiveSheet()->setCellValue('AO5', 'Voter ID'); @@ -685,6 +697,14 @@ echo ""; $this->excel->getActiveSheet()->getStyle('AJ5')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('AK5')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('AK5')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('AL5')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('AL5')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('AM5')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('AM5')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('AN5')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('AN5')->getFont()->setBold(true); + $this->excel->getActiveSheet()->getStyle('AO5')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('AO5')->getFont()->setBold(true); @@ -694,6 +714,7 @@ echo ""; if ($exportData) { $i = 6; $s = 1; + foreach ($exportData as $data) { @@ -734,6 +755,10 @@ echo ""; $this->excel->getActiveSheet()->setCellValue('AI'. $i,$data['UpdatedBY']); $this->excel->getActiveSheet()->setCellValue('AJ'. $i,$data['PF_Balance']); $this->excel->getActiveSheet()->setCellValue('AK'. $i,$data['PF_Bal_On']); + $this->excel->getActiveSheet()->setCellValue('AL'. $i,$data['personalEmailId']); + $this->excel->getActiveSheet()->setCellValue('AM'. $i,$data['DriverLicense']); + $this->excel->getActiveSheet()->setCellValue('AN'. $i,$data['LicenseValidtill']); + $this->excel->getActiveSheet()->setCellValue('AO'. $i,$data['VoterID']); diff --git a/application/views/addemployee.php b/application/views/addemployee.php index b4bc5bf4..2ba937a7 100755 --- a/application/views/addemployee.php +++ b/application/views/addemployee.php @@ -6,8 +6,8 @@ reader.onload = function (e) { $('#profilepicture') .attr('src', e.target.result) - .width(166) - .height(166); + .width(180) + .height(180); }; reader.readAsDataURL(input.files[0]); @@ -124,7 +124,7 @@ function validateEmail() { { if (reg.test(email) == false) { - alert('Please Enter Valid Email Address'); + alert('Please Enter Valid Personal Email Address'); return (false); } else @@ -138,6 +138,50 @@ function validateEmail() { } } +function validatecomEmail() { + var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; + + var email = $('#mail').val(); + + if(email != '') + { + if (reg.test(email) == false) + { + alert('Please Enter Valid Company Email Address'); + return (false); + } + else + { + return true; + } + } + else + { + alert('Please Enter email id'); + } + +} + +function validateDriverLicense() { + + + var reg = /^[A-Z]{2}[0-9]{2}\s[0-9]{11}$/; + // alert(); + var VehicleNo = $('#Driverlicense').val(); + if(VehicleNo != "") + { + if (reg.test(VehicleNo) == false) + { + alert('Please Enter Valid Driver License Number'); + return (false); + } + else + { + return true; + } + } + +} function getAge() { var dateString = $("#DateofBirth").val(); @@ -181,6 +225,9 @@ $(function() { }); $("#ValidTill").datepicker({dateFormat: 'mm/dd/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' }); + $("#LicenseExpiryDate").datepicker({dateFormat: 'mm/dd/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' +}); + }); @@ -264,7 +311,7 @@ function onlyAlphabets(evt) {
-
+
@@ -273,13 +320,18 @@ function onlyAlphabets(evt) {
+
your image
+ + +
+
@@ -304,7 +356,7 @@ function onlyAlphabets(evt) {
Contact Number*
-
Email ID* +
Personal Email ID*
@@ -325,25 +377,15 @@ function onlyAlphabets(evt) {
-
Marital Status* - +
Official Email ID* +
-
Blood group* +
+
+ + Blood group* +
+
Marital Status* + +
@@ -368,20 +427,20 @@ function onlyAlphabets(evt) { Address Details -
+
Current Address* - +
-
+
Current address same as permanent address
-
+
Permanent Address* - +
@@ -392,7 +451,7 @@ function onlyAlphabets(evt) { Emergency Contact Information -
+
Emergency Contact Name*
@@ -408,7 +467,7 @@ function onlyAlphabets(evt) { Work Profile -
+
Designation @@ -484,12 +543,12 @@ function onlyAlphabets(evt) { Bank Details -
+
Account Number
IFSC Code - +
Bank Branch Name @@ -502,25 +561,39 @@ function onlyAlphabets(evt) { ID Proof -
+
Aadhar Number
PAN Number - +
Passport Number
-
Valid Till +
Passport Expiry Date
+ +
+
Voter ID + +
+
Driving License + +
+ +
Driving License Expiry Date + +
+ +
-
+
@@ -607,15 +680,24 @@ function Validate() if($("#emailid").val().length < 1) { - alert('Please Enter Email ID'); + alert('Please Enter Personal Email ID'); return false; } else if(!validateEmail()) { - return false; + return; + } + + if($("#mail").val().length < 1) + { + alert('Please Enter Company Email ID'); + return false; + } + else if(!validatecomEmail()) + { + return; } - if($("option:selected", $("#gender")).val() == '-1') { alert('Please Select Gender'); @@ -683,6 +765,7 @@ function Validate() ValidatePassport(); } + } $("#emailid").change(function () { diff --git a/application/views/editEmployee.php b/application/views/editEmployee.php index 88646dec..5bdbe991 100755 --- a/application/views/editEmployee.php +++ b/application/views/editEmployee.php @@ -8,6 +8,7 @@ $DateofBirth = ''; $ContactNumber =''; $EmailId = ''; + $BloodGroup =''; $MartialStatus= ''; $DateofJoining = ''; @@ -38,6 +39,10 @@ $Age = ''; $DOB = ''; $DOJ = ''; + $personalEmailId=''; +$DriverLicense=''; +$LicenseValidtill=''; +$VoterID=''; if(!empty($EmpDetails)) { foreach ($EmpDetails as $Emp) @@ -54,6 +59,7 @@ if(!empty($EmpDetails)) $DOB = $from ->format('Y-m-d'); $ContactNumber = $Emp->ContactNumber; $EmailId = $Emp->EmailId; + //$comEmailId = $Emp->comEmailId; $BloodGroup = $Emp->BloodGroup; $MartialStatus =$Emp->MartialStatus; $DateofJoining = $Emp->DateofJoining; @@ -87,6 +93,12 @@ if(!empty($EmpDetails)) $Reference_Name = $Emp->Reference_Name; $Reference_ContactNumber = $Emp->Reference_ContactNumber; $Remarks = $Emp->Remarks; + $personalEmailId = $Emp->personalEmailId; + $DriverLicense = $Emp->DriverLicense; + $LicenseValidtill = $Emp->LicenseValidtill; + $VoterID = $Emp->VoterID; + $dtLicenseValidtill = new DateTime($LicenseValidtill); + $LicenseValidtill = $dtLicenseValidtill ->format('Y-m-d'); } } @@ -158,6 +170,26 @@ function validatePAN() { } } +} +function validateDriverLicense() { + + + var reg = /^[A-Z]{2}[0-9]{2}\s[0-9]{11}$/; + // alert(); + var VehicleNo = $('#Driverlicense').val(); + if(VehicleNo != "") + { + if (reg.test(VehicleNo) == false) + { + alert('Please Enter Valid Driver License Number'); + return (false); + } + else + { + return true; + } + } + } function Validate() { @@ -190,15 +222,24 @@ function Validate() { return;} - if($("#emailid").val().length < 1) + if($("#email").val().length < 1) { - alert('Please Enter Email ID'); - return; + alert('Please Enter Personal Email ID'); + return false; } else if(!validateEmail()) { return; } + if($("#mail").val().length < 1) + { + alert('Please Enter Company Email ID'); + return false; + } + else if(!validatecomEmail()) + { + return; + } if($("option:selected", $("#gender")).val() == '-1') @@ -295,7 +336,7 @@ function getValidReferNumber() { function validateEmail() { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; - var email = $('#emailid').val(); + var email = $('#email').val(); if(email != '') { @@ -310,6 +351,25 @@ function validateEmail() { } } +} +function validatecomEmail() { + var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; + + var email = $('#mail').val(); + + if(email != '') + { + if (reg.test(email) == false) + { + alert('Please Enter Valid Company Email Address'); + return (false); + } + else + { + return true; + } + } + } function getAge() { @@ -354,6 +414,8 @@ $(function() { }); $("#ValidTill").datepicker({dateFormat: 'mm/dd/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' }); + $("#LicenseExpiryDate").datepicker({dateFormat: 'mm/dd/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' +}); }); @@ -422,14 +484,14 @@ function ValidatePassport()
-
+
Personal Information -
+
your image
@@ -438,7 +500,9 @@ function ValidatePassport() -
IsActive + + + IsActive
@@ -464,8 +528,8 @@ function ValidatePassport()
Contact Number*
-
Email ID* - +
Personal Email ID* +
Gender* @@ -484,8 +548,32 @@ function ValidatePassport() ?>
- -
Marital Status* +
Official Email ID* + +
+ + + +
+
+ Blood group* + +
+
+ Marital Status*
- - -
Blood group* -
@@ -529,19 +600,25 @@ function ValidatePassport() Address Details
+
Current Address* - + +
+
Current address same as permanent address -
+
+
+
Permanent Address* - + +
@@ -553,12 +630,14 @@ function ValidatePassport() Emergency Contact Information
+
Emergency Contact Name*
Emergency Contact Number*
+
@@ -569,6 +648,7 @@ function ValidatePassport()
+
Designation*
+
+
Qualification*
+
Bank Details
+
Account Number
IFSC Code - +
Bank Branch Name @@ -656,17 +740,19 @@ function ValidatePassport()
Bank Address
+
ID Proof
+
Aadhar Number
PAN Number - +
Passport Number @@ -674,22 +760,35 @@ function ValidatePassport()
Valid Till
+
+
+
Voter ID + +
+
Driving License + +
+ +
Driving License Expiry Date + +
+ +
- - +
-
+
+ Cancel - -
+
@@ -735,9 +834,9 @@ function ValidatePassport()