Alfredomulet
MIS
Hello there,
I need to calculate the total amount (SUM(SALDO_ACTUAL)) of the accounts belonging to a customer obtained from a database after the customer's id is obtained from an input box.
What I would like to obtain is:
ACC NUMBER AMOUNT
123090912 125.00
468468664 100.00
TOTAL 225.00
Is it possible with ASP? If so, how do I calculate the total outside the loop so it won't be cleared each new account is added to the table? Will I need JavaScript? Thanks in advance for your replies.
my code looks like
I need to calculate the total amount (SUM(SALDO_ACTUAL)) of the accounts belonging to a customer obtained from a database after the customer's id is obtained from an input box.
What I would like to obtain is:
ACC NUMBER AMOUNT
123090912 125.00
468468664 100.00
TOTAL 225.00
Is it possible with ASP? If so, how do I calculate the total outside the loop so it won't be cleared each new account is added to the table? Will I need JavaScript? Thanks in advance for your replies.
my code looks like
Code:
<% 'crear objeto recordset
set rsProds=Server.CreateObject("ADODB.Recordset")
rowCount=0 %>
<form method="post" class ="cssazuL2"> <font size="1" face="Verdana">INTRODUCIR Nº DE CÉDULA</font>
<input name="fldSearch" size="16" style='font-family: Verdana; font-size: 7pt'> <input type="submit" size=64 value="Buscar">
</form>
<% if Request.Form("fldSearch")<>"" then
strSearch=Request("fldSearch") %>
<% 'especificar manejador de bases de datos
strProvider="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("lobo.mdb")
'define the search query
strQuery = "SELECT DATOS_BANCO.NAC_EXT AS NAC_EXT, DATOS_BANCO.CEDULA AS CEDULA, DATOS_BANCO.NOMBRES_BANCO AS NOMBRES_BANCO, DATOS_BANCO.TELEFONO1_BANCO AS TELEFONO1_BANCO, DATOS_BANCO.DIRECCION_BANCO AS DIRECCION_BANCO, DEUDOR_CUENTA.NRO_CUENTA AS NRO_CUENTA, DEUDOR_CUENTA.MORA AS MORA, DEUDOR_CUENTA.SALDO_ACTUAL AS SALDO_ACTUAL, DEUDOR_CUENTA.INTERESES AS INTERESES, DEUDOR_CUENTA.PRINCIPAL AS PRINCIPAL, DEUDOR_CUENTA.F_INGRESO AS ACTUALIZACION FROM DATOS_BANCO INNER JOIN DEUDOR_CUENTA ON DATOS_BANCO.CEDULA = DEUDOR_CUENTA.CEDULA WHERE DATOS_BANCO.CEDULA LIKE '" & strSearch & "'"
'open the search results recordset
rsProds.Open strQuery, strProvider, , , adCmdText
scriptregresar="deudoract.asp"
%>
.....
.....
<tr>
<% 'cycle thru the record set and display each row results
do until rsProds.EOF %>
<td width="100" SIZE=2><%= rsProds("NRO_CUENTA")%></td>
<td width="35" align=center><%= rsProds("MORA")%></td>
<td width="120" align=right><%= "Bs. " & formatnumber(rsProds("SALDO_ACTUAL"),2)%></td>
<td width="120"></td>
<td width="120"></td>
</tr>
<!-- next Row = next Record -->
<% rowCount = rowCount+1
'increment record position with MoveNext method
rsProds.MoveNext
loop
else %>
<td colspan="6" align="center" width="601"><h5>No se han encontrado resultados.</h5></td></tr>
<% end if %>