public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Thống kê 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();
     $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;
     $holidaysModel = new Front_Model_Holidays();
     $list_holidays = $holidaysModel->fetchData(array(), 'hld_order ASC');
     $xinnghiphepModel = new Front_Model_XinNghiPhep();
     $list_nghi_phep = $xinnghiphepModel->fetchByDate($em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59");
     $chamcongModel = new Front_Model_ChamCong();
     $cham_cong = $chamcongModel->fetchOneData(array('c_em_id' => $em_id, 'c_thang' => $thang, 'c_nam' => $nam));
     $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");
     $this->view->cham_cong = $cham_cong;
     $this->view->thang = $thang;
     $this->view->nam = $nam;
     $this->view->list_holidays = $list_holidays;
     $this->view->list_nghi_phep = $list_nghi_phep;
     $this->view->khen_thuong = $khen_thuong;
     $this->view->ky_luat = $ky_luat;
 }
 public function indexAction()
 {
     $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();
     $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');
     $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");
     $ketquaModel = new Front_Model_DanhGia();
     $phan_loai = $ketquaModel->getPhanLoai($em_id, $thang, $nam);
     $this->view->khen_thuong = $khen_thuong;
     $this->view->ky_luat = $ky_luat;
     $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 updatestatusAction()
 {
     $this->_helper->layout()->disableLayout();
     $process_status = 0;
     if ($this->_request->isPost()) {
         $auth = Zend_Auth::getInstance();
         $identity = $auth->getIdentity();
         $from_id = $identity->em_id;
         $thang = $this->_request->getParam('thang', 0);
         $nam = $this->_request->getParam('nam', 0);
         $kl_status = $this->_request->getParam('status', 0);
         if ($kl_status > 1) {
             $kl_status = 1;
         }
         if ($kl_status < 0) {
             $kl_status = 0;
         }
         $process_status = 1;
         $current_time = new Zend_Db_Expr('NOW()');
         $kyluatModel = new Front_Model_KyLuat();
         $item = $this->getRequest()->getPost('cid');
         foreach ($item as $k => $v) {
             $process_status = $kyluatModel->update(array('kl_can_bo_to_chuc' => $from_id, 'kl_ptccb_viewed' => 1, 'kl_status' => $kl_status, 'kl_date_modified' => $current_time), "kl_id={$v}");
             if ($process_status) {
                 if ($kl_status) {
                     $thongbao_model = new Front_Model_ThongBao();
                     $row_content = $kyluatModel->fetchRow("kl_id={$v}");
                     $data = array();
                     $data['tb_from'] = 0;
                     $data['tb_to'] = $row_content->kl_em_id;
                     $data['tb_tieu_de'] = '[Kỷ luật/Khiển trách] ' . $row_content->kl_ly_do;
                     $data['tb_noi_dung'] = $row_content->kl_chi_tiet;
                     $data['tb_status'] = 0;
                     $data['tb_date_added'] = $current_time;
                     $data['tb_date_modified'] = $current_time;
                     $thongbao_model->insert($data);
                 }
             }
         }
         $this->_redirect('tochuccanbo/yckyluat/index/thang/' . $thang . '/nam/' . $nam);
     }
 }
 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 jqkyluatAction()
 {
     $this->_helper->layout()->disableLayout();
     $kyluatModel = new Front_Model_KyLuat();
     if ($this->_request->isPost()) {
         $data = array();
         $auth = Zend_Auth::getInstance();
         $identity = $auth->getIdentity();
         $from_id = $identity->em_id;
         $em_id = $this->_arrParam['em_id'];
         $kl_date_day = $this->_arrParam['kl_date_day'];
         $kl_date_month = $this->_arrParam['kl_date_month'];
         $kl_date_year = $this->_arrParam['kl_date_year'];
         $kl_ly_do = trim($this->_arrParam['kl_ly_do']);
         $kl_money = trim($this->_arrParam['kl_money']);
         $kl_chi_tiet = trim($this->_arrParam['kl_chi_tiet']);
         $current_time = new Zend_Db_Expr('NOW()');
         $date_ky_luat = date_create($kl_date_year . '-' . $kl_date_month . '-' . $kl_date_day);
         if (!is_numeric($kl_money)) {
             $kl_money = 0;
         }
         $data['kl_can_bo_to_chuc'] = $from_id;
         $data['kl_em_id'] = $em_id;
         $data['kl_ptccb_viewed'] = 1;
         $data['kl_money'] = $kl_money;
         $data['kl_date'] = date_format($date_ky_luat, "Y-m-d H:iP");
         $data['kl_ly_do'] = $kl_ly_do;
         $data['kl_chi_tiet'] = $kl_chi_tiet;
         $data['kl_date_added'] = $current_time;
         $data['kl_date_modified'] = $current_time;
         $success_message = $kyluatModel->insert($data);
         $thongbao_model = new Front_Model_ThongBao();
         $data = array();
         $data['tb_from'] = 0;
         $data['tb_to'] = $em_id;
         $data['tb_tieu_de'] = '[Kỷ luật/khiển trách] ' . $kl_ly_do;
         $data['tb_noi_dung'] = $kl_chi_tiet;
         $data['tb_status'] = 0;
         $data['tb_date_added'] = $current_time;
         $data['tb_date_modified'] = $current_time;
         $thongbao_model->insert($data);
         $this->view->success_message = $success_message;
     }
 }