public function viewAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_salary', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); $emptyFlag = 0; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('userid'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $empsalarydetailsform = new Default_Form_empsalarydetails(); try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $empsalarydetailsModal = new Default_Model_Empsalarydetailsnew(); $cData = $empsalarydetailsModal->getCompensationData($id); $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $usersModel = new Default_Model_Users(); $msgarray = array(); $empsalarydetailsform->user_id->setValue($id); $empsalarydetailsform->setAttrib('action', DOMAIN . 'empsalarydetails/edit/userid/' . $id); $this->view->form = $empsalarydetailsform; $this->view->data = isset($data[0]) ? $data[0] : array(); $this->view->cData = $cData; $this->view->id = $id; $this->view->loginuserRole = $loginuserRole; $this->view->msgarray = $msgarray; $this->view->employeedata = $empdata[0]; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_salary', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); $emptyFlag = 0; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } if (sapp_Global::_checkprivileges(ACCOUNTCLASSTYPE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'accountclasstype'); } if (sapp_Global::_checkprivileges(BANKACCOUNTTYPE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'bankaccounttype'); } $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('userid'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $empsalarydetailsform = new Default_Form_empsalarydetails(); try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $empsalarydetailsModal = new Default_Model_Empsalarydetails(); $usersModel = new Default_Model_Users(); $currencymodel = new Default_Model_Currency(); $accountclasstypemodel = new Default_Model_Accountclasstype(); $bankaccounttypemodel = new Default_Model_Bankaccounttype(); $msgarray = array(); $basecurrencymodeldata = $currencymodel->getCurrencyList(); $empsalarydetailsform->currencyid->addMultiOption('', 'Select Salary Currency'); if (sizeof($basecurrencymodeldata) > 0) { foreach ($basecurrencymodeldata as $basecurrencyres) { $empsalarydetailsform->currencyid->addMultiOption($basecurrencyres['id'], utf8_encode($basecurrencyres['currency'])); } } else { $msgarray['currencyid'] = 'Currencies are not configured yet.'; $emptyFlag++; } $bankaccounttypeArr = $bankaccounttypemodel->getBankAccountList(); $empsalarydetailsform->bankaccountid->addMultiOption('', 'Select Bank Account Type'); if (!empty($bankaccounttypeArr)) { foreach ($bankaccounttypeArr as $bankaccounttyperes) { $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttyperes['id'], $bankaccounttyperes['bankaccounttype']); } } else { $msgarray['bankaccountid'] = 'Bank account types are not configured yet.'; $emptyFlag++; } $accountclasstypeArr = $accountclasstypemodel->getAccountClassTypeList(); $empsalarydetailsform->accountclasstypeid->addMultiOption('', 'Select Account Type'); if (!empty($accountclasstypeArr)) { foreach ($accountclasstypeArr as $accountclasstyperes) { $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstyperes['id'], $accountclasstyperes['accountclasstype']); } } else { $msgarray['accountclasstypeid'] = 'Account class types are not configured yet.'; $emptyFlag++; } $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id); if (!empty($data)) { $empsalarydetailsform->populate($data[0]); if ($data[0]['accountholding'] != '') { $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view'); $empsalarydetailsform->accountholding->setValue($accountholding); } if ($data[0]['accountclasstypeid'] != '') { $empsalarydetailsform->setDefault('accountclasstypeid', $data[0]['accountclasstypeid']); } $empsalarydetailsform->setDefault('currencyid', $data[0]['currencyid']); $empsalarydetailsform->setDefault('bankaccountid', $data[0]['bankaccountid']); } $empsalarydetailsform->user_id->setValue($id); $empsalarydetailsform->setAttrib('action', DOMAIN . 'empsalarydetails/edit/userid/' . $id); $this->view->form = $empsalarydetailsform; $this->view->data = isset($data[0]) ? $data[0] : array(); $this->view->id = $id; $this->view->msgarray = $msgarray; $this->view->employeedata = $empdata[0]; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($empsalarydetailsform, $id); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function salarydetailsAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_salary', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); $emptyFlag = 0; $tabName = 'salarydetails'; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $loginUserId; $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $empsalarydetailsform = new Default_Form_empsalarydetails(); try { if ($id) { $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $empsalarydetailsModal = new Default_Model_Empsalarydetails(); $usersModel = new Default_Model_Users(); $currencymodel = new Default_Model_Currency(); $accountclasstypemodel = new Default_Model_Accountclasstype(); $bankaccounttypemodel = new Default_Model_Bankaccounttype(); $payfrequencyModal = new Default_Model_Payfrequency(); $msgarray = array(); $basecurrencymodeldata = $currencymodel->getCurrencyList(); if (sizeof($basecurrencymodeldata) > 0) { $empsalarydetailsform->currencyid->addMultiOption('', 'Select Salary Currency'); foreach ($basecurrencymodeldata as $basecurrencyres) { $empsalarydetailsform->currencyid->addMultiOption($basecurrencyres['id'], utf8_encode($basecurrencyres['currency'])); } } else { $msgarray['currencyid'] = 'Salary currencies are not configured yet.'; $emptyFlag++; } $payfreqData = $payfrequencyModal->getActivePayFreqData(); $empsalarydetailsform->salarytype->addMultiOption('', 'Select Pay Frequency'); if (sizeof($payfreqData) > 0) { foreach ($payfreqData as $payfreqres) { $empsalarydetailsform->salarytype->addMultiOption($payfreqres['id'], $payfreqres['freqtype']); } } else { $msgarray['salarytype'] = 'Pay frequency is not configured yet.'; $emptyFlag++; } $bankaccounttypeArr = $bankaccounttypemodel->getBankAccountList(); if (!empty($bankaccounttypeArr)) { $empsalarydetailsform->bankaccountid->addMultiOption('', 'Select Bank Account Type'); foreach ($bankaccounttypeArr as $bankaccounttyperes) { $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttyperes['id'], $bankaccounttyperes['bankaccounttype']); } } else { $msgarray['bankaccountid'] = 'Bank account types are not configured yet.'; $emptyFlag++; } $accountclasstypeArr = $accountclasstypemodel->getAccountClassTypeList(); if (!empty($accountclasstypeArr)) { $empsalarydetailsform->accountclasstypeid->addMultiOption('', 'Select Account Type'); foreach ($accountclasstypeArr as $accountclasstyperes) { $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstyperes['id'], $accountclasstyperes['accountclasstype']); } } else { $msgarray['accountclasstypeid'] = 'Account class types are not configured yet.'; $emptyFlag++; } $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id); if (!empty($data)) { $empsalarydetailsform->populate($data[0]); if ($data[0]['accountholding'] != '') { $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view'); $empsalarydetailsform->accountholding->setValue($accountholding); } if ($data[0]['accountclasstypeid'] != '') { $empsalarydetailsform->setDefault('accountclasstypeid', $data[0]['accountclasstypeid']); } $empsalarydetailsform->setDefault('currencyid', $data[0]['currencyid']); $empsalarydetailsform->setDefault('bankaccountid', $data[0]['bankaccountid']); $this->view->data = $data[0]; } $empsalarydetailsform->user_id->setValue($id); $empsalarydetailsform->setAttrib('action', DOMAIN . 'mydetails/salarydetails'); $this->view->form = $empsalarydetailsform; $this->view->id = $id; $this->view->msgarray = $msgarray; $this->view->employeedata = $empdata[0]; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($empsalarydetailsform, $tabName); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }