public function viewGetChucVuName($id = 0)
 {
     if ($id) {
         $chucvuModel = new Front_Model_Chucvu();
         $chuc_vu = $chucvuModel->fetchRow('cv_id=' . $id . ' and cv_status=1');
         if ($chuc_vu) {
             return $chuc_vu->cv_name;
         }
         return '';
     }
     return '';
 }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Quản lý yêu cầu cập nhật thông tin - ' . $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);
     $employeesEditModel = new Front_Model_EmployeesEdit();
     $chucvuModel = new Front_Model_Chucvu();
     $list_chuc_vu = $chucvuModel->fetchData(array('cv_status' => 1));
     $phongbanModel = new Front_Model_Phongban();
     $list_phong_ban = $phongbanModel->fetchAll();
     $pb_selected = $this->_getParam('phongban', 0);
     $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;
     }
     if (!$pb_selected) {
         $list_employees = $employeesEditModel->fetchData(array(), 'eme_date_modified DESC');
     } else {
         $list_employees = $employeesEditModel->fetchByPhongBan($pb_ids);
     }
     $paginator = Zend_Paginator::factory($list_employees);
     $paginator->setItemCountPerPage(NUM_PER_PAGE);
     $paginator->setCurrentPageNumber($this->_page);
     $this->view->page = $this->_page;
     $this->view->paginator = $paginator;
     $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->pb_id = $pb_selected;
 }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Thống kê phân loại tháng - ' . $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);
     $date = new Zend_Date();
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $chucvuModel = new Front_Model_Chucvu();
     $chuc_vu = $chucvuModel->fetchAll();
     $list_phong_ban = $phongbanModel->fetchAll();
     $pb_selected = $this->_getParam('phongban', 0);
     $phong_ban = array();
     $list_phong_ban_option = $phongbanModel->fetchData(0, $phong_ban);
     $phong_ban_choosed_info = $phongbanModel->fetchRow("pb_id={$pb_selected} and pb_status=1");
     $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;
     }
     if (!$pb_selected) {
         //$list_employees = $emModel->fetchData(array('em_delete' => 0));
         $list_employees = $emModel->callGetListNhanVien();
     } else {
         //$select = $emModel->select()->where('em_phong_ban in (?)', $pb_ids);
         $list_employees = $emModel->callGetListNhanVien($pb_ids);
     }
     $tieuchiModel = new Front_Model_TieuChiDanhGiaCB();
     $list_tieuchi = $tieuchiModel->fetchData(array('tcdgcb_status' => 1), 'tcdgcb_order ASC');
     $ketquaModel = new Front_Model_DanhGiaKetQuaCV();
     $list_ketqua = $ketquaModel->fetchData(array('dgkqcv_status' => 1), 'dgkqcv_order ASC');
     if ($this->_request->isPost()) {
         $inputFileName = APPLICATION_PATH . "/../tmp/BANG_TONG_HOP_PHAN_LOAI_THANG.xlsx";
         $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
         $styleArray = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'font' => array('bold' => false, 'color' => array('rgb' => '000000'), 'size' => 11, 'name' => 'Times New Roman'));
         $objPHPExcel->getProperties()->setCreator("Cục Hải Quan Hà Tĩnh");
         $objPHPExcel->getProperties()->setLastModifiedBy("Cục Hải Quan Hà Tĩnh");
         $objPHPExcel->getProperties()->setTitle("Thống kê tháng");
         $objPHPExcel->getProperties()->setSubject("Bảng chấm công");
         $objPHPExcel->getProperties()->setDescription("Bảng chấm công Cục Hải Quan Hà Tĩnh");
         $objPHPExcel->setActiveSheetIndex(0);
         $objPHPExcel->getActiveSheet()->SetCellValue('A5', "(Tháng {$thang} Năm {$nam})");
         $phong_ban_st = array($phong_ban_choosed_info);
         $list_phongban_selected = $phongbanModel->fetchDataStatus($pb_selected, $phong_ban_st);
         if ($list_employees) {
             $k = 0;
             $stt = 0;
             $stt_1 = 0;
             foreach ($list_phongban_selected as $phong_ban_info) {
                 $stt_1 = 0;
                 $k++;
                 $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A" . ($k + 8) . ":J" . ($k + 8));
                 $objPHPExcel->getActiveSheet()->getStyle("A" . ($k + 8))->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => 'F28A8C')));
                 $objPHPExcel->getActiveSheet()->SetCellValue('A' . ($k + 8), $phong_ban_info->pb_name);
                 foreach ($list_employees as $nhan_vien) {
                     if ($phong_ban_info->pb_id == $nhan_vien['em_phong_ban']) {
                         $phan_loai = $this->view->viewGetPhanLoai($nhan_vien['em_id'], (int) $thang, (int) $nam);
                         $pl_ptccb = '';
                         if ($phan_loai) {
                             if ($phan_loai->dg_ptccb_status != 'O') {
                                 $pl_ptccb = $phan_loai->dg_ptccb_status;
                             } else {
                                 $pl_ptccb = '-';
                             }
                         }
                         $stt_1++;
                         $k++;
                         $stt++;
                         $objPHPExcel->getActiveSheet()->SetCellValue('A' . ($k + 8), $stt);
                         $objPHPExcel->getActiveSheet()->SetCellValue('B' . ($k + 8), $stt_1);
                         $objPHPExcel->getActiveSheet()->SetCellValue('C' . ($k + 8), $nhan_vien['em_ho'] . ' ' . $nhan_vien['em_ten']);
                         $objPHPExcel->getActiveSheet()->SetCellValue('D' . ($k + 8), $nhan_vien['cv_name']);
                         switch ($pl_ptccb) {
                             case 'A':
                                 $objPHPExcel->getActiveSheet()->SetCellValue('E' . ($k + 8), 'X');
                                 break;
                             case 'B':
                                 $objPHPExcel->getActiveSheet()->SetCellValue('F' . ($k + 8), 'X');
                                 break;
                             case 'C':
                                 $objPHPExcel->getActiveSheet()->SetCellValue('G' . ($k + 8), 'X');
                                 break;
                             case 'D':
                                 $objPHPExcel->getActiveSheet()->SetCellValue('H' . ($k + 8), 'X');
                                 break;
                             case '-':
                                 $objPHPExcel->getActiveSheet()->SetCellValue('I' . ($k + 8), 'X');
                                 break;
                         }
                     }
                     $objPHPExcel->getActiveSheet()->getStyle('A' . ($k + 8) . ':J' . ($k + 8))->applyFromArray($styleArray);
                 }
             }
             $objPHPExcel->getActiveSheet()->SetCellValue('A' . ($k + 13), 'Ghi chú: Để trống là chưa phân loại hoặc chưa xét duyệt');
             $objPHPExcel->getActiveSheet()->setTitle('Thống kê phân loại tháng' . $thang . '-' . $nam);
             $file_name = 'Thong_Ke_Phan_Loai_Thang_' . $thang . '-' . $nam . '.xls';
             header('Content-type: application/vnd.ms-excel; charset=UTF-8');
             header('Content-Disposition: attachment;filename="' . $file_name . '"');
             header('Cache-Control: max-age=0');
             $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
             $objWriter->save('php://output');
             die;
         }
     }
     $this->view->tieu_chi = $list_tieuchi;
     $this->view->ket_qua = $list_ketqua;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->list_nhan_vien = $list_employees;
     $this->view->list_phong_ban = $list_phong_ban;
     $this->view->list_phong_ban_option = $list_phong_ban_option;
     $this->view->pb_id = $pb_selected;
 }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Lọc danh sách theo chức vụ - ' . $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();
     $chucvuModel = new Front_Model_Chucvu();
     $list_chuc_vu = $chucvuModel->fetchData(array('cv_status' => 1));
     $filters = array();
     if ($filter_selected) {
         $filters['em_chuc_vu'] = $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_chuc_vu;
     $this->view->filter_selected = $filter_selected;
 }
 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 intheophongAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'In lương - ' . $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);
     $date = time();
     $thang = $this->_getParam('thang', date('m', $date));
     $nam = $this->_getParam('nam', date('Y', $date));
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $chucvuModel = new Front_Model_Chucvu();
     $pb_selected = $this->_getParam('phongban', 0);
     $phong_ban_id = $list_phongban_selected = $phong_ban = array();
     $phong_ban_id[] = $pb_selected;
     $list_phongban_selected = $phongbanModel->fetchDataStatus($pb_selected, $phong_ban);
     $list_chuc_vu = $chucvuModel->fetchAll();
     $phong_ban_options = array();
     $list_phong_ban_option = $phongbanModel->fetchData(0, $phong_ban_options);
     if (sizeof($list_phongban_selected)) {
         foreach ($list_phongban_selected as $phong_ban_info) {
             $phong_ban_id[] = $phong_ban_info->pb_id;
         }
     }
     $phong_ban_id = implode(',', $phong_ban_id);
     $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
     $this->view->list_nhan_vien = $list_nhan_vien;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->pb_id = $pb_selected;
     $this->view->list_phong_ban_option = $list_phong_ban_option;
     $this->view->list_chuc_vu = $list_chuc_vu;
 }
 public function auto02Action()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Tính lương hệ số 0.2 - ' . $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);
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $my_id = $identity->em_id;
     $date = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString('M'));
     $nam = $this->_getParam('nam', $date->toString('Y'));
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $chucvuModel = new Front_Model_Chucvu();
     $hesocbModel = new Front_Model_HeSo();
     $hesoModel = new Front_Model_EmployeesHeso();
     $bangluongModel = new Front_Model_BangLuong();
     $danhgiaModel = new Front_Model_DanhGia();
     $lastHeSoLuong = $hesocbModel->fetchOneData(array('hs_ngay_bat_dau' => date("{$nam}-{$thang}-1")), 'hs_ngay_bat_dau DESC');
     $he_so_tang_them = 0.5;
     $he_so_phan_loai = array('O' => 0, 'A' => 1.2, 'B' => 1, 'C' => 0.8, 'D' => 0);
     $pb_selected = $this->_getParam('phongban', 0);
     $phong_ban_id = $list_phongban_selected = $phong_ban = array();
     $phong_ban_id[] = $pb_selected;
     $list_phongban_selected = $phongbanModel->fetchDataStatus($pb_selected, $phong_ban);
     $list_chuc_vu = $chucvuModel->fetchAll();
     $list_nhan_vien = $phong_ban_options = array();
     $list_phong_ban_option = $phongbanModel->fetchData(0, $phong_ban_options);
     if (sizeof($list_phongban_selected)) {
         foreach ($list_phongban_selected as $phong_ban_info) {
             $phong_ban_id[] = $phong_ban_info->pb_id;
         }
     }
     $phong_ban_id = implode(',', $phong_ban_id);
     if ($pb_selected) {
         $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
     }
     if ($this->_request->isPost()) {
         $item = $this->getRequest()->getPost('cid');
         foreach ($item as $k => $v) {
             $bang_luong = $bangluongModel->fetchByDate($v, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
             if ($bang_luong && $bang_luong->bl_tong_he_so > 0) {
                 $luong_toi_thieu = $bang_luong->bl_luong_toi_thieu;
                 //luong co ban
                 $tong_hs_luong_pc = $bang_luong->bl_tong_he_so;
                 $tam_chi_dau_vao = $tong_hs_luong_pc * $luong_toi_thieu * 0.5;
                 $data = array('bl_ptccb_id' => $my_id, 'bl_tam_chi_dau_vao_02' => $tam_chi_dau_vao, 'bl_02' => 1);
                 $bl_id = $bang_luong->bl_id;
                 $bangluongModel->update($data, "bl_id={$bl_id}");
             }
         }
     }
     $this->view->list_nhan_vien = $list_nhan_vien;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->pb_id = $pb_selected;
     $this->view->list_phong_ban_option = $list_phong_ban_option;
     $this->view->list_chuc_vu = $list_chuc_vu;
 }
 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;
 }
 public function heso02Action()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'In lương hệ số 0.2 - ' . $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);
     $date = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $chucvuModel = new Front_Model_Chucvu();
     $heso02Model = new Front_Model_HeSo02();
     $check_he_so_02 = $heso02Model->fetchRow("nam={$nam}");
     $pb_selected = $this->_getParam('phongban', 0);
     $phong_ban_id = $list_phongban_selected = $phong_ban = array();
     $phong_ban_id[] = $pb_selected;
     $list_phongban_selected = $phongbanModel->fetchDataStatus($pb_selected, $phong_ban);
     $list_chuc_vu = $chucvuModel->fetchAll();
     $phong_ban_options = array();
     $list_phong_ban_option = $phongbanModel->fetchData(0, $phong_ban_options);
     if (sizeof($list_phongban_selected)) {
         foreach ($list_phongban_selected as $phong_ban_info) {
             $phong_ban_id[] = $phong_ban_info->pb_id;
         }
     }
     $phong_ban_id = implode(',', $phong_ban_id);
     $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
     $this->view->list_nhan_vien = $list_nhan_vien;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->pb_id = $pb_selected;
     $this->view->list_phong_ban_option = $list_phong_ban_option;
     $this->view->list_chuc_vu = $list_chuc_vu;
     if (!$check_he_so_02) {
         $this->_helper->viewRenderer->setRender('loi02');
     }
 }
 function deleteitemsAction()
 {
     $this->_helper->layout()->disableLayout();
     $chucvuModel = new Front_Model_Chucvu();
     if ($this->_request->isPost()) {
         $item = $this->getRequest()->getPost('cid');
         foreach ($item as $k => $v) {
             $chucvuModel->delete('cv_id=' . $v);
         }
     }
     $this->_redirect('hethong/chucvu/index/page/' . $this->_page);
 }