public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Duyệt đánh giá phân loại - ' . $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"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $emModel = new Front_Model_Employees();
     $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 = $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');
     $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 = 'Duyệt đánh giá phân loại - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => 'donvi/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"));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $my_info = $emModel->fetchRow('em_id=' . $em_id . ' and em_status=1');
     $phong_ban_id = $list_phongban = $phong_ban = array();
     if ($my_info) {
         $phong_ban_id[] = $my_info->em_phong_ban;
         $list_phongban = $phongbanModel->fetchDataStatus($my_info->em_phong_ban, $phong_ban);
     }
     if (sizeof($list_phongban)) {
         foreach ($list_phongban as $phong_ban_info) {
             $phong_ban_id[] = $phong_ban_info->pb_parent;
         }
     }
     $phong_ban_id = implode(',', $phong_ban_id);
     $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1");
     $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');
     $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_nhan_vien;
 }
 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;
 }
Exemplo n.º 4
0
 function deleteitemsAction()
 {
     $this->_helper->layout()->disableLayout();
     $ketquaModel = new Front_Model_DanhGiaKetQuaCV();
     if ($this->_request->isPost()) {
         $item = $this->getRequest()->getPost('cid');
         foreach ($item as $k => $v) {
             $ketquaModel->delete('dgkqcv_id=' . $v);
         }
     }
     $this->_redirect('hethong/ketqua/index/page/' . $this->_page);
 }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Tự đánh giá phân loại - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => 'canhan/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $this->view->page = $this->_page;
     $date = new Zend_Date();
     $date->subMonth(1);
     $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;
     $danhgiaModel = new Front_Model_DanhGia();
     $danh_gia = $danhgiaModel->fetchOneData(array('dg_em_id' => $em_id, 'dg_thang' => $thang, 'dg_nam' => $nam));
     $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');
     $error_message = array();
     $success_message = '';
     if ($this->_request->isPost()) {
         $cong_viec = $this->_arrParam['d_cong_viec'];
         $kq_cong_viec = $this->_arrParam['d_kq_cong_viec'];
         $ngay_nghi = $this->_arrParam['d_ngay_nghi'];
         $ly_do_nghi = $this->_arrParam['d_ly_do'];
         $y_thuc_tn = $this->_arrParam['d_y_thuc'];
         $khuyet_diem = $this->_arrParam['d_khuyet_diem'];
         $tc_danh_gia = serialize($this->_arrParam['d_tieu_chi']);
         $ghi_chu = $this->_arrParam['d_ghi_chu'];
         $phan_loai = $this->_arrParam['d_phan_loai'];
         $current_time = new Zend_Db_Expr('NOW()');
         if ($danh_gia && ($danh_gia->dg_don_vi_status != '' || $danh_gia->dg_ptccb_status != '')) {
             $error_message[] = 'Đánh giá phân loại đã được duyệt nên không thể thay đổi.';
         }
         if (!$cong_viec) {
             $error_message[] = 'Công việc trong tháng không được để trống';
         }
         if (!sizeof($error_message)) {
             if ($danh_gia) {
                 $danhgiaModel->update(array('dg_cong_viec' => $cong_viec, 'dg_ket_qua_cong_viec' => $kq_cong_viec, 'dg_so_ngay_nghi' => $ngay_nghi, 'dg_ly_do_nghi' => $ly_do_nghi, 'dg_y_thuc_xay_dung' => $y_thuc_tn, 'dg_khuyet_diem' => $khuyet_diem, 'dg_tc_danh_gia' => $tc_danh_gia, 'dg_ghi_chu' => $ghi_chu, 'dg_phan_loai' => $phan_loai, 'dg_date_modifyed' => $current_time), 'dg_id=' . $danh_gia->dg_id);
             } else {
                 $danhgiaModel->insert(array('dg_em_id' => $em_id, 'dg_thang' => $thang, 'dg_nam' => $nam, 'dg_cong_viec' => $cong_viec, 'dg_ket_qua_cong_viec' => $kq_cong_viec, 'dg_so_ngay_nghi' => $ngay_nghi, 'dg_ly_do_nghi' => $ly_do_nghi, 'dg_y_thuc_xay_dung' => $y_thuc_tn, 'dg_khuyet_diem' => $khuyet_diem, 'dg_tc_danh_gia' => $tc_danh_gia, 'dg_ghi_chu' => $ghi_chu, 'dg_phan_loai' => $phan_loai, 'dg_date_modifyed' => $current_time, 'dg_date_created' => $current_time));
             }
         }
         $users = $this->_helper->GlobalHelpers->checkDonViUsers($em_id, 3005);
         $thongbao_model = new Front_Model_ThongBao();
         $data = array();
         $data['tb_from'] = 0;
         $data['tb_tieu_de'] = '[Thông báo] Duyệt đánh giá phân loại.';
         $data['tb_noi_dung'] = 'Có khai báo đánh giá phân loại mới.<br/> Bạn hãy <strong><a href="' . $this->view->baseUrl('donvi/duyetphanloai') . '">click vào đây</a></strong> để xét duyệt.';
         $data['tb_status'] = 0;
         $data['tb_date_added'] = $current_time;
         $data['tb_date_modified'] = $current_time;
         foreach ($users as $user) {
             $data['tb_to'] = $user->em_id;
             $thongbao_model->insert($data);
         }
         $success_message = 'Đã cập nhật thành công.';
         $danh_gia = $danhgiaModel->fetchOneData(array('dg_em_id' => $em_id, 'dg_thang' => $thang, 'dg_nam' => $nam));
     }
     if ($danh_gia) {
         $this->_arrParam['d_cong_viec'] = $danh_gia->dg_cong_viec;
         $this->_arrParam['d_kq_cong_viec'] = $danh_gia->dg_ket_qua_cong_viec;
         $this->_arrParam['d_ngay_nghi'] = $danh_gia->dg_so_ngay_nghi;
         $this->_arrParam['d_ly_do'] = $danh_gia->dg_ly_do_nghi;
         $this->_arrParam['d_y_thuc'] = $danh_gia->dg_y_thuc_xay_dung;
         $this->_arrParam['d_khuyet_diem'] = $danh_gia->dg_khuyet_diem;
         $this->_arrParam['d_tieu_chi'] = unserialize($danh_gia->dg_tc_danh_gia);
         $this->_arrParam['d_ghi_chu'] = $danh_gia->dg_ghi_chu;
         $this->_arrParam['d_phan_loai'] = $danh_gia->dg_phan_loai;
     }
     $this->view->tieu_chi = $list_tieuchi;
     $this->view->ket_qua = $list_ketqua;
     $this->view->success_message = $success_message;
     $this->view->error_message = $error_message;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->danh_gia = $danh_gia;
     $this->view->arrParam = $this->_arrParam;
 }