170 messaggi dal 07 marzo 2004
Ho sviluppato una pagina per potere visualizzare una serie di ordini ed uso questo codice:


code:--------------------------------------------------------------------------------
<%
' ottiene l'elenco degli ordini dalla tabella ordini
sqlString = "Select ordini.*, prodotti.*, ordinidettaglio.* " &_
"FROM ordini, prodotti, ordinidettaglio " &_
"WHERE ordini_utenteID=" & userID & " " &_
"AND ordinidettaglio_ordineID= ordini_id " &_
"AND ordinidettaglio_prodottoID= prodotti_id " &_
"ORDER BY ordini_dataconferma DESC"
SET RS = Con.Execute( sqlString )
%>
<html>
<head><title>Account cliente</title></head>
<body>
<center>
<%
IF RS.EOF THEN
%>
<b>Non hai mai effettuato ordini sul nostro sito</b>
<%
ELSE
%>
<b>Ecco lo stato attuale di tutti i tuoi ordini</b><br><br>
<table width="760" cellpadding="1" cellspacing="0" bgcolor="lightblue" border="0">
<tr bgcolor="red">
<th width="10%" align="center">N° ordine</th>
<th width="12%" align="center">Cod. articolo</th>
<th width="40%" align="center">Nome prodotto</th>
<th align="center">Qtà</th>
<th align="center">Prezzo</th>
<th align="center">Subtotale</th>
</tr>
<%
WHILE NOT RS.EOF
prezzo_prodotto = RS( "ordinidettaglio_prezzoprodotto" )
prezzo_prodotto = replace(prezzo_prodotto, ".", ",")
suborder = prezzo_prodotto * RS( "ordinidettaglio_quantita" )
orderTotal = RS( "ordini_totalemerce" )
spesespedizione = RS( "ordini_spesespedizione" )
spesespedizione = replace(spesespedizione, ".", ",")
totgenerale = RS( "ordini_totalegenerale" )
tipopagamento = RS ( "ordini_tipopagamento" )
stato_ordine = showOrderStatus( RS( "ordini_stato" ), RS( "ordini_dataspedizione" ) )
%>
<tr>
<td width="10%" align="center">
<%=RS( "ordini_id" )%>
</td>
<td align="center" width="12%">
<%=RS( "prodotti_id" )%>
</td>
<td align="center" width="40%">
<%=RS( "prodotti_nome" )%>
</td>
<td align="center">
<%=RS( "ordinidettaglio_quantita" )%>
</td>
<td align="center">
? <%=FormatNumber(prezzo_prodotto,2)%>
</td>
<td align="center">
? <%=FormatNumber(suborder,2)%>
</td>
</tr>
<% rs.Movenext %>
<tr>
<td colspan="5" align="right" valign="bottom">
Totale merce
</td>
<td align="center">
___________<br>
? <%=FormatNumber(orderTotal,2)%>
</td>
</tr>
<tr>
<td colspan="5" align="right">
Spese spedizione
</td>
<td align="center">
? <%=FormatNumber(spesespedizione,2)%>
</td>
</tr>
<tr>
<td colspan="5" align="right">
<b>Totale generale</b>
</td>
<td align="center">
<b>? <%=FormatNumber(totgenerale,2)%></b>
</td>
</tr>
<tr>
<td colspan="5">
<b>Tipo di pagamento scelto:</b> <%=(tipopagamento)%><br>
<b>Stato dell'ordine:</b> <%=(stato_ordine)%>
</td>
</tr>
<tr>
<td bgcolor="white" colspan="6">

</td>
</tr>
<% WEND %>
</table>
<% END IF %>
<p>
<form action="default.asp">
<input type="submit" value="Vai alla homepage">
</form>
</center>
</body>
--------------------------------------------------------------------------------


Il mio problema riguarda il fatto che come ho impostato il codice mi visualizza tutti i record indipendentemente e dopo ogni record visualizzo il subtotale+spese+totgenerale, mentre io vorrei raggrupparli, come ovvio deve essere, con subtotale+spese+totgenerale solo alla fine di ogni ordine (anche se esso possiede più articoli).

Mi aiutate a sistemare?
Ciao e grazie mille!

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.