Commit 7c3b5c91 authored by kshinde's avatar kshinde

Added rounding method to prevent precision loss while validating amount.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106675 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d02e3d0d
...@@ -589,7 +589,12 @@ conn = getConnection(); ...@@ -589,7 +589,12 @@ conn = getConnection();
pstmt = null; pstmt = null;
} }
} }
if(((billAmt +taxAmt) != totAmt) || ((totAmt+advAmt) != netAmt)) /*if(((billAmt +taxAmt) != totAmt) || ((totAmt+advAmt) != netAmt))
{
errString = itmDBAccessEJB.getErrorString("","VTAMTMIS","","",conn); // amount mismatch
return errString;
}*/
if((roundVal((billAmt+taxAmt), 3) != roundVal((totAmt), 3)) || ((roundVal((totAmt+advAmt), 3) != roundVal((totAmt), 3))))
{ {
errString = itmDBAccessEJB.getErrorString("","VTAMTMIS","","",conn); // amount mismatch errString = itmDBAccessEJB.getErrorString("","VTAMTMIS","","",conn); // amount mismatch
return errString; return errString;
...@@ -3923,5 +3928,9 @@ conn = getConnection(); ...@@ -3923,5 +3928,9 @@ conn = getConnection();
System.out.println(""); System.out.println("");
return arry1 ; return arry1 ;
} }
private static double roundVal(double round, int scale)
{
return Math.round(round * Math.pow(10, scale)) / Math.pow(10, scale);
}
} //class } //class
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment