%@language=vbscript codepage=950 %>
<%
function getHouqiName(Houqistr)
if houqistr="" or Isnull(houqistr) then
getHouqiName=""
exit function
else
IdStr=split(Houqistr,",")
for j=0 to Ubound(IdStr)
HouqiId=HouqiId&split(IdStr(j),"|")(1)&","
next
getHouqiName=HouqiId
end if
end function
if Trim(session("cst_id"))="" or Trim(session("cst_id"))=null then
response.write ""
response.End()
end if
dim cst_id,produtID,mount,bmcl,hmjd,totalprice,Cst_orderid
cst_id = session("cst_id")
produtid = Trim(request("productID"))
mount = Trim(request("numb"))
stramout=request("Acount")
if not (stramout="" or Isnull(stramout)) then
Amount = split(stramout,"|")(1)
end if
bmcl = Trim(request("bmcl"))
hmjd = Trim(request("hmjd"))
ckbz=Trim(request("ck"))
totalprice = Trim(request("total"))
orderarea=Trim(request("area"))
houqiElement=Trim(request("houqiElement"))
flag=Request("flag")
typeStr=request("type")
response.Write Houqi
if flag="add" then
if session("OrderId")="" or Isnull(session("OrderId")) then
session("OrderId") = Trim(GetNextOrder_Id("","Cst_OrderTotal"))
strSql = "insert into Cst_OrderTotal(OrderID,Custom_Id) values('"&session("OrderId")&"','"&cst_id&"')"
conn.execute(strSql)
'response.Write strsql
' response.Write conn
' response.End()
end if
conn.beginTrans
strsql="select * from Cst_Order "
set rs=server.CreateObject("adodb.recordset")
rs.open strsql,conn,1,3
rs.addnew
IF len(session("OrderId"))>0 then
rs("orderid")=session("OrderId")
end if
IF len(orderarea)>0 then
rs("orderarea")=orderarea
end if
IF len(produtid)>0 then
rs("Product_id")=produtid
end if
if ckbz="1" then
rs("ckbz")="yes"
else
rs("ckbz")="no"
end if
IF len(mount)>0 then
rs("counts")=mount
end if
IF len(Amount)>0 then
rs("counts")=Amount
end if
IF len(bmcl)>0 then
rs("bmcl")=bmcl
end if
IF len(bmys)>0 then
rs("bmys")=bmys
end if
IF len(Trim(hmjd))>0 then
rs("hmjd")=hmjd
end if
IF len(Trim(totalprice))>0 then
rs("totalprice")=totalprice
end if
IF len(Trim(houqiElement))>0 then
rs("HouQi")=getHouqiName(houqiElement)
end if
IF len(Trim(typestr))>0 then
rs("TypeID")=typestr
end if
rs.update
rs.close()
If Err Then
Err.clear
conn.rollbackTrans
response.Write "Errors"
response.End()
Else
conn.CommitTrans
End if
response.Redirect("orderproduct_info.asp?orderid="&session("OrderId"))
end if
if flag="update" then
orderid=Trim(request("orderid"))
OrderParentId=Trim(request("OrderParentId"))
zuogao=Trim(request("zg"))
if ckbz="1" then
ckbz="yes"
else
ckbz="no"
end if
strsql="Update Cst_Order set hmjd='"&hmjd&"',bmcl='"&bmcl&"',ckbz='"&ckbz&"',counts="&mount&",totalprice="&totalprice&" where id="&orderid
conn.execute(strsql)
response.Redirect "orderproduct_info.asp?orderid="&OrderParentId
response.End()
end if
if flag="delete" then
orderid=Trim(request("orderid"))
poid = request("poid")
sqlstr="delete from Cst_Order where id="&orderid
conn.execute(sqlstr)
response.Write""
end if
%>
<%
conn.close
set conn=nothing
%>