Hi Guys,
I displaying report for work wise progress in
jsp. At end of line i calculating
total amount of Contract . In my result it is displaying 477.74999999994. For reference you can see attached screen shot file. But i want result in this format 477.74
(i dont want to be round off).
below code is report jsp page:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
import="java.sql.*"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<bean:define id="reportModel" name="JSPView"
type="in.gov.mrc.kstd.business.ReportModel" />
<%@page import="in.gov.mrc.kstd.business.WorkwiseProgressReport"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Workwise Progress Report</title>
</head>
<script language="javascript">
function fnFetchData()
{
document.WorkDetailForm.action="/CMSMTDP/generateWorkwiseProgressReport.do?dispatch=workwiseProgressReport";
document.WorkDetailForm.submit();
}
function fnClose()
{
document.location.href="/CMSMTDP/close.do";
}
function fnExport()
{
document.location.href = "/CMSMTDP/export-excel.do?tilesPath=.mrc.exportWorkwiseProgressReport";
}
</script>
<body bgcolor="FFFFCC">
<html:form action="/generateWorkwiseProgressReport.do" method="post">
<table border="0" cellpadding="2" align="center" >
<tr>
<td colspan="7" align="center" class="reportcolumnheader">Town:<html:select property="ulb.ulbId" name = "reportModel" onchange="fnFetchData()">
<logic:notEmpty property = "ulbList" name = "reportModel">
<html:option value="-2">Select</html:option>
<html:option value="-1">All</html:option>
<bean:define id="ulbLst" property="ulbList" name="reportModel"/>
<html:options collection ="ulbLst" property="ulbId" labelProperty="ulbName"/>
</logic:notEmpty>
</html:select> </td>
</tr>
</table>
<logic:equal property="showReportFlag" name="reportModel" value="true">
<table border="1" cellpadding="2" align="center" >
<tr>
<td colspan="13" align="center" class="reportcolumnheader">Workwise Progress Report</td>
</tr>
<tr>
<td colspan="13" align="right" height="5px">
<span style="font-size:10px;font-weight: bold">Rs in Lakhs</span>
</td>
</tr>
<tr>
<td class="reportcolumnheader">S.No</td>
<td class="reportcolumnheader">Town Name</td>
<td class="reportcolumnheader">SectorName</td>
<td class="reportcolumnheader">Package</td>
<td class="reportcolumnheader">Work Code</td>
<td class="reportcolumnheader">WorkName</td>
<td class="reportcolumnheader">Contractor/Entrusted Agency Name</td>
<td class="reportcolumnheader" width="70px">Commencement Date </td>
<td class="reportcolumnheader" width="70px">Target Date</td>
<td class="reportcolumnheader">Work Completion Date</td>
<td class="reportcolumnheader">Contract Amount</td>
<td class="reportcolumnheader">Estimate Cost</td>
<td class="reportcolumnheader">Expenditure Cost</td>
</tr>
<logic:empty property="workwiseProgressReportList" name="reportModel">
<tr ><td colspan="13" align="center" ><span style="font-size:10px;font-weight: bold">No records found</span></td></tr>
</logic:empty>
<%
double contractAmountTotal=0;
double estimateCostTotal=0;
double expenditureCostTotal=0;
int sNo=0;
%>
<logic:notEmpty property="workwiseProgressReportList" name="reportModel">
<logic:iterate id="workwiseProgressReport" property="workwiseProgressReportList" name="reportModel">
<tr>
<%
WorkwiseProgressReport work=(WorkwiseProgressReport) workwiseProgressReport;
int grouper=work.getUlbGroup();
int sectorGroup=work.getSectorGroup();
contractAmountTotal=contractAmountTotal+work.getContractAmount();
estimateCostTotal=estimateCostTotal+work.getEstimateCost();
expenditureCostTotal=expenditureCostTotal+work.getExpenditureCost();
sNo++;
%>
<td class="reportcolumnLabel"><%=sNo %></td>
<td class="reportcolumnLabel"><bean:write property="ulbName" name="workwiseProgressReport"/></td>
<td class="reportcolumnLabel"><bean:write property="sectorName" name="workwiseProgressReport"/></td>
<td class="reportcolumnLabel"><bean:write property="packageCode" name="workwiseProgressReport"/></td>
<%
String workCodeStr=work.getSectorCode()+"/"+work.getPackageCode()+"/"+work.getWorkCode();
%>
<td class="reportcolumnLabel"><%=workCodeStr %></td>
<td class="reportcolumnLabel"><bean:write property="workName" name="workwiseProgressReport"/></td>
<td class="reportcolumnNumber"><bean:write property="contractorentrustedagencyName" name="workwiseProgressReport"/> </td>
<td class="reportcolumnLabel"><bean:write property="commencementDate" name="workwiseProgressReport"/> </td>
<td class="reportcolumnLabel"><bean:write property="targetDate" name="workwiseProgressReport"/> </td>
<td class="reportcolumnNumber"><bean:write property="workCompDate" name="workwiseProgressReport"/> </td>
<td class="reportcolumnNumber"><bean:write property="contractAmount" name="workwiseProgressReport"/> </td>
<td class="reportcolumnNumber"><bean:write property="estimateCost" name="workwiseProgressReport"/> </td>
<td class="reportcolumnNumber"><bean:write property="expenditureCost" name="workwiseProgressReport"/> </td>
</tr>
</logic:iterate>
<tr>
<td colspan="10" align="right" class="reportcolumnheaderRight">Total:</td>
<td class="reportcolumnheaderRight" align="right"><%=contractAmountTotal %></td>
<td class="reportcolumnheaderRight" align="right"><%=estimateCostTotal %></td>
<td class="reportcolumnheaderRight" align="right"><%=expenditureCostTotal %></td>
</tr>
</logic:notEmpty>
</table>
<table align="center" border="0" >
<tr><td colspan="14" align="center"><input type="button" value="Close" class="button" onclick="fnClose()"/>
<input type="button" value="Save As Excel" class="button" onclick="fnExport()"/></td>
</tr>
</table>
</logic:equal>
</html:form>
</body>
</html>
Please help me & need code for that