<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0
%>
<!-- #include file="../dsn.asp" -->
<!-- #include file="../links.asp" -->
<%
pageno=Request.QueryString("pageno")
delid=Request.QueryString("keyno")

htmltitle="网站在线定单"
htmlname=linkorderadmin&"?flag=1"
addhtml=linkorderview&"?flag=1"
mode=Request.QueryString ("mode")
set cn=server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs=server.CreateObject("ADODB.Recordset")
set rs2=server.CreateObject("ADODB.Recordset")

if Request.ServerVariables("REQUEST_METHOD")="POST" and mode<>"888" then
		if not isempty(request("sel")) then
     		idlist=request("sel")
     		if instr(idlist,",")>0 then
				dim idarr
				idArr=split(idlist)
				for i = 0 to ubound(idarr)
	       			delid=clng(idarr(i))
	       			call setupdate(delid,mode)
				next
			else
				delid=clng(idlist)
				call setupdate(delid,mode)
			end if	
		end if
		delid=0
		Response.Redirect htmlname
end if
sub setupdate(id,mm)
    if mm="999" then
		sqltext3="delete from ordertab where id="&id
		cn.Execute sqltext3   
		sqltext3="delete from ordertable where pid="&id
		cn.Execute sqltext3   
	end if	
  end sub  
%>
<html>
<head>
<title><%=htmltitle%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000000; font-family: 宋体}
td {font-size: 12px; color: #000000; font-family: 宋体;line-height:130%}
.t1 {font:12px 宋体;color=000000} 
.t2 {font:12px 宋体;color:ffffff} 
.t3 {font:12px 宋体;color:336699} 
.t4 {font:12px 宋体;color:ff0000} 
.t4 {font:12px 宋体;color:ff0000} 
.t5 {font:12px 宋体;color:ff6600} 

.bt1 {font:14px 宋体;color=000000} 
.bt2 {font:12px 宋体;color:ffffff} 
.bt3 {font:14px 宋体;color:336699} 
.bt4 {font:14px 宋体;color:ff0000} 
.bt5 {font:14px 宋体;color:0000ff}
.bt10 {font:14px 宋体;color:0000ff}

.td1 {font-size:12px;background-color:#3388bb;color:#ffffff}
.td2 {font-size:12px;background-color:#ffffff;color:#000000;}

A:link {color: #000077}
A:visited {color: #000077}
A:hover {color: #ff0000}

A.title1:link {text-decoration:none;color:#336699;}
A.title1:visited {text-decoration:none;color:#336699;}
A.title1:active {text-decoration:none;color:#336699;}
A.title1:hover {text-decoration:none;color:#336699;}
-->
</style>
</head>
<body topmargin=5>
<table width="100%" align=center height="100%">
	<tr>
	<td valign="top" align="left" width="100%">
		<table width="100%" height="20" border="0">
			<tr>
			<td style="font-size:12px;"></td>
			<td><font class=t5>当前位置：<%=htmltitle%></font></td>
			<td align="right">
			</td>
			</tr>
		</table>
		<table width="100%" height="20" border="0">
			<tr>
			<form action="<%=htmlname%>" method=post name="listform">
		<%
		sqltext="select * from ordertab order by creatdate desc "
		'Response.Write sqltext
		rs.Open sqltext,cn,1,1
		listcs=8
		rs.PageSize=listcs
		if pageno="" then 
			pageno=1
		else
			pageno=cint(pageno)	
		end if	
		if rs.PageCount>0 then rs.AbsolutePage=pageno
	%>
		<td class=t1 align="left" width=200>
			<a href="Javascript:window.location.reload()">[刷新列表]</a>
			<a href="javascript:delrows()">[删除]</a>
		</td>
		<td align="right">
		<%if rs.PageCount>1 then%>
			[第<b><%=pageno%></b>页, 共<b><%=rs.PageCount%></b>页<b><%=rs.RecordCount%></b>条记录]		              
			<%if pageno>1 then%>
				<a class=r href="<%=htmlname%>&pageno=1">首页</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno-1%>">上页</a>              
			<%end if              
			if pageno<rs.PageCount then%>              
				<a class=r href="<%=htmlname%>&pageno=<%=pageno+1%>">下页</a>              
				<a class=r href="<%=htmlname%>&pageno=<%=rs.PageCount%>">末页</a>              
			<%end if%>              
		<%end if              
		%>              
		</td>
		</tr>
		</table>
		<table width="100%" border="0" cellspacing="1" cellpadding="1" style="font-size:14.5px;line-height:100%">
				<tr bgcolor="336699" style="color:#ffffff" align="center">
				<td class=bt2></td><td class=bt2>定单编号</td><td class=bt2>姓名</td>
				<td class=bt2>定单时间</td><td class=bt2>定单状态</td><td class=bt2>处理结果</td><td class=bt2>更新时间</td></tr>
		<%
		i=0
		do while not rs.EOF and i<listcs 
			if (i mod 2)=1 then
				Response.Write("<tr bgcolor=fefefe>")
			else
				Response.Write("<tr bgcolor=efefef>")
			end if	
			if keyno1="" then keyno1=rs("id")
			if rs("orderflag")=0 then
					txt="<font color=red>等待确认</font>"
			elseif rs("orderflag")=1 then
					txt="<font color=blue>正在确认</font>"
			elseif rs("orderflag")=2 then
					txt="<font color=000000>定单结束</font>"
			end if
			if rs("orderjg")=0 then
					if rs("orderflag")=0 then
							txt1=""
						else
							txt1="<font color=blue>拒绝定单</font>"
					end if
			elseif rs("orderjg")=1 then
					txt1="<font color=red>未发货</font>"
			elseif rs("orderjg")=2 then
					txt1="<font color=000000>货已发</font>"
			end if
		%>
			<td width="20" align="center">
				<input type="checkbox" name="sel" value="<%=(rs("id"))%>">
			</td>
			<td width="70" align="center"><%=rs("id")%></td>
			<td align="left"><a href="<%=linkorderview%>?keyno=<%=rs("id")%>" target=myview><%=trim(rs("orderman"))%></a></td>
			<td width="140" align="center"><%=rs("creatdate")%></td>
			<td width="80"><%=txt%></td>
			<td width="80"><%=txt1%></td>
			<td width="140" align="center"><%=rs("orderupdate")%></td>
			</tr>
		<%	
			i=i+1
			rs.MoveNext
		loop
		%>

		</td></tr>
			    </form>
		</table>
		<table><tr height=120><td></td></tr></table>
		<table width="100%"> 
		<tr><td bgcolor="cccccc">
			<iframe name=myview scrolling=auto width=100% height=240 src="<%=linkorderview%>?keyno=<%=keyno1%>" frameborder=0></iframe>
		</td></tr>
		</table>
</td></tr><table>
</body>
</html>

<script language="Javascript">

    function delrows()
    {
        if (confirm('您确认要删除你所选中的项目吗？')==true)
        {        
        document.listform.action="<%=htmlname%>&mode=999";
        document.listform.submit();
        }
    }

</script>

