<!--#include file="Conn.asp"--><%Checklogin()%>
<%
product=Request.QueryString("productId")
country=Request.QueryString("country")
str=""

Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open "select ProductName,ProductImg,unit,moq,tips from Products where id="&product,conn,1,1
	    If not Rs.bof and Not Rs.eof Then
		 productname=Rs("productname")
		 productImg=Rs("productImg")
		 unit=Rs("unit")
		 moq=Rs("moq")		 
		 tips=TextUnCode(Rs("tips"))
		 if isnull(moq) Then moq="无数量限制"
		 str="<td>"&productname&"</td><td><img src="&productImg&"></td><td>"&moq&"</td>"
		End If
	Rs.close


	Rs.open "select * from Products where (nosale like '"&country&"%' or nosale like '%,"&country&",%' or nosale like '%"&country&"') and Id="&product&"",conn,1,1
	If Not Rs.bof and not Rs.eof Then
		str=str&"<td class=""nosale"">产品无法在该地区销售,请勿报价。<br>"&TextUnCode(Rs("note"))&"</td>"
	Else
		
	
		Set Rs1=Server.CreateObject("ADODB.RecordSet")	
			Rs1.open "select distinct num,price from price where productId="&product&" and AreaId="&country&" order by num asc",conn,1,1
				If not Rs1.bof and not Rs1.eof Then
				    str=str&"<td><ul>"
					for i=1 to Rs1.Recordcount
					str=str&"<li>订单数量:≥"&Rs2("num")&"<span class=""unit"">"&unit&"</span><span class=""price"">"&Rs2("price")&"</span>RMB</li>"
					Rs1.moveNext
					Next	
						str=str&"</ul></td><td>"&tips&"</td>"					
				Else
					Set Rs2=Server.CreateObject("ADODB.RecordSet")				
						Rs2.open "select distinct num,price from price where productId="&product&" and AreaId=0 order by num asc",conn,1,1	
						str=str&"<td><ul>"						
						Do while Not Rs2.bof and not Rs2.eof
						str=str&"<li>订单数量:≥"&Rs2("num")&"<span class=""unit"">"&unit&"</span><span class=""price"">"&Rs2("price")&"</span>RMB</li>"
						Rs2.moveNext
						loop
						str=str&"</ul></td><td>"&tips&"</td>"					
					    Rs2.close
						Set Rs2=Nothing
				End if		
			Rs1.close
		Set Rs1=Nothing				
	End If	
	Rs.close
	response.write str
Set Rs=Nothing
conn.close
Set conn=Nothing
%>