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 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;
 }
예제 #3
0
 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;
 }
예제 #4
0
 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');
     }
 }