public function viewAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_salary', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('userid'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'empsalarydetails'; $empsalarydetailsform = new Default_Form_empsalarydetails(); $empsalarydetailsform->removeElement("submit"); $elements = $empsalarydetailsform->getElements(); if (count($elements) > 0) { foreach ($elements as $key => $element) { if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") { $element->setAttrib("disabled", "disabled"); } } } 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(); $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id); if (!empty($data)) { if (isset($data[0]['currencyid']) && $data[0]['currencyid'] != '') { $currencyArr = $currencymodel->getCurrencyDataByID($data[0]['currencyid']); if (sizeof($currencyArr) > 0) { $empsalarydetailsform->currencyid->addMultiOption($currencyArr[0]['id'], $currencyArr[0]['currencyname'] . ' ' . $currencyArr[0]['currencycode']); } } if (isset($data[0]['accountclasstypeid']) && $data[0]['accountclasstypeid'] != '') { $accountclasstypeArr = $accountclasstypemodel->getsingleAccountClassTypeData($data[0]['accountclasstypeid']); if (sizeof($accountclasstypeArr) > 0) { $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstypeArr[0]['id'], $accountclasstypeArr[0]['accountclasstype']); } } if (isset($data[0]['bankaccountid']) && $data[0]['bankaccountid'] != '') { $bankaccounttypeArr = $bankaccounttypemodel->getsingleBankAccountData($data[0]['bankaccountid']); if ($bankaccounttypeArr != 'norows') { $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttypeArr[0]['id'], $bankaccounttypeArr[0]['bankaccounttype']); } } $empsalarydetailsform->populate($data[0]); if ($data[0]['accountholding'] != '') { $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view'); $empsalarydetailsform->accountholding->setValue($accountholding); } } $this->view->controllername = $objName; $this->view->data = $data; $this->view->id = $id; $this->view->form = $empsalarydetailsform; $this->view->employeedata = $empdata[0]; } $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 deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ''; $actionflag = 3; if ($id) { $accountclasstypemodel = new Default_Model_Accountclasstype(); $menumodel = new Default_Model_Menu(); $accountdata = $accountclasstypemodel->getsingleAccountClassTypeData($id); $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $accountclasstypemodel->SaveorUpdateAccountClassTypeData($data, $where); if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/accountclasstype'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $configmail = sapp_Global::send_configuration_mail('Account Class Type', $accountdata[0]['accountclasstype']); $messages['message'] = 'Account class type deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Account class type cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Account class type cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }