ciao a tutti, ho il seguente problema:
ho una tabella del db chiamata record dove vado a popolarla con i vari dati però poi, quando faccio una query di estrazione dei dati in base ad un intervallo di tempo (tra due date), dovrei effettuare il totale della colonna dove sono presenti tutti i vari totali delle voci presenti nella fattura; chi mi sa ad aiutare?. Posto il codice totale della visualizzazione della query intervallo date:
report_date.asp
<html>
<head>
<title>Visualizza Periodo di Fattura</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#bbbbFF" text="#000000">
<center>
<p align="center"></p>
<form name="form1" method="post" action="">
<table border="0" width="400">
<tr bgcolor="#FF9966">
<td width="8%">
<center>
<font color="#000000">Data:</font>
</center>
</td>
<td width="15%">
<center>
<font color="#000000">Codice Articolo:</font>
</center>
</td>
<td width="14%">
<center>
<font color="#000000">Prezzo Singolo:</font>
</center>
</td>
<td width="14%">
<center>
<font color="#000000">Numero di Pezzi:</font>
</center>
</td>
<td width="7%">
<center>
<font color="#000000">Iva:</font>
</center>
</td>
<td width="19%">
<center>
<font color="#000000">Totale:</font>
</center>
</td>
<%
Dim rsReport__MMColParam
rsReport__MMColParam = "1"
If (Request.QueryString("dataRegistrazione") <> "") Then
rsReport__MMColParam = Request.QueryString("dataRegistrazione")
End If
%>
<%
dataInizio = month(Request.QueryString("dataInizio")) & "/" & day(Request.QueryString("dataInizio")) & "/" & year(Request.QueryString("dataInizio"))
dataFine = month(Request.QueryString("dataFine")) & "/" & day(Request.QueryString("dataFine")) & "/" & year(Request.QueryString("dataFine"))
dim strCode
strCode="innovatel"
dim intVolta
intVolta="0"
Set Conn=Server.CreateObject("ADODB.Connection")
strConn="driver={Microsoft Access Driver (*.mdb)}; "
strConn=strConn & " DBQ=" & Server.MapPath("db.mdb")
strConn=strConn & ";pwd=" & strCode
Conn.Open strConn
sql = "SELECT * FROM report WHERE (dataRegistrazione BETWEEN #"&dataInizio&"# And #"&dataFine&"#) ORDER BY articolo ASC"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn ,3,3
do while not(rs.eof)
if intVolta="1" then
intVolta="0"
intTesto="#000000"
intSfondo="#ffccff"
else
intVolta="1"
intTesto="#000000"
intSfondo="#ccccff"
end if
%>
<tr bgcolor="<%=intSfondo%>">
<td width="8%">
<input type="text" name="textfield" value="<%=rs(1)%>">
</td>
<td width="15%">
<input type="text" name="textfield2" value="<%=rs(2)%>">
</td>
<td width="14%">
<input type="text" name="textfield4" value="<%=rs(3)%>">
</td>
<td width="14%">
<input type="text" name="textfield5" value="<%=rs(4)%>">
</td>
<td width="7%">
<input type="text" name="textfield6" value="<%=rs(5)%> %">
</td>
<td width="19%">
<input type="text" name="textfield7" value="<%=rs(6)%>">
</td>
</tr>
<%
rs.movenext
loop
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
%>
</table>
</form>
</p>
</p>
<a href="javascript:;"onClick="javascript:window.clos e()">
<input type="button" name="Chiudi" value="Chiudi Pagina">
</a>
</p>
</center>
</body>
</html>
questa è la form dove di inserimento.
<form action="report_Date.asp" method="get" name="data" target="_self" id="data">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="110" class="testo">Data iniziale </td>
<td width="290" class="testo"><label>
<input name="dataInizio" type="text" class="testo" id="dataInizio" size="20" />
Formato data: gg/mm/aaaa
</label></td>
</tr>
<tr>
<td colspan="2" class="testo">[img]immagini/null.gif[/img]</td>
</tr>
<tr>
<td class="testo">Data finale </td>
<td class="testo"><input name="dataFine" type="text" class="testo" id="dataFine" size="20" />
Formato data: gg/mm/aaaa </td>
</tr>
<tr>
<td colspan="2" class="testo">[img]immagini/null.gif[/img]</td>
</tr>
<tr>
<td colspan="2" align="center" class="testo"><input name="button22" type="submit" class="testo" value="Cerca" /></td>
</tr>
</table>
</form>
Come faccio e dove metto il calcolo della somma?
aspetto con ansia aiuti...
Grazie e a presto

Rispondi quotando
