Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/02/2011, 08:40
alcisma
 
Fecha de Ingreso: marzo-2009
Mensajes: 26
Antigüedad: 15 años, 1 mes
Puntos: 0
Redondear numero

Buen dia,

Estoy intentando redondear un numero que tomo de la base de datos, pero me sale un error.

Este es el codigo :

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,java.util.*" errorPage="" %>
<%@include file="../usuarios/eliminar_cache.jsp"%>
<%@include file="../usuarios/verificar_autenticacion.jsp"%>
<jsp:useBean id="con" class="BaseDatos.Conexion"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Reporte Fecha <%=request.getParameter("fecha")%></title>
<link href="../css/situct.css" rel="stylesheet" type="text/css" />
</head>
<center>
<body>
<table width="800" class="color_tabla_reporte">
<tr>
<th class="titulo_reporte_negro">INGRESOS TASA DE USO
</table>
<table width="800" class="color_tabla_reporte">
<tr align="left">
<form name="formulario" id="formulario" method="post" action="../reportes/fecha.jsp">
<input name="fecha" id="fecha" value="<%=request.getParameter("fecha")%>" type="hidden"/>
<input name="empresas" id="empresas" value="si" type="hidden"/>
</form>
<th colspan="6" class="titulo_reporte_negro">FECHA: <%=request.getParameter("fecha")%>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="salir" id="salir" type="button" value="Salir" onclick="document.formulario.submit();"/>
</th>
<tr>
<th>
</th>
</table>

<table width="800" cellpadding="0" cellspacing="0" border="1" bordercolor="#000000" class="color_tabla_reporte">
<tr class="titulo_casilla_reporte" align="center">
<td width="200">EMPRESAS </td>
<td width="100">TOTAL</td>
<td width="100">ALCOHOL </td>
<td width="100">20 %</td>
<td width="100">80 %</td>
<td width="100">TRANSITO</td>
<td width="100">ORIGEN</td>

<%


int total = 0;
int prueba = 0;
float pru = 0;
float pru2 = 0;
float por = 1;
float por2 = 1;
float porcentaje = 0;
float porcentaje2 =0;
int transito = 0;
int origen = 0;
ResultSet rs = con.consultar("select distinct nom_empresa from turno t inner join tasa_uso tu on t.id_turno=tu.id_turno where fecha='"+request.getParameter("fecha")+"' and placa!='ANULADO' order by nom_empresa");
while(rs.next())
{
ResultSet sume = con.consultar("select sum(tasa_origen) as origen,sum(tasa_prueba) as prueba,sum(tasa_transito) as transito,sum(tasa_origen)+sum(tasa_prueba)+sum(tas a_transito) as total from turno t inner join tasa_uso tu on t.id_turno=tu.id_turno where fecha='"+request.getParameter("fecha")+"' and nom_empresa='"+rs.getString("nom_empresa")+"'");
sume.first();
total+=sume.getInt("total");
prueba+=sume.getInt("prueba");
porcentaje+=sume.getInt("prueba")*0.20;
porcentaje2+=sume.getInt("prueba")*0.80;
transito+=sume.getInt ("transito");
origen+=sume.getInt("origen");
%>

<tr class="titulo_casilla_reportes" align="center">
<td height="27" align="left"><%=rs.getString("nom_empresa")%></td>
<td align="right">$<%=sume.getInt("total")%></td>
<td align="right">$<%=sume.getInt("prueba")%></td>
<%
pru = 1;
pru*=sume.getInt("prueba")*0.20;
%>

<%
long v1 = 0;
String numero = null;
numero = request.getParameter("pru");
if ((numero != null)&&(numero != "")) { v1 = Math.round(Double.parseDouble(pru)); }
%>
<td align="right">$<%=v1%></td>
<%
pru2 = 1;
pru2*=sume.getInt("prueba")*0.80;
%>

<%
long v2 = 0;
String numero2 = null;
numero2 = request.getParameter("pru2");
if ((numero2 != null)&&(numero2 != "")) { v2 = Math.round(Double.parseDouble(pru2)); }
%>
<td align="right">$<%=v2%></td>
<td align="right">$<%=sume.getInt("transito")%></td>
<td align="right">$<%=sume.getInt("origen")%></td>
<%
sume.close();
}
rs.close();
%>
<tr class="titulo_casilla_reporte" align="center">
<td align="center" class="titulo_reporte_negro">TOTALES</td>
<td class = "titulo_reporte_negro" align="center">$<%=total%></td>
<td class = "titulo_reporte_negro" align="center">$<%=prueba%></td>
<%por*=porcentaje;%>
<td class = "titulo_reporte_negro" align="center">$<%=por%></td>
<%por2*=porcentaje2;%>
<td class = "titulo_reporte_negro" align="center">$<%=por2%></td>
<td class = "titulo_reporte_negro" align="center">$<%=transito%></td>
<td class = "titulo_reporte_negro" align="center">$<%=origen%></td>
<tr class="titulo_casilla_reporte" align="center">
</table>


<%
con.cerrar();
%>
</body>
</center>
</html>


y el error que me sale es el siguiente:

Ha tenido lugar un error en la línea: 90 en el archivo jsp: /reportes/reporte_relacion_ingresos.jsp
Error de servlet generado:
The method parseDouble(String) in the type Double is not applicable for the arguments (double)


QUIEN ME PUEDE AYUDAR POR FAVOR ESTOY EN PROBLEMA.

Y me pasa por que nunca he trabajado con este lenguaje