本文整理汇总了PHP中parseAlert函数的典型用法代码示例。如果您正苦于以下问题:PHP parseAlert函数的具体用法?PHP parseAlert怎么用?PHP parseAlert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseAlert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$templateList = M('SmsTemplate')->order('order_id')->select();
$this->templateList = $templateList;
$this->alert = parseAlert();
$this->display();
}
示例2: edit
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: index
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: index
public function index()
{
if (!F('smtp')) {
alert('info', '<font style="color:red;">SMTP信息未配置 (无法使用密码找回功能)</font> <a href="' . U('setting/smtp') . '">点此设置</a>');
}
$this->alert = parseAlert();
$this->display();
}
示例5: monthly
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: edit
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: edit
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: monthly
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: index
//.........这里部分代码省略.........
}
$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: edit
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: index
//.........这里部分代码省略.........
$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: export
//.........这里部分代码省略.........
//事假
$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: editCategory
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: index
//.........这里部分代码省略.........
}
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: view
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');
//.........这里部分代码省略.........