%
IDORDINE=SESSION("idORDINE")
IDvariante=request("IDvariante")
idprezzi=request("idprezzi")
IF (IDORDINE="") and (IDprezzi ="") then response.redirect"default.asp"
IF (IDORDINE="") and (IDprezzi <>"") then
set rs=cn.execute ("select * from nordine order by idordine desc")
session ("IDordine")=(rs("IDordine")+1)
session.timeout=500
idordine=session("idordine")
sessionid=session.sessionid
set rs1=cn.execute("insert into nordine (idordine,sessionid) values ("&IDordine&","&sessionid&") ")
end if
set rstot=cn.execute("select * from totale_ordine where idordine="&idordine&" ")
if idprezzi <>"" then
set rsp=cn.execute("select IDprodotto from prezzo where IDprezzi ="&IDprezzi&" ")
idprodotto=rsp("IDprodotto")
If idvariante ="" then
set rsvarCar=cn.execute ("select IDvariante from carrello_query where idprezzi="&IDprezzi&" and idordine="&IDordine&" ")
if rsvarCar.eof then
set rsvariante=cn.execute ("select IDvariante from varianti where idprezzi="&IDprezzi&" ")
if not rsvariante.eof then
response.redirect"scegli_variante.asp?IDprodotto="&IDprodotto&"&IDprezzi="&idprezzi&""
end if
end if
end if
set rs2=cn.execute("select * from carrello where idprezzi="&idprezzi&" and idordine="&idordine&" ")
if rs2.eof then
if idvariante="" then idvariante=0
set rs3=cn.execute ("insert into carrello (idprezzi, quantita,idordine,IDvariante) values ("&idprezzi&",1,"&idordine&","&IDvariante&" ) ")
end if
end if
idcarrello=request("IDcarrello")
quantita=request("quantita")
if quantita <>"" then
if quantita>0 then
idcarrello=request("idcarrello")
set rs4=cn.execute("update carrello set quantita="&quantita&" where idcarrello="&idcarrello&" ")
else
set rs5=cn.execute("delete from carrello where idcarrello="&idcarrello&" ")
set rs6=cn.execute("select idcarrello from carrello where idordine="&idordine&"")
if rs6.eof then idordine=""
end if
end if
elimina=request("elimina")
if lcase (elimina) ="si" then
set rs5=cn.execute("delete from carrello where idcarrello="&idcarrello&" ")
set rs6=cn.execute("select idcarrello from carrello where idordine="&idordine&"")
if rs6.eof then idordine=""
end if
%>
Situazione ordine
Carrello della Spesa <%=session("IDordine")%>
<% if IDordine<>"" then%>
Elimina
Prodotto
Quantità
Prezzo
Totale
<%
set rscarr=cn.execute("select * from prezzo_quantita where IDordine="&IDordine&" ")
do while not rscarr.eof
%>
<%rscarr.movenext
loop
%>
Totale ordine (IVA
compresa)
<%
if not rstot.eof then
totordine=rstot("totaleordine")
else
totordine=0
end if
%>
<%=formatnumber(totordine)%>