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; } }
public function save($empsalarydetailsform, $userid) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } if ($empsalarydetailsform->isValid($this->_request->getPost())) { $empsalarydetailsModal = new Default_Model_Empsalarydetails(); $id = $this->_request->getParam('id'); $user_id = $userid; $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'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $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")); if ($id != '') { $where = array('user_id=?' => $user_id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $empsalarydetailsModal->SaveorUpdateEmpSalaryData($data, $where); if ($Id == 'update') { $tableid = $id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee salary details updated successfully.")); } else { $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee salary details added successfully.")); } $menuidArr = $menumodel->getMenuObjID('/employee'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id); $this->_redirect('empsalarydetails/edit/userid/' . $user_id); } else { $messages = $empsalarydetailsform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } return $msgarray; } }
public static function process_emp_excel($file_name) { require_once 'Classes/PHPExcel.php'; require_once 'Classes/PHPExcel/IOFactory.php'; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $emp_model = new Default_Model_Employee(); $usersModel = new Default_Model_Usermanagement(); $identity_code_model = new Default_Model_Identitycodes(); $objReader = PHPExcel_IOFactory::createReaderForFile($file_name); $objPHPExcel = $objReader->load($file_name); //Read first sheet $sheet = $objPHPExcel->getSheet(0); // Get worksheet dimensions $sizeOfWorksheet = $sheet->getHighestDataRow(); $highestColumn = $sheet->getHighestDataColumn(); if ($sizeOfWorksheet > 1) { $column_salary_currency = 17; $column_salary_type = 18; $column_salary = 19; $arrReqHeaders = array('Prefix', 'First name', 'Last name', 'Role Type', 'Email', 'Business Unit', 'Department', 'Reporting manager', 'Job Title', 'Position', 'Employment Status', 'Date of joining', 'Date of leaving', 'Experience', 'Extension', 'Work telephone number', 'Fax', $column_salary_currency => 'Salary Currency', $column_salary_type => 'Pay Frequency', $column_salary => 'Salary'); //Get first/header from excel $firstRow = $sheet->rangeToArray('A' . 1 . ':' . $highestColumn . 1, NULL, TRUE, TRUE); $arrGivenHeaders = $firstRow[0]; $diffArray = array_diff_assoc($arrReqHeaders, $arrGivenHeaders); $prefix_arr = $emp_model->getPrefix_emp_excel(); $roles_arr = $emp_model->getRoles_emp_excel(); $bu_arr = $emp_model->getBU_emp_excel(); $dep_arr = $emp_model->getDep_emp_excel(); $job_arr = $emp_model->getJobs_emp_excel(); $positions_arr = $emp_model->getPositions_emp_excel(); $users_arr = $emp_model->getUsers_emp_excel(); $emp_stat_arr = $emp_model->getEstat_emp_excel(); $dol_emp_stat_arr = $emp_model->getDOLEstat_emp_excel(); $mng_roles_arr = $emp_model->getMngRoles_emp_excel(); $emps_arr = $emp_model->getEmps_emp_excel(); $emails_arr = $emps_arr['email']; $emp_ids_arr = $emps_arr['ids']; $emp_depts_arr = $emp_model->getEmpsDeptWise(); $dept_bu_arr = $emp_model->getDeptBUWise(); $pos_jt_arr = $emp_model->getPosJTWise(); $currency_arr = $emp_model->getCurrency_excel(); $salary_type_arr = $emp_model->getPayfrequency_excel(); $identity_codes = $identity_code_model->getIdentitycodesRecord(); $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : ""; $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { //start of validations $ex_prefix_arr = array(); $ex_firstname_arr = array(); $ex_lastname_arr = array(); $ex_role_arr = array(); $ex_email_arr = array(); $ex_bu_arr = array(); $ex_dep_arr = array(); $ex_rm_arr = array(); $ex_jt_arr = array(); $ex_pos_arr = array(); $ex_es_arr = array(); $ex_doj_arr = array(); $ex_dol_arr = array(); $ex_exp_arr = array(); $ex_ext_arr = array(); $ex_wn_arr = array(); $ex_fax_arr = array(); $tot_rec_cnt = 0; $err_msg = ""; for ($i = 2; $i <= $sizeOfWorksheet; $i++) { $rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE); $rowData = $rowData_org[0]; $rowData_cpy = $rowData; foreach ($rowData_cpy as $rkey => $rvalue) { $rowData[$rkey] = trim($rvalue); } //start of mandatory checking if (empty($rowData[1])) { $err_msg = "First name cannot be empty at row " . $i . "."; break; } if (empty($rowData[2])) { $err_msg = "Last name cannot be empty at row " . $i . "."; break; } if (empty($rowData[3])) { $err_msg = "Role type cannot be empty at row " . $i . "."; break; } if (empty($rowData[4])) { $err_msg = "Email cannot be empty at row " . $i . "."; break; } if (empty($rowData[7])) { $err_msg = "Reporting manager cannot be empty at row " . $i . "."; break; } if (empty($rowData[10])) { $err_msg = "Employment status cannot be empty at row " . $i . "."; break; } if (empty($rowData[11])) { $err_msg = "Date of joining cannot be empty at row " . $i . "."; break; } if (!in_array($rowData[3], $mng_roles_arr) && empty($rowData[6])) { $err_msg = "Department cannot be empty at row " . $i . "."; break; } if (in_array($rowData[10], $dol_emp_stat_arr) && empty($rowData[12])) { $err_msg = "Date of leaving cannot be empty at row " . $i . "."; break; } if (!empty($rowData[9]) && empty($rowData[8])) { $err_msg = "Job title cannot be empty at row " . $i . "."; break; } if (!empty($rowData[8]) && empty($rowData[9])) { $err_msg = "Position cannot be empty at row " . $i . "."; break; } if (!in_array($rowData[10], $dol_emp_stat_arr) && !empty($rowData[12]) && in_array($rowData[10], $emp_stat_arr)) { $err_msg = "Date of leaving must be empty for '" . $rowData[10] . "' at row " . $i . "."; break; } // end of mandatory checking // start of pattern checking if (!preg_match("/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)\$/", trim($rowData[0])) && !empty($rowData[0])) { $err_msg = "Prefix is not a valid format at row " . $i . "."; break; } if (!preg_match("/^([a-zA-Z.]+ ?)+\$/", $rowData[1]) && !empty($rowData[1])) { $err_msg = "First name is not a valid format at row " . $i . "."; break; } if (!preg_match("/^([a-zA-Z.]+ ?)+\$/", $rowData[2]) && !empty($rowData[2])) { $err_msg = "Last name is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z]+?\$/", $rowData[3]) && !empty($rowData[3])) { $err_msg = "Role type is not a valid format at row " . $i . "."; break; } if (!preg_match("/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+\$/", $rowData[4]) && !empty($rowData[4])) { $err_msg = "Email is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z0-9\\&\\'\\.\\s]+\$/", $rowData[5]) && !empty($rowData[5])) { $err_msg = "Business unit is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z0-9\\&\\'\\.\\s]+\$/", $rowData[6]) && !empty($rowData[6])) { $err_msg = "Department is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z0-9\\&\\'\\.\\s]+\$/", $rowData[7]) && !empty($rowData[7])) { $err_msg = "Reporting manager is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z][a-zA-Z0-9\\s]*\$/", $rowData[8]) && !empty($rowData[8])) { $err_msg = "Job title is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z][a-zA-Z0-9\\-\\s]*\$/i", $rowData[9]) && !empty($rowData[9])) { $err_msg = "Position is not a valid format at row " . $i . "."; break; } if (!preg_match("/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)\$/", $rowData[10]) && !empty($rowData[10])) { $err_msg = "Employment status is not a valid format at row " . $i . "."; break; } if (!empty($rowData[11])) { try { $test_doj = new DateTime($rowData[11]); } catch (Exception $ex) { return array('status' => 'error', 'msg' => "Date of joining is not a valid format at row " . $i . "."); } } if (!empty($rowData[12])) { try { $test_dol = new DateTime($rowData[12]); } catch (Exception $ex) { return array('status' => 'error', 'msg' => "Date of leaving is not a valid format at row " . $i . "."); } } if (!empty($rowData[12]) && $rowData[12] < $rowData[11]) { $err_msg = "Date of leaving must be greater than date of joining at row " . $i . "."; break; } if (!preg_match("/^[0-9]\\d{0,1}(\\.\\d*)?\$/", $rowData[13]) && !empty($rowData[13])) { $err_msg = "Experience is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[0-9]+\$/", $rowData[14]) && !empty($rowData[14])) { $err_msg = "Extension is not a valid format at row " . $i . "."; break; } if (!preg_match("/^(?!0{10})[0-9\\+\\-\\)\\(]+\$/", $rowData[15]) && !empty($rowData[15])) { $err_msg = "Work telephone number is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[0-9\\+\\-\\)\\(]+\$/", $rowData[16]) && !empty($rowData[16])) { $err_msg = "Fax is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z][a-zA-Z0-9]*\$/", $rowData[$column_salary_currency]) && !empty($rowData[$column_salary_currency])) { $err_msg = $arrReqHeaders[$column_salary_currency] . " is not a valid format at row " . $i . "."; break; } if (!preg_match("/^[a-zA-Z][a-zA-Z0-9]*\$/", $rowData[$column_salary_type]) && !empty($rowData[$column_salary_type])) { $err_msg = $arrReqHeaders[$column_salary_type] . " is not a valid format at row " . $i . "."; break; } if (!preg_match("/^([0-9]*\\.?[0-9]{1,2})\$/", $rowData[$column_salary]) && !empty($rowData[$column_salary])) { $err_msg = $arrReqHeaders[$column_salary] . " is not a valid format at row " . $i . "."; break; } if (!empty($rowData[$column_salary]) && $rowData[$column_salary] == 0) { $err_msg = $arrReqHeaders[$column_salary] . " cannot be zero at row " . $i . "."; break; } // end of pattern checking // start of checking existence in the system. if (!array_key_exists(strtolower($rowData[0]), $prefix_arr) && !empty($rowData[0])) { $err_msg = "Unknown prefix at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[3]), $roles_arr) && !empty($rowData[3])) { $err_msg = "Unknown role type at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[5]), $bu_arr) && !empty($rowData[5])) { $err_msg = "Unknown business unit at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[6]), $dep_arr) && !empty($rowData[6])) { $err_msg = "Unknown department at row " . $i . "."; break; } if (in_array(strtolower($rowData[4]), $emails_arr) && !empty($rowData[4])) { $err_msg = "Email already exists at row " . $i . "."; break; } if (!in_array(strtolower($rowData[7]), $emp_ids_arr) && !empty($rowData[7])) { $err_msg = "Unknown reporting manager at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[8]), $job_arr) && !empty($rowData[8])) { $err_msg = "Unknown job title at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[9]), $positions_arr) && !empty($rowData[9])) { $err_msg = "Unknown position at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[10]), $emp_stat_arr) && !empty($rowData[10])) { $err_msg = "Unknown employment status at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[$column_salary_currency]), $currency_arr) && !empty($rowData[$column_salary_currency])) { $err_msg = "Unknown " . strtolower($arrReqHeaders[$column_salary_currency]) . " at row " . $i . "."; break; } if (!array_key_exists(strtolower($rowData[$column_salary_type]), $salary_type_arr) && !empty($rowData[$column_salary_type])) { $err_msg = "Unknown " . strtolower($arrReqHeaders[$column_salary_type]) . " at row " . $i . "."; break; } // end of checking existence in the system. if (!empty($rowData[6])) { if (isset($emp_depts_arr[$dep_arr[strtolower($rowData[6])]]) && !in_array(strtolower($rowData[7]), $emp_depts_arr[$dep_arr[strtolower($rowData[6])]])) { if (isset($emp_depts_arr[0]) && is_array($emp_depts_arr[0])) { if (!in_array(strtolower($rowData[7]), $emp_depts_arr[0])) { $err_msg = "Reporting manager does not belong to '" . $rowData[6] . "' department at row " . $i . "."; break; } } } } else { if (isset($emp_depts_arr[0]) && is_array($emp_depts_arr[0])) { if (!in_array(strtolower($rowData[7]), $emp_depts_arr[0])) { $err_msg = "Reporting manager does not belong to management group at row " . $i . "."; break; } } } if (!empty($rowData[6])) { if (isset($dept_bu_arr[0]) && is_array($dept_bu_arr[0])) { if (in_array(strtolower($rowData[6]), $dept_bu_arr[0]) && !empty($rowData[5])) { $err_msg = "Business unit is not needed for this department '" . $rowData[6] . "' at row " . $i . "."; break; } if (!in_array(strtolower($rowData[6]), $dept_bu_arr[0]) && empty($rowData[5])) { $err_msg = "Business unit cannot be empty at row " . $i . "."; break; } } if (!empty($rowData[5])) { if (isset($dept_bu_arr[$bu_arr[strtolower($rowData[5])]]) && !in_array(strtolower($rowData[6]), $dept_bu_arr[$bu_arr[strtolower($rowData[5])]]) && !empty($rowData[5])) { $err_msg = "Department does not belong to '" . $rowData[5] . "' business unit at row " . $i . "."; break; } } } if (!empty($rowData[8]) && !empty($rowData[9])) { if (isset($pos_jt_arr[$job_arr[strtolower($rowData[8])]]) && !in_array(strtolower($rowData[9]), $pos_jt_arr[$job_arr[strtolower($rowData[8])]]) && !empty($rowData[8])) { $err_msg = "Position does not belong to '" . $rowData[8] . "' job title at row " . $i . "."; break; } } } //end of for loop if (!empty($err_msg)) { return array('status' => 'error', 'msg' => $err_msg); } $err_msg = ""; for ($i = 2; $i <= $sizeOfWorksheet; $i++) { $rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE); $rowData = $rowData_org[0]; $rowData_cpy = $rowData; foreach ($rowData_cpy as $rkey => $rvalue) { $rowData[$rkey] = trim($rvalue); } $ex_prefix_arr[] = $rowData[0]; $ex_firstname_arr[] = $rowData[1]; $ex_lastname_arr[] = $rowData[2]; $ex_role_arr[] = $rowData[3]; $ex_email_arr[$i] = $rowData[4]; $ex_bu_arr[] = $rowData[5]; $ex_dep_arr[] = $rowData[6]; $ex_rm_arr[] = $rowData[7]; $ex_jt_arr[] = $rowData[8]; $ex_pos_arr[] = $rowData[9]; $ex_es_arr[] = $rowData[10]; $ex_doj_arr[] = $rowData[11]; $ex_dol_arr[] = $rowData[12]; $ex_exp_arr[] = $rowData[13]; $ex_ext_arr[] = $rowData[14]; $ex_wn_arr[] = $rowData[15]; $ex_fax_arr[] = $rowData[16]; $tot_rec_cnt++; } foreach ($ex_email_arr as $key1 => $value1) { $d = 0; foreach ($ex_email_arr as $key2 => $value2) { if ($key1 != $key2 && $value1 == $value2) { $err_msg = "Duplicate email entry at row " . $key2 . "."; $d++; break; } } if ($d > 0) { break; } } if (!empty($err_msg)) { return array('status' => 'error', 'msg' => $err_msg); } //end of validations //start of saving if ($tot_rec_cnt > 0) { for ($i = 2; $i <= $sizeOfWorksheet; $i++) { $emp_id = $emp_identity_code . str_pad($usersModel->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); $rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE); $rowData = $rowData_org[0]; $rowData_cpy = $rowData; foreach ($rowData_cpy as $rkey => $rvalue) { $rowData[$rkey] = trim($rvalue); } $emppassword = sapp_Global::generatePassword(); $date = new DateTime($rowData[11]); $date_of_joining = $date->format('Y-m-d'); $date_of_leaving = ""; if ($rowData[12] != '') { $ldate = new DateTime($rowData[12]); $date_of_leaving = $ldate->format('Y-m-d'); } //start of saving into user table $userfullname = $rowData[1] . ' ' . $rowData[2]; $user_data = array('emprole' => $roles_arr[strtolower($rowData[3])], 'userfullname' => $userfullname, 'firstname' => $rowData[1], 'lastname' => $rowData[2], 'emailaddress' => $rowData[4], 'jobtitle_id' => isset($job_arr[strtolower($rowData[8])]) ? $job_arr[strtolower($rowData[8])] : null, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $emp_id, 'modeofentry' => "Direct", 'selecteddate' => $date_of_joining, 'userstatus' => 'old'); $user_data['createdby'] = $loginUserId; $user_data['createddate'] = gmdate("Y-m-d H:i:s"); $user_data['isactive'] = 1; $user_id = $usersModel->SaveorUpdateUserData($user_data, ''); //end of saving into user table. //start of saving into employee table $data = array('user_id' => $user_id, 'reporting_manager' => $users_arr[strtolower($rowData[7])], 'emp_status_id' => $emp_stat_arr[strtolower($rowData[10])], 'businessunit_id' => !empty($rowData[4]) ? $bu_arr[strtolower($rowData[5])] : 0, 'department_id' => !empty($rowData[5]) ? $dep_arr[strtolower($rowData[6])] : null, 'jobtitle_id' => isset($job_arr[strtolower($rowData[8])]) ? $job_arr[strtolower($rowData[8])] : null, 'position_id' => isset($positions_arr[strtolower($rowData[9])]) ? $positions_arr[strtolower($rowData[9])] : null, 'prefix_id' => isset($prefix_arr[strtolower($rowData[0])]) ? $prefix_arr[strtolower($rowData[0])] : null, 'extension_number' => $rowData[13] != '' ? $rowData[14] : NULL, 'office_number' => $rowData[14] != '' ? $rowData[15] : NULL, 'office_faxnumber' => $rowData[15] != '' ? $rowData[16] : NULL, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $rowData[13] == '' ? null : $rowData[13], 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $emp_model->SaveorUpdateEmployeeData($data, ''); //end of saving into employee table //start of saving into salary details if ($rowData[$column_salary_currency] != '' || $rowData[$column_salary] != '' || $rowData[$column_salary_type] != '') { $salary_data = array('user_id' => $user_id, 'currencyid' => isset($currency_arr[strtolower($rowData[$column_salary_currency])]) ? $currency_arr[strtolower($rowData[$column_salary_currency])] : null, 'salarytype' => isset($salary_type_arr[strtolower($rowData[$column_salary_type])]) ? $salary_type_arr[strtolower($rowData[$column_salary_type])] : null, 'salary' => !empty($rowData[$column_salary]) ? $rowData[$column_salary] : null, 'isactive' => 1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s")); $salary_model = new Default_Model_Empsalarydetails(); $salary_model->SaveorUpdateEmpSalaryData($salary_data, ''); } //end of saving into salary details //start of mail $text = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n <span style='color:#3b3b3b;'>Hello " . ucfirst($userfullname) . ",</span><br />\n\n <div style='padding:20px 0 0 0;color:#3b3b3b;'>You have been added to " . APPLICATION_NAME . ". The login credentials for your Sentrifugo account are:</div>\n\n <div style='padding:20px 0 0 0;color:#3b3b3b;'>Username: <strong>" . $emp_id . "</strong></div>\n <div style='padding:5px 0 0 0;color:#3b3b3b;'>Password: <strong>" . $emppassword . "</strong></div>\n\n <div style='padding:20px 0 10px 0;'>Please <a href='" . DOMAIN . "index/popup' target='_blank' style='color:#b3512f;'>click here</a> to login to your Sentrifugo account.</div>\n\n </div>"; $options['subject'] = APPLICATION_NAME . ': Login Credentials'; $options['header'] = 'Greetings from Sentrifugo'; $options['toEmail'] = $rowData[4]; $options['toName'] = $userfullname; $options['message'] = $text; $options['cron'] = 'yes'; $result = sapp_Global::_sendEmail($options); //end of mail } //end of for loop $trDb->commit(); return array('status' => "success", 'msg' => 'Employees saved successfully.'); } else { return array('status' => 'error', 'msg' => "No records to save."); } //end of saving } catch (Exception $e) { $trDb->rollBack(); return array('status' => 'error', 'msg' => "Something went wrong,please try again."); } } else { return array('status' => 'error', 'msg' => "No records to save."); } }