<%@ page language="java" pageEncoding="gb2312"%>
<%@ page
	import="com.zhuozhengsoft.pageoffice.*,com.zhuozhengsoft.pageoffice.excelwriter.*,java.awt.*,javax.servlet.*,javax.servlet.http.*,java.sql.*,java.text.SimpleDateFormat,java.util.Date,java.util.regex.Pattern,java.util.regex.Matcher"%>
<%@ taglib uri="http://java.pageoffice.cn" prefix="po"%>

<%
	Object userName = session.getAttribute("UserName");
	if (userName == null || userName.toString().length() <= 0) {
		response.sendRedirect("login.jsp?tz=true");
	}
	
	//pageoffice组件的使用
	Workbook wb = new Workbook();
	Sheet sheet = wb.openSheet("销售订单");

	sheet.openCell("D5").setSubmitName("CustName");
	sheet.openCell("I5").setSubmitName("OrderNum");
	sheet.openCell("I6").setValue(
			new SimpleDateFormat("yyyy/MM/dd").format(new Date()));
	sheet.openCell("I6").setReadOnly(true);
	sheet.openCell("I6").setSubmitName("OrderDate");
	sheet.openCell("D6").setSubmitName("CustDistrict");
	sheet.openCell("D18").setValue(userName.toString());
	sheet.openCell("H18").setSubmitName("SalesName");
	sheet.openCell("I16").setSubmitName("Amount");
	sheet.openCell("I16").setReadOnly(true);

	Table table = sheet.openTable("C9:H15");
	table.setSubmitName("OrderDetail");
	sheet.openTable("D9:D15").setReadOnly(true);
	
	//禁用右键、双击
	wb.setDisableSheetDoubleClick(true);
	wb.setDisableSheetRightClick(true);
	
	PageOfficeCtrl poCtrl1 = new PageOfficeCtrl(request);
	poCtrl1.setServerPage("poserver.do"); //此行必须
	String fileName = "OrderForm.xls";
	poCtrl1.setWriter(wb);
	// 创建自定义菜单栏
	poCtrl1.addCustomToolButton("保存", "SaveDocument()", 1);
	poCtrl1.addCustomToolButton("全屏切换", "SetFullScreen()", 4);
	
	poCtrl1.setMenubar(false);//隐藏菜单栏
	poCtrl1.setOfficeToolbars(false);//隐藏工具栏

	poCtrl1.setSaveDataPage("Update.jsp");
	poCtrl1.webOpen("doc/" + fileName, OpenModeType.xlsSubmitForm, "");
	poCtrl1.setTagId("PageOfficeCtrl1"); //此行必须
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<link rel="stylesheet" href="css/style.css" type="text/css"></link>
		<!--[if lte IE 6]>
<script type="text/javascript" src="js/belatedPNG.js"></script>
<script type="text/javascript">
  DD_belatedPNG.fix('.png_bg,.png_bg a:hover,img,li');
</script>
<![endif]-->
		<title>登录列表</title>
	</head>
	<body>
		<!--header-->
		<div class="zz-headBox clearfix">
			<div class="zz-head mc">
				<!--logo-->
				<div class="logo fl">
					<a href="home.html"> <img src="images/logo.png" alt="" />
					</a>
				</div>
				<!--logo end-->
				<ul class="head-rightUl fr">
					<li><a href="http://www.zhuozhengsoft.com" target="_blank">卓正网站</a></li>
                <li><a href="http://www.zhuozhengsoft.com/poask/index.asp" target="_blank">客户问吧</a></li>
                <li class="bor-0"><a href="http://www.zhuozhengsoft.com/contact-us.html" target="_blank">联系我们</a></li>
				</ul>
			</div>
		</div>
		<!--header end-->
		<!--a title-->
		<div class=" topTitle">
			<ul>
				<li class="pd-left">
					销售订单管理系统示例
				</li>
				<li>
					<font>当前用户：</font><%=userName%></li>
				<li>
					<font>当前系统日期：</font><%=new SimpleDateFormat("yyyy/MM/dd").format(new Date())%></li>
				<li>
					<font>当前模块：</font>新建订单
				</li>
			</ul>
		</div>
		<!--content-->
		<div class="zz-content mc clearfix pd-28">
			<!--left-->
			<div class="zz-contentLeft fl">
				<ul class="left-ul">
					<h2 class="fs-12">
						用户功能区
					</h2>
					<li>
						<a href="OrderList.jsp">订单列表</a>
					</li>
					<li style="background: #d0eaf7; display: block;">
						<a href="NewOrder.jsp">新建订单</a>
					</li>
					<li>
						<a href="OrderStat.jsp">统计图表</a>
					</li>
					<li>
						<a href="OrderStat2.jsp">查询表</a>
					</li>
					<li class="bo-n">
						<a href="logout.jsp">退出系统</a>
					</li>
				</ul>
			</div>
			<div class="zz-contentRight fl">
				<!--表格内容-->
				<div style="width: 860px; height: 750px;">
					<!-- ****************************pageoffice组件使用****************************** -->
					<script type="text/javascript">
						function SaveDocument(data) {
							document.getElementById("PageOfficeCtrl1").WebSave();
							if (document.getElementById("PageOfficeCtrl1").CustomSaveResult != "error") {
							alert('保存成功！');
							location.href = "OrderList.jsp";
							}
						}

						function SetFullScreen() {
							document.getElementById("PageOfficeCtrl1").FullScreen = !document
									.getElementById("PageOfficeCtrl1").FullScreen;
						}
					</script>
					<po:PageOfficeCtrl id="PageOfficeCtrl1" />
					<!-- ****************************pageoffice组件使用****************************** -->
				</div>
			</div>
			<!--内容区-->
		</div>
		<!--content end-->
		<!--footer-->
		<div class="login-footer clearfix">
			Copyright 2013 北京卓正志远软件有限公司
		</div>
		<!--footer end-->
	</body>
</html>