<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%
ColumnName="":Tablename="HX_Product"
action=request("action")
SSID=request("SSID")
page=request("page")
select case action
  case "del"
    id=request("id")
    if WS_S.HX_IsNUM(id) then
      conn.execute("delete from "&Tablename&" where WS_PTID="&id)
	  WS_S.HX_Redirect("ProductManage.asp?page="&page)
    end if  	
  case "search"
    SSID=WS_s.HX_Replace(request("SSID"))
    Productname=WS_s.HX_Replace(request("Productname"))
    Producttype=WS_s.HX_Replace(request("Producttype"))
    ProductUnitPrice=WS_s.HX_Replace(request("ProductUnitPrice"))
    ProductPrice=WS_s.HX_Replace(request("ProductPrice"))
    ProductSalePrice=WS_s.HX_Replace(request("ProductSalePrice"))
    ProductIntr=WS_s.HX_Replace(request("ProductIntr"))
	Orderby=" where 1=1"
    if WS_S.HX_IsNUM(SSID) and SSID>0 then
	  Orderby=Orderby&" and WS_SSID="&SSID
	end if    
	if Productname<>"" then
	  Orderby=Orderby&" and WS_Productname like '%"&Productname&"%'"
	end if    
	if Producttype<>"" then
	  Orderby=Orderby&" and WS_Producttype like '%"&Producttype&"%'"
	end if    
	if ProductUnitPrice<>"" then
	  Orderby=Orderby&" and WS_ProductUnitPrice="&ProductUnitPrice
	end if    
	if WS_S.HX_IsNUM(ProductPrice) then
	  Orderby=Orderby&" and WS_ProductPrice="&ProductPrice
	end if
	if WS_S.HX_IsNUM(ProductSalePrice) then
	  Orderby=Orderby&" and WS_ProductSalePrice="&ProductSalePrice
	end if
	if ProductIntr<>"" then
	  Orderby=Orderby&" and WS_ProductIntr like '%"&ProductIntr&"%'"
	end if
	  Orderby=Orderby&" and WS_ProductCreateMan="&loginuid
  case else
   if WS_S.HX_IsNUM(SSID) then
     Orderby=" where WS_SSID="&SSID
   else
     Orderby=" where WS_ProductCreateMan="&loginuid&" order by WS_PTID desc"
   end if  
end select
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>产品管理</title>
<link rel=stylesheet type=text/css href="../HXinclude/HX_Style.css">
</head>
<body topmargin="20" leftmargin="0" bottommargin="0">
<table width="98%"  border="0" cellspacing="1" cellpadding="0" align=center bgcolor="#613c25">
  <tr>
    <td colspan="2" bgcolor=FFFBE8 background="../hximages/titlelinebg.gif"><table width="590"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" background="../hximages/titleline.gif"><font class="fontmenu">产品管理</font>　　　　　　<a href="ProductCreate.asp" class="menu">添加产品</a></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="1" cellpadding="0" bgcolor=FFFBE8>
  <tr bgcolor="#BF9B73">
    <td width="6%" height="20" align="right"><div align="center">编 号</div></td>
    <td width="12%"><div align="center">产品名称</div></td>
    <td width="9%"><div align="center"> 产品型号 </div></td>
    <td width="9%"><div align="center">成本价</div></td>
    <td width="20%"><div align="center">出售价</div></td>    
    <td width="7%"><div align="center">计量单位</div></td>
    <td width="18%"><div align="center">简要说明</div></td>
    <td width="11%"><div align="center">供应商</div></td>
    <td width="8%"><div align="center">操 作</div></td>
  </tr>
  <%if rs.recordcount>0 then
 rs.PageSize =15 '每页记录条数
	iCount=rs.RecordCount '记录总数
	iPageSize=rs.PageSize
    	maxpage=rs.PageCount 
    	page=request("page")
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rs.AbsolutePage=Page

	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	ii=0
	do while not rs.EOF%>
  <tr bgcolor="#FFFBE8" onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'>
    <td align="center" height="20"><%=rs("WS_PTID")%></td>
    <td align="center"><%=rs("WS_ProductName")%></td>
    <td align="center"><%=rs("WS_ProductType")%></td>
    <td align="center">￥<%=rs("WS_ProductPrice")%></td>
    <td>￥<%response.Write rs("WS_ProductSalePrice")
	set crs=WS_S.HX_SetRSD("","HX_CustomRank"," order by WS_OrderBy asc")
	if crs.recordcount>0 then
	  do until crs.eof
	   if crs("WS_CustomRankPice")<>0 then WS_CustomRankPice=crs("WS_CustomRankPice"):msg=crs("WS_CustomRankPice")&"折</font>" else WS_CustomRankPice=10:msg="不打折</font>"
	   response.Write "<br>&nbsp;<font color=red>"&crs("WS_CustomRankName")&"：￥"&WS_CustomRankPice*rs("WS_ProductSalePrice")*0.1&"</font> <font color=blue>"&msg
	  crs.movenext
	  loop
	end if
	%></td>
    <td align="center"><%=rs("WS_ProductStocks")&" "&rs("WS_ProductUnitPrice")%></td>    
    <td align="center"><%=rs("WS_ProductIntr")%></td>
    <td align="center"><%call WS_S.HX_OutSaleShop(rs("WS_SSID"))%></td>
    <td align="center"><a href="ProductModify.asp?id=<%=rs("WS_PTID")%>">修改</a> <a href="#" onclick="if(!confirm('确认要删除此交往信息记录吗？')) {return false};else {location.href='ProductManage.asp?action=del&id=<%=rs("WS_PTID")%>';return true;}">删除</a></td>
  </tr><%
  ii=ii+1
	  if ii>=rs.PageSize then Exit Do
	  rs.movenext
      loop
	  end if
	  for i=0 to 15-rs.recordcount
  %>
   <tr bgcolor="#FFFBE8" onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8' align=center>
    <td height="25">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    
  </tr>
  <%
     next
   if rs.recordcount>0 then
   call WS_S.PageControl(iCount,maxpage,page,"border=0 align=right","<p align=right>",10)
   end if
  call WS_S.HX_RSClose(rs) %>
</table></td>
  </tr>
</table>

