<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="top.asp"-->
<%
tid = int(Request("tid"))
if tid=0 then
titlename="送货方式 "
elseif tid=1 then
titlename="支付方式"
end if

canshu1="tid="&tid&""
canshu3=""
canshu2=""&canshu3&""

set rs=server.CreateObject("adodb.recordset")
select case action
case "tj"
 call editbook("sh=1","com_songhuo")
case "pt"
 call editbook("sh=0","com_songhuo")

case "inputedit"
 attrKey = split(Trim(Request("id")), "$")(0)
 index00 = split(Trim(Request("id")), "$")(1)
 set rs=server.CreateObject("adodb.recordset")
 sql="select * from com_songhuo where id="&index00
 rs.open sql,conn,2,3
 rs(""&attrKey&"")=Trim(Request("value"))
 rs.update
 rs.close
 set rs=nothing
 Response.Write(Trim(Request("value"))) 
 Response.end()  
case "del" 
 id=replace(request("id")," ","")
 id=split(id,",")
 for i=0 to UBound(id)
 conn.execute("delete from com_songhuo where id="&id(i))
 next
 response.Write "<script>location='?"&canshu1&"'</script>"
case "order" 
 pi=REQUEST("pi")
 pi=REPLACE(pi,", ",",")
 SQL5="SELECT * from com_songhuo where id IN ("&pi&")"
 SET RS5=SERVER.CREATEOBJECT("ADODB.RECORDSET")
 rs5.open sql5,conn,1,3
 while not rs5.eof 
 RS5("pid")=REQUEST("pid"&RS5("id"))
 RS5.UPDATE
 RS5.MOVENEXT
 wend
 response.Write "<script>location='?"&canshu1&"'</script>"
case "add"
 tid = int(Request("tid"))
 rs.open "select * from com_songhuo",conn,1,3
 rs.addnew
 rs("subject")=trim(request("subject"))
 rs("pid")=REQUEST("pid")
 rs("type")=tid
 rs.update
 rs.close
 set rs=nothing
response.Write "<script>location='?tid=0'</script>"
response.End
end select

%>
<div id="container">
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><img src="images/but_2.gif" alt="排序" onclick="form1.action='?action=order&<%=canshu1%>';form1.submit();"></li>
<!-- <li><img src="images/but_3.gif" alt="删除" onclick="form1.action='?action=del&<%=canshu1%>'; ConfirmDel() "></li>-->
 <li><img src="images/but_8.gif" alt="刷新" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" onClick="window.print() "/></li>
</div>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_songhuo where type="&tid&" order by pid asc",conn,1,1
i=rs.recordcount
set subject=rs("subject")
set id=rs("id")
%>
<form name="form1" id="form1" method="post" action="?<%=canshu1%>">
<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:50px"><input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form);" ></li>
 <li style="width:200px"><%=titlename%>（点击修改）</li>
 <li style="width:50px">启用</li>
 <li style="width:50px">排序</li>
</div>
<%
do while not rs.eof
%>
<div class="tableAll trbgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:50px;"><input type="checkbox" name="id"  value="<%=id%>"></li>
 <li style="width:200px"><span id="subject$<%=id%>" class="edit"><%=subject%></span></li>
  <li style="width:50px;"><%if rs("sh")=1 then%><a href="?action=pt&id=<%=id%>&<%=canshu1%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=tj&id=<%=id%>&<%=canshu1%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
 <li style="width:50px;"><input name="pid<%=id%>" type="text" id="pid<%=id%>" value="<%=rs("pid")%>" size="3"> 
<input name="pi" type="hidden" id="pi" value="<%=id%>"></li>
</div>
<%
rs.movenext
loop
%>
</form>

<!--<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:550px">添加<%=titlename%></li>
</div>
<form name="addform" method="post" action="?action=add&tid=<%=tid%>">
<div class="tableAll trbgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:50px">&nbsp;</li>
 <li style="width:200px"><input name="subject" type="text" id="subject" size="30"></li>
 <li style="width:50px"><input name="pid" type="text" id="pid" value=<%=i+1%> size="4"  /></li>
 <li style="width:80px"><input type="submit" name="Submit3" value="添加" class="button" ></li>
</div>
</form>-->
<%
rs.close
set rs=nothing
%>
    
</div>
<script language="JavaScript" type="text/JavaScript" src="js/jquery.latest.js"></script> 
<!--#include file="footer.asp"-->