Feature rounded with 2 decimal Point in JAVA Sciprt

Hello

I calculate using java script.
I need the round function in JAVA script.

My code is
<script type="text/javascript">
     function getVal(pNd){
          return ($v(pNd)!= "")?parseFloat($v(pNd)):0;
     }
     function grossamt(){
        $s('P2_GROSS_AMT',getVal('P2_TAX_ON_AMT')-(getVal('P2_TAX_ON_AMT')*getVal('P2_TAX'))/100);
$s('P2_GROSS_AMT_1',getVal('P2_TAX_ON_AMT')-(getVal('P2_TAX_ON_AMT')*getVal('P2_TAX'))/100);
$s('P2_TAX_AMT',(getVal('P2_TAX_ON_AMT')*getVal('P2_TAX'))/100);
$s('P2_TAX_AMT_1',(getVal('P2_TAX_ON_AMT')*getVal('P2_TAX'))/100);
$s('P2_NET_AMOUNT',getVal('P2_GROSS_AMT')+getVal('P2_TAX_AMT'));
$s('P2_NET_AMT_1',getVal('P2_GROSS_AMT_1')+getVal('P2_TAX_AMT_1'));     }
</script>
How to apply the function round with 2 decimal Point
 $s('P2_GROSS_AMT',getVal('P2_TAX_ON_AMT')-(getVal('P2_TAX_ON_AMT')*getVal('P2_TAX'))/100);
How to get to Funtion in JAva script.

Thank you

Published by: Sophie on April 19, 2011 02:08

It would be more readable if you create a variable and do

var  x = Your complex formula to get the value

   x = Math.round( x * 100)/100;

Kind regards
Shijesh

Tags: Database

