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"> </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] : ' '; $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;"> </td><td style="width: 50pt;"> </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 = '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; }
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 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 indexAction() { $translate = Zend_Registry::get('Zend_Translate'); $this->view->title = 'Lọc danh sách theo chứng chỉ - ' . $translate->_('TEXT_DEFAULT_TITLE'); $this->view->headTitle($this->view->title); $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED; $option = array('layout' => 'danhsach/layout', 'layoutPath' => $layoutPath); Zend_Layout::startMvc($option); $filter_selected = $this->_getParam('id', 0); $emModel = new Front_Model_Employees(); $filterModel = new Front_Model_Chungchi(); $list_filters = $filterModel->fetchData(array('cc_status' => 1)); if ($filter_selected) { $list_items = $emModel->fetchAll(); } else { $list_items = $emModel->fetchAll("em_ngoai_ngu = {$filter_selected} or em_tin_hoc={$filter_selected} or em_chung_chi_khac={$filter_selected}"); } $paginator = Zend_Paginator::factory($list_items); $paginator->setItemCountPerPage(NUM_PER_PAGE); $paginator->setCurrentPageNumber($this->_page); $this->view->page = $this->_page; $this->view->paginator = $paginator; $this->view->filter = $list_filters; $this->view->filter_selected = $filter_selected; }
public function exelthongkeAction() { $inputFileName = APPLICATION_PATH . "/../tmp/Mau_Thong_Ke_Thang.xlsx"; $objPHPExcel = PHPExcel_IOFactory::load($inputFileName); $styleArray = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'font' => array('bold' => false, 'color' => array('rgb' => '000000'), 'size' => 11, 'name' => 'Times New Roman')); $objPHPExcel->getProperties()->setCreator("Cục Hải Quan Hà Tĩnh"); $objPHPExcel->getProperties()->setLastModifiedBy("Cục Hải Quan Hà Tĩnh"); $objPHPExcel->getProperties()->setTitle("Thống kê tháng"); $objPHPExcel->getProperties()->setSubject("Bảng chấm công"); $objPHPExcel->getProperties()->setDescription("Bảng chấm công Cục Hải Quan Hà Tĩnh"); $objPHPExcel->setActiveSheetIndex(0); $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")); $pb_selected = $this->_getParam('phongban', 0); $days_in_month = cal_days_in_month(0, (int) $thang, (int) $nam); $emModel = new Front_Model_Employees(); $phongbanModel = new Front_Model_Phongban(); $chamcongModel = new Front_Model_ChamCong(); $letetModel = new Front_Model_NghiLe(); $lamthemgioModel = new Front_Model_LamThemGio(); $list_lam_them = $lamthemgioModel->fetchByMonth($nam, $thang); $check_le_tet = $letetModel->fetchByMonth($nam, $thang); $le_tet_array = array(); foreach ($check_le_tet as $le_tet) { $ngay_ket_thuc = new Zend_Date($le_tet->nn_den_ngay); $ngay_bat_dau = new Zend_Date($le_tet->nn_tu_ngay); for ($n = 1; $n <= $days_in_month; $n++) { $date_check = new Zend_Date("{$nam}-{$thang}-{$n}"); if ($date_check >= $ngay_bat_dau && $date_check <= $ngay_ket_thuc) { $le_tet_array[$n] = 1; } } } $list_cham_cong = $chamcongModel->fetchByMonth($nam, $thang); $cham_cong_array = array(); foreach ($list_cham_cong as $cham_cong_info) { $cham_cong_array[$cham_cong_info->c_em_id] = $cham_cong_info; } $phong_ban_id = $list_phongban = $phong_ban = array(); $phong_ban_id[] = $pb_selected; $pb_selected_info = $phongbanModel->fetchRow('pb_id=' . $pb_selected); if ($pb_selected_info) { $phong_ban[] = $pb_selected_info; } $list_phongban = $phongbanModel->fetchDataStatus($pb_selected, $phong_ban); if (sizeof($list_phongban)) { foreach ($list_phongban as $phong_ban_info) { $phong_ban_id[] = $phong_ban_info->pb_id; } } $phong_ban_id = implode(',', $phong_ban_id); //if ($pb_selected) { $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1"); $holidaysModel = new Front_Model_Holidays(); $holidays = $holidaysModel->fetchData(); $listHoliday = array(); foreach ($holidays as $holiday) { $listHoliday[$holiday['hld_id']] = array('code' => $holiday['hld_code'], 'ngay_cong' => $holiday['hld_ngay_cong']); } $objPHPExcel->getActiveSheet()->SetCellValue('A4', 'BẢNG CHẤM CÔNG LÀM THÊM GIỜ THÁNG ' . $thang . ' NĂM ' . $nam); $day_key[1] = 'C'; $day_key[2] = 'D'; $day_key[3] = 'E'; $day_key[4] = 'F'; $day_key[5] = 'G'; $day_key[6] = 'H'; $day_key[7] = 'I'; $day_key[8] = 'J'; $day_key[9] = 'K'; $day_key[10] = 'L'; $day_key[11] = 'M'; $day_key[12] = 'N'; $day_key[13] = 'O'; $day_key[14] = 'P'; $day_key[15] = 'Q'; $day_key[16] = 'R'; $day_key[17] = 'S'; $day_key[18] = 'T'; $day_key[19] = 'U'; $day_key[20] = 'V'; $day_key[21] = 'W'; $day_key[22] = 'X'; $day_key[23] = 'Y'; $day_key[24] = 'Z'; $day_key[25] = 'AA'; $day_key[26] = 'AB'; $day_key[27] = 'AC'; $day_key[28] = 'AD'; $day_key[29] = 'AE'; $day_key[30] = 'AF'; $day_key[31] = 'AG'; if ($list_nhan_vien) { $k = 1; foreach ($list_phongban as $phong_ban_info) { $k++; $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A" . ($k + 6) . ":AL" . ($k + 6)); $objPHPExcel->getActiveSheet()->getStyle("A" . ($k + 6))->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => 'F28A8C'))); $objPHPExcel->getActiveSheet()->SetCellValue('A' . ($k + 6), $phong_ban_info->pb_name); $objPHPExcel->getActiveSheet()->getStyle('A' . ($k + 6))->applyFromArray($styleArray); foreach ($list_nhan_vien as $nhan_vien) { if ($phong_ban_info->pb_id == $nhan_vien->em_phong_ban) { $so_gio_lam_le_tet = $so_phut_lam_le_tet = 0; $so_gio_lam_thu_7_cn = $so_phut_lam_thu_7_cn = 0; $k++; $cham_cong = null; if ($cham_cong_array[$nhan_vien->em_id]) { $cham_cong = $cham_cong_array[$nhan_vien->em_id]; for ($d = 1; $d <= $days_in_month; $d++) { $check_gio_lam_them = $this->view->viewGetGioLamThem($nhan_vien->em_id, $d, $thang, $nam); if ($check_gio_lam_them) { if ($le_tet_array[$d]) { $so_gio_lam_le_tet += $check_gio_lam_them['gio']; $so_phut_lam_le_tet += $check_gio_lam_them['phut']; } elseif ($this->view->viewCheckChuNhatThuBay($d, (int) $thang, (int) $nam)) { $so_gio_lam_thu_7_cn += $check_gio_lam_them['gio']; $so_phut_lam_thu_7_cn += $check_gio_lam_them['phut']; } } } } $doi_gio_thu_7 = floor($so_phut_lam_thu_7_cn / 60); $so_phut_lam_thu_7_cn = $so_phut_lam_thu_7_cn % 60; $so_gio_lam_thu_7_cn += $doi_gio_thu_7; $doi_gio_le_tet = floor($so_phut_lam_le_tet / 60); $so_phut_lam_le_tet = $so_phut_lam_le_tet % 60; $so_gio_lam_le_tet += $doi_gio_le_tet; $objPHPExcel->getActiveSheet()->SetCellValue('A' . ($k + 6), $k); $objPHPExcel->getActiveSheet()->SetCellValue('B' . ($k + 6), $nhan_vien->em_ho . ' ' . $nhan_vien->em_ten); if ($cham_cong) { $objPHPExcel->getActiveSheet()->SetCellValue('C' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_1]) ? $listHoliday[$cham_cong->c_ngay_1]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('D' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_2]) ? $listHoliday[$cham_cong->c_ngay_2]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('E' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_3]) ? $listHoliday[$cham_cong->c_ngay_3]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('F' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_4]) ? $listHoliday[$cham_cong->c_ngay_4]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('G' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_5]) ? $listHoliday[$cham_cong->c_ngay_5]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('H' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_6]) ? $listHoliday[$cham_cong->c_ngay_6]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('I' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_7]) ? $listHoliday[$cham_cong->c_ngay_7]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('J' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_8]) ? $listHoliday[$cham_cong->c_ngay_8]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('K' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_9]) ? $listHoliday[$cham_cong->c_ngay_9]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('L' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_10]) ? $listHoliday[$cham_cong->c_ngay_10]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('M' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_11]) ? $listHoliday[$cham_cong->c_ngay_11]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('N' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_12]) ? $listHoliday[$cham_cong->c_ngay_12]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('O' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_13]) ? $listHoliday[$cham_cong->c_ngay_13]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('P' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_14]) ? $listHoliday[$cham_cong->c_ngay_14]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('Q' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_15]) ? $listHoliday[$cham_cong->c_ngay_15]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('R' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_16]) ? $listHoliday[$cham_cong->c_ngay_16]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('S' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_17]) ? $listHoliday[$cham_cong->c_ngay_17]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('T' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_18]) ? $listHoliday[$cham_cong->c_ngay_18]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('U' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_19]) ? $listHoliday[$cham_cong->c_ngay_19]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('V' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_20]) ? $listHoliday[$cham_cong->c_ngay_20]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('W' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_21]) ? $listHoliday[$cham_cong->c_ngay_21]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('X' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_22]) ? $listHoliday[$cham_cong->c_ngay_22]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('Y' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_23]) ? $listHoliday[$cham_cong->c_ngay_23]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('Z' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_24]) ? $listHoliday[$cham_cong->c_ngay_24]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('AA' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_25]) ? $listHoliday[$cham_cong->c_ngay_25]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('AB' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_26]) ? $listHoliday[$cham_cong->c_ngay_26]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('AC' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_27]) ? $listHoliday[$cham_cong->c_ngay_27]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('AD' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_28]) ? $listHoliday[$cham_cong->c_ngay_28]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('AE' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_29]) ? $listHoliday[$cham_cong->c_ngay_29]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('AF' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_30]) ? $listHoliday[$cham_cong->c_ngay_30]['code'] : ''); $objPHPExcel->getActiveSheet()->SetCellValue('AG' . ($k + 6), !empty($listHoliday[$cham_cong->c_ngay_31]) ? $listHoliday[$cham_cong->c_ngay_31]['code'] : ''); } $objPHPExcel->getActiveSheet()->SetCellValue('AI' . ($k + 6), $so_gio_lam_thu_7_cn . ':' . $so_phut_lam_thu_7_cn); $objPHPExcel->getActiveSheet()->SetCellValue('AJ' . ($k + 6), $so_gio_lam_le_tet . ':' . $so_phut_lam_le_tet); for ($l = 1; $l <= 31; $l++) { if ($this->view->viewCheckChuNhatThuBay($l, $thang, $nam)) { $objPHPExcel->getActiveSheet()->getStyle($day_key[$l] . ($k + 6))->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => 'DDDDDD'))); } } $objPHPExcel->getActiveSheet()->getStyle('A' . ($k + 6) . ':AL' . ($k + 6))->applyFromArray($styleArray); } } } $loop_day = 31 - $days_in_month; for ($a = 1; $a <= $loop_day; $a++) { $col_num = 33 - $a; $objPHPExcel->getActiveSheet()->removeColumnByIndex($col_num); } $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']); $objPHPExcel->getActiveSheet()->getStyle('B' . ($k + 7) . ':C' . ($k + 7))->applyFromArray($styleArray); } if ($k) { $objPHPExcel->getActiveSheet()->setTitle('Thống kê chấm công'); $file_name = 'Thong_ke_thang_' . $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; } else { $this->_helper->viewRenderer->setRender('loi'); } } else { $this->_helper->viewRenderer->setRender('loi'); } }
public function editAction() { $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED; $option = array('layout' => 'hethong/layout', 'layoutPath' => $layoutPath); Zend_Layout::startMvc($option); $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); $id = $this->_getParam('id', 0); $userModel = new Front_Model_Users(); $employeesModel = new Front_Model_Employees(); $groupsModel = new Front_Model_Groups(); $list_employees = $employeesModel->fetchAll(); $list_groups = $groupsModel->fetchAll(); $error_message = array(); $success_message = ''; $user_info = $userModel->fetchRow('user_id=' . $id); if (!$user_info) { $error_message[] = 'Không tìm thấy thông tin của tài khoản.'; } if ($this->_request->isPost()) { $username = trim($this->_arrParam['username']); $password = trim($this->_arrParam['password']); $employee = $this->_arrParam['employee']; $group = $this->_arrParam['group']; $status = $this->_arrParam['status']; $validator_length = new Zend_Validate_StringLength(array('min' => 4, 'max' => 12)); $validator_username = new Zend_Validate_Alnum(array('allowWhiteSpace' => false)); //kiem tra dữ liệu if (!$validator_length->isValid($username)) { $error_message[] = 'Tên tài khoản phải bằng hoặc hơn 4 ký tự và nhỏ hơn hoặc bằng 12 ký tự.'; } if (!$validator_username->isValid($username)) { $error_message[] = 'Tên tài khoản không không được chứa khoảng trắng.'; } if ($password) { if (!$validator_length->isValid($password)) { $error_message[] = 'Mật khẩu phải bằng hoặc hơn 4 ký tự và nhỏ hơn hoặc bằng 12 ký tự.'; } } //check username đã tồn tại $check_username = $userModel->fetchRow('username="******" and username !="' . $user_info->username . '"'); if ($check_username) { $error_message[] = 'Tên đăng nhập <strong>' . $username . '</strong> đã tồn tại.'; } //check employee $check_employee = $userModel->fetchRow('em_id=' . $employee . ' and em_id !=' . $user_info->em_id); if ($check_employee) { $error_message[] = 'Nhân viên <strong>' . $this->view->viewGetName($employee) . '</strong> đã có tài khoản rồi.'; } if (!sizeof($error_message)) { $current_time = new Zend_Db_Expr('NOW()'); $userModel->update(array('em_id' => $employee, 'group_id' => $group, 'username' => $username, 'status' => $status, 'date_modified' => $current_time), 'user_id=' . $id); if ($password) { $userModel->update(array('password' => md5($password)), 'user_id=' . $id); } $user_info->em_id = $employee; $user_info->group_id = $group; $user_info->username = $username; $user_info->status = $status; $success_message = 'Đã cập nhật thông tin tài khoản thành công.'; } } $this->view->user_info = $user_info; $this->view->success_message = $success_message; $this->view->error_message = $error_message; $this->view->list_groups = $list_groups; $this->view->list_employees = $list_employees; }
public function downtheophongAction() { $translate = Zend_Registry::get('Zend_Translate'); $this->view->title = 'In lương - ' . $translate->_('TEXT_DEFAULT_TITLE'); $this->view->headTitle($this->view->title); $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED; $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath); Zend_Layout::startMvc($option); $date = time(); $thang = $this->_getParam('thang', date('m', $date)); $nam = $this->_getParam('nam', date('Y', $date)); $emModel = new Front_Model_Employees(); $phongbanModel = new Front_Model_Phongban(); $pb_selected = $this->_getParam('phongban', 0); $phong_ban_id = $list_phongban_selected = $phong_ban = array(); $phong_ban_selected_info = $phongbanModel->fetchRow("pb_id={$pb_selected}"); $phong_ban_id[] = $pb_selected; $list_phongban_selected = $phongbanModel->fetchDataStatus($pb_selected, $phong_ban); if (sizeof($list_phongban_selected)) { foreach ($list_phongban_selected as $phong_ban_info) { $phong_ban_id[] = $phong_ban_info->pb_id; } } $phong_ban_id = implode(',', $phong_ban_id); $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1"); if ($list_nhan_vien) { $khenthuongModel = new Front_Model_KhenThuong(); $kyluatModel = new Front_Model_KyLuat(); $bangluongModel = new Front_Model_BangLuong(); $k = 0; $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')); foreach ($list_nhan_vien as $nhan_vien) { $khen_thuong = $khenthuongModel->fetchByDate($nhan_vien->em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59"); $ky_luat = $kyluatModel->fetchByDate($nhan_vien->em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59"); $bang_luong = $bangluongModel->fetchByDate($nhan_vien->em_id, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59"); if ($bang_luong) { $k++; if ($k > 1) { $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')); } $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"> </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>' . $nhan_vien->em_ho . ' ' . $nhan_vien->em_ten . '</td> <td>' . ($nhan_vien->em_gioi_tinh ? 'Nam' : 'Nữ') . '</td> <td>' . date('d-m-Y', strtotime($nhan_vien->em_ngay_sinh)) . '</td> <td>' . $this->view->viewGetPhongBanName($nhan_vien->em_phong_ban) . '</td> <td>' . $this->view->viewGetChucVuName($nhan_vien->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> '; $pdf->writeHTMLCell(0, 0, '', '', $text_outout, 0, 1, 0, true, '', true); } } if ($k) { if ($pb_selected && $phong_ban_selected_info) { $file_name = 'Bang_luong_' . str_replace(' ', '_', $this->loc_tieng_viet($phong_ban_selected_info->pb_name)) . '_' . $thang . '-' . $nam . '.pdf'; } else { $file_name = 'Bang_luong_' . $thang . '-' . $nam . '.pdf'; } $pdf->Output($file_name, 'I'); die; } else { $this->_helper->viewRenderer->setRender('loi'); } } else { $this->_helper->viewRenderer->setRender('loi'); } }
public function auto02Action() { $translate = Zend_Registry::get('Zend_Translate'); $this->view->title = 'Tính lương hệ số 0.2 - ' . $translate->_('TEXT_DEFAULT_TITLE'); $this->view->headTitle($this->view->title); $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED; $option = array('layout' => '1_column/layout', 'layoutPath' => $layoutPath); Zend_Layout::startMvc($option); $auth = Zend_Auth::getInstance(); $identity = $auth->getIdentity(); $my_id = $identity->em_id; $date = new Zend_Date(); $date->subMonth(1); $thang = $this->_getParam('thang', $date->toString('M')); $nam = $this->_getParam('nam', $date->toString('Y')); $emModel = new Front_Model_Employees(); $phongbanModel = new Front_Model_Phongban(); $chucvuModel = new Front_Model_Chucvu(); $hesocbModel = new Front_Model_HeSo(); $hesoModel = new Front_Model_EmployeesHeso(); $bangluongModel = new Front_Model_BangLuong(); $danhgiaModel = new Front_Model_DanhGia(); $lastHeSoLuong = $hesocbModel->fetchOneData(array('hs_ngay_bat_dau' => date("{$nam}-{$thang}-1")), 'hs_ngay_bat_dau DESC'); $he_so_tang_them = 0.5; $he_so_phan_loai = array('O' => 0, 'A' => 1.2, 'B' => 1, 'C' => 0.8, 'D' => 0); $pb_selected = $this->_getParam('phongban', 0); $phong_ban_id = $list_phongban_selected = $phong_ban = array(); $phong_ban_id[] = $pb_selected; $list_phongban_selected = $phongbanModel->fetchDataStatus($pb_selected, $phong_ban); $list_chuc_vu = $chucvuModel->fetchAll(); $list_nhan_vien = $phong_ban_options = array(); $list_phong_ban_option = $phongbanModel->fetchData(0, $phong_ban_options); if (sizeof($list_phongban_selected)) { foreach ($list_phongban_selected as $phong_ban_info) { $phong_ban_id[] = $phong_ban_info->pb_id; } } $phong_ban_id = implode(',', $phong_ban_id); if ($pb_selected) { $list_nhan_vien = $emModel->fetchAll("em_phong_ban in ({$phong_ban_id}) and em_status=1"); } if ($this->_request->isPost()) { $item = $this->getRequest()->getPost('cid'); foreach ($item as $k => $v) { $bang_luong = $bangluongModel->fetchByDate($v, "{$nam}-{$thang}-01 00:00:00", "{$nam}-{$thang}-31 23:59:59"); if ($bang_luong && $bang_luong->bl_tong_he_so > 0) { $luong_toi_thieu = $bang_luong->bl_luong_toi_thieu; //luong co ban $tong_hs_luong_pc = $bang_luong->bl_tong_he_so; $tam_chi_dau_vao = $tong_hs_luong_pc * $luong_toi_thieu * 0.5; $data = array('bl_ptccb_id' => $my_id, 'bl_tam_chi_dau_vao_02' => $tam_chi_dau_vao, 'bl_02' => 1); $bl_id = $bang_luong->bl_id; $bangluongModel->update($data, "bl_id={$bl_id}"); } } } $this->view->list_nhan_vien = $list_nhan_vien; $this->view->thang = $thang; $this->view->nam = $nam; $this->view->pb_id = $pb_selected; $this->view->list_phong_ban_option = $list_phong_ban_option; $this->view->list_chuc_vu = $list_chuc_vu; }