<!--#include file="conn.asp"-->
<!--#include file="ProductList.asp"-->

<%
strCurrMenu=GetVariable("mnid")
%>
<%
if GetVariable("action")="save" then 
	'下订餐单
	if Session("ProductList")="" then
		Response.Write "<script language='javascript'>alert('欢迎您来到⑨title⑨，您尚未点订购任何商品！\n\n请您先到产品展示区选择您想要的商品');</script>"
	end if

	strUser=GetFormVariable("txtuser")	
	strAddr=GetFormVariable("txtaddress")	
	strPhote=GetFormVariable("txtphote")	
	strEmail=GetFormVariable("txtemail")	
	strNote=GetFormVariable("txtnote")
	
	strProduct=""
	'输出商品列表
	ProductList = Session("ProductList")		'商品ID列表
	ProductCount=Session("ProductCount")		'商品数量列表
	PtCounts = Split(ProductCount, ",")
	strSQL="Select * From web_product Where id In (" & ProductList & "0)"
	Rs.open strSQL,conn,1,1
	money=0
	strProduct=strProduct & "<table width=100% border=0 cellspacing=1 cellpadding=0>" 
	strProduct=strProduct & "  <tr> " 
	strProduct=strProduct & "    <td width=11% align=center>序号</td>" 
	strProduct=strProduct & "    <td width=32% align=center>商品名</td>" 
	strProduct=strProduct & "    <td width=21% align=right>单价</td>" 
	strProduct=strProduct & "    <td width=18% align=right>数量</td>" 
	strProduct=strProduct & "    <td width=18% align=right>小计</td>" 
	strProduct=strProduct & "  </tr>" 
	For i=1 to rs.recordcount
		if rs.eof then exit for
		
		xj=Rs("p_price") * Cint(PtCounts(i-1))
		 money=money+xj
		strProduct=strProduct & "  <tr> " 
		strProduct=strProduct & "    <td align=center>" & i & "</td>" 
		strProduct=strProduct & "    <td align=center>" & trim(Rs("p_name")) & "</td>" 
		strProduct=strProduct & "    <td align=right>￥" & trim(Rs("p_price")) & "</td>" 
		strProduct=strProduct & "    <td align=right>" & PtCounts(i-1) & "</td>" 
		strProduct=strProduct & "    <td align=right>￥" & xj & "</td>" 
		strProduct=strProduct & "  </tr>" 
		rs.movenext
	next
	strProduct=strProduct & "<tr>     <td colspan=5><strong>总计：￥" & money & "</strong></td>  </tr></table>"

	
	strSQL="Insert Into web_product_order(m_id,mn_id,o_addr,o_phote,o_user,o_email,o_note,o_product,o_productList,o_productCount) Values("
	strSQL=strSQL & "0" & trim(Session("UserID")) & ","
	strSQL=strSQL & "0" & GetVariable("mnid") & ","
	strSQL=strSQL & "'" & strAddr & "',"
	strSQL=strSQL & "'" & strPhote & "',"
	strSQL=strSQL & "'" & strUser & "',"
	strSQL=strSQL & "'" & strEmail & "',"
	strSQL=strSQL & "'" & strNote & "',"
	strSQL=strSQL & "'" & strProduct & "',"	
	strSQL=strSQL & "'" & ProductList & "',"	
	strSQL=strSQL & "" & cint(ProductCount) & ")"	
	conn.execute strSQL,0,1
	Response.Write "<script language='javascript'>alert('⑨title⑨已经接收您的订单，谢谢您惠顾!');</script>"
end if
%>

<%
'++++++++++++++++++++++++++++++购物车操作+++++++++++++++++++++++++++++++
'
'添加商品
if GetVariable("action")="add" then
	call AddProduct(GetVariable("spid"),CInt(GetVariable("PtCount")))
end if

'删除商品
if GetVariable("action")="modify" then
	call ModifyProduct(GetVariable("spid"),CInt(GetVariable("PtCount")))
end if

'清空购物车
if GetVariable("action")="clear" then
	call clearProduct()
end if

%>

