public function converthesoAction() { $hesoModel = new Front_Model_EmployeesHeso(); $phucap_model = new Front_Model_EmployeesPhuCap(); $list_he_so = $hesoModel->fetchAll(); foreach ($list_he_so as $he_so) { $data = array('epc_em_id' => $he_so->eh_em_id, 'eh_pc_cong_viec' => $he_so->eh_pc_cong_viec, 'eh_pc_trach_nhiem' => $he_so->eh_pc_trach_nhiem, 'eh_pc_tnvk_phan_tram' => $he_so->eh_pc_tnvk_phan_tram, 'eh_tham_niem' => $he_so->eh_tham_niem, 'eh_pc_udn_phan_tram' => $he_so->eh_pc_udn_phan_tram, 'eh_pc_cong_vu_phan_tram' => $he_so->eh_pc_cong_vu_phan_tram, 'eh_pc_kiem_nhiem' => $he_so->eh_pc_kiem_nhiem, 'eh_pc_khac' => $he_so->eh_pc_khac, 'eh_date_added' => $he_so->eh_date_added, 'eh_date_modified' => $he_so->eh_date_modified, 'eh_pc_kv' => $he_so->eh_pc_kv, 'eh_pc_khac_type' => $he_so->eh_pc_khac_type, 'eh_pc_thu_hut' => $he_so->eh_pc_thu_hut, 'eh_pc_doc_hai' => $he_so->eh_pc_doc_hai, 'eh_pc_doc_hai_type' => $he_so->eh_pc_doc_hai_type, 'eh_han_ap_dung' => $he_so->eh_han_ap_dung, 'eh_pc_tham_nien' => $he_so->eh_pc_tham_nien); $phucap_model->insert($data); } die('ok'); }
public function xuatAction() { $inputFileName = APPLICATION_PATH . "/../tmp/xuat_du_lieu.xlsx"; $objPHPExcel = PHPExcel_IOFactory::load($inputFileName); $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("Bảng thông tin"); $objPHPExcel->getProperties()->setSubject("Bảng thông tin"); $objPHPExcel->getProperties()->setDescription("Bảng thông tin nhân viên - Cục Hải Quan Hà Tĩnh"); $translate = Zend_Registry::get('Zend_Translate'); $this->view->title = 'Lọc danh sách theo nghạch công chức - ' . $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); $hesoModel = new Front_Model_EmployeesHeso(); $emModel = new Front_Model_Employees(); $filterModel = new Front_Model_NgachCongChuc(); $phucapModel = new Front_Model_EmployeesPhuCap(); $list_filters = $filterModel->fetchData(array('ncc_status' => 1)); $filters = array(); if ($filter_selected) { $filters['em_ngach_cong_chuc'] = $filter_selected; } $list_items = $emModel->getListNhanVienDanhSachTheoChucVu($filters); $date = time(); $thang = date('m', $date); $nam = date('Y', $date); $i = 4; if (sizeof($list_items)) { $stt = 1; foreach ($list_items as $item) { $time_tang_bac = 0; $em_he_so = $hesoModel->getCurrentHeSo($thang, $nam, $item->em_id); $em_phu_cap = $phucapModel->getCurrentHeSo($thang, $nam, $item->em_id); $objPHPExcel->setActiveSheetIndex(0); $ngach_cong_chuc = $this->view->viewGetNgachCongChuc($item->em_ngach_cong_chuc); $objPHPExcel->getActiveSheet()->SetCellValue('A' . $i, $stt); $objPHPExcel->getActiveSheet()->SetCellValue('B' . $i, $item->em_ho . ' ' . $item->em_ten); $objPHPExcel->getActiveSheet()->SetCellValue('C' . $i, $item->em_ho); $objPHPExcel->getActiveSheet()->SetCellValue('D' . $i, $item->em_ten); if ($item->em_gioi_tinh) { if ($item->em_ngay_sinh && $item->em_ngay_sinh != '' && $item->em_ngay_sinh != '0000-00-00 00:00:00') { $objPHPExcel->getActiveSheet()->SetCellValue('E' . $i, date('m/Y', strtotime($item->em_ngay_sinh))); } } else { if ($item->em_ngay_sinh && $item->em_ngay_sinh != '' && $item->em_ngay_sinh != '0000-00-00 00:00:00') { $objPHPExcel->getActiveSheet()->SetCellValue('F' . $i, date('m/Y', strtotime($item->em_ngay_sinh))); } } $objPHPExcel->getActiveSheet()->SetCellValue('G' . $i, $this->view->viewGetChucVuName($item->em_chuc_vu)); $objPHPExcel->getActiveSheet()->SetCellValue('H' . $i, $this->view->viewGetPhongBanName($item->em_phong_ban)); if ($ngach_cong_chuc) { $objPHPExcel->getActiveSheet()->SetCellValue('I' . $i, $ngach_cong_chuc->ncc_ma_ngach); $objPHPExcel->getActiveSheet()->SetCellValue('J' . $i, $ngach_cong_chuc->ncc_name); $time_tang_bac = $ngach_cong_chuc->ncc_nam_nang_bac; } if ($item->em_time_cong_tac && $item->em_time_cong_tac != '' && $item->em_time_cong_tac != '0000-00-00 00:00:00') { $objPHPExcel->getActiveSheet()->SetCellValue('L' . $i, date('m/Y', strtotime($item->em_time_cong_tac))); } foreach (unserialize($item->em_lich_su_dao_tao) as $item_daotao) { $objPHPExcel->getActiveSheet()->SetCellValue('M' . $i, $item_daotao['chuyen_nghanh']); $objPHPExcel->getActiveSheet()->SetCellValue('N' . $i, $item_daotao['ten_truong']); $objPHPExcel->getActiveSheet()->SetCellValue('O' . $i, $item_daotao['van_bang']); $objPHPExcel->getActiveSheet()->SetCellValue('P' . $i, $item_daotao['hinh_thuc']); } $objPHPExcel->getActiveSheet()->SetCellValue('Q' . $i, $this->view->viewGetQuanLyNhaNuocName($item->em_quan_ly_nha_nuoc)); $objPHPExcel->getActiveSheet()->SetCellValue('R' . $i, $this->view->viewGetLyLuanChinhTriName($item->em_ly_luan_chinh_tri)); if ($item->em_chuc_vu_dang) { $objPHPExcel->getActiveSheet()->SetCellValue('S' . $i, 'X'); } if ($em_he_so) { $bac_luong = $this->view->viewGetBacLuong($em_he_so->eh_bac_luong); if ($bac_luong) { $objPHPExcel->getActiveSheet()->SetCellValue('T' . $i, $bac_luong->bl_name); $objPHPExcel->getActiveSheet()->SetCellValue('W' . $i, date('1/m', strtotime($em_he_so->eh_han_dieu_chinh)) . (date('Y', strtotime($em_he_so->eh_han_dieu_chinh)) + $time_tang_bac)); } $objPHPExcel->getActiveSheet()->SetCellValue('U' . $i, $em_he_so->eh_he_so); if ($em_phu_cap) { $hs_pc_chuc_vu = $em_phu_cap->eh_pc_cong_viec; $hs_pc_tnvk_phan_tram = $em_phu_cap->eh_pc_tnvk_phan_tram; $he_so_luong = $em_he_so->eh_he_so; $hs_pc_tnvk = ($he_so_luong + $hs_pc_chuc_vu) * $hs_pc_tnvk_phan_tram / 100; if ($em_phu_cap->eh_tham_niem && $em_phu_cap->eh_tham_niem != '' && $em_phu_cap->eh_tham_niem != '0000-00-00 00:00:00') { $objPHPExcel->getActiveSheet()->SetCellValue('K' . $i, date('1/m/Y', strtotime($em_phu_cap->eh_tham_niem))); } if ($em_he_so->eh_han_dieu_chinh && $em_he_so->eh_han_dieu_chinh != '' && $em_he_so->eh_han_dieu_chinh != '0000-00-00 00:00:00') { $objPHPExcel->getActiveSheet()->SetCellValue('V' . $i, date('1/m/Y', strtotime($em_he_so->eh_han_dieu_chinh))); } $objPHPExcel->getActiveSheet()->SetCellValue('X' . $i, number_format($hs_pc_tnvk, 0, '.', ',')); } } $objPHPExcel->getActiveSheet()->SetCellValue('Y' . $i, $item->em_so_cong_chuc); $objPHPExcel->getActiveSheet()->SetCellValue('Z' . $i, $item->em_phone); $i++; $stt++; } header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="Bang_Thong_Tin_Nhan_Vien_Theo_Nghach_Cong_Chuc.xls"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); die; } else { die('Không có dữ liệu nào'); } }
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 auto05Action() { $translate = Zend_Registry::get('Zend_Translate'); $this->view->title = 'Tinh lương hệ số 0.5 - ' . $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(); $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(); $phucapModel = new Front_Model_EmployeesPhuCap(); $bangluongModel = new Front_Model_BangLuong(); $lastHeSoLuong = $hesocbModel->fetchOneData(array('hs_ngay_bat_dau' => date("{$nam}-{$thang}-1")), 'hs_ngay_bat_dau DESC'); $he_so_tang_them = 0.5; $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) { $em_he_so = $hesoModel->getCurrentHeSo($thang, $nam, $v); $em_phu_cap = $phucapModel->getCurrentHeSo($thang, $nam, $v); $luong_toi_thieu = $lastHeSoLuong->hs_luong_co_ban; //luong co ban $giai_doan = $em_he_so->eh_giai_doan; //0: chinh thuc, 1: thu viec $loai_luong = $em_he_so->eh_loai_luong; //0: bien che, 1: hop dong $he_so_luong = $em_he_so->eh_he_so; $luong_thu_viec = 0; if ($giai_doan) { $luong_thu_viec = $lastHeSoLuong->hs_he_so_luong_thuc_tap; //so phan tram so voi luong chinh $he_so_luong = number_format($em_he_so->eh_he_so * (100 - $luong_thu_viec) / 100, 2); } $bhxh = $lastHeSoLuong->hs_bhxh > 0 ? $lastHeSoLuong->hs_bhxh : 0; //bao hiem xa hoi $bhyt = $lastHeSoLuong->hs_bhyt > 0 ? $lastHeSoLuong->hs_bhyt : 0; //bao hiem y te $hs_pc_chuc_vu = $em_phu_cap->eh_pc_cong_viec; //he so pc chuc vu $hs_pc_trach_nhiem = $em_phu_cap->eh_pc_trach_nhiem; //he so pc trach nhiem $hs_pc_khu_vuc = $em_phu_cap->eh_pc_kv; //he so pc khu vuc $hs_pc_tnvk_phan_tram = $em_phu_cap->eh_pc_tnvk_phan_tram; //he so pc tnvk $time_tham_niem = strtotime($em_phu_cap->eh_tham_niem); //tinh tham nien tu ngay $hs_pc_tham_nien_phan_tram = $em_phu_cap->eh_pc_tham_nien; $uu_dai_nghe = $em_phu_cap->eh_pc_udn_phan_tram; //he so pc uu dai nghe $cong_vu = $em_phu_cap->eh_pc_cong_vu_phan_tram; //he so pc cong vu $thu_hut = $em_phu_cap->eh_pc_thu_hut; //he so pc thu hut $kiem_nhiem = $em_phu_cap->eh_pc_kiem_nhiem; //he so pc kiem nhiem $hs_pc_khac = $em_phu_cap->eh_pc_khac; //he so pc khac $hs_pc_khac_type = $em_phu_cap->eh_pc_khac_type; //0: he so, 1: phan tram if (!$giai_doan && !$loai_luong) { $hs_pc_tnvk = ($he_so_luong + $hs_pc_chuc_vu) * $hs_pc_tnvk_phan_tram / 100; } else { $hs_pc_tnvk = $hs_pc_chuc_vu * $hs_pc_tnvk_phan_tram / 100; } if (!$giai_doan) { $hs_pc_tham_nien = ($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $hs_pc_tham_nien_phan_tram / 100; } else { $hs_pc_tham_nien = ($hs_pc_chuc_vu + $hs_pc_tnvk) * $hs_pc_tham_nien_phan_tram / 100; } $hs_pc_uu_dai_nghe = ($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $uu_dai_nghe / 100; $hs_pc_cong_vu = ($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $cong_vu / 100; $hs_pc_thu_hut = ($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $thu_hut / 100; if (!$giai_doan && !$loai_luong) { $hs_pc_kiem_nhiem = ($he_so_luong + $hs_pc_chuc_vu + $hs_pc_tnvk) * $kiem_nhiem / 100; } else { $hs_pc_kiem_nhiem = ($hs_pc_chuc_vu + $hs_pc_tnvk) * $kiem_nhiem / 100; } $hs_pc_khac_he_so = $hs_pc_khac; if ($hs_pc_khac_type) { $hs_pc_khac_he_so = $hs_pc_khac / 100; } $current_time = new Zend_Db_Expr('NOW()'); $data = array('bl_em_id' => $v, 'bl_ptccb_id' => $my_id, 'bl_luong_toi_thieu' => $luong_toi_thieu, 'bl_luong_thu_viec' => $luong_thu_viec, 'bl_giai_doan' => $giai_doan, 'bl_loai_luong' => $loai_luong, 'bl_bhxh' => $bhxh, 'bl_bhyt' => $bhyt, 'bl_tham_nien' => $hs_pc_tham_nien_phan_tram, 'bl_time_tham_nien' => date('Y-m-d', $time_tham_niem), 'bl_pc_kiem_nhiem' => $kiem_nhiem, 'bl_pc_tang_them' => $he_so_tang_them, 'bl_hs_luong' => $he_so_luong, 'bl_hs_pc_cong_viec' => $hs_pc_chuc_vu, 'bl_hs_pc_trach_nhiem' => $hs_pc_trach_nhiem, 'bl_hs_pc_khu_vuc' => $hs_pc_khu_vuc, 'bl_hs_pc_tnvk' => $hs_pc_tnvk_phan_tram, 'bl_hs_pc_udn' => $uu_dai_nghe, 'bl_hs_pc_cong_vu' => $cong_vu, 'bl_pc_thu_hut' => $thu_hut, 'bl_hs_pc_khac' => $hs_pc_khac, 'bl_pc_khac_type' => $hs_pc_khac_type, 'bl_date_modified' => $current_time, 'bl_date_added' => $current_time, 'bl_date' => "{$nam}-{$thang}-1"); $bangluongModel->insert($data); } } } $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; }