コード例 #1
0
 public function index()
 {
     $templateList = M('SmsTemplate')->order('order_id')->select();
     $this->templateList = $templateList;
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #2
0
 public function edit()
 {
     $d_navigation = D('Navigation');
     if ($this->isPost()) {
         $data['navigation_id'] = $this->_post('navigation_id', 'intval', 0);
         $data['name'] = $this->_post('name', 'trim', '');
         $data['description'] = $this->_post('description', 'trim', '');
         $data['default_display'] = $this->_post('default_display', 'intval', 0);
         $data['control_ids'] = $this->_post('control_ids', 'trim', '');
         $data['sort_id'] = $this->_post('sort_id', 'intval', 0);
         if ($data['navigation_id'] == 0) {
             alert('error', '参数错误!', U('core/navigation/index'));
         }
         if ($d_navigation->checkNavigationName($data['name'], $data['navigation_id'])) {
             alert('error', '导航名称为空或已存在!', U('core/navigation/index'));
         }
         if ($data['default_display'] == 0) {
             alert('error', '请选择默认操作', U('core/navigation/index'));
         }
         if ($d_navigation->editNavigation($data)) {
             alert('success', '修改成功!', U('core/navigation/index'));
         } else {
             alert('error', '数据无变化,修改失败!', U('core/navigation/index'));
         }
     } else {
         $navigation_id = $this->_get('id', 'intval', 0);
         if ($navigation_id == 0) {
             alert('error', '参数错误!', U('core/navigation/index'));
         }
         $this->navigation = $d_navigation->getNavigationById($navigation_id);
         $this->alert = parseAlert();
         $this->display();
     }
 }
コード例 #3
0
 public function index()
 {
     $search_user_name = empty($_GET['search_user_name']) ? '' : trim($_GET['search_user_name']);
     $search_type = $_GET['search_type'] == '' ? '' : intval($_GET['search_type']);
     $search_start_time = empty($_GET['search_start_time']) ? '' : strtotime($_GET['search_start_time']);
     $search_end_time = empty($_GET['search_end_time']) ? '' : strtotime($_GET['search_end_time']);
     if (!empty($search_user_name)) {
         $condition['user_name'] = $search_user_name;
     }
     if ('' !== $search_type) {
         $condition['type'] = $search_type;
     }
     if (!empty($search_start_time)) {
         if (!empty($search_end_time)) {
             $condition['create_time'] = array('between', array($search_start_time, $search_end_time));
         } else {
             $condition['create_time'] = array('between', array($search_start_time - 1, $search_start_time + 86400));
         }
     }
     if (!empty($search_end_time)) {
         if (!empty($search_start_time)) {
             $condition['create_time'] = array('between', array($search_start_time, $search_end_time));
         } else {
             $condition['create_time'] = array('between', array($search_end_time - 1, $search_end_time + 86400));
         }
     }
     $d_punch = D('Punch');
     $p = $this->_get('p', 'intval', 1);
     $punchlist = $d_punch->getPunchList($p, $condition);
     $this->punchlist = $punchlist['punchlist'];
     $this->assign('page', $punchlist['page']);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #4
0
 public function index()
 {
     if (!F('smtp')) {
         alert('info', '<font style="color:red;">SMTP信息未配置 (无法使用密码找回功能)</font>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . U('setting/smtp') . '">点此设置</a>');
     }
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #5
0
 public function monthly()
 {
     if ($this->isPost()) {
         $data['status'] = $_POST['status'];
         $data['name'] = $_POST['user_name'];
         $data['start_time'] = strtotime($_POST['start_time']);
         $d_attendancesheet = D('AttendanceSheet');
         $attendancesheet = $d_attendancesheet->getMonthly($data);
         $this->monthly = $attendancesheet;
     }
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #6
0
 public function edit()
 {
     if ($this->isPost()) {
         if (D('Archives')->editArchives()) {
             alert('success', '编辑员工档案成功', U('hrm/archives/index'));
         } else {
             alert('error', '编辑员工档案失败,' . D('Archives')->getError(), U(''));
         }
     } else {
         $user_id = $this->_get('user_id', 'intval', 0);
         $info = D('Archives')->getArchivesInfo($user_id);
         if (!$info) {
             alert('error', '没有找相应记录', U('hrm/archives/index'));
         }
         $this->assign('info', $info);
         $this->alert = parseAlert();
         $this->display();
     }
 }
コード例 #7
0
 public function edit()
 {
     if ($this->isPost()) {
         $m_check_template = M('checkTemplate');
         $data = $m_check_template->create();
         if ($m_check_template->save($data)) {
             alert('success', '更新成功', U('hrm/check/edit', 'id=' . $data['check_template_id']));
         } else {
             alert('error', '更新失败,或数据没有变化', U('hrm/check/edit', 'id=' . $data['check_template_id']));
         }
     } else {
         $id = $this->_get('id', 'intval', 0);
         $info = M('checkTemplate')->where('check_template_id', $id)->find();
         if (!$info) {
             alert('error', '没有找相应记录', U('hrm/check/index'));
         }
         $this->assign('info', $info);
         $this->alert = parseAlert();
         $this->display();
     }
 }
コード例 #8
0
 public function monthly()
 {
     if ($this->isPost()) {
         if ($_POST['user_id']) {
             $data['user_id'] = array('in', explode(',', $_POST['user_id']));
         }
         if ($_POST['start_time'] > $_POST['end_time']) {
             alert('error', '结束时间不能小于开始时间', U(''));
         }
         $month = $_POST['start_time'];
         do {
             $date[] = $month;
             $month++;
             if (substr($month, -2) > 12) {
                 $month += 88;
             }
         } while ($_POST['end_time'] >= $month);
         $data['month'] = array('in', $date);
         $info_list = D('Salary')->getMonthly($data);
         $this->monthly = $info_list;
     }
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #9
0
 public function index()
 {
     //更新最后阅读时间
     $m_user = M('user');
     $last_read_time_js = $m_user->where('role_id = %d', session('role_id'))->getField('last_read_time');
     $last_read_time = json_decode($last_read_time_js, true);
     $last_read_time['contract'] = time();
     $m_user->where('role_id = %d', session('role_id'))->setField('last_read_time', json_encode($last_read_time));
     $contract = D('ContractView');
     $below_ids = getSubRoleId(false);
     $all_ids = getSubRoleId();
     $where = array();
     $order = 'contract.create_time desc';
     if ($_GET['desc_order']) {
         $order = trim($_GET['desc_order']) . ' desc';
     } elseif ($_GET['asc_order']) {
         $order = trim($_GET['asc_order']) . ' asc';
     }
     switch ($_GET['by']) {
         case 'create':
             $where['contract.creator_role_id'] = session('role_id');
             break;
         case 'sub':
             $where['contract.owner_role_id'] = array('in', implode(',', $below_ids));
             break;
         case 'subcreate':
             $where['contract.creator_role_id'] = array('in', implode(',', $below_ids));
             break;
         case 'today':
             $where['contract.due_time'] = array('between', array(strtotime(date('Y-m-d')) - 1, strtotime(date('Y-m-d')) + 86400));
             break;
         case 'week':
             $week = date('w') == 0 ? 7 : date('w');
             $where['contract.due_time'] = array('between', array(strtotime(date('Y-m-d')) - ($week - 1) * 86400 - 1, strtotime(date('Y-m-d')) + (8 - $week) * 86400));
             break;
         case 'month':
             $next_year = date('Y') + 1;
             $next_month = date('m') + 1;
             $month_time = date('m') == 12 ? strtotime($next_year . '-01-01') : strtotime(date('Y') . '-' . $next_month . '-01');
             $where['contract.due_time'] = array('between', array(strtotime(date('Y-m-01')) - 1, $month_time));
             break;
         case 'add':
             $order = 'contract.create_time desc';
             break;
         case 'deleted':
             $where['contract.is_deleted'] = 1;
             break;
         case 'update':
             $order = 'contract.update_time desc';
             break;
         case 'me':
             $where['contract.owner_role_id'] = session('role_id');
             break;
         default:
             $where['contract.owner_role_id'] = array('in', implode(',', $all_ids));
             break;
     }
     if (!isset($where['contract.is_deleted'])) {
         $where['contract.is_deleted'] = 0;
     }
     if (!isset($where['contract.owner_role_id'])) {
         $where['contract.owner_role_id'] = array('in', implode(',', getSubRoleId()));
     }
     if ($_REQUEST["field"]) {
         if (trim($_REQUEST['field']) == "all") {
             $field = is_numeric(trim($_REQUEST['search'])) ? 'number|price|contract.description' : 'number|contract.description';
         } else {
             $field = trim($_REQUEST['field']);
         }
         $search = empty($_REQUEST['search']) ? '' : trim($_REQUEST['search']);
         $condition = empty($_REQUEST['condition']) ? 'is' : trim($_REQUEST['condition']);
         if ('create_time' == $field || 'update_time' == $field || 'start_date' == $field || 'end_date' == $field) {
             $search = is_numeric($search) ? $search : strtotime($search);
         }
         switch ($condition) {
             case "is":
                 if ($field == 'customer_id') {
                     $where['customer.' . $field] = array('eq', $search);
                 } else {
                     $where['contract.' . $field] = array('eq', $search);
                 }
                 break;
             case "isnot":
                 $where['contract.' . $field] = array('neq', $search);
                 break;
             case "contains":
                 $where['contract.' . $field] = array('like', '%' . $search . '%');
                 break;
             case "not_contain":
                 $where['contract.' . $field] = array('notlike', '%' . $search . '%');
                 break;
             case "start_with":
                 $where['contract.' . $field] = array('like', $search . '%');
                 break;
             case "end_with":
                 $where['contract.' . $field] = array('like', '%' . $search);
                 break;
             case "is_empty":
                 $where['contract.' . $field] = array('eq', '');
                 break;
             case "is_not_empty":
                 $where['contract.' . $field] = array('neq', '');
                 break;
             case "gt":
                 $where['contract.' . $field] = array('gt', $search);
                 break;
             case "egt":
                 $where['contract.' . $field] = array('egt', $search);
                 break;
             case "lt":
                 $where['contract.' . $field] = array('lt', $search);
                 break;
             case "elt":
                 $where['contract.' . $field] = array('elt', $search);
                 break;
             case "eq":
                 $where['contract.' . $field] = array('eq', $search);
                 break;
             case "neq":
                 $where['contract.' . $field] = array('neq', $search);
                 break;
             case "between":
                 $where['contract.' . $field] = array('between', array($search - 1, $search + 86400));
                 break;
             case "nbetween":
                 $where['contract.' . $field] = array('not between', array($search, $search + 86399));
                 break;
             case "tgt":
                 $where['contract.' . $field] = array('gt', $search + 86400);
                 break;
             default:
                 $where[$field] = array('eq', $search);
         }
         $params = array('field=' . trim($_REQUEST['field']), 'condition=' . $condition, 'search=' . $_REQUEST["search"]);
     }
     $p = intval($_GET['p']) ? intval($_GET['p']) : 1;
     $list = $contract->where($where)->page($p . ',15')->order($order)->select();
     $count = $contract->where($where)->count();
     import("@.ORG.Page");
     $Page = new Page($count, 15);
     if (!empty($_GET['by'])) {
         $params[] = "by=" . trim($_GET['by']);
     }
     $this->parameter = implode('&', $params);
     if ($_GET['desc_order']) {
         $params[] = "desc_order=" . trim($_GET['desc_order']);
     } elseif ($_GET['asc_order']) {
         $params[] = "asc_order=" . trim($_GET['asc_order']);
     }
     foreach ($list as $key => $value) {
         $list[$key]['owner'] = getUserByRoleId($value['owner_role_id']);
         $list[$key]['creator'] = getUserByRoleId($value['creator_role_id']);
         $list[$key]['deletor'] = getUserByRoleId($value['delete_role_id']);
         $list[$key]['supplier_name'] = M('supplier')->where('supplier_id = %d', $value['supplier_id'])->getField('name');
         $contacts_id = M('Business')->where('business_id = %d', $value['business_id'])->getField('contacts_id');
         $list[$key]['contacts_name'] = M('contacts')->where('contacts_id = %d', $contacts_id)->getField('name');
         $end_date = $contract->where('contract_id = %d', $value['contract_id'])->getField('end_date');
         if ($end_date) {
             $list[$key]['days'] = floor(($end_date - time()) / 86400 + 1);
         }
     }
     // println($list);
     $Page->parameter = implode('&', $params);
     $this->assign('page', $Page->show());
     $this->assign('list', $list);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #10
0
 public function edit()
 {
     $log_id = intval($_REQUEST['id']);
     if (!empty($log_id)) {
         if ($this->isPost()) {
             $data['log_id'] = $log_id;
             $data['title'] = trim($_POST['title']);
             $data['content'] = $_POST['content'];
             $data['update_time'] = time();
             if ('' == $data['title']) {
                 alert('error', '日志标题不能为空!', $_SERVER['HTTP_REFERER']);
             }
             if ('' == $data['content']) {
                 alert('error', '日志内容不能为空!', $_SERVER['HTTP_REFERER']);
             }
             $d_log = D('Log');
             if ($d_log->editLog($data)) {
                 alert('success', '编辑成功!', U('core/log/index'));
             } else {
                 alert('error', '信息无变化,编辑失败!', U('core/log/index'));
             }
         } else {
             $d_log = D('Log');
             $log = $d_log->getLogById($log_id);
         }
     } else {
         alert('error', '参数错误!', $_SERVER['HTTP_REFERER']);
     }
     $this->log = $log;
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #11
0
 public function index()
 {
     $m_feedback = M('Feedback');
     $by = isset($_GET['by']) ? trim($_GET['by']) : '';
     $order = isset($_GET['order']) ? trim($_GET['order']) : '';
     $where['status'] = 1;
     $params = array();
     switch ($order) {
         case 'ct_up':
             $order = 'create_time';
             break;
         case 'ct_down':
             $order = 'create_time desc';
             break;
         default:
             $order = 'create_time desc';
             break;
     }
     switch ($by) {
         case 'today':
             $where['create_time'] = array('between', array(strtotime(date('Y-m-d')) - 1, strtotime(date('Y-m-d')) + 86400));
             break;
         case 'week':
             $week = date('w') == 0 ? 7 : date('w');
             $where['create_time'] = array('between', array(strtotime(date('Y-m-d')) - ($week - 1) * 86400 - 1, strtotime(date('Y-m-d')) + (8 - $week) * 86400));
             break;
         case 'month':
             $next_year = date('Y') + 1;
             $next_month = date('m') + 1;
             $month_time = date('m') == 12 ? strtotime($next_year . '-01-01') : strtotime(date('Y') . '-' . $next_month . '-01');
             $where['create_time'] = array('between', array(strtotime(date('Y-m-01')) - 1, $month_time));
             break;
     }
     if ($_REQUEST["field"]) {
         $field = $_REQUEST['field'];
         $search = empty($_REQUEST['search']) ? '' : trim($_REQUEST['search']);
         $condition = empty($_REQUEST['condition']) ? 'is' : trim($_REQUEST['condition']);
         if ('create_time' == $field) {
             $search = is_numeric($search) ? $search : strtotime($search);
         }
         switch ($_REQUEST['condition']) {
             case "is":
                 $where[$field] = array('eq', $search);
                 break;
             case "isnot":
                 $where[$field] = array('neq', $search);
                 break;
             case "contains":
                 $where[$field] = array('like', '%' . $search . '%');
                 break;
             case "not_contain":
                 $where[$field] = array('notlike', '%' . $search . '%');
                 break;
             case "start_with":
                 $where[$field] = array('like', $search . '%');
                 break;
             case "end_with":
                 $where[$field] = array('like', '%' . $search);
                 break;
             case "is_empty":
                 $where[$field] = array('eq', '');
                 break;
             case "is_not_empty":
                 $where[$field] = array('neq', '');
                 break;
             case "gt":
                 $where[$field] = array('gt', $search);
                 break;
             case "egt":
                 $where[$field] = array('egt', $search);
                 break;
             case "lt":
                 $where[$field] = array('lt', $search);
                 break;
             case "elt":
                 $where[$field] = array('elt', $search);
                 break;
             case "eq":
                 $where[$field] = array('eq', $search);
                 break;
             case "neq":
                 $where[$field] = array('neq', $search);
                 break;
             case "between":
                 $where[$field] = array('between', array($search - 1, $search + 86400));
                 break;
             case "nbetween":
                 $where[$field] = array('not between', array($search, $search + 86399));
                 break;
             case "tgt":
                 $where[$field] = array('gt', $search + 86400);
                 break;
             default:
                 $where[$field] = array('eq', $search);
         }
         $params = array('field=' . $field, 'condition=' . $condition, 'search=' . trim($_REQUEST["search"]));
     }
     $p = isset($_GET['p']) ? intval($_GET['p']) : 1;
     $list = $m_feedback->where($where)->order($order)->page($p . ',15')->select();
     $count = $m_feedback->where($where)->count();
     foreach ($list as $k => $v) {
         if ($v['member_id']) {
             $list[$k]['member'] = M('Member')->where('member_id = %d', $v['member_id'])->find();
         }
     }
     import("@.ORG.Page");
     $Page = new Page($count, 15);
     $params[] = 'by =' . trim($_GET['by']);
     $parameter = implode('&', $params);
     $this->assign('parameter', $parameter);
     if ($_GET['order']) {
         $parameter .= '&order=' . trim($_GET['order']);
     }
     $Page->parameter = $parameter;
     $show = $Page->show();
     $this->assign('page', $show);
     $this->assign('memberlist', $list);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #12
0
 public function export()
 {
     if ($this->isPost()) {
         if (session('user_id') != 1) {
             alert('error', '您没有权限审核!', U('hrm/leave/index'));
         } else {
             $consoleTime = $_POST['search_start_time'];
             $search_start_time = strtotime($consoleTime);
             $search_end_time = strtotime($_POST['search_end_time']);
             if (!empty($search_start_time)) {
                 if (!empty($search_end_time)) {
                     $condition['start_time'] = array('between', array($search_start_time, $search_end_time));
                 } else {
                     $condition['start_time'] = array('between', array($search_start_time - 1, $search_start_time + 86400));
                 }
             }
             if (!empty($search_end_time)) {
                 if (!empty($search_start_time)) {
                     $condition['end_time'] = array('between', array($search_start_time, $search_end_time));
                 } else {
                     $condition['end_time'] = array('between', array($search_end_time - 1, $search_end_time + 86400));
                 }
             }
             $p = $this->_get('p', 'intval', 1);
             $leavelist = D('Leave')->getLeave($p, $condition);
             //excel代码开始:
             Vendor("PHPExcel.PHPExcel");
             $objPHPExcel = new PHPExcel();
             $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
             $Year = explode("-", $consoleTime)[0];
             $Month = explode("-", $consoleTime)[1];
             $excelTitle = $Year . '年' . $Month . '月请假导出';
             $objPHPExcel->setActiveSheetIndex(0);
             $objPHPExcel->getActiveSheet()->setTitle($excelTitle);
             $objPHPExcel->getActiveSheet()->setCellValue('A1', $excelTitle);
             $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
             $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
             $objPHPExcel->getActiveSheet()->mergeCells('A1:AO2');
             $objPHPExcel->getActiveSheet()->setCellValue('A3', '花名');
             $objPHPExcel->getActiveSheet()->mergeCells('A3:A4');
             $objPHPExcel->getActiveSheet()->setCellValue('B3', '姓名');
             $objPHPExcel->getActiveSheet()->mergeCells('B3:B4');
             $objPHPExcel->getActiveSheet()->setCellValue('C3', '星期');
             $objPHPExcel->getActiveSheet()->setCellValue('C4', '日');
             //设置单元格颜色
             //                $objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
             //                $objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('112233');
             $start_day = $_POST['search_start_time'];
             D('Leave')->getExcelDay($start_day, $objPHPExcel);
             D('Leave')->getExcelWk($start_day, $objPHPExcel);
             $objPHPExcel->getActiveSheet()->setCellValue('AJ3', '总天数');
             $objPHPExcel->getActiveSheet()->getStyle('AJ3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AK3', '年假');
             $objPHPExcel->getActiveSheet()->getStyle('AK3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AL3', '事假');
             $objPHPExcel->getActiveSheet()->getStyle('AL3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AM3', '病假');
             $objPHPExcel->getActiveSheet()->getStyle('AM3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AN3', '调休');
             $objPHPExcel->getActiveSheet()->getStyle('AN3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AO3', '其他');
             $objPHPExcel->getActiveSheet()->getStyle('AO3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AJ4', '天数');
             $objPHPExcel->getActiveSheet()->getStyle('AJ4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AK4', '天数');
             $objPHPExcel->getActiveSheet()->getStyle('AK4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AL4', '天数');
             $objPHPExcel->getActiveSheet()->getStyle('AL4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AM4', '天数');
             $objPHPExcel->getActiveSheet()->getStyle('AM4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AN4', '天数');
             $objPHPExcel->getActiveSheet()->getStyle('AN4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->setCellValue('AO4', '天数');
             $objPHPExcel->getActiveSheet()->getStyle('AO4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             //获取所有用户的花名,由于数据库中还没有加入真名,等加入真名功能之后再在excel中加入真名
             $user = D('UserView');
             $userlist = $user->where(array('status' => 1))->select();
             $excelDataStartLine = 5;
             $addUserDateLine = $excelDataStartLine;
             foreach ($userlist as $key => $val) {
                 if ($userlist[$key]['user_id'] == 1) {
                     continue;
                 }
                 //各类假期计数变量的定义
                 $userTotleYearLeave = 0;
                 $userTotleEventLeave = 0;
                 $userTotleIllLeave = 0;
                 $userTotleElseLeave = 0;
                 $userTotleTiaoLeave = 0;
                 //获取用户姓名等信息,后面进行其他信息的获取
                 $e_addUserDateLine = "A" . $addUserDateLine;
                 $e_addUserRealNameLine = "B" . $addUserDateLine;
                 $objPHPExcel->getActiveSheet()->setCellValue("C" . $addUserDateLine, "上午");
                 $objPHPExcel->getActiveSheet()->setCellValue($e_addUserDateLine, $userlist[$key]['name']);
                 $objPHPExcel->getActiveSheet()->getStyle("C" . $addUserDateLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle($e_addUserDateLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $addUserDateLine++;
                 $objPHPExcel->getActiveSheet()->setCellValue("C" . $addUserDateLine, "下午");
                 $objPHPExcel->getActiveSheet()->getStyle("C" . $addUserDateLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $e_merge_addUserDateLine = $e_addUserDateLine . ":" . "A" . $addUserDateLine;
                 $e_merge_addUserRealNameLine = $e_addUserRealNameLine . ":" . "B" . $addUserDateLine;
                 $objPHPExcel->getActiveSheet()->mergeCells($e_merge_addUserDateLine);
                 $objPHPExcel->getActiveSheet()->mergeCells($e_merge_addUserRealNameLine);
                 $objPHPExcel->getActiveSheet()->getStyle($e_merge_addUserDateLine)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle($e_merge_addUserRealNameLine)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
                 $addUserDateLine++;
                 $excelLeaveData = [];
                 foreach (range('C', 'Z') as $v) {
                     array_push($excelLeaveData, $v);
                 }
                 foreach (range('A', 'H') as $v) {
                     array_push($excelLeaveData, 'A' . $v);
                 }
                 //获取该用户的所有请假条的信息,然后根据用户的请假条信息进行判断
                 $only_condition['user_name'] = $userlist[$key]['name'];
                 $p = $this->_get('p', 'intval', 1);
                 $userLeavelist = D('Leave')->getLeave($p, $only_condition);
                 foreach ($userLeavelist['leavelist'] as $key => $value) {
                     $userLeaveStartTime = strtotime($userLeavelist['leavelist'][$key]['start_time']);
                     $userLeaveEndTime = strtotime($userLeavelist['leavelist'][$key]['end_time']);
                     $leaveCategory = $userLeavelist['leavelist'][$key]['category_id'];
                     if ($leaveCategory == 1) {
                         $S_leaveCategory = '○';
                     } elseif ($leaveCategory == 2) {
                         $S_leaveCategory = '☆';
                     } elseif ($leaveCategory == 3) {
                         $S_leaveCategory = '●';
                     } elseif ($leaveCategory == 5) {
                         $S_leaveCategory = '※';
                     } else {
                         $S_leaveCategory = '※';
                     }
                     if ($search_start_time >= $userLeaveStartTime && $search_end_time <= $userLeaveEndTime || $search_start_time >= $userLeaveStartTime && $search_start_time <= $userLeaveEndTime && $search_end_time >= $userLeaveEndTime || $search_start_time <= $userLeaveStartTime && $search_end_time >= $userLeaveEndTime || $userLeaveStartTime >= $search_start_time && $search_end_time >= $userLeaveStartTime && $search_end_time <= $userLeaveEndTime) {
                         if ($search_start_time >= $userLeaveStartTime && $search_end_time <= $userLeaveEndTime) {
                             //这里是请了整个月的假,每天都在请假
                             $to_e_leaveStartDay = substr(date('Y-m-d H:i:s', $search_start_time), 0, 11) . "09:00:00";
                             $to_e_leaveEndDay = substr(date('Y-m-d H:i:s', $search_end_time), 0, 11) . "09:00:00";
                         } elseif ($search_start_time >= $userLeaveStartTime && $search_start_time <= $userLeaveEndTime && $search_end_time >= $userLeaveEndTime) {
                             //从这个月的开始就请了,这个月并没有请完,后面有没请假的时候
                             $to_e_leaveStartDay = substr(date('Y-m-d H:i:s', $search_start_time), 0, 11) . "09:00:00";
                             $to_e_leaveEndDay = date('Y-m-d H:i:s', $userLeaveEndTime);
                         } elseif ($search_start_time <= $userLeaveStartTime && $search_end_time >= $userLeaveEndTime) {
                             //在这个月中间请的假,前后可能都有没有请的
                             $to_e_leaveStartDay = date('Y-m-d H:i:s', $userLeaveStartTime);
                             $to_e_leaveEndDay = date('Y-m-d H:i:s', $userLeaveEndTime);
                         } elseif ($userLeaveStartTime >= $search_start_time && $search_end_time >= $userLeaveStartTime && $search_end_time <= $userLeaveEndTime) {
                             //从月中请的假,持续到了下个月,结束时间是下个月
                             $to_e_leaveStartDay = date('Y-m-d H:i:s', $userLeaveStartTime);
                             $to_e_leaveEndDay = substr(date('Y-m-d H:i:s', $search_end_time), 0, 11) . "09:00:00";
                         }
                         //                        $objPHPExcel->getActiveSheet()->setCellValue("F7", date('Y-m-d H:i:s',$userLeaveStartTime));
                         //                        $objPHPExcel->getActiveSheet()->setCellValue("F8", $to_e_leaveStartDay);
                         //                        $objPHPExcel->getActiveSheet()->setCellValue("F9", substr(date('Y-m-d H:i:s',$search_start_time),11,19));
                         //                        $objPHPExcel->getActiveSheet()->setCellValue("F10", substr(date('Y-m-d H:i:s',$search_end_time),0,11)."06:00:00");
                         $e_leaveStartDate = substr($to_e_leaveStartDay, 8, 2);
                         $e_leaveStartTime = substr($to_e_leaveStartDay, 11, 8);
                         $e_leaveEndDate = substr($to_e_leaveEndDay, 8, 2);
                         $e_leaveEndTime = substr($to_e_leaveEndDay, 11, 8);
                         for ($monthDate = 1; $monthDate <= 31; $monthDate++) {
                             //                            $objPHPExcel->getActiveSheet()->setCellValue("F7", $e_leaveStartTime);
                             //                            $objPHPExcel->getActiveSheet()->setCellValue("F8", $e_leaveStartDate);
                             if ($e_leaveStartDate == $monthDate) {
                                 if ($e_leaveEndDate == $e_leaveStartDate || $e_leaveEndDate == (int) $e_leaveStartDate + 1 && $e_leaveEndTime == "09:00:00") {
                                     //请假在一天以内
                                     if ($e_leaveStartTime == "09:00:00" && $e_leaveEndTime == "12:00:00") {
                                         $userLine = $addUserDateLine - 2;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         //                                        $userTotleLeave += 0.5;
                                         if ($leaveCategory == 1) {
                                             //事假
                                             $userTotleEventLeave += 0.5;
                                         } elseif ($leaveCategory == 2) {
                                             //病假
                                             $userTotleIllLeave += 0.5;
                                         } elseif ($leaveCategory == 3) {
                                             //年假
                                             $userTotleYearLeave += 0.5;
                                         } elseif ($leaveCategory == 5) {
                                             //调休
                                             $userTotleTiaoLeave += 0.5;
                                         } else {
                                             //其他
                                             $userTotleElseLeave += 0.5;
                                         }
                                     } elseif ($e_leaveStartTime == "12:00:00") {
                                         $userLine = $addUserDateLine - 1;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         //                                        $userTotleLeave += 0.5;
                                         if ($leaveCategory == 1) {
                                             //事假
                                             $userTotleEventLeave += 0.5;
                                         } elseif ($leaveCategory == 2) {
                                             //病假
                                             $userTotleIllLeave += 0.5;
                                         } elseif ($leaveCategory == 3) {
                                             //年假
                                             $userTotleYearLeave += 0.5;
                                         } elseif ($leaveCategory == 5) {
                                             //调休
                                             $userTotleTiaoLeave += 0.5;
                                         } else {
                                             //其他
                                             $userTotleElseLeave += 0.5;
                                         }
                                     } elseif ($e_leaveStartTime == "09:00:00" && $e_leaveEndTime == "18:00:00") {
                                         $userLine = $addUserDateLine - 2;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         $userLine = $addUserDateLine - 1;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         //                                        $userTotleLeave += 1;
                                         if ($leaveCategory == 1) {
                                             //事假
                                             $userTotleEventLeave += 1;
                                         } elseif ($leaveCategory == 2) {
                                             //病假
                                             $userTotleIllLeave += 1;
                                         } elseif ($leaveCategory == 3) {
                                             //年假
                                             $userTotleYearLeave += 1;
                                         } elseif ($leaveCategory == 5) {
                                             //调休
                                             $userTotleTiaoLeave += 1;
                                         } else {
                                             //其他
                                             $userTotleElseLeave += 1;
                                         }
                                     }
                                     continue;
                                 } else {
                                     if ($e_leaveStartTime == "09:00:00") {
                                         $userLine = $addUserDateLine - 2;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         $userLine = $addUserDateLine - 1;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         //                                        $userTotleLeave += 1;
                                         if ($leaveCategory == 1) {
                                             //事假
                                             $userTotleEventLeave += 1;
                                         } elseif ($leaveCategory == 2) {
                                             //病假
                                             $userTotleIllLeave += 1;
                                         } elseif ($leaveCategory == 3) {
                                             //年假
                                             $userTotleYearLeave += 1;
                                         } elseif ($leaveCategory == 5) {
                                             //调休
                                             $userTotleTiaoLeave += 1;
                                         } else {
                                             //其他
                                             $userTotleElseLeave += 1;
                                         }
                                     } elseif ($e_leaveStartTime == "12:00:00") {
                                         $userLine = $addUserDateLine - 1;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         //                                        $userTotleLeave += 0.5;
                                         if ($leaveCategory == 1) {
                                             //事假
                                             $userTotleEventLeave += 0.5;
                                         } elseif ($leaveCategory == 2) {
                                             //病假
                                             $userTotleIllLeave += 0.5;
                                         } elseif ($leaveCategory == 3) {
                                             //年假
                                             $userTotleYearLeave += 0.5;
                                         } elseif ($leaveCategory == 5) {
                                             //调休
                                             $userTotleTiaoLeave += 0.5;
                                         } else {
                                             //其他
                                             $userTotleElseLeave += 0.5;
                                         }
                                     }
                                     continue;
                                 }
                             } else {
                                 if ($e_leaveEndDate == $monthDate) {
                                     if ($e_leaveStartTime == "12:00:00") {
                                         $userLine = $addUserDateLine - 2;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         //                                    $userTotleLeave += 0.5;
                                         if ($leaveCategory == 1) {
                                             //事假
                                             $userTotleEventLeave += 0.5;
                                         } elseif ($leaveCategory == 2) {
                                             //病假
                                             $userTotleIllLeave += 0.5;
                                         } elseif ($leaveCategory == 3) {
                                             //年假
                                             $userTotleYearLeave += 0.5;
                                         } elseif ($leaveCategory == 5) {
                                             //调休
                                             $userTotleTiaoLeave += 0.5;
                                         } else {
                                             //其他
                                             $userTotleElseLeave += 0.5;
                                         }
                                     } elseif ($e_leaveStartTime == "18:00:00") {
                                         $userLine = $addUserDateLine - 1;
                                         $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                         $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                         //                                    $userTotleLeave += 0.5;
                                         if ($leaveCategory == 1) {
                                             //事假
                                             $userTotleEventLeave += 0.5;
                                         } elseif ($leaveCategory == 2) {
                                             //病假
                                             $userTotleIllLeave += 0.5;
                                         } elseif ($leaveCategory == 3) {
                                             //年假
                                             $userTotleYearLeave += 0.5;
                                         } elseif ($leaveCategory == 5) {
                                             //调休
                                             $userTotleTiaoLeave += 0.5;
                                         } else {
                                             //其他
                                             $userTotleElseLeave += 0.5;
                                         }
                                     }
                                     continue;
                                 } elseif ($e_leaveStartDate < $monthDate && $e_leaveEndDate > $monthDate) {
                                     $userLine = $addUserDateLine - 2;
                                     $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                     $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                     $userLine = $addUserDateLine - 1;
                                     $objPHPExcel->getActiveSheet()->setCellValue($excelLeaveData[$monthDate] . $userLine, $S_leaveCategory);
                                     $objPHPExcel->getActiveSheet()->getStyle($excelLeaveData[$monthDate] . $userLine)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                                     //                                $e_leaveStartDate += 1;
                                     if ($leaveCategory == 1) {
                                         //事假
                                         $userTotleEventLeave += 1;
                                     } elseif ($leaveCategory == 2) {
                                         //病假
                                         $userTotleIllLeave += 1;
                                     } elseif ($leaveCategory == 3) {
                                         //年假
                                         $userTotleYearLeave += 1;
                                     } elseif ($leaveCategory == 5) {
                                         //调休
                                         $userTotleTiaoLeave += 1;
                                     } else {
                                         //其他
                                         $userTotleElseLeave += 1;
                                     }
                                     continue;
                                 }
                             }
                         }
                     }
                 }
                 $userTotleLeave = $userTotleYearLeave + $userTotleEventLeave + $userTotleIllLeave + $userTotleElseLeave + $userTotleTiaoLeave;
                 $objPHPExcel->getActiveSheet()->setCellValue("AJ" . ($addUserDateLine - 2), $userTotleLeave);
                 $objPHPExcel->getActiveSheet()->setCellValue("AK" . ($addUserDateLine - 2), $userTotleYearLeave);
                 $objPHPExcel->getActiveSheet()->setCellValue("AL" . ($addUserDateLine - 2), $userTotleEventLeave);
                 $objPHPExcel->getActiveSheet()->setCellValue("AM" . ($addUserDateLine - 2), $userTotleIllLeave);
                 $objPHPExcel->getActiveSheet()->setCellValue("AN" . ($addUserDateLine - 2), $userTotleTiaoLeave);
                 $objPHPExcel->getActiveSheet()->setCellValue("AO" . ($addUserDateLine - 2), $userTotleElseLeave);
                 $objPHPExcel->getActiveSheet()->getStyle("AJ" . ($addUserDateLine - 2))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle("AK" . ($addUserDateLine - 2))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle("AL" . ($addUserDateLine - 2))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle("AM" . ($addUserDateLine - 2))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle("AN" . ($addUserDateLine - 2))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle("AO" . ($addUserDateLine - 2))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             }
             $objPHPExcel->getActiveSheet()->getStyle('A1:AR2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->getStyle('A3:A4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->getStyle('A3:A4')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             $objPHPExcel->getActiveSheet()->getStyle('B3:B4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->getStyle('B3:B4')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             $objPHPExcel->getActiveSheet()->getStyle('C3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $objPHPExcel->getActiveSheet()->getStyle('C4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             foreach (range('A', 'Z') as $v) {
                 $objPHPExcel->getActiveSheet()->getColumnDimension($v)->setWidth(6);
             }
             foreach (range('A', 'O') as $v) {
                 $objPHPExcel->getActiveSheet()->getColumnDimension('A' . $v)->setWidth(6);
             }
             $objPHPExcel->createSheet();
             $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
             $objWriter->save($Year . '-' . $Month . ".xlsx");
             $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
             header("Pragma: public");
             header("Expires: 0");
             header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
             header("Content-Type:application/force-download");
             header("Content-Type:application/vnd.ms-execl");
             header("Content-Type:application/octet-stream");
             header("Content-Type:application/download");
             header('Content-Disposition:attachment;filename="' . $Year . '-' . $Month . '请假导出' . '.xls"');
             header("Content-Transfer-Encoding:binary");
             $objWriter->save('php://output');
             //          对所有的请假条进行的操作
             //            $this->leavelist = $leavelist['leavelist'];
             //            $this->assign('page', $leavelist['page']);
             //            alert('success', '导出成功!', U('hrm/leave/index'));
         }
     }
     $d_leave = D('Leave');
     $leave = $d_leave->where(array('status' => 1))->order('create_time')->limit(1)->select();
     $this->leave = $leave;
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #13
0
 public function editCategory()
 {
     if ($this->isPost()) {
         $category_id = $_POST['id'];
         if (!empty($category_id)) {
             $appraisal_template = D('AppraisalTemplate');
             $data['category_id'] = $category_id;
             $data['name'] = $_POST['name'];
             $data['description'] = $_POST['description'];
             if (empty($data['name'])) {
                 alert('error', '未填写模板类型名称!', $_SERVER['HTTP_REFERER']);
             }
             if ($appraisal_template->editTemplateCategory($data)) {
                 alert('success', '模板类型编辑成功!', U('hrm/appraisaltemplate/category'));
             } else {
                 alert('error', '加班类型编辑失败!', U('hrm/appraisaltemplate/category'));
             }
         } else {
             alert('error', '参数错误!', $_SERVER['HTTP_REFERER']);
         }
     } else {
         $category_id = $_GET['id'];
         if (!empty($category_id)) {
             $appraisal_template = D('AppraisalTemplate');
             $template_category = $appraisal_template->getTemplateCategoryById($category_id);
             $this->category = $template_category;
         } else {
             alert('error', '参数错误!', $_SERVER['HTTP_REFERER']);
         }
         $this->alert = parseAlert();
         $this->display();
     }
 }
コード例 #14
0
 public function index()
 {
     $d_contacts = D('ContactsView');
     $p = isset($_GET['p']) ? intval($_GET['p']) : 1;
     $by = isset($_GET['by']) ? trim($_GET['by']) : '';
     $below_ids = getSubRoleId(false);
     $all_ids = getSubRoleId();
     $where = array();
     $params = array();
     $order = "create_time desc";
     if ($_GET['desc_order']) {
         $order = trim($_GET['desc_order']) . ' desc';
     } elseif ($_GET['asc_order']) {
         $order = trim($_GET['asc_order']) . ' asc';
     }
     switch ($by) {
         case 'today':
             $where['create_time'] = array('gt', strtotime(date('Y-m-d', time())));
             break;
         case 'week':
             $where['create_time'] = array('gt', strtotime(date('Y-m-d', time())) - (date('N', time()) - 1) * 86400);
             break;
         case 'month':
             $where['create_time'] = array('gt', strtotime(date('Y-m-01', time())));
             break;
         case 'add':
             $order = 'create_time desc';
             break;
         case 'update':
             $order = 'update_time desc';
             break;
         case 'deleted':
             $where['is_deleted'] = 1;
             break;
         default:
             $where['owner_role_id'] = array('in', $all_ids);
             break;
     }
     if (!isset($where['owner_role_id'])) {
         $where['owner_role_id'] = array('in', $all_ids);
     }
     if (!isset($where['is_deleted'])) {
         $where['is_deleted'] = 0;
     }
     if ($_REQUEST["field"]) {
         $field = trim($_REQUEST['field']) == 'all' ? 'name|telephone|email|address|post|department|description' : $_REQUEST['field'];
         $search = empty($_REQUEST['search']) ? '' : trim($_REQUEST['search']);
         $condition = empty($_REQUEST['condition']) ? 'is' : trim($_REQUEST['condition']);
         if ('create_time' == $field || 'update_time' == $field) {
             $search = is_numeric($search) ? $search : strtotime($search);
         }
         switch ($condition) {
             case "is":
                 $where[$field] = array('eq', $search);
                 break;
             case "isnot":
                 $where[$field] = array('neq', $search);
                 break;
             case "contains":
                 $where[$field] = array('like', '%' . $search . '%');
                 break;
             case "not_contain":
                 $where[$field] = array('notlike', '%' . $search . '%');
                 break;
             case "start_with":
                 $where[$field] = array('like', $search . '%');
                 break;
             case "end_with":
                 $where[$field] = array('like', '%' . $search);
                 break;
             case "is_empty":
                 $where[$field] = array('eq', '');
                 break;
             case "is_not_empty":
                 $where[$field] = array('neq', '');
                 break;
             case "gt":
                 $where[$field] = array('gt', $search);
                 break;
             case "egt":
                 $where[$field] = array('egt', $search);
                 break;
             case "lt":
                 $where[$field] = array('lt', $search);
                 break;
             case "elt":
                 $where[$field] = array('elt', $search);
                 break;
             case "eq":
                 $where[$field] = array('eq', $search);
                 break;
             case "neq":
                 $where[$field] = array('neq', $search);
                 break;
             case "between":
                 $where[$field] = array('between', array($search - 1, $search + 86400));
                 break;
             case "nbetween":
                 $where[$field] = array('not between', array($search, $search + 86399));
                 break;
             case "tgt":
                 $where[$field] = array('gt', $search + 86400);
                 break;
             default:
                 $where[$field] = array('eq', $search);
         }
         $params = array('field=' . $field, 'condition=' . $condition, 'search=' . $_REQUEST["search"]);
     }
     if (trim($_GET['act']) == 'excel') {
         if (vali_permission('contacts', 'export')) {
             $order = $order ? $order : 'create_time desc';
             $contactsList = $d_contacts->where($where)->order($order)->select();
             $this->excelExport($contactsList);
         } else {
             alert('error', L('HAVE NOT PRIVILEGES'), $_SERVER['HTTP_REFERER']);
         }
     } else {
         $contactsList = $d_contacts->where($where)->order($order)->page($p . ',15')->select();
         $count = $d_contacts->where($where)->count();
         import("@.ORG.Page");
         $Page = new Page($count, 15);
         if (!empty($_GET['by'])) {
             $params[] = "by=" . trim($_GET['by']);
         }
         $this->parameter = implode('&', $params);
         if ($_GET['desc_order']) {
             $params[] = "desc_order=" . trim($_GET['desc_order']);
         } elseif ($_GET['asc_order']) {
             $params[] = "asc_order=" . trim($_GET['asc_order']);
         }
         $Page->parameter = implode('&', $params);
         $this->assign('page', $Page->show());
         if ($by == 'deleted') {
             foreach ($contactsList as $k => $v) {
                 $contactsList[$k]["delete_role"] = getUserByRoleId($v['delete_role_id']);
                 $contactsList[$k]["creator"] = getUserByRoleId($v['creator_role_id']);
             }
         } else {
             foreach ($contactsList as $k => $v) {
                 $contactsList[$k]["creator"] = getUserByRoleId($v['creator_role_id']);
             }
         }
         //获取下级和自己的岗位列表,搜索用
         $d_role_view = D('RoleView');
         $this->role_list = $d_role_view->where('role.role_id in (%s)', implode(',', $below_ids))->select();
         $this->assign('contactsList', $contactsList);
         $this->alert = parseAlert();
         $this->display();
     }
 }
コード例 #15
0
 public function view()
 {
     $id = intval($_GET['id']);
     if ($id == 0) {
         alert('error', L('PARAMETER_ERROR'), U('finance/index', 't=' . $this->type));
     }
     switch ($this->type) {
         case 'receivables':
             $receivables = D('ReceivablesView');
             $receivingorder = D('ReceivingorderView');
             $info = $receivables->where(array('receivables_id' => $id))->find();
             if (empty($info)) {
                 alert('error', L('RECORD NOT EXIST', array('')), U('finance/index', 't=' . $this->type));
             }
             $info['receivingorder'] = $receivingorder->where('receivingorder.is_deleted <> 1 and receivingorder.receivables_id = %d', $id)->select();
             $num = 0;
             //已收款金额
             $num_unCheckOut = 0;
             //未结账状态的金额
             $num_unReceivables = 0;
             //还剩多少金额未收款
             foreach ($info['receivingorder'] as $k => $v) {
                 if ($v['status'] == 1) {
                     //计算已结账状态的金额
                     $info['receivingorder'][$k]['owner'] = getUserByRoleId($v['owner_role_id']);
                     $num = $num + $v['money'];
                 } else {
                     //未结账状态的金额
                     $info['receivingorder'][$k]['owner'] = getUserByRoleId($v['owner_role_id']);
                     $num_unCheckOut = $num_unCheckOut + $v['money'];
                 }
             }
             $num_unReceivables = $info['price'] - $num < 0 ? 0 : $info['price'] - $num;
             $info['num'] = $num;
             $info['num_unReceivables'] = $num_unReceivables;
             $info['num_unCheckOut'] = $num_unCheckOut;
             $info['owner'] = getUserByRoleId($info['owner_role_id']);
             $this->assign('info', $info);
             $this->alert = parseAlert();
             $this->display('receivablesview');
             break;
         case 'payables':
             $payables = D('PayablesView');
             $paymentorder = D('PaymentorderView');
             $info = $payables->where(array('payables_id' => $id))->find();
             if (empty($info)) {
                 alert('error', L('RECORD NOT EXIST', array('')), U('finance/index', 't=' . $this->type));
             }
             $info['paymentorder'] = $paymentorder->where('paymentorder.is_deleted <> 1 and paymentorder.payables_id = %d', $id)->select();
             $num = 0;
             //已付款金额
             $num_unCheckOut = 0;
             //未结账状态的金额
             $num_unPayment = 0;
             //还剩多少金额未付款
             foreach ($info['paymentorder'] as $k => $v) {
                 if ($v['status'] == 1) {
                     //计算已结账状态的金额
                     $info['paymentorder'][$k]['owner'] = getUserByRoleId($v['owner_role_id']);
                     $num += $v['money'];
                 } else {
                     //未结账状态的金额
                     $info['paymentorder'][$k]['owner'] = getUserByRoleId($v['owner_role_id']);
                     $num_unCheckOut += $v['money'];
                 }
             }
             $num_unPayment = $info['price'] - $num < 0 ? 0 : $info['price'] - $num;
             $info['num'] = $num;
             $info['num_unPayment'] = $num_unPayment;
             $info['num_unCheckOut'] = $num_unCheckOut;
             $info['owner'] = getUserByRoleId($info['owner_role_id']);
             $this->assign('info', $info);
             $this->alert = parseAlert();
             $this->display('payablesview');
             break;
         case 'receivingorder':
             $receivingorder = D('ReceivingorderView');
             $info = $receivingorder->where(array('receivingorder_id' => $id))->find();
             if (empty($info)) {
                 alert('error', L('RECORD NOT EXIST', array('')), U('finance/index', 't=' . $this->type));
             }
             $info['owner'] = getUserByRoleId($info['owner_role_id']);
             $contract_id = M('receivables')->where(array('receivables_id' => $info['receivables_id']))->getField('contract_id');
             $info['other'] = D('ContractView')->where(array('contract_id' => $contract_id))->find();
             $this->assign('info', $info);
             $this->alert = parseAlert();
             $this->display('receivingorderview');
             break;
         case 'paymentorder':
             $paymentorder = D('PaymentorderView');
             $info = $paymentorder->where(array('paymentorder_id' => $id))->find();
             if (empty($info)) {
                 alert('error', L('RECORD NOT EXIST', array('')), U('finance/index', 't=' . $this->type));
             }
             $info['owner'] = getUserByRoleId($info['owner_role_id']);
             $contract_id = M('payables')->where(array('payables_id' => $info['payables_id']))->getField('contract_id');
             $info['other'] = D('ContractView')->where(array('contract_id' => $contract_id))->find();
             $this->assign('info', $info);
             $this->alert = parseAlert();
             $this->display('paymentorderview');
             break;
     }
 }
コード例 #16
0
 public function index()
 {
     $m_log = M('ActionLog');
     $by = isset($_GET['by']) ? trim($_GET['by']) : '';
     $where = array();
     $params = array();
     $order = "create_time desc";
     if ($_GET['desc_order']) {
         $order = trim($_GET['desc_order']) . ' desc';
     } elseif ($_GET['asc_order']) {
         $order = trim($_GET['asc_order']) . ' asc';
     }
     $all_ids = getSubRoleId();
     switch ($by) {
         case 'today':
             $where['create_time'] = array('gt', strtotime(date('Y-m-d', time())));
             break;
         case 'week':
             $where['create_time'] = array('gt', strtotime(date('Y-m-d', time())) - (date('N', time()) - 1) * 86400);
             break;
         case 'month':
             $where['create_time'] = array('gt', strtotime(date('Y-m-01', time())));
             break;
         case 'me':
             $where['role_id'] = session('role_id');
             break;
         case 'add':
             $order = 'create_time desc';
             break;
     }
     if (!isset($where['role_id'])) {
         $where['role_id'] = array('in', implode(',', getSubRoleId()));
     }
     if (trim($_GET['module'])) {
         $where['module_name'] = trim($_GET['module']);
     }
     if (trim($_GET['act'])) {
         $where['action_name'] = trim($_GET['act']);
     }
     if ($_REQUEST["field"]) {
         $field = trim($_REQUEST['field']) == 'all' ? 'subject|content' : $_REQUEST['field'];
         $search = empty($_REQUEST['search']) ? '' : trim($_REQUEST['search']);
         $condition = empty($_REQUEST['condition']) ? 'eq' : trim($_REQUEST['condition']);
         if ('create_time' == $field) {
             $search = strtotime($search);
         }
         $params = array('field=' . $_REQUEST['field'], 'condition=' . $condition, 'search=' . trim($_REQUEST["search"]));
         switch ($_REQUEST['condition']) {
             case "is":
                 $where[$field] = array('eq', $search);
                 break;
             case "isnot":
                 $where[$field] = array('neq', $search);
                 break;
             case "contains":
                 $where[$field] = array('like', '%' . $search . '%');
                 break;
             case "not_contain":
                 $where[$field] = array('notlike', '%' . $search . '%');
                 break;
             case "start_with":
                 $where[$field] = array('like', $search . '%');
                 break;
             case "end_with":
                 $where[$field] = array('like', '%' . $search);
                 break;
             case "is_empty":
                 $where[$field] = array('eq', '');
                 break;
             case "is_not_empty":
                 $where[$field] = array('neq', '');
                 break;
             case "gt":
                 $where[$field] = array('gt', $search);
                 break;
             case "egt":
                 $where[$field] = array('egt', $search);
                 break;
             case "lt":
                 $where[$field] = array('lt', $search);
                 break;
             case "elt":
                 $where[$field] = array('elt', $search);
                 break;
             case "eq":
                 $where[$field] = array('eq', $search);
                 break;
             case "neq":
                 $where[$field] = array('neq', $search);
                 break;
             case "between":
                 $where[$field] = array('between', array($search - 1, $search + 86400));
                 break;
             case "nbetween":
                 $where[$field] = array('not between', array($search, $search + 86399));
                 break;
             case "tgt":
                 $where[$field] = array('gt', $search + 86400);
                 break;
             default:
                 $where[$field] = array('eq', $search);
         }
     }
     $p = isset($_GET['p']) ? intval($_GET['p']) : 1;
     $list = $m_log->where($where)->page($p . ',10')->order($order)->select();
     $count = $m_log->where($where)->count();
     foreach ($list as $k => $v) {
         $param_name = '';
         if (!empty($v['param_name'])) {
             $param_name = $v['param_name'];
         }
         if ($v['module_name'] == 'finance') {
             $module_name = substr($v['param_name'], 2);
         } else {
             $module_name = $v['module_name'];
         }
         $m_module_name = M($module_name);
         $id = $m_module_name->getPk();
         $name = $m_module_name->where("{$id} = %d", $v['action_id'])->getField('name');
         if (empty($name)) {
             $name = $m_module_name->where("{$id} = %d", $v['action_id'])->getField('subject');
         }
         $list[$k]['content'] = $v['content'] . '---<a href="./index.php?m=' . $v[module_name] . '&a=view&' . $param_name . '&id=' . $v[action_id] . '">' . $name . '</a>';
     }
     import("@.ORG.Page");
     $Page = new Page($count, 10);
     if (!empty($_REQUEST['by'])) {
         $params['by'] = 'by=' . trim($_REQUEST['by']);
     }
     if (!empty($_REQUEST['module'])) {
         $params['module'] = 'module=' . trim($_REQUEST['module']);
     }
     if (!empty($_REQUEST['act'])) {
         $params['act'] = 'act=' . trim($_REQUEST['act']);
     }
     $this->parameter = implode('&', $params);
     if ($_GET['desc_order']) {
         $params[] = "desc_order=" . trim($_GET['desc_order']);
     } elseif ($_GET['asc_order']) {
         $params[] = "asc_order=" . trim($_GET['asc_order']);
     }
     $Page->parameter = implode('&', $params);
     $show = $Page->show();
     $this->assign('page', $show);
     foreach ($list as $k => $v) {
         $list[$k]['creator'] = getUserByRoleId($v['role_id']);
     }
     $d_role_view = D('RoleView');
     $this->role_list = $d_role_view->where('role.role_id in (%s)', implode(',', $below_ids))->select();
     $this->assign('list', $list);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #17
0
 public function analytics()
 {
     $m_customer = M('Customer');
     if ($_GET['role']) {
         $role_id = intval($_GET['role']);
     } else {
         $role_id = 'all';
     }
     if ($_GET['department'] && $_GET['department'] != 'all') {
         $department_id = intval($_GET['department']);
     } else {
         $department_id = D('RoleView')->where('role.role_id = %d', session('role_id'))->getField('department_id');
     }
     if ($_GET['start_time']) {
         $start_time = strtotime(date('Y-m-d', strtotime($_GET['start_time'])));
     }
     $end_time = $_GET['end_time'] ? strtotime(date('Y-m-d 23:59:59', strtotime($_GET['end_time']))) : strtotime(date('Y-m-d 23:59:59', time()));
     if ($role_id == "all") {
         $roleList = getRoleByDepartmentId($department_id);
         $role_id_array = array();
         foreach ($roleList as $v2) {
             $role_id_array[] = $v2['role_id'];
         }
         $where_role_id = array('in', implode(',', $role_id_array));
         $where_source['creator_role_id'] = $where_role_id;
         $where_industry['owner_role_id'] = $where_role_id;
         $where_renenue['creator_role_id'] = $where_role_id;
         $where_employees['creator_role_id'] = $where_role_id;
     } else {
         $where_source['creator_role_id'] = $role_id;
         $where_industry['owner_role_id'] = $role_id;
         $where_renenue['creator_role_id'] = $role_id;
         $where_employees['creator_role_id'] = $role_id;
     }
     if ($start_time) {
         $where_create_time = array(array('elt', $end_time), array('egt', $start_time), 'and');
         $where_source['create_time'] = $where_create_time;
         $where_industry['create_time'] = $where_create_time;
         $where_renenue['create_time'] = $where_create_time;
         $where_employees['create_time'] = $where_create_time;
     } else {
         $where_source['create_time'] = array('elt', $end_time);
         $where_industry['create_time'] = array('elt', $end_time);
         $where_renenue['create_time'] = array('elt', $end_time);
         $where_employees['create_time'] = array('elt', $end_time);
     }
     //统计表内容
     $role_id_array = array();
     if ($role_id == "all") {
         if ($_GET['department'] != 'all') {
             if (session('?admin')) {
                 $roleList = M('role')->where('user_id <> 0')->getField('role_id', true);
             } else {
                 $roleList = getRoleByDepartmentId($department_id);
             }
             foreach ($roleList as $v) {
                 $role_id_array[] = $v;
             }
         } else {
             $role_id_array = getSubRoleId();
         }
     } else {
         $role_id_array[] = $role_id;
     }
     if ($start_time) {
         $create_time = array(array('elt', $end_time), array('egt', $start_time), 'and');
     } else {
         $create_time = array('elt', $end_time);
     }
     $add_count_total = 0;
     $own_count_total = 0;
     $success_count_total = 0;
     $deal_count_total = 0;
     $busi_customer_array = M('Business')->getField('customer_id', true);
     $busi_customer_id = implode(',', $busi_customer_array);
     foreach ($role_id_array as $v) {
         $user = getUserByRoleId($v);
         $add_count = $m_customer->where(array('is_deleted' => 0, 'creator_role_id' => $v, 'create_time' => $create_time))->count();
         $own_count = $m_customer->where(array('is_deleted' => 0, 'owner_role_id' => $v, 'create_time' => $create_time))->count();
         $success_count = $m_customer->where(array('is_deleted' => 0, 'customer_id' => array('in', $busi_customer_id), 'owner_role_id' => $v, 'create_time' => $create_time))->count();
         $reportList[] = array("user" => $user, "add_count" => $add_count, "own_count" => $own_count, "success_count" => $success_count);
         $add_count_total += $add_count;
         $own_count_total += $own_count;
         $success_count_total += $success_count;
     }
     //来源统计图
     $source_count_array = array();
     $setting = M('Fields')->where("model = 'customer' and field = 'origin'")->getField('setting');
     $setting_str = '$sourceList=' . $setting . ';';
     eval($setting_str);
     $source_total_count = 0;
     foreach ($sourceList[data] as $v) {
         unset($where_source['origin']);
         $where_source['origin'] = $v;
         $target_count = $m_customer->where($where_source)->count();
         $source_count_array[] = '[' . '"' . $v . '",' . $target_count . ']';
         $source_total_count += $target_count;
     }
     $source_count_array[] = '["' . L('OTHER') . '",' . ($add_count_total - $source_total_count) . ']';
     $this->source_count = implode(',', $source_count_array);
     //客户行业统计图
     $industry_count_array = array();
     $setting = M('Fields')->where("model = 'customer' and field = 'industry'")->getField('setting');
     $setting_str = '$industryList=' . $setting . ';';
     eval($setting_str);
     $where_industry['is_deleted'] = 0;
     $industry_total_count = 0;
     foreach ($industryList['data'] as $v) {
         unset($where_employees['industry']);
         $where_industry['industry'] = $v;
         $target_count = $m_customer->where($where_industry)->count();
         $industry_total_count += $target_count;
         $industry_count_array[] = '["' . $v . '",' . $target_count . ']';
     }
     $industry_count_array[] = '["' . L('OTHER') . '",' . ($add_count_total - $industry_total_count) . ']';
     $this->industry_count = implode(',', $industry_count_array);
     //客户员工数统计
     $employees_count_array = array();
     $setting = M('Fields')->where("model = 'customer' and field = 'no_of_employees'")->getField('setting');
     $setting_str = '$no_List=' . $setting . ';';
     eval($setting_str);
     $where_employees['is_deleted'] = 0;
     $no_total_count = 0;
     foreach ($no_List['data'] as $v) {
         unset($where_employees['no_of_employees']);
         $where_employees['no_of_employees'] = $v;
         $target_count = $m_customer->where($where_employees)->count();
         $no_total_count += $target_count;
         $employees_count_array[] = '["' . $v . '",' . $target_count . ']';
     }
     $employees_count_array[] = '["' . L('OTHER') . '",' . ($add_count_total - $no_total_count) . ']';
     $this->employees_count = implode(',', $employees_count_array);
     //客户营业额统计
     $revenue_count_array = array();
     $setting = M('Fields')->where("model = 'customer' and field = 'annual_revenue'")->getField('setting');
     $setting_str = '$revenueList=' . $setting . ';';
     eval($setting_str);
     $where_renenue['is_deleted'] = 0;
     $revenue_total_count = 0;
     foreach ($revenueList['data'] as $v) {
         unset($where_renenue['annual_revenue']);
         $where_renenue['annual_revenue'] = $v;
         $target_count = $m_customer->where($where_renenue)->count();
         $revenue_count_array[] = '[' . '"' . $v . '",' . $target_count . ']';
         $revenue_total_count += $target_count;
     }
     $revenue_count_array[] = '["' . L('OTHER') . '",' . ($add_count_total - $target_count) . ']';
     $this->revenue_count = implode(',', $revenue_count_array);
     $this->total_report = array("add_count" => $add_count_total, "own_count" => $own_count_total, "success_count" => $success_count_total);
     $this->reportList = $reportList;
     if (session('?admin')) {
         $idArray = M('role')->where('user_id <> 0')->getField('role_id', true);
     } else {
         $idArray = getSubRoleId();
     }
     $roleList = array();
     foreach ($idArray as $roleId) {
         $roleList[$roleId] = getUserByRoleId($roleId);
     }
     $this->roleList = $roleList;
     $departments = M('roleDepartment')->select();
     $departmentList[] = M('roleDepartment')->where('department_id = %d', session('department_id'))->find();
     $departmentList = array_merge($departmentList, getSubDepartment(session('department_id'), $departments, ''));
     $this->assign('departmentList', $departmentList);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #18
0
 public function view()
 {
     $contract_id = $this->_get('id', 'intval', 0);
     if (!($info = D('StaffContract')->getConcractInfo($contract_id))) {
         alert('error', '合同不存在', U('hrm/staffcontract/index'));
     }
     if ($info['end_time'] != 0 && $info['end_time'] < time()) {
         $info['status'] = $data['status'] = 3;
         $data['staffcontract_id'] = $contract_id;
         D('StaffContract')->editConcract($data);
     }
     $this->assign('info', $info);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #19
0
 public function user_authorize()
 {
     if ($this->isAjax() && $_GET['auth']) {
         $position_id = isset($_GET['position_id']) ? $_GET['position_id'] : 0;
         if ($position_id != 0) {
             $per = explode(',', $_GET['perlist']);
             $m_permission = M('Permission');
             $owned_permission = $m_permission->where('position_id = %d', $position_id)->getField('url', true);
             if (!empty($owned_permission)) {
                 $add_permission = array_diff($per, $owned_permission);
                 //需要增加的
                 $delete_permission = array_diff($owned_permission, $per);
                 //需要删除的
             } else {
                 $add_permission = $per;
             }
             if (!empty($add_permission)) {
                 $data['position_id'] = $position_id;
                 foreach ($add_permission as $key => $value) {
                     $data['url'] = $value;
                     if (0 >= $m_permission->add($data)) {
                         $this->ajaxReturn(L('PART_OF_THE_AUTHORIZATION_FAILED'), 'info', 1);
                     }
                 }
             }
             if (!empty($delete_permission)) {
                 $map['url'] = array('in', $delete_permission);
                 $a = $m_permission->where('position_id = %d', $position_id)->where($map)->delete();
                 //改变首页widget权限
                 $user_list = D('RoleView')->where('position.position_id = %d', $position_id)->select();
                 foreach ($user_list as $v) {
                     $dashboard = unserialize($v['dashboard']);
                     if (!empty($dashboard)) {
                         foreach ($dashboard as $kk => $vv) {
                             //如果没有获取相应权限,则去除对应权限的首页图表
                             //权限图表:销售漏斗、客户来源、财务月度统计、财务年度对比
                             if (in_array('business/index', $delete_permission) && $vv['widget'] == 'Salesfunnel') {
                                 unset($dashboard[$kk]);
                             }
                             if (in_array('customer/index', $delete_permission) && $vv['widget'] == 'Customerorigin') {
                                 unset($dashboard[$kk]);
                             }
                             if (in_array('finance/index', $delete_permission) && ($vv['widget'] == 'Receivemonthly' || $vv['widget'] == 'Receiveyearcomparison')) {
                                 unset($dashboard[$kk]);
                             }
                         }
                         $newDashboard = serialize($dashboard);
                         M('user')->where('user_id = %d', $v['user_id'])->setField('dashboard', $newDashboard);
                     }
                 }
                 if ($a <= 0) {
                     $this->ajaxReturn(L('PART_OF_THE_AUTHORIZATION_FAILED'), 'info', 1);
                 }
             }
             $this->ajaxReturn(L('OPERATION_IS_CHANGED'), 'info', 1);
         } else {
             $this->ajaxReturn(L('PLEASE_RETRY_AFTER_LOGIN_AGAIN'), 'info', 1);
         }
     } elseif ($_GET['position_id']) {
         $m_permission = M('Permission');
         $owned_permission = $m_permission->where('position_id = %d', $_GET['position_id'])->getField('url', true);
         $this->owned_permission = $owned_permission;
         $this->position_id = $_GET['position_id'];
         $this->alert = parseAlert();
         $this->display();
     } else {
         alert('error', L('PLEASE_CHOOSE_TO_AUTHORIZE_JOBS'), $_SERVER['HTTP_REFERER']);
     }
 }
コード例 #20
0
 public function index()
 {
     $this->assign('list', $list);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #21
0
 public function notice()
 {
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #22
0
 public function editPassword()
 {
     if ($this->isPost()) {
         $old = $this->_post('old', 'trim', '');
         $new = $this->_post('new', 'trim', '');
         $new_again = $this->_post('new_again', 'trim', '');
         if ($new == '') {
             alert('error', '请输入新密码', U('core/user/editpassword'));
         }
         if ($new != $new_again) {
             alert('error', '两次输入不一致!', U('core/user/editpassword'));
         }
         $d_user = D('User');
         $userinfo = $d_user->getUserInfo(array('user_id' => session('user_id')));
         if ($userinfo['password'] != md5(md5($old) . $userinfo['salt'])) {
             alert('error', '原密码输入错误!', U('core/user/editpassword'));
         }
         if ($old == $new) {
             alert('error', '新密码与原密码不能相同!', U('core/user/editpassword'));
         }
         $info['salt'] = D('User')->getSalt();
         $info['user_id'] = $userinfo['user_id'];
         $info['password'] = md5(md5($new) . $info['salt']);
         if (D('User')->editUserInfo($info)) {
             alert('success', '密码修改成功!', U('core/user/editpassword'));
         } else {
             alert('error', '密码修改失败!', U('core/user/editpassword'));
         }
     } else {
         $this->alert = parseAlert();
         $this->display();
     }
 }
コード例 #23
0
 public function view()
 {
     $insurance_id = $this->_get('id', 'intval', 0);
     $info = D('Insurance')->getInsuranceInfo($insurance_id);
     if (!$info) {
         alert('error', '数据不存在', U('hrm/insurance/index'));
     }
     $this->assign('info', $info);
     $this->assign('suitinfo', D('Insurance')->getSuitInfo($info['suit_id']));
     $this->assign('insurancesuit', D('Insurance')->getSuitAll());
     $this->assign('alert', parseAlert());
     $this->display();
 }
コード例 #24
0
 public function editTaskLogDialog()
 {
     $task_log_id = intval($_GET['id']);
     if ($task_log_id) {
         $d_task = D('Task');
         $task_log = $d_task->getTaskLogById($task_log_id);
     } else {
         alert('error', '参数错误!', $_SERVER['HTTP_REFERER']);
     }
     $this->task_log_edit = $task_log;
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #25
0
 public function edit()
 {
     if ($this->isPost()) {
         $navigation = M('navigation');
         $data = $navigation->create();
         $menu = $navigation->where('id = %d', $data['id'])->find();
         if ($data['postion'] != $menu['postion']) {
             $navigation->where('postion="%s" and listorder > %d', $menu['postion'], $menu['listorder'])->setDec('listorder');
             $data['listorder'] = $navigation->where('postion = "%s"', $_POST['postion'])->count();
         }
         if ($navigation->save($data)) {
             alert('success', L('MODIFY_THE_SUCCESS'), U('navigation/setting'));
         } else {
             alert('error', L('MODIFY_THE_FAILURE'), U('navigation/setting'));
         }
     } else {
         $navigation = M('navigation');
         $menu = $navigation->where('id=%d', $_GET['id'])->find();
         $this->menu = $menu;
         $this->alert = parseAlert();
         $this->display();
     }
 }
コード例 #26
0
 public function analytics()
 {
     $m_leads = M('leads');
     if ($_GET['role']) {
         $role_id = intval($_GET['role']);
     } else {
         $role_id = 'all';
     }
     if ($_GET['department'] && $_GET['department'] != 'all') {
         $department_id = intval($_GET['department']);
     } else {
         $department_id = D('RoleView')->where('role.role_id = %d', session('role_id'))->getField('department_id');
     }
     if ($_GET['start_time']) {
         $start_time = strtotime(date('Y-m-d', strtotime($_GET['start_time'])));
     }
     $end_time = $_GET['end_time'] ? strtotime(date('Y-m-d 23:59:59', strtotime($_GET['end_time']))) : strtotime(date('Y-m-d 23:59:59', time()));
     if ($role_id == "all") {
         $roleList = getRoleByDepartmentId($department_id);
         $role_id_array = array();
         foreach ($roleList as $v2) {
             $role_id_array[] = $v2['role_id'];
         }
         $where_source['creator_role_id'] = array('in', implode(',', $role_id_array));
         $where_status['owner_role_id'] = array('in', implode(',', $role_id_array));
     } else {
         $where_source['creator_role_id'] = $role_id;
         $where_status['owner_role_id'] = $role_id;
     }
     if ($start_time) {
         $where_source['create_time'] = array(array('elt', $end_time), array('egt', $start_time), 'and');
         $where_status['create_time'] = array(array('elt', $end_time), array('egt', $start_time), 'and');
     } else {
         $where_source['create_time'] = array('elt', $end_time);
         $where_status['create_time'] = array('elt', $end_time);
     }
     //线索来源统计
     $setting = M('Fields')->where("model = 'leads' and field = 'source'")->getField('setting');
     $setting_str = '$revenueList=' . $setting . ';';
     //eval($setting_str);
     $source_count_array = array();
     $sourceList = M('leads')->field('count(1) as num , source')->group('source')->where($where_source)->select();
     foreach ($sourceList as $v) {
         $source = $v['source'] ? $v['source'] : L('OTHER');
         $source_count[$source] = $v['num'];
     }
     foreach ($revenueList['data'] as $v) {
         if ($source_count[$v]) {
             $source_count_array[] = '["' . $v . '",' . $source_count[$v] . ']';
         } else {
             $source_count_array[] = '["' . $v . '",0]';
         }
     }
     $this->source_count = implode(',', $source_count_array);
     //Statistics Content
     $role_id_array = array();
     if ($role_id == "all") {
         if ($department_id != "all") {
             if (session('?admin')) {
                 $roleList = M('role')->where('user_id <> 0')->getField('role_id', true);
             } else {
                 $roleList = getRoleByDepartmentId($department_id);
             }
             //$roleList = getRoleByDepartmentId($department_id);
             foreach ($roleList as $v) {
                 $role_id_array[] = $v;
             }
         } else {
             $role_id_array = getSubRoleId();
         }
     } else {
         $role_id_array[] = $role_id;
     }
     if ($start_time) {
         $create_time = array(array('elt', $end_time), array('egt', $start_time), 'and');
     } else {
         $create_time = array('elt', $end_time);
     }
     $add_count_total = 0;
     $own_count_total = 0;
     $success_count_total = 0;
     $deal_count_total = 0;
     foreach ($role_id_array as $v) {
         $user = getUserByRoleId($v);
         $add_count = $m_leads->where(array('is_deleted' => 0, 'creator_role_id' => $v, 'create_time' => $create_time))->count();
         $own_count = $m_leads->where(array('is_deleted' => 0, 'owner_role_id' => $v, 'create_time' => $create_time))->count();
         $success_count = $m_leads->where(array('is_deleted' => 0, 'is_transformed' => 1, 'owner_role_id' => $v, 'create_time' => $create_time))->count();
         $deal_count = $m_leads->where('is_deleted = 0 and owner_role_id = %d and is_transformed != 1 and update_time>create_time', $v)->count();
         $reportList[] = array("user" => $user, "add_count" => $add_count, "own_count" => $own_count, "success_count" => $success_count, "deal_count" => $deal_count);
         $add_count_total += $add_count;
         $own_count_total += $own_count;
         $success_count_total += $success_count;
         $deal_count_total += $deal_count;
     }
     $this->total_report = array("add_count" => $add_count_total, "own_count" => $own_count_total, "success_count" => $success_count_total, "deal_count" => $deal_count_total);
     $this->reportList = $reportList;
     if (session('?admin')) {
         $idArray = M('role')->where('user_id <> 0')->getField('role_id', true);
     } else {
         $idArray = getSubRoleId();
     }
     $roleList = array();
     foreach ($idArray as $roleId) {
         $roleList[$roleId] = getUserByRoleId($roleId);
     }
     $this->roleList = $roleList;
     $departments = M('roleDepartment')->select();
     $departmentList[] = M('roleDepartment')->where('department_id = %d', session('department_id'))->find();
     $departmentList = array_merge($departmentList, getSubDepartment(session('department_id'), $departments, ''));
     $this->assign('departmentList', $departmentList);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #27
0
 /**
  *商机统计
  *
  **/
 public function analytics()
 {
     $m_business = M('Business');
     if ($_GET['role']) {
         $role_id = intval($_GET['role']);
     } else {
         $role_id = 'all';
     }
     if ($_GET['department'] && $_GET['department'] != 'all') {
         $department_id = intval($_GET['department']);
     } else {
         $department_id = D('RoleView')->where('role.role_id = %d', session('role_id'))->getField('department_id');
     }
     if ($_GET['start_time']) {
         $start_time = strtotime(date('Y-m-d', strtotime($_GET['start_time'])));
     }
     $end_time = $_GET['end_time'] ? strtotime(date('Y-m-d 23:59:59', strtotime($_GET['end_time']))) : strtotime(date('Y-m-d 23:59:59', time()));
     if ($role_id == "all") {
         $roleList = getRoleByDepartmentId($department_id);
         $role_id_array = array();
         foreach ($roleList as $v2) {
             $role_id_array[] = $v2['role_id'];
         }
         $where_source['creator_role_id'] = array('in', implode(',', $role_id_array));
         $where_status['owner_role_id'] = array('in', implode(',', $role_id_array));
         $where_money['owner_role_id'] = array('in', implode(',', $role_id_array));
         $where_day_create['creator_role_id'] = array('in', implode(',', $role_id_array));
         $where_day_success['owner_role_id'] = array('in', implode(',', $role_id_array));
     } else {
         $where_source['creator_role_id'] = $role_id;
         $where_status['owner_role_id'] = $role_id;
         $where_money['owner_role_id'] = $role_id;
         $where_day_create['creator_role_id'] = array('in', implode(',', $role_id_array));
         $where_day_success['owner_role_id'] = array('in', implode(',', $role_id_array));
     }
     if ($start_time) {
         $where_source['create_time'] = array(array('lt', $end_time), array('gt', $start_time), 'and');
         $where_status['create_time'] = array(array('lt', $end_time), array('gt', $start_time), 'and');
         $where_money['create_time'] = array(array('lt', $end_time), array('gt', $start_time), 'and');
     } else {
         $where_source['create_time'] = array('lt', $end_time);
         $where_status['create_time'] = array('lt', $end_time);
         $where_money['create_time'] = array('lt', $end_time);
     }
     //统计表内容
     $role_id_array = array();
     if ($role_id == "all") {
         if ($department_id != "all") {
             if (session('?admin')) {
                 $roleList = M('role')->where('user_id <> 0')->getField('role_id', true);
             } else {
                 $roleList = getRoleByDepartmentId($department_id);
             }
             foreach ($roleList as $v) {
                 $role_id_array[] = $v;
             }
         } else {
             $role_id_array = getSubRoleId();
         }
     } else {
         $role_id_array[] = $role_id;
     }
     if ($start_time) {
         $create_time = array(array('lt', $end_time), array('gt', $start_time), 'and');
     } else {
         $create_time = array('lt', $end_time);
     }
     $add_count_total = 0;
     $own_count_total = 0;
     $success_count_total = 0;
     $deal_count_total = 0;
     foreach ($role_id_array as $v) {
         $user = getUserByRoleId($v);
         $add_count = $m_business->where(array('is_deleted' => 0, 'creator_role_id' => $v, 'create_time' => $create_time))->count();
         $own_count = $m_business->where(array('is_deleted' => 0, 'owner_role_id' => $v, 'create_time' => $create_time))->count();
         $success_count = $m_business->where(array('is_deleted' => 0, 'status_id' => 100, 'owner_role_id' => $v, 'create_time' => $create_time))->count();
         $deal_count = $m_business->where('is_deleted = 0 and status_id not in(99,100) and owner_role_id = %d and update_time>create_time', $v)->count();
         $reportList[] = array("user" => $user, "add_count" => $add_count, "own_count" => $own_count, "success_count" => $success_count, "deal_count" => $deal_count);
         $add_count_total += $add_count;
         $own_count_total += $own_count;
         $success_count_total += $success_count;
         $deal_count_total += $deal_count;
     }
     //商机来源统计图
     $source_count_array = array();
     $setting = M('Fields')->where("model = 'business' and field = 'origin'")->getField('setting');
     $setting_str = '$sourceList=' . $setting . ';';
     eval($setting_str);
     $where_source['is_deleted'] = 0;
     $source_total_count = 0;
     foreach ($sourceList['data'] as $v) {
         unset($where_source['origin']);
         $where_source['origin'] = $v;
         $target_count = $m_business->where($where_source)->count();
         $source_count_array[] = '[' . '"' . $v . '",' . $target_count . ']';
         $source_total_count += $target_count;
     }
     $source_count_array[] = '["' . L('OTHER') . '",' . ($add_count_total - $source_total_count) . ']';
     $this->source_count = implode(',', $source_count_array);
     //商机阶段统计图
     $status_count_array = array();
     $statusList = M('BusinessStatus')->order('order_id desc')->where('status_id <> 99')->select();
     $where_status['is_deleted'] = 0;
     $temp_count = 0;
     foreach ($statusList as $v) {
         unset($where_status['status_id']);
         $where_status['status_id'] = $v['status_id'];
         $target_count = $m_business->where($where_status)->count();
         $status_count_array[] = '[' . '"' . $v['name'] . '",' . ($target_count + $temp_count) . ']';
         $temp_count += $target_count;
     }
     $this->status_count = implode(',', array_reverse($status_count_array));
     /*时间序列图(按日)*/
     if ($end_time - 86400 * 30 > $start_time) {
         $this_time = $end_time - 86400 * 30;
     } else {
         $this_time = $start_time;
     }
     while (date('Y-m-d', $this_time) <= date('Y-m-d', $end_time)) {
         $day_count_array[] = "'" . date('Y/m/d', $this_time) . "'";
         $time1 = strtotime(date('Y-m-d', $this_time));
         $time2 = $time1 + 86400;
         $where_day_create['create_time'] = array(array('lt', $time2), array('gt', $time1), 'and');
         $day_create_count_array[] = $m_business->where($where_day_create)->count();
         $where_day_success['update_time'] = array(array('lt', $time2), array('gt', $time1), 'and');
         $where_day_success['status_id'] = 100;
         $day_success_count_array[] = $m_business->where($where_day_success)->count();
         $this_time += 86400;
     }
     $this->day_count = implode(',', $day_count_array);
     $this->day_create_count = implode(',', $day_create_count_array);
     $this->day_success_count = implode(',', $day_success_count_array);
     /*时间序列图(按周)*/
     if ($end_time - 86400 * 365 > $start_time) {
         $this_time = $end_time - 86400 * 365 - 86400 * date('w');
     } else {
         $this_time = $start_time - 86400 * date('w');
     }
     while (date('Y-m-d', $this_time) <= date('Y-m-d', $end_time)) {
         $week_count_array[] = "'" . date('Y', $this_time) . ' s' . date('W', $this_time) . "'";
         $time1 = strtotime(date('Y-m-d', $this_time));
         $time2 = $time1 + 86400 * 7;
         $where_week_create['create_time'] = array(array('lt', $time2), array('gt', $time1), 'and');
         $week_create_count_array[] = $m_business->where($where_week_create)->count();
         $where_week_success['update_time'] = array(array('lt', $time2), array('gt', $time1), 'and');
         $where_week_success['status_id'] = 100;
         $week_success_count_array[] = $m_business->where($where_week_success)->count();
         $this_time += 86400 * 7;
     }
     $this->week_count = implode(',', $week_count_array);
     $this->week_create_count = implode(',', $week_create_count_array);
     $this->week_success_count = implode(',', $week_success_count_array);
     /*时间序列图(按月)*/
     if ($end_time - 86400 * 365 > $start_time) {
         $this_time = $end_time - 86400 * 365;
     } else {
         $this_time = $start_time;
     }
     while (date('Y-m-d', $this_time) <= date('Y-m-d', $end_time)) {
         $month_count_array[] = "'" . date('Y/m', $this_time) . "'";
         $time1 = strtotime(date('Y-m', $this_time));
         $time2 = mktime(0, 0, 0, date('m', $this_time) + 1, 1, date('Y', $this_time));
         $where_month_create['create_time'] = array(array('lt', $time2), array('gt', $time1), 'and');
         $month_create_count_array[] = $m_business->where($where_month_create)->count();
         $where_month_success['update_time'] = array(array('lt', $time2), array('gt', $time1), 'and');
         $where_month_success['status_id'] = 100;
         $month_success_count_array[] = $m_business->where($where_month_success)->count();
         $this_time = mktime(date('H', $this_time), date('i', $this_time), date('s', $this_time), date('m', $this_time) + 1, date('d', $this_time), date('Y', $this_time));
     }
     $this->month_count = implode(',', $month_count_array);
     $this->month_create_count = implode(',', $month_create_count_array);
     $this->month_success_count = implode(',', $month_success_count_array);
     $max_money = $m_business->where($where_money)->Max('total_price');
     $min_money = $m_business->where($where_money)->Min('total_price');
     if ($max_money == $min_money) {
         $target_count = $m_business->where($where_money)->count();
         $money_count_array[] = '["' . $max_money . L('YUAN') . '",' . $target_count . ']';
     } else {
         $rank1 = round($min_money, 2);
         $rank2 = round($min_money + ($max_money - $min_money) * 0.25, 2);
         $rank3 = round($min_money + ($max_money - $min_money) * 0.5, 2);
         $rank4 = round($min_money + ($max_money - $min_money) * 0.75, 2);
         $rank5 = round($max_money, 2);
         $money_where = array(array('name' => $rank1 . '~' . $rank2 . L('YUAN'), 'where_money' => array(array('elt', $rank2), array('egt', $rank1), 'and')), array('name' => $rank2 . '~' . $rank3 . L('YUAN'), 'where_money' => array(array('elt', $rank3), array('gt', $rank2), 'and')), array('name' => $rank3 . '~' . $rank4 . L('YUAN'), 'where_money' => array(array('elt', $rank4), array('gt', $rank3), 'and')), array('name' => $rank4 . '~' . $rank5 . L('YUAN'), 'where_money' => array(array('elt', $rank5), array('egt', $rank4), 'and')));
         $money_count_array = array();
         foreach ($money_where as $v) {
             $where_money['total_price'] = $v['where_money'];
             $target_count = $m_business->where($where_money)->count();
             $money_count_array[] = '[' . '"' . $v['name'] . '",' . $target_count . ']';
         }
     }
     $this->money_count = implode(',', $money_count_array);
     $this->total_report = array("add_count" => $add_count_total, "own_count" => $own_count_total, "success_count" => $success_count_total, "deal_count" => $deal_count_total);
     $this->reportList = $reportList;
     if (session('?admin')) {
         $idArray = M('role')->where('user_id <> 0')->getField('role_id', true);
     } else {
         $idArray = getSubRoleId();
     }
     $roleList = array();
     foreach ($idArray as $roleId) {
         $roleList[$roleId] = getUserByRoleId($roleId);
     }
     $this->roleList = $roleList;
     $departments = M('roleDepartment')->select();
     $departmentList[] = M('roleDepartment')->where('department_id = %d', session('department_id'))->find();
     $departmentList = array_merge($departmentList, getSubDepartment(session('department_id'), $departments, ''));
     $this->assign('departmentList', $departmentList);
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #28
0
 public function category()
 {
     $product_category = M('product_category');
     $category_list = $product_category->select();
     $category_list = getSubCategory(0, $category_list, '');
     foreach ($category_list as $key => $value) {
         $product = M('product');
         $count = $product->where('category_id = %d', $value['category_id'])->count();
         $category_list[$key]['count'] = $count;
         $category_list[$key]['list'] = $product->where('category_id = %d', $value['category_id'])->select();
     }
     $this->alert = parseAlert();
     $this->assign('category_list', $category_list);
     $this->display();
 }
コード例 #29
0
 public function editPoint()
 {
     $appraisal_manager_id = $_REQUEST['id'];
     if (!empty($appraisal_manager_id)) {
         $d_appraisal_manager = D('AppraisalManager');
         $d_appraisal_point = D('AppraisalPoint');
         if ($this->isPost()) {
             $appraisal_manager = $d_appraisal_manager->getAppraisalManagerById($appraisal_manager_id);
             foreach ($appraisal_manager['template']['score'] as $val) {
                 $temp['appraisal_manager_id'] = $appraisal_manager_id;
                 $temp['point'] = $_POST['point'][$val['score_id']];
                 $temp['comment'] = $_POST['comment'][$val['score_id']];
                 $temp['examinee_user_id'] = $_POST['examinee_user_id'];
                 $temp['examiner_user_id'] = session('user_id');
                 $temp['score_id'] = $val['score_id'];
                 $temp['is_point'] = 0;
                 if (!is_numeric($temp['point']) || $temp['point'] > $val['high_scope']) {
                     alert('error', "【 " . $val['name'] . " 】" . '份数格式不正确!', $_SERVER['HTTP_REFERER']);
                 }
                 $d_appraisal_point->where(array('examiner_user_id' => $temp['examiner_user_id'], 'appraisal_manager_id' => $temp['appraisal_manager_id'], 'score_id' => $temp['score_id']))->save($temp);
             }
             alert('success', '编辑成功!', U('hrm/appraisalpoint/index'));
         } else {
             $appraisal_manager = $d_appraisal_manager->getAppraisalManagerById($appraisal_manager_id);
             $have_point_user = $d_appraisal_point->havePoint(session('user_id'), $appraisal_manager_id);
             if (sizeOf($have_point_user) == sizeOf($appraisal_manager['examinee_user'])) {
                 alert('error', '您已为该考核表打过分!', U('hrm/appraisalpoint/index'));
             }
             $point_detail = $d_appraisal_point->getPointByIdAndIsPoint($appraisal_manager_id, 1);
             $this->pointdetail = $point_detail;
             $this->have_point_user = $have_point_user;
             $this->appraisalmanager = $appraisal_manager;
         }
     } else {
         alert('error', '参数错误!', U('hrm/appraisalpoint/index'));
     }
     $this->alert = parseAlert();
     $this->display();
 }
コード例 #30
0
 public function editPosition()
 {
     if ($this->isPost()) {
         $info['name'] = $this->_post('name', 'trim', '');
         $info['department_id'] = $this->_post('department_id', 'intval', 0);
         $info['parent_id'] = $this->_post('parent_id', 'intval', 0);
         $info['plan_num'] = $this->_post('plan_num', 'intval', 1);
         $info['real_num'] = $this->_post('real_num', 'intval', 0);
         $info['description'] = $this->_post('description', 'trim', '');
         $info['position_id'] = $this->_post('position_id', 'intval', 0);
         if ($info['position_id'] == 0) {
             alert('error', '参数错误', U('hrm/structure/addposition'));
         }
         $d_user = D('Structure');
         if ($return_name = $d_user->checkPositionName($info['name'], $info['position_id']) < 0) {
             switch ($return_name) {
                 case -1:
                     alert('error', '请填写岗位名称', U('hrm/structure/addposition'));
                     break;
                 case -2:
                     alert('error', '岗位名称已存在,请重新输入', U('hrm/structure/addposition'));
                     break;
             }
         }
         if (!$d_user->getDepartmentInfo($info['department_id'])) {
             alert('error', '所选部门不存在', U('hrm/structure/addposition'));
         }
         if ($info['parent_id'] != 0 && !$d_user->getPositionInfo($info['parent_id'])) {
             alert('error', '所选上级岗位不存在', U('hrm/structure/addposition'));
         }
         if ($d_user->editPosition($info)) {
             alert('success', '修改岗位信息成功!', U('hrm/structure/position'));
         } else {
             alert('error', '岗位信息无变化,修改失败!', U('hrm/structure/addposition'));
         }
     } else {
         $position_id = $this->_get('id', 'intval', 0);
         $position = D('Structure')->getPositionInfo($position_id);
         if (!$position) {
             alert('error', '参数错误', U('hrm/structure/addposition'));
         }
         $department_list = D('Structure')->getDepartmentList(0, '--');
         $position_list = D('Structure')->getPositionDepartment($position['department_id'], $position['position_id']);
         $this->assign('department_list', $department_list);
         $this->assign('position_list', $position_list);
         $this->assign('position', $position);
         $this->alert = parseAlert();
         $this->display();
     }
 }