<html>
<head>
<title>⑨title⑨</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="common/style.css" type="text/css">
<style>
A:link{ color: #006000; text-decoration: none;}
A:visited{ color: #006000; TEXT-DECORATION: none;}
A:active{color: #006000; TEXT-DECORATION: none;}
A:hover{ color: #006000; TEXT-DECORATION: underline;}


</style>
<script language="JavaScript" src="common/JS_CheckForm.js"></script>
<script language="JavaScript">
function checkform(theform){
	if(!CheckEmpty(theform.key, "关键字")) return false;
	if(!CheckInteger(theform.price1, "最低价格")) return false;
	if(!CheckInteger(theform.price2, "最高价格")) return false;
}
</script>

<script language="JavaScript">
function checkform(theform){
	if(!CheckEmpty(theform.txtuser, "联系人")) return false;
	if(!CheckEmpty(theform.txtphote, "联系电话")) return false;
	if(!CheckEmpty(theform.txtaddress, "详细地址")) return false;
}
</script>
</head>

<body bgcolor="e7e7e7" text="#000000" leftmargin="0" topmargin="0" BodyBegin>
<table width="770" border="0" align="center" cellspacing="0" cellpadding="0" height="100%">
  <tr> 
    <td bgcolor="#FFFFFF" valign="top"> 
      <table width="750" border="0" align="center" cellspacing="0" cellpadding="0" height="100">
        <tr> 
          <td bgcolor="#FFFFFF">
		  <!--#include file="top.asp"-->
          </td>
        </tr>
        <tr> 
          <td bgcolor="#FFFFFF" height="17"> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr> 
                <td height="32" width="12%"> <div align="center"><img src="images/cp.gif" width="87" height="29"></div></td>
                <td height="32" width="88%"> <table cellspacing=0 cellpadding=0 width="100%" border=0>
                    <tbody>
                      <tr> 
                        <td 
                      background="images/line_1.gif"><img 
                        height=1 
                        src="厦门绿拾字环保 __ Xiamen Greencross Association _____________________________.files/line_1.gif" 
                        width=4></td>
                      </tr>
                    </tbody>
                  </table></td>
              </tr>
              <tr> 
                <td height="58" colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width="75%" height="183" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="8" align="center">
                          <tr> 
                            <td valign="top" height="36"> <table width="96%" border="0" align="center">
                                <tr> 
                                  <td  height="8"></td>
                                </tr>
                                <tr> 
                                  <td  height="23">您的位置 : <a class=title01 
            href=".">首页</a> <img src="images/image_24.gif" width="8" height="5"> 
                                    <font face="Arial Black">订购商品</font></td>
                                </tr>
                                <tr> 
                                  <td height="1" background="images/linebg.gif"></td>
                                </tr>
                              </table></td>
                          </tr>
                          <tr> 
                            <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr> 
                                  <td width="16">&nbsp;</td>
                                  <td width="490" height="300" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr> 
                                        <td width="15">&nbsp;</td>
                                        <td width="462" height="200" valign="top"> 
                                          <table width="100%" height="267" border="0" cellpadding="0" cellspacing="1">
                                            <tr> 
                                              <td height="20" valign="top"> <table width="100%" height="20" border="0" cellpadding="0" cellspacing="1">
                                                  <tr> 
                                                    <td height="27" bgcolor="#FFFFFF"><strong><font color="#FFFFFF">&nbsp;</font>您预订的商品清单：</strong></td>
                                                  </tr>
                                                  <tr> 
                                                    <td height="67" valign="top"> 
                                                      <table width="95%" border="0" align="center" cellpadding="2" cellspacing="1">
                                                        <tr> 
                                                          <td width="43%" height="18" bgcolor="#EEEEEE"><strong>商品名称</strong></td>
                                                          <td width="16%" align="center" bgcolor="#EEEEEE"><strong>数量</strong></td>
                                                          <td width="18%" align="center" bgcolor="#EEEEEE"><strong>价格</strong></td>
                                                          <td width="23%" align="center" bgcolor="#EEEEEE"><strong>删除 
                                                            </strong></td>
                                                        </tr>
                                                        <SCRIPT language=javascript>
						<!--
							function SetCount(strID,strCount){
								if (CheckValue(strCount)){
									window.location="shopping.asp?action=modify" + "&spid=" + strID + "&PtCount=" + strCount;
								}
							}
							
							function DeleProduct(strID){
								window.location="?action=modify" + "&spid=" + strID + "&PtCount=0&mnid=<%=strCurrMenu%>";
							}
							
							function clearProduct(){
								window.location="shopping.asp?action=clear";
							}
							
							function buy(){
								window.open("dc.asp");
							}
							
						//-->
					  </SCRIPT>
                                                        <%
				'输出商品列表
				ProductList = Session("ProductList")		'商品ID列表
				ProductCount=Session("ProductCount")		'商品数量列表
				PtCounts = Split(ProductCount, ",")
				
				strSQL="Select * From web_product Where id In (" & ProductList & "0)"
				set Rs=Server.CreateObject("ADODB.RecordSet")
				Rs.open strSQL,conn,1,1
				money=0
				if rs.recordcount=0 then 
					response.Write("<tr bgcolor=#FFFFFF><td colspan=4>欢迎您来到⑨title⑨，您尚先购任何商品！</td></tr>")
				end if
				For i=1 to rs.recordcount
					if rs.eof then exit for
				%>
                                                        <tr> 
                                                          <td height="18"><%=trim(Rs("p_name"))%></td>
                                                          <td width="16%" align="center"><%=PtCounts(i-1)%>件</td>
                                                          <td width="18%" align="center"><%=trim(Rs("p_price"))%>/件</td>
                                                          <td width="23%" align="center"><a href="javascript:DeleProduct('<%=rs("id")%>')"><img src="images/shanchu.gif" width="36" height="15" border="0"></a> 
                                                            <%
				  xj=Rs("p_price") * Cint(PtCounts(i-1))
				  money=money+xj
				  %>
                                                          </td>
                                                        </tr>
                                                        <%
					rs.movenext
				next
				%>
                                                        <tr> 
                                                          <td height="1" colspan="4" align="center" bgcolor="#EEEEEE"> 
                                                            <table width="98%" border="0" cellspacing="0" cellpadding="0">
                                                              <tr> 
                                                                <td height="1" bgcolor="#666666"></td>
                                                              </tr>
                                                            </table></td>
                                                        </tr>
                                                        <tr> 
                                                          <td colspan="2" bgcolor="F5F5F5"><a href="javascript:;" onClick="window.open('shopping.asp?mnid=<%=strCurrMenu%>','','width=580,height=250,scrollbars=yes,resizable=yes');">查看购物车<img src="images/buy.gif" alt="" width=60 height=20 border="0" align="absmiddle"></a></td>
                                                          <td align="right" bgcolor="#EEEEEE">合计：</td>
                                                          <td width="23%" align="center" bgcolor="#EEEEEE"><font color="#FF0000"><strong><%=money%></strong></font>元 
                                                          </td>
                                                        </tr>
                                                      </table></td>
                                                  </tr>
                                                </table></td>
                                            </tr>
                                            <tr> 
                                              <td valign="top"> <form name="orderform" method="post" onSubmit="return checkform(this)" action="?action=save&mnid=<%=strCurrMenu%>">
                                                  <table border="0" width="100%" height="0%" bordercolorlight="#000000" cellspacing="0" cellpadding="5" bordercolordark="#E8E8E8">
                                                    <tr bgcolor="#CfCfCf"> 
                                                      <td height="10%" colspan="3"><strong>填写订单：</strong></td>
                                                    </tr>
                                                    <tr> 
                                                      <td height="10%" width="15%" align="right">联系人：</td>
                                                      <td height="10%" colspan="2"> 
                                                        <input name="txtuser" type="text" id="txtuser3" size="18">
                                                        *必填</td>
                                                    </tr>
                                                    <tr> 
                                                      <td height="10%"  align="right">联系电话：</td>
                                                      <td height="10%" colspan="2"> 
                                                        <input name="txtphote" type="text" id="txtphote" size="18">
                                                        *必填 </td>
                                                    </tr>
                                                    <tr> 
                                                      <td height="10%" width="15%" align="right">E_mail：</td>
                                                      <td height="10%" colspan="2"> 
                                                        <input type="text" name="txtemail" size="31"> 
                                                      </td>
                                                    </tr>
                                                    <tr> 
                                                      <td height="10%" align="right">详细地址：</td>
                                                      <td height="10%" colspan="2"> 
                                                        <input type="text" name="txtaddress" size="31">
                                                        *必填，尽量详细</td>
                                                    </tr>
                                                    <tr> 
                                                      <td height="32%" align="right">订购备注：</td>
                                                      <td width="51%" height="32%"> 
                                                        <textarea name="txtnote" cols="31" rows="4" id="txtnote" ></textarea></td>
                                                      <td width="34%" height="32%">&nbsp;</td>
                                                    </tr>
                                                    <tr> 
                                                      <td height="18%" width="15%" align="right">&nbsp;</td>
                                                      <td height="18%"> <input type="submit" name="Submit" value="提交"> 
                                                        <input type="reset" name="Submit2" value="重置"></td>
                                                      <td height="18%">&nbsp;</td>
                                                    </tr>
                                                  </table>
                                                </form></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                    </table></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table></td>
                      <td width="25%" height="183" valign="top"> <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#5E9F2D">
                          <tr> 
                            <td bgcolor="#60994A" height="27"><font color="#FFFFFF">　<b>产品搜索</b></font></td>
                          </tr>
                          <tr> 
                            <td bgcolor="#F4FBEC" height="94"> <form name="form1" method="post" action="?" onSubmit="return checkform(this)">
                                <table width="190" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr> 
                                    <td width="58" height="8" align="right"></td>
                                    <td width="132" height="8"></td>
                                  </tr>
                                  <tr> 
                                    <td width="58" height="26" align="right">分　类：</td>
                                    <td width="132" height="26"> <select name="class" id="class" style="width:80px">
                                        <option value="">全部产品</option>
                                        <%
								'开始输出分类
								strSQL="Select * From web_product_class Where mn_id=" & strCurrMenu & " Order by c_index"
								Set rs=Server.CreateObject("ADODB.RecordSet")
								rs.open strSQL,conn,1,1
								for i=1 to rs.recordcount
								%>
                                        <option value="<%=rs("id")%>"><%=trim(rs("c_name"))%></option>
                                        <%
									rs.movenext
								next
								%>
                                      </select> </td>
                                  </tr>
                                  <tr> 
                                    <td height="26" align="right">关键字：</td>
                                    <td height="26"> <input name="key" type="text" id="key" size="14" maxlength="50" style="width:80px"> 
                                    </td>
                                  </tr>
                                  <% if showPrice<>"none" then %>
                                  <tr> 
                                    <td height="26" align="right">价　格：</td>
                                    <td height="26"> <input name="price1" type="text" id="price1" size="2" maxlength="5" style="width:30px">
                                      到 
                                      <input name="price2" type="text" id="price2" size="2" style="width:30px"> 
                                    </td>
                                  </tr>
                                  <%end if%>
                                  <tr align="left"> 
                                    <td height="30" colspan="2"> <table width="156" height="40" border="0" cellpadding="0" cellspacing="0">
                                        <tr> 
                                          <td width="117" height="40" align="right"> 
                                            <input name="imageField" type="image" src="images/search1.gif" width="82" height="24" border="0" style="border:0"> 
                                          </td>
                                          <td width="39" height="40" valign="bottom">&nbsp;&nbsp;</td>
                                        </tr>
                                      </table></td>
                                  </tr>
                                </table>
                              </form></td>
                          </tr>
                          <!--Link Begin-->
                          <%
							isLink=GetKey("Enable",WebUserID,"link")
							if isLink="Yes" then
							%>
                          <tr> 
                            <td bgcolor="#60994A" height="27"><b><font color="#FFFFFF">　友情链接</font></b></td>
                          </tr>
                          <tr> 
                            <td bgcolor="#F4FBEC" height="95"> <table width="100%" border="0" cellpadding="7" cellspacing="0">
                                <tr> 
                                  <td  valign="top"> 　 
                                    <div align="center"> 
                                      <script language="JavaScript" src="admin/link/link.asp"></script>
                                    </div></td>
                                </tr>
                              </table></td>
                          </tr>
                          <%
							  end if
							  %>
                          <!--Link End-->
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
        <tr> 
          <td bgcolor="#FFFFFF" height="17"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="1" background="images/line_1.gif"></td>
              </tr>
              <tr> 
                <td height="97"> <div align="center">⑨footnote⑨<br>⑨ICP⑨<br>
                    您是本站第<script language="JavaScript" src="admin/count/counter.asp"></script>位访问者</div></td>
              </tr>
            </table></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<script language="JavaScript" src="common/init.js"></script><br><script language=Javascript src="common/tranbig5.Js"></script>
</body>
</html>
