%
const ChannelID=2
Const ShowRunTime="Yes"
dim Action
SkinID=0
PageTitle="网上订购"
Action=trim(request("Action"))
if Action="SaveOrderForm" then
call SaveOrderForm()
else
%>
<%=strPageTitle & " >> " & PageTitle%>
<% call MenuJS() %>
onmousemove='HideMenu()'>
<%
end if
if FoundErr=True then
call WriteErrMsg()
end if
call CloseConn()
sub SaveOrderForm()
dim OrderFormID,OrderFormNum,Company,ContactMan,Phone,Address,PostCode,SpecialDemand
dim ProductName,Standard,Unit,Ammount,SendTime,Remark
dim arrProductName,arrStandard,arrUnit,arrAmmount,arrSendTime,arrRemark
dim sqlOrderForm,rsOrderForm,trs,i
Company=trim(request.form("Company"))
ContactMan=trim(request.form("ContactMan"))
Phone=trim(request.form("Phone"))
Address=trim(request.form("Address"))
PostCode=trim(request.form("PostCode"))
SpecialDemand=trim(request.form("SpecialDemand"))
ProductName=trim(request.form("ProductName"))
Standard=trim(request.form("Standard"))
Unit=trim(request.form("Unit"))
Ammount=trim(request.form("Ammount"))
SendTime=trim(request.form("SendTime"))
Remark=trim(request.form("Remark"))
if Company="" then
FoundErr=True
ErrMsg=ErrMsg & "
请输入单位名称"
end if
if ContactMan="" then
FoundErr=True
ErrMsg=ErrMsg & "
请输入联系人姓名"
end if
if Phone="" then
FoundErr=True
ErrMsg=ErrMsg & "
请输入联系电话"
end if
if ProductName="" then
FoundErr=True
ErrMsg=ErrMsg & "
请至少输入一项产品的产品名称"
end if
if Standard="" then
FoundErr=True
ErrMsg=ErrMsg & "
请至少输入一项产品的规格型号"
end if
if Unit="" then
FoundErr=True
ErrMsg=ErrMsg & "
请至少输入一项产品的单位"
end if
if Ammount="" then
FoundErr=True
ErrMsg=ErrMsg & "
请至少输入一项产品的订购数量"
end if
if FoundErr=True then
exit sub
end if
arrProductName=split(ProductName,",")
arrStandard=split(Standard,",")
arrUnit=split(Unit,",")
arrAmmount=split(Ammount,",")
arrSendTime=split(SendTime,",")
arrRemark=split(Remark,",")
' response.write ProductName & "
"
' response.write Standard & "
"
' response.write Unit & "
"
' response.write Ammount & "
"
' response.write SendTime & "
"
' response.write Remark & "
"
' exit sub
set trs=conn.execute("select max(OrderFormNum) from OrderForm where datediff('d',AddTime,now())=0")
if trs.bof and trs.eof then
OrderFormNum=year(now)&right("0"&month(now),2)&right("0"&day(now),2) & "001"
else
if IsNull(trs(0)) then
OrderFormNum=year(now)&right("0"&month(now),2)&right("0"&day(now),2) & "001"
else
OrderFormNum=trs(0)+1
end if
end if
set trs=nothing
sqlOrderForm="select top 1 * from OrderForm"
set rsOrderForm=server.createobject("adodb.recordset")
rsOrderForm.open sqlOrderForm,conn,1,3
rsOrderForm.addnew
rsOrderForm("OrderFormNum")=OrderFormNum
rsOrderForm("Company")=Company
rsOrderForm("ContactMan")=ContactMan
rsOrderForm("Phone")=Phone
rsOrderForm("Address")=Address
rsOrderForm("PostCode")=PostCode
rsOrderForm("SpecialDemand")=SpecialDemand
rsOrderForm("AddTime")=now()
rsOrderForm.update
OrderFormID=rsOrderForm("OrderFormID")
rsOrderForm.close
sqlOrderForm="select top 1 * from OrderForm_Item"
rsOrderForm.open sqlOrderForm,conn,1,3
for i=0 to ubound(arrProductName)
if trim(arrProductName(i))<>"" and trim(arrStandard(i))<>"" and trim(arrUnit(i))<>"" and isnumeric(trim(arrAmmount(i)))<>"" then
rsOrderForm.addnew
rsOrderForm("OrderFormID")=OrderFormID
rsOrderForm("ProductName")=trim(arrProductName(i))
rsOrderForm("Standard")=trim(arrStandard(i))
rsOrderForm("Unit")=trim(arrUnit(i))
rsOrderForm("Ammount")=Cdbl(trim(arrAmmount(i)))
if trim(arrSendTime(i))<>"" then
rsOrderForm("SendTime")=trim(arrSendTime(i))
end if
rsOrderForm("Remark")=trim(arrRemark(i))
rsOrderForm.update
end if
next
set rsOrderForm=nothing
call WriteSuccessMsg("订单已经保存到我们的订单数据库中。我们将以最快的速度与你联系!
请记住你的订单号:" & OrderFormNum & "")
end sub
%>