Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Javascrip Sum Item and control out put to two decimal point.

Kanaiya SindhavadFeb 3 2012 — edited Feb 3 2012
My que. is related to javascrip for sum item and control out put to two decimal point

Sum the Tax Amount Item I use following javascrip code in HTML Header

function sumst()
{
function getVal(item){
if($x(item).value != "")
return parseFloat($x(item).value);
else
return 0;
}
$x('P25_TAX_AMT').value = Math.round(
(getVal('P25_TXBL_AMT') * getVal('P25_STP')/100 ));


}


Result is in Round off


Or


function sumst()
{
function getVal(item){
if($x(item).value != "")
return parseFloat($x(item).value);
else
return 0;
}
$x('P25_TAX_AMT').value =
(getVal('P25_TXBL_AMT') * getVal('P25_STP')/100 );


}


Result in more then three decimal point


My Net Amount is 98089.80
Tax Rate 4 %
Tax Amount 3924 when I use Math.round
or
if I not use Math.round the tax Amount is 3923.592

I won't result 3923.59 ?

What Change i have to do in my javascript to get above result i.e. 3923.59

My current ver of apex is 3.2
This post has been answered by Sashio on Feb 3 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 2 2012
Added on Feb 3 2012
2 comments
262 views