public function pdfthongkeAction()
    {
        $translate = Zend_Registry::get('Zend_Translate');
        $this->view->title = 'Thống kê - ' . $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();
        $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");
        $holidaysModel = new Front_Model_Holidays();
        $holidays = $holidaysModel->fetchData();
        $listHoliday = array();
        foreach ($holidays as $holiday) {
            $listHoliday[$holiday['hld_id']] = $holiday['hld_code'];
        }
        $k = 0;
        if ($list_nhan_vien) {
            $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
            $pdf->SetCreator(PDF_CREATOR);
            $pdf->SetAuthor(PDF_AUTHOR);
            $pdf->SetTitle(PDF_HEADER_TITLE);
            $pdf->SetSubject(PDF_HEADER_TITLE);
            $pdf->SetKeywords('bang luong');
            $pdf->setPrintHeader(false);
            $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
            $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
            $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
            $pdf->SetMargins(5, PDF_MARGIN_TOP, 5);
            $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
            $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
            $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
            $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
            $pdf->setFontSubsetting(true);
            $pdf->SetFont('dejavusans', '', 14, '', true);
            $pdf->AddPage('L', 'A4');
            $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
            $text_outout = '
                        <style>
                            .ten-co-quan {
                                color: #000;
                                font-size: 10pt;
                                height: 50px;
                                text-align:center;
                            }
                            .ten-bang-luong{
                                height: 30px;
                                text-align:center;
                                font-size: 10pt;
                            }

                            table.first {
                                color: #003300;
                                font-family: helvetica;
                                font-size: 8pt;
                                border-left: 3px solid red;
                                border-right: 3px solid #FF00FF;
                                border-top: 3px solid green;
                                border-bottom: 3px solid blue;
                                background-color: #ccffcc;
                            }
                            .borders {
                                border: 1px solid #000;
                                font-size: 10px;
                            }

                            .tieu-de{
                                height: 20px;
                                font-size: 11px;
                            }
                            .noi-dung{
                                font-size: 10px;
                            }
                            td.second {
                                border: 2px dashed green;
                            }

                            .lowercase {
                                text-transform: lowercase;
                            }
                            .uppercase {
                                text-transform: uppercase;
                            }
                            .capitalize {
                                text-transform: capitalize;
                            }
                            
                            .error{
                                background-color: #dddddd;
                            }
                        </style>
                        <table width="100%">
                            <tr>
                                <td width="200" class="ten-co-quan uppercase">
                                    TỔNG CỤC HẢI QUAN
                                    <div><strong>CỤC HẢI QUAN HÀ TĨNH</strong></div>
                                </td>
                                <td colspan="2">&nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="3" class="ten-bang-luong uppercase">BẢNG CHẤM CÔNG VÀ XẾP LOẠI A,B,C THÁNG ' . $thang . '-' . $nam . '</td>
                            </tr>';
            $text_outout .= '<tr>
                                <td colspan="3">
                                    <br/>
                                    <table border="1" class="noi-dung" cellpadding="5" nobr="true">
                                        <tr>
                                            <td style="width: 25pt;" rowspan="2"><strong>STT</strong></td>
                                            <td style="width: 70pt;" rowspan="2"><strong>HỌ TÊN</strong></td>
                                            <td colspan="31" style="text-align:center;"><strong>Ngày Công Trong Tháng</strong></td>
                                            <td style="width: 50pt;" rowspan="2"><strong>Phân loại A,B,C</strong></td>
                                            <td style="width: 50pt;" rowspan="2"><strong>Ghi chú</strong></td>
                                        </tr>
                                        <tr>';
            for ($i = 1; $i <= 31; $i++) {
                $text_outout .= '<td >' . $i . '</td>';
            }
            $text_outout .= '</tr>';
            $k = 0;
            $chamcongModel = new Front_Model_ChamCong();
            foreach ($list_nhan_vien as $nhan_vien) {
                $phan_loai_label = 'A';
                $phan_loai = $this->view->viewGetPhanLoai($nhan_vien->em_id, $thang, $nam);
                if ($phan_loai) {
                    $phan_loai_label = $phan_loai->dg_ptccb_status;
                    if (!$phan_loai_label || $phan_loai_label == null || $phan_loai_label == '-') {
                        $phan_loai_label = 'A';
                    }
                } else {
                    $phan_loai_label = '';
                }
                $text_outout .= '<tr>';
                $k++;
                $cham_cong = $chamcongModel->fetchOneData(array('c_em_id' => $nhan_vien['em_id'], 'c_thang' => (int) $thang, 'c_nam' => (int) $nam));
                $text_outout .= '<td>' . $k . '</td>';
                $text_outout .= '<td>' . $nhan_vien->em_ho . ' ' . $nhan_vien->em_ten_dem . ' ' . $nhan_vien->em_ten . '</td>';
                for ($i = 1; $i <= 31; $i++) {
                    $ngay_chamcong = 'c_ngay_' . $i;
                    $trangthai_ngaycong = $cham_cong->{$ngay_chamcong};
                    $status = !empty($listHoliday[$trangthai_ngaycong]) ? $listHoliday[$trangthai_ngaycong] : '&nbsp;';
                    $text_outout .= '<td ' . $this->view->viewCheckChuNhatThuBay($i, (int) $thang, (int) $nam) . '>' . $status . '</td>';
                }
                $text_outout .= '<td>' . $phan_loai_label . '</td>';
                $text_outout .= '<td></td>';
                $text_outout .= '</tr>';
            }
            $text_outout .= '</table>
                                </td>
                            </tr>';
            $text_outout .= '</table>
                                </td>
                            </tr>';
            $text_outout .= '<tr><td style=""></td><td style="width: 120pt;">&nbsp;</td><td style="width: 50pt;">&nbsp;</td></tr>';
            foreach ($holidays as $holiday) {
                $text_outout .= '<tr class="noi-dung"><td style="width: 32pt;"></td><td style="width: 70pt;">' . $holiday['hld_name'] . '</td><td style="width: 50pt;">' . $holiday['hld_code'] . '</td></tr>';
            }
            $text_outout .= '</table> ';
            $pdf->writeHTMLCell(0, 0, '', '', $text_outout, 0, 1, 0, true, '', true);
            $pdf->Output($file_name, 'I');
            die;
            $k += 5;
            foreach ($holidays as $holiday) {
                $k++;
                $objPHPExcel->getActiveSheet()->SetCellValue('B' . ($k + 7), $holiday['hld_name']);
                $objPHPExcel->getActiveSheet()->SetCellValue('C' . ($k + 7), $holiday['hld_code']);
            }
            if ($k) {
                $objPHPExcel->getActiveSheet()->setTitle('Bảng lương');
                if ($pb_selected && $phong_ban_selected_info) {
                    $file_name = 'Thong_ke_luong_' . str_replace(' ', '_', $this->loc_tieng_viet($phong_ban_selected_info->pb_name)) . '_' . $thang . '-' . $nam . '.xls';
                } else {
                    $file_name = 'Thong_ke_luong_' . $thang . '-' . $nam . '.xls';
                }
                header('Content-Type: application/vnd.ms-excel');
                header('Content-Disposition: attachment;
                filename = "' . $file_name . '"');
                header('Cache-Control: max-age = 0');
                $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
                $objWriter->save('php://output');
                die;
                /*
                                  $file_name = 'Bang_luong_.xls';
                                  $objPHPExcel->getActiveSheet()->setTitle('Bảng lương');
                
                                  header('Content-Type: application/vnd.ms-excel');
                                  header('Content-Disposition: attachment;filename="hungnm.xls"');
                                  header('Cache-Control: max-age=0');
                                  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
                                  $objWriter->save('php://output'); */
            } else {
                $this->_helper->viewRenderer->setRender('loi');
            }
        } else {
            $this->_helper->viewRenderer->setRender('loi');
        }
    }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Danh sách thành viên - ' . $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);
     $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->getListNhanVienTheoChucVu($phong_ban_id);
     $this->view->list_nhan_vien = $list_nhan_vien;
 }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Duyệt chấm cô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();
     $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");
     $this->view->list_nhan_vien = $list_nhan_vien;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
 }
示例#4
0
 function __construct()
 {
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $employeeModel = new Front_Model_Employees();
     $employeeInfo = $employeeModel->fetchRow('em_id=' . $identity->em_id);
     $this->_employee_info = $employeeInfo;
     $this->_identity = $identity;
 }
 public function viewGetEmployeeInfo($id = 0)
 {
     if ($id) {
         $employeeModel = new Front_Model_Employees();
         $employee = $employeeModel->fetchRow('em_id=' . $id);
         if ($employee) {
             return $employee;
         }
         return false;
     }
     return false;
 }
