public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $messages['flagtype'] = '';
     $actionflag = 3;
     if ($id) {
         $payfrequencymodel = new Default_Model_Payfrequency();
         $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $where = array('id=?' => $id);
         $pay_data = $payfrequencymodel->getsinglePayfrequencyData($id);
         $Id = $payfrequencymodel->SaveorUpdatePayFrequencyData($data, $where);
         if ($Id == 'update') {
             sapp_Global::send_configuration_mail("Pay Frequency", $pay_data[0]['freqtype']);
             $menuID = PAYFREQUENCY;
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Pay frequency deleted successfully.';
             $messages['msgtype'] = 'success';
         } else {
             $messages['message'] = 'Pay frequency Status cannot be deleted.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Pay frequency cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }
 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();
                             $payfrequencyModal = new Default_Model_Payfrequency();
                             $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']);
                                     }
                                 }
                                 if (isset($data[0]['salarytype']) && $data[0]['salarytype'] != '') {
                                     $payfreqData = $payfrequencyModal->getActivePayFreqData($data[0]['salarytype']);
                                     if (sizeof($payfreqData) > 0) {
                                         foreach ($payfreqData as $payfreqres) {
                                             $empsalarydetailsform->salarytype->addMultiOption($payfreqres['id'], $payfreqres['freqtype']);
                                         }
                                     }
                                 }
                                 $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');
     }
 }
예제 #3
0
 public function addpopupAction()
 {
     $msgarray = array();
     $emptyFlag = '';
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     $controllername = 'jobtitles';
     $jobtitlesform = new Default_Form_jobtitles();
     $jobtitlesmodel = new Default_Model_Jobtitles();
     $payfrequencyModal = new Default_Model_Payfrequency();
     $payfreqData = $payfrequencyModal->getActivePayFreqData();
     $jobtitlesform->setAction(DOMAIN . 'jobtitles/addpopup');
     if (sizeof($payfreqData) > 0) {
         foreach ($payfreqData as $payfreqres) {
             $jobtitlesform->jobpayfrequency->addMultiOption($payfreqres['id'], $payfreqres['freqtype']);
         }
     } else {
         $msgarray['jobpayfrequency'] = 'Pay frequency is not configured yet.';
         $emptyFlag++;
     }
     $this->view->msgarray = $msgarray;
     $this->view->emptyFlag = $emptyFlag;
     if ($this->getRequest()->getPost()) {
         if ($jobtitlesform->isValid($this->_request->getPost())) {
             $id = $this->_request->getParam('id');
             $jobtitlecode = $this->_request->getParam('jobtitlecode');
             $jobtitlename = $this->_request->getParam('jobtitlename');
             $jobdescription = $this->_request->getParam('jobdescription');
             $minexperiencerequired = $this->_request->getParam('minexperiencerequired');
             $jobpaygradecode = $this->_request->getParam('jobpaygradecode');
             $jobpayfrequency = $this->_request->getParam('jobpayfrequency');
             $comments = $this->_request->getParam('comments');
             $date = new Zend_Date();
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $data = array('jobtitlecode' => trim($jobtitlecode), 'jobtitlename' => trim($jobtitlename), 'jobdescription' => trim($jobdescription), 'minexperiencerequired' => trim($minexperiencerequired), 'jobpaygradecode' => trim($jobpaygradecode), 'jobpayfrequency' => trim($jobpayfrequency), 'comments' => trim($comments), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             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;
             }
             $Id = $jobtitlesmodel->SaveorUpdateJobTitleData($data, $where);
             $tableid = $Id;
             $menuidArr = $menumodel->getMenuObjID('/jobtitles');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             $jobtitlesData = $jobtitlesmodel->fetchAll('isactive = 1', 'jobtitlename')->toArray();
             $opt = '';
             foreach ($jobtitlesData as $record) {
                 $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['jobtitlename']);
             }
             $this->view->jobtitlesData = $opt;
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $jobtitlesform->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
             $this->view->msgarray = $msgarray;
         }
     }
     $this->view->controllername = $controllername;
     $this->view->form = $jobtitlesform;
     $this->view->ermsg = '';
 }
예제 #4
0
 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');
     }
 }