|
|
<%
Contrassegno = "True"
'---Dichiarazione variabili
Dim SQLOrdine, RSOrdine, QSMancanoProdotti, QSPagamento, QSNote, QSNMancanti, I, QSID, QSQuantita, StrArrID, StrArrQuantita, ArrID, ArrQuantita, MancaProdotto, QuantitaIniziale, SommaPuntiSconto, Totale, Contrassegno, FlagCarrelloVuoto, PrezzoProdottoEuro, SpeseSpedizioneSomma, QuantitaTotale, SpeseSpedizione, SpeseSpedizioneCorriere, IvaTotale, QuotaFissaSpedizione
'---Recupero dal database i prodotti nel carrello per questa sessione
SQLOrdine = " SELECT * FROM Carrello WHERE IDSessione = '"& SessionID &"' "
Set RSOrdine = Conn.Execute(SQLOrdine)
'---Recupero il tipo di pagamento e le note, nel caso in cui l'ordine non è andato a buon fine
QSMancanoProdotti = Request.QueryString("mancanoprodotti")
If LCase(QSMancanoProdotti) = "true" Then
QSPagamento = Request.QueryString("pagamento")
QSNote = Request.QueryString("note")
QSNMancanti = CLng(Request.QueryString("nmancanti"))
For I = 1 To QSNMancanti
QSID = Request.QueryString("ID" & I)
QSQuantita = Request.QueryString("quantita" & I)
StrArrID = StrArrID & "," & QSID
StrArrQuantita = StrArrQuantita & "," & QSQuantita
Next
ArrID = Split(StrArrID, ",")
ArrQuantita = Split(StrArrQuantita, ",")
End If
%>
|
<%
If LCase(QSMancanoProdotti) <> "true" Then
Response.Write Head_Carrello
Else
Response.Write Head_Carrello_Mancano_Prodotti
End If
%>
|
|
<%=Prodotti%>
|
<%
If Session("Rivenditore") Then
Response.Write TitoloRPrezzo
Else
Response.Write TitoloCPrezzo
End If
%>
|
<%=Titolo_Quantita%>
|
<%=Azioni_Carrello%>
|
<%
'---Recupero i dati sui prodotti nel carrello
SommaPuntiSconto = 0
SpeseSpedizioneSomma = 0
IvaTotale = 0
If Not RSOrdine.EoF Then
FlagCarrelloVuoto = False
RSOrdine.MoveFirst
Do While Not RSOrdine.EOF
MancaProdotto = False
If LCase(QSMancanoProdotti) = "true" Then
For I = 1 To Ubound(ArrID, 1)
If CLng(ArrID(I)) = RSOrdine("IDProdotto") Then
MancaProdotto = True
QuantitaIniziale = CLng(ArrQuantita(I))
End If
Next
End If
'---Gestione tipologia prodotto
If RSOrdine("IDTipologia") <> 0 Then
SQLTipologie = " SELECT Tipologia FROM Tipologie WHERE ID = " & RSOrdine("IDTipologia")
Set RSTipologie = Conn.Execute(SQLTipologie)
CartTipologia = RSTipologie("Tipologia")
Else
CartTipologia = ""
End If
'---Gestione punti sconto e spedizione
SommaPuntiSconto = UtilizzaPrezzo(SommaPuntiSconto) + (UtilizzaPrezzo(RSOrdine("PuntiScontoMax")) * RSOrdine("Quantita"))
If RSOrdine("Spedizione") = False Then
Contrassegno = "False"
End If
%>
<%
'---Calcolo le spese di spedizione
If RSOrdine("Spedizione") Then
SpeseSpedizioneSomma = SpeseSpedizioneSomma + UtilizzaPrezzo(RSOrdine("SpeseSpedizione")) * RSOrdine("Quantita")
QuantitaTotale = QuantitaTotale + RSOrdine("Quantita")
End If
'---Gestione sconto quantità
SQLSconti = " SELECT Sconto FROM Sconti WHERE IDProdotto = " & RSOrdine("IDProdotto") & " AND Quantita <= " & RSOrdine("Quantita") & " ORDER BY Sconto DESC "
Set RSSconti = Conn.Execute(SQLSconti)
If Not RSSconti.EOF Then
PrezzoTotaleProdotto = PrezzoTotaleProdotto - ((PrezzoTotaleProdotto / 100) * RSSconti("Sconto"))
End If
'--- Calcolo l'iva se rivenditore aggiungo l'iva altrimenti iva inclusa
If Session("Rivenditore") Then
IvaTotale = IvaTotale + (PrezzoTotaleProdotto / 100 * RSOrdine("IVA"))
Else
IvaTotale = 0
End If
Totale = Totale + PrezzoTotaleProdotto
RSOrdine.MoveNext
Loop
Else
'---Carrello vuoto
FlagCarrelloVuoto = True
Totale = 0
%>
|
<%=CarrelloVuoto%>
|
<%
End If
%>
|
|
|
<%=ImportoProdotti%>:
|
<%=SimboloValuta%> <%=VisualizzaPrezzo(Totale)%>
<% If Session("Rivenditore") Then%><%=IvaNonCompresaBreve%> <%Else%><%=IvaInclusa%> <% End If %>
|
|
|
|
<%
'--- Gestisco le spese di Spedizione in funzione del peso equivalente inteso come spese di spedizione
SpeseSpedizioneCorriere = CalcoloSpeseSpedizione(SpeseSpedizioneSomma, QuantitaTotale)
If Totale - IvaTotale < 150 then
QuotaFissaSpedizione = 1200
else
QuotaFissaSpedizione = 1600
End If
if SpeseSpedizioneCorriere > 950 then
SpeseSpedizione = (SpeseSpedizioneCorriere * 0.5 + QuotaFissaSpedizione)
else
if SpeseSpedizioneCorriere = 0 then
SpeseSpedizione = 0
else
SpeseSpedizione = QuotaFissaSpedizione
End If
End If
Totale = Totale + SpeseSpedizione
%>
|
<%=TitoloSpeseSpedizione%>:
|
<%=SimboloValuta%> <%=VisualizzaPrezzo(SpeseSpedizione)%> <%=IvaInclusa%>
|
Consegna fino a 30 Kg: Poste Italiane Servizio: Pacco Celere 3. Se il valore della spedizione supera i 150,00 € si spedisce in assicurata. |
|
<%=SpesaTotale%>:
|
<%=SimboloValuta%> <%=VisualizzaPrezzo(Totale + IvaTotale)%> <%=IvaInclusa%>
|
|
<%
If Session("Collegato") Then
If Not FlagCarrelloVuoto Then
%>
<%=Ordina%>
<%
End If
Else
%>
<%=OrdineNoLogin%>
<%
End If
%>
|
|
|