示例#6
0
 public function viewGetName($id)
 {
     if ($id) {
         $employeeModel = new Front_Model_Employees();
         $employee = $employeeModel->fetchRow('em_id=' . $id);
         if ($employee) {
             $fullname = trim($employee->em_ho);
             $fullname .= ' ' . trim($employee->em_ten);
             return $fullname;
         }
         return '';
     }
     return '';
 }
示例#7
0
 public function checkDonViUsers($user_id = 0, $permission = 0)
 {
     $users = $groups = array();
     $groupsModel = new Front_Model_Groups();
     $employeeModel = new Front_Model_Employees();
     $list_groups = $groupsModel->getGroupByPermission($permission);
     $employeeInfo = $employeeModel->fetchRow('em_id=' . $user_id);
     if ($list_groups) {
         foreach ($list_groups as $group) {
             $groups[] = $group->group_id;
         }
         $users = $employeeModel->getUsersByGroupsAndPhong($groups, $employeeInfo->em_phong_ban);
     }
     return $users;
 }
 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 = 'Duyệt đơn xin nghỉ phép - ' . $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);
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $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();
     $xnpModel = new Front_Model_XinNghiPhep();
     $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");
     $list_nhan_vien_id = array();
     foreach ($list_nhan_vien as $nhan_vien) {
         $list_nhan_vien_id[] = $nhan_vien->em_id;
     }
     $list_nghi_phep = $xnpModel->fetchByDate($list_nhan_vien_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $this->view->list_nghi_phep = $list_nghi_phep;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
 }
 public function heso03Action()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Tính 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 = new Zend_Date();
     $date->subMonth(1);
     $thang = $this->_getParam('thang', $date->toString("M"));
     $nam = $this->_getParam('nam', $date->toString("Y"));
     $em_id = $this->_getParam('id', 0);
     $emModel = new Front_Model_Employees();
     $hesocbModel = new Front_Model_HeSo();
     $hesoModel = new Front_Model_EmployeesHeso();
     $phucapModel = new Front_Model_EmployeesPhuCap();
     $em_info = $emModel->fetchRow("em_id={$em_id}");
     $em_he_so = $hesoModel->getCurrentHeSo($thang, $nam, $em_id);
     $em_phu_cap = $phucapModel->getCurrentHeSo($thang, $nam, $em_id);
     $lastHeSoLuong = $hesocbModel->fetchOneData(array('hs_ngay_bat_dau' => date("{$nam}-{$thang}-1")), 'hs_ngay_bat_dau DESC');
     $bangluongModel = new Front_Model_BangLuong();
     $bang_luong = $bangluongModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $ketquaModel = new Front_Model_DanhGia();
     $phan_loai = $ketquaModel->getPhanLoai($em_id, $thang, $nam);
     $this->view->em_info = $em_info;
     $this->view->he_so = $em_he_so;
     $this->view->phu_cap = $em_phu_cap;
     $this->view->he_so_cb = $lastHeSoLuong;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->nv_id = $em_id;
     $this->view->bang_luong = $bang_luong;
     $this->view->phan_loai = $phan_loai;
     if ($nam > $date->toString("Y") || $nam == $date->toString("Y") && $thang > $date->toString("M")) {
         $this->_helper->viewRenderer->setRender('thoigian');
     }
 }
 public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'In khai báo làm thêm giờ - ' . $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);
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $date = new Zend_Date();
     $ngay = $this->_getParam('ngay', $date->toString('d'));
     $thang = $this->_getParam('thang', $date->toString('M'));
     $nam = $this->_getParam('nam', $date->toString('Y'));
     $ltg_date = $ngay . '/' . $thang . '/' . $nam;
     $emModel = new Front_Model_Employees();
     $phongbanModel = new Front_Model_Phongban();
     $ltgModel = new Front_Model_LamThemGio();
     if ($this->_request->isPost()) {
         $inputFileName = APPLICATION_PATH . "/../tmp/MAU_LAM_THEM_GIO.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('A6', "(Ngày {$ltg_date})");
         $item = $this->getRequest()->getPost('cid');
         $k = 8;
         foreach ($item as $v) {
             $ltg = $ltgModel->fetchRow('ltg_id=' . $v);
             if ($ltg) {
                 $k++;
                 $em_info = $this->view->viewGetEmployeeInfo($ltg->ltg_em_id);
                 $objPHPExcel->getActiveSheet()->SetCellValue('A' . $k, $k - 8);
                 $objPHPExcel->getActiveSheet()->SetCellValue('B' . $k, $em_info->em_ho . ' ' . $em_info->em_ten);
                 $objPHPExcel->getActiveSheet()->SetCellValue('C' . $k, strip_tags($ltg->ltg_chi_tiet));
                 $objPHPExcel->getActiveSheet()->getStyle('C' . $k)->getAlignment()->setWrapText(true);
                 $tong_gio = 0;
                 $tong_phut = 0;
                 if ($ltg->ltg_gio_bat_dau) {
                     $tong_gio += $ltg->ltg_gio_ket_thuc - $ltg->ltg_gio_bat_dau;
                     if ($ltg->ltg_phut_ket_thuc < $ltg->ltg_phut_bat_dau) {
                         $tong_gio--;
                         $tong_phut += $ltg->ltg_phut_bat_dau - $ltg->ltg_phut_ket_thuc;
                     } else {
                         $tong_phut += $ltg->ltg_phut_ket_thuc - $ltg->ltg_phut_bat_dau;
                     }
                 }
                 if ($ltg->ltg_gio_bat_dau_chieu) {
                     $tong_gio += $ltg->ltg_gio_ket_thuc_chieu - $ltg->ltg_gio_bat_dau_chieu;
                     if ($ltg->ltg_phut_ket_thuc_chieu < $ltg->ltg_phut_bat_dau_chieu) {
                         $tong_gio--;
                         $tong_phut += $ltg->ltg_phut_bat_dau_chieu - $ltg->ltg_phut_ket_thuc_chieu;
                     } else {
                         $tong_phut += $ltg->ltg_phut_ket_thuc_chieu - $ltg->ltg_phut_bat_dau_chieu;
                     }
                 }
                 if ($tong_phut >= 60) {
                     $tong_gio++;
                     $tong_phut = $tong_phut - 60;
                 }
                 $str_gio_bat_dau = '';
                 if ($ltg->ltg_gio_bat_dau && $ltg->ltg_gio_bat_dau_chieu) {
                     $str_gio_bat_dau = $ltg->ltg_gio_bat_dau . ":" . $ltg->ltg_phut_bat_dau . "\n" . $ltg->ltg_gio_bat_dau_chieu . ":" . $ltg->ltg_phut_bat_dau_chieu;
                 } elseif ($ltg->ltg_gio_bat_dau) {
                     $str_gio_bat_dau = $ltg->ltg_gio_bat_dau . ':' . $ltg->ltg_phut_bat_dau;
                 } elseif ($ltg->ltg_gio_bat_dau_chieu) {
                     $str_gio_bat_dau = $ltg->ltg_gio_bat_dau_chieu . ':' . $ltg->ltg_phut_bat_dau_chieu;
                 }
                 $str_gio_key_thuc = '';
                 if ($ltg->ltg_gio_ket_thuc && $ltg->ltg_gio_ket_thuc_chieu) {
                     $str_gio_key_thuc = $ltg->ltg_gio_ket_thuc . ":" . $ltg->ltg_phut_ket_thuc . "\n" . $ltg->ltg_gio_ket_thuc_chieu . ":" . $ltg->ltg_phut_ket_thuc_chieu;
                 } elseif ($ltg->ltg_gio_ket_thuc) {
                     $str_gio_key_thuc = $ltg->ltg_gio_ket_thuc . ':' . $ltg->ltg_phut_ket_thuc;
                 } elseif ($ltg->ltg_gio_ket_thuc_chieu) {
                     $str_gio_key_thuc = $ltg->ltg_gio_ket_thuc_chieu . ':' . $ltg->ltg_phut_ket_thuc_chieu;
                 }
                 $objPHPExcel->getActiveSheet()->getCell('D' . $k)->setValue($str_gio_bat_dau);
                 $objPHPExcel->getActiveSheet()->getStyle('D' . $k)->getAlignment()->setWrapText(true);
                 $objPHPExcel->getActiveSheet()->getCell('E' . $k)->setValue($str_gio_key_thuc);
                 $objPHPExcel->getActiveSheet()->getStyle('E' . $k)->getAlignment()->setWrapText(true);
                 $objPHPExcel->getActiveSheet()->getCell('F' . $k)->setValue($tong_gio . ':' . $tong_phut);
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $k . ':G' . $k)->applyFromArray($styleArray);
             }
         }
         $objPHPExcel->getActiveSheet()->setTitle('Làm thêm giờ');
         $file_name = 'Lam_Them_Gio_' . $ngay . '-' . $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;
     }
     $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");
     $list_nhan_vien_id = array();
     foreach ($list_nhan_vien as $nhan_vien) {
         $list_nhan_vien_id[] = $nhan_vien->em_id;
     }
     $list_lam_them_gio = $ltgModel->fetchByDate($list_nhan_vien_id, "{$nam}-{$thang}-{$ngay} 00:00:00", "{$nam}-{$thang}-{$ngay} 23:59:59");
     $this->view->lam_them_gio = $list_lam_them_gio;
     $this->view->ltg_date = $ltg_date;
     $this->view->ngay = $ngay;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
 }
    public function mau2cAction()
    {
        $translate = Zend_Registry::get('Zend_Translate');
        $this->view->title = 'Quản lý tài khoản - ' . $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);
        $auth = Zend_Auth::getInstance();
        $identity = $auth->getIdentity();
        $employeeModel = new Front_Model_Employees();
        $em_info = $employeeModel->fetchRow('em_id=' . $identity->em_id);
        $file_name = $this->loc_tieng_viet($em_info->em_ho) . '_' . $this->loc_tieng_viet($em_info->em_ten) . '.pdf';
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor(PDF_AUTHOR);
        $pdf->SetTitle(PDF_HEADER_TITLE);
        $pdf->SetSubject(PDF_HEADER_TITLE);
        $pdf->SetKeywords(PDF_HEADER_TITLE, PDF_AUTHOR);
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $pdf->SetMargins(PDF_MARGIN_LEFT, 12, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $pdf->setFontSubsetting(true);
        $pdf->SetFont('dejavusans', '', 9, '', true);
        $pdf->AddPage();
        $html = <<<EOF
<!-- EXAMPLE OF CSS STYLE -->
<style>
    p.top_co_quan{
        line-height: 20px;
    }
    p.title_so_yeu{
        text-transform: uppercase;
        font-size: 11px;
        font-weight: bold;
        text-align: center;
    }
    td{
        padding: 0;
        margin: 0;
        line-height: 20px;
        
    }
    td.td_anh{
        border: 1px solid #000;
    }
    
    tr.content_row > td{
        line-height: 25px;
        vertical-align: bottom;
        padding-top: 20px;
    }
</style>

<p class="top_co_quan">
Cơ quan, đơn vị có thẩm quyền quản lý CBCC .......................................................................................................<br />
Cơ quan, đơn vị sử dụng CBCC ..............................................................................................................................
</p>

<p class="title_so_yeu">SƠ YẾU LÝ LỊCH CÁN BỘ, CÔNG CHỨC</p>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td cellpadding="0" cellspacing="0">
            <br/>
            <table border="0" cellpadding="5" cellspacing="0" width="100%">
                <tr width="100%">
                    <td rowspan="5" align="center" width="100px" height="150px" class="td_anh">Ảnh 4x6 cm</td>
                    <td width="400px">1) Họ và tên khai sinh: NGUYỄN MẠNH HÙNG: </td>
                </tr>
                <tr>
                    <td>2) Tên gọi khác: .............................................................................................................</td>
                </tr>
                <tr>
                    <td>
                        <br />
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td width="25%">
                                    <br />
                                    3) Sinh ngày: .........
                                </td>
                                <td width="18%">
                                    <br />  
                                    tháng .............
                                </td>
                                <td width="18%">
                                    <br />
                                    năm .............,
                                </td>
                                <td width="39%">
                                    <br />
                                    Giới tính (nam, nữ): .....................
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <br />
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td width="44%">
                                    <br />
                                    4) Nơi sinh: Xã ..................................,
                                </td>
                                <td width="28%">
                                    <br />  
                                    Huyện ..........................,
                                </td>
                                <td width="28%">
                                    <br />
                                    Tỉnh ..............................
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <br />
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td width="44%">
                                    <br />
                                    4) Quê quán: Xã ................................,
                                </td>
                                <td width="28%">
                                    <br />  
                                    Huyện ..........................,
                                </td>
                                <td width="28%">
                                    <br />
                                    Tỉnh ..............................
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>            
        </td>
    </tr>
    <tr class="content_row">
        <td>
            <br/>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td width="250px">6) Dân tộc: .................................................................</td>
                    <td width="250px">7) Tôn giáo: .................................................................</td>
                </tr>
            </table>
        </td>
    </tr> 
    <tr class="content_row">
        <td>
            <br />
            8) Nơi đăng ký bộ khẩu thường trú: ....................................................................................................................
            <br />
            (Số nhà, đường phố, thành phố, xóm, thôn, xã, huyện, tỉnh)
        </td>
    </tr>
    <tr class="content_row">
        <td>
            <br />
            9) Nơi ở hiện nay: ...............................................................................................................................................
            <br />
            (Số nhà, đường phố, thành phố, xóm, thôn, xã, huyện, tỉnh)
        </td>
    </tr>
    <tr class="content_row">
        <td>
            <br />
            10) Nghề nghiệp khi được tuyển dụng: ...............................................................................................................
        </td>
    </tr>
    <tr class="content_row">
        <td>
            <br/>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td width="45%">11) Ngày tuyển dụng: ...........................................</td>
                    <td width="55%">Cơ quan tuyển dụng: ...........................................................</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr class="content_row">
        <td>
            <br />
            12) Chức vụ (chức danh) hiện tại: .......................................................................................................................
            <br />
            (Về chính quyền hoặc Đảng, đoàn thể, kể cả chức vụ kiêm nhiệm)
        </td>
    </tr>
    <tr class="content_row">
        <td>
            <br />
            13) Công việc chính được giao: ...........................................................................................................................
        </td>
    </tr>
    <tr class="content_row">
        <td>
            <br/>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td width="45%">14) Ngày tuyển dụng: ...........................................</td>
                    <td width="55%">Cơ quan tuyển dụng: ...........................................................</td>
                </tr>
            </table>
        </td>
    </tr>
