Beispiel #1
0
 function checkNangLuong($phong_ban = array())
 {
     $date = time();
     $thang = date('m', $date);
     $nam = date('Y', $date);
     $employeesModel = new Front_Model_Employees();
     $nghachModel = new Front_Model_NgachCongChuc();
     $list_nghach = $nghachModel->fetchAll('ncc_status=1');
     $list_employees = array();
     foreach ($list_nghach as $nghach) {
         $nam_tim_kiem = $nam - $nghach->ncc_nam_nang_bac;
         $list_employees = array_merge($list_employees, $employeesModel->getNangLuong($nghach->ncc_id, $thang, $nam_tim_kiem, $phong_ban));
     }
     $list_employees = array_merge($list_employees, $employeesModel->getNangPhuCap($thang, $nam - 1, $phong_ban));
     $list_removed = array();
     foreach ($list_employees as $key_1 => $employees_1) {
         foreach ($list_employees as $key_2 => $employees_2) {
             if ($key_1 != $key_2 && $employees_1['em_id'] == $employees_2['em_id'] && !in_array($employees_1['em_id'], $list_removed)) {
                 unset($list_employees[$key_2]);
                 $list_removed[] = $employees_1['em_id'];
                 break;
             }
         }
     }
     if (sizeof($list_employees)) {
         return $list_employees;
     }
     return 0;
 }
 public function viewGetNgachCongChuc($id = 0)
 {
     if ($id) {
         $ngachcongchucModel = new Front_Model_NgachCongChuc();
         $ngachcongchuc = $ngachcongchucModel->fetchRow('ncc_id=' . $id . ' and ncc_status=1');
         if ($ngachcongchuc) {
             return $ngachcongchuc;
         }
         return '';
     }
     return '';
 }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Lọc danh sách theo nghạch công chức - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => 'danhsach/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $filter_selected = $this->_getParam('id', 0);
     $emModel = new Front_Model_Employees();
     $filterModel = new Front_Model_NgachCongChuc();
     $list_filters = $filterModel->fetchData(array('ncc_status' => 1));
     $filters = array();
     if ($filter_selected) {
         $filters['em_ngach_cong_chuc'] = $filter_selected;
     }
     $list_items = $emModel->getListNhanVienDanhSachTheoChucVu($filters);
     $paginator = Zend_Paginator::factory($list_items);
     $paginator->setItemCountPerPage(NUM_PER_PAGE);
     $paginator->setCurrentPageNumber($this->_page);
     $this->view->page = $this->_page;
     $this->view->paginator = $paginator;
     $this->view->filter = $list_filters;
     $this->view->filter_selected = $filter_selected;
 }
 public function editAction()
 {
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Quản lý bậc lương - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $id = $this->_getParam('id', 0);
     $bacluongModel = new Front_Model_BacLuong();
     $nghachModel = new Front_Model_NgachCongChuc();
     $list_nghach = $nghachModel->fetchData('ncc_status=1');
     $error_message = array();
     $success_message = '';
     $bl_info = $bacluongModel->fetchRow('bl_id=' . $id);
     if (!$bl_info) {
         $error_message[] = 'Không tìm thấy thông tin.';
     }
     if ($this->_request->isPost()) {
         $bl_name = trim($this->_arrParam['bl_name']);
         $bl_he_so_luong = $this->_arrParam['bl_he_so_luong'];
         $bl_status = $this->_arrParam['bl_status'];
         $bl_order = trim($this->_arrParam['bl_order']);
         if (!is_numeric($bl_order)) {
             $bl_order = 0;
         }
         $locale = new Zend_Locale('en_US');
         $valid = new Zend_Validate_Float($locale);
         foreach ($bl_he_so_luong as $he_so) {
             if (!$valid->isValid($he_so)) {
                 $error_message[0] = 'Hệ số lương phải có dạng số.';
             }
         }
         if (!sizeof($error_message)) {
             $current_time = new Zend_Db_Expr('NOW()');
             $data = array('bl_name' => $bl_name, 'bl_he_so_luong' => serialize($bl_he_so_luong), 'bl_status' => $bl_status, 'bl_order' => $bl_order, 'bl_date_added' => $current_time, 'bl_date_modified' => $current_time);
             $bacluongModel->update($data, 'bl_id=' . $id);
             $bl_info = $bacluongModel->fetchRow('bl_id=' . $id);
             $success_message = 'Đã cập nhật thông tin thành công.';
         }
     }
     $this->view->list_ngach = $list_nghach;
     $this->view->bl_info = $bl_info;
     $this->view->success_message = $success_message;
     $this->view->error_message = $error_message;
 }
 public function nangluongAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Quản lý cán bộ - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $pb_selected = $this->_getParam('phongban', 0);
     $chucvuModel = new Front_Model_Chucvu();
     $list_chuc_vu = $chucvuModel->fetchData(array('cv_status' => 1));
     $ngachcongchucModel = new Front_Model_NgachCongChuc();
     $list_ngach_cong_chuc = $ngachcongchucModel->fetchData(array('ncc_status' => 1));
     $phongbanModel = new Front_Model_Phongban();
     $list_phong_ban = $phongbanModel->fetchAll();
     $phong_ban = array();
     $list_phong_ban_option = $phongbanModel->fetchData(0, $phong_ban);
     $phong_ban_choosed = array();
     $phongbanModel->fetchData($pb_selected, $phong_ban_choosed);
     $pb_ids = array($pb_selected);
     foreach ($phong_ban_choosed as $pb) {
         $pb_ids[] = $pb->pb_id;
     }
     $list_nang_luong = $this->_helper->global->checkNangLuong();
     $this->view->pb_id = $pb_selected;
     $this->view->list_nhan_vien = $list_nang_luong;
     $this->view->list_chuc_vu = $list_chuc_vu;
     $this->view->list_phong_ban = $list_phong_ban;
     $this->view->list_phong_ban_option = $list_phong_ban_option;
     $this->view->list_ngach_cong_chuc = $list_ngach_cong_chuc;
 }
 public function formnghihuuAction()
 {
     $this->_helper->layout()->disableLayout();
     $emID = $this->_getParam('id', 0);
     $emModel = new Front_Model_Employees();
     $em_info = $emModel->fetchRow('em_id =' . $emID);
     $chucvuModel = new Front_Model_Chucvu();
     $list_chuc_vu = $chucvuModel->fetchData(array('cv_status' => 1));
     $ngachcongchucModel = new Front_Model_NgachCongChuc();
     $list_ngach_cong_chuc = $ngachcongchucModel->fetchData(array('ncc_status' => 1));
     $phongbanModel = new Front_Model_Phongban();
     $list_phong_ban = $phongbanModel->fetchAll('pb_status=1');
     $error_message = array();
     $success_message = '';
     if ($this->_request->isPost()) {
         $current_time = new Zend_Db_Expr('NOW()');
         $data = array();
         $data['em_nghi_huu'] = 1;
         $data['em_ngay_nghi_huu'] = $current_time;
         $success_message = $emModel->update($data, 'em_id=' . $emID);
         if ($success_message) {
             $thongbao_model = new Front_Model_ThongBao();
             $data = array();
             $data['tb_from'] = 0;
             $data['tb_to'] = $emID;
             $data['tb_tieu_de'] = '[Nghỉ hưu] Bạn vừa được duyệt nghỉ hưu';
             $data['tb_noi_dung'] = 'Phòng tổ chức vừa chuyển trạng thái của bạn sang nghỉ hưu.';
             $data['tb_status'] = 0;
             $data['tb_date_added'] = $current_time;
             $data['tb_date_modified'] = $current_time;
             $thongbao_model->insert($data);
         }
         $em_info = $emModel->fetchRow('em_id =' . $emID);
     }
     $this->view->error_message = $error_message;
     $this->view->success_message = $success_message;
     $this->view->em_id = $emID;
     $this->view->employee_info = $em_info;
     $this->view->list_chuc_vu = $list_chuc_vu;
     $this->view->list_phong_ban = $list_phong_ban;
     $this->view->list_ngach_cong_chuc = $list_ngach_cong_chuc;
 }
 function deleteitemsAction()
 {
     $this->_helper->layout()->disableLayout();
     $ngachcongchucModel = new Front_Model_NgachCongChuc();
     if ($this->_request->isPost()) {
         $item = $this->getRequest()->getPost('cid');
         foreach ($item as $k => $v) {
             $ngachcongchucModel->delete('ncc_id=' . $v);
         }
     }
     $this->_redirect('hethong/ngachcongchuc/index/page/' . $this->_page);
 }