Similar Questions

  • Application with a decimal Point ID

    Hello

    We are in the process of migration of applications in an environment on APEX 3.01 to a new APEX 3.20 environment.

    On our environment old we had used decimals in our application ID i.e 100.1, 200.1 etc., this means we could keep all of our applications quite organized for example 100.x apps would be apps DEV, 200.x would be to TEST applications and 300.x would be PREPRODUCTION apps etc.

    When I got to install these applications in the new environment I get the following error message

    ORA-20001: GET_BLOCK error. ORA-20001: Execution of the statement was not successful. ORA-20001: digital invalid value 100.1 for the column ID of Application & lt; pre & gt; begin wwv_flow_api.create_flow (p_id = & amp; gt; 100.1, p_display_id = & amp; gt; 100.1, p_owner = & amp; gt;) "CS_APEX_DEV", p_name = & amp; GT; '* SSO Login', p_alias = & amp; GT; "SSO_DEV", p_page_view_logging = & amp; GT; 'YES', p_default_page_template = & amp; GT; 14915307666594361731 + wwv_flow_api.g_id_offset, p_printer_friendly_template = & amp; g

    I also get a invalid similar digital value error message when I try to manually create an application with a decimal point in the ID of the Application.

    Is this something that is no longer allowed withiin APEX or y at - it a parrameter which can be changed this will allow?

    Ian was soon

    Apex uses decimal notation to designate the translated versions of the application. I can't tell what dynamic translation of version was introduced, but it could be that you are running in. It seems you no more will be able to include a comma in your application ID.

  • Generate a random number with a decimal point

    I searched all over the internet and cannot find how to generate a random number that had a decimal.

    I'm trying to randomly generate numbers between 12.0 and 13.0.

    Here is my code... I know its bad because of Math.round and Math.random, but I can't seem to find something that deals with a decimal...

    addEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler_1);

    function fl_EnterFrameHandler_1(event:Event):void
    {
    Volt.Text = Math.round (Math.random () * (1) + 12) m:System.NET.SocketAddress.ToString ();
    }

    Any suggestions?

    -Pat

    Try this,

    addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler_1);
    
    function fl_EnterFrameHandler_1(event:Event):void
    {
    
         var rndNum:Number = int(Math.random()*10)/10; // Generate random num with 1 decimal place
         var newVal:Number = newVal + 12;
         volt.text = newVal.toString();
    }
    

    If you want 2 decimal places then replace the 10 per 100.

  • Showing results with one decimal two. Force the decimal.

    Hello

    Im a simple computing of writing device.

    You enter a digit, press one of the two buttons to multiply by a number, and then the result is displayed. The result is copied hide the result from the button you press on and visa versa.

    I'm having a problem to display the result with a decimal point two constant.

    I'm using strings and so do not know how to do this.

    Here is my code:

    import flash.events.MouseEvent;

    restrict entry to only numbers textfield

    txtInput.Restrict = "0-9";

    restrict the input textfield only a two-digit

    txtinput.maxChars = 6;

    event listeners

    btnW.addEventListener (MouseEvent.CLICK, WHandler);

    btnC.addEventListener (MouseEvent.CLICK, CHandler);

    btnW.addEventListener (MouseEvent.CLICK, hideC);

    btnC.addEventListener (MouseEvent.CLICK, hideW);

    functions

    function WHandler (e:MouseEvent): void

    {

    calculation of white

    var answerW:Number = Number (txtinput.text) * Number (0.90);

    txtWResult.text = answerW.toString ();

    }

    function of CHandler (e:MouseEvent): void

    {

    calculation of the color

    var answerC:Number = Number (txtinput.text) * Number (0.99).

    txtCResult.text = answerC.toString ();

    }

    function hideC (e:MouseEvent): void

    {

    Hide the result color

    txtCResult.visible = false;

    txtWResult.visible = true;

    }

    function hideW (e:MouseEvent): void

    {

    Hide the white result

    txtWResult.visible = false;

    txtCResult.visible = true;

    }

    After having had a look online I found these two resources:

    http://helpx.Adobe.com/Flash/KB/rounding-specific-decimal-places-Flash.html

    and

    http://StackOverflow.com/questions/11469321/decimals-to-one-decimal-place-in-AS3

    But I'm confused when combining these techniques with ropes.

    Any help would be greatly appreciated,

    Thanks in advance

    Mr B

    Use the toFixed() class number instead of the toString() method.  The result is a string that contains the number of decimal places you specify.

    var answerW:Number = Number (txtinput.text) * Number (0.90);

    txtWResult.text = answerW.toFixed (2);

    var answerC:Number = Number (txtinput.text) * Number (0.99).

    txtCResult.text = answerC.toFixed (2);

  • 0 and the decimal point in Oracle SQL

    Hello


    IM using Oracle Sql developer 'Oracle Database 11g Enterprise Edition Release 11.1.0.6.0' (I'm fairly new), im having trouble inserting '0 before 1' in the table, as well as with the decimal point
    I created a table with the following:

    CREATE TABLE employee
    (Employe_id number (4,0) NOT NULL primary key,)
    L_Name varchar2 (15).
    What varchar2 (10),
    Number of Pay_Rate (5);

    Then tried to insert this: insert into employee
    values ('003', 'Clarke', 'Michael', '13 h 00');
    which has been a success, but when I used the query select it to display the table, the result was not the same

    result:
    Employee_id L_Name what Pay_Rate
    1 13 Michael Clarke


    How can I ensure that the result looks like this (001 and 13 h 00):
    Employee_id L_Name what Pay_Rate
    001 Micheal Clarke 13.00

    Edited by: 936867 may 25, 2012 20:15

    Edited by: 936867 may 25, 2012 20:18

    936867 wrote:
    Sorry, I wanted to ask "what needs to be changed in the create table statement, so when I introduced through the 'Insert into' data is presented as above after the select query. I want the data to show as entered when I look at the table, I know that can use the select query to display data in the desired format.

    Then do not define the columns as a NUMBER, but as strings of VARCHAR2,
    but realize that you can't do arithmetic on strings.

    NUMBERS have no beginning or ending zeros but bites can contain what you want.

  • round the decimal points

    Hello
    I have the folder with the 237.741343124473 value. When the user enters 237.7413431244, registration must return. I use the round function, but does not work as I want. There is another function that can be used to supplement the decimal points

    How it is possible, because in my previous response, I added a line even a value in the test table and now when I give:

    SQL> SELECT * FROM TEST WHERE TRIM(to_char(TRUNC(A, 12),'999.999999999999'))='237.741343124473';
    
             A
    ----------
    237.741343
    
    It is returning the row.  Now you question will be why it is not returning the whole value? so for that:
    
    SQL> SELECT to_char(a,'999.999999999999') FROM TEST WHERE TRIM(to_char(TRUNC(A, 12),'999.999999999999'))='237.741343124473';
    
    TO_CHAR(A,'999.99
    -----------------
     237.741343124473
    
    Means, you have to apply to_char function on the column.
    

    Play to_char, trunc functions; You can get your desired output.

    Concerning
    Girish Sharma

  • Problems of decimal Point with easy Excel Table VI and Excel 2007

    Hello

    We used the Excel simple table VI transfer to Excel 2002 LabView measurement data. Now, we have updated our Excel for Excel 2007. After that, there is something wrong at the time of the transfer of LabView to Excel. It seems that excel now ignore the decimal Point.

    Hi Martin,

    It is a known issue with LV, excel and the European regional settings.

    To work around the problem, do the following:

    To transfer the correct data to Excel, disconnected "use localized comma" in tools-> Frontpanel.

    You can use the "." instead of ',' when you enter numbers, for example "0.99" instead of "0.99".

    Stefan

  • When you use Excel or my Peachtree Accounting program, entered digital as "$152(32 in the accounting package or the same number with a square symbol as the decimal point in Excel.)". No idea what I should check first?

    When you use Excel or my Peachtree Accounting program, entered digital as "$152(32 in the accounting package or the same number with a square symbol as the decimal point in Excel.)".  No idea what I should check first?

    Thank you for visiting the website of Microsoft Windows Vista Community. The question you have posted is related to Office Excel and would be better suited to the office community. Please visit the link below to find a community that will support what ask you

    http://www.Microsoft.com/Office/Community/en-us/default.mspx?d=1

    Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Is it possible a 0 is displayed after the decimal point when the value is rounded? (I get: 20-20, 1;) "I need 20, 0-20, 1).

    Using the effect of text "cursor", I am able to view replace "30 ° C" "35.5 ° C". My question is: is it possible a 0 is displayed after the decimal point when the value is rounded? (I get: 20-20, 1;) "I need 20, 0-20, 1). I use this code:

    Temp = effect ("Slider Control") ("Slider");

    sliderValue = Math.round(temp*10)/10;

    [sliderValue + ' ° C ' "']

    Here is the solution:

    numDecimals = 1;

    Temp = effect ("Slider Control") ("Slider");

    sliderValue = (Math.round(temp*10)/10).toFixed(numDecimals);

    sliderValue + "° C";

  • Basic with yellow exclamation point features

    Hello

    My L412 supplied with Windows 7 Home Premium. I reinstalled Windows using a purchased Windows 7 ultimate DVD and I installed most of the software, but I still 3 devices basic system with yellow exclamation points on them.

    Here is a screenshot

    http://Tinypic.com/r/28j9loy/7

    Any ideas on how to fix?

    Try the driver of lenovo card reader

    http://www-307.IBM.com/PC/support/site.WSS/document.do?lndocid=MIGR-75277

  • Delete zero balances in calculated fields and zero decimal points

    Hello

    I found the right java script to remove the balances of zero in calculated fields, but also, so I have to remove the two decimal points.  Can I work on what I need to add and where in java script so that it works?

    Thank you

    Nicole

    If you don't want to show any decimal places, this means generally that you want to round down to an integer. To round to the nearest integer, you could modify a single line of script in the Format:

    AFNumber_Format (0, 0, 0, 0, "$", true);

    and the same for the script of the hit. Note that this does not change the actual value of the field, it doesn't change what is displayed in the field. This is important if the value of the field is used in a calculation or exported, since it won't be the same as what is displayed. To change the value of actual field to round to an integer, it is usually best to use a custom validation script.

  • May not know how to fix the bug of the decimal point in this calculator code

    Hi guys, I am new in flash and is currently learning how to build a simple calculator with multiplier (more, less, multiple, divide, change of sign and decimal point), but I'm stuck on the decimal point and change the sign.

    var multiplier_old:Number = 10;
    var multiplier_new:Number = 1;
    
    // .: Sets the multipliers so that new input numbers become decimals of a lower unit column
    action_point.addEventListener(MouseEvent.MOUSE_DOWN, function():void {
      
              multiplier_old = 1;
              multiplier_new = 0.1;
              point = true;
      
    });
    
    // Takes intput from the input_ buttons and adds it to the input after applying the multipliers.
    // If `point` is true then the multiplier_new is divided by 10, also as described.
    function inputNumber(n:Number):void {
      
              input = input * multiplier_old + n * multiplier_new;
      
                        if (point) {
                                        multiplier_new *= 0.1;
                       trace(multiplier_new);
                        }
      
              output_txt.text = input.toString();
    }
    

    Decimal point

    The problem is that when I entered 2.7 in the calculator, it displays the values in output_txt correctly. But then when I entered 2.78, it will display 2.780000000000000000000000002. This will happen also to other numbers if the entry is too large.

    What I want is just 2.78. How can I change the encodings make 2.780000000000000000000000002 2.78?

    Sign of change

    Any tips on how to start on this one?

    Thanks for your time,

    Kamel

    You must use rounded in order to keep the numbers down to limited decimal values.  To display specific decimal values using the String class toFixed() method when you write the text in the TextField.

    To change the sign, multiply by-1.

  • View all numbers with 2 decimal places.

    Hi all

    We have a requirement in our code where we want all numbers must be displayed to 2 decimal places.

    For example: If a number is 21.234 then it should be displayed as 21.23
    If a number is 21.289 then it should be displayed as 21,28
    If a number is 21 so it should be displayed as 21.00

    Can someone help me please how do in a SQL query.

    Kind regards
    Shruti

    Hi, Shruti,

    This shows a couple of things you can do:

    COLUMN     trnc     FORMAT     999999.99
    
    WITH     got_x     AS
    (
         SELECT     empno / 1000     AS x
         FROM     scott.emp
    )
    SELECT     x
    ,     TO_CHAR (x,            '999999.99')     AS tc
    ,     TO_CHAR (TRUNC (x, 2), '999999.99')     AS trnc_tc
    ,     TRUNC (x, 2)                              AS trnc
    FROM     got_x
    ;
    

    Output:

    `        X TC         TRNC_TC          TRNC
    ---------- ---------- ---------- ----------
         7.369       7.37       7.36       7.36
         7.499       7.50       7.49       7.49
         7.521       7.52       7.52       7.52
         7.566       7.57       7.56       7.56
         7.654       7.65       7.65       7.65
         7.698       7.70       7.69       7.69
         7.782       7.78       7.78       7.78
         7.788       7.79       7.78       7.78
         7.839       7.84       7.83       7.83
         7.844       7.84       7.84       7.84
         7.876       7.88       7.87       7.87
           7.9       7.90       7.90       7.90
         7.902       7.90       7.90       7.90
         7.934       7.93       7.93       7.93
    

    Column x is the number, such as SQL * more it displays by default. Note there is as many digits after the decimal point are needed.
    TC column shows how TO_CHAR can put in shape the number with exactly 2 digits after the decimal point. This automatically rounds the number nearest multiple de.01, so on the first line (for example) 7.369 gets displayed as 7.37.

    user11272043 wrote:
    ... If a number is 21.289 then it should be displayed as 21,28

    You (apparently) still want the number rounded to 0, then the tc column isn't quite what you want.
    Column trnc_tc is exactly what you asked for, with the number rounded to 0 (when a rouning is possible) and 2 digits after the decimal point.
    TC column is also exactly what you asked, but he uses the language SQL * Plus formatting rather than SQL. In addition, TRNC column is a NUMBER, while the column trnc_tc is a VARCHAR2, because TO_CHAR, as its name implies, returns a VARCHAR2.

    SQL * more order

    SET   NUMFORMAT  999999.99
    

    change the default format for all the number of columns. If you use it, you can ignore it for individual columns using TO_CHAR (since it returns a VARCHAR2, the FORMATNUM does not apply), or an order of the COLUMN. Also, if you use the VALUE FORMATNUM 999999.99, you must still explicitly TRUNC each number, otherwise 21.289 will come out as 21.29, 21.28. not.

  • OBI, rounded to 2 decimal places

    I just created a simple application with a dumy column and a single column and gave the math in this column as 23/12, 6. The returned result is 1.83. Why the result is rounded to two decimal places?

    THX.

    Hi parag.

    OBIEE inwardly rounded to 2 decimal places... for the calculation you mentioned 23/12.6 gives you great something like 16-digit number after the decimal point.

    If you want to check with Select 23/12.6 double (GOLD)
    If you want to round your favorite decimal check with this query, select double round(23/12.6,5)

    Hope this helps you.

    By,.
    KK

    Published by: KK on October 21, 2010 23:15

  • RM-YD022 send any decimal point. What is the solution?

    RM-YD022 send any decimal point. What is the solution?

    Hello
    Welcome to the community of Sony.

    The button of the decimal point can be used with the number buttons 0-9 and press ENT to select digital channels. For example, to enter in 5.1, press [5] [.] [1] and ENT.
    The television receives digital channels?

Maybe you are looking for