</table>
EOF;
        $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
        $pdf->Output($file_name, 'I');
        die;
    }
 public function phucapAction()
 {
     $this->_helper->layout()->disableLayout();
     $date = time();
     $thang = $this->_getParam('thang', date('m', $date));
     $nam = $this->_getParam('nam', date('Y', $date));
     $em_id = $this->_getParam('id', 0);
     $emModel = new Front_Model_Employees();
     $em_info = $emModel->fetchRow("em_id={$em_id}");
     $phucapModel = new Front_Model_EmployeesPhuCap();
     $he_so = $phucapModel->getCurrentHeSo($thang, $nam, $em_id);
     $error_message = array();
     $success_message = '';
     if ($this->_request->isPost()) {
         $update_em_id = $this->_request->getParam('pc_cap_nhat_pc_em_id', 0);
         $eh_pc_cong_viec = $this->_request->getParam('eh_pc_cong_viec', 0);
         $eh_pc_trach_nhiem = $this->_request->getParam('eh_pc_trach_nhiem', 0);
         $eh_pc_kv = $this->_request->getParam('eh_pc_kv', 0);
         $eh_tnvk_thang = $this->_request->getParam('eh_tnvk_thang', 0);
         $eh_tnvk_nam = $this->_request->getParam('eh_tnvk_nam', 0);
         $eh_pc_tnvk_phan_tram = $this->_request->getParam('eh_pc_tnvk_phan_tram', 0);
         $eh_pc_udn_phan_tram = $this->_request->getParam('eh_pc_udn_phan_tram', 0);
         $eh_pc_cong_vu_phan_tram = $this->_request->getParam('eh_pc_cong_vu_phan_tram', 0);
         $eh_pc_kiem_nhiem = $this->_request->getParam('eh_pc_kiem_nhiem', 0);
         $eh_pc_khac = $this->_request->getParam('eh_pc_khac', 0);
         $eh_pc_thu_hut = $this->_request->getParam('eh_pc_thu_hut', 0);
         $eh_pc_khac_type = $this->_request->getParam('eh_pc_khac_type', 0);
         $eh_pc_doc_hai = $this->_request->getParam('eh_pc_doc_hai', 0);
         $eh_pc_doc_hai_type = $this->_request->getParam('eh_pc_doc_hai_type', 0);
         $eh_tham_nien_thang = $this->_request->getParam('eh_tham_nien_thang', 0);
         $eh_tham_nien_nam = $this->_request->getParam('eh_tham_nien_nam', 0);
         $eh_pc_tham_nien = $this->_request->getParam('eh_pc_tham_nien', 0);
         $eh_thang_ap_dung = $this->_request->getParam('eh_thang_ap_dung', 0);
         $eh_nam_ap_dung = $this->_request->getParam('eh_nam_ap_dung', 0);
         if (!is_numeric($eh_pc_thu_hut)) {
             $error_message = array('Phụ cấp thu hút phải có dạng số.');
         }
         if (!is_numeric($eh_pc_cong_viec)) {
             $error_message = array('Phụ cấp chức vụ phải có dạng số.');
         }
         if (!is_numeric($eh_pc_trach_nhiem)) {
             $error_message = array('Phụ cấp trách nhiệm phải có dạng số.');
         }
         if (!is_numeric($eh_pc_kv)) {
             $error_message = array('Phụ cấp khu vực phải có dạng số.');
         }
         if (!is_numeric($eh_pc_tnvk_phan_tram)) {
             $error_message = array('Phụ cấp thâm niên vượt khung phải có dạng số.');
         }
         if (!is_numeric($eh_pc_udn_phan_tram)) {
             $error_message = array('Phụ cấp ưu đãi nghề (%) phải có dạng số.');
         }
         if (!is_numeric($eh_pc_cong_vu_phan_tram)) {
             $error_message = array('Phụ cấp công vụ (%) phải có dạng số.');
         }
         if (!is_numeric($eh_pc_kiem_nhiem)) {
             $error_message = array('Phụ cấp kiêm nhiệm phải có dạng số.');
         }
         if (!is_numeric($eh_pc_doc_hai)) {
             $error_message = array('Phụ cấp độc hại phải có dạng số.');
         }
         if (!is_numeric($eh_pc_khac)) {
             $error_message = array('Phụ cấp khác phải có dạng số.');
         }
         if (!is_numeric($eh_pc_tham_nien)) {
             $error_message = array('Phụ cấp thâm niên phải có dạng số.');
         }
         if (!sizeof($error_message)) {
             if ($em_id != $update_em_id) {
                 $error_message = array('Có lỗi xảy ra, xin hãy tắt form này và mở lại.');
             } else {
                 $current_time = new Zend_Db_Expr('NOW()');
                 $date_tham_nien = date_create($eh_tham_nien_nam . '-' . $eh_tham_nien_thang . '-1');
                 $date_ap_dung = date_create($eh_nam_ap_dung . '-' . $eh_thang_ap_dung . '-1');
                 $data = array('eh_pc_kv' => $eh_pc_kv, 'eh_pc_thu_hut' => $eh_pc_thu_hut, 'eh_pc_cong_viec' => $eh_pc_cong_viec, 'eh_pc_trach_nhiem' => $eh_pc_trach_nhiem, 'eh_pc_tnvk_phan_tram' => $eh_pc_tnvk_phan_tram, 'eh_tham_niem' => date_format($date_tham_nien, "Y-m-d H:iP"), 'eh_pc_tham_nien' => $eh_pc_tham_nien, 'eh_pc_udn_phan_tram' => $eh_pc_udn_phan_tram, 'eh_pc_cong_vu_phan_tram' => $eh_pc_cong_vu_phan_tram, 'eh_pc_kiem_nhiem' => $eh_pc_kiem_nhiem, 'eh_pc_khac' => $eh_pc_khac, 'eh_pc_khac_type' => $eh_pc_khac_type, 'eh_pc_doc_hai' => $eh_pc_doc_hai, 'eh_pc_doc_hai_type' => $eh_pc_doc_hai_type, 'eh_date_modified' => $current_time);
                 if ($eh_tnvk_thang && $eh_tnvk_nam) {
                     $date_tnvk = date_create($eh_tnvk_nam . '-' . $eh_tnvk_thang . '-1');
                     $data['eh_pc_tnvk_time'] = date_format($date_tnvk, "Y-m-d H:iP");
                 } else {
                     $data['eh_pc_tnvk_time'] = '';
                 }
                 $he_so = $phucapModel->checkHeSo($eh_thang_ap_dung, $eh_nam_ap_dung, $em_id);
                 if (!$he_so) {
                     $data['epc_em_id'] = $update_em_id;
                     $data['eh_date_added'] = $current_time;
                     $data['eh_han_ap_dung'] = date_format($date_ap_dung, "Y-m-d H:iP");
                     $phucapModel->insert($data);
                     $he_so_id = $phucapModel->getAdapter()->lastInsertId();
                 } else {
                     $he_so_id = $he_so->epc_id;
                     $phucapModel->update($data, "epc_id={$he_so_id}");
                 }
                 $he_so = $phucapModel->fetchRow("epc_id={$he_so_id}");
                 $success_message = 'Đã cập nhật thông tin thành công.';
             }
         }
     }
     $this->view->error_message = $error_message;
     $this->view->success_message = $success_message;
     $this->view->he_so = $he_so;
     $this->view->em_id = $em_id;
     $this->view->em_info = $em_info;
 }
 public function downAction()
 {
     $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));
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $em_id = $identity->em_id;
     $emModel = new Front_Model_Employees();
     $em_info = $emModel->fetchRow("em_id={$em_id}");
     $khenthuongModel = new Front_Model_KhenThuong();
     $khen_thuong = $khenthuongModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $kyluatModel = new Front_Model_KyLuat();
     $ky_luat = $kyluatModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $bangluongModel = new Front_Model_BangLuong();
     $bang_luong = $bangluongModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     if (!$em_info || !$bang_luong) {
         $this->_helper->viewRenderer->setRender('loi');
     } else {
         $luong_toi_thieu = $bang_luong->bl_luong_toi_thieu;
         $giai_doan = $bang_luong->bl_giai_doan;
         $loai_luong = $bang_luong->bl_loai_luong;
         $luong_thu_viec = $bang_luong->bl_luong_thu_viec;
         $he_so_luong = $bang_luong->bl_hs_luong;
         $bhxh = $bang_luong->bl_bhxh;
         $bhyt = $bang_luong->bl_bhyt;
         $hs_pc_chuc_vu = $bang_luong->bl_hs_pc_cong_viec;
         $hs_pc_trach_nhiem = $bang_luong->bl_hs_pc_trach_nhiem;
         $hs_pc_khu_vuc = $bang_luong->bl_hs_pc_khu_vuc;
         $hs_pc_tnvk_phan_tram = $bang_luong->bl_hs_pc_tnvk;
         $tham_nien = $bang_luong->bl_tham_nien;
         $uu_dai_nghe = $bang_luong->bl_hs_pc_udn;
         $cong_vu = $bang_luong->bl_hs_pc_cong_vu;
         $kiem_nhiem = $bang_luong->bl_pc_kiem_nhiem;
         $hs_pc_khac = $bang_luong->bl_hs_pc_khac;
         $he_so_tang_them = $bang_luong->bl_pc_tang_them;
         $hs_pc_khac_type = $bang_luong->bl_pc_khac_type;
         $hs_pc_thu_hut_phan_tram = $bang_luong->bl_pc_thu_hut;
         $phan_loai = strtoupper($bang_luong->bl_phan_loai);
         $phan_loai_he_so = $bang_luong->bl_phan_loai_he_so;
         $luong_toi_thieu_sau_bh = (int) ($luong_toi_thieu * (100 - ($bhxh + $bhyt)) / 100);
         $luong_toi_thieu_bhyt = (int) ($luong_toi_thieu * (100 - $bhyt) / 100);
         $pc_trach_nhiem = $pc_cong_vu = $pc_khac = $pc_kiem_nhiem = $pc_uu_dai_nghe = $luong_toi_thieu;
         $pc_chuc_vu = $pc_tnvk = $pc_thu_hut = $pc_tham_nien = $luong_toi_thieu_sau_bh;
         $pc_khu_vuc = $luong_toi_thieu_bhyt;
         $thanh_tien_hsl = $luong_toi_thieu_sau_bh * $he_so_luong * $phan_loai_he_so;
         //if ($this->he_so->eh_giai_doan)
         //$hs_pc_chuc_vu = number_format ($this->he_so->eh_pc_cong_viec*(100-$luong_thu_viec)/100, 2);
         $thanh_tien_pc_chuc_vu = $hs_pc_chuc_vu * $pc_chuc_vu * $phan_loai_he_so;
         //if ($this->he_so->eh_giai_doan)
         //$hs_pc_trach_nhiem = number_format ($this->he_so->eh_pc_trach_nhiem*(100-$luong_thu_viec)/100, 2);
         $thanh_tien_pc_trach_nhiem = $hs_pc_trach_nhiem * $pc_trach_nhiem * $phan_loai_he_so;
         //if ($this->he_so->eh_giai_doan)
         //$hs_pc_khu_vuc = number_format ($this->he_so->eh_pc_kv*(100-$luong_thu_viec)/100, 2);
         $thanh_tien_pc_khu_vuc = $hs_pc_khu_vuc * $pc_khu_vuc * $phan_loai_he_so;
         $hs_pc_tnvk = ($he_so_luong + $hs_pc_chuc_vu) * $hs_pc_tnvk_phan_tram / 100;
         //if ($this->he_so->eh_giai_doan)
         //$hs_pc_tnvk = number_format ($hs_pc_tnvk*(100-$luong_thu_viec)/100, 2);
         $thanh_tien_pc_tham_nien_vuot_khung = $hs_pc_tnvk * $pc_tnvk * $phan_loai_he_so;
         $hs_pc_tham_nien = floor(($he_so_luong + $hs_pc_chuc_vu + $hs_pc_trach_nhiem) * $tham_nien / 100 * 100) / 100;
         $thanh_tien_pc_tham_nien = $hs_pc_tham_nien * $pc_tham_nien * $phan_loai_he_so;
         $hs_pc_thu_hut = floor(($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $hs_pc_thu_hut_phan_tram / 100 * 100) / 100;
         $thanh_tien_pc_thu_hut = $hs_pc_thu_hut * $pc_thu_hut * $phan_loai_he_so;
         $hs_pc_uu_dai_nghe = floor(($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $uu_dai_nghe / 100 * 100) / 100;
         $thanh_tien_pc_uu_dai_nghe = $hs_pc_uu_dai_nghe * $pc_uu_dai_nghe * $phan_loai_he_so;
         $hs_pc_cong_vu = floor(($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $cong_vu / 100 * 100) / 100;
         $thanh_tien_pc_cong_vu = $hs_pc_cong_vu * $pc_cong_vu * $phan_loai_he_so;
         $hs_pc_kiem_nhiem = floor(($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $kiem_nhiem / 100 * 100) / 100;
         $thanh_tien_pc_kiem_nhiem = $hs_pc_kiem_nhiem * $pc_kiem_nhiem * $phan_loai_he_so;
         $thanh_tien_pc_khac = $hs_pc_khac * $pc_khac;
         $hs_pc_khac_he_so = $hs_pc_khac;
         if ($hs_pc_khac_type) {
             $thanh_tien_pc_khac = $thanh_tien_pc_khac / 100;
             $hs_pc_khac_he_so = $hs_pc_khac / 100;
         }
         $thanh_tien_pc_khac = $thanh_tien_pc_khac * $phan_loai_he_so;
         $tong_1 = (int) ($thanh_tien_pc_thu_hut + $thanh_tien_hsl + $thanh_tien_pc_chuc_vu + $thanh_tien_pc_trach_nhiem + $thanh_tien_pc_khu_vuc + $thanh_tien_pc_tham_nien_vuot_khung + $thanh_tien_pc_tham_nien + $thanh_tien_pc_uu_dai_nghe + $thanh_tien_pc_cong_vu + $thanh_tien_pc_kiem_nhiem);
         $hs_tang_them = $hs_pc_thu_hut + $he_so_luong + $hs_pc_chuc_vu + $hs_pc_trach_nhiem + $hs_pc_khu_vuc + $hs_pc_tnvk + $hs_pc_tham_nien + $hs_pc_uu_dai_nghe + $hs_pc_cong_vu + $hs_pc_kiem_nhiem + $hs_pc_khac_he_so;
         $ti_le_tang_them = ($hs_tang_them - $hs_pc_kiem_nhiem) * $luong_toi_thieu * $he_so_tang_them * $phan_loai_he_so;
         $tong_2 = (int) $tong_1 + $ti_le_tang_them;
         $tong_khen_thuong = 0;
         if (sizeof($khen_thuong)) {
             foreach ($khen_thuong as $kt) {
                 $tong_khen_thuong += $kt->kt_money;
             }
         }
         $tong_khien_trach = 0;
         if (sizeof($ky_luat)) {
             foreach ($ky_luat as $kl) {
                 $tong_khien_trach += $kl->kl_money;
             }
         }
         $tong_cong = $tong_2 + $tong_khen_thuong - $tong_khien_trach;
         //$mpdf = new mPDF();
         $khen_thuong_text_out = '
             <tr>
                 <td colspan="3" class="tieu-de">Khen thưởng</td>
             </tr>
             <tr>
                 <td colspan="3">
                     <br/>
                     <table border="1" width="100%" class="noi-dung" cellpadding="5" nobr="true">
                         <tr>
                             <td style="width: 36pt;"><strong>#</strong></td>
                             <td><strong>Ngày</strong></td>
                             <td style="width: 235pt;"><strong>Lý do</strong></td>
                             <td style="width: 100pt;"><strong>Mức thưởng</strong></td>
                         </tr>';
         if (sizeof($khen_thuong)) {
             $i = 0;
             foreach ($khen_thuong as $kt) {
                 $i++;
                 $khen_thuong_text_out .= '<tr>
                                     <td>' . $i . '</td>
                                     <td>' . date('d-m-Y', strtotime($kt->kt_date)) . '</td>
                                     <td>' . $kt->kt_ly_do . '</td>
                                     <td>' . number_format($kt->kt_money, 0, '.', ',') . '</td>
                                 </tr>';
             }
         } else {
             $khen_thuong_text_out .= '<tr><td colspan="4">Không có khen thưởng nào!</td></tr>';
         }
         $khen_thuong_text_out .= '
                         <tr>
                             <td colspan="3"><strong>Tổng cộng (III)</strong></td>
                             <td><strong>' . number_format($tong_khen_thuong, 0, '.', ',') . '</strong></td>
                         </tr>
                     </table>
                 </td>
             </tr>';
         $ky_luat_text_out = '
             <tr>
                 <td colspan="3" class="tieu-de">Kỷ luật/Khiển trách</td>
             </tr>
             <tr>
                 <td colspan="3">
                     <br/>
                     <table border="1" width="100%" class="noi-dung" cellpadding="5" nobr="true">
                         <tr>
                             <td style="width: 36pt;"><strong>#</strong></td>
                             <td><strong>Ngày</strong></td>
                             <td style="width: 235pt;"><strong>Lý do</strong></td>
                             <td style="width: 100pt;"><strong>Mức phạt</strong></td>
                         </tr>';
         if (sizeof($ky_luat)) {
             $i = 0;
             foreach ($ky_luat as $kl) {
                 $i++;
                 $ky_luat_text_out .= '<tr>
                                     <td>' . $i . '</td>
                                     <td>' . date('d-m-Y', strtotime($kl->kl_date)) . '</td>
                                     <td>' . $kl->kl_ly_do . '</td>
                                     <td>' . number_format($kl->kl_money, 0, '.', ',') . '</td>
                                 </tr>';
             }
         } else {
             $ky_luat_text_out .= '<tr><td colspan="4">Không có kỷ luật/khiển trách nào nào!</td></tr>';
         }
         $ky_luat_text_out .= '
                         <tr>
                             <td colspan="3"><strong>Tổng cộng (IV)</strong></td>
                             <td><strong>' . number_format($tong_khien_trach, 0, '.', ',') . '</strong></td>
                         </tr>
                     </table>
                 </td>
             </tr>';
         $text_outout = '
             <style>
                 .ten-co-quan {
                     color: #000;
                     font-size: 10pt;
                     height: 50px;
                     text-align:center;
                 }
                 .ten-bang-luong{
                     height: 30px;
                     text-align:center;
                     font-size: 10pt;
                 }
                 
                 table.first {
                     color: #003300;
                     font-family: helvetica;
                     font-size: 8pt;
                     border-left: 3px solid red;
                     border-right: 3px solid #FF00FF;
                     border-top: 3px solid green;
                     border-bottom: 3px solid blue;
                     background-color: #ccffcc;
                 }
                 .borders {
                     border: 1px solid #000;
                     font-size: 10px;
                 }
                 
                 .tieu-de{
                     height: 20px;
                     font-size: 11px;
                 }
                 .noi-dung{
                     font-size: 10px;
                 }
                 td.second {
                     border: 2px dashed green;
                 }
                 
                 .lowercase {
                     text-transform: lowercase;
                 }
                 .uppercase {
                     text-transform: uppercase;
                 }
                 .capitalize {
                     text-transform: capitalize;
                 }
             </style>
             <table width="100%">
                 <tr>
                     <td width="200" class="ten-co-quan uppercase">
                         TỔNG CỤC HẢI QUAN
                         <div><strong>CỤC HẢI QUAN HÀ TĨNH</strong></div>
                     </td>
                     <td colspan="2">&nbsp;</td>
                 </tr>
                 <tr>
                     <td colspan="3" class="ten-bang-luong uppercase">BẢNG LƯƠNG THÁNG ' . $thang . '-' . $nam . '</td>
                 </tr>
                 <tr>
                     <td colspan="3" class="tieu-de">Thông tin cá nhân</td>
                 </tr>
                 <tr>
                     <td colspan="3">
                         <br/>
                         <table border="1" class="noi-dung" cellpadding="5" nobr="true">
                             <tr>
                                 <td style="width: 120pt;"><strong>Họ tên</strong></td>
                                 <td style="width: 80pt;"><strong>Giới tính</strong></td>
                                 <td style="width: 100pt;"><strong>Ngày sinh</strong></td>
                                 <td style="width: 100pt;"><strong>Phòng ban</strong></td>
                                 <td style="width: 96pt;"><strong>Chức vụ</strong></td>
                             </tr>
                             <tr>
                                 <td>' . $em_info->em_ho . ' ' . $em_info->em_ten . '</td>
                                 <td>' . ($em_info->em_gioi_tinh ? 'Nam' : 'Nữ') . '</td>
                                 <td>' . date('d-m-Y', strtotime($em_info->em_ngay_sinh)) . '</td>
                                 <td>' . $this->view->viewGetPhongBanName($em_info->em_phong_ban) . '</td>
                                 <td>' . $this->view->viewGetChucVuName($em_info->em_chuc_vu) . '</td>
                             </tr>
                         </table>
                     </td>
                 </tr>
                 <tr>
                     <td colspan="3" class="tieu-de"></td>
                 </tr>
                 <tr>
                     <td colspan="3" class="tieu-de">Thông số lương cơ bản</td>
                 </tr>
                 <tr>
                     <td colspan="3">
                         <br />
                         <table border="1" width="575pt" class="noi-dung" cellpadding="5" nobr="true">
                             <tr>
                                 <td><strong>Lương cơ bản</strong></td>
                                 ' . ($giai_doan ? '<td><strong>Thử việc</strong></td>  ' : '') . '
                                 <td style="width: 70pt;"><strong>BHXH</strong></td>
                                 <td style="width: 70pt;"><strong>BHYT</strong></td>
                                 <td style="width: 210pt;"><strong>Đã trừ BHXH+BHYT</strong></td>
                             </tr>
                             <tr>
                                 <td>' . number_format($luong_toi_thieu, 0, '.', ',') . '</td>
                                 ' . ($giai_doan ? '<td>' . $luong_thu_viec . '%</td>  ' : '') . '
                                 <td>' . $bhxh . '%</td>
                                 <td>' . $bhyt . '%</td>
                                 <td>
                                     Đã trừ BHYT + BHXH: ' . number_format($luong_toi_thieu_sau_bh, 0, '.', ',') . ' <br>
                                     Đã trừ BHYT: ' . number_format($luong_toi_thieu_bhyt, 0, '.', ',') . '
                                 </td>
                             </tr>
                         </table>
                     </td>
                 </tr>
                 <tr>
                     <td colspan="3" class="tieu-de"></td>
                 </tr>
                 <tr>
                     <td colspan="3" class="tieu-de">Bảng lương</td>
                 </tr>
                 <tr>
                     <td colspan="3">
                         <br/>
                         <table border="1" width="100%" class="noi-dung" cellpadding="5" nobr="true">
                             <tr>
                                 <td style="width: 150pt;"><strong>Tên</strong></td>
                                 <td style="width: 245pt;" colspan="2"><strong>Hệ số</strong></td>
                                 <td style="width: 100pt;"><strong>Thành tiền</strong></td>
                             </tr>
                             <tr>
                                 <td>Kết quả phân loại tháng</td>
                                 <td> ' . $phan_loai . ' </td>
                                 <td> ' . $phan_loai_he_so . '</td>
                                 <td></td>
                             </tr>  
                             <tr>
                                 <td>Hệ số lương</td>
                                 <td colspan="2">' . $he_so_luong . '</td>
                                 <td>' . number_format($thanh_tien_hsl, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC chức vụ</td>
                                 <td colspan="2">' . $hs_pc_chuc_vu . '</td>
                                 <td>' . number_format($thanh_tien_pc_cong_viec, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC trách nhiệm</td>
                                 <td colspan="2">' . $hs_pc_trach_nhiem . '</td>
                                 <td>' . number_format($thanh_tien_pc_trach_nhiem, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC khu vực</td>
                                 <td colspan="2">' . $hs_pc_khu_vuc . '</td>
                                 <td>' . number_format($thanh_tien_pc_khu_vuc, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC thu hút</td>
                                 <td>' . $hs_pc_thu_hut_phan_tram . '%</td>
                                 <td>' . $hs_pc_thu_hut . '</td>
                                 <td>' . number_format($thanh_tien_pc_thu_hut, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC thâm niên vượt khung</td>
                                 <td>' . $hs_pc_tnvk_phan_tram . '%</td>
                                 <td>' . $hs_pc_tnvk . '</td>
                                 <td>' . number_format($thanh_tien_pc_tham_nien_vuot_khung, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC thâm niên</td>
                                 <td>' . $tham_nien . ' Năm</td>
                                 <td>' . $hs_pc_tham_nien . '</td>
                                 <td>' . number_format($thanh_tien_pc_tham_nien, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC ưu đãi nghề</td>
                                 <td>' . $uu_dai_nghe . '%</td>
                                 <td>' . $hs_pc_uu_dai_nghe . '</td>
                                 <td>' . number_format($thanh_tien_pc_uu_dai_nghe, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC công vụ</td>
                                 <td>' . $cong_vu . '%</td>
                                 <td>' . $hs_pc_cong_vu . '</td>
                                 <td>' . number_format($thanh_tien_pc_cong_vu, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC kiêm nhiệm</td>
                                 <td colspan="2">' . $hs_pc_kiem_nhiem . '</td>
                                 <td>' . number_format($thanh_tien_pc_kiem_nhiem, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>PC khác</td>
                                 <td colspan="2">' . $hs_pc_khac . ($hs_pc_khac_type ? '%' : '') . '</td>
                                 <td>' . number_format($thanh_tien_pc_khac, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td colspan="3">Tổng cộng (I)</td>
                                 <td>' . number_format($tong_1, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td>Tỷ lệ tăng thêm</td>
                                 <td colspan="2">' . $hs_tang_them . '</td>
                                 <td>' . number_format($ti_le_tang_them, 0, '.', ',') . '</td>
                             </tr>
                             <tr>
                                 <td colspan="3"><strong>Tổng cộng (II)</strong></td>
                                 <td><strong>' . number_format($tong_2, 0, '.', ',') . '</strong></td>
                             </tr>
                         </table>                            
                     </td>
                 </tr>
                 <tr>
                     <td colspan="3" class="tieu-de"></td>
                 </tr>  
                 ' . $khen_thuong_text_out . '
                 <tr>
                     <td colspan="3" class="tieu-de"></td>
                 </tr> 
                 ' . $ky_luat_text_out . '
                 <tr>
                     <td colspan="3" class="tieu-de"></td>
                 </tr> 
                 <tr>
                     <td colspan="3">
                         <br/>
                         <table border="1" width="100%" class="noi-dung" cellpadding="5" nobr="true">
                             <tr>
                                 <td style="width: 395pt;"><strong>Tổng được nhận = II + III + IV</strong></td>
                                 <td style="width: 100pt;"><strong>' . number_format($tong_cong, 0, '.', ',') . '</strong></td>
                             </tr>
                         </table>
                     </td>
                 </tr>
             </table> 
           ';
         /*
          $mpdf->WriteHTML($text_outout);
          $file_name = $this->loc_tieng_viet($em_info->em_ho) . '_' . $this->loc_tieng_viet($em_info->em_ten) . '_' . $thang . '-' . $nam . '.pdf';
          $mpdf->Output($file_name, 'D');
         */
         $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
         $pdf->SetCreator(PDF_CREATOR);
         $pdf->SetAuthor(PDF_AUTHOR);
         $pdf->SetTitle(PDF_HEADER_TITLE);
         $pdf->SetSubject(PDF_HEADER_TITLE);
         $pdf->SetKeywords('bang luong');
         $pdf->setPrintHeader(false);
         $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
         $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
         $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
         $pdf->setFontSubsetting(true);
         $pdf->SetFont('dejavusans', '', 14, '', true);
         $pdf->AddPage();
         $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
         $file_name = $this->loc_tieng_viet($em_info->em_ho) . '_' . $this->loc_tieng_viet($em_info->em_ten) . '_' . $thang . '-' . $nam . '.pdf';
         $pdf->writeHTMLCell(0, 0, '', '', $text_outout, 0, 1, 0, true, '', true);
         // ---------------------------------------------------------
         // Close and output PDF document
         // This method has several options, check the source code documentation for more information.
         $pdf->Output($file_name, 'I');
         die;
     }
 }
 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 indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Quản lý tài khoản - ' . $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);
     $employeesModel = new Front_Model_Employees();
     $employeesEditModel = new Front_Model_EmployeesEdit();
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $success_message = '';
     $id = $identity->em_id;
     $employee_info = $employeesModel->fetchRow('em_id=' . $id);
     if (!$employee_info) {
         $error_message[] = 'Không tìm thấy thông tin.';
     }
     $tinhModel = new Front_Model_Tinh();
     $list_tinh = $tinhModel->fetchData(array('tinh_status' => 1));
     $huyenModel = new Front_Model_Huyen();
     $list_huyen = $huyenModel->fetchData(array('huyen_status' => 1));
     $dantocModel = new Front_Model_Dantoc();
     $list_dan_toc = $dantocModel->fetchData(array('dt_status' => 1));
     $hochamModel = new Front_Model_Hocham();
     $list_hoc_ham = $hochamModel->fetchData(array('hh_status' => 1));
     $bangcapModel = new Front_Model_Bangcap();
     $list_bang_cap = $bangcapModel->fetchData(array('bc_status' => 1));
     $chungchiModel = new Front_Model_Chungchi();
     $list_chung_chi = $chungchiModel->fetchData(array('cc_status' => 1));
     $chucvudoanModel = new Front_Model_ChucVuDoan();
     $list_chuc_vu_doan = $chucvudoanModel->fetchData(array('cvdoan_status' => 1));
     $chucvudangModel = new Front_Model_ChucVuDang();
     $list_chuc_vu_dang = $chucvudangModel->fetchData(array('cvdang_status' => 1));
     $chucvucongdoanModel = new Front_Model_ChucVuCongDoan();
     $list_chuc_vu_cong_doan = $chucvucongdoanModel->fetchData(array('cvcdoan_status' => 1));
     $lyluanModel = new Front_Model_LyLuanChinhTri();
     $list_ly_luan_chinh_tri = $lyluanModel->fetchData(array('llct_status' => 1));
     $quanlynnModel = new Front_Model_QuanLyNhaNuoc();
     $list_quan_ly_nn = $quanlynnModel->fetchData(array('qlnn_status' => 1));
     $error_message = array();
     $min = 10;
     $max = 20 * 1024 * 1024;
     //20MB
     $dir = '/avatars';
     //thu muc uploads
     $dir_upload = UPLOAD_PATH . $dir;
     //duong dan
     $upload = new Zend_File_Transfer_Adapter_Http();
     $upload->setDestination($dir_upload);
     $upload->addValidator('Count', false, array('min' => 1, 'max' => 1))->addValidator('Size', false, array('min' => $min, 'max' => $max))->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     $files = $upload->getFileInfo();
     if ($this->_request->isPost()) {
         $data = array('em_id' => $id);
         if ($upload->isValid()) {
             foreach ($files as $file => $info) {
                 if ($info['name'] != '') {
                     $validator = new Zend_Validate_File_Exists($dir_upload);
                     if ($validator->isValid($info['name'])) {
                         $file_name = $upload->getFileName($info['name']);
                         preg_match("/\\.([^\\.]+)\$/", $file_name, $matches);
                         $file_ext = $matches[1];
                         $file_name = time() . '.' . $file_ext;
                         $arrFileName[$file] = $file_name;
                         $upload->addFilter('Rename', $dir_upload . '/' . $file_name);
                     } else {
                         $arrFileName[$file] = $info['name'];
                     }
                     $upload->receive($file);
                 }
             }
             $data['eme_anh_the'] = $arrFileName['em_anh_the'];
         }
         $em_ho = trim($this->_arrParam['em_ho']);
         $em_ten = trim($this->_arrParam['em_ten']);
         $em_ten_khac = $this->_arrParam['em_ten_khac'];
         $em_so_chung_minh_thu = trim($this->_arrParam['em_so_chung_minh_thu']);
         $em_gioi_tinh = $this->_arrParam['em_gioi_tinh'];
         $ngay_sinh = $this->_arrParam['ngay_sinh'];
         $em_home_phone = $this->_arrParam['em_home_phone'];
         $em_phone = $this->_arrParam['em_phone'];
         $em_noi_sinh = trim($this->_arrParam['em_noi_sinh']);
         $em_que_quan = trim($this->_arrParam['em_que_quan']);
         $em_dia_chi = $this->_arrParam['em_dia_chi'];
         $em_dia_chi_tinh = $this->_arrParam['em_dia_chi_tinh'];
         $em_dia_chi_huyen = $this->_arrParam['em_dia_chi_huyen'];
         $em_dan_toc = $this->_arrParam['em_dan_toc'];
         $em_chuc_vu_dang = $this->_arrParam['em_chuc_vu_dang'];
         $ngay_dang = $this->_arrParam['ngay_dang'];
         $em_chuc_vu_doan = $this->_arrParam['em_chuc_vu_doan'];
         $ngay_doan = $this->_arrParam['ngay_doan'];
         $em_chuc_vu_cong_doan = $this->_arrParam['em_chuc_vu_cong_doan'];
         $em_van_hoa_pt = trim($this->_arrParam['em_van_hoa_pt']);
         $em_hoc_ham = $this->_arrParam['em_hoc_ham'];
         $em_bang_cap = $this->_arrParam['em_bang_cap'];
         $em_ngoai_ngu = $this->_arrParam['em_ngoai_ngu'];
         $em_tin_hoc = $this->_arrParam['em_tin_hoc'];
         $em_chung_chi_khac = $this->_arrParam['em_chung_chi_khac'];
         $em_bang_scan_upload = $this->_arrParam['anh_bang_cap'];
         $em_tai_lieu_khac = $this->_arrParam['anh_tai_lieu_khac'];
         /* Moi them */
         $em_ton_giao = trim($this->_arrParam['em_ton_giao']);
         $em_noi_sinh_huyen = trim($this->_arrParam['em_noi_sinh_huyen']);
         $em_noi_sinh_tinh = trim($this->_arrParam['em_noi_sinh_tinh']);
         $em_que_quan_huyen = trim($this->_arrParam['em_que_quan_huyen']);
         $em_que_quan_tinh = trim($this->_arrParam['em_que_quan_tinh']);
         $em_noi_o = trim($this->_arrParam['em_noi_o']);
         $em_noi_o_huyen = $this->_arrParam['em_noi_o_huyen'];
         $em_noi_o_tinh = $this->_arrParam['em_noi_o_tinh'];
         $em_ngay_nhap_ngu = trim($this->_arrParam['em_ngay_nhap_ngu']);
         $em_ngay_xuat_ngu = trim($this->_arrParam['em_ngay_xuat_ngu']);
         $em_cmt_ngay_cap = trim($this->_arrParam['em_cmt_ngay_cap']);
         $em_quan_ham = trim($this->_arrParam['em_quan_ham']);
         $em_danh_hieu = trim($this->_arrParam['em_danh_hieu']);
         $em_so_bhxh = trim($this->_arrParam['em_so_bhxh']);
         $em_tinh_trang_suc_khoe = trim($this->_arrParam['em_tinh_trang_suc_khoe']);
         $em_chieu_cao = trim($this->_arrParam['em_chieu_cao']);
         $em_can_nang = trim($this->_arrParam['em_can_nang']);
         $em_nhom_mau = trim($this->_arrParam['em_nhom_mau']);
         $em_thuong_binh = trim($this->_arrParam['em_thuong_binh']);
         $em_gia_dinh_chinh_sach = trim($this->_arrParam['em_gia_dinh_chinh_sach']);
         $em_lich_su_dao_tao = $this->_arrParam['em_lich_su_dao_tao'];
         $em_qua_trinh_cong_tac = $this->_arrParam['em_qua_trinh_cong_tac'];
         $em_gia_dinh_ban_than = $this->_arrParam['em_gia_dinh_ban_than'];
         $em_gia_dinh_vo = $this->_arrParam['em_gia_dinh_vo'];
         $em_qua_trinh_luong = $this->_arrParam['em_qua_trinh_luong'];
         $em_bi_bat = trim($this->_arrParam['em_bi_bat']);
         $em_tham_gia_to_chuc = trim($this->_arrParam['em_tham_gia_to_chuc']);
         $em_than_nhan_nuoc_ngoai = trim($this->_arrParam['em_than_nhan_nuoc_ngoai']);
         $em_ly_luan_chinh_tri = trim($this->_arrParam['em_ly_luan_chinh_tri']);
         $em_quan_ly_nha_nuoc = trim($this->_arrParam['em_quan_ly_nha_nuoc']);
         $validator_length = new Zend_Validate_StringLength(array('min' => 2, 'max' => 255));
         //kiem tra dữ liệu
         if (!$validator_length->isValid($em_ho)) {
             $error_message[] = 'Họ không được bỏ trống và phải lớn hơn hoặc bằng 2 ký tự.';
         }
         if (!$validator_length->isValid($em_ten)) {
             $error_message[] = 'Họ không được bỏ trống và phải lớn hơn hoặc bằng 2 ký tự.';
         }
         if (!sizeof($error_message)) {
             $current_time = new Zend_Db_Expr('NOW()');
             if ($ngay_sinh != '') {
                 $ngay_sinh = str_replace('/', '-', $ngay_sinh);
                 $ngay_sinh = date('Y-m-d', strtotime($ngay_sinh));
             }
             if ($ngay_dang != '') {
                 $ngay_dang = str_replace('/', '-', $ngay_dang);
                 $ngay_dang = date('Y-m-d', strtotime($ngay_dang));
             }
             if ($ngay_doan != '') {
                 $ngay_doan = str_replace('/', '-', $ngay_doan);
                 $ngay_doan = date('Y-m-d', strtotime($ngay_doan));
             }
             if ($em_ngay_nhap_ngu != '') {
                 $em_ngay_nhap_ngu = str_replace('/', '-', $em_ngay_nhap_ngu);
                 $em_ngay_nhap_ngu = date('Y-m-d', strtotime($em_ngay_nhap_ngu));
             }
             if ($em_ngay_xuat_ngu != '') {
                 $em_ngay_xuat_ngu = str_replace('/', '-', $em_ngay_xuat_ngu);
                 $em_ngay_xuat_ngu = date('Y-m-d', strtotime($em_ngay_xuat_ngu));
             }
             if ($em_cmt_ngay_cap != '') {
                 $em_cmt_ngay_cap = str_replace('/', '-', $em_cmt_ngay_cap);
                 $em_cmt_ngay_cap = date('Y-m-d', strtotime($em_cmt_ngay_cap));
             }
             $data['eme_ho'] = $em_ho;
             $data['eme_ten'] = $em_ten;
             $data['eme_ten_khac'] = $em_ten_khac;
             $data['eme_so_chung_minh_thu'] = $em_so_chung_minh_thu;
             $data['eme_cmt_ngay_cap'] = $em_cmt_ngay_cap;
             $data['eme_gioi_tinh'] = $em_gioi_tinh;
             $data['eme_home_phone'] = $em_home_phone;
             $data['eme_phone'] = $em_phone;
             $data['eme_noi_sinh'] = $em_noi_sinh;
             $data['eme_que_quan'] = $em_que_quan;
             $data['eme_dia_chi'] = $em_dia_chi;
             $data['eme_dia_chi_tinh'] = $em_dia_chi_tinh;
             $data['eme_dia_chi_huyen'] = $em_dia_chi_huyen;
             $data['eme_dan_toc'] = $em_dan_toc;
             $data['eme_chuc_vu_dang'] = $em_chuc_vu_dang;
             $data['eme_chuc_vu_doan'] = $em_chuc_vu_doan;
             $data['eme_chuc_vu_cong_doan'] = $em_chuc_vu_cong_doan;
             $data['eme_van_hoa_pt'] = $em_van_hoa_pt;
             $data['eme_hoc_ham'] = $em_hoc_ham;
             $data['eme_bang_cap'] = $em_bang_cap;
             $data['eme_ngoai_ngu'] = $em_ngoai_ngu;
             $data['eme_tin_hoc'] = $em_tin_hoc;
             $data['eme_chung_chi_khac'] = $em_chung_chi_khac;
             $data['eme_anh_bang_cap'] = serialize($em_bang_scan_upload);
             $data['eme_tai_lieu_khac'] = serialize($em_tai_lieu_khac);
             $data['eme_ngay_sinh'] = $ngay_sinh;
             $data['eme_ngay_vao_dang'] = $ngay_dang;
             $data['eme_ngay_vao_doan'] = $ngay_doan;
             $data['eme_date_modified'] = $current_time;
             /* Moi them */
             $data['eme_ton_giao'] = $em_ton_giao;
             $data['eme_noi_sinh_huyen'] = $em_noi_sinh_huyen;
             $data['eme_noi_sinh_tinh'] = $em_noi_sinh_tinh;
             $data['eme_que_quan_huyen'] = $em_que_quan_huyen;
             $data['eme_que_quan_tinh'] = $em_que_quan_tinh;
             $data['eme_noi_o'] = $em_noi_o;
             $data['eme_noi_o_huyen'] = $em_noi_o_huyen;
             $data['eme_noi_o_tinh'] = $em_noi_o_tinh;
             $data['eme_ngay_nhap_ngu'] = $em_ngay_nhap_ngu;
             $data['eme_ngay_xuat_ngu'] = $em_ngay_xuat_ngu;
             $data['eme_quan_ham'] = $em_quan_ham;
             $data['eme_danh_hieu'] = $em_danh_hieu;
             $data['eme_so_bhxh'] = $em_so_bhxh;
             $data['eme_tinh_trang_suc_khoe'] = $em_tinh_trang_suc_khoe;
             $data['eme_chieu_cao'] = $em_chieu_cao;
             $data['eme_can_nang'] = $em_can_nang;
             $data['eme_nhom_mau'] = $em_nhom_mau;
             $data['eme_thuong_binh'] = $em_thuong_binh;
             $data['eme_gia_dinh_chinh_sach'] = $em_gia_dinh_chinh_sach;
             $data['eme_lich_su_dao_tao'] = serialize($em_lich_su_dao_tao);
             $data['eme_qua_trinh_cong_tac'] = serialize($em_qua_trinh_cong_tac);
             $data['eme_gia_dinh_ban_than'] = serialize($em_gia_dinh_ban_than);
             $data['eme_gia_dinh_vo'] = serialize($em_gia_dinh_vo);
             $data['eme_qua_trinh_luong'] = serialize($em_qua_trinh_luong);
             $data['eme_bi_bat'] = $em_bi_bat;
             $data['eme_tham_gia_to_chuc'] = $em_tham_gia_to_chuc;
             $data['eme_than_nhan_nuoc_ngoai'] = $em_than_nhan_nuoc_ngoai;
             $data['eme_ly_luan_chinh_tri'] = $em_ly_luan_chinh_tri;
             $data['eme_quan_ly_nha_nuoc'] = $em_quan_ly_nha_nuoc;
             $checkExit = $employeesEditModel->fetchRow('em_id=' . $id);
             if ($checkExit) {
                 $employeesEditModel->update($data, 'eme_id=' . $checkExit->eme_id);
             } else {
                 $data['eme_date_added'] = $current_time;
                 $employeesEditModel->insert($data);
             }
             $users = $this->_helper->GlobalHelpers->checkToChucUsers(4002);
             $thongbao_model = new Front_Model_ThongBao();
             $data = array();
             $data['tb_from'] = 0;
             $data['tb_tieu_de'] = '[Thông báo] Có yêu cầu cập nhật thông tin.';
             $data['tb_noi_dung'] = 'Cán bộ <strong>' . $em_ho . ' ' . $em_ten . '</strong> đã khai báo thông tin cá nhân mới.<br/> Bạn hãy <strong><a href="' . $this->view->baseUrl('tochuccanbo/capnhatthongtin') . '">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 = 'Yêu cầu cập nhật thông tin thành công';
         }
     }
     $this->view->employee_info = $employee_info;
     $this->view->success_message = $success_message;
     $this->view->error_message = $error_message;
     $this->view->list_tinh = $list_tinh;
     $this->view->list_huyen = $list_huyen;
     $this->view->list_dan_toc = $list_dan_toc;
     $this->view->list_hoc_ham = $list_hoc_ham;
     $this->view->list_bang_cap = $list_bang_cap;
     $this->view->list_chung_chi = $list_chung_chi;
     $this->view->list_chuc_vu_doan = $list_chuc_vu_doan;
     $this->view->list_chuc_vu_dang = $list_chuc_vu_dang;
     $this->view->list_chuc_vu_cong_doan = $list_chuc_vu_cong_doan;
     $this->view->list_ly_luan_chinh_tri = $list_ly_luan_chinh_tri;
     $this->view->list_quan_ly_nha_nuoc = $list_quan_ly_nn;
 }