public function save($creditcardDetailsform)
 {
     $result = "";
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $date = new Zend_Date();
     if ($creditcardDetailsform->isValid($this->_request->getPost())) {
         $post_values = $this->_request->getPost();
         if (isset($post_values['id'])) {
             unset($post_values['id']);
         }
         if (isset($post_values['user_id'])) {
             unset($post_values['user_id']);
         }
         if (isset($post_values['submit'])) {
             unset($post_values['submit']);
         }
         $new_post_values = array_filter($post_values);
         $user_id = $this->_request->getParam('userid');
         if (!empty($new_post_values)) {
             $creditcardDetailsModel = new Default_Model_Creditcarddetails();
             $id = $this->_request->getParam('id');
             $card_type = $this->_request->getParam('card_type');
             $card_number = $this->_request->getParam('card_number');
             $card_name = $this->_request->getParam('nameoncard');
             $card_expiry_1 = $this->_request->getParam('card_expiration', null);
             $card_expiry = sapp_Global::change_date($card_expiry_1, 'database');
             $card_issuedBy = $this->_request->getParam('card_issuedby');
             $card_code = $this->_request->getParam('card_code');
             $data = array('card_type' => $card_type, 'card_number' => $card_number, 'nameoncard' => $card_name, 'card_expiration' => $card_expiry, 'card_issued_comp' => $card_issuedBy, 'card_code' => $card_code, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($id != '') {
                 $where = array('user_id=?' => $user_id);
                 $actionflag = 2;
             } else {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $where = '';
                 $actionflag = 1;
             }
             $Id = $creditcardDetailsModel->SaveorUpdateCreditcardDetails($data, $where);
             if ($Id == 'update') {
                 $tableid = $id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee corporate card details updated successfully."));
             } else {
                 $tableid = $Id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee corporate card details added successfully."));
             }
             $menumodel = new Default_Model_Menu();
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
         } else {
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => FIELDMSG));
         }
         $this->_redirect('creditcarddetails/edit/userid/' . $user_id);
     } else {
         $messages = $creditcardDetailsform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 public function save($employeeDetailsform, $tabName)
 {
     $data = array();
     $employeeData = array();
     $actionflag = '';
     $tableid = '';
     $date = new Zend_Date();
     $msgStr = "";
     $menumodel = new Default_Model_Menu();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $loginUserId;
     if ($employeeDetailsform->isValid($this->_request->getPost())) {
         //Taking id(PK) from Form....
         $id = $this->getRequest()->getParam('id');
         $user_id = $loginUserId;
         if ($id != '') {
             $where = array('id=?' => $id);
             $actionflag = 2;
         } else {
             $data['createdby'] = $loginUserId;
             $data['createddate'] = gmdate("Y-m-d H:i:s");
             $data['isactive'] = 1;
             $where = '';
             $actionflag = 1;
         }
         switch ($tabName) {
             case 'employee':
                 //Employee Details....
                 break;
             case 'personal':
                 //Employee personal details...
                 $empperdetailsModal = new Default_Model_Emppersonaldetails();
                 $id = $this->_request->getParam('id');
                 $user_id = $loginUserId;
                 $genderid = $this->_request->getParam('genderid');
                 $maritalstatusid = $this->_request->getParam('maritalstatusid');
                 $nationalityid = $this->_request->getParam('nationalityid');
                 $ethniccodeid = $this->_request->getParam('ethniccodeid');
                 $racecodeid = $this->_request->getParam('racecodeid');
                 $languageid = $this->_request->getParam('languageid');
                 $dob = $this->_request->getParam('dob');
                 $dob = sapp_Global::change_date($dob, 'database');
                 $celebrated_dob = $this->_request->getParam('celebrated_dob');
                 $celebrated_dob = sapp_Global::change_date($celebrated_dob, 'database');
                 $passport = $this->_request->getParam('passport');
                 $pancard_number = $this->_request->getParam('pancard_number');
                 $SSN_number = $this->_request->getParam('SSN_number');
                 $adhar_number = $this->_request->getParam('adhar_number');
                 $drivinglicence_number = $this->_request->getParam('drivinglicence_number');
                 $otheridentity = $this->_request->getParam('otheridentity');
                 $bloodgroup = $this->_request->getParam('bloodgroup');
                 $data = array('user_id' => $user_id, 'genderid' => $genderid, 'maritalstatusid' => $maritalstatusid, 'nationalityid' => $nationalityid, 'ethniccodeid' => $ethniccodeid, 'racecodeid' => $racecodeid, 'languageid' => $languageid, 'dob' => $dob, 'celebrated_dob' => $celebrated_dob != '' ? $celebrated_dob : NULL, 'passport' => $passport != '' ? $passport : NULL, 'pancard_number' => $pancard_number != '' ? $pancard_number : NULL, 'adhar_number' => $adhar_number != '' ? $adhar_number : NULL, 'SSN_number' => $SSN_number != '' ? $SSN_number : NULL, 'drivinglicence_number' => $drivinglicence_number != '' ? $drivinglicence_number : NULL, 'otheridentity' => $otheridentity != '' ? $otheridentity : NULL, 'bloodgroup' => $bloodgroup != '' ? $bloodgroup : NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $empperdetailsModal->SaveorUpdateEmpPersonalData($data, $where);
                 break;
             case 'communication':
                 $empcommdetailsModal = new Default_Model_Empcommunicationdetails();
                 $personalemail = $this->_request->getParam('personalemail');
                 $perm_streetaddress = $this->_request->getParam('perm_streetaddress');
                 $perm_country = $this->_request->getParam('perm_country');
                 $perm_stateArr = explode("!@#", $this->_request->getParam('perm_state'));
                 $perm_state = $perm_stateArr[0];
                 $perm_cityArr = explode("!@#", $this->_request->getParam('perm_city'));
                 $perm_city = $perm_cityArr[0];
                 $perm_pincode = $this->_request->getParam('perm_pincode');
                 $address_flag = $this->_request->getParam('address_flag');
                 $current_streetaddress = $this->_request->getParam('current_streetaddress');
                 $current_country = $this->_request->getParam('current_country');
                 $current_stateArr = explode("!@#", $this->_request->getParam('current_state'));
                 $current_state = $current_stateArr[0];
                 $current_cityArr = explode("!@#", $this->_request->getParam('current_city'));
                 $current_city = $current_cityArr[0];
                 $current_pincode = $this->_request->getParam('current_pincode');
                 $emergency_number = $this->_request->getParam('emergency_number');
                 $emergency_name = $this->_request->getParam('emergency_name');
                 $emergency_email = $this->_request->getParam('emergency_email');
                 $data = array('user_id' => $user_id, 'personalemail' => $personalemail, 'perm_streetaddress' => $perm_streetaddress, 'perm_country' => $perm_country, 'perm_state' => $perm_state, 'perm_city' => $perm_city, 'perm_pincode' => $perm_pincode, 'current_streetaddress' => $current_streetaddress != '' ? $current_streetaddress : NULL, 'current_country' => $current_country != '' ? $current_country : NULL, 'current_state' => $current_state != '' ? $current_state : NULL, 'current_city' => $current_city != '' ? $current_city : NULL, 'current_pincode' => $current_pincode != '' ? $current_pincode : NULL, 'emergency_number' => $emergency_number != '' ? $emergency_number : NULL, 'emergency_name' => $emergency_name != '' ? $emergency_name : NULL, 'emergency_email' => $emergency_email != '' ? $emergency_email : NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $empcommdetailsModal->SaveorUpdateEmpcommData($data, $where);
                 break;
             case 'skills':
                 //Employee Skills....
                 $empskillsModal = new Default_Model_Empskills();
                 $skillname = $this->_request->getParam('skillname');
                 $yearsofexp = $this->_request->getParam('yearsofexp');
                 $competencylevelid = $this->_request->getParam('competencylevelid');
                 $year_skill_last_used = $this->_request->getParam('year_skill_last_used', null);
                 $year_skill_last_used = sapp_Global::change_date($year_skill_last_used, 'database');
                 $data = array('user_id' => $user_id, 'skillname' => $skillname, 'yearsofexp' => $yearsofexp, 'competencylevelid' => $competencylevelid, 'year_skill_last_used' => $year_skill_last_used != '' ? $year_skill_last_used : NUll, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $empskillsModal->SaveorUpdateEmpSkills($data, $where);
                 break;
             case 'education':
                 //Employee education details
                 $educationDetailsModel = new Default_Model_Educationdetails();
                 $institution_name = $this->_request->getParam('institution_name');
                 $course = $this->_request->getParam('course');
                 $from_date = $this->_request->getParam('from_date');
                 $to_date = $this->_request->getParam('to_date');
                 $percentage = $this->_request->getParam('percentage');
                 //Date Formats....
                 $fromDate = sapp_Global::change_date($from_date, 'database');
                 $toDate = sapp_Global::change_date($to_date, 'database');
                 $data = array('user_id' => $user_id, 'institution_name' => $institution_name, 'course' => $course, 'from_date' => $fromDate, 'to_date' => $toDate, 'percentage' => $percentage, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $educationDetailsModel->SaveorUpdateEducationDetails($data, $where);
                 break;
             case 'experience':
                 //Employee experience details...
                 $experienceDetailsModel = new Default_Model_Experiencedetails();
                 $comp_name = $this->_request->getParam('comp_name');
                 $comp_website = $this->_request->getParam('comp_website');
                 $designation = $this->_request->getParam('designation');
                 $reference_name = $this->_request->getParam('reference_name');
                 $reference_contact = $this->_request->getParam('reference_contact');
                 $reference_email = $this->_request->getParam('reference_email');
                 $fromdate = $this->_request->getParam('from_date', null);
                 $fromDateStr = sapp_Global::change_date($fromdate, 'database');
                 $todate = $this->_request->getParam('to_date', null);
                 $toDateStr = sapp_Global::change_date($todate, 'database');
                 $reason_for_leaving = $this->_request->getParam('reason_for_leaving');
                 $data = array('comp_name' => $comp_name, 'comp_website' => $comp_website, 'designation' => $designation, 'from_date' => $fromDateStr, 'to_date' => $toDateStr, 'reference_name' => $reference_name, 'reference_contact' => $reference_contact, 'reference_email' => $reference_email, 'reason_for_leaving' => $reason_for_leaving, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $experienceDetailsModel->SaveorUpdateEmployeeexperienceData($data, $where);
                 break;
             case 'leaves':
                 //Employee Leaves...
                 $employeeleavesModel = new Default_Model_Employeeleaves();
                 $emp_leave_limit = $this->_request->getParam('leave_limit');
                 $data = array('user_id' => $user_id, 'emp_leave_limit' => $emp_leave_limit, 'used_leaves' => $used_leaves, 'alloted_year' => $date->get('yyyy'), 'modifiedby' => $loginUserId, 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss'));
                 $Id = $employeeleavesModel->SaveorUpdateEmpLeaves($data, $where);
                 break;
             case 'certification':
                 //Employee training and certification details....
                 $TandCdetailsModel = new Default_Model_Trainingandcertificationdetails();
                 $course_name = $this->_request->getParam('course_name');
                 $description = $this->_request->getParam('description');
                 $course_level = $this->_request->getParam('course_level');
                 $course_offered_by = $this->_request->getParam('course_offered_by');
                 $certification_name = $this->_request->getParam('certification_name');
                 $issueddate = $this->_request->getParam('issued_date', null);
                 $issuedDateStr = sapp_Global::change_date($issueddate, 'database');
                 $data = array('course_name' => $course_name, 'description' => $description, 'course_level' => $course_level, 'course_offered_by' => $course_offered_by, 'certification_name' => $certification_name, 'issued_date' => $issuedDateStr, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $TandCdetailsModel->SaveorUpdateEmployeeTandCData($data, $where);
                 break;
             case 'medicalclaims':
                 //Employee Medical claims....
                 //echo "in medical claims case";die;
                 $empMedicalclaimsModel = new Default_Model_Medicalclaims();
                 //Post values ..
                 $injuryIndicator = $this->_request->getParam('injuryindicator');
                 $type = $this->_request->getParam('type');
                 $injured_date = $this->_request->getParam('injured_date', null);
                 $description = $this->_request->getParam('description');
                 $injury_name = $this->_request->getParam('injury_name');
                 $injury_severity = $this->_request->getParam('injury_severity');
                 $disability_type = $this->_request->getParam('disability_type');
                 $other_disability_type = $this->_request->getParam('other_disability_type');
                 $insurer_name = $this->_request->getParam('insurer_name');
                 $expected_date_join = $this->_request->getParam('expected_date_join', null);
                 $leavebyemp_from_date = $this->_request->getParam('leavebyemp_from_date', null);
                 $leavebyemp_to_date = $this->_request->getParam('leavebyemp_to_date', null);
                 $leavebyemp_days = $this->_request->getParam('leavebyemp_days');
                 $empleave_from_date = $this->_request->getParam('empleave_from_date', null);
                 $empleave_to_date = $this->_request->getParam('empleave_to_date', null);
                 $empleave_days = $this->_request->getParam('empleave_days');
                 $hospital_name = $this->_request->getParam('hospital_name');
                 $hospital_addr = $this->_request->getParam('hospital_addr');
                 $room_num = $this->_request->getParam('room_num');
                 $gp_name = $this->_request->getParam('gp_name');
                 $treatment_details = $this->_request->getParam('treatment_details');
                 $total_cost = $this->_request->getParam('total_cost');
                 $amount_claimed = $this->_request->getParam('amount_claimed');
                 $amount_approved = $this->_request->getParam('amount_approved');
                 //Date Formats....
                 $empleaveToDate = "";
                 $leavebyEmpFromDate = "";
                 $leavebyEmpToDate = '';
                 $empleaveFromDate = '';
                 $injuredDate = sapp_Global::change_date($injured_date, 'database');
                 $expectedDateOfJoin = sapp_Global::change_date($expected_date_join, 'database');
                 if ($leavebyemp_from_date != "") {
                     $leavebyEmpFromDate = sapp_Global::change_date($leavebyemp_from_date, 'database');
                 }
                 if ($leavebyemp_to_date != "") {
                     $leavebyEmpToDate = sapp_Global::change_date($leavebyemp_to_date, 'database');
                 }
                 if ($empleave_from_date != "") {
                     $empleaveFromDate = sapp_Global::change_date($empleave_from_date, 'database');
                 }
                 if ($empleave_to_date != "") {
                     $empleaveToDate = sapp_Global::change_date($empleave_to_date, 'database');
                 }
                 $data = array('amount_approved' => $amount_approved, 'amount_claimed_for' => $amount_claimed, 'treatment_details' => $treatment_details, 'total_cost' => $total_cost, 'concerned_physician_name' => $gp_name, 'room_number' => $room_num, 'hospital_address' => $hospital_addr, 'hospital_name' => $hospital_name, 'leaveappliedbyemployee_days' => $empleave_days, 'leaveappliedbyemployee_to_date' => $empleaveToDate, 'leaveappliedbyemployee_from_date' => $empleaveFromDate, 'leavebyemployeer_days' => $leavebyemp_days, 'leavebyemployeer_to_date' => $leavebyEmpToDate, 'leavebyemployeer_from_date' => $leavebyEmpFromDate, 'expected_date_join' => $expectedDateOfJoin, 'medical_insurer_name' => $insurer_name, 'other_disability_type' => $other_disability_type, 'disability_type' => $disability_type, 'injury_severity' => $injury_severity, 'injury_name' => $injury_name, 'injury_description' => $description, 'injured_date' => $injuredDate, 'injury_type' => $type, 'injury_indicator' => $injuryIndicator, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $empMedicalclaimsModel->SaveorUpdateEmpmedicalclaimsDetails($data, $where);
                 break;
             case 'disability':
                 //Employee disability details....
                 $empDisabilitydetailsModel = new Default_Model_Disabilitydetails();
                 //Post values ..
                 $disability_type = $this->_request->getParam('disability_type');
                 $disabiity_name = $this->_request->getParam('disability_name');
                 $description = $this->_request->getParam('disability_description');
                 $other_disability_type = $this->_request->getParam('other_disability_type');
                 $data = array('other_disability_type' => $other_disability_type, 'disability_type' => $disability_type, 'disability_name' => $disabiity_name, 'disability_description' => $description, 'user_id' => $loginUserId, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $empDisabilitydetailsModel->SaveorUpdateEmpdisabilityDetails($data, $where);
                 break;
             case 'dependency':
                 //Employee dependency details....
                 $dependencyDetailsModel = new Default_Model_Dependencydetails();
                 $dependent_name = $this->_request->getParam('dependent_name');
                 $dependent_relation = $this->_request->getParam('dependent_relation');
                 $dependent_custody = $this->_request->getParam('dependent_custody');
                 $dependentdob = $this->_request->getParam('dependent_dob', null);
                 $dependentDOB = sapp_Global::change_date($dependentdob, 'database');
                 $dependent_age = $this->_request->getParam('dependent_age');
                 $data = array('dependent_name' => $dependent_name, 'dependent_relation' => $dependent_relation, 'dependent_custody' => $dependent_custody, 'dependent_dob' => $dependentDOB, 'dependent_age' => $dependent_age, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $dependencyDetailsModel->SaveorUpdateEmployeedependencyData($data, $where);
                 break;
             case 'visa':
                 //Employee visa and immigration details.....
                 $visaandimmigrationdetailsModel = new Default_Model_Visaandimmigrationdetails();
                 $passport_num = $this->_request->getParam('passport_number');
                 $passport_issue_date = $this->_request->getParam('passport_issue_date', null);
                 $passport_expiry_date = $this->_request->getParam('passport_expiry_date', null);
                 $visa_number = $this->_request->getParam('visa_number');
                 $visa_type = $this->_request->getParam('visa_type');
                 $visa_issue_date = $this->_request->getParam('visa_issue_date', null);
                 $visa_expiry_date = $this->_request->getParam('visa_expiry_date', null);
                 $inine_status = $this->_request->getParam('inine_status');
                 $inine_review_date = $this->_request->getParam('inine_review_date', null);
                 $issuing_authority = $this->_request->getParam('issuing_authority');
                 $ininetyfour_status = $this->_request->getParam('ininetyfour_status');
                 $ininetyfour_expiry_date = $this->_request->getParam('ininetyfour_expiry_date', null);
                 // Date Formats....
                 $passport_issue = sapp_Global::change_date($passport_issue_date, 'database');
                 $passport_expiry = sapp_Global::change_date($passport_expiry_date, 'database');
                 $visa_issue = sapp_Global::change_date($visa_issue_date, 'database');
                 $visa_expiry = sapp_Global::change_date($visa_expiry_date, 'database');
                 $inine_review = sapp_Global::change_date($inine_review_date, 'database');
                 $ininetyfour_expiry = sapp_Global::change_date($ininetyfour_expiry_date, 'database');
                 $data = array('passport_number' => $passport_num, 'passport_issue_date' => $passport_issue, 'passport_expiry_date' => $passport_expiry, 'visa_number' => $visa_number, 'visa_type' => $visa_type, 'visa_issue_date' => $visa_issue, 'visa_expiry_date' => $visa_expiry, 'inine_status' => $inine_status, 'inine_review_date' => $inine_review, 'issuing_authority' => $issuing_authority, 'ininetyfour_status' => $ininetyfour_status, 'ininetyfour_expiry_date' => $ininetyfour_expiry, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $visaandimmigrationdetailsModel->SaveorUpdatevisaandimmigrationDetails($data, $where);
                 break;
             case 'creditcard':
                 //Employee credit card details....
                 $creditcardDetailsModel = new Default_Model_Creditcarddetails();
                 $card_type = $this->_request->getParam('card_type');
                 $card_number = $this->_request->getParam('card_number');
                 $card_name = $this->_request->getParam('nameoncard');
                 $card_expiry_1 = $this->_request->getParam('card_expiration', null);
                 $card_expiry = sapp_Global::change_date($card_expiry_1, 'database');
                 $card_issuedBy = $this->_request->getParam('card_issuedby');
                 $card_code = $this->_request->getParam('card_code');
                 $data = array('card_type' => $card_type, 'card_number' => $card_number, 'nameoncard' => $card_name, 'card_expiration' => $card_expiry, 'card_issued_comp' => $card_issuedBy, 'card_code' => $card_code, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $creditcardDetailsModel->SaveorUpdateCreditcardDetails($data, $where);
                 break;
             case 'workeligibility':
                 //Employee work eligibility details....
                 $workeligibilityModel = new Default_Model_Workeligibilitydetails();
                 $documenttype_id = $this->_request->getParam('documenttype_id');
                 $doc_issue_date = $this->_request->getParam('doc_issue_date');
                 $doc_expiry_date = $this->_request->getParam('doc_expiry_date');
                 $issuingauth_name = $this->_request->getParam('issuingauth_name');
                 $issuingauth_country = $this->_request->getParam('issuingauth_country');
                 $issuingauth_state = $this->_request->getParam('issuingauth_state');
                 $issuingauth_city = $this->_request->getParam('issuingauth_city');
                 $issuingauth_postalcode = $this->_request->getParam('issuingauth_postalcode');
                 $docexpiryDate = sapp_Global::change_date($doc_expiry_date, 'database');
                 $docissueDate = sapp_Global::change_date($doc_issue_date, 'database');
                 $data = array('documenttype_id' => $documenttype_id, 'doc_issue_date' => $docissueDate, 'doc_expiry_date' => $docexpiryDate, 'issuingauth_name' => $issuingauth_name, 'issuingauth_country' => $issuingauth_country, 'issuingauth_state' => $issuingauth_state, 'issuingauth_city' => $issuingauth_city, 'issuingauth_postalcode' => $issuingauth_postalcode, 'user_id' => $user_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $workeligibilityModel->SaveorUpdateWorkEligibilityDetails($data, $where);
                 break;
             case 'additionaldetails':
                 //Employee additional details ....
                 $empadditionaldetailsModal = new Default_Model_Empadditionaldetails();
                 $id = $this->_request->getParam('id');
                 $military_status = $this->_request->getParam('military_status');
                 $countries_served = $this->_request->getParam('countries_served');
                 $branch_service = trim($this->_request->getParam('branch_service'));
                 $rank_achieved = trim($this->_request->getParam('rank_achieved'));
                 $special_training = trim($this->_request->getParam('special_training'));
                 $awards = trim($this->_request->getParam('awards'));
                 $from_date = $this->_request->getParam('from_date');
                 $from_date = sapp_Global::change_date($from_date, 'database');
                 $to_date = $this->_request->getParam('to_date');
                 $to_date = sapp_Global::change_date($to_date, 'database');
                 $discharge_status = $this->_request->getParam('discharge_status');
                 $service_number = trim($this->_request->getParam('service_number'));
                 $rank = trim($this->_request->getParam('rank'));
                 $verification_report = trim($this->_request->getParam('verification_report'));
                 $military_servicetype = $this->_request->getParam('military_servicetype');
                 $veteran_status = $this->_request->getParam('veteran_status');
                 $data = array('user_id' => $loginUserId, 'military_status' => $military_status, 'countries_served' => $countries_served, 'branch_service' => $branch_service != '' ? $branch_service : NULL, 'rank_achieved' => $rank_achieved != '' ? $rank_achieved : NULL, 'special_training' => $special_training != '' ? $special_training : NULL, 'awards' => $awards != '' ? $awards : NULL, 'from_date' => $from_date != '' ? $from_date : NULL, 'to_date' => $to_date != '' ? $to_date : NULL, 'discharge_status' => $discharge_status, 'service_number' => $service_number != '' ? $service_number : NULL, 'rank' => $rank != '' ? $rank : NULL, 'verification_report' => $verification_report != '' ? $verification_report : NULL, 'military_servicetype' => $military_servicetype, 'veteran_status' => $veteran_status, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $Id = $empadditionaldetailsModal->SaveorUpdateEmpAdditionalData($data, $where);
                 break;
             case 'salarydetails':
                 //Employee salary account details.....
                 $empsalarydetailsModal = new Default_Model_Empsalarydetails();
                 $id = $this->_request->getParam('id');
                 $user_id = $loginUserId;
                 $currencyid = $this->_request->getParam('currencyid');
                 $salarytype = $this->_request->getParam('salarytype');
                 $salary = $this->_request->getParam('salary');
                 $bankname = trim($this->_request->getParam('bankname'));
                 $accountholder_name = trim($this->_request->getParam('accountholder_name'));
                 $accountclasstypeid = $this->_request->getParam('accountclasstypeid');
                 $bankaccountid = $this->_request->getParam('bankaccountid');
                 $accountnumber = trim($this->_request->getParam('accountnumber'));
                 $accountholding = $this->_request->getParam('accountholding');
                 $accountholding = sapp_Global::change_date($accountholding, 'database');
                 $data = array('user_id' => $user_id, 'currencyid' => $currencyid, 'salarytype' => $salarytype, 'salary' => $salary, 'bankname' => $bankname != '' ? $bankname : NULL, 'accountholder_name' => $accountholder_name != '' ? $accountholder_name : NULL, 'accountclasstypeid' => $accountclasstypeid != '' ? $accountclasstypeid : NULL, 'bankaccountid' => $bankaccountid != '' ? $bankaccountid : NULL, 'accountnumber' => $accountnumber != '' ? $accountnumber : NULL, 'accountholding' => $accountholding != '' ? $accountholding : NULL, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 1);
                 $Id = $empsalarydetailsModal->SaveorUpdateEmpSalaryData($data, $where);
                 break;
         }
         //switch case end...
         if ($Id == 'update') {
             $tableid = $id;
             if ($tabName == "skills" || $tabName == "leaves" || $tabName == "holidays" || $tabName == "medicalclaims") {
                 $msgStr = "Employee " . $tabName . " updated successfully.";
             } else {
                 if ($tabName == "employee") {
                     $msgStr = "Employee details updated successfully.";
                 } else {
                     if ($tabName == "salarydetails") {
                         $msgStr = "Employee salary details updated successfully.";
                     } else {
                         if ($tabName == "creditcard") {
                             $msgStr = "Employee corporate card details updated successfully.";
                         } else {
                             $msgStr = "Employee " . $tabName . " details updated successfully.";
                         }
                     }
                 }
             }
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => $msgStr));
         } else {
             $tableid = $Id;
             if ($tabName == "skills" || $tabName == "leaves" || $tabName == "holidays" || $tabName == "medicalclaims") {
                 $msgStr = "Employee " . $tabName . " added successfully.";
             } else {
                 if ($tabName == "employee") {
                     $msgStr = "Employee details added successfully.";
                 } else {
                     if ($tabName == "salarydetails") {
                         $msgStr = "Employee salary details added successfully.";
                     } else {
                         if ($tabName == "creditcard") {
                             $msgStr = "Employee corporate card details added successfully.";
                         } else {
                             $msgStr = "Employee " . $tabName . " details added successfully.";
                         }
                     }
                 }
             }
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => $msgStr));
         }
         $menuidArr = $menumodel->getMenuObjID('/employee');
         $menuID = $menuidArr[0]['id'];
         $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
         if ($tabName == "employee") {
             $this->_redirect('mydetails/edit');
         } else {
             $this->_redirect('mydetails/' . $tabName);
         }
     } else {
         $messages = $employeeDetailsform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }