<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("03")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>

<BODY background="../images/admin/back.gif">
<%
action=request("action")
if action="" then
%>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
<form name=search action=prod3.asp method=post>
<tr><td colspan=2 class=td height=18>产品类别转移</td></tr>
<%	Dim a,b,c 
	set rs=server.createobject("adodb.recordset") 
	sql="select distinct LarCode,LarSeq,MidCode,midSeq from hfvip_class order by LarSeq,MIdSeq" 
	rs.Open sql,conn,1,1 



	if rs.bof and rs.eof then
	response.write "<TR><TD align=center colspan=2>没有对产品进行分类，不能转移产品。</td>"
	else
	response.write "<TR><TD align=center width=100 >从</td><td>"
	response.write "<select name='fenlei1'>"
	response.write	"<option value='' selected>选择要转移的产品分类</option>"
	Do While Not rs.eof
	a=rs("larcode")	
	response.write "<option value='"&rs("larCode")&"^"&rs("MidCode")&"'>"&rs("LarCode")&" >> "&rs("MidCode")&"</option>"
	rs.movenext
	if rs.eof then exit do
	if rs("larcode")<>a then response.write "<option value=''>--------------------------</option>"
	loop
	response.write "<option value=''>--------------------------</option>"
	response.write "<option value='未归类^未归类'>所有未归类的产品</option>"

	response.write "</td><tr><TD align=center width=100 >转移到</td><td>"

	rs.movefirst	'指针重定位
	response.write "<select name='fenlei2'>"
	response.write	"<option value='' selected>选择产品转移的目标位置</option>"
	Do While Not rs.eof
	a=rs("larcode")	
	response.write "<option value='"&rs("larCode")&"^"&rs("MidCode")&"'>"&rs("LarCode")&" >> "&rs("MidCode")&"</option>"
	rs.movenext
	if rs.eof then exit do
	if rs("larcode")<>a then response.write "<option value=''>--------------------------</option>"
	loop
	end if
	rs.close
	set rs=nothing

	response.write "</td></tr>"

%>

<tr><td colspan=2><INPUT name=action TYPE="submit" value="开始转移"><INPUT name="action" TYPE="hidden" value="ok"></td></tr>
</table>

<%
else

'开始搜索
if request("fenlei1")="" or  request("fenlei2")="" then
	response.write "<script language='javascript'>"
	response.write "alert('您没有选择，或者没有可供选择的产品分类。');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
end if

if request("fenlei1")=request("fenlei2") then
	response.write "<script language='javascript'>"
	response.write "alert('选择了两个相同的分类，产品未转移。');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
end if


code1=split(request.form("fenlei1"),"^")
larcode1=code1(0)
MidCode1=code1(1)

code2=split(request.form("fenlei2"),"^")
larcode2=code2(0)
MidCode2=code2(1)

set rs=server.createobject("adodb.recordset")
sql = "select * from hfvip_produc where larcode='"&larcode1&"' and midcode='"&midcode1&"'"
rs.open sql,conn,1,3
if  (rs.eof and rs.bof) then

	response.write "<script language='javascript'>"
	response.write "alert('这个分类中没有产品可供转移。');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end

else
i=0
do while not rs.eof
rs("larcode")=larcode2
rs("midcode")=midcode2
i=i+1
if rs.eof then exit do
rs.movenext
loop

	response.write "<script language='javascript'>"
	response.write "alert('产品转移成功！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end

end if
rs.close
set rs=nothing


end if
%>

</body>
</html>
