
24/08/2007, 01:17
|
| | Fecha de Ingreso: septiembre-2004
Mensajes: 76
Antigüedad: 20 años, 7 meses Puntos: 0 | |
Re: Problemas Al Sumar Con Valores Null os pongo el codigo para que se pueda entender un poco mejor
Consulta
sqlText = "select productos.productID, productos.catalogName, productos.referncia, productos.color01, productos.txttalla01, productos.txttalla01a, productos.txttalla01b, productos.color02, productos.txttalla02, productos.txttalla02a, productos.txttalla02b, productos.color03, productos.txttalla03, productos.txttalla03a, productos.txttalla03b, productos.color04, productos.txttalla04, productos.txttalla04a, productos.txttalla04b, " _
& "precio, quantity, quantity2, quantity3, quantity4, from productos, " _
& "detalle_pedido where " _
& "productos.productID = detalle_pedido.ProductID "_
& "and detalle_pedido.orderID = " & intOrderID
<%
set rsReview = Conn.Execute(sqlText)
while not rsReview.EOF
intProdID = rsReview("productID")
strRefer = rsReview("REFERNCIA")
strProdName = rsReview("catalogName")
strTalla1 = rsReview("txttalla01")
strTalla1a = rsReview("txttalla01a")
strTalla1b = rsReview("txttalla01b")
strTalla2 = rsReview("txttalla02")
strTalla2a = rsReview("txttalla02a")
strTalla2b = rsReview("txttalla02b")
strTalla3 = rsReview("txttalla03")
strTalla3a = rsReview("txttalla03a")
strTalla3b = rsReview("txttalla03b")
strTalla4 = rsReview("txttalla04")
strTalla4a = rsReview("txttalla04a")
strTalla4b = rsReview("txttalla04b")
strcolor1 = rsReview("color01")
strcolor2 = rsReview("color02")
strcolor3 = rsReview("color03")
strcolor4 = rsReview("color04")
intProdPrice = rsReview("precio")
intQuant = rsReview("quantity")
intQuant2 = rsReview("quantity2")
intQuant3 = rsReview("quantity3")
intQuant4 = rsReview("quantity4")
intTotal =intTotal + (intQuant * intProdPrice)+ (intQuant2 * intProdPrice)+ (intQuant3 * intProdPrice)+ (intQuant4 * intProdPrice)
<%if intQuant >0 then%>
<tr>
<td width="7%" valign="center" align="left"><div align="center" class="Estilo18"><font face="Arial" size="2">
<input name="quant<%= intProdID %>" size="3" value=" <%=intQuant%>" onChange="HandleError(this)">
</font></div></td>
<td width="8%" align="left"><div align="center" class="Estilo18"><font face="ARIAL" size="2"> <%= strRefer %> </font></div></td>
<td width="23%" align="left"><div align="center" class="Estilo18"><font face="ARIAL" size="2"> <%= strProdName %></font></div></td>
<td width="15%" align="left"><div align="center" class="Estilo18"><font face="ARIAL" size="2"> <%= strTalla1 %></font></div></td>
<td width="18%" align="left"><div align="center" class="Estilo18"><font face="ARIAL" size="2"> <%= strcolor1 %></font></div></td>
<td width="15%" align="right"><span class="Estilo18"><font face="Arial" size="2"><%= formatNumber(intProdPrice, 2) %> €</font></span></td>
<td width="14%" align="right"><span class="Estilo18"><font face="Arial" size="2"><%= formatNumber((intQuant * intProdPrice), 2) %> € </font></span></td>
</tr>
<% end if%>
y asi con las 4 intQuant4, es para q me muestre los mayores de cero.
<%
rsReview.MoveNext
wend
rsReview.Close
set rsReview = Nothing
%>
Y ASI CON LAS 5, PERO EN ALGUNAS CANTIDADES NO TIENE VALOR ES DECIR UN NULL
LO Q NECESITO QUE ME HAGA ES EL SUMAR TODO INTTOTAL
<td><div align="center" class="Estilo18"><strong><%= formatNumber(INTTOTAL,2) %> € </strong></div></td>
Lo q hago q es si una cantidad no tiene valor no me lo muestre y no me lo sume pero lo q no me sale es el subtotal (intTotal) q aqui me hace la suma de todo. Si en vez de poner valor null le pongo 0 funciona perfectamente pero luego es un jale con la consulta pq me salen las cantidades a 0
GRACIAS A TODOS |